linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST
@ 2021-08-23 12:00 Michael Straube
  2021-08-23 12:00 ` [PATCH 1/8] staging: r8188eu: ensure proper alignment for eth address buffers Michael Straube
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:00 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

This series replaces most uses of the custom IS_MCAST macro with
is_multicast_ether_addr. The goal is to get rid of IS_MCAST.
There is only one usage left in rtw_sta_mgt.c, but that one needs
more effort to verify that the buffers are properly aligned, so I
left it as is for now.

Michael Straube (8):
  staging: r8188eu: ensure proper alignment for eth address buffers
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c
  staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c
  staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c

 drivers/staging/r8188eu/core/rtw_mlme.c      |  4 ++--
 drivers/staging/r8188eu/core/rtw_mp.c        |  4 ++--
 drivers/staging/r8188eu/core/rtw_recv.c      | 20 ++++++++++----------
 drivers/staging/r8188eu/core/rtw_security.c  |  8 ++++----
 drivers/staging/r8188eu/core/rtw_xmit.c      | 15 ++++++---------
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c |  3 +--
 drivers/staging/r8188eu/include/rtw_recv.h   | 10 +++++-----
 drivers/staging/r8188eu/include/rtw_xmit.h   |  8 ++++----
 drivers/staging/r8188eu/os_dep/recv_linux.c  |  2 +-
 9 files changed, 35 insertions(+), 39 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/8] staging: r8188eu: ensure proper alignment for eth address buffers
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
@ 2021-08-23 12:00 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 2/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c Michael Straube
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:00 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Add __aligned(2) to eth address buffers in structs rx_pkt_attrib and
pkt_attrib to ensure proper alignment for usage with functions from
<linux/etherdevice.h>

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/include/rtw_recv.h | 10 +++++-----
 drivers/staging/r8188eu/include/rtw_xmit.h |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_recv.h b/drivers/staging/r8188eu/include/rtw_recv.h
index 81594e7aed51..1b41f8d7d079 100644
--- a/drivers/staging/r8188eu/include/rtw_recv.h
+++ b/drivers/staging/r8188eu/include/rtw_recv.h
@@ -109,11 +109,11 @@ struct rx_pkt_attrib {
 
 	u16 eth_type;
 
-	u8	dst[ETH_ALEN];
-	u8	src[ETH_ALEN];
-	u8	ta[ETH_ALEN];
-	u8	ra[ETH_ALEN];
-	u8	bssid[ETH_ALEN];
+	u8	dst[ETH_ALEN] __aligned(2);
+	u8	src[ETH_ALEN] __aligned(2);
+	u8	ta[ETH_ALEN] __aligned(2);
+	u8	ra[ETH_ALEN] __aligned(2);
+	u8	bssid[ETH_ALEN] __aligned(2);
 
 	u8 ack_policy;
 
diff --git a/drivers/staging/r8188eu/include/rtw_xmit.h b/drivers/staging/r8188eu/include/rtw_xmit.h
index e1418a3f7ed1..5f6e2402e5c4 100644
--- a/drivers/staging/r8188eu/include/rtw_xmit.h
+++ b/drivers/staging/r8188eu/include/rtw_xmit.h
@@ -122,10 +122,10 @@ struct pkt_attrib {
 	u8	ack_policy;
 	u8	mac_id;
 	u8	vcs_mode;	/* virtual carrier sense method */
-	u8	dst[ETH_ALEN];
-	u8	src[ETH_ALEN];
-	u8	ta[ETH_ALEN];
-	u8	ra[ETH_ALEN];
+	u8	dst[ETH_ALEN] __aligned(2);
+	u8	src[ETH_ALEN] __aligned(2);
+	u8	ta[ETH_ALEN] __aligned(2);
+	u8	ra[ETH_ALEN] __aligned(2);
 	u8	key_idx;
 	u8	qos_en;
 	u8	ht_en;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
  2021-08-23 12:00 ` [PATCH 1/8] staging: r8188eu: ensure proper alignment for eth address buffers Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 3/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c Michael Straube
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, the
buffer is properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_mlme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index c41312660054..1115ff5d865a 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -2121,9 +2121,9 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr
 	struct sta_info *psta = NULL;
 	struct ht_priv	*phtpriv;
 	struct pkt_attrib *pattrib = &pxmitframe->attrib;
