From: Rishik Yechuri <epicrishik@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Rishik Yechuri <rishik.yechuri.code@gmail.com>
Subject: [PATCH 10/10] staging: rtl8723bs: use ieee80211_get_DA() and ieee80211_get_SA()
Date: Tue, 13 Oct 2026 15:15:38 -0500 [thread overview]
Message-ID: <20261013201538.43156-11-rishik.yechuri.code@gmail.com> (raw)
In-Reply-To: <20261013201538.43156-1-rishik.yechuri.code@gmail.com>
get_da() and get_sa() in wifi.h select the destination and source
address of a frame according to the To DS and From DS bits. They
duplicate ieee80211_get_DA() and ieee80211_get_SA() from
<linux/ieee80211.h>, which return the same address for every
combination of these bits.
rtl8723bs_get_ra() and get_ta() only return the addr1 and addr2
members of the header.
Replace get_da() and get_sa() with the generic helpers, replace
rtl8723bs_get_ra() and get_ta() with direct accesses to addr1 and
addr2, and remove the four functions.
No functional change intended.
Signed-off-by: Rishik Yechuri <rishik.yechuri.code@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++-
drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +-
.../staging/rtl8723bs/hal/rtl8723bs_recv.c | 4 +-
drivers/staging/rtl8723bs/include/wifi.h | 68 -------------------
4 files changed, 9 insertions(+), 75 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 4d8073d48..dde78ecb7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -501,6 +501,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *cur = &pmlmeinfo->network;
u8 *pframe = precv_frame->u.hdr.rx_data;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
uint len = precv_frame->u.hdr.len;
u8 is_valid_p2p_probereq = false;
@@ -529,7 +530,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)
if ((check_fwstate(pmlmepriv, _FW_LINKED) &&
pmlmepriv->cur_network.join_res) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
- issue_probersp(padapter, get_sa(pframe), is_valid_p2p_probereq);
+ issue_probersp(padapter, ieee80211_get_SA(hdr), is_valid_p2p_probereq);
}
return _SUCCESS;
@@ -853,7 +854,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
uint pkt_len = precv_frame->u.hdr.len;
/* check A1 matches or not */
- if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
+ if (memcmp(myid(&(padapter->eeprompriv)), ieee80211_get_DA(hdr), ETH_ALEN))
return _SUCCESS;
if (!(pmlmeinfo->state & WIFI_FW_AUTH_STATE))
@@ -1332,10 +1333,11 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u8 *pframe = precv_frame->u.hdr.rx_data;
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
uint pkt_len = precv_frame->u.hdr.len;
/* check A1 matches or not */
- if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
+ if (memcmp(myid(&(padapter->eeprompriv)), ieee80211_get_DA(hdr), ETH_ALEN))
return _SUCCESS;
if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE)))
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index a7462444e..eec1b400d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1251,8 +1251,8 @@ static signed int validate_recv_data_frame(struct adapter *adapter, union recv_f
signed int ret = _SUCCESS;
bretry = ieee80211_has_retry(hdr->frame_control);
- pda = get_da(ptr);
- psa = get_sa(ptr);
+ pda = ieee80211_get_DA(hdr);
+ psa = ieee80211_get_SA(hdr);
pbssid = get_hdr_bssid(ptr);
if (!pbssid) {
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index 79d6d7431..14686f5eb 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -106,7 +106,7 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe,
!pattrib->icv_err && !pattrib->crc_err &&
ether_addr_equal(rx_bssid, my_bssid));
- rx_ra = rtl8723bs_get_ra(wlanhdr);
+ rx_ra = hdr->addr1;
my_hwaddr = myid(&padapter->eeprompriv);
pkt_info.to_self = pkt_info.bssid_match &&
ether_addr_equal(rx_ra, my_hwaddr);
@@ -114,7 +114,7 @@ static void update_recvframe_phyinfo(union recv_frame *precvframe,
pkt_info.is_beacon = pkt_info.bssid_match &&
ieee80211_is_beacon(hdr->frame_control);
- sa = get_ta(wlanhdr);
+ sa = hdr->addr2;
pkt_info.station_id = 0xFF;
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index d1bb9076d..4619cb672 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -18,74 +18,6 @@
/* This test verifies the WLAN NIC can update the NAV through sending the CTS with large duration. */
#define WiFiNavUpperUs 30000 /* 30 ms */
-static inline unsigned char *rtl8723bs_get_ra(unsigned char *pframe)
-{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
- unsigned char *ra;
-
- ra = hdr->addr1;
- return ra;
-}
-
-static inline unsigned char *get_ta(unsigned char *pframe)
-{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
- unsigned char *ta;
-
- ta = hdr->addr2;
- return ta;
-}
-
-static inline unsigned char *get_da(unsigned char *pframe)
-{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
- unsigned char *da;
- unsigned int to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) |
- ieee80211_has_fromds(hdr->frame_control);
-
- switch (to_fr_ds) {
- case 0x00: /* ToDs = 0, FromDs = 0 */
- da = hdr->addr1;
- break;
- case 0x01: /* ToDs = 0, FromDs = 1 */
- da = hdr->addr1;
- break;
- case 0x02: /* ToDs = 1, FromDs = 0 */
- da = hdr->addr3;
- break;
- default: /* ToDs = 1, FromDs = 1 */
- da = hdr->addr3;
- break;
- }
-
- return da;
-}
-
-static inline unsigned char *get_sa(unsigned char *pframe)
-{
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
- unsigned char *sa;
- unsigned int to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) |
- ieee80211_has_fromds(hdr->frame_control);
-
- switch (to_fr_ds) {
- case 0x00: /* ToDs = 0, FromDs = 0 */
- sa = hdr->addr2;
- break;
- case 0x01: /* ToDs = 0, FromDs = 1 */
- sa = hdr->addr3;
- break;
- case 0x02: /* ToDs = 1, FromDs = 0 */
- sa = hdr->addr2;
- break;
- default: /* ToDs = 1, FromDs = 1 */
- sa = hdr->addr4;
- break;
- }
-
- return sa;
-}
-
static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)pframe;
--
2.43.0
prev parent reply other threads:[~2026-10-13 20:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 20:15 [PATCH 00/10] staging: rtl8723bs: replace private 802.11 header macros with generic helpers Rishik Yechuri
2026-10-13 20:15 ` [PATCH 01/10] staging: rtl8723bs: use struct ieee80211_hdr for header addresses Rishik Yechuri
2026-10-13 20:15 ` [PATCH 02/10] staging: rtl8723bs: use ieee80211_has_*() to test frame control flags Rishik Yechuri
2026-10-13 20:15 ` [PATCH 03/10] staging: rtl8723bs: set frame control flags with IEEE80211_FCTL_* masks Rishik Yechuri
2026-10-13 20:15 ` [PATCH 04/10] staging: rtl8723bs: use ieee80211_is_*() for frame type tests Rishik Yechuri
2026-10-13 20:15 ` [PATCH 05/10] staging: rtl8723bs: use IEEE80211_FCTL_* masks for frame type dispatch Rishik Yechuri
2026-10-13 20:15 ` [PATCH 06/10] staging: rtl8723bs: remove unused num member from struct mlme_handler Rishik Yechuri
2026-10-13 20:15 ` [PATCH 07/10] staging: rtl8723bs: use IEEE80211_FTYPE_* and IEEE80211_STYPE_* values Rishik Yechuri
2026-10-13 20:15 ` [PATCH 08/10] staging: rtl8723bs: use struct ieee80211_hdr for seq_ctrl and duration_id Rishik Yechuri
2026-10-13 20:15 ` [PATCH 09/10] staging: rtl8723bs: use IEEE80211_QOS_CTL_* masks for QoS control Rishik Yechuri
2026-10-13 20:15 ` Rishik Yechuri [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261013201538.43156-11-rishik.yechuri.code@gmail.com \
--to=epicrishik@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=rishik.yechuri.code@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.