Commit 786737b6 authored by Chih-Kang Chang's avatar Chih-Kang Chang Committed by Ping-Ke Shih

wifi: rtw89: use struct to fill H2C of WoWLAN global configuration

This H2C command is used to set WoWLAN global config, and we correct
the H2C format by enlarging the H2C size to fill GTK and PTK info.
This fix is compatible with old firmware.
Signed-off-by: default avatarChih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-7-pkshih@realtek.com
parent 9076bf36
......@@ -6353,30 +6353,32 @@ int rtw89_fw_h2c_disconnect_detect(struct rtw89_dev *rtwdev,
return ret;
}
#define H2C_WOW_GLOBAL_LEN 8
int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
bool enable)
{
struct sk_buff *skb;
struct rtw89_h2c_wow_global *h2c;
u8 macid = rtwvif->mac_id;
u32 len = sizeof(*h2c);
struct sk_buff *skb;
int ret;
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_WOW_GLOBAL_LEN);
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
if (!skb) {
rtw89_err(rtwdev, "failed to alloc skb for keep alive\n");
rtw89_err(rtwdev, "failed to alloc skb for wow global\n");
return -ENOMEM;
}
skb_put(skb, H2C_WOW_GLOBAL_LEN);
skb_put(skb, len);
h2c = (struct rtw89_h2c_wow_global *)skb->data;
RTW89_SET_WOW_GLOBAL_ENABLE(skb->data, enable);
RTW89_SET_WOW_GLOBAL_MAC_ID(skb->data, macid);
h2c->w0 = le32_encode_bits(enable, RTW89_H2C_WOW_GLOBAL_W0_ENABLE) |
le32_encode_bits(macid, RTW89_H2C_WOW_GLOBAL_W0_MAC_ID);
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
H2C_CAT_MAC,
H2C_CL_MAC_WOW,
H2C_FUNC_WOW_GLOBAL, 0, 1,
H2C_WOW_GLOBAL_LEN);
len);
ret = rtw89_h2c_tx(rtwdev, skb, false);
if (ret) {
......
......@@ -1856,45 +1856,18 @@ static inline void RTW89_SET_DISCONNECT_DETECT_TRYOK_BCNFAIL_COUNT_LIMIT(void *h
le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(7, 0));
}
static inline void RTW89_SET_WOW_GLOBAL_ENABLE(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, BIT(0));
}
static inline void RTW89_SET_WOW_GLOBAL_DROP_ALL_PKT(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, BIT(1));
}
static inline void RTW89_SET_WOW_GLOBAL_RX_PARSE_AFTER_WAKE(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, BIT(2));
}
static inline void RTW89_SET_WOW_GLOBAL_WAKE_BAR_PULLED(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, BIT(3));
}
static inline void RTW89_SET_WOW_GLOBAL_MAC_ID(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, GENMASK(15, 8));
}
static inline void RTW89_SET_WOW_GLOBAL_PAIRWISE_SEC_ALGO(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, GENMASK(23, 16));
}
static inline void RTW89_SET_WOW_GLOBAL_GROUP_SEC_ALGO(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
}
struct rtw89_h2c_wow_global {
__le32 w0;
struct rtw89_wow_key_info key_info;
} __packed;
static inline void RTW89_SET_WOW_GLOBAL_REMOTECTRL_INFO_CONTENT(void *h2c, u32 val)
{
le32p_replace_bits((__le32 *)(h2c) + 1, val, GENMASK(31, 0));
}
#define RTW89_H2C_WOW_GLOBAL_W0_ENABLE BIT(0)
#define RTW89_H2C_WOW_GLOBAL_W0_DROP_ALL_PKT BIT(1)
#define RTW89_H2C_WOW_GLOBAL_W0_RX_PARSE_AFTER_WAKE BIT(2)
#define RTW89_H2C_WOW_GLOBAL_W0_WAKE_BAR_PULLED BIT(3)
#define RTW89_H2C_WOW_GLOBAL_W0_MAC_ID GENMASK(15, 8)
#define RTW89_H2C_WOW_GLOBAL_W0_PAIRWISE_SEC_ALGO GENMASK(23, 16)
#define RTW89_H2C_WOW_GLOBAL_W0_GROUP_SEC_ALGO GENMASK(31, 24)
static inline void RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(void *h2c, u32 val)
{
......
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