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 | 565 | * with the get_key() callback, must be in little endian, |
| 566 | 566 | * length given by @seq_len. |
| 567 | 567 | * @seq_len: length of @seq. |
| 568 | + * @vlan_id: vlan_id for VLAN group key (if nonzero) | |
| 568 | 569 | * @mode: key install mode (RX_TX, NO_TX or SET_TX) |
| 569 | 570 | */ |
| 570 | 571 | struct key_params { |
| @@ -572,6 +573,7 @@ struct key_params { · 1 unmodified line | ||
| 572 | 573 | const u8 *seq; |
| 573 | 574 | int key_len; |
| 574 | 575 | int seq_len; |
| 576 | + u16 vlan_id; | |
| 575 | 577 | u32 cipher; |
| 576 | 578 | enum nl80211_key_mode mode; |
| 577 | 579 | }; |
| @@ -1124,6 +1126,7 @@ struct sta_txpwr { · 546 unmodified lines | ||
| 1124 | 1126 | * (bitmask of BIT(%NL80211_STA_FLAG_...)) |
| 1125 | 1127 | * @listen_interval: listen interval or -1 for no change |
| 1126 | 1128 | * @aid: AID or zero for no change |
| 1129 | + * @vlan_id: VLAN ID for station (if nonzero) | |
| 1127 | 1130 | * @peer_aid: mesh peer AID or zero for no change |
| 1128 | 1131 | * @plink_action: plink action to take |
| 1129 | 1132 | * @plink_state: set the peer link state for a station |
| @@ -1159,6 +1162,7 @@ struct station_parameters { · 29 unmodified lines | ||
| 1159 | 1162 | u32 sta_modify_mask; |
| 1160 | 1163 | int listen_interval; |
| 1161 | 1164 | u16 aid; |
| 1165 | + u16 vlan_id; | |
| 1162 | 1166 | u16 peer_aid; |
| 1163 | 1167 | u8 supported_rates_len; |
| 1164 | 1168 | u8 plink_action; |
| @@ -248,6 +248,22 @@ · 247 unmodified lines | ||
| 248 | 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 | 268 | * enum nl80211_commands - supported nl80211 commands |
| 253 | 269 | * |
| @@ -2381,6 +2397,9 @@ enum nl80211_commands { · 2127 unmodified lines | ||
| 2381 | 2397 | * the allowed channel bandwidth configurations. (u8 attribute) |
| 2382 | 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 | 2403 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 2385 | 2404 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 2386 | 2405 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -2843,6 +2862,8 @@ enum nl80211_attrs { · 456 unmodified lines | ||
| 2843 | 2862 | NL80211_ATTR_WIPHY_EDMG_CHANNELS, |
| 2844 | 2863 | NL80211_ATTR_WIPHY_EDMG_BW_CONFIG, |
| 2845 | 2864 | |
| 2865 | + NL80211_ATTR_VLAN_ID, | |
| 2866 | + | |
| 2846 | 2867 | /* add attributes here, update the policy in nl80211.c */ |
| 2847 | 2868 | |
| 2848 | 2869 | __NL80211_ATTR_AFTER_LAST, |
| @@ -5492,6 +5513,10 @@ enum nl80211_feature_flags { · 2643 unmodified lines | ||
| 5492 | 5513 | * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in |
| 5493 | 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 | 5520 | * @NUM_NL80211_EXT_FEATURES: number of extended features. |
| 5496 | 5521 | * @MAX_NL80211_EXT_FEATURES: highest extended feature index. |
| 5497 | 5522 | */ |
| @@ -5537,6 +5562,7 @@ enum nl80211_ext_feature_index { · 39 unmodified lines | ||
| 5537 | 5562 | NL80211_EXT_FEATURE_EXT_KEY_ID, |
| 5538 | 5563 | NL80211_EXT_FEATURE_STA_TX_PWR, |
| 5539 | 5564 | NL80211_EXT_FEATURE_SAE_OFFLOAD, |
| 5565 | + NL80211_EXT_FEATURE_VLAN_OFFLOAD, | |
| 5540 | 5566 | |
| 5541 | 5567 | /* add new features before the definition below */ |
| 5542 | 5568 | NUM_NL80211_EXT_FEATURES, |
| @@ -624,6 +624,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 623 unmodified lines | ||
| 624 | 624 | .len = SAE_PASSWORD_MAX_LEN }, |
| 625 | 625 | [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG }, |
| 626 | 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 | 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 | 3941 | key.type != NL80211_KEYTYPE_GROUP) |
| 3941 | 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 | 3948 | if (!rdev->ops->add_key) |
| 3944 | 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 | 5716 | if (info->attrs[NL80211_ATTR_STA_AID]) |
| 5712 | 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 | 5722 | if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) |
| 5715 | 5723 | params.listen_interval = |
| 5716 | 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 | 5864 | params.listen_interval = |
| 5857 | 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 | 5870 | if (info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]) { |
| 5860 | 5871 | params.support_p2p_ps = |
| 5861 | 5872 | nla_get_u8(info->attrs[NL80211_ATTR_STA_SUPPORT_P2P_PS]); |