Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d4fd8d7 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville
Browse files

brcmfmac: extend struct brcmf_if with bssidx field



When the firmware notifies the driver about adding a new interface
it also provides an index for the bss associated with this interface.
This index will be needed for upcoming features like peer-to-peer.
By adding this index in struct brcmf_if it is easy to obtain as this
will be associated with the net_device private data.

Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1e271c95
Loading
Loading
Loading
Loading
+26 −17
Original line number Diff line number Diff line
@@ -677,20 +677,9 @@ struct brcmf_pub {
#endif
};

/* struct brcmf_if - Interface control information
 *
 * @drvr: back pointer to brcmf_pub
 * @ndev: interface net device pointer
 * @stats: net device statistics
 * @idx: iface idx in dongle
 * @mac_addr: assigned MAC address
 */
struct brcmf_if {
	struct brcmf_pub *drvr;
	struct net_device *ndev;
	struct net_device_stats stats;
	int idx;
	u8 mac_addr[ETH_ALEN];
struct bcmevent_name {
	uint event;
	const char *name;
};

struct brcmf_if_event {
@@ -700,11 +689,31 @@ struct brcmf_if_event {
	u8 bssidx;
};

struct bcmevent_name {
	uint event;
	const char *name;
/**
 * struct brcmf_if - interface control information.
 *
 * @drvr: points to device related information.
 * @ndev: associated network device.
 * @stats: interface specific network statistics.
 * @idx: interface index in device firmware.
 * @bssidx: index of bss associated with this interface.
 * @mac_addr: assigned mac address.
 */
struct brcmf_if {
	struct brcmf_pub *drvr;
	struct net_device *ndev;
	struct net_device_stats stats;
	int idx;
	s32 bssidx;
	u8 mac_addr[ETH_ALEN];
};

static inline s32 brcmf_ndev_bssidx(struct net_device *ndev)
{
	struct brcmf_if *ifp = netdev_priv(ndev);
	return ifp->bssidx;
}

extern const struct bcmevent_name bcmevent_names[];

extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen,
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp,

extern int brcmf_bus_start(struct device *dev);

extern int brcmf_add_if(struct device *dev, int ifidx,
extern int brcmf_add_if(struct device *dev, int ifidx, s32 bssidx,
			char *name, u8 *mac_addr);

#ifdef CONFIG_BRCMFMAC_SDIO
+2 −1
Original line number Diff line number Diff line
@@ -480,7 +480,8 @@ brcmf_c_host_event(struct brcmf_pub *drvr, int *ifidx, void *pktdata,

		if (ifevent->ifidx > 0 && ifevent->ifidx < BRCMF_MAX_IFS) {
			if (ifevent->action == BRCMF_E_IF_ADD)
				brcmf_add_if(drvr->dev, ifevent->ifidx,
				brcmf_add_if(drvr->dev,
					     ifevent->ifidx, ifevent->bssidx,
					     event->ifname,
					     pvt_data->eth.h_dest);
			else
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/debugfs.h>
#include <linux/if_ether.h>
#include <linux/if.h>
#include <linux/netdevice.h>
#include <linux/ieee80211.h>
#include <linux/module.h>
#include <linux/netdevice.h>
+5 −2
Original line number Diff line number Diff line
@@ -837,7 +837,8 @@ static int brcmf_net_attach(struct brcmf_if *ifp)
}

int
brcmf_add_if(struct device *dev, int ifidx, char *name, u8 *mac_addr)
brcmf_add_if(struct device *dev, int ifidx, s32 bssidx,
	     char *name, u8 *mac_addr)
{
	struct brcmf_if *ifp;
	struct net_device *ndev;
@@ -872,6 +873,7 @@ brcmf_add_if(struct device *dev, int ifidx, char *name, u8 *mac_addr)
	ifp->drvr = drvr;
	drvr->iflist[ifidx] = ifp;
	ifp->idx = ifidx;
	ifp->bssidx = bssidx;
	if (mac_addr != NULL)
		memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN);

@@ -1002,6 +1004,7 @@ int brcmf_bus_start(struct device *dev)
	setbit(drvr->eventmask, BRCMF_E_TXFAIL);
	setbit(drvr->eventmask, BRCMF_E_JOIN_START);
	setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE);
	setbit(drvr->eventmask, BRCMF_E_IF);

/* enable dongle roaming event */

@@ -1015,7 +1018,7 @@ int brcmf_bus_start(struct device *dev)
		return ret;

	/* add primary networking interface */
	ret = brcmf_add_if(dev, 0, "wlan%d", drvr->mac);
	ret = brcmf_add_if(dev, 0, 0, "wlan%d", drvr->mac);
	if (ret < 0)
		return ret;

Loading