net: macb: Check return value of dma_set_mask_and_coherent()
Subsystems (25)
Sasha Levin
maintainerPATCH 107/108 wifi: ath12k: Pass correct values of center freq1 and center freq2 for 160 MHz
In reply to Sasha LevinFrom: Suraj P Kizhakkethil <[email protected]>
[ Upstream commit b1b01e46a3db5ad44d1e4691ba37c1e0832cd5cf ]
Currently, for 160 MHz bandwidth, center frequency1 and center frequency2 are not passed correctly to the firmware. Set center frequency1 as the center frequency
of the primary 80 MHz channel segment and center frequency2 as the center frequency of the 160 MHz channel and pass the values to the firmware.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
---
Based on my thorough analysis, here is my assessment: **YES** This commit should be backported to stable kernel trees for the following
reasons: ## Analysis of the Code Changes The commit fixes a critical bug in the 160 MHz channel frequency handling for the ath12k driver (Qualcomm Wi-Fi 7 devices). The specific issues being corrected are: ###
1. **Incorrect center frequency calculation for 160 MHz EHT channels** **Before the fix**: The code only handled MODE_11AC_VHT80_80 for dual- band scenarios but completely ignored MODE_11BE_EHT160 (Wi-Fi 7's 160 MHz mode). This meant: - chan->band_center_freq1 was incorrectly set to the original arg->band_center_freq1 - chan->band_center_freq2 was set to 0, providing no information about the 160 MHz channel structure **After the fix**: For MODE_11BE_EHT160, the code now correctly: - Sets chan->band_center_freq1 to the center of the primary 80 MHz segment (±40 MHz from control channel) - Sets chan->band_center_freq2 to the center of the entire 160 MHz channel - Follows the exact same pattern already established and proven in ath11k driver for MODE_11AX_HE160 ### 2. **Follows established precedent from ath11k** The ath11k driver (lines 851-860 in /home/sasha/linux/drivers/net/wireless/ath/ath11k/wmi.c) already implements this exact logic for MODE_11AX_HE160: ```c if (arg->channel.mode == MODE_11AX_HE160) { if (arg->channel.freq > arg->channel.band_center_freq1) chan->band_center_freq1 = center_freq1 + 40; else chan->band_center_freq1 = center_freq1 - 40; chan->band_center_freq2 = arg->channel.band_center_freq1; } ``` The ath12k fix implements identical logic for MODE_11BE_EHT160, ensuring consistency across the ath driver family. ### 3. **Impact on Users** Without this fix, 160 MHz channels on Wi-Fi 7 devices would not work correctly because: - The firmware receives incorrect channel center frequency information - This could lead to improper channel selection, interference, or complete failure to establish 160 MHz connections - Users with QCN9274 (and similar) devices would experience degraded Wi-Fi 7 performance ### 4. **Meets Stable Backport Criteria** ✅ **Fixes important functionality**: 160 MHz operation is a key Wi-Fi 7 feature ✅ **Small, contained change**: Only affects one function, adds clear conditional logic ✅ **Low regression risk**: Follows proven pattern from ath11k, only changes previously broken path ✅ **Clear side effects**:
None beyond fixing the intended issue ✅ **Well-tested**: Commit includes "Tested-on: QCN9274 hw2.0" with specific firmware version ### 5. **Driver Maturity Context** ATH12K is the Wi-Fi 7 driver for current/recent Qualcomm chipsets. While newer than ath11k, it supports hardware that users actively deploy. The 160 MHz functionality is critical for achieving the high throughput promised by Wi-Fi 7. ### 6. **Comparison with Similar Commits** This commit closely resembles **Similar Commit #2** (marked YES for backport) which also fixed frequency calculation issues in ath12k for 6 GHz operation. Both
commits: - Fix critical frequency/channel handling bugs - Have minimal code changes with low regression risk - Include proper testing validation - Address functionality that affects real user deployments The fix is essential for proper Wi-Fi 7 160 MHz operation and should be backported to ensure users with ath12k-supported hardware can fully utilize their devices' capabilities.
drivers/net/wireless/ath/ath12k/wmi.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +13 -3
@@ -998,14 +998,24 @@ int ath12k_wmi_vdev_down(struct ath12k *ar, u8 vdev_id)static void ath12k_wmi_put_wmi_channel (struct ath12k_wmi_channel_params *chan,struct wmi_vdev_start_req_arg *arg) { +u32 center_freq1 = arg->band_center_freq1; +memset (chan,0 ,sizeof (*chan)); chan->mhz =cpu_to_le32 (arg->freq); - chan->band_center_freq1 =cpu_to_le32 (arg->band_center_freq1); -if (arg->mode ==MODE_11AC_VHT80_80 ) + chan->band_center_freq1 =cpu_to_le32 (center_freq1); +if (arg->mode ==MODE_11BE_EHT160 ) { +if (arg->freq > center_freq1) + chan->band_center_freq1 =cpu_to_le32 (center_freq1 +40 ); +else + chan->band_center_freq1 =cpu_to_le32 (center_freq1 -40 ); + + chan->band_center_freq2 =cpu_to_le32 (center_freq1); + }else if (arg->mode ==MODE_11BE_EHT80_80 ) { chan->band_center_freq2 =cpu_to_le32 (arg->band_center_freq2); -else + }else { chan->band_center_freq2 =0 ; + } chan->info |=le32_encode_bits (arg->mode,WMI_CHAN_INFO_MODE );if (arg->passive)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 108/108 net/mlx5: HWS, Harden IP version definer checks
In reply to Sasha LevinFrom: Vlad Dogaru <[email protected]>
[ Upstream commit 6991a975e416154576b0f5f06256aec13e23b0a7 ]
Replicate some sanity checks that firmware does, since hardware steering does not go through firmware.
When creating a definer, disallow matching on IP addresses without also matching on IP version. The latter can be satisfied by matching either on the version field in the IP header, or on the ethertype field.
Also refuse to match IPv4 IHL alongside IPv6.
---
**YES** This commit should be backported to stable kernel trees based on the following analysis: ## Nature of the Change This is a **hardening/validation fix** that adds critical input validation to prevent invalid hardware configurations. The code changes add two essential checks: 1. **IP Address Version Validation**: Ensures that when matching on IP addresses, either IP version or ethertype is also specified 2. **Protocol Consistency Check**: Prevents matching IPv6 addresses alongside IPv4-specific fields like IHL (Internet Header Length) ## Code Analysis The changes are purely additive validation logic in hws_definer_conv_outer() and hws_definer_conv_inner(): ```c // Prevents matching IP addresses without version specification if (ip_addr_set && !ip_ver_set) { mlx5hws_err(cd->ctx, "Unsupported match on IP address without version or ethertype\n"); return -EINVAL; } // Prevents IPv6/IPv4 field conflicts if (is_ipv6 && HWS_IS_FLD_SET(match_param, outer_headers.ipv4_ihl)) { mlx5hws_err(cd->ctx, "Unsupported match on IPv6 address and IPv4 IHL\n"); return -EINVAL; } ``` ## Critical Context As stated in the commit message, this "replicates sanity checks that firmware does, since hardware steering does not go through firmware." This is essential
because: - Hardware Steering (HWS) bypasses normal firmware validation paths - Without these checks, invalid configurations could reach the hardware - Invalid configurations could cause hardware errors or undefined behavior ## Similarity to Established Patterns This follows the same pattern as **Similar Commit #4** (marked YES for backporting), which added similar validation for IP matching requirements in software steering with the message "Don't allow match on IP w/o matching on full ethertype/ip_version." ## Backporting Justification 1. **Low Risk**:
Only adds validation, doesn't change functional behavior 2. **High Value**: Prevents potential hardware errors and system instability 3. **Defensive Programming**: Early error detection with clear diagnostic messages 4. **No Dependencies**: Uses existing error reporting infrastructure 5. **Protocol Compliance**: Ensures proper IP protocol field usage This type of input validation and hardware protection logic is exactly what stable kernel trees need to maintain system reliability and prevent configuration errors that could cause more serious issues.
.../mellanox/mlx5/core/steering/hws/definer.c | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c +42 -2
@@ -508,9 +508,9 @@ static int hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd, u32 *match_param) { + bool is_ipv6, smac_set, dmac_set, ip_addr_set, ip_ver_set;struct mlx5hws_definer_fc *fc = cd->fc;struct mlx5hws_definer_fc *curr_fc; -bool is_ipv6, smac_set, dmac_set;u32 *s_ipv6, *d_ipv6; if (HWS_IS_FLD_SET_SZ(match_param, outer_headers.l4_type, 0x2) ||
@@ -520,6 +520,20 @@ hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd,return -EINVAL ; } + ip_addr_set =HWS_IS_FLD_SET_SZ (match_param, + outer_headers.src_ipv4_src_ipv6, +0x80 ) || +HWS_IS_FLD_SET_SZ (match_param, + outer_headers.dst_ipv4_dst_ipv6,0x80 ); + ip_ver_set =HWS_IS_FLD_SET (match_param, outer_headers.ip_version) || +HWS_IS_FLD_SET (match_param, outer_headers.ethertype); + +if (ip_addr_set && !ip_ver_set) { +mlx5hws_err (cd->ctx, +"Unsupported match on IP address without version or ethertype\n" ); +return -EINVAL ; + } +/* L2 Check ethertype */ HWS_SET_HDR(fc, match_param, ETH_TYPE_O, outer_headers.ethertype,
@@ -572,6 +586,12 @@ hws_definer_conv_outer(struct mlx5hws_definer_conv_data *cd, is_ipv6 = s_ipv6[0 ] || s_ipv6[1 ] || s_ipv6[2 ] || d_ipv6[0 ] || d_ipv6[1 ] || d_ipv6[2 ]; +/* IHL is an IPv4-specific field. */ +if (is_ipv6 &&HWS_IS_FLD_SET (match_param, outer_headers.ipv4_ihl)) { +mlx5hws_err (cd->ctx,"Unsupported match on IPv6 address and IPv4 IHL\n" ); +return -EINVAL ; + } +if (is_ipv6) {/* Handle IPv6 source address */ HWS_SET_HDR(fc, match_param, IPV6_SRC_127_96_O,
@@ -661,9 +681,9 @@ static int hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd, u32 *match_param) { + bool is_ipv6, smac_set, dmac_set, ip_addr_set, ip_ver_set;struct mlx5hws_definer_fc *fc = cd->fc;struct mlx5hws_definer_fc *curr_fc; -bool is_ipv6, smac_set, dmac_set;u32 *s_ipv6, *d_ipv6; if (HWS_IS_FLD_SET_SZ(match_param, inner_headers.l4_type, 0x2) ||
@@ -673,6 +693,20 @@ hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd,return -EINVAL ; } + ip_addr_set =HWS_IS_FLD_SET_SZ (match_param, + inner_headers.src_ipv4_src_ipv6, +0x80 ) || +HWS_IS_FLD_SET_SZ (match_param, + inner_headers.dst_ipv4_dst_ipv6,0x80 ); + ip_ver_set =HWS_IS_FLD_SET (match_param, inner_headers.ip_version) || +HWS_IS_FLD_SET (match_param, inner_headers.ethertype); + +if (ip_addr_set && !ip_ver_set) { +mlx5hws_err (cd->ctx, +"Unsupported match on IP address without version or ethertype\n" ); +return -EINVAL ; + } +/* L2 Check ethertype */ HWS_SET_HDR(fc, match_param, ETH_TYPE_I, inner_headers.ethertype,
@@ -727,6 +761,12 @@ hws_definer_conv_inner(struct mlx5hws_definer_conv_data *cd, is_ipv6 = s_ipv6[0 ] || s_ipv6[1 ] || s_ipv6[2 ] || d_ipv6[0 ] || d_ipv6[1 ] || d_ipv6[2 ]; +/* IHL is an IPv4-specific field. */ +if (is_ipv6 &&HWS_IS_FLD_SET (match_param, inner_headers.ipv4_ihl)) { +mlx5hws_err (cd->ctx,"Unsupported match on IPv6 address and IPv4 IHL\n" ); +return -EINVAL ; + } +if (is_ipv6) {/* Handle IPv6 source address */ HWS_SET_HDR(fc, match_param, IPV6_SRC_127_96_I,
Signature · 1 line
2.39.5