2016-07-15 09:06:43

by Alex Briskin

[permalink] [raw]
Subject: [PATCH 1/4 v2 iface_work] New function ieee80211_is_skb_handled_by_pkt_type

Split ieee80211_iface_work in two. Moved part of a code that checks
pkt_type.

Signed-off-by: Alex Briskin <[email protected]>
---
net/mac80211/iface.c | 75 +++++++++++++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 30 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index c59af3e..a68cbac 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1198,6 +1198,48 @@ static void ieee80211_if_setup(struct net_device *dev)
dev->destructor = ieee80211_if_free;
}

+static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
+ struct ieee80211_sub_if_data
+ *sdata)
+{
+ struct ieee80211_ra_tid *ra_tid;
+ struct ieee80211_rx_agg *rx_agg;
+ struct ieee80211_local *local = sdata->local;
+ struct sta_info *sta;
+
+ if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
+ ra_tid = (void *)&skb->cb;
+ ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
+ } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
+ ra_tid = (void *)&skb->cb;
+ ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
+ } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
+ rx_agg = (void *)&skb->cb;
+ mutex_lock(&local->sta_mtx);
+ sta = sta_info_get_bss(sdata, rx_agg->addr);
+ if (sta)
+ __ieee80211_start_rx_ba_session(sta,
+ 0, 0, 0, 1, rx_agg->tid,
+ IEEE80211_MAX_AMPDU_BUF,
+ false, true);
+ mutex_unlock(&local->sta_mtx);
+ } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
+ rx_agg = (void *)&skb->cb;
+ mutex_lock(&local->sta_mtx);
+ sta = sta_info_get_bss(sdata, rx_agg->addr);
+ if (sta)
+ __ieee80211_stop_rx_ba_session(sta,
+ rx_agg->tid,
+ WLAN_BACK_RECIPIENT, 0,
+ false);
+ mutex_unlock(&local->sta_mtx);
+ } else {
+ return false;
+ }
+ /*will return true if pkt_type found and handled */
+ return true;
+}
+
static void ieee80211_iface_work(struct work_struct *work)
{
struct ieee80211_sub_if_data *sdata =
@@ -1205,8 +1247,6 @@ static void ieee80211_iface_work(struct work_struct *work)
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
struct sta_info *sta;
- struct ieee80211_ra_tid *ra_tid;
- struct ieee80211_rx_agg *rx_agg;

if (!ieee80211_sdata_running(sdata))
return;
@@ -1221,34 +1261,8 @@ static void ieee80211_iface_work(struct work_struct *work)
while ((skb = skb_dequeue(&sdata->skb_queue))) {
struct ieee80211_mgmt *mgmt = (void *)skb->data;

- if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
- ra_tid = (void *)&skb->cb;
- ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra,
- ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
- ra_tid = (void *)&skb->cb;
- ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra,
- ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
- rx_agg = (void *)&skb->cb;
- mutex_lock(&local->sta_mtx);
- sta = sta_info_get_bss(sdata, rx_agg->addr);
- if (sta)
- __ieee80211_start_rx_ba_session(sta,
- 0, 0, 0, 1, rx_agg->tid,
- IEEE80211_MAX_AMPDU_BUF,
- false, true);
- mutex_unlock(&local->sta_mtx);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
- rx_agg = (void *)&skb->cb;
- mutex_lock(&local->sta_mtx);
- sta = sta_info_get_bss(sdata, rx_agg->addr);
- if (sta)
- __ieee80211_stop_rx_ba_session(sta,
- rx_agg->tid,
- WLAN_BACK_RECIPIENT, 0,
- false);
- mutex_unlock(&local->sta_mtx);
+ if (ieee80211_is_skb_handled_by_pkt_type(skb, sdata)) {
+ goto free_skb;
} else if (ieee80211_is_action(mgmt->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK) {
int len = skb->len;
@@ -1333,6 +1347,7 @@ static void ieee80211_iface_work(struct work_struct *work)
break;
}

+free_skb:
kfree_skb(skb);
}

--
2.5.0



2016-07-15 09:06:47

by Alex Briskin

[permalink] [raw]
Subject: [PATCH 3/4 v2 iface_work] Simple and well understood logic

Now the logic is obvious - if skb not handled by pkt type and not handled
by frame control it is handled by vif type and then released

Signed-off-by: Alex Briskin <[email protected]>
---
net/mac80211/iface.c | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 7756eec..6f55901 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1324,6 +1324,27 @@ static bool ieee80211_is_handled_by_frame_control(struct sk_buff *skb,
return true;
}

+static void ieee80211_handle_by_vif_type(struct sk_buff *skb,
+ struct ieee80211_sub_if_data *sdata)
+{
+ switch (sdata->vif.type) {
+ case NL80211_IFTYPE_STATION:
+ ieee80211_sta_rx_queued_mgmt(sdata, skb);
+ break;
+ case NL80211_IFTYPE_ADHOC:
+ ieee80211_ibss_rx_queued_mgmt(sdata, skb);
+ break;
+ case NL80211_IFTYPE_MESH_POINT:
+ if (!ieee80211_vif_is_mesh(&sdata->vif))
+ break;
+ ieee80211_mesh_rx_queued_mgmt(sdata, skb);
+ break;
+ default:
+ WARN(1, "frame for unexpected interface type");
+ break;
+ }
+}
+
static void ieee80211_iface_work(struct work_struct *work)
{
struct ieee80211_sub_if_data *sdata =
@@ -1342,28 +1363,11 @@ static void ieee80211_iface_work(struct work_struct *work)

/* first process frames */
while ((skb = skb_dequeue(&sdata->skb_queue))) {
- if (ieee80211_is_skb_handled_by_pkt_type(skb, sdata)) {
- goto free_skb;
- } else if (ieee80211_is_handled_by_frame_control(skb, sdata)) {
- goto free_skb;
- } else switch (sdata->vif.type) {
- case NL80211_IFTYPE_STATION:
- ieee80211_sta_rx_queued_mgmt(sdata, skb);
- break;
- case NL80211_IFTYPE_ADHOC:
- ieee80211_ibss_rx_queued_mgmt(sdata, skb);
- break;
- case NL80211_IFTYPE_MESH_POINT:
- if (!ieee80211_vif_is_mesh(&sdata->vif))
- break;
- ieee80211_mesh_rx_queued_mgmt(sdata, skb);
- break;
- default:
- WARN(1, "frame for unexpected interface type");
- break;
+ if (!ieee80211_is_skb_handled_by_pkt_type(skb, sdata) &&
+ !ieee80211_is_handled_by_frame_control(skb, sdata)) {
+ ieee80211_handle_by_vif_type(skb, sdata);
}

-free_skb:
kfree_skb(skb);
}

--
2.5.0


2016-07-15 13:30:49

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 4/4 v2 iface_work] Function renaming

Hi,

[auto build test ERROR on mac80211/master]
[also build test ERROR on v4.7-rc7]
[cannot apply to mac80211-next/master next-20160715]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alex-Briskin/New-function-ieee80211_is_skb_handled_by_pkt_type/20160715-195540
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git master
config: alpha-defconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha

All error/warnings (new ones prefixed by >>):

>> net/mac80211/iface.c:1249:11: warning: 'struct ieee80211_sub_if_datai' declared inside parameter list
struct ieee80211_sub_if_datai *sdata)
^
>> net/mac80211/iface.c:1249:11: warning: its scope is only this definition or declaration, which is probably not what you want
net/mac80211/iface.c: In function 'mac80211_is_skb_handled_by_frame_control':
>> net/mac80211/iface.c:1251:39: error: dereferencing pointer to incomplete type 'struct ieee80211_sub_if_datai'
struct ieee80211_local *local = sdata->local;
^
>> net/mac80211/iface.c:1260:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^
>> net/mac80211/iface.c:1272:29: error: passing argument 1 of 'ieee80211_process_delba' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_delba(sdata, sta, mgmt, len);
^
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1700:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
^
>> net/mac80211/iface.c:1284:32: error: passing argument 1 of 'ieee80211_process_mu_groups' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_mu_groups(sdata, mgmt);
^
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1737:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
^
net/mac80211/iface.c:1309:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^
net/mac80211/iface.c: In function 'ieee80211_iface_work':
>> net/mac80211/iface.c:1366:54: error: passing argument 2 of 'mac80211_is_skb_handled_by_frame_control' from incompatible pointer type [-Werror=incompatible-pointer-types]
!mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
^
net/mac80211/iface.c:1248:13: note: expected 'struct ieee80211_sub_if_datai *' but argument is of type 'struct ieee80211_sub_if_data *'
static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
^
cc1: some warnings being treated as errors

vim +1251 net/mac80211/iface.c

4ea9593c0 Alex Briskin 2016-07-15 1243 }
4ea9593c0 Alex Briskin 2016-07-15 1244 /*will return true if pkt_type found and handled */
4ea9593c0 Alex Briskin 2016-07-15 1245 return true;
4ea9593c0 Alex Briskin 2016-07-15 1246 }
4ea9593c0 Alex Briskin 2016-07-15 1247
9ea4267a9 Alex Briskin 2016-07-15 1248 static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
9ea4267a9 Alex Briskin 2016-07-15 @1249 struct ieee80211_sub_if_datai *sdata)
4ea9593c0 Alex Briskin 2016-07-15 1250 {
4ea9593c0 Alex Briskin 2016-07-15 @1251 struct ieee80211_local *local = sdata->local;
4ea9593c0 Alex Briskin 2016-07-15 1252 struct sta_info *sta;
4ea9593c0 Alex Briskin 2016-07-15 1253 struct ieee80211_mgmt *mgmt = (void *)skb->data;
4ea9593c0 Alex Briskin 2016-07-15 1254
f10059ca6 Alex Briskin 2016-07-15 1255 if (ieee80211_is_action(mgmt->frame_control) &&
bed7ee6e4 Johannes Berg 2010-06-10 1256 mgmt->u.action.category == WLAN_CATEGORY_BACK) {
bed7ee6e4 Johannes Berg 2010-06-10 1257 int len = skb->len;
bed7ee6e4 Johannes Berg 2010-06-10 1258
a93e36443 Johannes Berg 2010-06-10 1259 mutex_lock(&local->sta_mtx);
875ae5f68 Felix Fietkau 2010-07-17 @1260 sta = sta_info_get_bss(sdata, mgmt->sa);
bed7ee6e4 Johannes Berg 2010-06-10 1261 if (sta) {
bed7ee6e4 Johannes Berg 2010-06-10 1262 switch (mgmt->u.action.u.addba_req.action_code) {
bed7ee6e4 Johannes Berg 2010-06-10 1263 case WLAN_ACTION_ADDBA_REQ:
f10059ca6 Alex Briskin 2016-07-15 1264 ieee80211_process_addba_request(local, sta,
f10059ca6 Alex Briskin 2016-07-15 1265 mgmt, len);
bed7ee6e4 Johannes Berg 2010-06-10 1266 break;
bed7ee6e4 Johannes Berg 2010-06-10 1267 case WLAN_ACTION_ADDBA_RESP:
bed7ee6e4 Johannes Berg 2010-06-10 1268 ieee80211_process_addba_resp(local, sta,
bed7ee6e4 Johannes Berg 2010-06-10 1269 mgmt, len);
bed7ee6e4 Johannes Berg 2010-06-10 1270 break;
bed7ee6e4 Johannes Berg 2010-06-10 1271 case WLAN_ACTION_DELBA:
f10059ca6 Alex Briskin 2016-07-15 @1272 ieee80211_process_delba(sdata, sta, mgmt, len);
bed7ee6e4 Johannes Berg 2010-06-10 1273 break;
bed7ee6e4 Johannes Berg 2010-06-10 1274 default:
bed7ee6e4 Johannes Berg 2010-06-10 1275 WARN_ON(1);
bed7ee6e4 Johannes Berg 2010-06-10 1276 break;
bed7ee6e4 Johannes Berg 2010-06-10 1277 }
bed7ee6e4 Johannes Berg 2010-06-10 1278 }
a93e36443 Johannes Berg 2010-06-10 1279 mutex_unlock(&local->sta_mtx);
23a1f8d44 Sara Sharon 2015-12-08 1280 } else if (ieee80211_is_action(mgmt->frame_control) &&
23a1f8d44 Sara Sharon 2015-12-08 1281 mgmt->u.action.category == WLAN_CATEGORY_VHT) {
23a1f8d44 Sara Sharon 2015-12-08 1282 switch (mgmt->u.action.u.vht_group_notif.action_code) {
23a1f8d44 Sara Sharon 2015-12-08 1283 case WLAN_VHT_ACTION_GROUPID_MGMT:
23a1f8d44 Sara Sharon 2015-12-08 @1284 ieee80211_process_mu_groups(sdata, mgmt);
23a1f8d44 Sara Sharon 2015-12-08 1285 break;
23a1f8d44 Sara Sharon 2015-12-08 1286 default:
23a1f8d44 Sara Sharon 2015-12-08 1287 WARN_ON(1);
23a1f8d44 Sara Sharon 2015-12-08 1288 break;
23a1f8d44 Sara Sharon 2015-12-08 1289 }
344eec67c Johannes Berg 2010-06-10 1290 } else if (ieee80211_is_data_qos(mgmt->frame_control)) {
344eec67c Johannes Berg 2010-06-10 1291 struct ieee80211_hdr *hdr = (void *)mgmt;
344eec67c Johannes Berg 2010-06-10 1292 /*
344eec67c Johannes Berg 2010-06-10 1293 * So the frame isn't mgmt, but frame_control
344eec67c Johannes Berg 2010-06-10 1294 * is at the right place anyway, of course, so
344eec67c Johannes Berg 2010-06-10 1295 * the if statement is correct.
344eec67c Johannes Berg 2010-06-10 1296 *
344eec67c Johannes Berg 2010-06-10 1297 * Warn if we have other data frame types here,
344eec67c Johannes Berg 2010-06-10 1298 * they must not get here.
344eec67c Johannes Berg 2010-06-10 1299 */
344eec67c Johannes Berg 2010-06-10 1300 WARN_ON(hdr->frame_control &
344eec67c Johannes Berg 2010-06-10 1301 cpu_to_le16(IEEE80211_STYPE_NULLFUNC));
f10059ca6 Alex Briskin 2016-07-15 1302 WARN_ON(!(hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)));
344eec67c Johannes Berg 2010-06-10 1303 /*
344eec67c Johannes Berg 2010-06-10 1304 * This was a fragment of a frame, received while
344eec67c Johannes Berg 2010-06-10 1305 * a block-ack session was active. That cannot be
344eec67c Johannes Berg 2010-06-10 1306 * right, so terminate the session.
344eec67c Johannes Berg 2010-06-10 1307 */
a93e36443 Johannes Berg 2010-06-10 1308 mutex_lock(&local->sta_mtx);
875ae5f68 Felix Fietkau 2010-07-17 @1309 sta = sta_info_get_bss(sdata, mgmt->sa);
344eec67c Johannes Berg 2010-06-10 1310 if (sta) {
344eec67c Johannes Berg 2010-06-10 1311 u16 tid = *ieee80211_get_qos_ctl(hdr) &
344eec67c Johannes Berg 2010-06-10 1312 IEEE80211_QOS_CTL_TID_MASK;
344eec67c Johannes Berg 2010-06-10 1313
f10059ca6 Alex Briskin 2016-07-15 1314 __ieee80211_stop_rx_ba_session(sta, tid,
f10059ca6 Alex Briskin 2016-07-15 1315 WLAN_BACK_RECIPIENT,
53f73c09d Johannes Berg 2010-10-05 1316 WLAN_REASON_QSTA_REQUIRE_SETUP,
53f73c09d Johannes Berg 2010-10-05 1317 true);
344eec67c Johannes Berg 2010-06-10 1318 }
a93e36443 Johannes Berg 2010-06-10 1319 mutex_unlock(&local->sta_mtx);
f10059ca6 Alex Briskin 2016-07-15 1320 } else {
f10059ca6 Alex Briskin 2016-07-15 1321 return false;
f10059ca6 Alex Briskin 2016-07-15 1322 }
f10059ca6 Alex Briskin 2016-07-15 1323 return true;
f10059ca6 Alex Briskin 2016-07-15 1324 }
f10059ca6 Alex Briskin 2016-07-15 1325
9ea4267a9 Alex Briskin 2016-07-15 1326 static void mac80211_skb_handle_by_vif_type(struct sk_buff *skb,
698f121a4 Alex Briskin 2016-07-15 1327 struct ieee80211_sub_if_data *sdata)
698f121a4 Alex Briskin 2016-07-15 1328 {
698f121a4 Alex Briskin 2016-07-15 1329 switch (sdata->vif.type) {
698f121a4 Alex Briskin 2016-07-15 1330 case NL80211_IFTYPE_STATION:
698f121a4 Alex Briskin 2016-07-15 1331 ieee80211_sta_rx_queued_mgmt(sdata, skb);
698f121a4 Alex Briskin 2016-07-15 1332 break;
698f121a4 Alex Briskin 2016-07-15 1333 case NL80211_IFTYPE_ADHOC:
698f121a4 Alex Briskin 2016-07-15 1334 ieee80211_ibss_rx_queued_mgmt(sdata, skb);
698f121a4 Alex Briskin 2016-07-15 1335 break;
698f121a4 Alex Briskin 2016-07-15 1336 case NL80211_IFTYPE_MESH_POINT:
698f121a4 Alex Briskin 2016-07-15 1337 if (!ieee80211_vif_is_mesh(&sdata->vif))
698f121a4 Alex Briskin 2016-07-15 1338 break;
698f121a4 Alex Briskin 2016-07-15 1339 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
698f121a4 Alex Briskin 2016-07-15 1340 break;
698f121a4 Alex Briskin 2016-07-15 1341 default:
698f121a4 Alex Briskin 2016-07-15 1342 WARN(1, "frame for unexpected interface type");
698f121a4 Alex Briskin 2016-07-15 1343 break;
698f121a4 Alex Briskin 2016-07-15 1344 }
698f121a4 Alex Briskin 2016-07-15 1345 }
698f121a4 Alex Briskin 2016-07-15 1346
f10059ca6 Alex Briskin 2016-07-15 1347 static void ieee80211_iface_work(struct work_struct *work)
f10059ca6 Alex Briskin 2016-07-15 1348 {
f10059ca6 Alex Briskin 2016-07-15 1349 struct ieee80211_sub_if_data *sdata =
f10059ca6 Alex Briskin 2016-07-15 1350 container_of(work, struct ieee80211_sub_if_data, work);
f10059ca6 Alex Briskin 2016-07-15 1351 struct ieee80211_local *local = sdata->local;
f10059ca6 Alex Briskin 2016-07-15 1352 struct sk_buff *skb;
f10059ca6 Alex Briskin 2016-07-15 1353
f10059ca6 Alex Briskin 2016-07-15 1354 if (!ieee80211_sdata_running(sdata))
f10059ca6 Alex Briskin 2016-07-15 1355 return;
f10059ca6 Alex Briskin 2016-07-15 1356
f10059ca6 Alex Briskin 2016-07-15 1357 if (test_bit(SCAN_SW_SCANNING, &local->scanning))
f10059ca6 Alex Briskin 2016-07-15 1358 return;
f10059ca6 Alex Briskin 2016-07-15 1359
f10059ca6 Alex Briskin 2016-07-15 1360 if (!ieee80211_can_run_worker(local))
f10059ca6 Alex Briskin 2016-07-15 1361 return;
f10059ca6 Alex Briskin 2016-07-15 1362
f10059ca6 Alex Briskin 2016-07-15 1363 /* first process frames */
f10059ca6 Alex Briskin 2016-07-15 1364 while ((skb = skb_dequeue(&sdata->skb_queue))) {
9ea4267a9 Alex Briskin 2016-07-15 1365 if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
9ea4267a9 Alex Briskin 2016-07-15 @1366 !mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
9ea4267a9 Alex Briskin 2016-07-15 1367 mac80211_skb_handle_by_vif_type(skb, sdata);
1fa57d017 Johannes Berg 2010-06-10 1368 }
36b3a628a Johannes Berg 2010-06-10 1369

:::::: The code at line 1251 was first introduced by commit
:::::: 4ea9593c0fc996ef6869e82aefc22a58ee6186f7 New function ieee80211_is_skb_handled_by_pkt_type

:::::: TO: Alex Briskin <[email protected]>
:::::: CC: 0day robot <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (13.18 kB)
.config.gz (12.04 kB)
Download all attachments

2016-07-15 13:34:47

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 4/4 v2 iface_work] Function renaming

