Commit c313c31f authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: add new H2C command to pause/sleep transmitting by MAC ID

New H2C command is introduced to pause/sleep transmitting. That extends
more bits to support more MAC ID, and currently we still configure 256
MAC ID at most.

This new command is always used by coming WiFi 7 chips, and existing
chips can use old or new command because firmware still preserves the old
one. Add a firmware feature flag to determine which command is adopted
according to firmware version.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240108091315.67358-1-pkshih@realtek.com
parent e3552b37
...@@ -3900,6 +3900,7 @@ enum rtw89_fw_feature { ...@@ -3900,6 +3900,7 @@ enum rtw89_fw_feature {
RTW89_FW_FEATURE_NO_DEEP_PS, RTW89_FW_FEATURE_NO_DEEP_PS,
RTW89_FW_FEATURE_NO_LPS_PG, RTW89_FW_FEATURE_NO_LPS_PG,
RTW89_FW_FEATURE_BEACON_FILTER, RTW89_FW_FEATURE_BEACON_FILTER,
RTW89_FW_FEATURE_MACID_PAUSE_SLEEP,
}; };
struct rtw89_fw_suit { struct rtw89_fw_suit {
......
...@@ -458,6 +458,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = { ...@@ -458,6 +458,7 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 40, 0, CRASH_TRIGGER), __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 40, 0, CRASH_TRIGGER),
__CFG_FW_FEAT(RTL8852C, ge, 0, 27, 56, 10, BEACON_FILTER), __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 56, 10, BEACON_FILTER),
__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER), __CFG_FW_FEAT(RTL8922A, ge, 0, 34, 30, 0, CRASH_TRIGGER),
__CFG_FW_FEAT(RTL8922A, ge, 0, 34, 11, 0, MACID_PAUSE_SLEEP),
}; };
static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw, static void rtw89_fw_iterate_feature_cfg(struct rtw89_fw_info *fw,
...@@ -2489,27 +2490,49 @@ int rtw89_fw_h2c_notify_dbcc(struct rtw89_dev *rtwdev, bool en) ...@@ -2489,27 +2490,49 @@ int rtw89_fw_h2c_notify_dbcc(struct rtw89_dev *rtwdev, bool en)
int rtw89_fw_h2c_macid_pause(struct rtw89_dev *rtwdev, u8 sh, u8 grp, int rtw89_fw_h2c_macid_pause(struct rtw89_dev *rtwdev, u8 sh, u8 grp,
bool pause) bool pause)
{ {
struct rtw89_fw_macid_pause_sleep_grp *h2c_new;
struct rtw89_fw_macid_pause_grp *h2c; struct rtw89_fw_macid_pause_grp *h2c;
__le32 set = cpu_to_le32(BIT(sh)); __le32 set = cpu_to_le32(BIT(sh));
u8 len = sizeof(*h2c); u8 h2c_macid_pause_id;
struct sk_buff *skb; struct sk_buff *skb;
u32 len;
int ret; int ret;
if (RTW89_CHK_FW_FEATURE(MACID_PAUSE_SLEEP, &rtwdev->fw)) {
h2c_macid_pause_id = H2C_FUNC_MAC_MACID_PAUSE_SLEEP;
len = sizeof(*h2c_new);
} else {
h2c_macid_pause_id = H2C_FUNC_MAC_MACID_PAUSE;
len = sizeof(*h2c);
}
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len); skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
if (!skb) { if (!skb) {
rtw89_err(rtwdev, "failed to alloc skb for h2c macid pause\n"); rtw89_err(rtwdev, "failed to alloc skb for h2c macid pause\n");
return -ENOMEM; return -ENOMEM;
} }
skb_put(skb, len); skb_put(skb, len);
h2c = (struct rtw89_fw_macid_pause_grp *)skb->data;
h2c->mask_grp[grp] = set; if (h2c_macid_pause_id == H2C_FUNC_MAC_MACID_PAUSE_SLEEP) {
if (pause) h2c_new = (struct rtw89_fw_macid_pause_sleep_grp *)skb->data;
h2c->pause_grp[grp] = set;
h2c_new->n[0].pause_mask_grp[grp] = set;
h2c_new->n[0].sleep_mask_grp[grp] = set;
if (pause) {
h2c_new->n[0].pause_grp[grp] = set;
h2c_new->n[0].sleep_grp[grp] = set;
}
} else {
h2c = (struct rtw89_fw_macid_pause_grp *)skb->data;
h2c->mask_grp[grp] = set;
if (pause)
h2c->pause_grp[grp] = set;
}
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C, rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
H2C_CAT_MAC, H2C_CL_MAC_FW_OFLD, H2C_CAT_MAC, H2C_CL_MAC_FW_OFLD,
H2C_FUNC_MAC_MACID_PAUSE, 1, 0, h2c_macid_pause_id, 1, 0,
len); len);
ret = rtw89_h2c_tx(rtwdev, skb, false); ret = rtw89_h2c_tx(rtwdev, skb, false);
......
...@@ -231,6 +231,15 @@ struct rtw89_fw_macid_pause_grp { ...@@ -231,6 +231,15 @@ struct rtw89_fw_macid_pause_grp {
__le32 mask_grp[4]; __le32 mask_grp[4];
} __packed; } __packed;
struct rtw89_fw_macid_pause_sleep_grp {
struct {
__le32 pause_grp[4];
__le32 pause_mask_grp[4];
__le32 sleep_grp[4];
__le32 sleep_mask_grp[4];
} __packed n[4];
} __packed;
#define RTW89_H2C_MAX_SIZE 2048 #define RTW89_H2C_MAX_SIZE 2048
#define RTW89_CHANNEL_TIME 45 #define RTW89_CHANNEL_TIME 45
#define RTW89_CHANNEL_TIME_6G 20 #define RTW89_CHANNEL_TIME_6G 20
...@@ -3659,6 +3668,7 @@ enum rtw89_fw_ofld_h2c_func { ...@@ -3659,6 +3668,7 @@ enum rtw89_fw_ofld_h2c_func {
H2C_FUNC_CFG_BCNFLTR = 0x1e, H2C_FUNC_CFG_BCNFLTR = 0x1e,
H2C_FUNC_OFLD_RSSI = 0x1f, H2C_FUNC_OFLD_RSSI = 0x1f,
H2C_FUNC_OFLD_TP = 0x20, H2C_FUNC_OFLD_TP = 0x20,
H2C_FUNC_MAC_MACID_PAUSE_SLEEP = 0x28,
NUM_OF_RTW89_FW_OFLD_H2C_FUNC, NUM_OF_RTW89_FW_OFLD_H2C_FUNC,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment