diff options
author | Arik Nemtsov <arik@wizery.com> | 2012-05-10 09:18:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-05 15:21:46 -0400 |
commit | 72d7872852e1734e94686012a2e9deade3457329 (patch) | |
tree | a03e04cbb654ddd44132b420e068a6e0a24d8f86 | |
parent | f8f5701bdaf9134b1f90e5044a82c66324d2073f (diff) |
mac80211: allow low-level drivers to set netdev feature bits
Low level drivers can now set certain netdev feature bits in
netdev_features member of the ieee80211_hw struct. These will be
propagated to every netdev created from this HW.
The white-listed features currently include only ones related to HW
checksumming.
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/mac80211.h | 5 | ||||
-rw-r--r-- | net/mac80211/iface.c | 2 | ||||
-rw-r--r-- | net/mac80211/main.c | 7 |
3 files changed, 14 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 1937c7d98304..0286c0476e44 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1297,6 +1297,10 @@ enum ieee80211_hw_flags { | |||
1297 | * reports, by default it is set to _MCS, _GI and _BW but doesn't | 1297 | * reports, by default it is set to _MCS, _GI and _BW but doesn't |
1298 | * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only | 1298 | * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only |
1299 | * adding _BW is supported today. | 1299 | * adding _BW is supported today. |
1300 | * | ||
1301 | * @netdev_features: netdev features to be set in each netdev created | ||
1302 | * from this HW. Note only HW checksum features are currently | ||
1303 | * compatible with mac80211. Other feature bits will be rejected. | ||
1300 | */ | 1304 | */ |
1301 | struct ieee80211_hw { | 1305 | struct ieee80211_hw { |
1302 | struct ieee80211_conf conf; | 1306 | struct ieee80211_conf conf; |
@@ -1319,6 +1323,7 @@ struct ieee80211_hw { | |||
1319 | u8 max_tx_aggregation_subframes; | 1323 | u8 max_tx_aggregation_subframes; |
1320 | u8 offchannel_tx_hw_queue; | 1324 | u8 offchannel_tx_hw_queue; |
1321 | u8 radiotap_mcs_details; | 1325 | u8 radiotap_mcs_details; |
1326 | netdev_features_t netdev_features; | ||
1322 | }; | 1327 | }; |
1323 | 1328 | ||
1324 | /** | 1329 | /** |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index d4c19a7773db..f970e0b3c4b9 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1352,6 +1352,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1352 | sdata->u.mgd.use_4addr = params->use_4addr; | 1352 | sdata->u.mgd.use_4addr = params->use_4addr; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | ndev->features |= local->hw.netdev_features; | ||
1356 | |||
1355 | ret = register_netdevice(ndev); | 1357 | ret = register_netdevice(ndev); |
1356 | if (ret) | 1358 | if (ret) |
1357 | goto fail; | 1359 | goto fail; |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index f5548e953259..779ac613ee57 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -682,6 +682,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
682 | enum ieee80211_band band; | 682 | enum ieee80211_band band; |
683 | int channels, max_bitrates; | 683 | int channels, max_bitrates; |
684 | bool supp_ht; | 684 | bool supp_ht; |
685 | netdev_features_t feature_whitelist; | ||
685 | static const u32 cipher_suites[] = { | 686 | static const u32 cipher_suites[] = { |
686 | /* keep WEP first, it may be removed below */ | 687 | /* keep WEP first, it may be removed below */ |
687 | WLAN_CIPHER_SUITE_WEP40, | 688 | WLAN_CIPHER_SUITE_WEP40, |
@@ -708,6 +709,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
708 | if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan) | 709 | if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan) |
709 | return -EINVAL; | 710 | return -EINVAL; |
710 | 711 | ||
712 | /* Only HW csum features are currently compatible with mac80211 */ | ||
713 | feature_whitelist = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | ||
714 | NETIF_F_HW_CSUM; | ||
715 | if (WARN_ON(hw->netdev_features & ~feature_whitelist)) | ||
716 | return -EINVAL; | ||
717 | |||
711 | if (hw->max_report_rates == 0) | 718 | if (hw->max_report_rates == 0) |
712 | hw->max_report_rates = hw->max_rates; | 719 | hw->max_report_rates = hw->max_rates; |
713 | 720 | ||