From 03af80bee9fb858e1e8748edd0802b17eff04c39 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Thu, 5 Aug 2021 22:50:10 +0200 Subject: [PATCH] replace custom macros with is_broadcast_ether_addr Replace usage of custom macros with is_broadcast_ether_addr. All buffers are properly aligned. Remove the now unsued macros MacAddr_isBcst and IS_MAC_ADDRESS_BROADCAST. Link: https://lore.kernel.org/r/20210805205010.31192-1-straube.linux@gmail.com --- core/rtw_ioctl_set.c | 7 ------- core/rtw_recv.c | 2 +- core/rtw_sta_mgt.c | 2 +- core/rtw_tdls.c | 2 +- hal/phydm/txbf/haltxbfinterface.c | 2 +- include/wifi.h | 7 ------- 6 files changed, 4 insertions(+), 18 deletions(-) diff --git a/core/rtw_ioctl_set.c b/core/rtw_ioctl_set.c index 9ac1e18..565a734 100644 --- a/core/rtw_ioctl_set.c +++ b/core/rtw_ioctl_set.c @@ -20,13 +20,6 @@ extern void indicate_wx_scan_complete_event(_adapter *padapter); -#define IS_MAC_ADDRESS_BROADCAST(addr) \ - (\ - ((addr[0] == 0xff) && (addr[1] == 0xff) && \ - (addr[2] == 0xff) && (addr[3] == 0xff) && \ - (addr[4] == 0xff) && (addr[5] == 0xff)) ? _TRUE : _FALSE \ - ) - u8 rtw_validate_bssid(u8 *bssid) { u8 ret = _TRUE; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 1c290b4..71f477b 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -1113,7 +1113,7 @@ void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_in padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++; - if ((!MacAddr_isBcst(pattrib->dst)) && (!IS_MCAST(pattrib->dst))) + if (!is_broadcast_ether_addr(pattrib->dst) && !IS_MCAST(pattrib->dst)) padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++; if (sta) diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 36972cb..c26d50f 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -713,7 +713,7 @@ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta) } - if (!((psta->state & WIFI_AP_STATE) || MacAddr_isBcst(psta->cmn.mac_addr)) && is_pre_link_sta == _FALSE) + if (!((psta->state & WIFI_AP_STATE) || is_broadcast_ether_addr(psta->cmn.mac_addr)) && is_pre_link_sta == _FALSE) rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _FALSE); diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index 604cd35..32855a7 100644 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -2376,7 +2376,7 @@ int On_TDLS_Dis_Req(_adapter *padapter, union recv_frame *precv_frame) if (psta_ap == NULL) goto exit; dst = pIE->data + 12; - if (MacAddr_isBcst(dst) == _FALSE && (_rtw_memcmp(adapter_mac_addr(padapter), dst, ETH_ALEN) == _FALSE)) + if (MacAddr_isMulticast(dst) == _FALSE && (_rtw_memcmp(adapter_mac_addr(padapter), dst, ETH_ALEN) == _FALSE)) goto exit; break; default: diff --git a/hal/phydm/txbf/haltxbfinterface.c b/hal/phydm/txbf/haltxbfinterface.c index d4aa797..905b117 100644 --- a/hal/phydm/txbf/haltxbfinterface.c +++ b/hal/phydm/txbf/haltxbfinterface.c @@ -54,7 +54,7 @@ void beamforming_gid_paid( /* VHT SU PPDU carrying one or more group addressed MPDUs or */ /* Transmitting a VHT NDP intended for multiple recipients */ - if (MacAddr_isBcst(RA) || MacAddr_isMulticast(RA) || tcb->macId == MAC_ID_STATIC_FOR_BROADCAST_MULTICAST) { + if (is_broadcast_ether_addr(RA) || MacAddr_isMulticast(RA) || tcb->macId == MAC_ID_STATIC_FOR_BROADCAST_MULTICAST) { tcb->G_ID = 63; tcb->P_AID = 0; } else if (ACTING_AS_AP(adapter)) { diff --git a/include/wifi.h b/include/wifi.h index 11bb895..5670c66 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -441,13 +441,6 @@ enum WIFI_REG_DOMAIN { #define GetAddr4Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 24)) -#define MacAddr_isBcst(addr) \ - (\ - ((addr[0] == 0xff) && (addr[1] == 0xff) && \ - (addr[2] == 0xff) && (addr[3] == 0xff) && \ - (addr[4] == 0xff) && (addr[5] == 0xff)) ? _TRUE : _FALSE \ - ) - __inline static int IS_MCAST(const u8 *da) { if ((*da) & 0x01)