wifi: rtlwifi: replace the 802.11 header helper macros with kernel ones
cover wifi: rtlwifi: replace the 802.11 header helper macros with kernel ones
base.h and wifi.h carry a few helper macros that duplicate things the kernel already provides. The reserved page builders in the fw.c files write MAC addresses and the PS Poll AID into their frame templates at hand counted byte offsets, there is a private alias for msecs_to_jiffies(), a private rounding macro and a private frame type test. Some more are defined but not used anywhere.
This series switches each of them over to the kernel equivalent and then removes the macro.
Patch 1 uses struct ieee80211_pspoll for the PS Poll template. Its aid member is __le16, so this one is more than a cleanup on big endian hosts, where the old macro stored the AID in host byte order. On little endian hosts the bytes written are the same as before.
Patch 2 uses struct ieee80211_hdr and ether_addr_copy() for the other templates and removes CP_MACADDR() and the FRAME_OFFSET_* constants.
Patches 3 to 5 replace MSECS(), N_BYTE_ALIGMENT() and WLAN_FC_GET_TYPE() with msecs_to_jiffies(), ALIGN() and ieee80211_is_ctl().
Patch 6 open codes the one use of byte() and removes it together with two macros that have no users left.
Each patch builds cleanly with W=1 and sparse. I do not have any of these chips, so this is compile tested only.
Rishik Yechuri (6):
wifi: rtlwifi: use struct ieee80211_pspoll for the PS Poll reserved
page
wifi: rtlwifi: use struct ieee80211_hdr for the reserved page headers
wifi: rtlwifi: call msecs_to_jiffies() directly
wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length
wifi: rtlwifi: use ieee80211_is_ctl() instead of WLAN_FC_GET_TYPE()
wifi: rtlwifi: remove byte(), packet_get_type() and
FILL_OCTET_STRING()
drivers/net/wireless/realtek/rtlwifi/base.c | 2 +- drivers/net/wireless/realtek/rtlwifi/base.h | 21 ---- drivers/net/wireless/realtek/rtlwifi/core.c | 2 +- drivers/net/wireless/realtek/rtlwifi/ps.c | 6 +- .../wireless/realtek/rtlwifi/rtl8188ee/dm.c | 2 +- .../wireless/realtek/rtlwifi/rtl8188ee/fw.c | 38 +++--- .../wireless/realtek/rtlwifi/rtl8188ee/hw.c | 6 +- .../realtek/rtlwifi/rtl8192c/fw_common.c | 38 +++--- .../wireless/realtek/rtlwifi/rtl8192ce/trx.c | 5 +- .../wireless/realtek/rtlwifi/rtl8192cu/mac.c | 5 +- .../realtek/rtlwifi/rtl8192d/trx_common.c | 5 +- .../wireless/realtek/rtlwifi/rtl8192de/fw.c | 38 +++--- .../wireless/realtek/rtlwifi/rtl8192ee/fw.c | 58 ++++----- .../wireless/realtek/rtlwifi/rtl8192ee/hw.c | 6 +- .../wireless/realtek/rtlwifi/rtl8192se/fw.c | 6 +- .../wireless/realtek/rtlwifi/rtl8192se/trx.c | 5 +- .../wireless/realtek/rtlwifi/rtl8723ae/fw.c | 38 +++--- .../wireless/realtek/rtlwifi/rtl8723ae/trx.c | 5 +- .../wireless/realtek/rtlwifi/rtl8723be/fw.c | 58 ++++----- .../wireless/realtek/rtlwifi/rtl8723be/hw.c | 6 +- .../wireless/realtek/rtlwifi/rtl8723be/trx.c | 5 +- .../wireless/realtek/rtlwifi/rtl8821ae/fw.c | 116 +++++++++--------- .../wireless/realtek/rtlwifi/rtl8821ae/hw.c | 6 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 30 ----- 24 files changed, 225 insertions(+), 282 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/6 wifi: rtlwifi: use struct ieee80211_pspoll for the PS Poll reserved page
The reserved page builders fill in the PS Poll template with the SET_80211_PS_POLL_* macros from base.h, which write at fixed byte offsets into a u8 buffer. The AID macro stores a host order u16, so the frame is only correct on a little endian machine.
Point at the template with struct ieee80211_pspoll from <linux/ieee80211.h> instead. Its aid member is __le16, so the AID goes through cpu_to_le16() and sparse can check it. The two addresses are copied with ether_addr_copy() on the struct members. Remove the three macros.
On little endian systems the bytes written are the same as before.
--- drivers/net/wireless/realtek/rtlwifi/base.h | 7 ------- .../wireless/realtek/rtlwifi/rtl8188ee/fw.c | 10 +++++----- .../realtek/rtlwifi/rtl8192c/fw_common.c | 10 +++++----- .../wireless/realtek/rtlwifi/rtl8192de/fw.c | 10 +++++----- .../wireless/realtek/rtlwifi/rtl8192ee/fw.c | 10 +++++----- .../wireless/realtek/rtlwifi/rtl8723ae/fw.c | 10 +++++----- .../wireless/realtek/rtlwifi/rtl8723be/fw.c | 10 +++++----- .../wireless/realtek/rtlwifi/rtl8821ae/fw.c | 20 +++++++++---------- 8 files changed, 40 insertions(+), 47 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.h +0 -7
@@ -46,13 +46,6 @@ enum ap_peer {#define MAX_LISTEN_INTERVAL 10#define MAX_RATE_TRIES 4 -#define SET_80211_PS_POLL_AID (_hdr, _val) \ - (*(u16 *)((u8 *)(_hdr) + 2) = _val) -#define SET_80211_PS_POLL_BSSID (_hdr, _val) \ - ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val)) -#define SET_80211_PS_POLL_TA (_hdr, _val) \ - ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val)) -#define SET_80211_HDR_ADDRESS1 (_hdr, _val) \ CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))#define SET_80211_HDR_ADDRESS2 (_hdr, _val) \
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +5 -5
@@ -545,7 +545,7 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)u8 u1rsvdpageloc[5 ] = {0 };bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;
@@ -561,10 +561,10 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (2) ps-poll *-------------------------------------------------------- */ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c +5 -5
@@ -573,7 +573,7 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;/*---------------------------------------------------------
@@ -586,10 +586,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,/*------------------------------------------------------- (2) ps-poll --------------------------------------------------------*/ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c +5 -5
@@ -260,7 +260,7 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)u8 u1rsvdpageloc[3 ] = {PROBERSP_PG ,PSPOLL_PG ,NULL_PG };bool dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;/*---------------------------------------------------------
@@ -272,10 +272,10 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)/*------------------------------------------------------- (2) ps-poll --------------------------------------------------------*/ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);/*-------------------------------------------------------- (3) null data ---------------------------------------------------------*/
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +5 -5
@@ -663,7 +663,7 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;u8 *qosnull;
@@ -680,10 +680,10 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (2) ps-poll *-------------------------------------------------------- */ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c +5 -5
@@ -393,7 +393,7 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)u8 u1rsvdpageloc[3 ] = {0 };bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;
@@ -409,10 +409,10 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (2) ps-poll *-------------------------------------------------------- */ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c +5 -5
@@ -484,7 +484,7 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *p_probersp;u8 *qosnull;
@@ -501,10 +501,10 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,* (2) ps-poll *------------------------------------------------------- */ - p_pspoll = &reserved_page_packet[PSPOLL_PG *128 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet[PSPOLL_PG *128 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +10 -10
@@ -1525,7 +1525,7 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,u8 u1rsvdpageloc2[7 ] = {0 };bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *qosnull;u8 *btqosnull;
@@ -1547,10 +1547,10 @@ void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,* (2) ps-poll *-------------------------------------------------------- */ - p_pspoll = &reserved_page_packet_8812[PSPOLL_PG *512 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet_8812[PSPOLL_PG *512 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
@@ -1662,7 +1662,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,u8 u1rsvdpageloc2[7 ] = {0 };bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;u8 *nullfunc;u8 *qosnull;u8 *btqosnull;
@@ -1684,10 +1684,10 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,* (2) ps-poll *-------------------------------------------------------- */ - p_pspoll = &reserved_page_packet_8821[PSPOLL_PG *256 ]; -SET_80211_PS_POLL_AID (p_pspoll, (mac->assoc_id |0xc000 )); -SET_80211_PS_POLL_BSSID (p_pspoll, mac->bssid); -SET_80211_PS_POLL_TA (p_pspoll, mac->mac_addr); + p_pspoll = (struct ieee80211_pspoll *)&reserved_page_packet_8821[PSPOLL_PG *256 ]; + p_pspoll->aid =cpu_to_le16 (mac->assoc_id |0xc000 ); +ether_addr_copy (p_pspoll->bssid, mac->bssid); +ether_addr_copy (p_pspoll->ta, mac->mac_addr);SET_H2CCMD_RSVDPAGE_LOC_PSPOLL (u1rsvdpageloc,PSPOLL_PG );
Signature · 1 line
2.43.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next 1/6] wifi: rtlwifi: use struct ieee80211_pspoll for the PS Poll reserved page
Quoted 7 lines · Rishik Yechuri
The reserved page builders fill in the PS Poll template with the SET_80211_PS_POLL_* macros from
base.h, which write at fixed byte offsets into a u8 buffer. The AID macro stores a host order u16, so the frame is only correct on a little endian machine.Point at the template with struct
ieee80211_pspollfrom <linux/ieee80211.h> instead.
No need this sentence. It is obvious.
Quoted 8 lines
Its aid member is
__le16, so the AID goes
throughcpu_to_le16()and sparse can check it. The two addresses are copied withether_addr_copy()on the struct members. Remove the three macros.On little endian systems the bytes written are the same as before.
Signed-off-by Rishik Yechuri <[email protected]>
Not match the From: field
Quoted 1 line
Assisted-by Claude:claude-fable-5-1
No need Assisted-by.
Please check the result of patchwork:
https://patchwork.kernel.org/project/linux-wireless/list/?series=1207558
[...]
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) · line 548
Quoted 11 lines
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +1
-1@@ -545,7 +545,7 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)u8 u1rsvdpageloc[5 ] = {0 };bool b_dlok = false;u8 *beacon; -u8 *p_pspoll; +struct ieee80211_pspoll *p_pspoll;
reverse x'mas tree (apply to whole patch)
Quoted 3 lines
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +0
-0u8 *nullfunc;u8 *p_probersp;
PATCH 2/6 wifi: rtlwifi: use struct ieee80211_hdr for the reserved page headers
In reply to Rishik YechuriThe reserved page builders also patch the addresses of the beacon, null data, probe response, QoS null data, BT QoS null data and ARP response templates with SET_80211_HDR_ADDRESS1(), SET_80211_HDR_ADDRESS2() and SET_80211_HDR_ADDRESS3() from base.h. These add a hard coded byte offset to a u8 pointer and copy the six bytes one at a time through the CP_MACADDR() macro in wifi.h.
struct ieee80211_hdr from <linux/ieee80211.h> has the addr1, addr2 and addr3 members at the same offsets. Point at each template with that struct and copy the addresses with ether_addr_copy() on the members. Then remove the three macros, CP_MACADDR() and the FRAME_OFFSET_* constants, which have no other users.
No functional change intended.
--- drivers/net/wireless/realtek/rtlwifi/base.h | 14 --- .../wireless/realtek/rtlwifi/rtl8188ee/fw.c | 28 +++--- .../realtek/rtlwifi/rtl8192c/fw_common.c | 28 +++--- .../wireless/realtek/rtlwifi/rtl8192de/fw.c | 28 +++--- .../wireless/realtek/rtlwifi/rtl8192ee/fw.c | 48 +++++----- .../wireless/realtek/rtlwifi/rtl8723ae/fw.c | 28 +++--- .../wireless/realtek/rtlwifi/rtl8723be/fw.c | 48 +++++----- .../wireless/realtek/rtlwifi/rtl8821ae/fw.c | 96 +++++++++---------- drivers/net/wireless/realtek/rtlwifi/wifi.h | 5 - 9 files changed, 152 insertions(+), 171 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.h +0 -14
@@ -36,23 +36,9 @@ enum ap_peer {#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9 390/* Mbps */ #define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7 293/* Mbps */ -#define FRAME_OFFSET_FRAME_CONTROL 0 -#define FRAME_OFFSET_DURATION 2 -#define FRAME_OFFSET_ADDRESS1 4 -#define FRAME_OFFSET_ADDRESS2 10 -#define FRAME_OFFSET_ADDRESS3 16 -#define FRAME_OFFSET_SEQUENCE 22 -#define FRAME_OFFSET_ADDRESS4 24#define MAX_LISTEN_INTERVAL 10#define MAX_RATE_TRIES 4 -#define SET_80211_HDR_ADDRESS1 (_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val)) -#define SET_80211_HDR_ADDRESS2 (_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val)) -#define SET_80211_HDR_ADDRESS3 (_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) -#define SET_TX_DESC_SPE_RPT (__pdesc, __val) \ le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19))#define SET_TX_DESC_SW_DEFINE (__pdesc, __val) \
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +14 -14
@@ -544,18 +544,18 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)bool rtstatus;u8 u1rsvdpageloc[5 ] = {0 };bool b_dlok = false; -u8 *beacon; +struct ieee80211_hdr *beacon;struct ieee80211_pspoll *p_pspoll; -u8 *nullfunc; -u8 *p_probersp; +struct ieee80211_hdr *nullfunc; +struct ieee80211_hdr *p_probersp;/*--------------------------------------------------------- * (1) beacon *--------------------------------------------------------- */ - beacon = &reserved_page_packet[BEACON_PG *128 ]; -SET_80211_HDR_ADDRESS2 (beacon, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (beacon, mac->bssid); + beacon = (struct ieee80211_hdr *)&reserved_page_packet[BEACON_PG *128 ]; +ether_addr_copy (beacon->addr2, mac->mac_addr); +ether_addr_copy (beacon->addr3, mac->bssid);/*------------------------------------------------------- * (2) ps-poll
@@ -572,10 +572,10 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (3) null data *--------------------------------------------------------- */ - nullfunc = &reserved_page_packet[NULL_PG *128 ]; -SET_80211_HDR_ADDRESS1 (nullfunc, mac->bssid); -SET_80211_HDR_ADDRESS2 (nullfunc, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (nullfunc, mac->bssid); + nullfunc = (struct ieee80211_hdr *)&reserved_page_packet[NULL_PG *128 ]; +ether_addr_copy (nullfunc->addr1, mac->bssid); +ether_addr_copy (nullfunc->addr2, mac->mac_addr); +ether_addr_copy (nullfunc->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA (u1rsvdpageloc,NULL_PG );
@@ -583,10 +583,10 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (4) probe response *---------------------------------------------------------- */ - p_probersp = &reserved_page_packet[PROBERSP_PG *128 ]; -SET_80211_HDR_ADDRESS1 (p_probersp, mac->bssid); -SET_80211_HDR_ADDRESS2 (p_probersp, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (p_probersp, mac->bssid); + p_probersp = (struct ieee80211_hdr *)&reserved_page_packet[PROBERSP_PG *128 ]; +ether_addr_copy (p_probersp->addr1, mac->bssid); +ether_addr_copy (p_probersp->addr2, mac->mac_addr); +ether_addr_copy (p_probersp->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP (u1rsvdpageloc,PROBERSP_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c +14 -14
@@ -572,16 +572,16 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,u8 u1rsvdpageloc[3 ] = {0 };bool b_dlok = false; -u8 *beacon; +struct ieee80211_hdr *beacon;struct ieee80211_pspoll *p_pspoll; -u8 *nullfunc; -u8 *p_probersp; +struct ieee80211_hdr *nullfunc; +struct ieee80211_hdr *p_probersp;/*--------------------------------------------------------- (1) beacon ---------------------------------------------------------*/ - beacon = &reserved_page_packet[BEACON_PG *128 ]; -SET_80211_HDR_ADDRESS2 (beacon, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (beacon, mac->bssid); + beacon = (struct ieee80211_hdr *)&reserved_page_packet[BEACON_PG *128 ]; +ether_addr_copy (beacon->addr2, mac->mac_addr); +ether_addr_copy (beacon->addr3, mac->bssid);/*------------------------------------------------------- (2) ps-poll
@@ -596,20 +596,20 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,/*-------------------------------------------------------- (3) null data ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet[NULL_PG *128 ]; -SET_80211_HDR_ADDRESS1 (nullfunc, mac->bssid); -SET_80211_HDR_ADDRESS2 (nullfunc, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (nullfunc, mac->bssid); + nullfunc = (struct ieee80211_hdr *)&reserved_page_packet[NULL_PG *128 ]; +ether_addr_copy (nullfunc->addr1, mac->bssid); +ether_addr_copy (nullfunc->addr2, mac->mac_addr); +ether_addr_copy (nullfunc->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA (u1rsvdpageloc,NULL_PG );/*--------------------------------------------------------- (4) probe response ----------------------------------------------------------*/ - p_probersp = &reserved_page_packet[PROBERSP_PG *128 ]; -SET_80211_HDR_ADDRESS1 (p_probersp, mac->bssid); -SET_80211_HDR_ADDRESS2 (p_probersp, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (p_probersp, mac->bssid); + p_probersp = (struct ieee80211_hdr *)&reserved_page_packet[PROBERSP_PG *128 ]; +ether_addr_copy (p_probersp->addr1, mac->bssid); +ether_addr_copy (p_probersp->addr2, mac->mac_addr); +ether_addr_copy (p_probersp->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP (u1rsvdpageloc,PROBERSP_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8192de/fw.c +14 -14
@@ -259,16 +259,16 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)bool rtstatus;u8 u1rsvdpageloc[3 ] = {PROBERSP_PG ,PSPOLL_PG ,NULL_PG };bool dlok = false; -u8 *beacon; +struct ieee80211_hdr *beacon;struct ieee80211_pspoll *p_pspoll; -u8 *nullfunc; -u8 *p_probersp; +struct ieee80211_hdr *nullfunc; +struct ieee80211_hdr *p_probersp;/*--------------------------------------------------------- (1) beacon ---------------------------------------------------------*/ - beacon = &reserved_page_packet[BEACON_PG *128 ]; -SET_80211_HDR_ADDRESS2 (beacon, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (beacon, mac->bssid); + beacon = (struct ieee80211_hdr *)&reserved_page_packet[BEACON_PG *128 ]; +ether_addr_copy (beacon->addr2, mac->mac_addr); +ether_addr_copy (beacon->addr3, mac->bssid);/*------------------------------------------------------- (2) ps-poll --------------------------------------------------------*/
@@ -279,17 +279,17 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished)/*-------------------------------------------------------- (3) null data ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet[NULL_PG *128 ]; -SET_80211_HDR_ADDRESS1 (nullfunc, mac->bssid); -SET_80211_HDR_ADDRESS2 (nullfunc, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (nullfunc, mac->bssid); + nullfunc = (struct ieee80211_hdr *)&reserved_page_packet[NULL_PG *128 ]; +ether_addr_copy (nullfunc->addr1, mac->bssid); +ether_addr_copy (nullfunc->addr2, mac->mac_addr); +ether_addr_copy (nullfunc->addr3, mac->bssid);/*--------------------------------------------------------- (4) probe response ----------------------------------------------------------*/ - p_probersp = &reserved_page_packet[PROBERSP_PG *128 ]; -SET_80211_HDR_ADDRESS1 (p_probersp, mac->bssid); -SET_80211_HDR_ADDRESS2 (p_probersp, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (p_probersp, mac->bssid); + p_probersp = (struct ieee80211_hdr *)&reserved_page_packet[PROBERSP_PG *128 ]; +ether_addr_copy (p_probersp->addr1, mac->bssid); +ether_addr_copy (p_probersp->addr2, mac->mac_addr); +ether_addr_copy (p_probersp->addr3, mac->bssid); totalpacketlen =TOTAL_RESERVED_PKT_LEN ; RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL",
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c +24 -24
83 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c +14 -14
@@ -392,18 +392,18 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)bool rtstatus;u8 u1rsvdpageloc[3 ] = {0 };bool b_dlok = false; -u8 *beacon; +struct ieee80211_hdr *beacon;struct ieee80211_pspoll *p_pspoll; -u8 *nullfunc; -u8 *p_probersp; +struct ieee80211_hdr *nullfunc; +struct ieee80211_hdr *p_probersp;/*--------------------------------------------------------- * (1) beacon *--------------------------------------------------------- */ - beacon = &reserved_page_packet[BEACON_PG *128 ]; -SET_80211_HDR_ADDRESS2 (beacon, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (beacon, mac->bssid); + beacon = (struct ieee80211_hdr *)&reserved_page_packet[BEACON_PG *128 ]; +ether_addr_copy (beacon->addr2, mac->mac_addr); +ether_addr_copy (beacon->addr3, mac->bssid);/*------------------------------------------------------- * (2) ps-poll
@@ -420,10 +420,10 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (3) null data *--------------------------------------------------------- */ - nullfunc = &reserved_page_packet[NULL_PG *128 ]; -SET_80211_HDR_ADDRESS1 (nullfunc, mac->bssid); -SET_80211_HDR_ADDRESS2 (nullfunc, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (nullfunc, mac->bssid); + nullfunc = (struct ieee80211_hdr *)&reserved_page_packet[NULL_PG *128 ]; +ether_addr_copy (nullfunc->addr1, mac->bssid); +ether_addr_copy (nullfunc->addr2, mac->mac_addr); +ether_addr_copy (nullfunc->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA (u1rsvdpageloc,NULL_PG );
@@ -431,10 +431,10 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)* (4) probe response *---------------------------------------------------------- */ - p_probersp = &reserved_page_packet[PROBERSP_PG *128 ]; -SET_80211_HDR_ADDRESS1 (p_probersp, mac->bssid); -SET_80211_HDR_ADDRESS2 (p_probersp, mac->mac_addr); -SET_80211_HDR_ADDRESS3 (p_probersp, mac->bssid); + p_probersp = (struct ieee80211_hdr *)&reserved_page_packet[PROBERSP_PG *128 ]; +ether_addr_copy (p_probersp->addr1, mac->bssid); +ether_addr_copy (p_probersp->addr2, mac->mac_addr); +ether_addr_copy (p_probersp->addr3, mac->bssid);SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP (u1rsvdpageloc,PROBERSP_PG );
drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c +24 -24
83 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +48 -48
168 lines not on this page · raw message
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -5
@@ -2855,11 +2855,6 @@ enum bt_radio_shared { (_os).octet = (u8 *)(_octet); \ (_os).length = (_len); -#define CP_MACADDR (des, src) \ - ((des)[0] = (src)[0], (des)[1] = (src)[1],\ - (des)[2] = (src)[2], (des)[3] = (src)[3],\ - (des)[4] = (src)[4], (des)[5] = (src)[5]) -#define LDPC_HT_ENABLE_RX BIT(0)#define LDPC_HT_ENABLE_TX BIT(1)#define LDPC_HT_TEST_TX_ENABLE BIT(2)
Signature · 1 line
2.43.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next 2/6] wifi: rtlwifi: use struct ieee80211_hdr for the reserved page headers
Quoted 9 lines · Rishik Yechuri
The reserved page builders also patch the addresses of the beacon, null data, probe response, QoS null data, BT QoS null data and ARP response templates with
SET_80211_HDR_ADDRESS1(),SET_80211_HDR_ADDRESS2()andSET_80211_HDR_ADDRESS3()frombase.h. These add a hard coded byte offset to a u8 pointer and copy the six bytes one at a time through theCP_MACADDR()macro inwifi.h.struct
ieee80211_hdrfrom <linux/ieee80211.h> has the addr1, addr2 and addr3 members at the same offsets.
No need this sentence. It is obvious.
Please reword commit messages generated by LLM across whole patchset.
Quoted 9 lines
Point at each template with that
struct and copy the addresses withether_addr_copy()on the members. Then remove the three macros,CP_MACADDR()and the FRAME_OFFSET_* constants, which have no other users.No functional change intended.
Signed-off-by Rishik Yechuri <[email protected]>Assisted-by Claude:claude-fable-5-1
[...]
Quoted 6 lines
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +0
-0
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) · line 550
Quoted 10 lines
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c +3
-3@@ -544,18 +544,18 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)bool rtstatus;u8 u1rsvdpageloc[5 ] = {0 };bool b_dlok = false; -u8 *beacon; +struct ieee80211_hdr *beacon;struct ieee80211_pspoll *p_pspoll; -u8 *nullfunc; -u8 *p_probersp; +struct ieee80211_hdr *nullfunc; +struct ieee80211_hdr *p_probersp;
reverse x'mas tree
PATCH 3/6 wifi: rtlwifi: call msecs_to_jiffies() directly
In reply to Rishik YechuriMSECS() in wifi.h is a plain alias for msecs_to_jiffies(). Call msecs_to_jiffies() at the 18 sites that used it and remove the macro.
No functional change intended.
--- drivers/net/wireless/realtek/rtlwifi/base.c | 2 +- drivers/net/wireless/realtek/rtlwifi/core.c | 2 +- drivers/net/wireless/realtek/rtlwifi/ps.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c | 2 +- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 6 +++--- drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 - 9 files changed, 18 insertions(+), 19 deletions(-)
drivers/net/wireless/realtek/rtlwifi/base.c +1 -1
@@ -2230,7 +2230,7 @@ void rtl_watch_dog_timer_callback(struct timer_list *t) &rtlpriv->works.watchdog_wq, 0);mod_timer (&rtlpriv->works.watchdog_timer, - jiffies +MSECS (RTL_WATCH_DOG_TIME )); + jiffies +msecs_to_jiffies (RTL_WATCH_DOG_TIME )); }static void rtl_fwevt_wq_callback (struct work_struct *work)
drivers/net/wireless/realtek/rtlwifi/core.c +1 -1
@@ -615,7 +615,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)if (!rtlpriv->psc.multi_buffered)queue_delayed_work (rtlpriv->works.rtl_wq, &rtlpriv->works.ps_work, -MSECS (5 )); +msecs_to_jiffies (5 )); }else {rtl_swlps_rf_awake (hw); rtlpriv->psc.sw_ps_enabled = false;
drivers/net/wireless/realtek/rtlwifi/ps.c +3 -3
@@ -254,7 +254,7 @@ void rtl_ips_nic_off(struct ieee80211_hw *hw)* this will cause link failed, so we delay 100ms here */ queue_delayed_work (rtlpriv->works.rtl_wq, - &rtlpriv->works.ips_nic_off_wq,MSECS (100 )); + &rtlpriv->works.ips_nic_off_wq,msecs_to_jiffies (100 )); }/* NOTICE: any opmode should exc nic_on, or disable without
@@ -532,7 +532,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)/* back to low-power land. and delay is * prevent null power save frame tx fail */ queue_delayed_work (rtlpriv->works.rtl_wq, - &rtlpriv->works.ps_work,MSECS (5 )); + &rtlpriv->works.ps_work,msecs_to_jiffies (5 )); }else {rtl_dbg (rtlpriv,COMP_POWER ,DBG_DMESG ,"u_bufferd: %x, m_buffered: %x\n" , u_buffed, m_buffed);
@@ -636,7 +636,7 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)/* we tested that 40ms is enough for sw & hw sw delay */ queue_delayed_work (rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq, -MSECS (sleep_intv * mac->vif->bss_conf.beacon_int -40 )); +msecs_to_jiffies (sleep_intv * mac->vif->bss_conf.beacon_int -40 )); }void rtl_lps_change_work_callback (struct work_struct *work)
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +1 -1
@@ -1677,7 +1677,7 @@ static void rtl88e_dm_fast_ant_training(struct ieee80211_hw *hw)rtl_set_bbreg (hw,DM_REG_IGI_A_11N ,BIT (7 ),1 );mod_timer (&rtlpriv->works.fast_antenna_training_timer, - jiffies +MSECS (RTL_WATCH_DOG_TIME )); + jiffies +msecs_to_jiffies (RTL_WATCH_DOG_TIME )); } }
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c +3 -3
@@ -154,7 +154,7 @@ static void _rtl88ee_set_fw_clock_on(struct ieee80211_hw *hw,spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);if (schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } }else {
@@ -195,7 +195,7 @@ static void _rtl88ee_set_fw_clock_off(struct ieee80211_hw *hw,if (schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 ));return ; }
@@ -215,7 +215,7 @@ static void _rtl88ee_set_fw_clock_off(struct ieee80211_hw *hw, }else {spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } } }
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +3 -3
@@ -130,7 +130,7 @@ static void _rtl92ee_set_fw_clock_on(struct ieee80211_hw *hw,spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);if (b_schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } }else {spin_lock_bh (&rtlpriv->locks.fw_ps_lock);
@@ -170,7 +170,7 @@ static void _rtl92ee_set_fw_clock_off(struct ieee80211_hw *hw, u8 rpwm_val)if (b_schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 ));return ; }
@@ -189,7 +189,7 @@ static void _rtl92ee_set_fw_clock_off(struct ieee80211_hw *hw, u8 rpwm_val) }else {spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } } }
drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +3 -3
@@ -160,7 +160,7 @@ static void _rtl8723be_set_fw_clock_on(struct ieee80211_hw *hw, u8 rpwm_val,spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);if (b_schedule_timer)mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); }else {spin_lock_bh (&rtlpriv->locks.fw_ps_lock); rtlhal->fw_clk_change_in_progress = false;
@@ -198,7 +198,7 @@ static void _rtl8723be_set_fw_clock_off(struct ieee80211_hw *hw, u8 rpwm_val)if (b_schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 ));return ; }
@@ -217,7 +217,7 @@ static void _rtl8723be_set_fw_clock_off(struct ieee80211_hw *hw, u8 rpwm_val) }else {spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } }
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +3 -3
@@ -157,7 +157,7 @@ static void _rtl8821ae_set_fw_clock_on(struct ieee80211_hw *hw,spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);if (b_schedule_timer)mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); }else {spin_lock_bh (&rtlpriv->locks.fw_ps_lock); rtlhal->fw_clk_change_in_progress = false;
@@ -196,7 +196,7 @@ static void _rtl8821ae_set_fw_clock_off(struct ieee80211_hw *hw,if (b_schedule_timer) {mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 ));return ; }
@@ -216,7 +216,7 @@ static void _rtl8821ae_set_fw_clock_off(struct ieee80211_hw *hw, }else {spin_unlock_bh (&rtlpriv->locks.fw_ps_lock);mod_timer (&rtlpriv->works.fw_clockoff_timer, - jiffies +MSECS (10 )); + jiffies +msecs_to_jiffies (10 )); } } }
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -1
@@ -2823,7 +2823,6 @@ enum bt_radio_shared {#define packet_get_type (_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)#define RTL_WATCH_DOG_TIME 2000 -#define MSECS (t) msecs_to_jiffies(t)#define WLAN_FC_GET_VERS (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS)#define WLAN_FC_GET_TYPE (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE)#define WLAN_FC_GET_STYPE (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE)
Signature · 1 line
2.43.0
RE: [PATCH rtw-next 3/6] wifi: rtlwifi: call msecs_to_jiffies() directly
Quoted 1 line · Rishik Yechuri
MSECS()inwifi.his a plain alias formsecs_to_jiffies().
Saying "in wifi.h" is really unnecessary.
Quoted 7 lines
Call
msecs_to_jiffies()at the 18 sites that used it and remove the macro.No functional change intended.
Signed-off-by Rishik Yechuri <[email protected]>Assisted-by Claude:claude-fable-5-1
The same problems as others.
Some statements are over 80 characters.
With proper fixes, take my Acked-by:
PATCH 4/6 wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length
In reply to Rishik Yechuri_rtl92s_fill_h2c_cmd() and _rtl92s_get_h2c_cmdlen() round each command length up to a multiple of 8 with N_BYTE_ALIGMENT() from wifi.h. The macro spells out the rounding by hand and special cases an alignment of 1. ALIGN() from <linux/align.h> gives the same result for a power of two.
Use ALIGN() at both sites and remove the macro together with the comment block around it, which no longer has anything in it.
No functional change intended.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 4 ++-- drivers/net/wireless/realtek/rtlwifi/wifi.h | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c +2 -2
@@ -431,7 +431,7 @@ static u32 _rtl92s_fill_h2c_cmd(struct sk_buff *skb, u32 h2cbufferlen, do { /* 8 - Byte alignment */ - len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8); + len = H2C_TX_CMD_HDR_LEN + ALIGN(pcmd_len[i], 8); /* Buffer length is not enough */ if (h2cbufferlen < totallen + len + tx_desclen)
@@ -484,7 +484,7 @@ static u32 _rtl92s_get_h2c_cmdlen(u32 h2cbufferlen, u32 cmd_num, u32 *pcmd_len) do { /* 8 - Byte alignment */ - len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8); + len = H2C_TX_CMD_HDR_LEN + ALIGN(pcmd_len[i], 8); /* Buffer length is not enough */ if (h2cbufferlen < totallen + len + tx_desclen)
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -13
@@ -2806,19 +2806,6 @@ enum bt_radio_shared { BT_RADIO_INDIVIDUAL = 1, }; -/**************************************** -* mem access macro define start -* Call endian free function when -* 1. Read/write packet content. -* 2. Before write integer to IO. -* 3. After read integer from IO. -****************************************/ - -#define N_BYTE_ALIGMENT (__value, __aligment) ((__aligment == 1) ? \ - (__value) : (((__value + __aligment - 1) / __aligment) * __aligment)) - -/* mem access macro define end */ -#define byte (x, n) ((x >> (8 * n)) & 0xff)#define packet_get_type (_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
Signature · 1 line
2.43.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next 4/6] wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length
Quoted 5 lines · Rishik Yechuri
_rtl92s_fill_h2c_cmd()and_rtl92s_get_h2c_cmdlen()round each command length up to a multiple of 8 withN_BYTE_ALIGMENT()fromwifi.h. The macro spells out the rounding by hand and special cases an alignment of 1.ALIGN()from <linux/align.h> gives the same result for a power of two.
Just say N_BYTE_ALIGMENT() is identical to ALIGN()...
PATCH 5/6 wifi: rtlwifi: use ieee80211_is_ctl() instead of WLAN_FC_GET_TYPE()
In reply to Rishik YechuriSix RX status parsers read the frame type with WLAN_FC_GET_TYPE() from wifi.h only to compare it against IEEE80211_FTYPE_CTL. ieee80211_is_ctl() from <linux/ieee80211.h> does that test directly on the little endian frame control.
Use it at the six sites, drop the type variables that only held the result, and remove WLAN_FC_GET_TYPE() together with WLAN_FC_GET_VERS(), WLAN_FC_GET_STYPE() and WLAN_FC_MORE_DATA(), which have no users.
No functional change intended.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 5 ++--- drivers/net/wireless/realtek/rtlwifi/wifi.h | 4 ---- 7 files changed, 12 insertions(+), 22 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c +2 -3
@@ -221,7 +221,7 @@ static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw,u8 *tmp_buf;u8 *praddr;__le16 fc; -u16 type, c_fc; +u16 c_fc;bool packet_matchbssid, packet_toself, packet_beacon = false; tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift;
@@ -229,11 +229,10 @@ static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw, hdr = (struct ieee80211_hdr *)tmp_buf; fc = hdr->frame_control; c_fc =le16_to_cpu (fc); - type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1; packet_matchbssid = - ((IEEE80211_FTYPE_CTL != type) && + (!ieee80211_is_ctl (fc) && ether_addr_equal(mac->bssid, (c_fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (c_fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c +2 -3
@@ -719,17 +719,16 @@ void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,u8 *tmp_buf;u8 *praddr;__le16 fc; -u16 type, cpu_fc; +u16 cpu_fc;bool packet_matchbssid, packet_toself, packet_beacon = false; tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; hdr = (struct ieee80211_hdr *)tmp_buf; fc = hdr->frame_control; cpu_fc =le16_to_cpu (fc); - type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1; packet_matchbssid = - ((IEEE80211_FTYPE_CTL != type) && + (!ieee80211_is_ctl (fc) && ether_addr_equal(mac->bssid, (cpu_fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (cpu_fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c +2 -3
@@ -355,7 +355,7 @@ static void _rtl92d_translate_rx_signal_stuff(struct ieee80211_hw *hw,bool packet_matchbssid;bool packet_beacon;bool packet_toself; -u16 type, cfc; +u16 cfc;u8 *tmp_buf;u8 *praddr;__le16 fc;
@@ -364,9 +364,8 @@ static void _rtl92d_translate_rx_signal_stuff(struct ieee80211_hw *hw, hdr = (struct ieee80211_hdr *)tmp_buf; fc = hdr->frame_control; cfc =le16_to_cpu (fc); - type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1; - packet_matchbssid = ((type !=IEEE80211_FTYPE_CTL ) && + packet_matchbssid = (!ieee80211_is_ctl (fc) && ether_addr_equal(mac->bssid, (cfc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (cfc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c +2 -3
@@ -201,7 +201,7 @@ static void _rtl92se_translate_rx_signal_stuff(struct ieee80211_hw *hw,u8 *tmp_buf;u8 *praddr;__le16 fc; -u16 type, cfc; +u16 cfc;bool packet_matchbssid, packet_toself, packet_beacon = false; tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift;
@@ -209,10 +209,9 @@ static void _rtl92se_translate_rx_signal_stuff(struct ieee80211_hw *hw, hdr = (struct ieee80211_hdr *)tmp_buf; fc = hdr->frame_control; cfc =le16_to_cpu (fc); - type =WLAN_FC_GET_TYPE (fc); praddr = hdr->addr1; - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && + packet_matchbssid = (!ieee80211_is_ctl (fc) && ether_addr_equal(mac->bssid, (cfc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (cfc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c +2 -3
@@ -225,17 +225,16 @@ static void translate_rx_signal_stuff(struct ieee80211_hw *hw,u8 *tmp_buf;u8 *praddr;/*u8 *psaddr;*/ -u16 fc, type; +u16 fc;bool packet_matchbssid, packet_toself, packet_beacon; tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; hdr = (struct ieee80211_hdr *)tmp_buf; fc =le16_to_cpu (hdr->frame_control); - type =WLAN_FC_GET_TYPE (hdr->frame_control); praddr = hdr->addr1; - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && + packet_matchbssid = (!ieee80211_is_ctl(hdr->frame_control) && (ether_addr_equal(mac->bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) &&
drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c +2 -3
@@ -197,19 +197,18 @@ static void _rtl8723be_translate_rx_signal_stuff(struct ieee80211_hw *hw,u8 *tmp_buf;u8 *praddr;u8 *psaddr; -u16 fc, type; +u16 fc;bool packet_matchbssid, packet_toself, packet_beacon; tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; hdr = (struct ieee80211_hdr *)tmp_buf; fc =le16_to_cpu (hdr->frame_control); - type =WLAN_FC_GET_TYPE (hdr->frame_control); praddr = hdr->addr1; psaddr =ieee80211_get_SA (hdr);memcpy (pstatus->psaddr, psaddr,ETH_ALEN ); - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && + packet_matchbssid = (!ieee80211_is_ctl(hdr->frame_control) && (ether_addr_equal(mac->bssid, (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3)) &&
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -4
@@ -2810,10 +2810,6 @@ enum bt_radio_shared {#define packet_get_type (_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)#define RTL_WATCH_DOG_TIME 2000 -#define WLAN_FC_GET_VERS (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) -#define WLAN_FC_GET_TYPE (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) -#define WLAN_FC_MORE_DATA (fc) (le16_to_cpu(fc) & IEEE80211_FCTL_MOREDATA)#define rtl_dm (rtlpriv) (&((rtlpriv)->dm))#define RT_RF_OFF_LEVL_ASPM BIT(0)/*PCI ASPM */
Signature · 1 line
2.43.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next 5/6] wifi: rtlwifi: use ieee80211_is_ctl() instead of WLAN_FC_GET_TYPE()
Quoted 8 lines · Rishik Yechuri
Six RX status parsers read the frame type with
WLAN_FC_GET_TYPE()fromwifi.honly to compare it againstIEEE80211_FTYPE_CTL.ieee80211_is_ctl()from <linux/ieee80211.h> does that test directly on the little endian frame control.Use it at the six sites, drop the type variables that only held the result, and remove
WLAN_FC_GET_TYPE()together withWLAN_FC_GET_VERS(),WLAN_FC_GET_STYPE()andWLAN_FC_MORE_DATA(), which have no users.
Please reword your commit messages.
The subject has pointed out the key point. No need much verbose messages generated by LLM.
PATCH 6/6 wifi: rtlwifi: remove byte(), packet_get_type() and FILL_OCTET_STRING()
In reply to Rishik Yechuribyte() in wifi.h has a single user. rtl8192se takes the low byte of the firmware header version with it, which is just a mask. Open code that as & 0xff.
packet_get_type() and FILL_OCTET_STRING() have no users at all. packet_get_type() also refers to EF1BYTE(), which no longer exists in the driver, so it could not be used even if someone wanted to.
Remove the three macros.
No functional change intended.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c | 2 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192se/fw.c +1 -1
@@ -334,7 +334,7 @@ int rtl92s_download_fw(struct ieee80211_hw *hw)/* 1. Retrieve FW header. */ firmware->pfwheader = (struct fw_hdr *) puc_mappedfile; pfwheader = firmware->pfwheader; - firmware->firmwareversion =byte (pfwheader->version,0 ); + firmware->firmwareversion = pfwheader->version &0xff ; firmware->pfwheader->fwpriv.hci_sel =1 ;/* pcie */ rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD,
drivers/net/wireless/realtek/rtlwifi/wifi.h +0 -7
@@ -2806,9 +2806,6 @@ enum bt_radio_shared { BT_RADIO_INDIVIDUAL = 1, }; -#define byte (x, n) ((x >> (8 * n)) & 0xff) - -#define packet_get_type (_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)#define RTL_WATCH_DOG_TIME 2000#define rtl_dm (rtlpriv) (&((rtlpriv)->dm))
@@ -2833,10 +2830,6 @@ enum bt_radio_shared {#define RT_SET_PS_LEVEL (ppsc, _ps_flg) \ (ppsc->cur_ps_level |= _ps_flg) -#define FILL_OCTET_STRING (_os, _octet, _len) \ - (_os).octet = (u8 *)(_octet); \ - (_os).length = (_len); -#define LDPC_HT_ENABLE_RX BIT(0)#define LDPC_HT_ENABLE_TX BIT(1)#define LDPC_HT_TEST_TX_ENABLE BIT(2)
Signature · 1 line
2.43.0
Ping-Ke Shih
maintainerRE: [PATCH rtw-next 6/6] wifi: rtlwifi: remove byte(), packet_get_type() and FILL_OCTET_STRING()
Quoted 1 line · Rishik Yechuri
byte()inwifi.h
No "in wifi.h".
Please write the commit messages yourself.
Quoted 14 lines
has a single user. rtl8192se takes the low byte of the firmware header version with it, which is just a mask. Open code that as &
0xff.
packet_get_type()andFILL_OCTET_STRING()have no users at all.packet_get_type()also refers toEF1BYTE(), which no longer exists in the driver, so it could not be used even if someone wanted to.Remove the three macros.
No functional change intended.
Signed-off-by Rishik Yechuri <[email protected]>Assisted-by Claude:claude-fable-5-1