Commit 3ca5ada5 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: brcm80211: Convert ETHER_IS_MULTI to is_multicast_ether_addr

Use the standard kernel function.
Change callers to add .octet to addressing to avoid warnings.
Add #include <linux/etherdevice.h> where necessary.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ee417a79
...@@ -1032,7 +1032,7 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) ...@@ -1032,7 +1032,7 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf)
u8 *pktdata = (u8 *) (pktbuf->data); u8 *pktdata = (u8 *) (pktbuf->data);
struct ether_header *eh = (struct ether_header *)pktdata; struct ether_header *eh = (struct ether_header *)pktdata;
if (ETHER_ISMULTI(eh->ether_dhost)) if (is_multicast_ether_addr(eh->ether_dhost))
dhdp->tx_multicast++; dhdp->tx_multicast++;
if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X) if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X)
atomic_inc(&dhd->pend_8021x_cnt); atomic_inc(&dhd->pend_8021x_cnt);
......
...@@ -1532,7 +1532,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, ...@@ -1532,7 +1532,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev,
key.index = (u32) key_idx; key.index = (u32) key_idx;
/* Instead of bcast for ea address for default wep keys, /* Instead of bcast for ea address for default wep keys,
driver needs it to be Null */ driver needs it to be Null */
if (!ETHER_ISMULTI(mac_addr)) if (!is_multicast_ether_addr(mac_addr))
memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN); memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN);
key.len = (u32) params->key_len; key.len = (u32) params->key_len;
/* check for key index change */ /* check for key index change */
......
...@@ -2548,7 +2548,7 @@ wl_iw_set_encodeext(struct net_device *dev, ...@@ -2548,7 +2548,7 @@ wl_iw_set_encodeext(struct net_device *dev,
key.len = iwe->key_len; key.len = iwe->key_len;
if (!ETHER_ISMULTI(iwe->addr.sa_data)) if (!is_multicast_ether_addr(iwe->addr.sa_data))
bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea, bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea,
ETHER_ADDR_LEN); ETHER_ADDR_LEN);
......
...@@ -64,8 +64,6 @@ BWL_PRE_PACKED_STRUCT struct ether_addr { ...@@ -64,8 +64,6 @@ BWL_PRE_PACKED_STRUCT struct ether_addr {
#define ETHER_SET_UNICAST(ea) (((u8 *)(ea))[0] = (((u8 *)(ea))[0] & ~1)) #define ETHER_SET_UNICAST(ea) (((u8 *)(ea))[0] = (((u8 *)(ea))[0] & ~1))
#define ETHER_ISMULTI(ea) (((const u8 *)(ea))[0] & 1)
#define ether_cmp(a, b) (!(((short *)a)[0] == ((short *)b)[0]) | \ #define ether_cmp(a, b) (!(((short *)a)[0] == ((short *)b)[0]) | \
!(((short *)a)[1] == ((short *)b)[1]) | \ !(((short *)a)[1] == ((short *)b)[1]) | \
!(((short *)a)[2] == ((short *)b)[2])) !(((short *)a)[2] == ((short *)b)[2]))
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/etherdevice.h>
#include <bcmdefs.h> #include <bcmdefs.h>
#include <bcmdevs.h> #include <bcmdevs.h>
#include <wlc_cfg.h> #include <wlc_cfg.h>
...@@ -5802,7 +5803,8 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, ...@@ -5802,7 +5803,8 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
ASSERT(RSPEC_ACTIVE(rspec[k])); ASSERT(RSPEC_ACTIVE(rspec[k]));
rspec[k] = WLC_RATE_1M; rspec[k] = WLC_RATE_1M;
} else { } else {
if (WLANTSEL_ENAB(wlc) && !ETHER_ISMULTI(&h->a1)) { if (WLANTSEL_ENAB(wlc) &&
!is_multicast_ether_addr(h->a1.octet)) {
/* set tx antenna config */ /* set tx antenna config */
wlc_antsel_antcfg_get(wlc->asi, false, false, 0, wlc_antsel_antcfg_get(wlc->asi, false, false, 0,
0, &antcfg, &fbantcfg); 0, &antcfg, &fbantcfg);
...@@ -5963,7 +5965,8 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, ...@@ -5963,7 +5965,8 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
plcp[0]; plcp[0];
/* DUR field for main rate */ /* DUR field for main rate */
if ((fc != FC_PS_POLL) && !ETHER_ISMULTI(&h->a1) && !use_rifs) { if ((fc != FC_PS_POLL) &&
!is_multicast_ether_addr(h->a1.octet) && !use_rifs) {
durid = durid =
wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0], wlc_compute_frame_dur(wlc, rspec[0], preamble_type[0],
next_frag_len); next_frag_len);
...@@ -5981,7 +5984,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, ...@@ -5981,7 +5984,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
/* DUR field for fallback rate */ /* DUR field for fallback rate */
if (fc == FC_PS_POLL) if (fc == FC_PS_POLL)
txh->FragDurFallback = h->durid; txh->FragDurFallback = h->durid;
else if (ETHER_ISMULTI(&h->a1) || use_rifs) else if (is_multicast_ether_addr(h->a1.octet) || use_rifs)
txh->FragDurFallback = 0; txh->FragDurFallback = 0;
else { else {
durid = wlc_compute_frame_dur(wlc, rspec[1], durid = wlc_compute_frame_dur(wlc, rspec[1],
...@@ -5993,7 +5996,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, ...@@ -5993,7 +5996,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
if (frag == 0) if (frag == 0)
mcl |= TXC_STARTMSDU; mcl |= TXC_STARTMSDU;
if (!ETHER_ISMULTI(&h->a1)) if (!is_multicast_ether_addr(h->a1.octet))
mcl |= TXC_IMMEDACK; mcl |= TXC_IMMEDACK;
if (BAND_5G(wlc->band->bandtype)) if (BAND_5G(wlc->band->bandtype))
...@@ -6222,7 +6225,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw, ...@@ -6222,7 +6225,7 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct ieee80211_hw *hw,
if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) { if (SCB_WME(scb) && qos && wlc->edcf_txop[ac]) {
uint frag_dur, dur, dur_fallback; uint frag_dur, dur, dur_fallback;
ASSERT(!ETHER_ISMULTI(&h->a1)); ASSERT(!is_multicast_ether_addr(h->a1.octet));
/* WME: Update TXOP threshold */ /* WME: Update TXOP threshold */
if ((!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) && (frag == 0)) { if ((!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) && (frag == 0)) {
...@@ -7023,7 +7026,8 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p) ...@@ -7023,7 +7026,8 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
if (!is_amsdu) { if (!is_amsdu) {
/* CTS and ACK CTL frames are w/o a2 */ /* CTS and ACK CTL frames are w/o a2 */
if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) { if (FC_TYPE(fc) == FC_TYPE_DATA || FC_TYPE(fc) == FC_TYPE_MNG) {
if ((ETHER_ISNULLADDR(&h->a2) || ETHER_ISMULTI(&h->a2))) { if ((ETHER_ISNULLADDR(&h->a2) ||
is_multicast_ether_addr(h->a2.octet))) {
WL_ERROR(("wl%d: %s: dropping a frame with " WL_ERROR(("wl%d: %s: dropping a frame with "
"invalid src mac address, a2: %pM\n", "invalid src mac address, a2: %pM\n",
wlc->pub->unit, __func__, &h->a2)); wlc->pub->unit, __func__, &h->a2));
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/etherdevice.h>
#include <bcmdefs.h> #include <bcmdefs.h>
#include <osl.h> #include <osl.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -499,10 +500,10 @@ int srom_parsecis(struct osl_info *osh, u8 *pcis[], uint ciscnt, char **vars, ...@@ -499,10 +500,10 @@ int srom_parsecis(struct osl_info *osh, u8 *pcis[], uint ciscnt, char **vars,
break; break;
default: default:
/* set macaddr if HNBU_MACADDR not seen yet */ /* set macaddr if HNBU_MACADDR not seen yet */
if (eabuf[0] == '\0' if (eabuf[0] == '\0' &&
&& cis[i] == LAN_NID cis[i] == LAN_NID &&
&& !(ETHER_ISNULLADDR(&cis[i + 2])) !(ETHER_ISNULLADDR(&cis[i + 2])) &&
&& !(ETHER_ISMULTI(&cis[i + 2]))) { !is_multicast_ether_addr(&cis[i + 2])) {
ASSERT(cis[i + 1] == ASSERT(cis[i + 1] ==
ETHER_ADDR_LEN); ETHER_ADDR_LEN);
snprintf(eabuf, sizeof(eabuf), snprintf(eabuf, sizeof(eabuf),
...@@ -974,7 +975,7 @@ int srom_parsecis(struct osl_info *osh, u8 *pcis[], uint ciscnt, char **vars, ...@@ -974,7 +975,7 @@ int srom_parsecis(struct osl_info *osh, u8 *pcis[], uint ciscnt, char **vars,
case HNBU_MACADDR: case HNBU_MACADDR:
if (!(ETHER_ISNULLADDR(&cis[i + 1])) && if (!(ETHER_ISNULLADDR(&cis[i + 1])) &&
!(ETHER_ISMULTI(&cis[i + 1]))) { !is_multicast_ether_addr(&cis[i + 1])) {
snprintf(eabuf, sizeof(eabuf), snprintf(eabuf, sizeof(eabuf),
"%pM", &cis[i + 1]); "%pM", &cis[i + 1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment