diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-07-27 09:43:22 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:47:30 -0400 |
commit | 8e6f003274147359ea612663048298823bed131f (patch) | |
tree | e1809de01cfc7f8281e9d1a900846472d4f9fdcd | |
parent | 6e0d114d52833449a4e40f6dc8582e88d0742be4 (diff) |
[MAC80211]: rx cleanups (1)
Make some really indented code more readable by outdenting.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/rx.c | 198 |
1 files changed, 101 insertions, 97 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c5a6bb200726..b46ba7c67453 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1079,21 +1079,24 @@ static inline ieee80211_txrx_result __ieee80211_invoke_rx_handlers( | |||
1079 | 1079 | ||
1080 | for (handler = handlers; *handler != NULL; handler++) { | 1080 | for (handler = handlers; *handler != NULL; handler++) { |
1081 | res = (*handler)(rx); | 1081 | res = (*handler)(rx); |
1082 | if (res != TXRX_CONTINUE) { | 1082 | |
1083 | if (res == TXRX_DROP) { | 1083 | switch (res) { |
1084 | I802_DEBUG_INC(local->rx_handlers_drop); | 1084 | case TXRX_CONTINUE: |
1085 | if (sta) | 1085 | continue; |
1086 | sta->rx_dropped++; | 1086 | case TXRX_DROP: |
1087 | } | 1087 | I802_DEBUG_INC(local->rx_handlers_drop); |
1088 | if (res == TXRX_QUEUED) | 1088 | if (sta) |
1089 | I802_DEBUG_INC(local->rx_handlers_queued); | 1089 | sta->rx_dropped++; |
1090 | break; | ||
1091 | case TXRX_QUEUED: | ||
1092 | I802_DEBUG_INC(local->rx_handlers_queued); | ||
1090 | break; | 1093 | break; |
1091 | } | 1094 | } |
1095 | break; | ||
1092 | } | 1096 | } |
1093 | 1097 | ||
1094 | if (res == TXRX_DROP) { | 1098 | if (res == TXRX_DROP) |
1095 | dev_kfree_skb(rx->skb); | 1099 | dev_kfree_skb(rx->skb); |
1096 | } | ||
1097 | return res; | 1100 | return res; |
1098 | } | 1101 | } |
1099 | 1102 | ||
@@ -1242,6 +1245,9 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1242 | u16 type; | 1245 | u16 type; |
1243 | int multicast; | 1246 | int multicast; |
1244 | int radiotap_len = 0; | 1247 | int radiotap_len = 0; |
1248 | struct ieee80211_sub_if_data *prev = NULL; | ||
1249 | struct sk_buff *skb_new; | ||
1250 | u8 *bssid; | ||
1245 | 1251 | ||
1246 | if (status->flag & RX_FLAG_RADIOTAP) { | 1252 | if (status->flag & RX_FLAG_RADIOTAP) { |
1247 | radiotap_len = ieee80211_get_radiotap_len(skb->data); | 1253 | radiotap_len = ieee80211_get_radiotap_len(skb->data); |
@@ -1289,108 +1295,106 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
1289 | rx.u.rx.ra_match = 1; | 1295 | rx.u.rx.ra_match = 1; |
1290 | ieee80211_invoke_rx_handlers(local, local->rx_handlers, &rx, | 1296 | ieee80211_invoke_rx_handlers(local, local->rx_handlers, &rx, |
1291 | sta); | 1297 | sta); |
1292 | } else { | 1298 | sta_info_put(sta); |
1293 | struct ieee80211_sub_if_data *prev = NULL; | 1299 | return; |
1294 | struct sk_buff *skb_new; | 1300 | } |
1295 | u8 *bssid = ieee80211_get_bssid(hdr, skb->len - radiotap_len); | 1301 | |
1296 | 1302 | bssid = ieee80211_get_bssid(hdr, skb->len - radiotap_len); | |
1297 | read_lock(&local->sub_if_lock); | 1303 | |
1298 | list_for_each_entry(sdata, &local->sub_if_list, list) { | 1304 | read_lock(&local->sub_if_lock); |
1299 | rx.u.rx.ra_match = 1; | 1305 | list_for_each_entry(sdata, &local->sub_if_list, list) { |
1300 | switch (sdata->type) { | 1306 | rx.u.rx.ra_match = 1; |
1301 | case IEEE80211_IF_TYPE_STA: | 1307 | switch (sdata->type) { |
1302 | if (!bssid) | 1308 | case IEEE80211_IF_TYPE_STA: |
1309 | if (!bssid) | ||
1310 | continue; | ||
1311 | if (!ieee80211_bssid_match(bssid, | ||
1312 | sdata->u.sta.bssid)) { | ||
1313 | if (!rx.u.rx.in_scan) | ||
1303 | continue; | 1314 | continue; |
1304 | if (!ieee80211_bssid_match(bssid, | 1315 | rx.u.rx.ra_match = 0; |
1305 | sdata->u.sta.bssid)) { | 1316 | } else if (!multicast && |
1306 | if (!rx.u.rx.in_scan) | 1317 | compare_ether_addr(sdata->dev->dev_addr, |
1307 | continue; | 1318 | hdr->addr1) != 0) { |
1308 | rx.u.rx.ra_match = 0; | 1319 | if (!sdata->promisc) |
1309 | } else if (!multicast && | ||
1310 | compare_ether_addr(sdata->dev->dev_addr, | ||
1311 | hdr->addr1) != 0) { | ||
1312 | if (!sdata->promisc) | ||
1313 | continue; | ||
1314 | rx.u.rx.ra_match = 0; | ||
1315 | } | ||
1316 | break; | ||
1317 | case IEEE80211_IF_TYPE_IBSS: | ||
1318 | if (!bssid) | ||
1319 | continue; | 1320 | continue; |
1320 | if (!ieee80211_bssid_match(bssid, | 1321 | rx.u.rx.ra_match = 0; |
1321 | sdata->u.sta.bssid)) { | 1322 | } |
1322 | if (!rx.u.rx.in_scan) | 1323 | break; |
1323 | continue; | 1324 | case IEEE80211_IF_TYPE_IBSS: |
1324 | rx.u.rx.ra_match = 0; | 1325 | if (!bssid) |
1325 | } else if (!multicast && | 1326 | continue; |
1326 | compare_ether_addr(sdata->dev->dev_addr, | 1327 | if (!ieee80211_bssid_match(bssid, |
1327 | hdr->addr1) != 0) { | 1328 | sdata->u.sta.bssid)) { |
1328 | if (!sdata->promisc) | 1329 | if (!rx.u.rx.in_scan) |
1329 | continue; | ||
1330 | rx.u.rx.ra_match = 0; | ||
1331 | } else if (!sta) | ||
1332 | sta = rx.sta = | ||
1333 | ieee80211_ibss_add_sta(sdata->dev, | ||
1334 | skb, bssid, | ||
1335 | hdr->addr2); | ||
1336 | break; | ||
1337 | case IEEE80211_IF_TYPE_AP: | ||
1338 | if (!bssid) { | ||
1339 | if (compare_ether_addr(sdata->dev->dev_addr, | ||
1340 | hdr->addr1) != 0) | ||
1341 | continue; | ||
1342 | } else if (!ieee80211_bssid_match(bssid, | ||
1343 | sdata->dev->dev_addr)) { | ||
1344 | if (!rx.u.rx.in_scan) | ||
1345 | continue; | ||
1346 | rx.u.rx.ra_match = 0; | ||
1347 | } | ||
1348 | if (sdata->dev == local->mdev && | ||
1349 | !rx.u.rx.in_scan) | ||
1350 | /* do not receive anything via | ||
1351 | * master device when not scanning */ | ||
1352 | continue; | 1330 | continue; |
1353 | break; | 1331 | rx.u.rx.ra_match = 0; |
1354 | case IEEE80211_IF_TYPE_WDS: | 1332 | } else if (!multicast && |
1355 | if (bssid || | 1333 | compare_ether_addr(sdata->dev->dev_addr, |
1356 | (rx.fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) | 1334 | hdr->addr1) != 0) { |
1335 | if (!sdata->promisc) | ||
1357 | continue; | 1336 | continue; |
1358 | if (compare_ether_addr(sdata->u.wds.remote_addr, | 1337 | rx.u.rx.ra_match = 0; |
1359 | hdr->addr2) != 0) | 1338 | } else if (!sta) |
1339 | sta = rx.sta = | ||
1340 | ieee80211_ibss_add_sta(sdata->dev, | ||
1341 | skb, bssid, | ||
1342 | hdr->addr2); | ||
1343 | break; | ||
1344 | case IEEE80211_IF_TYPE_AP: | ||
1345 | if (!bssid) { | ||
1346 | if (compare_ether_addr(sdata->dev->dev_addr, | ||
1347 | hdr->addr1)) | ||
1360 | continue; | 1348 | continue; |
1361 | break; | 1349 | } else if (!ieee80211_bssid_match(bssid, |
1362 | } | 1350 | sdata->dev->dev_addr)) { |
1363 | 1351 | if (!rx.u.rx.in_scan) | |
1364 | if (prev) { | ||
1365 | skb_new = skb_copy(skb, GFP_ATOMIC); | ||
1366 | if (!skb_new) { | ||
1367 | if (net_ratelimit()) | ||
1368 | printk(KERN_DEBUG "%s: failed to copy " | ||
1369 | "multicast frame for %s", | ||
1370 | local->mdev->name, prev->dev->name); | ||
1371 | continue; | 1352 | continue; |
1372 | } | 1353 | rx.u.rx.ra_match = 0; |
1373 | rx.skb = skb_new; | ||
1374 | rx.dev = prev->dev; | ||
1375 | rx.sdata = prev; | ||
1376 | ieee80211_invoke_rx_handlers(local, | ||
1377 | local->rx_handlers, | ||
1378 | &rx, sta); | ||
1379 | } | 1354 | } |
1380 | prev = sdata; | 1355 | if (sdata->dev == local->mdev && !rx.u.rx.in_scan) |
1356 | /* do not receive anything via | ||
1357 | * master device when not scanning */ | ||
1358 | continue; | ||
1359 | break; | ||
1360 | case IEEE80211_IF_TYPE_WDS: | ||
1361 | if (bssid || | ||
1362 | (rx.fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) | ||
1363 | continue; | ||
1364 | if (compare_ether_addr(sdata->u.wds.remote_addr, | ||
1365 | hdr->addr2)) | ||
1366 | continue; | ||
1367 | break; | ||
1381 | } | 1368 | } |
1369 | |||
1382 | if (prev) { | 1370 | if (prev) { |
1383 | rx.skb = skb; | 1371 | skb_new = skb_copy(skb, GFP_ATOMIC); |
1372 | if (!skb_new) { | ||
1373 | if (net_ratelimit()) | ||
1374 | printk(KERN_DEBUG "%s: failed to copy " | ||
1375 | "multicast frame for %s", | ||
1376 | local->mdev->name, prev->dev->name); | ||
1377 | continue; | ||
1378 | } | ||
1379 | rx.skb = skb_new; | ||
1384 | rx.dev = prev->dev; | 1380 | rx.dev = prev->dev; |
1385 | rx.sdata = prev; | 1381 | rx.sdata = prev; |
1386 | ieee80211_invoke_rx_handlers(local, local->rx_handlers, | 1382 | ieee80211_invoke_rx_handlers(local, local->rx_handlers, |
1387 | &rx, sta); | 1383 | &rx, sta); |
1388 | } else | 1384 | } |
1389 | dev_kfree_skb(skb); | 1385 | prev = sdata; |
1390 | read_unlock(&local->sub_if_lock); | ||
1391 | } | 1386 | } |
1387 | if (prev) { | ||
1388 | rx.skb = skb; | ||
1389 | rx.dev = prev->dev; | ||
1390 | rx.sdata = prev; | ||
1391 | ieee80211_invoke_rx_handlers(local, local->rx_handlers, | ||
1392 | &rx, sta); | ||
1393 | } else | ||
1394 | dev_kfree_skb(skb); | ||
1395 | read_unlock(&local->sub_if_lock); | ||
1392 | 1396 | ||
1393 | end: | 1397 | end: |
1394 | if (sta) | 1398 | if (sta) |
1395 | sta_info_put(sta); | 1399 | sta_info_put(sta); |
1396 | } | 1400 | } |