Skip to contentSkip to conversation

mac80211: add 802.11 decapsulation offload support

PATCH In review Sriram R 2 participants 5 messages Jun 10, 2020 – Aug 3, 2020

Subsystems (2)
lore
Share & tools
lore

Sriram R

author
#0 lore raw

cover mac80211: add 802.11 decapsulation offload support

Adding support for offloading 802.11 decapsulation to the HW. This helps in RX path optmization to reduces the CPU cycles spent on host CPU for doing the conversion from 802.11 format to ethernet format and thereby improving the performance of the device.

Sriram R (2):
mac80211: add receive path for ethernet frame format
ath11k: add rx path 802.11 decapsulation offloading support

 drivers/net/wireless/ath/ath11k/core.h     |   3 +
 drivers/net/wireless/ath/ath11k/dp_rx.c    | 185 ++++++++++++++----------
 drivers/net/wireless/ath/ath11k/hal_desc.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c      |  20 +++
 include/net/mac80211.h                     |  20 +++
 net/mac80211/rx.c                          | 222 ++++++++++++++++++++++++++++-
 6 files changed, 373 insertions(+), 79 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 mac80211: add receive path for ethernet frame format

Implement rx path which does fewer processing on the received data frame which has already gone through 802.11 header decapsulation and other functionalities which require 802.11 header in the low level driver or hardware. Currently this rx path is restricted to AP and STA mode, but can be extended for Adhoc mode as well.

It is upto to the low level driver to invoke the correct API and make sure if the frame that it passes is in ethernet format and the sta pointer is valid.

---
 include/net/mac80211.h |  20 +++++
 net/mac80211/rx.c      | 222 +++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 237 insertions(+), 5 deletions(-)
include/net/mac80211.h +20 -0
index 7cb7124..9233a3b 100644
@@ -1258,6 +1258,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  *	the "0-length PSDU" field included there.  The value for it is
  *	in &struct ieee80211_rx_status.  Note that if this value isn't
  *	known the frame shouldn't be reported.
+ * @RX_FLAG_80211_MCAST: If the receiver address (addr1) in the frame is
+ *	multicast. This is used with the data frames by the drivers
+ *	supporting 802.11 hdr decap offload.
  */
 enum mac80211_rx_flags {
 	RX_FLAG_MMIC_ERROR		= BIT(0),
@@ -1290,6 +1293,7 @@ enum mac80211_rx_flags {
 	RX_FLAG_RADIOTAP_HE_MU		= BIT(27),
 	RX_FLAG_RADIOTAP_LSIG		= BIT(28),
 	RX_FLAG_NO_PSDU			= BIT(29),
+	RX_FLAG_80211_MCAST		= BIT(30),
 };
 
 /**
@@ -4442,6 +4446,22 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
 }
 
 /**
+ * ieee80211_rx_8023 - Receive frames in 802.11 decapsulated format
+ *
+ * Low level driver capable of 802.11 header decap uses this function. The frame
+ * will be in ethernet format.
+ * This function may not be called in IRQ context. Calls to this function
+ * for a single hardware must be synchronized against each other.
+ *
+ * @hw: the hardware this frame came in on
+ * @sta : the station the frame was received from, must not be %NULL
+ * @skb: the buffer to receive, owned by mac80211 after this call
+ * @napi: the NAPI context
+ */
+void ieee80211_rx_8023(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+		       struct sk_buff *skb, struct napi_struct *napi);
+
+/**
  * ieee80211_sta_ps_transition - PS transition for connected sta
  *
  * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
net/mac80211/rx.c +217 -5

248 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH 1/2] mac80211: add receive path for ethernet frame format

Hi,

sorry for the delay.

net/mac80211/rx.c __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control) · line 2512

Quoted 2 lines
net/mac80211/rx.c +2 -0
+static const u8 pae_group_addr[ETH_ALEN] __aligned(2) = {0x01, 0x80, 0xC2, 0x00,
+							 0x00, 0x03};

Why the strange line breaking, and not preserve like it was:

Quoted 11 lines

static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) {

net/mac80211/rx.c +0 -2
-	static const u8 pae_group_addr[ETH_ALEN] __aligned(2)
-		= { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
 	struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data;
@@ -2582,9 +2584,12 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
 		 * for non-QoS-data frames. Here we know it's a data
 		 * frame, so count MSDUs.
 		 */

net/mac80211/rx.c ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · line 2593

Quoted 10 lines
net/mac80211/rx.c +6 -3
-		u64_stats_update_begin(&rx->sta->rx_stats.syncp);
-		rx->sta->rx_stats.msdu[rx->seqno_idx]++;
-		u64_stats_update_end(&rx->sta->rx_stats.syncp);
+		rx_stats = &rx->sta->rx_stats;
+		if (ieee80211_hw_check(&rx->local->hw, USES_RSS))
+			rx_stats = this_cpu_ptr(rx->sta->pcpu_rx_stats);
+		u64_stats_update_begin(&rx_stats->syncp);
+		rx_stats->msdu[rx->seqno_idx]++;
+		u64_stats_update_end(&rx_stats->syncp);
 	}

