brcm2708: add linux 4.19 support
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0151-brcmfmac-Disable-ARP-offloading-when-promiscuous.patch
1 From 80cebfc3a14a2645e99baa0a72587e25961e178f Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 24 Aug 2017 16:16:16 +0100
4 Subject: [PATCH 151/703] brcmfmac: Disable ARP offloading when promiscuous
5
6 This is a test patch for brcmfmac from Franky Lin at Broadcom to disable
7 ARP offloading when in promiscuous mode, re-enabling the ability to
8 sniff ARP packets over WiFi.
9
10 See: https://github.com/raspberrypi/linux/issues/2171
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
13 ---
14  .../net/wireless/broadcom/brcm80211/brcmfmac/core.c   | 11 ++++++-----
15  .../net/wireless/broadcom/brcm80211/brcmfmac/core.h   |  1 +
16  2 files changed, 7 insertions(+), 5 deletions(-)
17
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
20 @@ -88,25 +88,25 @@ void brcmf_configure_arp_nd_offload(stru
21         if (err) {
22                 brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n",
23                           mode, err);
24 +               err = 0;
25         } else {
26                 err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable);
27                 if (err) {
28                         brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n",
29                                   enable, err);
30 -               } else {
31 +                       err = 0;
32 +               } else
33                         brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n",
34                                   enable, mode);
35 -               }
36         }
37  
38         err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable);
39 -       if (err) {
40 +       if (err)
41                 brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n",
42                           enable, err);
43 -       } else {
44 +       else
45                 brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n",
46                           enable, mode);
47 -       }
48  }
49  
50  static void _brcmf_set_multicast_list(struct work_struct *work)
51 @@ -172,6 +172,7 @@ static void _brcmf_set_multicast_list(st
52         if (err < 0)
53                 brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n",
54                           err);
55 +
56         brcmf_configure_arp_nd_offload(ifp, !cmd_value);
57  }
58  
59 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
60 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
61 @@ -210,6 +210,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
62  struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
63  void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable);
64  int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
65 +void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable);
66  struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
67                               bool is_p2pdev, const char *name, u8 *mac_addr);
68  void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);