Hi,

[auto build test WARNING on mac80211/master]
[also build test WARNING on v4.7-rc7]
[cannot apply to mac80211-next/master next-20160715]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alex-Briskin/New-function-ieee80211_is_skb_handled_by_pkt_type/20160715-195540
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git master
config: i386-randconfig-s1-201628 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

>> net/mac80211/iface.c:1249:11: warning: 'struct ieee80211_sub_if_datai' declared inside parameter list will not be visible outside of this definition or declaration
struct ieee80211_sub_if_datai *sdata)
^~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c: In function 'mac80211_is_skb_handled_by_frame_control':
net/mac80211/iface.c:1251:39: error: dereferencing pointer to incomplete type 'struct ieee80211_sub_if_datai'
struct ieee80211_local *local = sdata->local;
^~
net/mac80211/iface.c:1260:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^~~~~
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~
net/mac80211/iface.c:1272:29: error: passing argument 1 of 'ieee80211_process_delba' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_delba(sdata, sta, mgmt, len);
^~~~~
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1700:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c:1284:32: error: passing argument 1 of 'ieee80211_process_mu_groups' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_mu_groups(sdata, mgmt);
^~~~~
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1737:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c:1309:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^~~~~
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~
net/mac80211/iface.c: In function 'ieee80211_iface_work':
net/mac80211/iface.c:1366:54: error: passing argument 2 of 'mac80211_is_skb_handled_by_frame_control' from incompatible pointer type [-Werror=incompatible-pointer-types]
!mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
^~~~~
net/mac80211/iface.c:1248:13: note: expected 'struct ieee80211_sub_if_datai *' but argument is of type 'struct ieee80211_sub_if_data *'
static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +1249 net/mac80211/iface.c

