wifi: mac80211: TSO and SG for encap offload, and the TID of 802.3 RX frames
v2 cover wifi: mac80211: TSO and SG for encap offload, and the TID of 802.3 RX frames
Patch 4 lets a driver offer TSO and scatter-gather on the netdevs that send with 802.3 encap offload, without offering them on the 802.11 path. ath11k uses it in a series for ath-next that lets the TCL segment TCP batches, which depends on this patch. Patches 1 to 3 fix the AQL airtime estimate, which patch 4 uses to segment a GSO frame for a slow station.
Patches 5 to 7 count frames received in 802.3 format on their TID: the 802.3 receive path counted all of them on TID 0. Patch 5 adds the field, 6 and 7 fill it in ath11k and ath12k.
What the fixes for released code change:
- Patch 1: a station that sends at a low rate to an mt76x0, mt76x2 or mt7603 radio, which compute RX airtime over a whole A-MPDU, is charged a fraction of its airtime and gets more than its share under airtime fairness. CVSS 3.1 3.5 (AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L). Found by the hosted Sashiko review of v1.
- Patch 2: every VO frame an AQL driver (mt76, ath10k) sends at an HT or later rate is charged less than its airtime, so the VO queue holds more than the AQL limit. CVSS 3.1 0.0, queue accounting only. Found by an LLM review (Claude).
- Patch 3: an estimate of 65536 us or more is charged modulo 65536 us. Without patch 4 that takes an A-MSDU of about 8 KB to a station whose last rate is 1 Mbit/s. CVSS 3.1 0.0, queue accounting only. Found by an LLM review (Claude).
- Patch 5: the per-TID RX MSDU counters of a station count every 802.3 frame on TID 0. CVSS 3.1 0.0, statistics only. Found reading the 802.3 receive path.
None of them touches memory safety, and nothing short of the patches avoids them.
Tests, on x86_64:
- A KUnit test of airtime.c (not part of this series), HT MCS0 20 MHz. wireless-next fails all 5 cases: 65536 bytes come out as 2834 us instead of 80658 us, the VO and A-MPDU estimates of 1500 bytes are both 1912 us, and 65540 us is stored as 4 us. With patch 1, 3 cases pass; with patch 2, 4 (VO 1932 us); with patch 3, all 5. One run each.
- mac80211_hwsim in QEMU with a local change that sets encap offload and encap_netdev_features (not part of this series): a netdev created as station, changed to mesh point and joined to a mesh, TCP for 5 s. v1 handed GSO frames to its ndo_start_xmit and skb_checksum_help() warned, in 2 of 2 runs; this version hands it none and nothing warns, in 2 of 2 runs. A P2P client netdev has TSO and SG with this version and had neither with v1.
- W=1 builds of each patch for x86_64 (gcc) and arm64 (clang 21), with no warnings.
Changes in v2:
- New patches 1 to 3.
- Patch 4 (v1 1/4): the encap features are taken away per frame on the non-encap netdev ops, the AQL fallback keeps SG, a station without a usable rate gets its GSO frames segmented, kernel-doc for an encap_gso_max_segs of 0.
- Patches 6 and 7 (v1 3/4 and 4/4): read the TID before the copy of the rx status overwrites it, and report frames without QoS control as such.
- Rebased onto wireless-next 18d0bedbb5f0.
Details below the --- of each patch.
v1: https://lore.kernel.org/all/[email protected]/
I used Claude (Anthropic) to help write these patches.
Julius Bairaktaris (7):
wifi: mac80211: compute the airtime estimate in 64 bits
wifi: mac80211: use the ampdu argument of
ieee80211_calc_expected_tx_airtime()
wifi: mac80211: clamp the AQL airtime estimate before narrowing it
wifi: mac80211: advertise TSO and SG for encap offloaded frames
wifi: mac80211: take the TID of an 802.3 frame from the driver
wifi: ath11k: pass the TID of a received 802.3 frame to mac80211
wifi: ath12k: pass the TID of a received 802.3 frame to mac80211
drivers/net/wireless/ath/ath11k/dp_rx.c | 14 +++- drivers/net/wireless/ath/ath11k/hw.c | 25 +++++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath12k/dp_rx.c | 2 + drivers/net/wireless/ath/ath12k/hal.h | 1 + .../wireless/ath/ath12k/wifi7/hal_qcc2072.c | 8 +++ .../wireless/ath/ath12k/wifi7/hal_qcn9274.c | 9 +++ .../wireless/ath/ath12k/wifi7/hal_wcn7850.c | 9 +++ include/net/mac80211.h | 23 ++++++- net/mac80211/airtime.c | 9 +-- net/mac80211/iface.c | 28 ++++++++ net/mac80211/main.c | 3 +- net/mac80211/rx.c | 3 + net/mac80211/tx.c | 65 ++++++++++++++++++- 14 files changed, 188 insertions(+), 12 deletions(-)
base-commit: 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23
Signature · 1 line
2.53.0
PATCH v2 1/7 wifi: mac80211: compute the airtime estimate in 64 bits
ieee80211_calc_rx_airtime() and ieee80211_rate_expected_tx_airtime() multiply the duration of an AVG_PKT_SIZE frame, in 1/1024 us, by the frame length in a u32. The product is the airtime in us times 2^20, so it wraps once the airtime reaches 4096 us. At HT MCS0 a 4096 byte A-MPDU comes out as 945 us instead of 5041 us.
mt76x0, mt76x2 and mt7603 compute RX airtime in software and pass the length of a whole A-MPDU to ieee80211_calc_rx_airtime(), so a station that sends at a low rate is charged a fraction of its airtime.
Do the multiplication in 64 bits. Where it did not wrap, the result is the same.
Found by the hosted Sashiko review of v1.
---
v2:
- New. The GSO estimate of v1 1/4 wrapped here.
net/mac80211/airtime.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/mac80211/airtime.c +2 -5
@@ -616,9 +616,7 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,if (!duration)return 0 ; - duration *= len; - duration /=AVG_PKT_SIZE ; - duration /=1024 ; + duration =div_u64 (mul_u32_u32 (duration, len),AVG_PKT_SIZE *1024 );return duration + overhead; }
@@ -813,8 +811,7 @@ u32 ieee80211_rate_expected_tx_airtime(struct ieee80211_hw *hw,else agg_shift =6 ; - duration *= len; - duration /=AVG_PKT_SIZE ; + duration =div_u64 (mul_u32_u32 (duration, len),AVG_PKT_SIZE ); duration += (overhead *1024 >> agg_shift);return duration;
Signature · 1 line
2.53.0
PATCH v2 2/7 wifi: mac80211: use the ampdu argument of ieee80211_calc_expected_tx_airtime()
In reply to Julius BairaktarisSince ieee80211_rate_expected_tx_airtime() was split out, ieee80211_calc_expected_tx_airtime() passes true to it and ignores its own ampdu argument. ieee80211_tx_dequeue() passes false for a frame on the VO queue, which AQL is then charged as part of an A-MPDU: its PHY overhead is divided by 2 to 64 instead of charged in full.
Pass ampdu on.
Found by an LLM review (Claude) of the airtime code.
---
v2:
- New.
net/mac80211/airtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/airtime.c +1 -1
@@ -843,7 +843,7 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,u32 duration; duration =ieee80211_rate_expected_tx_airtime (hw, tx_rate, ri, - band, true, len); + band, ampdu, len); duration /=1024 ;return max_t (u32, duration,4 );
Signature · 1 line
2.53.0
PATCH v2 3/7 wifi: mac80211: clamp the AQL airtime estimate before narrowing it
In reply to Julius Bairaktarisieee80211_info_set_tx_time_est() takes the estimate as u16 and clamps it to 4095 us, but ieee80211_tx_dequeue() passes a u32. An estimate of 65536 us or more loses its upper bits before the clamp: 65540 us is charged as 4 us.
Take the estimate as u32.
Found by an LLM review (Claude) of the airtime code.
---
v2:
- New.
include/net/mac80211.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/mac80211.h +2 -2
@@ -1425,12 +1425,12 @@ struct ieee80211_tx_info { };static inline u16 -ieee80211_info_set_tx_time_est (struct ieee80211_tx_info *info,u16 tx_time_est) +ieee80211_info_set_tx_time_est (struct ieee80211_tx_info *info,u32 tx_time_est) {/* We only have 10 bits in tx_time_est, so store airtime * in increments of 4us and clamp the maximum to 2**12-1 */ - info->tx_time_est =min_t (u16, tx_time_est,4095 ) >>2 ; + info->tx_time_est =min_t (u32, tx_time_est,4095 ) >>2 ;return info->tx_time_est <<2 ; }
Signature · 1 line
2.53.0
PATCH v2 4/7 wifi: mac80211: advertise TSO and SG for encap offloaded frames
In reply to Julius BairaktarisA driver whose hardware segments TCP frames and takes frames with fragments on its 802.3 encap path cannot say so. hw->netdev_features applies to every netdev of the hw, so a feature set there also reaches the frames that go out through the 802.11 path.
Add hw->encap_netdev_features and hw->encap_gso_max_segs. When the hw supports encap offload, mac80211 sets the features on each netdev it creates, and ieee80211_8023_xmit() passes them to ieee80211_tx_skb_fixup(), so a GSO frame reaches the driver whole.
Whether a netdev sends with encap offload changes with its type, 4addr mode, fragmentation threshold and monitor interfaces, and mac80211 switches its netdev ops when it does. The ops of the 802.11 and monitor paths get an ndo_features_check that drops the encap features, so the stack segments, linearizes and resolves the checksum first.
AQL charges a frame by tx_time_est, which ieee80211_info_set_tx_time_est() caps at 4095 us. A whole GSO frame to a slow station, or to one whose rate mac80211 does not know yet, would be charged less than its airtime. Segment such a frame in software instead; the segments keep scatter-gather. The check uses the rate of the station when the frame is queued.
The tx statistics count a TCP GSO frame as gso_segs packets, with the headers of every segment in its length.
---
v2:
- Take the encap features away per frame in ndo_features_check of the non-encap ops, instead of setting them by interface type when the netdev is created. v1 left them on a netdev changed to mesh point, whose fast path then warned in skb_checksum_help(), and never set them on P2P netdevs. Found by the hosted Sashiko review of v1.
- The AQL fallback clears only the GSO bits and keeps SG. Found by the hosted Sashiko review of v1.
- Segment a GSO frame for a station with no usable rate, which AQL charges as 4 us. Found by an LLM review (Claude).
- Say in the kernel-doc that an encap_gso_max_segs of 0 keeps the default of the netdev. Found by an LLM review (Claude).
include/net/mac80211.h | 15 ++++++++++ net/mac80211/iface.c | 28 ++++++++++++++++++ net/mac80211/main.c | 3 +- net/mac80211/tx.c | 65 ++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 108 insertions(+), 3 deletions(-)
include/net/mac80211.h +15 -0
@@ -3271,6 +3271,19 @@ enum ieee80211_hw_flags {* @netdev_features: netdev features to be set in each netdev created * from this HW. Note that not all features are usable with mac80211, * other features will be rejected during HW registration. +* @encap_netdev_features: netdev features, in addition to @netdev_features, +* set in each netdev created from this HW when it supports 802.3 +* encapsulation offload, for the frames that are sent with it (see +* %IEEE80211_OFFLOAD_ENCAP_ENABLED). A driver sets scatter-gather and +* segmentation offload here when the hardware takes such frames whole. +* mac80211 hands a driver a frame with these features only with +* %IEEE80211_TX_CTL_HW_80211_ENCAP, and segments or linearizes it in +* software on every other path, and for a station when the airtime +* estimate of the whole frame is more than AQL can account to one frame. +* Such a frame starts with its 802.3 header. +* @encap_gso_max_segs: the most segments of a GSO frame the driver takes +* whole, when @encap_netdev_features has a segmentation offload; 0 +* keeps the default limit of the netdev. * * @uapsd_queues: This bitmap is included in (re)association frame to indicate * for each access category if it is uAPSD trigger-enabled and delivery-
@@ -3330,6 +3343,8 @@ struct ieee80211_hw {s16 accuracy; } radiotap_timestamp;netdev_features_t netdev_features; +netdev_features_t encap_netdev_features; +u16 encap_gso_max_segs;u8 uapsd_queues;u8 uapsd_max_sp_len;u8 max_nan_de_entries;
net/mac80211/iface.c +28 -0
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/kernel.h> #include <linux/if_arp.h> +#include <linux/if_vlan.h> #include <linux/netdevice.h> #include <linux/rtnetlink.h> #include <linux/kcov.h>
@@ -960,11 +961,28 @@ static int ieee80211_netdev_setup_tc(struct net_device *dev,return drv_net_setup_tc (local, sdata, dev, type, type_data); } +/* For the netdev ops that send without the 802.3 encap offload: the frame +* is built into an 802.11 frame here, which cannot take what only the encap +* offload path takes, so the stack segments or linearizes it first. +*/ +static netdev_features_t +ieee80211_netdev_features_check (struct sk_buff *skb,struct net_device *dev, +netdev_features_t features) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_hw *hw = &sdata->local->hw; + + features &= ~(hw->encap_netdev_features & ~hw->netdev_features); + +return vlan_features_check (skb, features); +} +static const struct net_device_ops ieee80211_dataif_ops = { .ndo_open = ieee80211_open, .ndo_stop = ieee80211_stop, .ndo_uninit = ieee80211_uninit, .ndo_start_xmit = ieee80211_subif_start_xmit, + .ndo_features_check = ieee80211_netdev_features_check, .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, .ndo_setup_tc = ieee80211_netdev_setup_tc,
@@ -1003,6 +1021,7 @@ static const struct net_device_ops ieee80211_monitorif_ops = { .ndo_stop = ieee80211_stop, .ndo_uninit = ieee80211_uninit, .ndo_start_xmit = ieee80211_monitor_start_xmit, + .ndo_features_check = ieee80211_netdev_features_check, .ndo_set_rx_mode = ieee80211_set_multicast_list, .ndo_set_mac_address = ieee80211_change_mac, .ndo_select_queue = ieee80211_monitor_select_queue,
@@ -2407,6 +2426,15 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, sdata->u.mgd.use_4addr = params->use_4addr; ndev->features |= local->hw.netdev_features; +/* ieee80211_netdev_features_check() takes the encap features +* away from every frame sent without the encap offload +*/ +if (ieee80211_hw_check (&local->hw,SUPPORTS_TX_ENCAP_OFFLOAD )) { + ndev->features |= local->hw.encap_netdev_features; +if (local->hw.encap_gso_max_segs) +netif_set_tso_max_segs (ndev, + local->hw.encap_gso_max_segs); + } ndev->priv_flags |=IFF_LIVE_ADDR_CHANGE ; ndev->hw_features |= ndev->features &MAC80211_SUPPORTED_FEATURES_TX ;
net/mac80211/main.c +2 -1
@@ -1243,7 +1243,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) }/* Only HW csum features are currently compatible with mac80211 */ -if (WARN_ON (hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES )) +if (WARN_ON ((hw->netdev_features | hw->encap_netdev_features) & + ~MAC80211_SUPPORTED_FEATURES ))return -EINVAL ;if (hw->max_report_rates ==0 )
net/mac80211/tx.c +63 -2
96 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v2 5/7 wifi: mac80211: take the TID of an 802.3 frame from the driver
In reply to Julius Bairaktaris__ieee80211_rx_handle_8023() clears struct ieee80211_rx_data and never sets seqno_idx, so ieee80211_rx_8023() counts every frame received with RX_FLAG_8023 in rx_stats.msdu[0], whatever its TID. The native path takes the TID from the QoS header, which an 802.3 frame no longer has.
Add a tid field to struct ieee80211_rx_status for the driver to fill, and use it as seqno_idx on the 802.3 path. A driver that does not set it leaves it 0, which counts the frame on TID 0 as before.
---
v2:
- No change.
include/net/mac80211.h | 4 ++++ net/mac80211/rx.c | 3 +++ 2 files changed, 7 insertions(+)
include/net/mac80211.h +4 -0
@@ -1770,6 +1770,9 @@ enum mac80211_rx_encoding {* @ampdu_reference: A-MPDU reference number, must be a different value for * each A-MPDU but the same for each subframe within one A-MPDU * @zero_length_psdu_type: radiotap type of the 0-length PSDU +* @tid: the TID of a frame received in 802.3 format (%RX_FLAG_8023), or +* %IEEE80211_NUM_TIDS if it has none; counts the frame in the per-TID +* statistics of its station. Not read for other frames. * @link_id: id of the link used to receive the packet. Set and used by * mac80211 internally, it uses @freq set by the driver to identify the * correct link per vif. Set to %IEEE80211_LINK_UNSPECIFIED for non-MLD
@@ -1813,6 +1816,7 @@ struct ieee80211_rx_status {u8 chains;s8 chain_signal[IEEE80211_MAX_CHAINS ];u8 zero_length_psdu_type; +u8 tid; u8 link_id:4; };
net/mac80211/rx.c +3 -0
@@ -5303,6 +5303,7 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw,struct sk_buff *skb, struct list_head *list) { + struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_fast_rx *fast_rx;struct ieee80211_rx_data rx;
@@ -5313,6 +5314,8 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, rx.skb = skb; rx.local = local; rx.list = list; +/* the MSDU count of the station is kept per TID */ + rx.seqno_idx =min_t (u8, status->tid,IEEE80211_NUM_TIDS );I802_DEBUG_INC (local->dot11ReceivedFragmentCount);
Signature · 1 line
2.53.0
PATCH v2 6/7 wifi: ath11k: pass the TID of a received 802.3 frame to mac80211
In reply to Julius Bairaktarisath11k_dp_rx_deliver_msdu() delivers frames with Ethernet decap as RX_FLAG_8023, and mac80211 counted all of them on TID 0. Pass the TID the driver keeps in rxcb->tid. Copying the rx status into skb->cb overwrites rxcb, so read it before that.
On the REO path rxcb->tid is the REO queue number, which is HAL_DESC_REO_NON_QOS_TID for a frame without QoS control. The null queue descriptor path takes it from the 4-bit TID field of MPDU_START; set HAL_DESC_REO_NON_QOS_TID there as well when the MPDU has no QoS control, so mac80211 counts such a frame as non-QoS on both paths.
---
v2:
- Read rxcb->tid before *rx_status = *status overwrites it. Found by the hosted Sashiko review of v1.
- Report a frame without QoS control on the null queue descriptor path as HAL_DESC_REO_NON_QOS_TID. Found by an LLM review (Claude).
drivers/net/wireless/ath/ath11k/dp_rx.c | 14 +++++++++++++- drivers/net/wireless/ath/ath11k/hw.c | 25 +++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + 3 files changed, 39 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +13 -1
@@ -70,6 +70,12 @@ static inline bool ath11k_dp_rx_h_mpdu_start_fc_valid(struct ath11k_base *ab,return ab->hw_params.hw_ops->rx_desc_get_mpdu_fc_valid (desc); } +static inline bool ath11k_dp_rx_h_mpdu_start_qos_ctrl_valid (struct ath11k_base *ab, +struct hal_rx_desc *desc) +{ +return ab->hw_params.hw_ops->rx_desc_get_mpdu_qos_ctrl_valid (desc); +} +static inline bool ath11k_dp_rx_h_mpdu_start_more_frags (struct ath11k_base *ab,struct sk_buff *skb) {
@@ -2446,6 +2452,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *napu8 decap =DP_RX_DECAP_TYPE_RAW ;bool is_mcbc = rxcb->is_mcbc;bool is_eapol = rxcb->is_eapol; +u8 tid = rxcb->tid; if (status->encoding == RX_ENC_HE && !(status->flag & RX_FLAG_RADIOTAP_HE) &&
@@ -2493,6 +2500,7 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *nap rx_status =IEEE80211_SKB_RXCB (msdu); *rx_status = *status; + rx_status->tid =min_t (u8, tid,IEEE80211_NUM_TIDS );/* TODO: trace rx packet */
@@ -4001,7 +4009,11 @@ static int ath11k_dp_rx_h_null_q_desc(struct ath11k *ar, struct sk_buff *msdu,ath11k_dp_rx_h_mpdu (ar, msdu, desc, status); - rxcb->tid =ath11k_dp_rx_h_mpdu_start_tid (ar->ab, desc); +/* the REO queue number, as on the REO path */ +if (ath11k_dp_rx_h_mpdu_start_qos_ctrl_valid (ar->ab, desc)) + rxcb->tid =ath11k_dp_rx_h_mpdu_start_tid (ar->ab, desc); +else + rxcb->tid =HAL_DESC_REO_NON_QOS_TID ;/* Please note that caller will having the access to msdu and completing * rx with mac80211. Need not worry about cleaning up amsdu_list.
drivers/net/wireless/ath/ath11k/hw.c +25 -0
@@ -296,6 +296,12 @@ static bool ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc __le32_to_cpu(desc->u.ipq8074.mpdu_start.info1)); } +static bool ath11k_hw_ipq8074_rx_desc_get_mpdu_qos_ctrl_valid (struct hal_rx_desc *desc) +{ +return !!FIELD_GET (RX_MPDU_START_INFO1_MPDU_QOS_CTRL_VALID , +__le32_to_cpu (desc->u.ipq8074.mpdu_start.info1)); +} +static u16 ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no (struct hal_rx_desc *desc) { return FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_NUM,
@@ -473,6 +479,12 @@ static bool ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc __le32_to_cpu(desc->u.qcn9074.mpdu_start.info11)); } +static bool ath11k_hw_qcn9074_rx_desc_get_mpdu_qos_ctrl_valid (struct hal_rx_desc *desc) +{ +return !!FIELD_GET (RX_MPDU_START_INFO11_MPDU_QOS_CTRL_VALID , +__le32_to_cpu (desc->u.qcn9074.mpdu_start.info11)); +} +static u16 ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no (struct hal_rx_desc *desc) { return FIELD_GET(RX_MPDU_START_INFO11_MPDU_SEQ_NUM,
@@ -644,6 +656,12 @@ static bool ath11k_hw_wcn6855_rx_desc_get_mpdu_fc_valid(struct hal_rx_desc *desc __le32_to_cpu(desc->u.wcn6855.mpdu_start.info1)); } +static bool ath11k_hw_wcn6855_rx_desc_get_mpdu_qos_ctrl_valid (struct hal_rx_desc *desc) +{ +return !!FIELD_GET (RX_MPDU_START_INFO1_MPDU_QOS_CTRL_VALID , +__le32_to_cpu (desc->u.wcn6855.mpdu_start.info1)); +} +static u16 ath11k_hw_wcn6855_rx_desc_get_mpdu_start_seq_no (struct hal_rx_desc *desc) { return FIELD_GET(RX_MPDU_START_INFO1_MPDU_SEQ_NUM,
@@ -917,6 +935,7 @@ const struct ath11k_hw_ops ipq8074_ops = { .rx_desc_get_ldpc_support = ath11k_hw_ipq8074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi,
@@ -957,6 +976,7 @@ const struct ath11k_hw_ops ipq6018_ops = { .rx_desc_get_ldpc_support = ath11k_hw_ipq8074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi,
@@ -997,6 +1017,7 @@ const struct ath11k_hw_ops qca6390_ops = { .rx_desc_get_ldpc_support = ath11k_hw_ipq8074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_ipq8074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_ipq8074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_ipq8074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_ipq8074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_ipq8074_rx_desc_get_msdu_sgi,
@@ -1037,6 +1058,7 @@ const struct ath11k_hw_ops qcn9074_ops = { .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi,
@@ -1077,6 +1099,7 @@ const struct ath11k_hw_ops wcn6855_ops = { .rx_desc_get_ldpc_support = ath11k_hw_wcn6855_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_wcn6855_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_wcn6855_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_wcn6855_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_wcn6855_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_wcn6855_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_wcn6855_rx_desc_get_msdu_sgi,
@@ -1117,6 +1140,7 @@ const struct ath11k_hw_ops wcn6750_ops = { .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi,
@@ -1158,6 +1182,7 @@ const struct ath11k_hw_ops ipq5018_ops = { .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support, .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld, .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid, + .rx_desc_get_mpdu_qos_ctrl_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_qos_ctrl_valid, .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no, .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len, .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi,
drivers/net/wireless/ath/ath11k/hw.h +1 -0
@@ -252,6 +252,7 @@ struct ath11k_hw_ops {bool (*rx_desc_get_ldpc_support)(struct hal_rx_desc *desc);bool (*rx_desc_get_mpdu_seq_ctl_vld)(struct hal_rx_desc *desc);bool (*rx_desc_get_mpdu_fc_valid)(struct hal_rx_desc *desc); +bool (*rx_desc_get_mpdu_qos_ctrl_valid)(struct hal_rx_desc *desc);u16 (*rx_desc_get_mpdu_start_seq_no)(struct hal_rx_desc *desc);u16 (*rx_desc_get_msdu_len)(struct hal_rx_desc *desc);u8 (*rx_desc_get_msdu_sgi)(struct hal_rx_desc *desc);
Signature · 1 line
2.53.0
PATCH v2 7/7 wifi: ath12k: pass the TID of a received 802.3 frame to mac80211
In reply to Julius Bairaktarisath12k_dp_rx_deliver_msdu() delivers frames with Ethernet decap as RX_FLAG_8023, and mac80211 counted all of them on TID 0. Pass the TID from the rx descriptor data of the MSDU, or IEEE80211_NUM_TIDS when the MPDU has no QoS control. The TID field has 4 bits, so add the QoS control valid bit of MPDU_START to struct hal_rx_desc_data.
---
v2:
- Take the TID from rx_info instead of rxcb->tid, which *rx_status = *status overwrote before v1 read it. Found by the hosted Sashiko review of v1.
- Pass IEEE80211_NUM_TIDS for a frame without QoS control. Found by an LLM review (Claude).
drivers/net/wireless/ath/ath12k/dp_rx.c | 2 ++ drivers/net/wireless/ath/ath12k/hal.h | 1 + drivers/net/wireless/ath/ath12k/wifi7/hal_qcc2072.c | 8 ++++++++ drivers/net/wireless/ath/ath12k/wifi7/hal_qcn9274.c | 9 +++++++++ drivers/net/wireless/ath/ath12k/wifi7/hal_wcn7850.c | 9 +++++++++ 5 files changed, 29 insertions(+)
drivers/net/wireless/ath/ath12k/dp_rx.c +2 -0
@@ -1409,6 +1409,8 @@ void ath12k_dp_rx_deliver_msdu(struct ath12k_pdev_dp *dp_pdev, struct napi_struc rx_status =IEEE80211_SKB_RXCB (msdu); *rx_status = *status; + rx_status->tid = rx_info->qos_ctrl_valid ? rx_info->tid : +IEEE80211_NUM_TIDS ;/* TODO: trace rx packet */
drivers/net/wireless/ath/ath12k/hal.h +1 -0
@@ -739,6 +739,7 @@ struct hal_rx_desc_data { is_mcbc:1, seq_ctl_valid:1, fc_valid:1, + qos_ctrl_valid:1, is_to_ds:1, is_from_ds:1;u16 msdu_len;
drivers/net/wireless/ath/ath12k/wifi7/hal_qcc2072.c +8 -0
@@ -260,6 +260,12 @@ static bool ath12k_hal_rx_desc_get_mpdu_fc_valid_qcc2072(struct hal_rx_desc *des RX_MPDU_START_INFO4_MPDU_FCTRL_VALID); } +static bool ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_qcc2072 (struct hal_rx_desc *desc) +{ +return !!le32_get_bits (desc->u.qcc2072.mpdu_start.info4, +RX_MPDU_START_INFO4_MPDU_QOS_CTRL_VALID ); +} +static u16 ath12k_hal_rx_desc_get_mpdu_start_seq_no_qcc2072 (struct hal_rx_desc *desc) { return le32_get_bits(desc->u.qcc2072.mpdu_start.info4,
@@ -403,6 +409,8 @@ static void ath12k_hal_extract_rx_desc_data_qcc2072(struct hal_rx_desc_data *rx_ rx_desc_data->seq_ctl_valid =ath12k_hal_rx_desc_get_mpdu_seq_ctl_vld_qcc2072 (rx_desc); rx_desc_data->fc_valid =ath12k_hal_rx_desc_get_mpdu_fc_valid_qcc2072 (rx_desc); + rx_desc_data->qos_ctrl_valid = +ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_qcc2072 (rx_desc); rx_desc_data->seq_no =ath12k_hal_rx_desc_get_mpdu_start_seq_no_qcc2072 (rx_desc); rx_desc_data->msdu_len =ath12k_hal_rx_desc_get_msdu_len_qcc2072 (ldesc); rx_desc_data->sgi =ath12k_hal_rx_desc_get_msdu_sgi_qcc2072 (ldesc);
drivers/net/wireless/ath/ath12k/wifi7/hal_qcn9274.c +9 -0
@@ -722,6 +722,13 @@ bool ath12k_hal_rx_desc_get_mpdu_fc_valid_qcn9274(struct hal_rx_desc *desc) RX_MPDU_START_INFO4_MPDU_FCTRL_VALID); } +static inline +bool ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_qcn9274 (struct hal_rx_desc *desc) +{ +return !!le32_get_bits (desc->u.qcn9274_compact.mpdu_start.info4, +RX_MPDU_START_INFO4_MPDU_QOS_CTRL_VALID ); +} +static inline u16 ath12k_hal_rx_desc_get_mpdu_start_seq_no_qcn9274 (struct hal_rx_desc *desc) {
@@ -1024,6 +1031,8 @@ void ath12k_hal_extract_rx_desc_data_qcn9274(struct hal_rx_desc_data *rx_desc_da rx_desc_data->seq_ctl_valid =ath12k_hal_rx_desc_get_mpdu_seq_ctl_vld_qcn9274 (rx_desc); rx_desc_data->fc_valid =ath12k_hal_rx_desc_get_mpdu_fc_valid_qcn9274 (rx_desc); + rx_desc_data->qos_ctrl_valid = +ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_qcn9274 (rx_desc); rx_desc_data->is_from_ds =ath12k_wifi7_hal_rx_h_from_ds_qcn9274 (ldesc); rx_desc_data->is_to_ds =ath12k_wifi7_hal_rx_h_to_ds_qcn9274 (ldesc); rx_desc_data->seq_no =ath12k_hal_rx_desc_get_mpdu_start_seq_no_qcn9274 (rx_desc);
drivers/net/wireless/ath/ath12k/wifi7/hal_wcn7850.c +9 -0
@@ -340,6 +340,13 @@ bool ath12k_hal_rx_desc_get_mpdu_fc_valid_wcn7850(struct hal_rx_desc *desc) RX_MPDU_START_INFO4_MPDU_FCTRL_VALID); } +static inline +bool ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_wcn7850 (struct hal_rx_desc *desc) +{ +return !!le32_get_bits (desc->u.wcn7850.mpdu_start.info4, +RX_MPDU_START_INFO4_MPDU_QOS_CTRL_VALID ); +} +static inline u16 ath12k_hal_rx_desc_get_mpdu_start_seq_no_wcn7850 (struct hal_rx_desc *desc) {
@@ -620,6 +627,8 @@ void ath12k_hal_extract_rx_desc_data_wcn7850(struct hal_rx_desc_data *rx_desc_da rx_desc_data->seq_ctl_valid =ath12k_hal_rx_desc_get_mpdu_seq_ctl_vld_wcn7850 (rx_desc); rx_desc_data->fc_valid =ath12k_hal_rx_desc_get_mpdu_fc_valid_wcn7850 (rx_desc); + rx_desc_data->qos_ctrl_valid = +ath12k_hal_rx_desc_get_mpdu_qos_ctrl_valid_wcn7850 (rx_desc); rx_desc_data->seq_no =ath12k_hal_rx_desc_get_mpdu_start_seq_no_wcn7850 (rx_desc); rx_desc_data->msdu_len =ath12k_hal_rx_desc_get_msdu_len_wcn7850 (ldesc); rx_desc_data->sgi =ath12k_hal_rx_desc_get_msdu_sgi_wcn7850 (ldesc);
Signature · 1 line
2.53.0