-	s32 bmcst = IS_MCAST(pattrib->ra);
 
-	if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100))
+	if (is_multicast_ether_addr(pattrib->ra) ||
+	    padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100)
 		return;
 
 	priority = pattrib->priority;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
  2021-08-23 12:00 ` [PATCH 1/8] staging: r8188eu: ensure proper alignment for eth address buffers Michael Straube
  2021-08-23 12:01 ` [PATCH 2/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 4/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c Michael Straube
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, the
buffer is properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_mp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mp.c b/drivers/staging/r8188eu/core/rtw_mp.c
index 93bb683b628f..e66b7333077a 100644
--- a/drivers/staging/r8188eu/core/rtw_mp.c
+++ b/drivers/staging/r8188eu/core/rtw_mp.c
@@ -635,7 +635,7 @@ void SetPacketTx(struct adapter *padapter)
 	struct tx_desc *desc;
 	struct rtw_ieee80211_hdr *hdr;
 	u8 payload;
-	s32 bmcast;
+	bool bmcast;
 	struct pkt_attrib *pattrib;
 	struct mp_priv *pmp_priv;
 
@@ -651,7 +651,7 @@ void SetPacketTx(struct adapter *padapter)
 	memcpy(pattrib->src, padapter->eeprompriv.mac_addr, ETH_ALEN);
 	memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
 	memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
-	bmcast = IS_MCAST(pattrib->ra);
+	bmcast = is_multicast_ether_addr(pattrib->ra);
 	if (bmcast) {
 		pattrib->mac_id = 1;
 		pattrib->psta = rtw_get_bcmc_stainfo(padapter);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (2 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 3/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 5/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c Michael Straube
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, all
buffers are properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_recv.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index 52236bae8693..bc452420c119 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -330,7 +330,7 @@ static int recvframe_chkmic(struct adapter *adapter,  struct recv_frame *precvfr
 	if (prxattrib->encrypt == _TKIP_) {
 		/* calculate mic code */
 		if (stainfo) {
-			if (IS_MCAST(prxattrib->ra)) {
+			if (is_multicast_ether_addr(prxattrib->ra)) {
 				mickey = &psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0];
 
 				if (!psecuritypriv) {
@@ -361,11 +361,11 @@ static int recvframe_chkmic(struct adapter *adapter,  struct recv_frame *precvfr
 			if (bmic_err) {
 				/*  double check key_index for some timing issue , */
 				/*  cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */
-				if (IS_MCAST(prxattrib->ra) && prxattrib->key_index != pmlmeinfo->key_index)
+				if (is_multicast_ether_addr(prxattrib->ra) && prxattrib->key_index != pmlmeinfo->key_index)
 					brpt_micerror = false;
 
 				if ((prxattrib->bdecrypted) && (brpt_micerror)) {
-					rtw_handle_tkip_mic_err(adapter, (u8)IS_MCAST(prxattrib->ra));
+					rtw_handle_tkip_mic_err(adapter, (u8)is_multicast_ether_addr(prxattrib->ra));
 					DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted);
 				} else {
 					DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted);
@@ -373,7 +373,7 @@ static int recvframe_chkmic(struct adapter *adapter,  struct recv_frame *precvfr
 				res = _FAIL;
 			} else {
 				/* mic checked ok */
-				if ((!psecuritypriv->bcheck_grpkey) && (IS_MCAST(prxattrib->ra)))
+				if (!psecuritypriv->bcheck_grpkey && is_multicast_ether_addr(prxattrib->ra))
 					psecuritypriv->bcheck_grpkey = true;
 			}
 		}
@@ -618,7 +618,7 @@ static void count_rx_stats(struct adapter *padapter, struct recv_frame *prframe,
 
 	padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++;
 
-	if (!is_broadcast_ether_addr(pattrib->dst) && !IS_MCAST(pattrib->dst))
+	if (!is_broadcast_ether_addr(pattrib->dst) && !is_multicast_ether_addr(pattrib->dst))
 		padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++;
 
 	if (sta)
@@ -650,7 +650,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,
 	u8 *mybssid  = get_bssid(pmlmepriv);
 	u8 *myhwaddr = myid(&adapter->eeprompriv);
 	u8 *sta_addr = NULL;
-	int bmcast = IS_MCAST(pattrib->dst);
+	bool bmcast = is_multicast_ether_addr(pattrib->dst);
 
 	if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
 	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@@ -683,7 +683,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,
 	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		if (bmcast) {
 			/*  For AP mode, if DA == MCAST, then BSSID should be also MCAST */
-			if (!IS_MCAST(pattrib->bssid)) {
+			if (!is_multicast_ether_addr(pattrib->bssid)) {
 					ret = _FAIL;
 					goto exit;
 			}
@@ -739,7 +739,7 @@ static int ap2sta_data_frame(
 	struct	mlme_priv *pmlmepriv = &adapter->mlmepriv;
 	u8 *mybssid  = get_bssid(pmlmepriv);
 	u8 *myhwaddr = myid(&adapter->eeprompriv);
-	int bmcast = IS_MCAST(pattrib->dst);
+	bool bmcast = is_multicast_ether_addr(pattrib->dst);
 
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
 	    (check_fwstate(pmlmepriv, _FW_LINKED) ||
@@ -1136,7 +1136,7 @@ static int validate_recv_data_frame(struct adapter *adapter,
 	}
 
 	if (pattrib->privacy) {
-		GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, IS_MCAST(pattrib->ra));
+		GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, is_multicast_ether_addr(pattrib->ra));
 
 		SET_ICE_IV_LEN(pattrib->iv_len, pattrib->icv_len, pattrib->encrypt);
 	} else {
@@ -1957,7 +1957,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
 	if (ret == _SUCCESS) {
 		/* check if need to enqueue into uc_swdec_pending_queue*/
 		if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
-		    !IS_MCAST(prxattrib->ra) && prxattrib->encrypt > 0 &&
+		    !is_multicast_ether_addr(prxattrib->ra) && prxattrib->encrypt > 0 &&
 		    (prxattrib->bdecrypted == 0 || psecuritypriv->sw_decrypt) &&
 		     psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPAPSK &&
 		     !psecuritypriv->busetkipkey) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (3 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 4/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 6/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c Michael Straube
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, all
buffers are properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_security.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_security.c b/drivers/staging/r8188eu/core/rtw_security.c
index b9ab4b20ed8e..5aa893ab46e9 100644
--- a/drivers/staging/r8188eu/core/rtw_security.c
+++ b/drivers/staging/r8188eu/core/rtw_security.c
@@ -538,7 +538,7 @@ u32	rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
 			stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]);
 
 		if (stainfo) {
-			if (IS_MCAST(pattrib->ra))
+			if (is_multicast_ether_addr(pattrib->ra))
 				prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
 			else
 				prwskey = &stainfo->dot118021x_UncstKey.skey[0];
@@ -608,7 +608,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _TKIP_) {
 		stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
 		if (stainfo) {
-			if (IS_MCAST(prxattrib->ra)) {
+			if (is_multicast_ether_addr(prxattrib->ra)) {
 				if (!psecuritypriv->binstallGrpkey) {
 					res = _FAIL;
 					DBG_88E("%s:rx bc/mc packets, but didn't install group key!!!!!!!!!!\n", __func__);
@@ -1188,7 +1188,7 @@ u32	rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
 			stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]);
 
 		if (stainfo) {
-			if (IS_MCAST(pattrib->ra))
+			if (is_multicast_ether_addr(pattrib->ra))
 				prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
 			else
 				prwskey = &stainfo->dot118021x_UncstKey.skey[0];
@@ -1421,7 +1421,7 @@ u32	rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
 	if (prxattrib->encrypt == _AES_) {
 		stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
 		if (stainfo) {
-			if (IS_MCAST(prxattrib->ra)) {
+			if (is_multicast_ether_addr(prxattrib->ra)) {
 				/* in concurrent we should use sw descrypt in group key, so we remove this message */
 				if (!psecuritypriv->binstallGrpkey) {
 					res = _FAIL;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (4 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 5/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 7/8] staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c Michael Straube
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, all
buffers are properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_xmit.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index f242f3ffca70..b901d4398f03 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -411,7 +411,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
 	struct sta_info *psta = NULL;
 	struct ethhdr etherhdr;
 
-	int bmcast;
+	bool bmcast;
 	struct sta_priv		*pstapriv = &padapter->stapriv;
 	struct security_priv	*psecuritypriv = &padapter->securitypriv;
 	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
@@ -472,7 +472,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
 	if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
 		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
 
-	bmcast = IS_MCAST(pattrib->ra);
+	bmcast = is_multicast_ether_addr(pattrib->ra);
 
 	/*  get sta_info */
 	if (bmcast) {
@@ -597,7 +597,6 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr
 	struct	xmit_priv *pxmitpriv = &padapter->xmitpriv;
 	u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
 	u8 hw_hdr_offset = 0;
-	int bmcst = IS_MCAST(pattrib->ra);
 
 	if (pattrib->psta)
 		stainfo = pattrib->psta;
@@ -615,7 +614,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr
 
 			pframe = pxmitframe->buf_addr + hw_hdr_offset;
 
-			if (bmcst) {
+			if (is_multicast_ether_addr(pattrib->ra)) {
 				if (!memcmp(psecuritypriv->dot118021XGrptxmickey[psecuritypriv->dot118021XGrpKeyid].skey, null_key, 16))
 					return _FAIL;
 				/* start to calculate the mic code */
@@ -715,12 +714,10 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
 
 	struct sta_info *psta;
 
-	int bmcst = IS_MCAST(pattrib->ra);
-
 	if (pattrib->psta) {
 		psta = pattrib->psta;
 	} else {
-		if (bmcst) {
+		if (is_multicast_ether_addr(pattrib->ra)) {
 			psta = rtw_get_bcmc_stainfo(padapter);
 		} else {
 			psta = rtw_get_stainfo(&padapter->stapriv, pattrib->ra);
@@ -907,7 +904,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
 	struct pkt_attrib	*pattrib = &pxmitframe->attrib;
 	u8 *pbuf_start;
-	s32 bmcst = IS_MCAST(pattrib->ra);
+	bool bmcst = is_multicast_ether_addr(pattrib->ra);
 	s32 res = _SUCCESS;
 
 	if (!pkt)
@@ -1801,7 +1798,7 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra
 	struct sta_priv *pstapriv = &padapter->stapriv;
 	struct pkt_attrib *pattrib = &pxmitframe->attrib;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	int bmcst = IS_MCAST(pattrib->ra);
+	bool bmcst = is_multicast_ether_addr(pattrib->ra);
 
 	if (!check_fwstate(pmlmepriv, WIFI_AP_STATE))
 	    return ret;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/8] staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (5 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 6/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 12:01 ` [PATCH 8/8] staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c Michael Straube
  2021-08-23 22:15 ` [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Phillip Potter
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, the
buffer is properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/rtl8188eu_xmit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
index d22b16cc5a30..17be67ac5fae 100644
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -167,7 +167,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag
 	struct tx_desc	*ptxdesc = (struct tx_desc *)pmem;
 	struct mlme_ext_priv	*pmlmeext = &adapt->mlmeextpriv;
 	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
-	int	bmcst = IS_MCAST(pattrib->ra);
 
 	if (adapt->registrypriv.mp_mode == 0) {
 		if ((!bagg_pkt) && (urb_zero_packet_chk(adapt, sz) == 0)) {
@@ -186,7 +185,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag
 
 	ptxdesc->txdw0 |= cpu_to_le32(((offset) << OFFSET_SHT) & 0x00ff0000);/* 32 bytes for TX Desc */
 
-	if (bmcst)
+	if (is_multicast_ether_addr(pattrib->ra))
 		ptxdesc->txdw0 |= cpu_to_le32(BMC);
 
 	if (adapt->registrypriv.mp_mode == 0) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/8] staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (6 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 7/8] staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c Michael Straube
@ 2021-08-23 12:01 ` Michael Straube
  2021-08-23 22:15 ` [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Phillip Potter
  8 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2021-08-23 12:01 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Use is_multicast_ether_addr instead of custom macro IS_MCAST, the
buffer is properly aligned.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/os_dep/recv_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/os_dep/recv_linux.c b/drivers/staging/r8188eu/os_dep/recv_linux.c
index b4c5333bfff0..dd3113b6d4f3 100644
--- a/drivers/staging/r8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/r8188eu/os_dep/recv_linux.c
@@ -132,7 +132,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
 		struct sta_info *psta = NULL;
 		struct sta_priv *pstapriv = &padapter->stapriv;
 		struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
-		int bmcast = IS_MCAST(pattrib->dst);
+		bool bmcast = is_multicast_ether_addr(pattrib->dst);
 
 		if (memcmp(pattrib->dst, myid(&padapter->eeprompriv),
 				 ETH_ALEN)) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST
  2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
                   ` (7 preceding siblings ...)
  2021-08-23 12:01 ` [PATCH 8/8] staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c Michael Straube
@ 2021-08-23 22:15 ` Phillip Potter
  8 siblings, 0 replies; 10+ messages in thread
From: Phillip Potter @ 2021-08-23 22:15 UTC (permalink / raw)
  To: Michael Straube
  Cc: Greg KH, Larry Finger, Martin Kaiser, Fabio M. De Francesco,
	open list:STAGING SUBSYSTEM, Linux Kernel Mailing List

On Mon, 23 Aug 2021 at 13:02, Michael Straube <straube.linux@gmail.com> wrote:
>
> This series replaces most uses of the custom IS_MCAST macro with
> is_multicast_ether_addr. The goal is to get rid of IS_MCAST.
> There is only one usage left in rtw_sta_mgt.c, but that one needs
> more effort to verify that the buffers are properly aligned, so I
> left it as is for now.
>
> Michael Straube (8):
>   staging: r8188eu: ensure proper alignment for eth address buffers
>   staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c
>   staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c
>   staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c
>   staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c
>   staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c
>   staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c
>   staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c
>
>  drivers/staging/r8188eu/core/rtw_mlme.c      |  4 ++--
>  drivers/staging/r8188eu/core/rtw_mp.c        |  4 ++--
>  drivers/staging/r8188eu/core/rtw_recv.c      | 20 ++++++++++----------
>  drivers/staging/r8188eu/core/rtw_security.c  |  8 ++++----
>  drivers/staging/r8188eu/core/rtw_xmit.c      | 15 ++++++---------
>  drivers/staging/r8188eu/hal/rtl8188eu_xmit.c |  3 +--
>  drivers/staging/r8188eu/include/rtw_recv.h   | 10 +++++-----
>  drivers/staging/r8188eu/include/rtw_xmit.h   |  8 ++++----
>  drivers/staging/r8188eu/os_dep/recv_linux.c  |  2 +-
>  9 files changed, 35 insertions(+), 39 deletions(-)
>
> --
> 2.32.0
>

Dear Michael,

Based on my limited knowledge, looks good to me. Also I built and
runtime tested it with my N10-Nano, driver works well still. Many
thanks.

For whole series:
Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-23 22:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 12:00 [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Michael Straube
2021-08-23 12:00 ` [PATCH 1/8] staging: r8188eu: ensure proper alignment for eth address buffers Michael Straube
2021-08-23 12:01 ` [PATCH 2/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mlme.c Michael Straube
2021-08-23 12:01 ` [PATCH 3/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_mp.c Michael Straube
2021-08-23 12:01 ` [PATCH 4/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_recv.c Michael Straube
2021-08-23 12:01 ` [PATCH 5/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_security.c Michael Straube
2021-08-23 12:01 ` [PATCH 6/8] staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c Michael Straube
2021-08-23 12:01 ` [PATCH 7/8] staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c Michael Straube
2021-08-23 12:01 ` [PATCH 8/8] staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c Michael Straube
2021-08-23 22:15 ` [PATCH 0/8] staging: r8188eu: use is_multicast_ether_addr instead of IS_MCAST Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).