This provides an alternative mechanism for AP VLAN support where a single netdev is used with VLAN tagged frames instead of separate netdevs for each VLAN without tagged frames from the WLAN driver. By setting NL80211_EXT_FEATURE_VLAN_OFFLOAD flag the driver indicates support for a single netdev with VLAN tagged frames. Separate VLAN-specific netdevs can be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to Ethernet. NL80211_CMD_NEW_KEY (for group keys), NL80211_CMD_NEW_STATION, and NL80211_CMD_SET_STATION will optionally specify vlan_id using NL80211_ATTR_VLAN_ID.
Unified · Split
| @@ -565,6 +565,7 @@ struct vif_params { · 564 unmodified lines | |||
| 565 | * with the get_key() callback, must be in little endian, | 565 | * with the get_key() callback, must be in little endian, |
| 566 | * length given by @seq_len. | 566 | * length given by @seq_len. |
| 567 | * @seq_len: length of @seq. | 567 | * @seq_len: length of @seq. |
| 568 | * @vlan_id: vlan_id for VLAN group key (if nonzero) | ||
| 568 | * @mode: key install mode (RX_TX, NO_TX or SET_TX) | 569 | * @mode: key install mode (RX_TX, NO_TX or SET_TX) |
| 569 | */ | 570 | */ |
| 570 | struct key_params { | 571 | struct key_params { |
| @@ -572,6 +573,7 @@ struct key_params { · 1 unmodified line | |||
| 572 | const u8 *seq; | 573 | const u8 *seq; |
| 573 | int key_len; | 574 | int key_len; |
| 574 | int seq_len; | 575 | int seq_len; |
| 576 | u16 vlan_id; | ||
| 575 | u32 cipher; | 577 | u32 cipher; |
| 576 | enum nl80211_key_mode mode; | 578 | enum nl80211_key_mode mode; |
| 577 | }; | 579 | }; |
| @@ -1124,6 +1126,7 @@ struct sta_txpwr { · 546 unmodified lines | |||
| 1124 | * (bitmask of BIT(%NL80211_STA_FLAG_...)) | 1126 | * (bitmask of BIT(%NL80211_STA_FLAG_...)) |
| 1125 | * @listen_interval: listen interval or -1 for no change | 1127 | * @listen_interval: listen interval or -1 for no change |
| 1126 | * @aid: AID or zero for no change | 1128 | * @aid: AID or zero for no change |
| 1129 | * @vlan_id: VLAN ID for station (if nonzero) | ||
| 1127 | * @peer_aid: mesh peer AID or zero for no change | 1130 | * @peer_aid: mesh peer AID or zero for no change |
| 1128 | * @plink_action: plink action to take | 1131 | * @plink_action: plink action to take |
| 1129 | * @plink_state: set the peer link state for a station | 1132 | * @plink_state: set the peer link state for a station |
| @@ -1159,6 +1162,7 @@ struct station_parameters { · 29 unmodified lines | |||
| 1159 | u32 sta_modify_mask; | 1162 | u32 sta_modify_mask; |
| 1160 | int listen_interval; | 1163 | int listen_interval; |
| 1161 | u16 aid; | 1164 | u16 aid; |
| 1165 | u16 vlan_id; | ||
| 1162 | u16 peer_aid; | 1166 | u16 peer_aid; |
| 1163 | u8 supported_rates_len; | 1167 | u8 supported_rates_len; |
| 1164 | u8 plink_action; | 1168 | u8 plink_action; |
| @@ -248,6 +248,22 @@ · 247 unmodified lines | |||
| 248 | * %NL80211_ATTR_SAE_PASSWORD. | 248 | * %NL80211_ATTR_SAE_PASSWORD. |
| 249 | */ | 249 | */ |
| 250 | 250 | ||
| 251 | /** | ||
| 252 | * DOC: VLAN offload support for setting group keys and binding STAs to VLANs | ||
| 253 | * | ||
| 254 | * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they | ||
| 255 | * support offloading VLAN functionality in a manner where the driver exposes a | ||
| 256 | * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs | ||
| 257 | * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet | ||
| 258 | * case. Frames received from stations that are not assigned to any VLAN are | ||
| 259 | * delivered on the main netdev and frames to such stations can be sent through | ||
| 260 | * that main netdev. | ||
| 261 | * | ||
| 262 | * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and | ||
| 263 | * %NL80211_CMD_SET_STATION will optionally specify vlan_id using | ||
| 264 | * %NL80211_ATTR_VLAN_ID. | ||
| 265 | */ | ||
| 266 | |||
| 251 | /** | 267 | /** |
| 252 | * enum nl80211_commands - supported nl80211 commands | 268 | * enum nl80211_commands - supported nl80211 commands |
| 253 | * | 269 | * |
| @@ -2381,6 +2397,9 @@ enum nl80211_commands { · 2127 unmodified lines | |||
| 2381 | * the allowed channel bandwidth configurations. (u8 attribute) | 2397 | * the allowed channel bandwidth configurations. (u8 attribute) |
| 2382 | * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. | 2398 | * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13. |
| 2383 | * | 2399 | * |
| 2400 | * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key | ||
| 2401 | * (u16). | ||
| 2402 | * | ||
| 2384 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available | 2403 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 2385 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 2404 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 2386 | * @__NL80211_ATTR_AFTER_LAST: internal use | 2405 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -2843,6 +2862,8 @@ enum nl80211_attrs { · 456 unmodified lines | |||
| 2843 | NL80211_ATTR_WIPHY_EDMG_CHANNELS, | 2862 | NL80211_ATTR_WIPHY_EDMG_CHANNELS, |
| 2844 | NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, | 2863 | NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, |
| 2845 | 2864 | ||
| 2865 | NL80211_ATTR_VLAN_ID, | ||
| 2866 | |||
| 2846 | /* add attributes here, update the policy in nl80211.c */ | 2867 | /* add attributes here, update the policy in nl80211.c */ |
| 2847 | 2868 | ||
| 2848 | __NL80211_ATTR_AFTER_LAST, | 2869 | __NL80211_ATTR_AFTER_LAST, |
| @@ -5492,6 +5513,10 @@ enum nl80211_feature_flags { · 2643 unmodified lines | |||
| 5492 | * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in | 5513 | * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in |
| 5493 | * station mode (SAE password is passed as part of the connect command). | 5514 | * station mode (SAE password is passed as part of the connect command). |
| 5494 | * | 5515 | * |
| 5516 | * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev | ||
| 5517 | * with VLAN tagged frames and separate VLAN-specific netdevs added using | ||
| 5518 | * vconfig similarly to the Ethernet case. | ||
| 5519 | * | ||
| 5495 | * @NUM_NL80211_EXT_FEATURES: number of extended features. | 5520 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
| 5496 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. | 5521 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
| 5497 | */ | 5522 | */ |
| @@ -5537,6 +5562,7 @@ enum nl80211_ext_feature_index { · 39 unmodified lines | |||
| 5537 | NL80211_EXT_FEATURE_EXT_KEY_ID, | 5562 | NL80211_EXT_FEATURE_EXT_KEY_ID, |
| 5538 | NL80211_EXT_FEATURE_STA_TX_PWR, | 5563 | NL80211_EXT_FEATURE_STA_TX_PWR, |
| 5539 | NL80211_EXT_FEATURE_SAE_OFFLOAD, | 5564 | NL80211_EXT_FEATURE_SAE_OFFLOAD, |
| 5565 | NL80211_EXT_FEATURE_VLAN_OFFLOAD, | ||
| 5540 | 5566 | ||
| 5541 | /* add new features before the definition below */ | 5567 | /* add new features before the definition below */ |
| 5542 | NUM_NL80211_EXT_FEATURES, | 5568 | NUM_NL80211_EXT_FEATURES, |
| @@ -624,6 +624,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 623 unmodified lines | |||
| 624 | .len = SAE_PASSWORD_MAX_LEN }, | 624 | .len = SAE_PASSWORD_MAX_LEN }, |
| 625 | [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, | 625 | [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, |
| 626 | [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), | 626 | [NL80211_ATTR_HE_OBSS_PD] = NLA_POLICY_NESTED(he_obss_pd_policy), |
| 627 | [NL80211_ATTR_VLAN_ID] = NLA_POLICY_RANGE(NLA_U16, 1, VLAN_N_VID - 2), | ||
| 627 | }; | 628 | }; |
| 628 | 629 | ||
| 629 | /* policy for the key attributes */ | 630 | /* policy for the key attributes */ |
| @@ -3940,6 +3941,10 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info) · 3310 unmodified lines | |||
| 3940 | key.type != NL80211_KEYTYPE_GROUP) | 3941 | key.type != NL80211_KEYTYPE_GROUP) |
| 3941 | return -EINVAL; | 3942 | return -EINVAL; |
| 3942 | 3943 | ||
| 3944 | if (key.type == NL80211_KEYTYPE_GROUP && | ||
| 3945 | info->attrs[NL80211_ATTR_VLAN_ID]) | ||
| 3946 | key.p.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); | ||
| 3947 | |||
| 3943 | if (!rdev->ops->add_key) | 3948 | if (!rdev->ops->add_key) |
| 3944 | return -EOPNOTSUPP; | 3949 | return -EOPNOTSUPP; |
| 3945 | 3950 | ||
| @@ -5711,6 +5716,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 1765 unmodified lines | |||
| 5711 | if (info->attrs[NL80211_ATTR_STA_AID]) | 5716 | if (info->attrs[NL80211_ATTR_STA_AID]) |
| 5712 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); | 5717 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); |
| 5713 | 5718 | ||
| 5719 | if (info->attrs[NL80211_ATTR_VLAN_ID]) | ||
| 5720 | params.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); | ||
| 5721 | |||
| 5714 | if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) | 5722 | if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) |
| 5715 | params.listen_interval = | 5723 | params.listen_interval = |
| 5716 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); | 5724 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); |
| @@ -5856,6 +5864,9 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) · 139 unmodified lines | |||
| 5856 | params.listen_interval = | 5864 | params.listen_interval = |
| 5857 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); | 5865 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); |
| 5858 | 5866 | ||
| 5867 | if (info->attrs[NL80211_ATTR_VLAN_ID]) | ||
| 5868 | params.vlan_id = nla_get_u16(info->attrs[NL80211_ATTR_VLAN_ID]); | ||
| 5869 | |||
| 5859 | if (info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]) { | 5870 | if (info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]) { |
| 5860 | params.support_p2p_ps = | 5871 | params.support_p2p_ps = |
| 5861 | nla_get_u8(info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]); | 5872 | nla_get_u8(info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]); |