1233 sta = sta_info_get_bss(sdata, rx_agg->addr);
1234 if (sta)
1235 __ieee80211_stop_rx_ba_session(sta,
1236 rx_agg->tid,
1237 WLAN_BACK_RECIPIENT, 0,
1238 false);
1239 mutex_unlock(&local->sta_mtx);
1240 break;
1241 default:
1242 return false;
1243 }
1244 /*will return true if pkt_type found and handled */
1245 return true;
1246 }
1247
1248 static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
> 1249 struct ieee80211_sub_if_datai *sdata)
1250 {
1251 struct ieee80211_local *local = sdata->local;
1252 struct sta_info *sta;
1253 struct ieee80211_mgmt *mgmt = (void *)skb->data;
1254
1255 if (ieee80211_is_action(mgmt->frame_control) &&
1256 mgmt->u.action.category == WLAN_CATEGORY_BACK) {
1257 int len = skb->len;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (5.13 kB)
.config.gz (22.01 kB)
Download all attachments

2016-07-15 09:06:44

by Alex Briskin

[permalink] [raw]
Subject: [PATCH 2/4 v2 iface_work] Further improve radabilty

Refactor ieee80211_is_skb_handled_by_pkt_typ
Add ieee80211_is_handled_by_frame_control

Signed-off-by: Alex Briskin <[email protected]>
---
net/mac80211/iface.c | 166 ++++++++++++++++++++++++++++-----------------------
1 file changed, 91 insertions(+), 75 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index a68cbac..7756eec 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1207,13 +1207,16 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;

- if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
+ switch (skb->pkt_type) {
+ case IEEE80211_SDATA_QUEUE_AGG_START:
ra_tid = (void *)&skb->cb;
ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
+ break;
+ case IEEE80211_SDATA_QUEUE_AGG_STOP:
ra_tid = (void *)&skb->cb;
ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
+ break;
+ case IEEE80211_SDATA_QUEUE_RX_AGG_START:
rx_agg = (void *)&skb->cb;
mutex_lock(&local->sta_mtx);
sta = sta_info_get_bss(sdata, rx_agg->addr);
@@ -1223,7 +1226,8 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
IEEE80211_MAX_AMPDU_BUF,
false, true);
mutex_unlock(&local->sta_mtx);
- } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
+ break;
+ case IEEE80211_SDATA_QUEUE_RX_AGG_STOP:
rx_agg = (void *)&skb->cb;
mutex_lock(&local->sta_mtx);
sta = sta_info_get_bss(sdata, rx_agg->addr);
@@ -1233,20 +1237,99 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
WLAN_BACK_RECIPIENT, 0,
false);
mutex_unlock(&local->sta_mtx);
- } else {
+ break;
+ default:
return false;
}
/*will return true if pkt_type found and handled */
return true;
}

