1 From 3ad31f4efe9674a8bda057c79995a9468281e77f Mon Sep 17 00:00:00 2001
2 From: Manikanta Pubbisetty <mpubbise@codeaurora.org>
3 Date: Wed, 21 Nov 2018 16:33:48 +0530
4 Subject: [PATCH] {nl,mac}80211: allow 4addr AP operation on crypto controlled
7 As per the current design, for sw crypto controlled devices, it is
8 the device which has to advertise the support for AP/VLAN iftype
9 based on it's capability to tranmsit packets encrypted in software
10 (In VLAN functionality, group traffic generated for a specific
11 VLAN group is always encrypted in software). Commit db3bdcb9c3ff
12 ("mac80211: allow AP_VLAN operation on crypto controlled devices")
13 has introduced this change.
15 Since 4addr AP operation also uses AP/VLAN iftype, this conditional
16 way of advertising AP/VLAN support has broken 4addr AP mode operation on
17 crypto controlled devices which do not support VLAN functionality.
20 In the case of ath10k driver, not all firmwares have support for VLAN
21 functionality but all can support 4addr AP operation. Because AP/VLAN
22 support is not advertised for these devices, 4addr AP operations are
25 Fix this by allowing 4addr opertion on devices which do not advertise
26 AP/VLAN iftype but which can support 4addr operation (the desicion is
27 taken based on the wiphy flag WIPHY_FLAG_4ADDR_AP).
29 Fixes: Commit db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on
30 crypto controlled devices")
31 Signed-off-by: Manikanta Pubbisetty <mpubbise@codeaurora.org>
33 include/net/cfg80211.h | 3 ++-
34 net/mac80211/util.c | 4 +++-
35 net/wireless/core.c | 9 +++++++--
36 net/wireless/nl80211.c | 10 ++++++++--
37 4 files changed, 20 insertions(+), 6 deletions(-)
39 --- a/include/net/cfg80211.h
40 +++ b/include/net/cfg80211.h
41 @@ -3448,7 +3448,8 @@ struct cfg80211_ops {
42 * on wiphy_new(), but can be changed by the driver if it has a good
43 * reason to override the default
44 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
45 - * on a VLAN interface)
46 + * on a VLAN interface). This flag also serves an extra purpose of
47 + * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
48 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
49 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
50 * control port protocol ethertype. The device also honours the
51 --- a/net/mac80211/util.c
52 +++ b/net/mac80211/util.c
53 @@ -3523,7 +3523,9 @@ int ieee80211_check_combinations(struct
56 /* Always allow software iftypes */
57 - if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
58 + if (local->hw.wiphy->software_iftypes & BIT(iftype) ||
59 + (iftype == NL80211_IFTYPE_AP_VLAN &&
60 + local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
64 --- a/net/wireless/core.c
65 +++ b/net/wireless/core.c
66 @@ -1351,8 +1351,13 @@ static int cfg80211_netdev_notifier_call
70 - if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
71 - return notifier_from_errno(-EOPNOTSUPP);
72 + if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) {
73 + if (!(wdev->iftype == NL80211_IFTYPE_AP_VLAN &&
74 + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
76 + return notifier_from_errno(-EOPNOTSUPP);
79 if (rfkill_blocked(rdev->rfkill))
80 return notifier_from_errno(-ERFKILL);
82 --- a/net/wireless/nl80211.c
83 +++ b/net/wireless/nl80211.c
84 @@ -3193,8 +3193,7 @@ static int nl80211_new_interface(struct
88 - if (!rdev->ops->add_virtual_intf ||
89 - !(rdev->wiphy.interface_modes & (1 << type)))
90 + if (!rdev->ops->add_virtual_intf)
93 if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN ||
94 @@ -3213,6 +3212,13 @@ static int nl80211_new_interface(struct
98 + if (!(rdev->wiphy.interface_modes & (1 << type))) {
99 + if (!(type == NL80211_IFTYPE_AP_VLAN &&
100 + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
102 + return -EOPNOTSUPP;
105 err = nl80211_parse_mon_options(rdev, type, info, ¶ms);