Skip to content

Commit 8851cce

Browse files
Hante Meulemanlinvjw
authored andcommitted
brcmfmac: Add protocol addressing mode and peer deletion API.
The soon to be added protocol msgbuf requires information about interface addressing mode and peer deletion. This patch adds the necessary APIs to proto, implements dummy functions in BCDC and adds calls to proto wherever necessary by wl_cfg80211. Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 9374a2b commit 8851cce

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed

drivers/net/wireless/brcm80211/brcmfmac/bcdc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,17 @@ brcmf_proto_bcdc_txdata(struct brcmf_pub *drvr, int ifidx, u8 offset,
337337
return brcmf_bus_txdata(drvr->bus_if, pktbuf);
338338
}
339339

340+
static void
341+
brcmf_proto_bcdc_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
342+
enum proto_addr_mode addr_mode)
343+
{
344+
}
345+
346+
static void
347+
brcmf_proto_bcdc_delete_peer(struct brcmf_pub *drvr, int ifidx,
348+
u8 peer[ETH_ALEN])
349+
{
350+
}
340351

341352
int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
342353
{
@@ -356,6 +367,8 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
356367
drvr->proto->query_dcmd = brcmf_proto_bcdc_query_dcmd;
357368
drvr->proto->set_dcmd = brcmf_proto_bcdc_set_dcmd;
358369
drvr->proto->txdata = brcmf_proto_bcdc_txdata;
370+
drvr->proto->configure_addr_mode = brcmf_proto_bcdc_configure_addr_mode;
371+
drvr->proto->delete_peer = brcmf_proto_bcdc_delete_peer;
359372
drvr->proto->pd = bcdc;
360373

361374
drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES;

drivers/net/wireless/brcm80211/brcmfmac/proto.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
3030
{
3131
struct brcmf_proto *proto;
3232

33+
brcmf_dbg(TRACE, "Enter\n");
34+
3335
proto = kzalloc(sizeof(*proto), GFP_ATOMIC);
3436
if (!proto)
3537
goto fail;
@@ -40,7 +42,9 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
4042
goto fail;
4143

4244
if ((proto->txdata == NULL) || (proto->hdrpull == NULL) ||
43-
(proto->query_dcmd == NULL) || (proto->set_dcmd == NULL)) {
45+
(proto->query_dcmd == NULL) || (proto->set_dcmd == NULL) ||
46+
(proto->configure_addr_mode == NULL) ||
47+
(proto->delete_peer == NULL)) {
4448
brcmf_err("Not all proto handlers have been installed\n");
4549
goto fail;
4650
}
@@ -54,6 +58,8 @@ int brcmf_proto_attach(struct brcmf_pub *drvr)
5458

5559
void brcmf_proto_detach(struct brcmf_pub *drvr)
5660
{
61+
brcmf_dbg(TRACE, "Enter\n");
62+
5763
if (drvr->proto) {
5864
brcmf_proto_bcdc_detach(drvr);
5965
kfree(drvr->proto);

drivers/net/wireless/brcm80211/brcmfmac/proto.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
#ifndef BRCMFMAC_PROTO_H
1717
#define BRCMFMAC_PROTO_H
1818

19+
20+
enum proto_addr_mode {
21+
ADDR_INDIRECT = 0,
22+
ADDR_DIRECT
23+
};
24+
25+
1926
struct brcmf_proto {
2027
int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
2128
struct sk_buff *skb);
@@ -25,6 +32,10 @@ struct brcmf_proto {
2532
uint len);
2633
int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset,
2734
struct sk_buff *skb);
35+
void (*configure_addr_mode)(struct brcmf_pub *drvr, int ifidx,
36+
enum proto_addr_mode addr_mode);
37+
void (*delete_peer)(struct brcmf_pub *drvr, int ifidx,
38+
u8 peer[ETH_ALEN]);
2839
void *pd;
2940
};
3041

@@ -48,10 +59,21 @@ static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx,
4859
return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len);
4960
}
5061
static inline int brcmf_proto_txdata(struct brcmf_pub *drvr, int ifidx,
51-
u8 offset, struct sk_buff *skb)
62+
u8 offset, struct sk_buff *skb)
5263
{
5364
return drvr->proto->txdata(drvr, ifidx, offset, skb);
5465
}
66+
static inline void
67+
brcmf_proto_configure_addr_mode(struct brcmf_pub *drvr, int ifidx,
68+
enum proto_addr_mode addr_mode)
69+
{
70+
drvr->proto->configure_addr_mode(drvr, ifidx, addr_mode);
71+
}
72+
static inline void
73+
brcmf_proto_delete_peer(struct brcmf_pub *drvr, int ifidx, u8 peer[ETH_ALEN])
74+
{
75+
drvr->proto->delete_peer(drvr, ifidx, peer);
76+
}
5577

