aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
Diffstat (limited to 'package')
-rw-r--r--package/kernel/mac80211/patches/319-mac80211-avoid-extra-memcpy-in-A-MSDU-head-creation.patch55
-rw-r--r--package/kernel/mac80211/patches/320-mac80211-fix-A-MSDU-outer-SA-DA.patch73
2 files changed, 128 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/319-mac80211-avoid-extra-memcpy-in-A-MSDU-head-creation.patch b/package/kernel/mac80211/patches/319-mac80211-avoid-extra-memcpy-in-A-MSDU-head-creation.patch
new file mode 100644
index 0000000000..fb6bd30243
--- /dev/null
+++ b/package/kernel/mac80211/patches/319-mac80211-avoid-extra-memcpy-in-A-MSDU-head-creation.patch
@@ -0,0 +1,55 @@
+From: Michael Braun <michael-dev@fami-braun.de>
+Date: Sat, 15 Oct 2016 13:28:18 +0200
+Subject: [PATCH] mac80211: avoid extra memcpy in A-MSDU head creation
+
+Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -3069,11 +3069,11 @@ static bool ieee80211_amsdu_prepare_head
+ struct ieee80211_local *local = sdata->local;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr;
+- struct ethhdr amsdu_hdr;
++ struct ethhdr *amsdu_hdr;
+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
+ int subframe_len = skb->len - hdr_len;
+ void *data;
+- u8 *qc;
++ u8 *qc, *h_80211_src, *h_80211_dst;
+
+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
+ return false;
+@@ -3081,19 +3081,22 @@ static bool ieee80211_amsdu_prepare_head
+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
+ return true;
+
+- if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
++ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr),
+ &subframe_len))
+ return false;
+
+- amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
+- memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
+- memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
++ data = skb_push(skb, sizeof(*amsdu_hdr));
++ memmove(data, data + sizeof(*amsdu_hdr), hdr_len);
++ hdr = data;
++ amsdu_hdr = data + hdr_len;
++ /* h_80211_src/dst is addr* field within hdr */
++ h_80211_src = data + fast_tx->sa_offs;
++ h_80211_dst = data + fast_tx->da_offs;
+
+- data = skb_push(skb, sizeof(amsdu_hdr));
+- memmove(data, data + sizeof(amsdu_hdr), hdr_len);
+- memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
++ amsdu_hdr->h_proto = cpu_to_be16(subframe_len);
++ ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
++ ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
+
+- hdr = data;
+ qc = ieee80211_get_qos_ctl(hdr);
+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+
diff --git a/package/kernel/mac80211/patches/320-mac80211-fix-A-MSDU-outer-SA-DA.patch b/package/kernel/mac80211/patches/320-mac80211-fix-A-MSDU-outer-SA-DA.patch
new file mode 100644
index 0000000000..7700254cd1
--- /dev/null
+++ b/package/kernel/mac80211/patches/320-mac80211-fix-A-MSDU-outer-SA-DA.patch
@@ -0,0 +1,73 @@
+From: Michael Braun <michael-dev@fami-braun.de>
+Date: Sat, 15 Oct 2016 13:28:19 +0200
+Subject: [PATCH] mac80211: fix A-MSDU outer SA/DA
+
+According to IEEE 802.11-2012 section 8.3.2 table 8-19, the outer SA/DA
+of A-MSDU frames need to be changed depending on FromDS/ToDS values.
+
+Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
+[use ether_addr_copy and add alignment annotations]
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -1438,7 +1438,7 @@ enum ieee80211_vif_flags {
+ struct ieee80211_vif {
+ enum nl80211_iftype type;
+ struct ieee80211_bss_conf bss_conf;
+- u8 addr[ETH_ALEN];
++ u8 addr[ETH_ALEN] __aligned(2);
+ bool p2p;
+ bool csa_active;
+ bool mu_mimo_owner;
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -443,7 +443,7 @@ struct ieee80211_if_managed {
+ struct ieee80211_mgd_auth_data *auth_data;
+ struct ieee80211_mgd_assoc_data *assoc_data;
+
+- u8 bssid[ETH_ALEN];
++ u8 bssid[ETH_ALEN] __aligned(2);
+
+ u16 aid;
+
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -3074,6 +3074,7 @@ static bool ieee80211_amsdu_prepare_head
+ int subframe_len = skb->len - hdr_len;
+ void *data;
+ u8 *qc, *h_80211_src, *h_80211_dst;
++ const u8 *bssid;
+
+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
+ return false;
+@@ -3097,6 +3098,28 @@ static bool ieee80211_amsdu_prepare_head
+ ether_addr_copy(amsdu_hdr->h_source, h_80211_src);
+ ether_addr_copy(amsdu_hdr->h_dest, h_80211_dst);
+
++ /* according to IEEE 802.11-2012 8.3.2 table 8-19, the outer SA/DA
++ * fields needs to be changed to BSSID for A-MSDU frames depending
++ * on FromDS/ToDS values.
++ */
++ switch (sdata->vif.type) {
++ case NL80211_IFTYPE_STATION:
++ bssid = sdata->u.mgd.bssid;
++ break;
++ case NL80211_IFTYPE_AP:
++ case NL80211_IFTYPE_AP_VLAN:
++ bssid = sdata->vif.addr;
++ break;
++ default:
++ bssid = NULL;
++ }
++
++ if (bssid && ieee80211_has_fromds(hdr->frame_control))
++ ether_addr_copy(h_80211_src, bssid);
++
++ if (bssid && ieee80211_has_tods(hdr->frame_control))
++ ether_addr_copy(h_80211_dst, bssid);
++
+ qc = ieee80211_get_qos_ctl(hdr);
+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+