Commit 455f3e76 authored by Arend Van Spriel's avatar Arend Van Spriel Committed by Kalle Valo

brcmfmac: fix P2P_DEVICE ethernet address generation

The firmware has a requirement that the P2P_DEVICE address should
be different from the address of the primary interface. When not
specified by user-space, the driver generates the MAC address for
the P2P_DEVICE interface using the MAC address of the primary
interface and setting the locally administered bit. However, the MAC
address of the primary interface may already have that bit set causing
the creation of the P2P_DEVICE interface to fail with -EBUSY. Fix this
by using a random address instead to determine the P2P_DEVICE address.

Cc: stable@vger.kernel.org # 3.10.y
Reported-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarHante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: default avatarFranky Lin <franky.lin@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 93389734
...@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) ...@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
* @dev_addr: optional device address. * @dev_addr: optional device address.
* *
* P2P needs mac addresses for P2P device and interface. If no device * P2P needs mac addresses for P2P device and interface. If no device
* address it specified, these are derived from the primary net device, ie. * address it specified, these are derived from a random ethernet
* the permanent ethernet address of the device. * address.
*/ */
static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
{ {
struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; bool random_addr = false;
bool local_admin = false;
if (!dev_addr || is_zero_ether_addr(dev_addr)) { if (!dev_addr || is_zero_ether_addr(dev_addr))
dev_addr = pri_ifp->mac_addr; random_addr = true;
local_admin = true;
}
/* Generate the P2P Device Address. This consists of the device's /* Generate the P2P Device Address obtaining a random ethernet
* primary MAC address with the locally administered bit set. * address with the locally administered bit set.
*/ */
memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); if (random_addr)
if (local_admin) eth_random_addr(p2p->dev_addr);
p2p->dev_addr[0] |= 0x02; else
memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
/* Generate the P2P Interface Address. If the discovery and connection /* Generate the P2P Interface Address. If the discovery and connection
* BSSCFGs need to simultaneously co-exist, then this address must be * BSSCFGs need to simultaneously co-exist, then this address must be
......
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