+static bool ieee80211_is_handled_by_frame_control(struct sk_buff *skb,
+ struct ieee80211_sub_if_data
+ *sdata)
+{
+ struct ieee80211_local *local = sdata->local;
+ struct sta_info *sta;
+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
+
+ if (ieee80211_is_action(mgmt->frame_control) &&
+ mgmt->u.action.category == WLAN_CATEGORY_BACK) {
+ int len = skb->len;
+
+ mutex_lock(&local->sta_mtx);
+ sta = sta_info_get_bss(sdata, mgmt->sa);
+ if (sta) {
+ switch (mgmt->u.action.u.addba_req.action_code) {
+ case WLAN_ACTION_ADDBA_REQ:
+ ieee80211_process_addba_request(local, sta,
+ mgmt, len);
+ break;
+ case WLAN_ACTION_ADDBA_RESP:
+ ieee80211_process_addba_resp(local, sta,
+ mgmt, len);
+ break;
+ case WLAN_ACTION_DELBA:
+ ieee80211_process_delba(sdata, sta, mgmt, len);
+ break;
+ default:
+ WARN_ON(1);
+ break;
+ }
+ }
+ mutex_unlock(&local->sta_mtx);
+ } else if (ieee80211_is_action(mgmt->frame_control) &&
+ mgmt->u.action.category == WLAN_CATEGORY_VHT) {
+ switch (mgmt->u.action.u.vht_group_notif.action_code) {
+ case WLAN_VHT_ACTION_GROUPID_MGMT:
+ ieee80211_process_mu_groups(sdata, mgmt);
+ break;
+ default:
+ WARN_ON(1);
+ break;
+ }
+ } else if (ieee80211_is_data_qos(mgmt->frame_control)) {
+ struct ieee80211_hdr *hdr = (void *)mgmt;
+ /*
+ * So the frame isn't mgmt, but frame_control
+ * is at the right place anyway, of course, so
+ * the if statement is correct.
+ *
+ * Warn if we have other data frame types here,
+ * they must not get here.
+ */
+ WARN_ON(hdr->frame_control &
+ cpu_to_le16(IEEE80211_STYPE_NULLFUNC));
+ WARN_ON(!(hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)));
+ /*
+ * This was a fragment of a frame, received while
+ * a block-ack session was active. That cannot be
+ * right, so terminate the session.
+ */
+ mutex_lock(&local->sta_mtx);
+ sta = sta_info_get_bss(sdata, mgmt->sa);
+ if (sta) {
+ u16 tid = *ieee80211_get_qos_ctl(hdr) &
+ IEEE80211_QOS_CTL_TID_MASK;
+
+ __ieee80211_stop_rx_ba_session(sta, tid,
+ WLAN_BACK_RECIPIENT,
+ WLAN_REASON_QSTA_REQUIRE_SETUP,
+ true);
+ }
+ mutex_unlock(&local->sta_mtx);
+ } else {
+ return false;
+ }
+ return true;
+}
+
static void ieee80211_iface_work(struct work_struct *work)
{
struct ieee80211_sub_if_data *sdata =
container_of(work, struct ieee80211_sub_if_data, work);
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
- struct sta_info *sta;

if (!ieee80211_sdata_running(sdata))
return;
@@ -1259,77 +1342,10 @@ static void ieee80211_iface_work(struct work_struct *work)

/* first process frames */
while ((skb = skb_dequeue(&sdata->skb_queue))) {
- struct ieee80211_mgmt *mgmt = (void *)skb->data;
-
if (ieee80211_is_skb_handled_by_pkt_type(skb, sdata)) {
goto free_skb;
- } else if (ieee80211_is_action(mgmt->frame_control) &&
- mgmt->u.action.category == WLAN_CATEGORY_BACK) {
- int len = skb->len;
-
- mutex_lock(&local->sta_mtx);
- sta = sta_info_get_bss(sdata, mgmt->sa);
- if (sta) {
- switch (mgmt->u.action.u.addba_req.action_code) {
- case WLAN_ACTION_ADDBA_REQ:
- ieee80211_process_addba_request(
- local, sta, mgmt, len);
- break;
- case WLAN_ACTION_ADDBA_RESP:
- ieee80211_process_addba_resp(local, sta,
- mgmt, len);
- break;
- case WLAN_ACTION_DELBA:
- ieee80211_process_delba(sdata, sta,
- mgmt, len);
- break;
- default:
- WARN_ON(1);
- break;
- }
- }
- mutex_unlock(&local->sta_mtx);
- } else if (ieee80211_is_action(mgmt->frame_control) &&
- mgmt->u.action.category == WLAN_CATEGORY_VHT) {
- switch (mgmt->u.action.u.vht_group_notif.action_code) {
- case WLAN_VHT_ACTION_GROUPID_MGMT:
- ieee80211_process_mu_groups(sdata, mgmt);
- break;
- default:
- WARN_ON(1);
- break;
- }
- } else if (ieee80211_is_data_qos(mgmt->frame_control)) {
- struct ieee80211_hdr *hdr = (void *)mgmt;
- /*
- * So the frame isn't mgmt, but frame_control
- * is at the right place anyway, of course, so
- * the if statement is correct.
- *
- * Warn if we have other data frame types here,
- * they must not get here.
- */
- WARN_ON(hdr->frame_control &
- cpu_to_le16(IEEE80211_STYPE_NULLFUNC));
- WARN_ON(!(hdr->seq_ctrl &
- cpu_to_le16(IEEE80211_SCTL_FRAG)));
- /*
- * This was a fragment of a frame, received while
- * a block-ack session was active. That cannot be
- * right, so terminate the session.
- */
- mutex_lock(&local->sta_mtx);
- sta = sta_info_get_bss(sdata, mgmt->sa);
- if (sta) {
- u16 tid = *ieee80211_get_qos_ctl(hdr) &
- IEEE80211_QOS_CTL_TID_MASK;
-
- __ieee80211_stop_rx_ba_session(
- sta, tid, WLAN_BACK_RECIPIENT,
- WLAN_REASON_QSTA_REQUIRE_SETUP,
- true);
- }
- mutex_unlock(&local->sta_mtx);
+ } else if (ieee80211_is_handled_by_frame_control(skb, sdata)) {
+ goto free_skb;
} else switch (sdata->vif.type) {
case NL80211_IFTYPE_STATION:
ieee80211_sta_rx_queued_mgmt(sdata, skb);
--
2.5.0


2016-07-15 14:02:43

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 4/4 v2 iface_work] Function renaming

Hi,

[auto build test WARNING on mac80211/master]
[also build test WARNING on v4.7-rc7]
[cannot apply to mac80211-next/master next-20160715]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alex-Briskin/New-function-ieee80211_is_skb_handled_by_pkt_type/20160715-195540
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git master
config: x86_64-randconfig-i0-201628 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

net/mac80211/iface.c:1249:11: warning: 'struct ieee80211_sub_if_datai' declared inside parameter list will not be visible outside of this definition or declaration
struct ieee80211_sub_if_datai *sdata)
^~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c: In function 'mac80211_is_skb_handled_by_frame_control':
net/mac80211/iface.c:1251:39: error: dereferencing pointer to incomplete type 'struct ieee80211_sub_if_datai'
struct ieee80211_local *local = sdata->local;
^~
net/mac80211/iface.c:1260:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^~~~~
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~
net/mac80211/iface.c:1272:29: error: passing argument 1 of 'ieee80211_process_delba' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_delba(sdata, sta, mgmt, len);
^~~~~
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1700:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c:1284:32: error: passing argument 1 of 'ieee80211_process_mu_groups' from incompatible pointer type [-Werror=incompatible-pointer-types]
ieee80211_process_mu_groups(sdata, mgmt);
^~~~~
In file included from net/mac80211/iface.c:21:0:
net/mac80211/ieee80211_i.h:1737:6: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mac80211/iface.c:1309:26: error: passing argument 1 of 'sta_info_get_bss' from incompatible pointer type [-Werror=incompatible-pointer-types]
sta = sta_info_get_bss(sdata, mgmt->sa);
^~~~~
In file included from net/mac80211/ieee80211_i.h:34:0,
from net/mac80211/iface.c:21:
net/mac80211/sta_info.h:644:18: note: expected 'struct ieee80211_sub_if_data *' but argument is of type 'struct ieee80211_sub_if_datai *'
struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
^~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:4:0,
from arch/x86/include/asm/bug.h:35,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/gfp.h:4,
from include/linux/slab.h:14,
from net/mac80211/iface.c:14:
net/mac80211/iface.c: In function 'ieee80211_iface_work':
net/mac80211/iface.c:1366:54: error: passing argument 2 of 'mac80211_is_skb_handled_by_frame_control' from incompatible pointer type [-Werror=incompatible-pointer-types]
!mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
^
include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> net/mac80211/iface.c:1365:3: note: in expansion of macro 'if'
if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
^~
net/mac80211/iface.c:1248:13: note: expected 'struct ieee80211_sub_if_datai *' but argument is of type 'struct ieee80211_sub_if_data *'
static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:4:0,
from arch/x86/include/asm/bug.h:35,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/gfp.h:4,
from include/linux/slab.h:14,
from net/mac80211/iface.c:14:
net/mac80211/iface.c:1366:54: error: passing argument 2 of 'mac80211_is_skb_handled_by_frame_control' from incompatible pointer type [-Werror=incompatible-pointer-types]
!mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
^
include/linux/compiler.h:151:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> net/mac80211/iface.c:1365:3: note: in expansion of macro 'if'
if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
^~
net/mac80211/iface.c:1248:13: note: expected 'struct ieee80211_sub_if_datai *' but argument is of type 'struct ieee80211_sub_if_data *'
static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/asm-generic/bug.h:4:0,
from arch/x86/include/asm/bug.h:35,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/gfp.h:4,
from include/linux/slab.h:14,
from net/mac80211/iface.c:14:
net/mac80211/iface.c:1366:54: error: passing argument 2 of 'mac80211_is_skb_handled_by_frame_control' from incompatible pointer type [-Werror=incompatible-pointer-types]
!mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
^
include/linux/compiler.h:162:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
>> net/mac80211/iface.c:1365:3: note: in expansion of macro 'if'
if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
^~
net/mac80211/iface.c:1248:13: note: expected 'struct ieee80211_sub_if_datai *' but argument is of type 'struct ieee80211_sub_if_data *'
static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/if +1365 net/mac80211/iface.c

1349 struct ieee80211_sub_if_data *sdata =
1350 container_of(work, struct ieee80211_sub_if_data, work);
1351 struct ieee80211_local *local = sdata->local;
1352 struct sk_buff *skb;
1353
1354 if (!ieee80211_sdata_running(sdata))
1355 return;
1356
1357 if (test_bit(SCAN_SW_SCANNING, &local->scanning))
1358 return;
1359
1360 if (!ieee80211_can_run_worker(local))
1361 return;
1362
1363 /* first process frames */
1364 while ((skb = skb_dequeue(&sdata->skb_queue))) {
> 1365 if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
1366 !mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
1367 mac80211_skb_handle_by_vif_type(skb, sdata);
1368 }
1369
1370 kfree_skb(skb);
1371 }
1372
1373 /* then other type-dependent work */

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (8.15 kB)
.config.gz (24.37 kB)
Download all attachments

