diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-08-28 17:01:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:48 -0400 |
commit | cf966838cd5596ca61d3e9949050442a943f6238 (patch) | |
tree | fc5945ad6df812160b1f865ed29a6b1dc184b3c1 | |
parent | eb063c1702a84d58eb4c05a032bbff6f1c29049d (diff) |
[MAC80211]: use switch statement in tx code
The transmit code needs to set the addresses depending on the
interface type, a likely() for AP/VLAN is quite wrong since
most people will be using STA; convert to a switch statement
to make it look nicer.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/mac80211/tx.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c9b909d9498b..53efcf6f769c 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1363,15 +1363,17 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1363 | /* TODO: handling for 802.1x authorized/unauthorized port */ | 1363 | /* TODO: handling for 802.1x authorized/unauthorized port */ |
1364 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; | 1364 | fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; |
1365 | 1365 | ||
1366 | if (likely(sdata->type == IEEE80211_IF_TYPE_AP || | 1366 | switch (sdata->type) { |
1367 | sdata->type == IEEE80211_IF_TYPE_VLAN)) { | 1367 | case IEEE80211_IF_TYPE_AP: |
1368 | case IEEE80211_IF_TYPE_VLAN: | ||
1368 | fc |= IEEE80211_FCTL_FROMDS; | 1369 | fc |= IEEE80211_FCTL_FROMDS; |
1369 | /* DA BSSID SA */ | 1370 | /* DA BSSID SA */ |
1370 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1371 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1371 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1372 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); |
1372 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 1373 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); |
1373 | hdrlen = 24; | 1374 | hdrlen = 24; |
1374 | } else if (sdata->type == IEEE80211_IF_TYPE_WDS) { | 1375 | break; |
1376 | case IEEE80211_IF_TYPE_WDS: | ||
1375 | fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; | 1377 | fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; |
1376 | /* RA TA DA SA */ | 1378 | /* RA TA DA SA */ |
1377 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); | 1379 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); |
@@ -1379,20 +1381,23 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1379 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1381 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1380 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1382 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1381 | hdrlen = 30; | 1383 | hdrlen = 30; |
1382 | } else if (sdata->type == IEEE80211_IF_TYPE_STA) { | 1384 | break; |
1385 | case IEEE80211_IF_TYPE_STA: | ||
1383 | fc |= IEEE80211_FCTL_TODS; | 1386 | fc |= IEEE80211_FCTL_TODS; |
1384 | /* BSSID SA DA */ | 1387 | /* BSSID SA DA */ |
1385 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); | 1388 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); |
1386 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 1389 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); |
1387 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1390 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1388 | hdrlen = 24; | 1391 | hdrlen = 24; |
1389 | } else if (sdata->type == IEEE80211_IF_TYPE_IBSS) { | 1392 | break; |
1393 | case IEEE80211_IF_TYPE_IBSS: | ||
1390 | /* DA SA BSSID */ | 1394 | /* DA SA BSSID */ |
1391 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1395 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1392 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 1396 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); |
1393 | memcpy(hdr.addr3, sdata->u.sta.bssid, ETH_ALEN); | 1397 | memcpy(hdr.addr3, sdata->u.sta.bssid, ETH_ALEN); |
1394 | hdrlen = 24; | 1398 | hdrlen = 24; |
1395 | } else { | 1399 | break; |
1400 | default: | ||
1396 | ret = 0; | 1401 | ret = 0; |
1397 | goto fail; | 1402 | goto fail; |
1398 | } | 1403 | } |