* [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c @ 2018-08-09 17:01 Michael Straube 2018-08-09 17:01 ` [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c Michael Straube ` (3 more replies) 0 siblings, 4 replies; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:01 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-kernel, Michael Straube Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_security.c. Signed-off-by: Michael Straube <straube.linux@gmail.com> --- drivers/staging/rtl8188eu/core/rtw_security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_security.c b/drivers/staging/rtl8188eu/core/rtw_security.c index 2a48b09ea9ae..a2ec0e403718 100644 --- a/drivers/staging/rtl8188eu/core/rtw_security.c +++ b/drivers/staging/rtl8188eu/core/rtw_security.c @@ -608,7 +608,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) if (stainfo != NULL) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__)); - 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]; @@ -678,7 +678,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__); @@ -1250,7 +1250,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe) if (stainfo) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__)); - 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]; @@ -1296,7 +1296,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe) struct security_priv *psecuritypriv = &padapter->securitypriv; char iv[8], icv[8]; - 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.18.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c 2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube @ 2018-08-09 17:01 ` Michael Straube 2018-08-09 17:01 ` [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c Michael Straube ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:01 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-kernel, Michael Straube Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_recv.c. Signed-off-by: Michael Straube <straube.linux@gmail.com> --- drivers/staging/rtl8188eu/core/rtw_recv.c | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 17b4b9257b49..ab9638d618a9 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -233,7 +233,7 @@ static int recvframe_chkmic(struct adapter *adapter, /* calculate mic code */ if (stainfo) { - if (IS_MCAST(prxattrib->ra)) { + if (is_multicast_ether_addr(prxattrib->ra)) { if (!psecuritypriv) { res = _FAIL; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, @@ -321,11 +321,11 @@ static int recvframe_chkmic(struct adapter *adapter, /* double check key_index for some timing issue , */ /* cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */ - if ((IS_MCAST(prxattrib->ra) == true) && (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)); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" mic error :prxattrib->bdecrypted=%d ", prxattrib->bdecrypted)); DBG_88E(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted); } else { @@ -335,7 +335,7 @@ static int recvframe_chkmic(struct adapter *adapter, 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; RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("psecuritypriv->bcheck_grpkey = true")); } @@ -648,7 +648,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 mcast = is_multicast_ether_addr(pattrib->dst); if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { @@ -659,7 +659,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, goto exit; } - if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast)) { + if (memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && !mcast) { ret = _FAIL; goto exit; } @@ -681,9 +681,9 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, } sta_addr = pattrib->bssid; } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - if (bmcast) { + if (mcast) { /* 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; } @@ -700,7 +700,7 @@ int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame, ret = _FAIL; } - if (bmcast) + if (mcast) *psta = rtw_get_bcmc_stainfo(adapter); else *psta = rtw_get_stainfo(pstapriv, sta_addr); /* get ap_info */ @@ -727,7 +727,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 mcast = is_multicast_ether_addr(pattrib->dst); if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) && (check_fwstate(pmlmepriv, _FW_LINKED) == true || @@ -740,7 +740,7 @@ static int ap2sta_data_frame( } /* da should be for me */ - if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast)) { + if (memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && !mcast) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, (" %s: compare DA fail; DA=%pM\n", __func__, (pattrib->dst))); ret = _FAIL; @@ -755,7 +755,7 @@ static int ap2sta_data_frame( (" %s: compare BSSID fail ; BSSID=%pM\n", __func__, (pattrib->bssid))); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("mybssid=%pM\n", (mybssid))); - if (!bmcast) { + if (!mcast) { DBG_88E("issue_deauth to the nonassociated ap=%pM for the reason(7)\n", (pattrib->bssid)); issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); } @@ -764,7 +764,7 @@ static int ap2sta_data_frame( goto exit; } - if (bmcast) + if (mcast) *psta = rtw_get_bcmc_stainfo(adapter); else *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get ap_info */ @@ -789,7 +789,7 @@ static int ap2sta_data_frame( ret = RTW_RX_HANDLED; goto exit; } else { - if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && (!bmcast)) { + if (!memcmp(myhwaddr, pattrib->dst, ETH_ALEN) && !mcast) { *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /* get sta_info */ if (*psta == NULL) { DBG_88E("issue_deauth to the ap =%pM for the reason(7)\n", (pattrib->bssid)); @@ -1129,9 +1129,9 @@ static int validate_recv_data_frame(struct adapter *adapter, if (pattrib->privacy) { RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("%s:pattrib->privacy=%x\n", __func__, pattrib->privacy)); - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n ^^^^^^^^^^^IS_MCAST(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n", pattrib->ra[0], IS_MCAST(pattrib->ra))); + RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n ^^^^^^^^^^^is_multicast_ether_addr(pattrib->ra(0x%02x))=%d^^^^^^^^^^^^^^^6\n", pattrib->ra[0], is_multicast_ether_addr(pattrib->ra))); - GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, IS_MCAST(pattrib->ra)); + GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, is_multicast_ether_addr(pattrib->ra)); RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n pattrib->encrypt=%d\n", pattrib->encrypt)); @@ -1971,7 +1971,8 @@ 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 && !is_wep_enc(psecuritypriv->dot11PrivacyAlgrthm) && !psecuritypriv->busetkipkey) { -- 2.18.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube 2018-08-09 17:01 ` [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c Michael Straube @ 2018-08-09 17:01 ` Michael Straube 2018-08-09 17:13 ` Joe Perches 2018-08-09 17:01 ` [PATCH 4/5] staging: rtl8188eu: remove unused IS_MCAST Michael Straube 2018-08-09 17:01 ` [PATCH 5/5] staging: rtl8188eu: use phydm_reg.h from rtlwifi Michael Straube 3 siblings, 1 reply; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:01 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-kernel, Michael Straube Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_xmit.c. Signed-off-by: Michael Straube <straube.linux@gmail.com> --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 35 +++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index 2130d78e0d9f..fc06a13a6ea1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -399,7 +399,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 mcast; struct sta_priv *pstapriv = &padapter->stapriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); - bmcast = IS_MCAST(pattrib->ra); + mcast = is_multicast_ether_addr(pattrib->ra); /* get sta_info */ - if (bmcast) { + if (mcast) { psta = rtw_get_bcmc_stainfo(padapter); } else { psta = rtw_get_stainfo(pstapriv, pattrib->ra); @@ -517,7 +517,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p goto exit; } } else { - GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast); + GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, mcast); switch (psecuritypriv->dot11AuthAlgrthm) { case dot11AuthAlgrthm_Open: @@ -526,7 +526,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p pattrib->key_idx = (u8)psecuritypriv->dot11PrivacyKeyIndex; break; case dot11AuthAlgrthm_8021X: - if (bmcast) + if (mcast) pattrib->key_idx = (u8)psecuritypriv->dot118021XGrpKeyid; else pattrib->key_idx = 0; @@ -596,7 +596,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; @@ -614,7 +613,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 */ @@ -743,12 +742,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); @@ -914,7 +911,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 mcast = is_multicast_ether_addr(pattrib->ra); s32 res = _SUCCESS; size_t remainder = pkt->len - ETH_HLEN; @@ -964,13 +961,13 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); break; case _TKIP_: - if (bmcst) + if (mcast) TKIP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else TKIP_IV(pattrib->iv, psta->dot11txpn, 0); break; case _AES_: - if (bmcst) + if (mcast) AES_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); else AES_IV(pattrib->iv, psta->dot11txpn, 0); @@ -997,7 +994,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct if ((pattrib->icv_len > 0) && (pattrib->bswenc)) mpdu_len -= pattrib->icv_len; - mem_sz = min_t(size_t, bmcst ? pattrib->pktlen : mpdu_len, remainder); + mem_sz = min_t(size_t, mcast ? pattrib->pktlen : mpdu_len, remainder); skb_copy_bits(pkt, pkt->len - remainder, pframe, mem_sz); remainder -= mem_sz; @@ -1010,7 +1007,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct frg_inx++; - if (bmcst || remainder == 0) { + if (mcast || remainder == 0) { pattrib->nr_frags = frg_inx; pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz : 0) + @@ -1041,7 +1038,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct xmitframe_swencrypt(padapter, pxmitframe); - if (!bmcst) + if (!mcast) update_attrib_vcs_info(padapter, pxmitframe); else pattrib->vcs_mode = NONE_VCS; @@ -1632,7 +1629,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 mcast = is_multicast_ether_addr(pattrib->ra); if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == false) return ret; @@ -1646,12 +1643,12 @@ int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fra return ret; if (pattrib->triggered == 1) { - if (bmcst) + if (mcast) pattrib->qsel = 0x11;/* HIQ */ return ret; } - if (bmcst) { + if (mcast) { spin_lock_bh(&psta->sleep_q.lock); if (pstapriv->sta_dz_bitmap) {/* if any one sta is in ps mode */ -- 2.18.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 17:01 ` [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c Michael Straube @ 2018-08-09 17:13 ` Joe Perches 2018-08-09 17:42 ` Michael Straube 0 siblings, 1 reply; 12+ messages in thread From: Joe Perches @ 2018-08-09 17:13 UTC (permalink / raw) To: Michael Straube, gregkh; +Cc: devel, linux-kernel On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote: > Use is_multicast_ether_addr instead of custom IS_MCAST in > core/rtw_xmit.c. Have you verified that all accesses are __aligned(2) ? If so, please state that in the patch description. > diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c [] > @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p > if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) > rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); > > - bmcast = IS_MCAST(pattrib->ra); > + mcast = is_multicast_ether_addr(pattrib->ra); i.e.: is pattrib->ra __aligned(2) ? etc... ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 17:13 ` Joe Perches @ 2018-08-09 17:42 ` Michael Straube 2018-08-09 17:51 ` Joe Perches 0 siblings, 1 reply; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:42 UTC (permalink / raw) To: Joe Perches, gregkh; +Cc: devel, linux-kernel On 8/9/18 7:13 PM, Joe Perches wrote: > On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote: >> Use is_multicast_ether_addr instead of custom IS_MCAST in >> core/rtw_xmit.c. > > Have you verified that all accesses are __aligned(2) ? > > If so, please state that in the patch description. > >> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c > [] >> @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p >> if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) >> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); >> >> - bmcast = IS_MCAST(pattrib->ra); >> + mcast = is_multicast_ether_addr(pattrib->ra); > > i.e.: is pattrib->ra __aligned(2) ? > > etc... > Hi Joe, I looked at the function comment for is_multicast_ether_addr in etherdevice.h. There is not mentioned that __aligned(2) is required. If it is, I will check. So, is it required although it's not mentioned for is_multicast_ether_addr? Thanks, Michael ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 17:42 ` Michael Straube @ 2018-08-09 17:51 ` Joe Perches 2018-08-09 18:03 ` Michael Straube 0 siblings, 1 reply; 12+ messages in thread From: Joe Perches @ 2018-08-09 17:51 UTC (permalink / raw) To: Michael Straube, gregkh Cc: devel, linux-kernel, Alexander Duyck, David S. Miller On Thu, 2018-08-09 at 19:42 +0200, Michael Straube wrote: > On 8/9/18 7:13 PM, Joe Perches wrote: > > On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote: > > > Use is_multicast_ether_addr instead of custom IS_MCAST in > > > core/rtw_xmit.c. > > > > Have you verified that all accesses are __aligned(2) ? > > > > If so, please state that in the patch description. > > > > > diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c > > > > [] > > > @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p > > > if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) > > > rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); > > > > > > - bmcast = IS_MCAST(pattrib->ra); > > > + mcast = is_multicast_ether_addr(pattrib->ra); > > > > i.e.: is pattrib->ra __aligned(2) ? > > > > etc... > > > > Hi Joe, > > I looked at the function comment for is_multicast_ether_addr in etherdevice.h. > There is not mentioned that __aligned(2) is required. If it is, I will check. > > So, is it required although it's not mentioned for is_multicast_ether_addr? Well, it wasn't required initially, but commit d54385ce68cd18ab002b46f61246ad197cec92de Author: Alexander Duyck <alexander.h.duyck@redhat.com> Date: Thu Apr 30 14:53:54 2015 -0700 etherdev: Process is_multicast_ether_addr at same size as other operations This change makes it so that we process the address in is_multicast_ether_addr at the same size as the other calls. This allows us to avoid duplicate reads when used with other calls such as is_zero_ether_addr or eth_addr_copy. In addition I have added a 64 bit version of the function so in eth_type_trans we can process the destination address as a 64 bit value throughout. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> changed it without adding a note in the kernel-doc. So this is likely appropriate to avoid unaligned access traps: --- include/linux/etherdevice.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 572e11bb8696..0f7086b4836a 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -115,6 +115,8 @@ static inline bool is_zero_ether_addr(const u8 *addr) * * Return true if the address is a multicast address. * By definition the broadcast address is also a multicast address. + * + * Please note: addr must be aligned to u16. */ static inline bool is_multicast_ether_addr(const u8 *addr) { ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 17:51 ` Joe Perches @ 2018-08-09 18:03 ` Michael Straube 2018-08-09 19:44 ` Michael Straube 0 siblings, 1 reply; 12+ messages in thread From: Michael Straube @ 2018-08-09 18:03 UTC (permalink / raw) To: Joe Perches, gregkh; +Cc: devel, linux-kernel, Alexander Duyck, David S. Miller On 8/9/18 7:51 PM, Joe Perches wrote: > On Thu, 2018-08-09 at 19:42 +0200, Michael Straube wrote: >> On 8/9/18 7:13 PM, Joe Perches wrote: >>> On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote: >>>> Use is_multicast_ether_addr instead of custom IS_MCAST in >>>> core/rtw_xmit.c. >>> >>> Have you verified that all accesses are __aligned(2) ? >>> >>> If so, please state that in the patch description. >>> >>>> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c >>> >>> [] >>>> @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p >>>> if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) >>>> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); >>>> >>>> - bmcast = IS_MCAST(pattrib->ra); >>>> + mcast = is_multicast_ether_addr(pattrib->ra); >>> >>> i.e.: is pattrib->ra __aligned(2) ? >>> >>> etc... >>> >> >> Hi Joe, >> >> I looked at the function comment for is_multicast_ether_addr in etherdevice.h. >> There is not mentioned that __aligned(2) is required. If it is, I will check. >> >> So, is it required although it's not mentioned for is_multicast_ether_addr? > > Well, it wasn't required initially, but > > commit d54385ce68cd18ab002b46f61246ad197cec92de > Author: Alexander Duyck <alexander.h.duyck@redhat.com> > Date: Thu Apr 30 14:53:54 2015 -0700 > > etherdev: Process is_multicast_ether_addr at same size as other operations > > This change makes it so that we process the address in > is_multicast_ether_addr at the same size as the other calls. This allows > us to avoid duplicate reads when used with other calls such as > is_zero_ether_addr or eth_addr_copy. In addition I have added a 64 bit > version of the function so in eth_type_trans we can process the destination > address as a 64 bit value throughout. > > Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> > Signed-off-by: David S. Miller <davem@davemloft.net> > > changed it without adding a note in the kernel-doc. > > So this is likely appropriate to avoid unaligned access traps: > --- > include/linux/etherdevice.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h > index 572e11bb8696..0f7086b4836a 100644 > --- a/include/linux/etherdevice.h > +++ b/include/linux/etherdevice.h > @@ -115,6 +115,8 @@ static inline bool is_zero_ether_addr(const u8 *addr) > * > * Return true if the address is a multicast address. > * By definition the broadcast address is also a multicast address. > + * > + * Please note: addr must be aligned to u16. > */ > static inline bool is_multicast_ether_addr(const u8 *addr) > { > Ok, then I will check and resend the series. Thanks again. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 18:03 ` Michael Straube @ 2018-08-09 19:44 ` Michael Straube 2018-08-09 19:46 ` Dan Carpenter 0 siblings, 1 reply; 12+ messages in thread From: Michael Straube @ 2018-08-09 19:44 UTC (permalink / raw) To: Joe Perches, gregkh; +Cc: devel, linux-kernel On 8/9/18 8:03 PM, Michael Straube wrote: > On 8/9/18 7:51 PM, Joe Perches wrote: >> On Thu, 2018-08-09 at 19:42 +0200, Michael Straube wrote: >>> On 8/9/18 7:13 PM, Joe Perches wrote: >>>> On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote: >>>>> Use is_multicast_ether_addr instead of custom IS_MCAST in >>>>> core/rtw_xmit.c. >>>> >>>> Have you verified that all accesses are __aligned(2) ? >>>> >>>> If so, please state that in the patch description. >>>> >>>>> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c >>>> >>>> [] >>>>> @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p >>>>> if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1)) >>>>> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1); >>>>> - bmcast = IS_MCAST(pattrib->ra); >>>>> + mcast = is_multicast_ether_addr(pattrib->ra); >>>> >>>> i.e.: is pattrib->ra __aligned(2) ? >>>> >>>> etc... >>>> >>> >>> Hi Joe, >>> >>> I looked at the function comment for is_multicast_ether_addr in etherdevice.h. >>> There is not mentioned that __aligned(2) is required. If it is, I will check. >>> >>> So, is it required although it's not mentioned for is_multicast_ether_addr? >> >> Well, it wasn't required initially, but >> >> commit d54385ce68cd18ab002b46f61246ad197cec92de >> Author: Alexander Duyck <alexander.h.duyck@redhat.com> >> Date: Thu Apr 30 14:53:54 2015 -0700 >> >> etherdev: Process is_multicast_ether_addr at same size as other operations >> This change makes it so that we process the address in >> is_multicast_ether_addr at the same size as the other calls. This allows >> us to avoid duplicate reads when used with other calls such as >> is_zero_ether_addr or eth_addr_copy. In addition I have added a 64 bit >> version of the function so in eth_type_trans we can process the destination >> address as a 64 bit value throughout. >> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> >> Signed-off-by: David S. Miller <davem@davemloft.net> >> >> changed it without adding a note in the kernel-doc. >> >> So this is likely appropriate to avoid unaligned access traps: >> --- >> include/linux/etherdevice.h | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h >> index 572e11bb8696..0f7086b4836a 100644 >> --- a/include/linux/etherdevice.h >> +++ b/include/linux/etherdevice.h >> @@ -115,6 +115,8 @@ static inline bool is_zero_ether_addr(const u8 *addr) >> * >> * Return true if the address is a multicast address. >> * By definition the broadcast address is also a multicast address. >> + * >> + * Please note: addr must be aligned to u16. >> */ >> static inline bool is_multicast_ether_addr(const u8 *addr) >> { >> > > Ok, then I will check and resend the series. > Thanks again. I looked at it and I'm not sure about this one: (where precv_frame->pkt is a sk_buff) is_multicast_ether_addr(GetAddr1Ptr(precv_frame->pkt->data)) and the macro GetAddr1Ptr: #define GetAddr1Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 4)) Is the memory pointed to by sk_buff->data (always) __aligned(2) ? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 19:44 ` Michael Straube @ 2018-08-09 19:46 ` Dan Carpenter 2018-08-09 19:59 ` Joe Perches 0 siblings, 1 reply; 12+ messages in thread From: Dan Carpenter @ 2018-08-09 19:46 UTC (permalink / raw) To: Michael Straube; +Cc: Joe Perches, gregkh, devel, linux-kernel On Thu, Aug 09, 2018 at 09:44:54PM +0200, Michael Straube wrote: > Is the memory pointed to by sk_buff->data (always) __aligned(2) ? Yes. regards, dan carpenter ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c 2018-08-09 19:46 ` Dan Carpenter @ 2018-08-09 19:59 ` Joe Perches 0 siblings, 0 replies; 12+ messages in thread From: Joe Perches @ 2018-08-09 19:59 UTC (permalink / raw) To: Dan Carpenter, Michael Straube; +Cc: gregkh, devel, linux-kernel On Thu, 2018-08-09 at 22:46 +0300, Dan Carpenter wrote: > On Thu, Aug 09, 2018 at 09:44:54PM +0200, Michael Straube wrote: > > Is the memory pointed to by sk_buff->data (always) __aligned(2) ? > Yes. Yup. It's actually set by ARCH_KMALLOC_MINALIGN, which is normally 8. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/5] staging: rtl8188eu: remove unused IS_MCAST 2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube 2018-08-09 17:01 ` [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c Michael Straube 2018-08-09 17:01 ` [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c Michael Straube @ 2018-08-09 17:01 ` Michael Straube 2018-08-09 17:01 ` [PATCH 5/5] staging: rtl8188eu: use phydm_reg.h from rtlwifi Michael Straube 3 siblings, 0 replies; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:01 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-kernel, Michael Straube Remove the now unused IS_MCAST. Signed-off-by: Michael Straube <straube.linux@gmail.com> --- drivers/staging/rtl8188eu/include/wifi.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 4a56e54e38f6..0a952edf8a81 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -257,14 +257,6 @@ enum WIFI_REG_DOMAIN { #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24)) -static inline int IS_MCAST(unsigned char *da) -{ - if ((*da) & 0x01) - return true; - else - return false; -} - static inline unsigned char *get_da(unsigned char *pframe) { unsigned char *da; -- 2.18.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] staging: rtl8188eu: use phydm_reg.h from rtlwifi 2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube ` (2 preceding siblings ...) 2018-08-09 17:01 ` [PATCH 4/5] staging: rtl8188eu: remove unused IS_MCAST Michael Straube @ 2018-08-09 17:01 ` Michael Straube 3 siblings, 0 replies; 12+ messages in thread From: Michael Straube @ 2018-08-09 17:01 UTC (permalink / raw) To: gregkh; +Cc: devel, linux-kernel, Michael Straube Use rtlwifi/phydm/phydm_reg.h instead of odm_reg.h and remove the now unused odm_reg.h. All defines from odm_reg.h are defined with the same values in rtlwifi/phydm/phydm_reg.h. Signed-off-by: Michael Straube <straube.linux@gmail.com> --- .../staging/rtl8188eu/include/odm_precomp.h | 2 +- drivers/staging/rtl8188eu/include/odm_reg.h | 106 ------------------ 2 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 drivers/staging/rtl8188eu/include/odm_reg.h diff --git a/drivers/staging/rtl8188eu/include/odm_precomp.h b/drivers/staging/rtl8188eu/include/odm_precomp.h index 658a938df4c1..0cf7f82b805f 100644 --- a/drivers/staging/rtl8188eu/include/odm_precomp.h +++ b/drivers/staging/rtl8188eu/include/odm_precomp.h @@ -29,7 +29,7 @@ #include "hal8188e_rate_adaptive.h" /* for RA,Power training */ #include "rtl8188e_hal.h" -#include "odm_reg.h" +#include "../../rtlwifi/phydm/phydm_reg.h" #include "odm_rtl8188e.h" diff --git a/drivers/staging/rtl8188eu/include/odm_reg.h b/drivers/staging/rtl8188eu/include/odm_reg.h deleted file mode 100644 index b56549ba1256..000000000000 --- a/drivers/staging/rtl8188eu/include/odm_reg.h +++ /dev/null @@ -1,106 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/****************************************************************************** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - ******************************************************************************/ -/* */ -/* File Name: odm_reg.h */ -/* */ -/* Description: */ -/* */ -/* This file is for general register definition. */ -/* */ -/* */ -/* */ -#ifndef __HAL_ODM_REG_H__ -#define __HAL_ODM_REG_H__ - -/* */ -/* Register Definition */ -/* */ - -/* MAC REG */ -#define ODM_BB_RESET 0x002 -#define ODM_DUMMY 0x4fe -#define ODM_EDCA_VO_PARAM 0x500 -#define ODM_EDCA_VI_PARAM 0x504 -#define ODM_EDCA_BE_PARAM 0x508 -#define ODM_EDCA_BK_PARAM 0x50C -#define ODM_TXPAUSE 0x522 - -/* BB REG */ -#define ODM_FPGA_PHY0_PAGE8 0x800 -#define ODM_PSD_SETTING 0x808 -#define ODM_AFE_SETTING 0x818 -#define ODM_TXAGC_B_6_18 0x830 -#define ODM_TXAGC_B_24_54 0x834 -#define ODM_TXAGC_B_MCS32_5 0x838 -#define ODM_TXAGC_B_MCS0_MCS3 0x83c -#define ODM_TXAGC_B_MCS4_MCS7 0x848 -#define ODM_TXAGC_B_MCS8_MCS11 0x84c -#define ODM_ANALOG_REGISTER 0x85c -#define ODM_RF_INTERFACE_OUTPUT 0x860 -#define ODM_TXAGC_B_MCS12_MCS15 0x868 -#define ODM_TXAGC_B_11_A_2_11 0x86c -#define ODM_AD_DA_LSB_MASK 0x874 -#define ODM_ENABLE_3_WIRE 0x88c -#define ODM_PSD_REPORT 0x8b4 -#define ODM_R_ANT_SELECT 0x90c -#define ODM_CCK_ANT_SELECT 0xa07 -#define ODM_CCK_PD_THRESH 0xa0a -#define ODM_CCK_RF_REG1 0xa11 -#define ODM_CCK_MATCH_FILTER 0xa20 -#define ODM_CCK_RAKE_MAC 0xa2e -#define ODM_CCK_CNT_RESET 0xa2d -#define ODM_CCK_TX_DIVERSITY 0xa2f -#define ODM_CCK_FA_CNT_MSB 0xa5b -#define ODM_CCK_FA_CNT_LSB 0xa5c -#define ODM_CCK_NEW_FUNCTION 0xa75 -#define ODM_OFDM_PHY0_PAGE_C 0xc00 -#define ODM_OFDM_RX_ANT 0xc04 -#define ODM_R_A_RXIQI 0xc14 -#define ODM_R_A_AGC_CORE1 0xc50 -#define ODM_R_A_AGC_CORE2 0xc54 -#define ODM_R_B_AGC_CORE1 0xc58 -#define ODM_R_AGC_PAR 0xc70 -#define ODM_R_HTSTF_AGC_PAR 0xc7c -#define ODM_TX_PWR_TRAINING_A 0xc90 -#define ODM_TX_PWR_TRAINING_B 0xc98 -#define ODM_OFDM_FA_CNT1 0xcf0 -#define ODM_OFDM_PHY0_PAGE_D 0xd00 -#define ODM_OFDM_FA_CNT2 0xda0 -#define ODM_OFDM_FA_CNT3 0xda4 -#define ODM_OFDM_FA_CNT4 0xda8 -#define ODM_TXAGC_A_6_18 0xe00 -#define ODM_TXAGC_A_24_54 0xe04 -#define ODM_TXAGC_A_1_MCS32 0xe08 -#define ODM_TXAGC_A_MCS0_MCS3 0xe10 -#define ODM_TXAGC_A_MCS4_MCS7 0xe14 -#define ODM_TXAGC_A_MCS8_MCS11 0xe18 -#define ODM_TXAGC_A_MCS12_MCS15 0xe1c - -/* RF REG */ -#define ODM_GAIN_SETTING 0x00 -#define ODM_CHANNEL 0x18 - -/* Ant Detect Reg */ -#define ODM_DPDT 0x300 - -/* PSD Init */ -#define ODM_PSDREG 0x808 - -/* 92D Path Div */ -#define PATHDIV_REG 0xB30 -#define PATHDIV_TRI 0xBA0 - - -/* */ -/* Bitmap Definition */ -/* */ - -#define BIT_FA_RESET BIT(0) - - - -#endif -- 2.18.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-08-09 19:59 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube 2018-08-09 17:01 ` [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c Michael Straube 2018-08-09 17:01 ` [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c Michael Straube 2018-08-09 17:13 ` Joe Perches 2018-08-09 17:42 ` Michael Straube 2018-08-09 17:51 ` Joe Perches 2018-08-09 18:03 ` Michael Straube 2018-08-09 19:44 ` Michael Straube 2018-08-09 19:46 ` Dan Carpenter 2018-08-09 19:59 ` Joe Perches 2018-08-09 17:01 ` [PATCH 4/5] staging: rtl8188eu: remove unused IS_MCAST Michael Straube 2018-08-09 17:01 ` [PATCH 5/5] staging: rtl8188eu: use phydm_reg.h from rtlwifi Michael Straube
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).