mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
wifi: rtw89: wow: use struct style to fill WOW wakeup control H2C command
The WOW wakeup control command is used to tell firmware the content of wakeup feature. Use struct instead of macros to fill the data. Signed-off-by: Chin-Yen Lee <timlee@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20260325072130.41751-2-pkshih@realtek.com
This commit is contained in:
parent
1b622535a5
commit
86a4c63c01
|
|
@ -9705,38 +9705,43 @@ int rtw89_fw_h2c_wow_global(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtw
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define H2C_WAKEUP_CTRL_LEN 4
|
||||
int rtw89_fw_h2c_wow_wakeup_ctrl(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif_link *rtwvif_link,
|
||||
bool enable)
|
||||
{
|
||||
struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
|
||||
struct rtw89_h2c_wow_wakeup_ctrl *h2c;
|
||||
struct sk_buff *skb;
|
||||
u32 len = sizeof(*h2c);
|
||||
u8 macid = rtwvif_link->mac_id;
|
||||
int ret;
|
||||
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, H2C_WAKEUP_CTRL_LEN);
|
||||
skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
|
||||
if (!skb) {
|
||||
rtw89_err(rtwdev, "failed to alloc skb for wakeup ctrl\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
skb_put(skb, H2C_WAKEUP_CTRL_LEN);
|
||||
skb_put(skb, len);
|
||||
h2c = (struct rtw89_h2c_wow_wakeup_ctrl *)skb->data;
|
||||
|
||||
if (rtw_wow->pattern_cnt)
|
||||
RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(skb->data, enable);
|
||||
h2c->w0 |= le32_encode_bits(enable,
|
||||
RTW89_H2C_WOW_WAKEUP_CTRL_W0_PATTERN_MATCH_ENABLE);
|
||||
if (test_bit(RTW89_WOW_FLAG_EN_MAGIC_PKT, rtw_wow->flags))
|
||||
RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(skb->data, enable);
|
||||
h2c->w0 |= le32_encode_bits(enable,
|
||||
RTW89_H2C_WOW_WAKEUP_CTRL_W0_MAGIC_ENABLE);
|
||||
if (test_bit(RTW89_WOW_FLAG_EN_DISCONNECT, rtw_wow->flags))
|
||||
RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(skb->data, enable);
|
||||
h2c->w0 |= le32_encode_bits(enable,
|
||||
RTW89_H2C_WOW_WAKEUP_CTRL_W0_DEAUTH_ENABLE);
|
||||
|
||||
RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(skb->data, macid);
|
||||
h2c->w0 |= le32_encode_bits(macid, RTW89_H2C_WOW_WAKEUP_CTRL_W0_MAC_ID);
|
||||
|
||||
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
|
||||
H2C_CAT_MAC,
|
||||
H2C_CL_MAC_WOW,
|
||||
H2C_FUNC_WAKEUP_CTRL, 0, 1,
|
||||
H2C_WAKEUP_CTRL_LEN);
|
||||
len);
|
||||
|
||||
ret = rtw89_h2c_tx(rtwdev, skb, false);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -2219,50 +2219,20 @@ struct rtw89_h2c_cfg_nlo {
|
|||
#define RTW89_H2C_NLO_W0_IGNORE_CIPHER BIT(2)
|
||||
#define RTW89_H2C_NLO_W0_MACID GENMASK(31, 24)
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_PATTERN_MATCH_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(0));
|
||||
}
|
||||
struct rtw89_h2c_wow_wakeup_ctrl {
|
||||
__le32 w0;
|
||||
} __packed;
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAGIC_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(1));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_HW_UNICAST_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(2));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_FW_UNICAST_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(3));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_DEAUTH_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(4));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_REKEYP_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(5));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_EAP_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(6));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_ALL_DATA_ENABLE(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, BIT(7));
|
||||
}
|
||||
|
||||
static inline void RTW89_SET_WOW_WAKEUP_CTRL_MAC_ID(void *h2c, u32 val)
|
||||
{
|
||||
le32p_replace_bits((__le32 *)h2c, val, GENMASK(31, 24));
|
||||
}
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_PATTERN_MATCH_ENABLE BIT(0)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_MAGIC_ENABLE BIT(1)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_HW_UNICAST_ENABLE BIT(2)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_FW_UNICAST_ENABLE BIT(3)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_DEAUTH_ENABLE BIT(4)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_REKEYP_ENABLE BIT(5)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_EAP_ENABLE BIT(6)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_ALL_DATA_ENABLE BIT(7)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_MAC_ID_EXT GENMASK(23, 16)
|
||||
#define RTW89_H2C_WOW_WAKEUP_CTRL_W0_MAC_ID GENMASK(31, 24)
|
||||
|
||||
struct rtw89_h2c_wow_cam_update {
|
||||
__le32 w0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user