When CTRL_F_OVERWRITE_FORCE_ACTIVE_BITMAP or CTRL_F_OVERWRITE_FORCE_INACTIVE_BITMAP is set in ctrl_flags, firmware replaces the existing force link bitmaps rather than OR-ing the new bitmap into the accumulated force state. Without these flags, successive commands accumulate: forcing link A active and then forcing link B active would leave both links forced simultaneously, making it impossible to clear a previously forced link. With the overwrite flags, each command atomically replaces the force bitmap, giving the driver precise control over which links are active. Encode the two overwrite flags in WMI_MLO_LINK_SET_ACTIVE_CMDID, and copy the AP MLD MAC address from the argument into the command. Also fix the CRTL_F_DYNC_FORCE_LINK_NUM typo. ath12k_mac_mlo_sta_set_link_active() takes the AP MLD address and sets both overwrite flags when the mode is FORCE_ACTIVE_INACTIVE. The existing caller passes NULL and uses INACTIVE_LINK_NUM, so its behavior does not change. Tested-on: QCC2072 hw1.0 PCI WLAN.COL.1.0.c2-00277-QCACOLSWPL_V1_TO_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3 Signed-off-by: Miaoqing Pan --- drivers/net/wireless/ath/ath12k/mac.c | 10 ++++++++++ drivers/net/wireless/ath/ath12k/wmi.c | 11 +++++++++-- drivers/net/wireless/ath/ath12k/wmi.h | 4 +++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index eee3f38375ae..3f106ac6141c 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -7562,6 +7562,7 @@ static bool ath12k_mac_freqs_on_same_mac(struct ath12k_base *ab, static int ath12k_mac_mlo_sta_set_link_active(struct ath12k_base *ab, enum wmi_mlo_link_force_reason reason, enum wmi_mlo_link_force_mode mode, + const u8 *ap_mld_addr, u8 *mlo_vdev_id_lst, u8 num_mlo_vdev, u8 *mlo_inactive_vdev_lst, @@ -7574,6 +7575,14 @@ static int ath12k_mac_mlo_sta_set_link_active(struct ath12k_base *ab, param.reason = reason; param.force_mode = mode; + if (ap_mld_addr) + ether_addr_copy(param.force_cmd.ap_mld_mac_addr, ap_mld_addr); + + if (mode == WMI_MLO_LINK_FORCE_MODE_ACTIVE_INACTIVE) { + param.ctrl_flags.overwrite_force_active_bitmap = true; + param.ctrl_flags.overwrite_force_inactive_bitmap = true; + } + for (vdev_idx = 0; vdev_idx < num_mlo_vdev; vdev_idx++) { vdev_id = mlo_vdev_id_lst[vdev_idx]; entry_idx = vdev_id / 32; @@ -7672,6 +7681,7 @@ static int ath12k_mac_mlo_sta_update_link_active(struct ath12k_base *ab, mode = WMI_MLO_LINK_FORCE_MODE_INACTIVE_LINK_NUM; reason = WMI_MLO_LINK_FORCE_REASON_NEW_CONNECT; return ath12k_mac_mlo_sta_set_link_active(ab, reason, mode, + NULL, mlo_vdev_id_lst, num_mlo_vdev, NULL, 0); } diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index dde7721182af..7e06dbb1e884 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -11832,6 +11832,7 @@ int ath12k_wmi_send_mlo_link_set_active_cmd(struct ath12k_base *ab, sizeof(*cmd)); cmd->force_mode = cpu_to_le32(arg->force_mode); cmd->reason = cpu_to_le32(arg->reason); + ether_addr_copy(cmd->ap_mld_mac_addr.addr, arg->force_cmd.ap_mld_mac_addr); ath12k_dbg(ab, ATH12K_DBG_WMI, "mode %d reason %d num_link_num_param %d num_vdev_bitmap %d inactive %d num_disallow_mode_comb %d", arg->force_mode, arg->reason, num_link_num_param, @@ -11844,10 +11845,16 @@ int ath12k_wmi_send_mlo_link_set_active_cmd(struct ath12k_base *ab, sizeof(*link_num_param) * num_link_num_param); buf_ptr += TLV_HDR_SIZE; + cmd->ctrl_flags = + le32_encode_bits(arg->ctrl_flags.overwrite_force_active_bitmap ? 1 : 0, + CTRL_F_OVERWRITE_FORCE_ACTIVE_BITMAP) | + le32_encode_bits(arg->ctrl_flags.overwrite_force_inactive_bitmap ? 1 : 0, + CTRL_F_OVERWRITE_FORCE_INACTIVE_BITMAP); + if (num_link_num_param) { - cmd->ctrl_flags = + cmd->ctrl_flags |= le32_encode_bits(arg->ctrl_flags.dync_force_link_num ? 1 : 0, - CRTL_F_DYNC_FORCE_LINK_NUM); + CTRL_F_DYNC_FORCE_LINK_NUM); link_num_param = buf_ptr; for (i = 0; i < num_link_num_param; i++) { diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h index 68dd13cafe51..6d590b30ecbe 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.h +++ b/drivers/net/wireless/ath/ath12k/wmi.h @@ -6385,7 +6385,9 @@ struct wmi_vdev_set_tpc_power_cmd { */ } __packed; -#define CRTL_F_DYNC_FORCE_LINK_NUM GENMASK(3, 2) +#define CTRL_F_OVERWRITE_FORCE_ACTIVE_BITMAP BIT(0) +#define CTRL_F_OVERWRITE_FORCE_INACTIVE_BITMAP BIT(1) +#define CTRL_F_DYNC_FORCE_LINK_NUM GENMASK(3, 2) struct wmi_mlo_link_set_active_cmd { __le32 tlv_header; -- 2.34.1