aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-10 18:01:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-15 16:48:23 -0400
commit05c914fe330fa8e1cc67870dc0d3809dfd96c107 (patch)
treedf53bcab47335f3361c09478d6b1447b7d298536 /net/mac80211/rx.c
parent96dd22ac06b0dbfb069fdf530c72046a941e9694 (diff)
mac80211: use nl80211 interface types
There's really no reason for mac80211 to be using its own interface type defines. Use the nl80211 types and simplify the configuration code a bit: there's no need to translate them any more now. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 33530b29c422..8c3dda5f00b2 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -295,7 +295,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
295 if (!netif_running(sdata->dev)) 295 if (!netif_running(sdata->dev))
296 continue; 296 continue;
297 297
298 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR) 298 if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
299 continue; 299 continue;
300 300
301 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) 301 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)
@@ -512,7 +512,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
512 512
513 if (unlikely((ieee80211_is_data(hdr->frame_control) || 513 if (unlikely((ieee80211_is_data(hdr->frame_control) ||
514 ieee80211_is_pspoll(hdr->frame_control)) && 514 ieee80211_is_pspoll(hdr->frame_control)) &&
515 rx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 515 rx->sdata->vif.type != NL80211_IFTYPE_ADHOC &&
516 (!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) { 516 (!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) {
517 if ((!ieee80211_has_fromds(hdr->frame_control) && 517 if ((!ieee80211_has_fromds(hdr->frame_control) &&
518 !ieee80211_has_tods(hdr->frame_control) && 518 !ieee80211_has_tods(hdr->frame_control) &&
@@ -724,14 +724,14 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
724 /* Update last_rx only for IBSS packets which are for the current 724 /* Update last_rx only for IBSS packets which are for the current
725 * BSSID to avoid keeping the current IBSS network alive in cases where 725 * BSSID to avoid keeping the current IBSS network alive in cases where
726 * other STAs are using different BSSID. */ 726 * other STAs are using different BSSID. */
727 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { 727 if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
728 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, 728 u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
729 IEEE80211_IF_TYPE_IBSS); 729 NL80211_IFTYPE_ADHOC);
730 if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0) 730 if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0)
731 sta->last_rx = jiffies; 731 sta->last_rx = jiffies;
732 } else 732 } else
733 if (!is_multicast_ether_addr(hdr->addr1) || 733 if (!is_multicast_ether_addr(hdr->addr1) ||
734 rx->sdata->vif.type == IEEE80211_IF_TYPE_STA) { 734 rx->sdata->vif.type == NL80211_IFTYPE_STATION) {
735 /* Update last_rx only for unicast frames in order to prevent 735 /* Update last_rx only for unicast frames in order to prevent
736 * the Probe Request frames (the only broadcast frames from a 736 * the Probe Request frames (the only broadcast frames from a
737 * STA in infrastructure mode) from keeping a connection alive. 737 * STA in infrastructure mode) from keeping a connection alive.
@@ -751,8 +751,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
751 sta->last_noise = rx->status->noise; 751 sta->last_noise = rx->status->noise;
752 752
753 if (!ieee80211_has_morefrags(hdr->frame_control) && 753 if (!ieee80211_has_morefrags(hdr->frame_control) &&
754 (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP || 754 (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
755 rx->sdata->vif.type == IEEE80211_IF_TYPE_VLAN)) { 755 rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) {
756 /* Change STA power saving mode only in the end of a frame 756 /* Change STA power saving mode only in the end of a frame
757 * exchange sequence */ 757 * exchange sequence */
758 if (test_sta_flags(sta, WLAN_STA_PS) && 758 if (test_sta_flags(sta, WLAN_STA_PS) &&
@@ -982,8 +982,8 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
982 !(rx->flags & IEEE80211_RX_RA_MATCH))) 982 !(rx->flags & IEEE80211_RX_RA_MATCH)))
983 return RX_CONTINUE; 983 return RX_CONTINUE;
984 984
985 if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) && 985 if ((sdata->vif.type != NL80211_IFTYPE_AP) &&
986 (sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) 986 (sdata->vif.type != NL80211_IFTYPE_AP_VLAN))
987 return RX_DROP_UNUSABLE; 987 return RX_DROP_UNUSABLE;
988 988
989 skb = skb_dequeue(&rx->sta->tx_filtered); 989 skb = skb_dequeue(&rx->sta->tx_filtered);
@@ -1131,23 +1131,23 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1131 switch (hdr->frame_control & 1131 switch (hdr->frame_control &
1132 cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { 1132 cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
1133 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS): 1133 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS):
1134 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && 1134 if (unlikely(sdata->vif.type != NL80211_IFTYPE_AP &&
1135 sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) 1135 sdata->vif.type != NL80211_IFTYPE_AP_VLAN))
1136 return -1; 1136 return -1;
1137 break; 1137 break;
1138 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): 1138 case __constant_cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
1139 if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && 1139 if (unlikely(sdata->vif.type != NL80211_IFTYPE_WDS &&
1140 sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) 1140 sdata->vif.type != NL80211_IFTYPE_MESH_POINT))
1141 return -1; 1141 return -1;
1142 break; 1142 break;
1143 case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS): 1143 case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
1144 if (sdata->vif.type != IEEE80211_IF_TYPE_STA || 1144 if (sdata->vif.type != NL80211_IFTYPE_STATION ||
1145 (is_multicast_ether_addr(dst) && 1145 (is_multicast_ether_addr(dst) &&
1146 !compare_ether_addr(src, dev->dev_addr))) 1146 !compare_ether_addr(src, dev->dev_addr)))
1147 return -1; 1147 return -1;
1148 break; 1148 break;
1149 case __constant_cpu_to_le16(0): 1149 case __constant_cpu_to_le16(0):
1150 if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) 1150 if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
1151 return -1; 1151 return -1;
1152 break; 1152 break;
1153 } 1153 }
@@ -1221,8 +1221,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1221 skb = rx->skb; 1221 skb = rx->skb;
1222 xmit_skb = NULL; 1222 xmit_skb = NULL;
1223 1223
1224 if ((sdata->vif.type == IEEE80211_IF_TYPE_AP || 1224 if ((sdata->vif.type == NL80211_IFTYPE_AP ||
1225 sdata->vif.type == IEEE80211_IF_TYPE_VLAN) && 1225 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) &&
1226 !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && 1226 !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) &&
1227 (rx->flags & IEEE80211_RX_RA_MATCH)) { 1227 (rx->flags & IEEE80211_RX_RA_MATCH)) {
1228 if (is_multicast_ether_addr(ehdr->h_dest)) { 1228 if (is_multicast_ether_addr(ehdr->h_dest)) {
@@ -1536,8 +1536,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
1536 * FIXME: revisit this, I'm sure we should handle most 1536 * FIXME: revisit this, I'm sure we should handle most
1537 * of these frames in other modes as well! 1537 * of these frames in other modes as well!
1538 */ 1538 */
1539 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 1539 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
1540 sdata->vif.type != IEEE80211_IF_TYPE_IBSS) 1540 sdata->vif.type != NL80211_IFTYPE_ADHOC)
1541 return RX_DROP_MONITOR; 1541 return RX_DROP_MONITOR;
1542 1542
1543 switch (mgmt->u.action.category) { 1543 switch (mgmt->u.action.category) {
@@ -1595,8 +1595,8 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
1595 if (ieee80211_vif_is_mesh(&sdata->vif)) 1595 if (ieee80211_vif_is_mesh(&sdata->vif))
1596 return ieee80211_mesh_rx_mgmt(sdata, rx->skb, rx->status); 1596 return ieee80211_mesh_rx_mgmt(sdata, rx->skb, rx->status);
1597 1597
1598 if (sdata->vif.type != IEEE80211_IF_TYPE_STA && 1598 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
1599 sdata->vif.type != IEEE80211_IF_TYPE_IBSS) 1599 sdata->vif.type != NL80211_IFTYPE_ADHOC)
1600 return RX_DROP_MONITOR; 1600 return RX_DROP_MONITOR;
1601 1601
1602 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) 1602 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
@@ -1632,7 +1632,7 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1632 if (!ieee80211_has_protected(hdr->frame_control)) 1632 if (!ieee80211_has_protected(hdr->frame_control))
1633 goto ignore; 1633 goto ignore;
1634 1634
1635 if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { 1635 if (rx->sdata->vif.type == NL80211_IFTYPE_AP && keyidx) {
1636 /* 1636 /*
1637 * APs with pairwise keys should never receive Michael MIC 1637 * APs with pairwise keys should never receive Michael MIC
1638 * errors for non-zero keyidx because these are reserved for 1638 * errors for non-zero keyidx because these are reserved for
@@ -1702,7 +1702,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx)
1702 if (!netif_running(sdata->dev)) 1702 if (!netif_running(sdata->dev))
1703 continue; 1703 continue;
1704 1704
1705 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || 1705 if (sdata->vif.type != NL80211_IFTYPE_MONITOR ||
1706 !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) 1706 !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES))
1707 continue; 1707 continue;
1708 1708
@@ -1801,7 +1801,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1801 int multicast = is_multicast_ether_addr(hdr->addr1); 1801 int multicast = is_multicast_ether_addr(hdr->addr1);
1802 1802
1803 switch (sdata->vif.type) { 1803 switch (sdata->vif.type) {
1804 case IEEE80211_IF_TYPE_STA: 1804 case NL80211_IFTYPE_STATION:
1805 if (!bssid) 1805 if (!bssid)
1806 return 0; 1806 return 0;
1807 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1807 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
@@ -1816,7 +1816,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1816 rx->flags &= ~IEEE80211_RX_RA_MATCH; 1816 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1817 } 1817 }
1818 break; 1818 break;
1819 case IEEE80211_IF_TYPE_IBSS: 1819 case NL80211_IFTYPE_ADHOC:
1820 if (!bssid) 1820 if (!bssid)
1821 return 0; 1821 return 0;
1822 if (ieee80211_is_beacon(hdr->frame_control)) { 1822 if (ieee80211_is_beacon(hdr->frame_control)) {
@@ -1837,7 +1837,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1837 bssid, hdr->addr2, 1837 bssid, hdr->addr2,
1838 BIT(rx->status->rate_idx)); 1838 BIT(rx->status->rate_idx));
1839 break; 1839 break;
1840 case IEEE80211_IF_TYPE_MESH_POINT: 1840 case NL80211_IFTYPE_MESH_POINT:
1841 if (!multicast && 1841 if (!multicast &&
1842 compare_ether_addr(sdata->dev->dev_addr, 1842 compare_ether_addr(sdata->dev->dev_addr,
1843 hdr->addr1) != 0) { 1843 hdr->addr1) != 0) {
@@ -1847,8 +1847,8 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1847 rx->flags &= ~IEEE80211_RX_RA_MATCH; 1847 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1848 } 1848 }
1849 break; 1849 break;
1850 case IEEE80211_IF_TYPE_VLAN: 1850 case NL80211_IFTYPE_AP_VLAN:
1851 case IEEE80211_IF_TYPE_AP: 1851 case NL80211_IFTYPE_AP:
1852 if (!bssid) { 1852 if (!bssid) {
1853 if (compare_ether_addr(sdata->dev->dev_addr, 1853 if (compare_ether_addr(sdata->dev->dev_addr,
1854 hdr->addr1)) 1854 hdr->addr1))
@@ -1860,16 +1860,17 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1860 rx->flags &= ~IEEE80211_RX_RA_MATCH; 1860 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1861 } 1861 }
1862 break; 1862 break;
1863 case IEEE80211_IF_TYPE_WDS: 1863 case NL80211_IFTYPE_WDS:
1864 if (bssid || !ieee80211_is_data(hdr->frame_control)) 1864 if (bssid || !ieee80211_is_data(hdr->frame_control))
1865 return 0; 1865 return 0;
1866 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) 1866 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
1867 return 0; 1867 return 0;
1868 break; 1868 break;
1869 case IEEE80211_IF_TYPE_MNTR: 1869 case NL80211_IFTYPE_MONITOR:
1870 /* take everything */ 1870 /* take everything */
1871 break; 1871 break;
1872 case IEEE80211_IF_TYPE_INVALID: 1872 case NL80211_IFTYPE_UNSPECIFIED:
1873 case __NL80211_IFTYPE_AFTER_LAST:
1873 /* should never get here */ 1874 /* should never get here */
1874 WARN_ON(1); 1875 WARN_ON(1);
1875 break; 1876 break;
@@ -1930,7 +1931,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1930 if (!netif_running(sdata->dev)) 1931 if (!netif_running(sdata->dev))
1931 continue; 1932 continue;
1932 1933
1933 if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) 1934 if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
1934 continue; 1935 continue;
1935 1936
1936 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); 1937 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);