mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rishik Yechuri <epicrishik@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rishik Yechuri <rishik.yechuri.code@gmail.com>
Subject: [PATCH rtw-next 5/6] wifi: rtlwifi: use ieee80211_is_ctl() instead of WLAN_FC_GET_TYPE()
Date: Tue, 10 Nov 2026 12:44:08 -0600	[thread overview]
Message-ID: <20261110184409.42205-6-rishik.yechuri.code@gmail.com> (raw)
In-Reply-To: <20261110184409.42205-1-rishik.yechuri.code@gmail.com>

Six 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.

Signed-off-by: Rishik Yechuri <rishik.yechuri.code@gmail.com>
Assisted-by: Claude:claude-fable-5-1
---
 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(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
index 99472053ccff..3ab08b345df7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/trx.c
@@ -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 :
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
index a76f2dc8a977..c3ea858af693 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.c
@@ -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 :
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c
index 9f9a34492030..0fcba5b56c71 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192d/trx_common.c
@@ -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 :
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
index b057d035a3a8..3fb8a641770d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/trx.c
@@ -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 :
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
index f40b0efebe3a..976d840d9e49 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/trx.c
@@ -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)) &&
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
index b6029bfaedac..bb9fc0783bdc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/trx.c
@@ -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)) &&
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 24c6db867421..e289a88e9666 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -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 */
-- 
2.43.0


  parent reply	other threads:[~2026-11-10 18:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 18:44 [PATCH rtw-next 0/6] wifi: rtlwifi: replace the 802.11 header helper macros with kernel ones Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 1/6] wifi: rtlwifi: use struct ieee80211_pspoll for the PS Poll reserved page Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 2/6] wifi: rtlwifi: use struct ieee80211_hdr for the reserved page headers Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 3/6] wifi: rtlwifi: call msecs_to_jiffies() directly Rishik Yechuri
2026-11-10 18:44 ` [PATCH rtw-next 4/6] wifi: rtlwifi: rtl8192se: use ALIGN() for the H2C command length Rishik Yechuri
2026-11-10 18:44 ` Rishik Yechuri [this message]
2026-11-10 18:44 ` [PATCH rtw-next 6/6] wifi: rtlwifi: remove byte(), packet_get_type() and FILL_OCTET_STRING() Rishik Yechuri

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=20261110184409.42205-6-rishik.yechuri.code@gmail.com \
    --to=epicrishik@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®