5678

5779
#endif /* BRCMFMAC_PROTO_H */

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "wl_cfg80211.h"
3636
#include "feature.h"
3737
#include "fwil.h"
38+
#include "proto.h"
3839
#include "vendor.h"
3940

4041
#define BRCMF_SCAN_IE_LEN_MAX 2048
@@ -493,6 +494,22 @@ brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable)
493494
return err;
494495
}
495496

497+
static void
498+
brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev)
499+
{
500+
struct net_device *ndev = wdev->netdev;
501+
struct brcmf_if *ifp = netdev_priv(ndev);
502+
503+
if ((wdev->iftype == NL80211_IFTYPE_ADHOC) ||
504+
(wdev->iftype == NL80211_IFTYPE_AP) ||
505+
(wdev->iftype == NL80211_IFTYPE_P2P_GO))
506+
brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx,
507+
ADDR_DIRECT);
508+
else
509+
brcmf_proto_configure_addr_mode(ifp->drvr, ifp->ifidx,
510+
ADDR_INDIRECT);
511+
}
512+
496513
static bool brcmf_is_apmode(struct brcmf_cfg80211_vif *vif)
497514
{
498515
enum nl80211_iftype iftype;
@@ -512,6 +529,8 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
512529
u32 *flags,
513530
struct vif_params *params)
514531
{
532+
struct wireless_dev *wdev;
533+
515534
brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
516535
switch (type) {
517536
case NL80211_IFTYPE_ADHOC:
@@ -525,7 +544,10 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
525544
case NL80211_IFTYPE_P2P_CLIENT:
526545
case NL80211_IFTYPE_P2P_GO:
527546
case NL80211_IFTYPE_P2P_DEVICE:
528-
return brcmf_p2p_add_vif(wiphy, name, type, flags, params);
547+
wdev = brcmf_p2p_add_vif(wiphy, name, type, flags, params);
548+
if (!IS_ERR(wdev))
549+
brcmf_cfg80211_update_proto_addr_mode(wdev);
550+
return wdev;
529551
case NL80211_IFTYPE_UNSPECIFIED:
530552
default:
531553
return ERR_PTR(-EINVAL);
@@ -720,6 +742,8 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
720742
}
721743
ndev->ieee80211_ptr->iftype = type;
722744

745+
brcmf_cfg80211_update_proto_addr_mode(&vif->wdev);
746+
723747
done:
724748
brcmf_dbg(TRACE, "Exit\n");
725749

@@ -4525,6 +4549,13 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
45254549
struct ieee80211_channel *chan;
45264550
s32 err = 0;
45274551

4552+
if ((e->event_code == BRCMF_E_DEAUTH) ||
4553+
(e->event_code == BRCMF_E_DEAUTH_IND) ||
4554+
(e->event_code == BRCMF_E_DISASSOC_IND) ||
4555+
((e->event_code == BRCMF_E_LINK) && (!e->flags))) {
4556+
brcmf_proto_delete_peer(ifp->drvr, ifp->ifidx, (u8 *)e->addr);
4557+
}
4558+
45284559
if (brcmf_is_apmode(ifp->vif)) {
45294560
err = brcmf_notify_connect_status_ap(cfg, ndev, e, data);
45304561
} else if (brcmf_is_linkup(e)) {

0 commit comments

Comments
 (0)