mac80211: fix various issues with fast-rx mode
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 334-mac80211-support-station-4-addr-mode-fast-rx.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 23 Feb 2018 10:05:08 +0100
3 Subject: [PATCH] mac80211: support station 4-addr mode fast-rx
4
5 Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 ---
7
8 --- a/net/mac80211/cfg.c
9 +++ b/net/mac80211/cfg.c
10 @@ -160,7 +160,6 @@ static int ieee80211_change_iface(struct
11         if (type == NL80211_IFTYPE_AP_VLAN &&
12             params && params->use_4addr == 0) {
13                 RCU_INIT_POINTER(sdata->u.vlan.sta, NULL);
14 -               ieee80211_check_fast_rx_iface(sdata);
15         } else if (type == NL80211_IFTYPE_STATION &&
16                    params && params->use_4addr >= 0) {
17                 sdata->u.mgd.use_4addr = params->use_4addr;
18 @@ -1574,7 +1573,6 @@ static int ieee80211_change_station(stru
19                         }
20  
21                         rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
22 -                       __ieee80211_check_fast_rx_iface(vlansdata);
23                 }
24  
25                 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
26 --- a/net/mac80211/rx.c
27 +++ b/net/mac80211/rx.c
28 @@ -3738,10 +3738,6 @@ void ieee80211_check_fast_rx(struct sta_
29  
30         switch (sdata->vif.type) {
31         case NL80211_IFTYPE_STATION:
32 -               /* 4-addr is harder to deal with, later maybe */
33 -               if (sdata->u.mgd.use_4addr)
34 -                       goto clear;
35 -
36                 if (sta->sta.tdls) {
37                         fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1);
38                         fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2);
39 @@ -3754,6 +3750,13 @@ void ieee80211_check_fast_rx(struct sta_
40                                 cpu_to_le16(IEEE80211_FCTL_FROMDS);
41                 }
42  
43 +               if (sdata->u.mgd.use_4addr && !sta->sta.tdls) {
44 +                       fastrx.expected_ds_bits |=
45 +                               cpu_to_le16(IEEE80211_FCTL_TODS);
46 +                       fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3);
47 +                       fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4);
48 +               }
49 +
50                 if (!sdata->u.mgd.powersave)
51                     break;
52