2016-07-15 09:06:49

by Alex Briskin

[permalink] [raw]
Subject: [PATCH 4/4 v2 iface_work] Function renaming

Replace iee80211 prefix with mac80211 prefix as it affects mac80211
only.

* Was unable to fit mac80211_is_skb_handled_by_frame_control function
signature into 80 char. line, compromised on parenthesis alignment.

Signed-off-by: Alex Briskin <[email protected]>
---
net/mac80211/iface.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 6f55901..bd376e8 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1198,9 +1198,9 @@ static void ieee80211_if_setup(struct net_device *dev)
dev->destructor = ieee80211_if_free;
}

-static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
- struct ieee80211_sub_if_data
- *sdata)
+static bool mac80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
+ struct ieee80211_sub_if_data
+ *sdata)
{
struct ieee80211_ra_tid *ra_tid;
struct ieee80211_rx_agg *rx_agg;
@@ -1245,9 +1245,8 @@ static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
return true;
}

-static bool ieee80211_is_handled_by_frame_control(struct sk_buff *skb,
- struct ieee80211_sub_if_data
- *sdata)
+static bool mac80211_is_skb_handled_by_frame_control(struct sk_buff *skb,
+ struct ieee80211_sub_if_datai *sdata)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
@@ -1324,8 +1323,8 @@ static bool ieee80211_is_handled_by_frame_control(struct sk_buff *skb,
return true;
}

