staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c
Subsystems (2)
PATCH 1/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c
Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_security.c.
--- drivers/staging/rtl8188eu/core/rtw_security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_security.c +4 -4
@@ -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;
Signature · 1 line
2.18.0
PATCH 2/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c
Use is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_recv.c.
--- drivers/staging/rtl8188eu/core/rtw_recv.c | 35 ++++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/staging/rtl8188eu/core/rtw_recv.c +18 -17
@@ -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) {
Signature · 1 line
2.18.0
PATCH 3/5 staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
In reply to Michael StraubeUse is_multicast_ether_addr instead of custom IS_MCAST in core/rtw_xmit.c.
--- drivers/staging/rtl8188eu/core/rtw_xmit.c | 35 +++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +16 -19
@@ -399,7 +399,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pstruct 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 pif ((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 *pxmitfrstruct 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 *pattrstruct 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, structstruct 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, structWEP_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, structif ((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, structxmitframe_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_frastruct 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_frareturn 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 */
Signature · 1 line
2.18.0
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 2 lines · Michael Straube
Use
is_multicast_ether_addrinstead of customIS_MCASTincore/rtw_xmit.c.
Have you verified that all accesses are __aligned(2) ?
If so, please state that in the patch description.
drivers/staging/rtl8188eu/core/rtw_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0
[]
drivers/staging/rtl8188eu/core/rtw_xmit.c static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p · line 463
Quoted 6 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +1
-1@@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif ((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...
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 14 lines · Joe Perches
Quoted 2 lines · Michael Straube
Use
is_multicast_ether_addrinstead of customIS_MCASTincore/rtw_xmit.c.Have you verified that all accesses are
__aligned(2)?If so, please state that in the patch description.
drivers/staging/rtl8188eu/core/rtw_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0[]
Quoted 4 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0@@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif ((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 );
Quoted 7 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p · line 463
Quoted 2 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +1
-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
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 24 lines · Michael Straube
Quoted 15 lines · Joe Perches
Quoted 2 lines · Michael Straube
Use
is_multicast_ether_addrinstead of customIS_MCASTincore/rtw_xmit.c.Have you verified that all accesses are
__aligned(2)?If so, please state that in the patch description.
drivers/staging/rtl8188eu/core/rtw_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0[]
Quoted 4 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0@@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif ((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 );Quoted 7 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p · line 463
Quoted 2 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +1
-1- bmcast =IS_MCAST (pattrib->ra); + mcast =is_multicast_ether_addr (pattrib->ra);i.e.: is
pattrib->ra__aligned(2)?etc...
Quoted 6 lines
Hi Joe,
I looked at the function comment for
is_multicast_ether_addrinetherdevice.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 <[email protected]> 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.
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(+)
include/linux/etherdevice.h +2 -0
@@ -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) {
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 63 lines · Joe Perches
Quoted 24 lines · Michael Straube
Quoted 15 lines · Joe Perches
Quoted 2 lines · Michael Straube
Use
is_multicast_ether_addrinstead of customIS_MCASTincore/rtw_xmit.c.Have you verified that all accesses are
__aligned(2)?If so, please state that in the patch description.
drivers/staging/rtl8188eu/core/rtw_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0[]
Quoted 4 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0@@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pif ((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 );Quoted 7 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p · line 463
Quoted 2 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +1
-1- bmcast =IS_MCAST (pattrib->ra); + mcast =is_multicast_ether_addr (pattrib->ra);i.e.: is
pattrib->ra__aligned(2)?etc...
Quoted 6 lines
Hi Joe,
I looked at the function comment for
is_multicast_ether_addrinetherdevice.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
d54385ce68cd18ab002b46f61246ad197cec92deAuthor: Alexander Duyck <[email protected]> Date: Thu Apr 30 14:53:54 2015 -0700etherdev: Process
is_multicast_ether_addrat same size as other operationsThis change makes it so that we process the address in
is_multicast_ether_addrat the same size as the other calls. This allows us to avoid duplicate reads when used with other calls such asis_zero_ether_addroreth_addr_copy. In addition I have added a 64 bit version of the function so ineth_type_transwe can process the destination address as a 64 bit value throughout.Signed-off-by Alexander Duyck <[email protected]>Signed-off-by David S. Miller <[email protected]>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(+)include/linux/etherdevice.h +0
-0
include/linux/etherdevice.h static inline bool is_zero_ether_addr(const u8 *addr) · line 122
Quoted 8 lines
include/linux/etherdevice.h +2
-0@@ -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.
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 64 lines · Michael Straube
Quoted 63 lines · Joe Perches
Quoted 23 lines · Michael Straube
Quoted 19 lines · Joe Perches
Quoted 2 lines · Michael Straube
Use
is_multicast_ether_addrinstead of customIS_MCASTincore/rtw_xmit.c.Have you verified that all accesses are
__aligned(2)?If so, please state that in the patch description.
drivers/staging/rtl8188eu/core/rtw_xmit.c
Quoted 1 line
drivers/staging/rtl8188eu/core/rtw_xmit.c +0
-0[]
drivers/staging/rtl8188eu/core/rtw_xmit.c static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p · line 462
Quoted 5 lines
drivers/staging/rtl8188eu/core/rtw_xmit.c +1
-1@@ -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)?Quoted 2 lines
etc...
Quoted 6 lines
Hi Joe,
I looked at the function comment for
is_multicast_ether_addrinetherdevice.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 <[email protected]> Date: Thu Apr 30 14:53:54 2015 -0700etherdev: Process
is_multicast_ether_addrat same size as other operations This change makes it so that we process the address inis_multicast_ether_addrat the same size as the other calls. This allows us to avoid duplicate reads when used with other calls such asis_zero_ether_addror eth_addr_copy. In addition I have added a 64 bit version of the function so ineth_type_transwe can process the destination address as a 64 bit value throughout.Signed-off-by Alexander Duyck <[email protected]>Signed-off-by David S. Miller <[email protected]>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(+)include/linux/etherdevice.h +1
-0@@ -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. + *
Quoted 8 lines
include/linux/etherdevice.h static inline bool is_zero_ether_addr(const u8 *addr) · line 122
Quoted 5 lines
include/linux/etherdevice.h +1
-0+* 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) ?
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 1 line · Michael Straube
Is the memory pointed to by
sk_buff->data(always)__aligned(2)?
Yes.
regards,
dan carpenter
Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Quoted 3 lines · Dan Carpenter
Quoted 1 line · Michael Straube
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.
PATCH 4/5 staging: rtl8188eu: remove unused IS_MCAST
In reply to Michael StraubeRemove the now unused IS_MCAST.
--- drivers/staging/rtl8188eu/include/wifi.h | 8 -------- 1 file changed, 8 deletions(-)
drivers/staging/rtl8188eu/include/wifi.h +0 -8
@@ -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;
Signature · 1 line
2.18.0
PATCH 5/5 staging: rtl8188eu: use phydm_reg.h from rtlwifi
In reply to Michael StraubeUse 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.
--- .../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
drivers/staging/rtl8188eu/include/odm_precomp.h +1 -1
@@ -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"
drivers/staging/rtl8188eu/include/odm_reg.h deleted +0 -106
106 lines not on this page · raw message
Signature · 1 line
2.18.0