This seems like an unrelated fix?

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4824

Quoted 6 lines
net/mac80211/rx.c +6 -0
+	if (ieee80211_hw_check(&local->hw, USES_RSS))
+		stats = this_cpu_ptr(sta->pcpu_rx_stats);
+
+	/* TODO: Extend ieee80211_rx_8023() with bssid so that Ethernet
+	 * encap/decap can be supported in Adhoc interface type as well.
+	 * Adhoc interface depends on bssid to update last_rx.

What would the plan for this be? And I guess by that I mostly mean "where's the space for it"? In a function argument?

Any reason not to do this from the start, to avoid having to change the API again later? Though I guess the bssid argument could then be allowed to be NULL for the modes listed:

Quoted 4 lines
net/mac80211/rx.c +4 -0
+	if (vif->type != NL80211_IFTYPE_STATION &&
+	    vif->type != NL80211_IFTYPE_AP_VLAN &&
+	    vif->type != NL80211_IFTYPE_AP)
+		goto drop;

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4837

Quoted 10 lines
net/mac80211/rx.c +8 -0
 
 
+
+	if (unlikely(!test_sta_flag(sta, WLAN_STA_AUTHORIZED))) {
+		if (ehdr->h_proto != sdata->control_port_protocol)
+			goto drop;
+		else if (!ether_addr_equal(ehdr->h_dest, vif->addr) &&
+			 !ether_addr_equal(ehdr->h_dest, pae_group_addr))
+			goto drop;
+	}

Maybe refactor ieee80211_frame_allowed() a bit? This is basically the same as the first condition in there, after all. Then you'd also not have to pull pae_group_addr to the file scope.

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4843

Quoted 5 lines
net/mac80211/rx.c +5 -0
+	if (status->flag & RX_FLAG_80211_MCAST) {
+		for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+			key = rcu_dereference(sta->gtk[i]);
+			if (key)
+				break;

What? This doesn't seem right at all.

Either you cannot support multiple GTKs (umm?) or you should probably have the right one somehow? Or maybe you don't need to do anything per key?

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4856

Quoted 13 lines
net/mac80211/rx.c +13 -0
+		}
+	} else {
+		key = rcu_dereference(sta->ptk[sta->ptk_idx]);
+	}
+
+	if (key && unlikely(key->flags & KEY_FLAG_TAINTED))
+		goto drop;
+
+	if (status->flag & RX_FLAG_MMIC_ERROR) {
+		if (key)
+			key->u.tkip.mic_failures++;
+		goto mic_fail;
+	}

But then you do per-key things.

Quoted 7 lines
net/mac80211/rx.c +7 -0
+	if (!(status->flag & RX_FLAG_DUP_VALIDATED))
+		goto drop;
+
+	I802_DEBUG_INC(local->dot11ReceivedFragmentCount);
+
+	if (!(status->flag & RX_FLAG_80211_MCAST)) {
+		stats->last_rx = jiffies;

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4879

Quoted 10 lines
net/mac80211/rx.c +10 -0
+		stats->last_rate = sta_stats_encode_rate(status);
+	}
+
+	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+	    !(status->flag & RX_FLAG_80211_MCAST))
+		ieee80211_sta_reset_conn_monitor(sdata);
+
+	u64_stats_update_begin(&stats->syncp);
+	stats->fragments++;
+	stats->packets++;

fragments and packets don't need the begin/end, do they?

Quoted 14 lines
net/mac80211/rx.c +14 -0
+	stats->bytes += skb->len;
+	u64_stats_update_end(&stats->syncp);
+
+	if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
+		stats->last_signal = status->signal;
+		if (!ieee80211_hw_check(&local->hw, USES_RSS))
+			ewma_signal_add(&sta->rx_stats_avg.signal,
+					-status->signal);
+	}
+
+	if (status->chains) {
+		stats->chains = status->chains;
+		for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) {
+			int signal = status->chain_signal[i];

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4903

Quoted 10 lines
net/mac80211/rx.c +10 -0
+
+			if (!(status->chains & BIT(i)))
+				continue;
+
+			stats->chain_signal_last[i] = signal;
+			if (!ieee80211_hw_check(&local->hw, USES_RSS))
+				ewma_signal_add(&sta->rx_stats_avg.chain_signal[i],
+						-signal);
+		}
+	}

This seems very duplicated - can you refactor it?

Quoted 4 lines
net/mac80211/rx.c +4 -0
+	if (unlikely(ehdr->h_proto == cpu_to_be16(ETH_P_TDLS))) {
+		struct ieee80211_tdls_data *tf = (void *)skb->data;
+
+		if (pskb_may_pull(skb,

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4918

Quoted 10 lines
net/mac80211/rx.c +10 -0
+				  offsetof(struct ieee80211_tdls_data, u)) &&
+		    tf->payload_type == WLAN_TDLS_SNAP_RFTYPE &&
+		    tf->category == WLAN_CATEGORY_TDLS &&
+		    (tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_REQUEST ||
+		     tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_RESPONSE)) {
+			skb_queue_tail(&local->skb_queue_tdls_chsw, skb);
+			schedule_work(&local->tdls_chsw_work);
+			return;
+		}
+	}

same here.

Ultimately, it seems that the parts of the RX path _after_ conversion really ought to be the same between the normal and offloaded conversion? So why wouldn't those be (essentially) the same code?

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4941

Quoted 5 lines
net/mac80211/rx.c +5 -0
+	/* FIXME: Since rx.seqno_idx is not available for decap offloaded frames
+	 * rx msdu stats update at the seqno_idx in ieee80211_deliver_skb()
+	 * will always be updated at index 0 and will not be very useful.
+	 */
+	ieee80211_deliver_skb(&rx);