-static void ieee80211_handle_by_vif_type(struct sk_buff *skb,
- struct ieee80211_sub_if_data *sdata)
+static void mac80211_skb_handle_by_vif_type(struct sk_buff *skb,
+ struct ieee80211_sub_if_data *sdata)
{
switch (sdata->vif.type) {
case NL80211_IFTYPE_STATION:
@@ -1363,9 +1362,9 @@ static void ieee80211_iface_work(struct work_struct *work)

/* first process frames */
while ((skb = skb_dequeue(&sdata->skb_queue))) {
- if (!ieee80211_is_skb_handled_by_pkt_type(skb, sdata) &&
- !ieee80211_is_handled_by_frame_control(skb, sdata)) {
- ieee80211_handle_by_vif_type(skb, sdata);
+ if (!mac80211_is_skb_handled_by_pkt_type(skb, sdata) &&
+ !mac80211_is_skb_handled_by_frame_control(skb, sdata)) {
+ mac80211_skb_handle_by_vif_type(skb, sdata);
}

kfree_skb(skb);
--
2.5.0


2016-07-15 09:32:18

by Arend Van Spriel

[permalink] [raw]
Subject: Re: [PATCH 1/4 v2 iface_work] New function ieee80211_is_skb_handled_by_pkt_type

On 15-7-2016 11:06, Alex Briskin wrote:
> Split ieee80211_iface_work in two. Moved part of a code that checks
> pkt_type.

As mentioned before the subject of the patches should use "mac80211: "
prefix. So:

[PATCH 1/4 v2] mac80211: New function ieee80211_is_skb_handled_by_pkt_type

So I did not mean you should rename function from ieee80211_... to
mac80211_...

Another thing is that a lot of people skim the repository using 'git log
--oneline' to find a commit (unless they use git blame first) so it
would be great to have the subject line summarize the patch intent in a
meaningful manner. Using generic terms like "Further improve radability"
does not really help.

My comment from the initial patch series on the function names is that
it would be better to be consistent and reflect it is used in iface_work
context, eg. ieee80211_iface_Work_handle_pkt_type,
ieee80211_iface_Work_handle_frame_control, and
ieee80211_iface_Work_handle_vif_type.

Regards,
Arend

> Signed-off-by: Alex Briskin <[email protected]>
> ---
> net/mac80211/iface.c | 75 +++++++++++++++++++++++++++++++---------------------
> 1 file changed, 45 insertions(+), 30 deletions(-)
>
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index c59af3e..a68cbac 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -1198,6 +1198,48 @@ static void ieee80211_if_setup(struct net_device *dev)
> dev->destructor = ieee80211_if_free;
> }
>
> +static bool ieee80211_is_skb_handled_by_pkt_type(struct sk_buff *skb,
> + struct ieee80211_sub_if_data
> + *sdata)
> +{
> + struct ieee80211_ra_tid *ra_tid;
> + struct ieee80211_rx_agg *rx_agg;
> + struct ieee80211_local *local = sdata->local;
> + struct sta_info *sta;
> +
> + if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
> + ra_tid = (void *)&skb->cb;
> + ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
> + } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
> + ra_tid = (void *)&skb->cb;
> + ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, ra_tid->tid);
> + } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
> + rx_agg = (void *)&skb->cb;
> + mutex_lock(&local->sta_mtx);
> + sta = sta_info_get_bss(sdata, rx_agg->addr);
> + if (sta)
> + __ieee80211_start_rx_ba_session(sta,
> + 0, 0, 0, 1, rx_agg->tid,
> + IEEE80211_MAX_AMPDU_BUF,
> + false, true);
> + mutex_unlock(&local->sta_mtx);
> + } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
> + rx_agg = (void *)&skb->cb;
> + mutex_lock(&local->sta_mtx);
> + sta = sta_info_get_bss(sdata, rx_agg->addr);
> + if (sta)
> + __ieee80211_stop_rx_ba_session(sta,
> + rx_agg->tid,
> + WLAN_BACK_RECIPIENT, 0,
> + false);
> + mutex_unlock(&local->sta_mtx);
> + } else {
> + return false;
> + }
> + /*will return true if pkt_type found and handled */
> + return true;
> +}
> +
> static void ieee80211_iface_work(struct work_struct *work)
> {
> struct ieee80211_sub_if_data *sdata =
> @@ -1205,8 +1247,6 @@ static void ieee80211_iface_work(struct work_struct *work)
> struct ieee80211_local *local = sdata->local;
> struct sk_buff *skb;
> struct sta_info *sta;
> - struct ieee80211_ra_tid *ra_tid;
> - struct ieee80211_rx_agg *rx_agg;
>
> if (!ieee80211_sdata_running(sdata))
> return;
> @@ -1221,34 +1261,8 @@ static void ieee80211_iface_work(struct work_struct *work)
> while ((skb = skb_dequeue(&sdata->skb_queue))) {
> struct ieee80211_mgmt *mgmt = (void *)skb->data;
>
> - if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) {
> - ra_tid = (void *)&skb->cb;
> - ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra,
> - ra_tid->tid);
> - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) {
> - ra_tid = (void *)&skb->cb;
> - ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra,
> - ra_tid->tid);
> - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) {
> - rx_agg = (void *)&skb->cb;
> - mutex_lock(&local->sta_mtx);
> - sta = sta_info_get_bss(sdata, rx_agg->addr);
> - if (sta)
> - __ieee80211_start_rx_ba_session(sta,
> - 0, 0, 0, 1, rx_agg->tid,
> - IEEE80211_MAX_AMPDU_BUF,
> - false, true);
> - mutex_unlock(&local->sta_mtx);
> - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_STOP) {
> - rx_agg = (void *)&skb->cb;
> - mutex_lock(&local->sta_mtx);
> - sta = sta_info_get_bss(sdata, rx_agg->addr);
> - if (sta)
> - __ieee80211_stop_rx_ba_session(sta,
> - rx_agg->tid,
> - WLAN_BACK_RECIPIENT, 0,
> - false);
> - mutex_unlock(&local->sta_mtx);
> + if (ieee80211_is_skb_handled_by_pkt_type(skb, sdata)) {
> + goto free_skb;
> } else if (ieee80211_is_action(mgmt->frame_control) &&
> mgmt->u.action.category == WLAN_CATEGORY_BACK) {
> int len = skb->len;
> @@ -1333,6 +1347,7 @@ static void ieee80211_iface_work(struct work_struct *work)
> break;
> }
>
> +free_skb:
> kfree_skb(skb);
> }
>
>