That's an issue. You should either fix that or prevent the bad counters being shown to userspace - IMHO lack of stats is better than broken stats.

johannes

author
#3 lore raw

Re: [PATCH 1/2] mac80211: add receive path for ethernet frame format

Hi,

Quoted 9 lines · Johannes Berg

Hi,

sorry for the delay.

net/mac80211/rx.c __ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control) · line 2512

Quoted 3 lines

+static const u8 pae_group_addr[ETH_ALEN] __aligned(2) = {0x01, 0x80, 0xC2, 0x00,

net/mac80211/rx.c +1 -0
+							 0x00, 0x03};

Why the strange line breaking, and not preserve like it was:

I'll fix in next revision.

Quoted 18 lines
Quoted 18 lines

static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx,
__le16 fc)
{

net/mac80211/rx.c +1 -5
-	static const u8 pae_group_addr[ETH_ALEN] __aligned(2)
-		= { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
 	struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data;
@@ -2582,9 +2584,12 @@ ieee80211_deliver_skb(struct ieee80211_rx_data 
 *rx)
 		 * for non-QoS-data frames. Here we know it's a data
 		 * frame, so count MSDUs.
 		 */
-		u64_stats_update_begin(&rx->sta->rx_stats.syncp);
-		rx->sta->rx_stats.msdu[rx->seqno_idx]++;
-		u64_stats_update_end(&rx->sta->rx_stats.syncp);
+		rx_stats = &rx->sta->rx_stats;
Quoted 8 lines

net/mac80211/rx.c ieee80211_deliver_skb(struct ieee80211_rx_data *rx) · line 2593

Quoted 6 lines
net/mac80211/rx.c +5 -0
+		if (ieee80211_hw_check(&rx->local->hw, USES_RSS))
+			rx_stats = this_cpu_ptr(rx->sta->pcpu_rx_stats);
+		u64_stats_update_begin(&rx_stats->syncp);
+		rx_stats->msdu[rx->seqno_idx]++;
+		u64_stats_update_end(&rx_stats->syncp);
 	}

This seems like an unrelated fix?

Yes, I'll move this separately.

Quoted 11 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4824

Quoted 7 lines
net/mac80211/rx.c +6 -0
+	if (ieee80211_hw_check(&local->hw, USES_RSS))
+		stats = this_cpu_ptr(sta->pcpu_rx_stats);
+
+	/* TODO: Extend ieee80211_rx_8023() with bssid so that Ethernet
+	 * encap/decap can be supported in Adhoc interface type as well.
+	 * Adhoc interface depends on bssid to update last_rx.

What would the plan for this be? And I guess by that I mostly mean "where's the space for it"? In a function argument?

Quoted 3 lines

Any reason not to do this from the start, to avoid having to change the API again later? Though I guess the bssid argument could then be allowed to be NULL for the modes listed:

Sure, i'll extend the api in next revision.

Quoted 7 lines
Quoted 5 lines
net/mac80211/rx.c +4 -0
+	if (vif->type != NL80211_IFTYPE_STATION &&
+	    vif->type != NL80211_IFTYPE_AP_VLAN &&
+	    vif->type != NL80211_IFTYPE_AP)
+		goto drop;
Quoted 13 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4837

Quoted 8 lines
net/mac80211/rx.c +8 -0
+
+	if (unlikely(!test_sta_flag(sta, WLAN_STA_AUTHORIZED))) {
+		if (ehdr->h_proto != sdata->control_port_protocol)
+			goto drop;
+		else if (!ether_addr_equal(ehdr->h_dest, vif->addr) &&
+			 !ether_addr_equal(ehdr->h_dest, pae_group_addr))
+			goto drop;
+	}

Maybe refactor ieee80211_frame_allowed() a bit? This is basically the same as the first condition in there, after all. Then you'd also not have to pull pae_group_addr to the file scope.

Sure. I'll refactor this and similar duplicate code below in next revision.

Quoted 7 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4843

Quoted 5 lines
net/mac80211/rx.c +5 -0
+	if (status->flag & RX_FLAG_80211_MCAST) {
+		for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+			key = rcu_dereference(sta->gtk[i]);
+			if (key)
+				break;

What? This doesn't seem right at all.

I'll update ieee80211_rx_8023() to get some meta data of the received packet such as key id and tid from the driver, so that this key id selection and
tid stats issue pointed below is also resolved.

Quoted 32 lines

Either you cannot support multiple GTKs (umm?) or you should probably have the right one somehow? Or maybe you don't need to do anything per key?

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4856

Quoted 13 lines
net/mac80211/rx.c +13 -0
+		}
+	} else {
+		key = rcu_dereference(sta->ptk[sta->ptk_idx]);
+	}
+
+	if (key && unlikely(key->flags & KEY_FLAG_TAINTED))
+		goto drop;
+
+	if (status->flag & RX_FLAG_MMIC_ERROR) {
+		if (key)
+			key->u.tkip.mic_failures++;
+		goto mic_fail;
+	}

But then you do per-key things.

Quoted 11 lines
net/mac80211/rx.c +11 -0
+	if (!(status->flag & RX_FLAG_DUP_VALIDATED))
+		goto drop;
+
+	I802_DEBUG_INC(local->dot11ReceivedFragmentCount);
+
+	if (!(status->flag & RX_FLAG_80211_MCAST)) {
+		stats->last_rx = jiffies;
+		stats->last_rate = sta_stats_encode_rate(status);
+	}
+
+	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
Quoted 8 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4879

Quoted 6 lines
net/mac80211/rx.c +6 -0
+	    !(status->flag & RX_FLAG_80211_MCAST))
+		ieee80211_sta_reset_conn_monitor(sdata);
+
+	u64_stats_update_begin(&stats->syncp);
+	stats->fragments++;
+	stats->packets++;

fragments and packets don't need the begin/end, do they?

I'll remove it.

Quoted 19 lines
Quoted 19 lines
net/mac80211/rx.c +18 -0
+	stats->bytes += skb->len;
+	u64_stats_update_end(&stats->syncp);
+
+	if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
+		stats->last_signal = status->signal;
+		if (!ieee80211_hw_check(&local->hw, USES_RSS))
+			ewma_signal_add(&sta->rx_stats_avg.signal,
+					-status->signal);
+	}
+
+	if (status->chains) {
+		stats->chains = status->chains;
+		for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) {
+			int signal = status->chain_signal[i];
+
+			if (!(status->chains & BIT(i)))
+				continue;
+
Quoted 8 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4903

Quoted 6 lines
net/mac80211/rx.c +6 -0
+			stats->chain_signal_last[i] = signal;
+			if (!ieee80211_hw_check(&local->hw, USES_RSS))
+				ewma_signal_add(&sta->rx_stats_avg.chain_signal[i],
+						-signal);
+		}
+	}

This seems very duplicated - can you refactor it?

Sure.

Quoted 18 lines
Quoted 5 lines
net/mac80211/rx.c +4 -0
+	if (unlikely(ehdr->h_proto == cpu_to_be16(ETH_P_TDLS))) {
+		struct ieee80211_tdls_data *tf = (void *)skb->data;
+
+		if (pskb_may_pull(skb,

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4918

Quoted 10 lines
net/mac80211/rx.c +10 -0
+				  offsetof(struct ieee80211_tdls_data, u)) &&
+		    tf->payload_type == WLAN_TDLS_SNAP_RFTYPE &&
+		    tf->category == WLAN_CATEGORY_TDLS &&
+		    (tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_REQUEST ||
+		     tf->action_code == WLAN_TDLS_CHANNEL_SWITCH_RESPONSE)) {
+			skb_queue_tail(&local->skb_queue_tdls_chsw, skb);
+			schedule_work(&local->tdls_chsw_work);
+			return;
+		}
+	}

same here.

Quoted 3 lines

Ultimately, it seems that the parts of the RX path _after_ conversion really ought to be the same between the normal and offloaded conversion? So why wouldn't those be (essentially) the same code?

Yes, i'll remove these duplicate code in next revision.

Quoted 11 lines

net/mac80211/rx.c void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) · line 4941

Quoted 7 lines
(quoted diff) +1 -0
+	/* FIXME: Since rx.seqno_idx is not available for decap offloaded 

frames

net/mac80211/rx.c +4 -0
+	 * rx msdu stats update at the seqno_idx in ieee80211_deliver_skb()
+	 * will always be updated at index 0 and will not be very useful.
+	 */
+	ieee80211_deliver_skb(&rx);

That's an issue. You should either fix that or prevent the bad counters being shown to userspace - IMHO lack of stats is better than broken stats.

As mentioned, we can extend the api to allow the driver to pass tid as part of rx metadata and have the stats updated.

Thanks for review.

Regards,
Sriram.R

Quoted 2 lines

johannes

Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
author
#4 lore raw

PATCH 2/2 ath11k: add rx path 802.11 decapsulation offloading support

In reply to Sriram R

Adding 802.11 decapsulation offloading support to the driver. Since the packets delivered to the driver are in 802.3 format, these can be sent to the network core with minimal processing in mac80211. This helps in releasing some CPU cycles in the host processor and thereby improving the performance.

Ethernet decap can be enabled by using a modparam as shown below:
insmod ath11k frame_mode=2

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1

---
 drivers/net/wireless/ath/ath11k/core.h     |   3 +
 drivers/net/wireless/ath/ath11k/dp_rx.c    | 185 +++++++++++++++++------------
 drivers/net/wireless/ath/ath11k/hal_desc.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c      |  20 ++++
 4 files changed, 136 insertions(+), 74 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +3 -0
index e04f0e7..f9e0f30 100644
@@ -77,6 +77,7 @@ struct ath11k_skb_rxcb {
 	bool is_first_msdu;
 	bool is_last_msdu;
 	bool is_continuation;
+	bool is_mcbc;
 	struct hal_rx_desc *rx_desc;
 	u8 err_rel_src;
 	u8 err_code;
@@ -84,6 +85,8 @@ struct ath11k_skb_rxcb {
 	u8 unmapped;
 	u8 is_frag;
 	u8 tid;
+	u16 peer_id;
+	u16 seq_no;
 };
 
 enum ath11k_hw_rev {
drivers/net/wireless/ath/ath11k/dp_rx.c +111 -74

326 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/hal_desc.h +2 -0
index 8a59281..a47c288 100644
@@ -496,6 +496,8 @@ struct hal_tlv_hdr {
 #define RX_MPDU_DESC_INFO0_DA_IDX_TIMEOUT	BIT(29)
 #define RX_MPDU_DESC_INFO0_RAW_MPDU		BIT(30)
 
+#define RX_MPDU_DESC_META_DATA_PEER_ID		GENMASK(15, 0)
+
 struct rx_mpdu_desc {
 	u32 info0; /* %RX_MPDU_DESC_INFO */
 	u32 meta_data;
drivers/net/wireless/ath/ath11k/mac.c +20 -0
index 2836a0f..de6c132 100644
@@ -4278,6 +4278,26 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
 		goto err_vdev_del;
 	}
 
+	/* Do not enable ethernet mode for mesh vifs, packets in mesh network
+	 * can be forwarded to other mesh nodes and mac80211 expects the packet
+	 * in 802.11 format. Also, please note that ethernet mode shall not be
+	 * used on interface where 4addr mode is enabled as we might not have
+	 * 4addr related config during add_interface().
+	 */
+	if (ath11k_frame_mode == ATH11K_HW_TXRX_ETHERNET &&
+	    vif->type != NL80211_IFTYPE_MESH_POINT) {
+		param_id = WMI_VDEV_PARAM_RX_DECAP_TYPE;
+		param_value = ATH11K_HW_TXRX_ETHERNET;
+
+		ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+						    param_id, param_value);
+		if (ret) {
+			ath11k_warn(ab, "failed to set vdev %d tx encap mode: %d\n",
+				    arvif->vdev_id, ret);
+			goto err_vdev_del;
+		}
+	}
+
 	nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1;
 	ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
 					    WMI_VDEV_PARAM_NSS, nss);
Signature · 1 line
2.7.4