Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] cxgb4: add per rx-queue counter for packet errors
From: Ganesh Goudar @ 2018-09-14  9:16 UTC (permalink / raw)
  To: netdev, davem; +Cc: nirranjan, indranil, dt, Ganesh Goudar, Casey Leedom

print per rx-queue packet errors in sge_qinfo

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h         | 1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 1 +
 drivers/net/ethernet/chelsio/cxgb4/sge.c           | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 298701ed..b5010bd 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -692,6 +692,7 @@ struct sge_eth_stats {              /* Ethernet queue statistics */
 	unsigned long rx_cso;       /* # of Rx checksum offloads */
 	unsigned long vlan_ex;      /* # of Rx VLAN extractions */
 	unsigned long rx_drops;     /* # of packets dropped due to no mem */
+	unsigned long bad_rx_pkts;  /* # of packets with err_vec!=0 */
 };
 
 struct sge_eth_rxq {                /* SW Ethernet Rx queue */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 0f72f9c..cab492e 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2784,6 +2784,7 @@ do { \
 		RL("LROmerged:", stats.lro_merged);
 		RL("LROpackets:", stats.lro_pkts);
 		RL("RxDrops:", stats.rx_drops);
+		RL("RxBadPkts:", stats.bad_rx_pkts);
 		TL("TSO:", tso);
 		TL("TxCSO:", tx_cso);
 		TL("VLANins:", vlan_ins);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 6807bc3..b901884 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2830,6 +2830,10 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
 
 	csum_ok = pkt->csum_calc && !err_vec &&
 		  (q->netdev->features & NETIF_F_RXCSUM);
+
+	if (err_vec)
+		rxq->stats.bad_rx_pkts++;
+
 	if (((pkt->l2info & htonl(RXF_TCP_F)) ||
 	     tnl_hdr_len) &&
 	    (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) {
-- 
2.1.0

^ permalink raw reply related

* Re: [RFC PATCH net-next v1 00/14] rename and shrink i40evf
From: Or Gerlitz @ 2018-09-14  9:10 UTC (permalink / raw)
  To: Jesse Brandeburg
  Cc: Linux Netdev List, intel-wired-lan, Jeff Kirsher, Saeed Mahameed
In-Reply-To: <20180913223144.75823-1-jesse.brandeburg@intel.com>

On Fri, Sep 14, 2018 at 1:31 AM, Jesse Brandeburg
<jesse.brandeburg@intel.com> wrote:

Hi Jesse,

> This series contains changes to i40evf so that it becomes a more
> generic virtual function driver for current and future silicon.
>
> While doing the rename of i40evf to a more generic name of iavf,
> we also put the driver on a severe diet due to how much of the
> code was unneeded or was unused.  The outcome is a lean and mean
> virtual function driver that continues to work on existing 40GbE
> (i40e) virtual devices and prepped for future supported devices,
> like the 100GbE (ice) virtual devices.

on what HW ring format do you standardize? do i40e/Fortville and
ice/what's-the-intel-code-name?  HWs can/use the same posting/completion
descriptor?

> This solves 2 issues we saw coming or were already present, the
> first was constant code duplication happening with i40e/i40evf,
> when much of the duplicate code in the i40evf was not used or was
> not needed.

could you spare few words on the origin/nature of these duplicates? were them
just developer C&P mistakes for functionality which is irrelevant for
a VF? like what?
if not, what was there?

> The second was to remove the future confusion of why
> future VF devices that were not considered "40GbE" only devices
> were supported by i40evf.

can elaborate further?

> The thought is that iavf will be the virtual function driver for
> all future devices, so it should have a "generic" name to propery
> represent that it is the VF driver for multiple generations of
> devices.

for that end,  as I think was explained @ the netdev Tokyo AVF session,
you would need a mechanism for feature negotiation, is it here or coming up?


>  41 files changed, 3436 insertions(+), 7581 deletions(-)

code diet is cool!

^ permalink raw reply

* Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg
From: David Sterba @ 2018-09-14 14:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-remoteproc-u79uwXL29TY76Z2rM5mHXA,
	linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA,
	sparclinux-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	qat-linux-ral2JQCrhuEAvxtiuMwx3w,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-media-u79uwXL29TY76Z2rM5mHXA,
	linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	ceph-devel-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-crypto-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, David S. Miller,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn
In-Reply-To: <20180912151134.436719-1-arnd-r2nGTMty4D4@public.gmane.org>

On Wed, Sep 12, 2018 at 05:08:52PM +0200, Arnd Bergmann wrote:
> The .ioctl and .compat_ioctl file operations have the same prototype so
> they can both point to the same function, which works great almost all
> the time when all the commands are compatible.
> 
> One exception is the s390 architecture, where a compat pointer is only
> 31 bit wide, and converting it into a 64-bit pointer requires calling
> compat_ptr(). Most drivers here will ever run in s390, but since we now
> have a generic helper for it, it's easy enough to use it consistently.
> 
> I double-checked all these drivers to ensure that all ioctl arguments
> are used as pointers or are ignored, but are not interpreted as integer
> values.
> 
> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> ---

>  fs/btrfs/super.c                            | 2 +-

Acked-by: David Sterba <dsterba-IBi9RG/b67k@public.gmane.org>

^ permalink raw reply

* [PATCH net-next] cxgb4: Fix endianness issue in t4_fwcache()
From: Ganesh Goudar @ 2018-09-14  9:06 UTC (permalink / raw)
  To: netdev, davem; +Cc: viro, nirranjan, indranil, dt, Ganesh Goudar

Do not put host-endian 0 or 1 into big endian feild.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index c28a1d8..f85eab5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -3889,7 +3889,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op)
 	c.param[0].mnem =
 		cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
 			    FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE));
-	c.param[0].val = (__force __be32)op;
+	c.param[0].val = cpu_to_be32(op);
 
 	return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL);
 }
-- 
2.1.0

^ permalink raw reply related

* Re: [PATCH net-next 5/8] bnxt_en: Use hw_tc_offload and ignore_ari devlink parameters
From: kbuild test robot @ 2018-09-14  8:58 UTC (permalink / raw)
  To: Vasundhara Volam; +Cc: kbuild-all, davem, michael.chan, netdev
In-Reply-To: <1536655505-14387-6-git-send-email-vasundhara-v.volam@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 7214 bytes --]

Hi Vasundhara,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Vasundhara-Volam/bnxt_en-devlink-param-updates/20180914-141937
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_hwrm_nvm_req.constprop':
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:38:27: warning: 'nvm_param.num_bits' may be used uninitialized in this function [-Wmaybe-uninitialized]
     struct bnxt_dl_nvm_param nvm_param;
                              ^~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:53:5: warning: 'nvm_param.dir_type' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
        ^
   In file included from include/linux/byteorder/big_endian.h:5:0,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:247,
                    from include/linux/bitops.h:19,
                    from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/pci.h:26,
                    from drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:10:
>> include/uapi/linux/byteorder/big_endian.h:35:27: warning: 'nvm_param.offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
    #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
                              ^
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:38:27: note: 'nvm_param.offset' was declared here
     struct bnxt_dl_nvm_param nvm_param;
                              ^~~~~~~~~
--
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_hwrm_nvm_req.constprop':
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:38:27: warning: 'nvm_param.num_bits' may be used uninitialized in this function [-Wmaybe-uninitialized]
     struct bnxt_dl_nvm_param nvm_param;
                              ^~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:53:5: warning: 'nvm_param.dir_type' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
        ^
   In file included from include/linux/byteorder/big_endian.h:5:0,
                    from arch/powerpc/include/uapi/asm/byteorder.h:14,
                    from include/asm-generic/bitops/le.h:6,
                    from arch/powerpc/include/asm/bitops.h:247,
                    from include/linux/bitops.h:19,
                    from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/pci.h:26,
                    from drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:10:
>> include/uapi/linux/byteorder/big_endian.h:35:27: warning: 'nvm_param.offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
    #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
                              ^
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:38:27: note: 'nvm_param.offset' was declared here
     struct bnxt_dl_nvm_param nvm_param;
                              ^~~~~~~~~

vim +35 include/uapi/linux/byteorder/big_endian.h

5921e6f8 David Howells 2012-10-13  14  
5921e6f8 David Howells 2012-10-13  15  #define __constant_htonl(x) ((__force __be32)(__u32)(x))
5921e6f8 David Howells 2012-10-13  16  #define __constant_ntohl(x) ((__force __u32)(__be32)(x))
5921e6f8 David Howells 2012-10-13  17  #define __constant_htons(x) ((__force __be16)(__u16)(x))
5921e6f8 David Howells 2012-10-13  18  #define __constant_ntohs(x) ((__force __u16)(__be16)(x))
5921e6f8 David Howells 2012-10-13  19  #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
5921e6f8 David Howells 2012-10-13  20  #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
5921e6f8 David Howells 2012-10-13  21  #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
5921e6f8 David Howells 2012-10-13  22  #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
5921e6f8 David Howells 2012-10-13  23  #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
5921e6f8 David Howells 2012-10-13  24  #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
5921e6f8 David Howells 2012-10-13  25  #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8 David Howells 2012-10-13  26  #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8 David Howells 2012-10-13  27  #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8 David Howells 2012-10-13  28  #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8 David Howells 2012-10-13  29  #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8 David Howells 2012-10-13  30  #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8 David Howells 2012-10-13  31  #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
5921e6f8 David Howells 2012-10-13  32  #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
5921e6f8 David Howells 2012-10-13  33  #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
5921e6f8 David Howells 2012-10-13  34  #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
5921e6f8 David Howells 2012-10-13 @35  #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
5921e6f8 David Howells 2012-10-13  36  #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
5921e6f8 David Howells 2012-10-13  37  #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8 David Howells 2012-10-13  38  #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8 David Howells 2012-10-13  39  #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8 David Howells 2012-10-13  40  #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8 David Howells 2012-10-13  41  #define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8 David Howells 2012-10-13  42  #define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8 David Howells 2012-10-13  43  

:::::: The code at line 35 was first introduced by commit
:::::: 5921e6f8809b1616932ca4afd40fe449faa8fd88 UAPI: (Scripted) Disintegrate include/linux/byteorder

:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: David Howells <dhowells@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58692 bytes --]

^ permalink raw reply

* Re: mlx5 driver loading failing on v4.19 / net-next / bpf-next
From: Jesper Dangaard Brouer @ 2018-09-14  8:52 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Alexei Starovoitov, Moshe Shemesh, Eli Cohen, Or Gerlitz,
	Tariq Toukan, Saeed Mahameed, netdev@vger.kernel.org,
	Eran Ben Elisha, brouer
In-Reply-To: <CALzJLG-t3ytoE1d8PeA9aUDiENAAmQJpX3LgT1YOhKLMnL=s7g@mail.gmail.com>

On Fri, 14 Sep 2018 01:22:15 -0700
Saeed Mahameed <saeedm@dev.mellanox.co.il> wrote:

> On Thu, Sep 13, 2018 at 11:36 PM, Jesper Dangaard Brouer
> <brouer@redhat.com> wrote:
> > On Thu, 13 Sep 2018 15:55:29 -0700
> > Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> >  
> >> On Thu, Aug 30, 2018 at 1:35 AM, Tariq Toukan <tariqt@mellanox.com> wrote:  
> >> >
> >> >
> >> > On 29/08/2018 6:05 PM, Jesper Dangaard Brouer wrote:  
> >> >>
> >> >> Hi Saeed,
> >> >>
> >> >> I'm having issues loading mlx5 driver on v4.19 kernels (tested both
> >> >> net-next and bpf-next), while kernel v4.18 seems to work.  It happens
> >> >> with a Mellanox ConnectX-5 NIC (and also a CX4-Lx but I removed that
> >> >> from the system now).
> >> >>  
> >> >
> >> > Hi Jesper,
> >> >
> >> > Thanks for your report!
> >> >
> >> > We are working to analyze and debug the issue.  
> >>
> >> looks like serious issue to me... while no news in 2 weeks.
> >> any update?  
> >
> > Mellanox took it offlist, and Sep 6th found that this is a regression
> > introduced by commit 269d26f47f6f ("net/mlx5: Reduce command polling
> > interval"), but only if CONFIG_PREEMPT is on.
> >
> > I can confirm that reverting this commit fixed the issue (and not the
> > firmware upgrade I also did).
> >
> > I think Moshe (Cc) is responsible for this case, and I expect to soon
> > see a revert or alternative solution to this!?
> >
> > Thanks for the kick Alexei :-)  
> 
> Thanks you Alexei and Jesper for following up,
> the fix is already being tested [1] and will be submitted tomorrow,
> as Jesper pointed out the issue happens only with 269d26f47f6f
> ("net/mlx5: Reduce command polling
> interval"), and only if CONFIG_PREEMPT is on.
> the only affected kernel is 4.19 which is not GA yet.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?h=net-mlx5

Sound good.

I will appreciate if you add a:

Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply

* [PATCH 1/1] net: rds: use memset to optimize the recv
From: Zhu Yanjun @ 2018-09-14  8:45 UTC (permalink / raw)
  To: santosh.shilimkar, davem, netdev, linux-rdma, rds-devel

The function rds_inc_init is in recv process. To use memset can optimize
the function rds_inc_init.
The test result:

    Before:
    1) + 24.950 us   |        rds_inc_init [rds]();
    After:
    1) + 10.990 us   |        rds_inc_init [rds]();

Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 net/rds/recv.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/rds/recv.c b/net/rds/recv.c
index 504cd6bcc54c..a9399ddbb7bf 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -43,8 +43,6 @@
 void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
 		 struct in6_addr *saddr)
 {
-	int i;
-
 	refcount_set(&inc->i_refcount, 1);
 	INIT_LIST_HEAD(&inc->i_item);
 	inc->i_conn = conn;
@@ -53,8 +51,7 @@ void rds_inc_init(struct rds_incoming *inc, struct rds_connection *conn,
 	inc->i_rx_tstamp.tv_sec = 0;
 	inc->i_rx_tstamp.tv_usec = 0;
 
-	for (i = 0; i < RDS_RX_MAX_TRACES; i++)
-		inc->i_rx_lat_trace[i] = 0;
+	memset(inc->i_rx_lat_trace, 0, sizeof(inc->i_rx_lat_trace));
 }
 EXPORT_SYMBOL_GPL(rds_inc_init);
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH net-next 2/5] net: phy: mscc: Add EEE init sequence
From: Quentin Schulz @ 2018-09-14  8:33 UTC (permalink / raw)
  To: davem, andrew, f.fainelli
  Cc: allan.nielsen, linux-kernel, netdev, thomas.petazzoni,
	Quentin Schulz, Raju Lakkaraju
In-Reply-To: <cover.616d15610d44a0e3d463acd8119859f243163ad2.1536913944.git-series.quentin.schulz@bootlin.com>

From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>

Microsemi PHYs (VSC 8530/31/40/41) need to update the Energy Efficient
Ethernet initialization sequence.
In order to avoid certain link state errors that could result in link
drops and packet loss, the physical coding sublayer (PCS) must be
updated with settings related to EEE in order to improve performance.

Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 drivers/net/phy/mscc.c | 54 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 54 insertions(+)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 62d6e0a..c0a9ea9 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -67,6 +67,7 @@ enum rgmii_rx_clock_delay {
 #define MSCC_PHY_PAGE_STANDARD		  0x0000 /* Standard registers */
 #define MSCC_PHY_PAGE_EXTENDED		  0x0001 /* Extended registers */
 #define MSCC_PHY_PAGE_EXTENDED_2	  0x0002 /* Extended reg - page 2 */
+#define MSCC_PHY_PAGE_TR		  0x52b5 /* Token ring registers */
 
 /* Extended Page 1 Registers */
 #define MSCC_PHY_CU_MEDIA_CRC_VALID_CNT	  18
@@ -100,6 +101,13 @@ enum rgmii_rx_clock_delay {
 #define SECURE_ON_ENABLE		  0x8000
 #define SECURE_ON_PASSWD_LEN_4		  0x4000
 
+/* Token ring page Registers */
+#define MSCC_PHY_TR_CNTL		  16
+#define TR_WRITE			  0x8000
+#define TR_ADDR(x)			  (0x7fff & (x))
+#define MSCC_PHY_TR_LSB			  17
+#define MSCC_PHY_TR_MSB			  18
+
 /* Microsemi PHY ID's */
 #define PHY_ID_VSC8530			  0x00070560
 #define PHY_ID_VSC8531			  0x00070570
@@ -685,6 +693,48 @@ static int vsc85xx_set_tunable(struct phy_device *phydev,
 	}
 }
 
+static void vsc85xx_tr_write(struct phy_device *phydev, u16 addr, u32 val)
+{
+	phy_write(phydev, MSCC_PHY_TR_MSB, val >> 16);
+	phy_write(phydev, MSCC_PHY_TR_LSB, val & GENMASK(15, 0));
+	phy_write(phydev, MSCC_PHY_TR_CNTL, TR_WRITE | TR_ADDR(addr));
+}
+
+static int vsc85xx_eee_init_seq_set(struct phy_device *phydev)
+{
+	int rc;
+
+	mutex_lock(&phydev->lock);
+	rc = vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_TR);
+	if (rc)
+		goto out_unlock;
+
+	vsc85xx_tr_write(phydev, 0x0f82, 0x0012b00a);
+	vsc85xx_tr_write(phydev, 0x1686, 0x00000004);
+	vsc85xx_tr_write(phydev, 0x168c, 0x00d2c46f);
+	vsc85xx_tr_write(phydev, 0x17a2, 0x00000620);
+	vsc85xx_tr_write(phydev, 0x16a0, 0x00eeffdd);
+	vsc85xx_tr_write(phydev, 0x16a6, 0x00071448);
+	vsc85xx_tr_write(phydev, 0x16a4, 0x0013132f);
+	vsc85xx_tr_write(phydev, 0x16a8, 0x00000000);
+	vsc85xx_tr_write(phydev, 0x0ffc, 0x00c0a028);
+	vsc85xx_tr_write(phydev, 0x0fe8, 0x0091b06c);
+	vsc85xx_tr_write(phydev, 0x0fea, 0x00041600);
+	vsc85xx_tr_write(phydev, 0x0f80, 0x00000af4);
+	vsc85xx_tr_write(phydev, 0x0fec, 0x00901809);
+	vsc85xx_tr_write(phydev, 0x0fee, 0x0000a6a1);
+	vsc85xx_tr_write(phydev, 0x0ffe, 0x00b01007);
+	vsc85xx_tr_write(phydev, 0x16b0, 0x00eeff00);
+	vsc85xx_tr_write(phydev, 0x16b2, 0x00007000);
+	vsc85xx_tr_write(phydev, 0x16b4, 0x00000814);
+
+out_unlock:
+	rc = vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_STANDARD);
+	mutex_unlock(&phydev->lock);
+
+	return rc;
+}
+
 static int vsc85xx_config_init(struct phy_device *phydev)
 {
 	int rc, i;
@@ -702,6 +752,10 @@ static int vsc85xx_config_init(struct phy_device *phydev)
 	if (rc)
 		return rc;
 
+	rc = vsc85xx_eee_init_seq_set(phydev);
+	if (rc)
+		return rc;
+
 	for (i = 0; i < vsc8531->nleds; i++) {
 		rc = vsc85xx_led_cntl_set(phydev, i, vsc8531->leds_mode[i]);
 		if (rc)
-- 
git-series 0.9.1

^ permalink raw reply related

* Re: mlx5 driver loading failing on v4.19 / net-next / bpf-next
From: Saeed Mahameed @ 2018-09-14  8:22 UTC (permalink / raw)
  To: Jesper Dangaard Brouer
  Cc: Alexei Starovoitov, Moshe Shemesh, Eli Cohen, Or Gerlitz,
	Tariq Toukan, Saeed Mahameed, netdev@vger.kernel.org,
	Eran Ben Elisha
In-Reply-To: <20180914083618.08fe816e@redhat.com>

On Thu, Sep 13, 2018 at 11:36 PM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> On Thu, 13 Sep 2018 15:55:29 -0700
> Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
>
>> On Thu, Aug 30, 2018 at 1:35 AM, Tariq Toukan <tariqt@mellanox.com> wrote:
>> >
>> >
>> > On 29/08/2018 6:05 PM, Jesper Dangaard Brouer wrote:
>> >>
>> >> Hi Saeed,
>> >>
>> >> I'm having issues loading mlx5 driver on v4.19 kernels (tested both
>> >> net-next and bpf-next), while kernel v4.18 seems to work.  It happens
>> >> with a Mellanox ConnectX-5 NIC (and also a CX4-Lx but I removed that
>> >> from the system now).
>> >>
>> >
>> > Hi Jesper,
>> >
>> > Thanks for your report!
>> >
>> > We are working to analyze and debug the issue.
>>
>> looks like serious issue to me... while no news in 2 weeks.
>> any update?
>
> Mellanox took it offlist, and Sep 6th found that this is a regression
> introduced by commit 269d26f47f6f ("net/mlx5: Reduce command polling
> interval"), but only if CONFIG_PREEMPT is on.
>
> I can confirm that reverting this commit fixed the issue (and not the
> firmware upgrade I also did).
>
> I think Moshe (Cc) is responsible for this case, and I expect to soon
> see a revert or alternative solution to this!?
>
> Thanks for the kick Alexei :-)

Thanks you Alexei and Jesper for following up,
the fix is already being tested [1] and will be submitted tomorrow,
as Jesper pointed out the issue happens only with 269d26f47f6f
("net/mlx5: Reduce command polling
interval"), and only if CONFIG_PREEMPT is on.
the only affected kernel is 4.19 which is not GA yet.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?h=net-mlx5

> --
> Best regards,
>   Jesper Dangaard Brouer
>   MSc.CS, Principal Kernel Engineer at Red Hat
>   LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply

* Re: [PATCH net-next 1/5] net: phy: mscc: add ethtool statistics counters
From: Andrew Lunn @ 2018-09-14 13:29 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni, Raju Lakkaraju
In-Reply-To: <20180914131645.64k4w4h7ir3u5yuk@qschulz>

> When you change a page, you basically can access only the registers in
> this page so if there are two functions requesting different pages at
> the same time or registers of different pages, it won't work well
> indeed.
> 
> > phy_read_page() and phy_write_page() will do the needed locking if
> > this is an issue.
> > 
> 
> That's awesome! Didn't know it existed. Thanks a ton!
> 
> Well, that means I should migrate the whole driver to use
> phy_read/write_paged instead of the phy_read/write that is currently in
> use.
> 
> That's impacting performance though as per phy_read/write_paged we read
> the current page, set the desired page, read/write the register, set the
> old page back. That's 4 times more operations.

You can use the lower level locking primatives. See m88e1318_set_wol()
for example.

> Couldn't we use the
> phy_device mutex instead (as it's currently done in the whole driver)?
> Or is it worse/comparable in performance to the suggested solution?

Russell King found a race condition where this breaks. You cannot hold
the phy_device mutex everywhere.

    Andrew

^ permalink raw reply

* Re: [PATCH net-next 2/7] net: phy: mscc: add support for VSC8584 PHY
From: Quentin Schulz @ 2018-09-14 13:29 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, f.fainelli, allan.nielsen, linux-mips,
	devicetree, linux-kernel, netdev, thomas.petazzoni,
	antoine.tenart
In-Reply-To: <20180914131846.GG14865@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 881 bytes --]

Hi Andrew,

On Fri, Sep 14, 2018 at 03:18:46PM +0200, Andrew Lunn wrote:
> > Most of the init sequence of a PHY of the package is common to all PHYs
> > in the package, thus we use the SMI broadcast feature which enables us
> > to propagate a write in one register of one PHY to all PHYs in the
> > package.
> 
> Hi Quinten
> 
> Could you say a bit more about the broadcast. Does the SMI broadcast
> go to all PHY everywhere on an MDIO bus, or only all PHYs within one
> package? I'm just thinking about the case you need two of these
> packages to cover 8 switch ports.
> 

Ah sorry, that wasn't very explicit. That's a feature on the PHY side so
my wildest guess is that it wouldn't impact any other PHY outside of
this package. Affecting any other PHY on the bus is counter-intuitive to
me but I'll ask the HW engineers for confirmation.

Thanks,
Quentin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH net-next] virtio_net: ethtool tx napi configuration
From: Jason Wang @ 2018-09-14  8:08 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: Florian Fainelli, Network Development, David Miller, caleb.raitto,
	Michael S. Tsirkin, Jon Olson (Google Drive), Willem de Bruijn
In-Reply-To: <CAF=yD-KEcWuYrSofugYBc3kwWvQdFDsv3z_yWx5-JDzyMga1qw@mail.gmail.com>



On 2018年09月14日 12:46, Willem de Bruijn wrote:
> On Thu, Sep 13, 2018 at 11:53 PM Jason Wang <jasowang@redhat.com> wrote:
>>
>>
>> On 2018年09月14日 11:40, Willem de Bruijn wrote:
>>> On Thu, Sep 13, 2018 at 11:27 PM Jason Wang <jasowang@redhat.com> wrote:
>>>>
>>>> On 2018年09月13日 22:58, Willem de Bruijn wrote:
>>>>> On Thu, Sep 13, 2018 at 5:02 AM Jason Wang <jasowang@redhat.com> wrote:
>>>>>> On 2018年09月13日 07:27, Willem de Bruijn wrote:
>>>>>>> On Wed, Sep 12, 2018 at 3:11 PM Willem de Bruijn
>>>>>>> <willemdebruijn.kernel@gmail.com> wrote:
>>>>>>>> On Wed, Sep 12, 2018 at 2:16 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>>>>>>> On 9/12/2018 11:07 AM, Willem de Bruijn wrote:
>>>>>>>>>> On Wed, Sep 12, 2018 at 1:42 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>>>>>>>>> On 9/9/2018 3:44 PM, Willem de Bruijn wrote:
>>>>>>>>>>>> From: Willem de Bruijn <willemb@google.com>
>>>>>>>>>>>>
>>>>>>>>>>>> Implement ethtool .set_coalesce (-C) and .get_coalesce (-c) handlers.
>>>>>>>>>>>> Interrupt moderation is currently not supported, so these accept and
>>>>>>>>>>>> display the default settings of 0 usec and 1 frame.
>>>>>>>>>>>>
>>>>>>>>>>>> Toggle tx napi through a bit in tx-frames. So as to not interfere
>>>>>>>>>>>> with possible future interrupt moderation, use bit 10, well outside
>>>>>>>>>>>> the reasonable range of real interrupt moderation values.
>>>>>>>>>>>>
>>>>>>>>>>>> Changes are not atomic. The tx IRQ, napi BH and transmit path must
>>>>>>>>>>>> be quiesced when switching modes. Only allow changing this setting
>>>>>>>>>>>> when the device is down.
>>>>>>>>>>> Humm, would not a private ethtool flag to switch TX NAPI on/off be more
>>>>>>>>>>> appropriate rather than use the coalescing configuration API here?
>>>>>>>>>> What do you mean by private ethtool flag? A new field in ethtool
>>>>>>>>>> --features (-k)?
>>>>>>>>> I meant using ethtool_drvinfo::n_priv_flags, ETH_SS_PRIV_FLAGS and then
>>>>>>>>> ETHTOOL_GFPFLAGS and ETHTOOL_SPFLAGS to control the toggling of that
>>>>>>>>> private flag. mlx5 has a number of privates flags for instance.
>>>>>>>> Interesting, thanks! I was not at all aware of those ethtool flags.
>>>>>>>> Am having a look. It definitely looks promising.
>>>>>>> Okay, I made that change. That is indeed much cleaner, thanks.
>>>>>>> Let me send the patch, initially as RFC.
>>>>>>>
>>>>>>> I've observed one issue where if we toggle the flag before bringing
>>>>>>> up the device, it hits a kernel BUG at include/linux/netdevice.h:515
>>>>>>>
>>>>>>>             BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
>>>>>> This reminds me that we need to check netif_running() before trying to
>>>>>> enable and disable tx napi in ethtool_set_coalesce().
>>>>> The first iteration of my patch checked IFF_UP and effectively
>>>>> only allowed the change when not running. What do you mean
>>>>> by need to check?
>>>> I mean if device is not up, there's no need to toggle napi state and tx
>>>> lock.
>>>>
>>>>> And to respond to the other follow-up notes at once:
>>>>>
>>>>>> Consider we may have interrupt moderation in the future, I tend to use
>>>>>> set_coalesce. Otherwise we may need two steps to enable moderation:
>>>>>>
>>>>>> - tx-napi on
>>>>>> - set_coalesce
>>>>> FWIW, I don't care strongly whether we do this through coalesce or priv_flags.
>>>> Ok.
>>> Since you prefer coalesce, let's go with that (and a revision of your
>>> latest patch).
>> Good to know this.
>>
>>>>>>> +                     if (!napi_weight)
>>>>>>> +                             virtqueue_enable_cb(vi->sq[i].vq);
>>>>>> I don't get why we need to disable enable cb here.
>>>>> To avoid entering no-napi mode with too few descriptors to
>>>>> make progress and no way to get out of that state. This is a
>>>>> pretty crude attempt at handling that, admittedly.
>>>> But in this case, we will call enable_cb_delayed() and we will finally
>>>> get a interrupt?
>>> Right. It's a bit of a roundabout way to ensure that
>>> netif_tx_wake_queue and thus eventually free_old_xmit_skbs are called.
>>> It might make more sense to just wake the device without going through
>>> an interrupt.
>> I'm not sure I get this. If we don't enable tx napi, we tend to delay TX
>> interrupt if we found the ring is about to full to avoid interrupt
>> storm, so we're probably ok in this case.
> I'm only concerned about the transition state when converting from
> napi to no-napi when the queue is stopped and tx interrupt disabled.
>
> With napi mode the interrupt is only disabled if napi is scheduled,
> in which case it will eventually reenable the interrupt. But when
> switching to no-napi mode in this state no progress will be made.
>
> But it seems this cannot happen. When converting to no-napi
> mode, set_coalesce waits for napi to complete in napi_disable.
> So the interrupt should always start enabled when transitioning
> into no-napi mode.

Yes, I see.

Thanks

^ permalink raw reply

* Re: [PATCH net-next 2/7] net: phy: mscc: add support for VSC8584 PHY
From: Andrew Lunn @ 2018-09-14 13:18 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, f.fainelli, allan.nielsen, linux-mips,
	devicetree, linux-kernel, netdev, thomas.petazzoni,
	antoine.tenart
In-Reply-To: <a61d9affd3f1ec9deb60c882cce1daf37fbe2427.1536916714.git-series.quentin.schulz@bootlin.com>

> Most of the init sequence of a PHY of the package is common to all PHYs
> in the package, thus we use the SMI broadcast feature which enables us
> to propagate a write in one register of one PHY to all PHYs in the
> package.

Hi Quinten

Could you say a bit more about the broadcast. Does the SMI broadcast
go to all PHY everywhere on an MDIO bus, or only all PHYs within one
package? I'm just thinking about the case you need two of these
packages to cover 8 switch ports.

Thanks
	Andrew

^ permalink raw reply

* Re: [PATCH net-next 1/5] net: phy: mscc: add ethtool statistics counters
From: Quentin Schulz @ 2018-09-14 13:16 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni, Raju Lakkaraju
In-Reply-To: <20180914130156.GB14865@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 3042 bytes --]

Hi Andrew,

On Fri, Sep 14, 2018 at 03:01:56PM +0200, Andrew Lunn wrote:
> Hi Quentin
> 
> > +static struct vsc85xx_hw_stat vsc85xx_hw_stats[] = {
> 
> You could add a const to that.
> 

ACK.

> > +	{
> > +		.string	= "phy_receive_errors",
> > +		.reg	= MSCC_PHY_ERR_RX_CNT,
> > +		.page	= MSCC_PHY_PAGE_STANDARD,
> > +		.mask	= ERR_CNT_MASK,
> > +	}, {
> > +		.string	= "phy_false_carrier",
> > +		.reg	= MSCC_PHY_ERR_FALSE_CARRIER_CNT,
> > +		.page	= MSCC_PHY_PAGE_STANDARD,
> > +		.mask	= ERR_CNT_MASK,
> > +	}, {
> > +		.string	= "phy_cu_media_link_disconnect",
> > +		.reg	= MSCC_PHY_ERR_LINK_DISCONNECT_CNT,
> > +		.page	= MSCC_PHY_PAGE_STANDARD,
> > +		.mask	= ERR_CNT_MASK,
> > +	}, {
> > +		.string	= "phy_cu_media_crc_good_count",
> > +		.reg	= MSCC_PHY_CU_MEDIA_CRC_VALID_CNT,
> > +		.page	= MSCC_PHY_PAGE_EXTENDED,
> > +		.mask	= VALID_CRC_CNT_CRC_MASK,
> > +	}, {
> > +		.string	= "phy_cu_media_crc_error_count",
> > +		.reg	= MSCC_PHY_EXT_PHY_CNTL_4,
> > +		.page	= MSCC_PHY_PAGE_EXTENDED,
> > +		.mask	= ERR_CNT_MASK,
> > +	},
> > +};
> 
> > +static u64 vsc85xx_get_stat(struct phy_device *phydev, int i)
> > +{
> > +	struct vsc8531_private *priv = phydev->priv;
> > +	int val;
> > +	u64 ret;
> > +
> > +	vsc85xx_phy_page_set(phydev, priv->hw_stats[i].page);
> 
> I might of asked this before...
> 
> Does changing the page effect registers in the lower range? It is
> possible for other operations to happen at the same time, and you
> don't want for example a status read to happen from some other
> extended page register because a statistics read is happening.
> 

When you change a page, you basically can access only the registers in
this page so if there are two functions requesting different pages at
the same time or registers of different pages, it won't work well
indeed.

> phy_read_page() and phy_write_page() will do the needed locking if
> this is an issue.
> 

That's awesome! Didn't know it existed. Thanks a ton!

Well, that means I should migrate the whole driver to use
phy_read/write_paged instead of the phy_read/write that is currently in
use.

That's impacting performance though as per phy_read/write_paged we read
the current page, set the desired page, read/write the register, set the
old page back. That's 4 times more operations. Couldn't we use the
phy_device mutex instead (as it's currently done in the whole driver)?
Or is it worse/comparable in performance to the suggested solution?

> > @@ -673,6 +782,13 @@ static int vsc85xx_probe(struct phy_device *phydev)
> >  	vsc8531->rate_magic = rate_magic;
> >  	vsc8531->nleds = 2;
> >  	vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES;
> > +	vsc8531->hw_stats = vsc85xx_hw_stats;
> > +	vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats);
> > +	vsc8531->stats = devm_kzalloc(&phydev->mdio.dev,
> > +				      sizeof(u64) * vsc8531->nstats,
> > +				      GFP_KERNEL);
> 
> devm_kmalloc_array()? The security people prefer that.
> 

ACK.

Thanks,
Quentin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: Regression: kernel 4.14 an later very slow with many ipsec tunnels
From: Christophe Gouault @ 2018-09-14  8:01 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: fw, David S. Miller, linux, netdev, linux-kernel, torvalds
In-Reply-To: <20180914060132.GE23674@gauss3.secunet.de>

Le ven. 14 sept. 2018 à 08:01, Steffen Klassert
<steffen.klassert@secunet.com> a écrit :
> > > The hash threshold can be configured like this:
> > >
> > > ip x p set hthresh4 0 0
> > >
> > > This sets the hash threshold to local /0 and remote /0 netmasks.
> > > With this configuration, all policies should go to the hashtable.
> >
> > Yes, but won't they all be hashed to same bucket?
> >
> > [ jhash(addr & 0, addr & 0) ] ?
>
> Hm, yes. Maybe something between /0 and /32 makes more sense.

Indeed, hash thresholds not only determine which policies will be
hashed, but also the number of bits of the local and remote address
that will be used to calculate the hash key. Big thresholds mean
potentially fewer hashed policies, but better distribution in the hash
table, and vice versa.

A good trade off must be found depending on the prefix lengths used in
your policies.

Best regards,
Christophe

^ permalink raw reply

* [PATCH][net-next] net: move definition of pcpu_lstats to header file
From: Li RongQing @ 2018-09-14  8:00 UTC (permalink / raw)
  To: netdev

pcpu_lstats is defined in several files, so unify them as one
and move to header file

Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/loopback.c    |  6 ------
 drivers/net/nlmon.c       |  6 ------
 drivers/net/vsockmon.c    | 14 ++++----------
 include/linux/netdevice.h |  6 ++++++
 4 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 30612497643c..a7207fa7e451 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -59,12 +59,6 @@
 #include <net/net_namespace.h>
 #include <linux/u64_stats_sync.h>
 
-struct pcpu_lstats {
-	u64			packets;
-	u64			bytes;
-	struct u64_stats_sync	syncp;
-};
-
 /* The higher levels take care of making this non-reentrant (it's
  * called with bh's disabled).
  */
diff --git a/drivers/net/nlmon.c b/drivers/net/nlmon.c
index 4b22955de191..dd0db7534cb3 100644
--- a/drivers/net/nlmon.c
+++ b/drivers/net/nlmon.c
@@ -6,12 +6,6 @@
 #include <linux/if_arp.h>
 #include <net/rtnetlink.h>
 
-struct pcpu_lstats {
-	u64 packets;
-	u64 bytes;
-	struct u64_stats_sync syncp;
-};
-
 static netdev_tx_t nlmon_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	int len = skb->len;
diff --git a/drivers/net/vsockmon.c b/drivers/net/vsockmon.c
index c28bdce14fd5..7bad5c95551f 100644
--- a/drivers/net/vsockmon.c
+++ b/drivers/net/vsockmon.c
@@ -11,12 +11,6 @@
 #define DEFAULT_MTU (VIRTIO_VSOCK_MAX_PKT_BUF_SIZE + \
 		     sizeof(struct af_vsockmon_hdr))
 
-struct pcpu_lstats {
-	u64 rx_packets;
-	u64 rx_bytes;
-	struct u64_stats_sync syncp;
-};
-
 static int vsockmon_dev_init(struct net_device *dev)
 {
 	dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats);
@@ -56,8 +50,8 @@ static netdev_tx_t vsockmon_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct pcpu_lstats *stats = this_cpu_ptr(dev->lstats);
 
 	u64_stats_update_begin(&stats->syncp);
-	stats->rx_bytes += len;
-	stats->rx_packets++;
+	stats->bytes += len;
+	stats->packets++;
 	u64_stats_update_end(&stats->syncp);
 
 	dev_kfree_skb(skb);
@@ -80,8 +74,8 @@ vsockmon_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 
 		do {
 			start = u64_stats_fetch_begin_irq(&vstats->syncp);
-			tbytes = vstats->rx_bytes;
-			tpackets = vstats->rx_packets;
+			tbytes = vstats->bytes;
+			tpackets = vstats->packets;
 		} while (u64_stats_fetch_retry_irq(&vstats->syncp, start));
 
 		packets += tpackets;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e2b3bd750c98..baed5d5088c5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2382,6 +2382,12 @@ struct pcpu_sw_netstats {
 	struct u64_stats_sync   syncp;
 };
 
+struct pcpu_lstats {
+	u64 packets;
+	u64 bytes;
+	struct u64_stats_sync syncp;
+};
+
 #define __netdev_alloc_pcpu_stats(type, gfp)				\
 ({									\
 	typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
-- 
2.16.2

^ permalink raw reply related

* Re: [PATCH net-next 1/7] dt-bindings: net: vsc8531: add two additional LED modes for VSC8584
From: Andrew Lunn @ 2018-09-14 13:11 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, f.fainelli, allan.nielsen, linux-mips,
	devicetree, linux-kernel, netdev, thomas.petazzoni,
	antoine.tenart
In-Reply-To: <f54f6cda7f505d99531e33626f8d4e6f1dc084ec.1536916714.git-series.quentin.schulz@bootlin.com>

On Fri, Sep 14, 2018 at 11:44:22AM +0200, Quentin Schulz wrote:
> The VSC8584 (and most likely other PHYs in the same generation) has two
> additional LED modes that can be picked, so let's add them.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: [PATCH net-next 5/5] net: phy: mscc: remove unneeded temporary variable
From: Andrew Lunn @ 2018-09-14 13:06 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni
In-Reply-To: <d9cca8eef36bb8918c9ed28574b79b7674fd36f6.1536913944.git-series.quentin.schulz@bootlin.com>

On Fri, Sep 14, 2018 at 10:33:47AM +0200, Quentin Schulz wrote:
> Here, the rc variable is either used only for the condition right after
> the assignment or right before being used as the return value of the
> function it's being used in.
> 
> So let's remove this unneeded temporary variable whenever possible.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: [PATCH net-next 4/5] net: phy: mscc: shorten `x != 0` condition to `x`
From: Andrew Lunn @ 2018-09-14 13:05 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni
In-Reply-To: <2efac3971c41837fec6001018c1275d81286512a.1536913944.git-series.quentin.schulz@bootlin.com>

On Fri, Sep 14, 2018 at 10:33:46AM +0200, Quentin Schulz wrote:
> `if (x != 0)` is basically a more verbose version of `if (x)` so let's
> use the latter so it's consistent throughout the whole driver.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: [PATCH net-next 3/5] net: phy: mscc: remove unneeded parenthesis
From: Andrew Lunn @ 2018-09-14 13:04 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni
In-Reply-To: <e3a1a9940e18c69ecf9aaecc3e2d9bf2a180a939.1536913944.git-series.quentin.schulz@bootlin.com>

On Fri, Sep 14, 2018 at 10:33:45AM +0200, Quentin Schulz wrote:
> The == operator precedes the || operator, so we can remove the
> parenthesis around (a == b) || (c == d).
> 
> The condition is rather explicit and short so removing the parenthesis
> definitely does not make it harder to read.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply

* Re: [PATCH net-next 1/5] net: phy: mscc: add ethtool statistics counters
From: Andrew Lunn @ 2018-09-14 13:01 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: davem, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni, Raju Lakkaraju
In-Reply-To: <e220fe75053e200f91554b752905d84b14b76eb6.1536913944.git-series.quentin.schulz@bootlin.com>

Hi Quentin

> +static struct vsc85xx_hw_stat vsc85xx_hw_stats[] = {

You could add a const to that.

> +	{
> +		.string	= "phy_receive_errors",
> +		.reg	= MSCC_PHY_ERR_RX_CNT,
> +		.page	= MSCC_PHY_PAGE_STANDARD,
> +		.mask	= ERR_CNT_MASK,
> +	}, {
> +		.string	= "phy_false_carrier",
> +		.reg	= MSCC_PHY_ERR_FALSE_CARRIER_CNT,
> +		.page	= MSCC_PHY_PAGE_STANDARD,
> +		.mask	= ERR_CNT_MASK,
> +	}, {
> +		.string	= "phy_cu_media_link_disconnect",
> +		.reg	= MSCC_PHY_ERR_LINK_DISCONNECT_CNT,
> +		.page	= MSCC_PHY_PAGE_STANDARD,
> +		.mask	= ERR_CNT_MASK,
> +	}, {
> +		.string	= "phy_cu_media_crc_good_count",
> +		.reg	= MSCC_PHY_CU_MEDIA_CRC_VALID_CNT,
> +		.page	= MSCC_PHY_PAGE_EXTENDED,
> +		.mask	= VALID_CRC_CNT_CRC_MASK,
> +	}, {
> +		.string	= "phy_cu_media_crc_error_count",
> +		.reg	= MSCC_PHY_EXT_PHY_CNTL_4,
> +		.page	= MSCC_PHY_PAGE_EXTENDED,
> +		.mask	= ERR_CNT_MASK,
> +	},
> +};

> +static u64 vsc85xx_get_stat(struct phy_device *phydev, int i)
> +{
> +	struct vsc8531_private *priv = phydev->priv;
> +	int val;
> +	u64 ret;
> +
> +	vsc85xx_phy_page_set(phydev, priv->hw_stats[i].page);

I might of asked this before...

Does changing the page effect registers in the lower range? It is
possible for other operations to happen at the same time, and you
don't want for example a status read to happen from some other
extended page register because a statistics read is happening.

phy_read_page() and phy_write_page() will do the needed locking if
this is an issue.

> @@ -673,6 +782,13 @@ static int vsc85xx_probe(struct phy_device *phydev)
>  	vsc8531->rate_magic = rate_magic;
>  	vsc8531->nleds = 2;
>  	vsc8531->supp_led_modes = VSC85XX_SUPP_LED_MODES;
> +	vsc8531->hw_stats = vsc85xx_hw_stats;
> +	vsc8531->nstats = ARRAY_SIZE(vsc85xx_hw_stats);
> +	vsc8531->stats = devm_kzalloc(&phydev->mdio.dev,
> +				      sizeof(u64) * vsc8531->nstats,
> +				      GFP_KERNEL);

devm_kmalloc_array()? The security people prefer that.

> +	if (!vsc8531->stats)
> +		return -ENOMEM;
>  
>  	return vsc85xx_dt_led_modes_get(phydev, default_mode);
>  }

   Andrew

^ permalink raw reply

* Re: [PATCH v2,net-next 1/2] ip_gre: fix parsing gre header in ipgre_err
From: Edward Cree @ 2018-09-14 12:44 UTC (permalink / raw)
  To: David Miller, yanhaishuang; +Cc: kuznet, jbenc, netdev, linux-kernel
In-Reply-To: <20180913.105840.140151724801067072.davem@davemloft.net>

On 13/09/18 18:58, David Miller wrote:
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Wed, 12 Sep 2018 17:21:21 +0800
>
>> @@ -86,7 +86,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
>>  
>>  	options = (__be32 *)(greh + 1);
>>  	if (greh->flags & GRE_CSUM) {
>> -		if (skb_checksum_simple_validate(skb)) {
>> +		if (csum_err && skb_checksum_simple_validate(skb)) {
>>  			*csum_err = true;
>>  			return -EINVAL;
>>  		}
> You want to ignore csum errors, but you do not want to elide the side
> effects of the skb_checksum_simple_validate() call which are to set
> skb->csum_valid and skb->csum.
>
> Therefore, the skb_checksum_simple_validate() call still needs to be
> performed. We just wont return -EINVAL in the NULL csum_err case.

How about just reversing the order of the AND?

	if (skb_checksum_simple_validate(skb) && csum_err) {
		*csum_err = true;
		return -EINVAL;
	}

^ permalink raw reply

* Re: [PATCH bpf-next 07/11] bpf: Add helper to retrieve socket in BPF
From: kbuild test robot @ 2018-09-14  7:11 UTC (permalink / raw)
  To: Joe Stringer
  Cc: kbuild-all, daniel, netdev, ast, john.fastabend, tgraf, kafai,
	nitin.hande, mauricio.vasquez
In-Reply-To: <20180912003640.28316-8-joe@wand.net.nz>

[-- Attachment #1: Type: text/plain, Size: 41175 bytes --]

Hi Joe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Joe-Stringer/Add-socket-lookup-support/20180914-134632
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-randconfig-s0-09141346 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   net/core/filter.c: In function 'sk_lookup':
>> net/core/filter.c:4870:1: error: invalid storage class for function 'bpf_sk_lookup'
    bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
    ^~~~~~~~~~~~~
>> net/core/filter.c:4869:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static unsigned long
    ^~~~~~
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net/core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____bpf_sk_lookup_tcp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
>> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
>> net/core/filter.c:4896:12: error: static declaration of 'bpf_sk_lookup_tcp' follows non-static declaration
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
>> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c:4896:12: note: previous declaration of 'bpf_sk_lookup_tcp' was here
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
>> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c: In function 'bpf_sk_lookup_tcp':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____bpf_sk_lookup_tcp' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
>> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_tcp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
>> net/core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
>> net/core/filter.c:4903:11: error: initializer element is not constant
     .func  = bpf_sk_lookup_tcp,
              ^~~~~~~~~~~~~~~~~
   net/core/filter.c:4903:11: note: (near initialization for 'bpf_sk_lookup_tcp_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net/core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____bpf_sk_lookup_udp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
>> net/core/filter.c:4913:12: error: static declaration of 'bpf_sk_lookup_udp' follows non-static declaration
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c:4913:12: note: previous declaration of 'bpf_sk_lookup_udp' was here
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c: In function 'bpf_sk_lookup_udp':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____bpf_sk_lookup_udp' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_udp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net/core/filter.c:4920:11: error: initializer element is not constant
     .func  = bpf_sk_lookup_udp,
              ^~~~~~~~~~~~~~~~~
   net/core/filter.c:4920:11: note: (near initialization for 'bpf_sk_lookup_udp_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net/core/filter.c:29:
--
   net//core/filter.c: In function 'sk_lookup':
   net//core/filter.c:4870:1: error: invalid storage class for function 'bpf_sk_lookup'
    bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
    ^~~~~~~~~~~~~
   net//core/filter.c:4869:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static unsigned long
    ^~~~~~
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____bpf_sk_lookup_tcp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4896:12: error: static declaration of 'bpf_sk_lookup_tcp' follows non-static declaration
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4896:12: note: previous declaration of 'bpf_sk_lookup_tcp' was here
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c: In function 'bpf_sk_lookup_tcp':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____bpf_sk_lookup_tcp' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_tcp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4896:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4903:11: error: initializer element is not constant
     .func  = bpf_sk_lookup_tcp,
              ^~~~~~~~~~~~~~~~~
   net//core/filter.c:4903:11: note: (near initialization for 'bpf_sk_lookup_tcp_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____bpf_sk_lookup_udp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4913:12: error: static declaration of 'bpf_sk_lookup_udp' follows non-static declaration
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4913:12: note: previous declaration of 'bpf_sk_lookup_udp' was here
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c: In function 'bpf_sk_lookup_udp':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____bpf_sk_lookup_udp' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_lookup_udp'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4913:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
    ^~~~~~~~~~
   net//core/filter.c:4920:11: error: initializer element is not constant
     .func  = bpf_sk_lookup_udp,
              ^~~~~~~~~~~~~~~~~
   net//core/filter.c:4920:11: note: (near initialization for 'bpf_sk_lookup_udp_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____bpf_sk_release'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
   include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net//core/filter.c:4930:12: error: static declaration of 'bpf_sk_release' follows non-static declaration
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net//core/filter.c:4930:12: note: previous declaration of 'bpf_sk_release' was here
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net//core/filter.c: In function 'bpf_sk_release':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____bpf_sk_release' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
   include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_release'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
   include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net//core/filter.c:4941:11: error: initializer element is not constant
     .func  = bpf_sk_release,
              ^~~~~~~~~~~~~~
   net//core/filter.c:4941:11: note: (near initialization for 'bpf_sk_release_proto.func')
   net//core/filter.c:4980:1: error: invalid storage class for function 'bpf_base_func_proto'
    bpf_base_func_proto(enum bpf_func_id func_id)
    ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5009:1: error: invalid storage class for function 'sock_filter_func_proto'
    sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5025:1: error: invalid storage class for function 'sock_addr_func_proto'
    sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5051:1: error: invalid storage class for function 'sk_filter_func_proto'
    sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5068:1: error: invalid storage class for function 'cg_skb_func_proto'
    cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net//core/filter.c:5079:1: error: invalid storage class for function 'tc_cls_act_func_proto'
    tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5166:1: error: invalid storage class for function 'xdp_func_proto'
    xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~
   net//core/filter.c:5193:1: error: invalid storage class for function 'sock_ops_func_proto'
    sock_ops_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5216:1: error: invalid storage class for function 'sk_msg_func_proto'
    sk_msg_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net//core/filter.c:5237:1: error: invalid storage class for function 'sk_skb_func_proto'
    sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net//core/filter.c:5272:1: error: invalid storage class for function 'lwt_out_func_proto'
    lwt_out_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~
   net//core/filter.c:5299:1: error: invalid storage class for function 'lwt_in_func_proto'
    lwt_in_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net//core/filter.c:5310:1: error: invalid storage class for function 'lwt_xmit_func_proto'
    lwt_xmit_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5345:1: error: invalid storage class for function 'lwt_seg6local_func_proto'
    lwt_seg6local_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5361:13: error: invalid storage class for function 'bpf_skb_is_valid_access'
    static bool bpf_skb_is_valid_access(int off, int size, enum bpf_access_type type,
                ^~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5404:13: error: invalid storage class for function 'sk_filter_is_valid_access'
    static bool sk_filter_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5430:13: error: invalid storage class for function 'lwt_is_valid_access'
    static bool lwt_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5466:13: error: invalid storage class for function '__sock_filter_check_attach_type'
    static bool __sock_filter_check_attach_type(int off,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5509:13: error: invalid storage class for function '__sock_filter_check_size'
    static bool __sock_filter_check_size(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5536:13: error: invalid storage class for function 'sock_filter_is_valid_access'
    static bool sock_filter_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5547:12: error: invalid storage class for function 'bpf_unclone_prologue'
    static int bpf_unclone_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5586:12: error: invalid storage class for function 'bpf_gen_ld_abs'
    static int bpf_gen_ld_abs(const struct bpf_insn *orig,
               ^~~~~~~~~~~~~~
   net//core/filter.c:5621:12: error: invalid storage class for function 'tc_cls_act_prologue'
    static int tc_cls_act_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5627:13: error: invalid storage class for function 'tc_cls_act_is_valid_access'
    static bool tc_cls_act_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5662:13: error: invalid storage class for function '__is_valid_xdp_access'
    static bool __is_valid_xdp_access(int off, int size)
                ^~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5674:13: error: invalid storage class for function 'xdp_is_valid_access'
    static bool xdp_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5714:13: error: invalid storage class for function 'sock_addr_is_valid_access'
    static bool sock_addr_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5714:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static bool sock_addr_is_valid_access(int off, int size,
    ^~~~~~
   net//core/filter.c:5801:13: error: invalid storage class for function 'sock_ops_is_valid_access'
    static bool sock_ops_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5842:12: error: invalid storage class for function 'sk_skb_prologue'
    static int sk_skb_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~
   net//core/filter.c:5848:13: error: invalid storage class for function 'sk_skb_is_valid_access'
    static bool sk_skb_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5883:13: error: invalid storage class for function 'sk_msg_is_valid_access'
    static bool sk_msg_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:5915:12: error: invalid storage class for function 'bpf_convert_ctx_access'
    static u32 bpf_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6318:12: error: invalid storage class for function 'tc_cls_act_convert_ctx_access'
    static u32 tc_cls_act_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6342:12: error: invalid storage class for function 'xdp_convert_ctx_access'
    static u32 xdp_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6462:12: error: invalid storage class for function 'sock_addr_convert_ctx_access'
    static u32 sock_addr_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6551:12: error: invalid storage class for function 'sock_ops_convert_ctx_access'
    static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6890:12: error: invalid storage class for function 'sk_skb_convert_ctx_access'
    static u32 sk_skb_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:6915:12: error: invalid storage class for function 'sk_msg_convert_ctx_access'
    static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:7192:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int sk_get_filter(struct sock *sk, struct sock_filter __user *ubuf,
    ^~~
   net//core/filter.c:7247:13: error: invalid storage class for function 'bpf_init_reuseport_kern'
    static void bpf_init_reuseport_kern(struct sk_reuseport_kern *reuse_kern,
                ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____sk_select_reuseport'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net//core/filter.c:7277:12: error: static declaration of 'sk_select_reuseport' follows non-static declaration
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net//core/filter.c:7277:12: note: previous declaration of 'sk_select_reuseport' was here
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_select_reuseport':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____sk_select_reuseport' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____sk_select_reuseport'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net//core/filter.c:7323:20: error: initializer element is not constant
     .func           = sk_select_reuseport,
                       ^~~~~~~~~~~~~~~~~~~
   net//core/filter.c:7323:20: note: (near initialization for 'sk_select_reuseport_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____sk_reuseport_load_bytes'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net//core/filter.c:7332:12: error: static declaration of 'sk_reuseport_load_bytes' follows non-static declaration
    BPF_CALL_4(sk_reuseport_load_bytes,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net//core/filter.c:7332:12: note: previous declaration of 'sk_reuseport_load_bytes' was here
    BPF_CALL_4(sk_reuseport_load_bytes,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_reuseport_load_bytes':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____sk_reuseport_load_bytes' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____sk_reuseport_load_bytes'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net//core/filter.c:7340:11: error: initializer element is not constant
     .func  = sk_reuseport_load_bytes,
              ^~~~~~~~~~~~~~~~~~~~~~~
   net//core/filter.c:7340:11: note: (near initialization for 'sk_reuseport_load_bytes_proto.func')
   In file included from include/net/sock.h:64:0,
                    from include/linux/sock_diag.h:8,
                    from net//core/filter.c:29:
>> include/linux/filter.h:432:6: error: invalid storage class for function '____sk_reuseport_load_bytes_relative'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
    ^~~~~~~~~~
   net//core/filter.c:7349:12: error: static declaration of 'sk_reuseport_load_bytes_relative' follows non-static declaration
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
               ^
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
    ^~~~~~~~~~
   net//core/filter.c:7349:12: note: previous declaration of 'sk_reuseport_load_bytes_relative' was here
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
               ^
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_reuseport_load_bytes_relative':
>> include/linux/filter.h:436:10: error: implicit declaration of function '____sk_reuseport_load_bytes_relative' [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^
>> include/linux/filter.h:446:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_5(name, ...) BPF_CALL_x(5, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net//core/filter.c:7349:1: note: in expansion of macro 'BPF_CALL_5'
    BPF_CALL_5(sk_reuseport_load_bytes_relative,
    ^~~~~~~~~~
   net//core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____sk_reuseport_load_bytes_relative'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^

vim +/bpf_sk_lookup +4870 net/core/filter.c

  4863	
  4864	/* bpf_sk_lookup performs the core lookup for different types of sockets,
  4865	 * taking a reference on the socket if it doesn't have the flag SOCK_RCU_FREE.
  4866	 * Returns the socket as an 'unsigned long' to simplify the casting in the
  4867	 * callers to satisfy BPF_CALL declarations.
  4868	 */
> 4869	static unsigned long
> 4870	bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
  4871		      u8 proto, u32 netns_id, u64 flags)
  4872	{
  4873		struct net *caller_net = dev_net(skb->dev);
  4874		struct sock *sk = NULL;
  4875		struct net *net;
  4876	
  4877		if (unlikely(len != sizeof(struct bpf_sock_tuple) || flags ||
  4878			     (tuple->family != AF_INET && tuple->family != AF_INET6)))
  4879			goto out;
  4880	
  4881		if (netns_id)
  4882			net = get_net_ns_by_id(caller_net, netns_id);
  4883		else
  4884			net = caller_net;
  4885		if (unlikely(!net))
  4886			goto out;
  4887		sk = sk_lookup(net, tuple, skb, proto);
  4888		put_net(net);
  4889	
  4890		if (sk)
  4891			sk = sk_to_full_sk(sk);
  4892	out:
  4893		return (unsigned long) sk;
  4894	}
  4895	
> 4896	BPF_CALL_5(bpf_sk_lookup_tcp, struct sk_buff *, skb,
  4897		   struct bpf_sock_tuple *, tuple, u32, len, u32, netns_id, u64, flags)
  4898	{
  4899		return bpf_sk_lookup(skb, tuple, len, IPPROTO_TCP, netns_id, flags);
  4900	}
  4901	
  4902	static const struct bpf_func_proto bpf_sk_lookup_tcp_proto = {
> 4903		.func		= bpf_sk_lookup_tcp,
  4904		.gpl_only	= false,
  4905		.ret_type	= RET_PTR_TO_SOCKET_OR_NULL,
  4906		.arg1_type	= ARG_PTR_TO_CTX,
  4907		.arg2_type	= ARG_PTR_TO_MEM,
  4908		.arg3_type	= ARG_CONST_SIZE,
  4909		.arg4_type	= ARG_ANYTHING,
  4910		.arg5_type	= ARG_ANYTHING,
  4911	};
  4912	
> 4913	BPF_CALL_5(bpf_sk_lookup_udp, struct sk_buff *, skb,
  4914		   struct bpf_sock_tuple *, tuple, u32, len, u32, netns_id, u64, flags)
  4915	{
  4916		return bpf_sk_lookup(skb, tuple, len, IPPROTO_UDP, netns_id, flags);
  4917	}
  4918	
  4919	static const struct bpf_func_proto bpf_sk_lookup_udp_proto = {
  4920		.func		= bpf_sk_lookup_udp,
  4921		.gpl_only	= false,
  4922		.ret_type	= RET_PTR_TO_SOCKET_OR_NULL,
  4923		.arg1_type	= ARG_PTR_TO_CTX,
  4924		.arg2_type	= ARG_PTR_TO_MEM,
  4925		.arg3_type	= ARG_CONST_SIZE,
  4926		.arg4_type	= ARG_ANYTHING,
  4927		.arg5_type	= ARG_ANYTHING,
  4928	};
  4929	
> 4930	BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
  4931	{
  4932		if (!sock_flag(sk, SOCK_RCU_FREE))
  4933			sock_gen_put(sk);
  4934	
  4935		if (unlikely(flags))
  4936			return -EINVAL;
  4937		return 0;
  4938	}
  4939	
  4940	static const struct bpf_func_proto bpf_sk_release_proto = {
> 4941		.func		= bpf_sk_release,
  4942		.gpl_only	= false,
  4943		.ret_type	= RET_INTEGER,
  4944		.arg1_type	= ARG_PTR_TO_SOCKET,
  4945		.arg2_type	= ARG_ANYTHING,
  4946	};
  4947	
  4948	bool bpf_helper_changes_pkt_data(void *func)
  4949	{
  4950		if (func == bpf_skb_vlan_push ||
  4951		    func == bpf_skb_vlan_pop ||
  4952		    func == bpf_skb_store_bytes ||
  4953		    func == bpf_skb_change_proto ||
  4954		    func == bpf_skb_change_head ||
  4955		    func == sk_skb_change_head ||
  4956		    func == bpf_skb_change_tail ||
  4957		    func == sk_skb_change_tail ||
  4958		    func == bpf_skb_adjust_room ||
  4959		    func == bpf_skb_pull_data ||
  4960		    func == sk_skb_pull_data ||
  4961		    func == bpf_clone_redirect ||
  4962		    func == bpf_l3_csum_replace ||
  4963		    func == bpf_l4_csum_replace ||
  4964		    func == bpf_xdp_adjust_head ||
  4965		    func == bpf_xdp_adjust_meta ||
  4966		    func == bpf_msg_pull_data ||
  4967		    func == bpf_xdp_adjust_tail ||
  4968	#if IS_ENABLED(CONFIG_IPV6_SEG6_BPF)
  4969		    func == bpf_lwt_seg6_store_bytes ||
  4970		    func == bpf_lwt_seg6_adjust_srh ||
  4971		    func == bpf_lwt_seg6_action ||
  4972	#endif
  4973		    func == bpf_lwt_push_encap)
  4974			return true;
  4975	
  4976		return false;
  4977	}
  4978	
  4979	static const struct bpf_func_proto *
> 4980	bpf_base_func_proto(enum bpf_func_id func_id)
  4981	{
  4982		switch (func_id) {
  4983		case BPF_FUNC_map_lookup_elem:
  4984			return &bpf_map_lookup_elem_proto;
  4985		case BPF_FUNC_map_update_elem:
  4986			return &bpf_map_update_elem_proto;
  4987		case BPF_FUNC_map_delete_elem:
  4988			return &bpf_map_delete_elem_proto;
  4989		case BPF_FUNC_get_prandom_u32:
  4990			return &bpf_get_prandom_u32_proto;
  4991		case BPF_FUNC_get_smp_processor_id:
  4992			return &bpf_get_raw_smp_processor_id_proto;
  4993		case BPF_FUNC_get_numa_node_id:
  4994			return &bpf_get_numa_node_id_proto;
  4995		case BPF_FUNC_tail_call:
  4996			return &bpf_tail_call_proto;
  4997		case BPF_FUNC_ktime_get_ns:
  4998			return &bpf_ktime_get_ns_proto;
  4999		case BPF_FUNC_trace_printk:
  5000			if (capable(CAP_SYS_ADMIN))
  5001				return bpf_get_trace_printk_proto();
  5002			/* else: fall through */
  5003		default:
  5004			return NULL;
  5005		}
  5006	}
  5007	
  5008	static const struct bpf_func_proto *
> 5009	sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  5010	{
  5011		switch (func_id) {
  5012		/* inet and inet6 sockets are created in a process
  5013		 * context so there is always a valid uid/gid
  5014		 */
  5015		case BPF_FUNC_get_current_uid_gid:
  5016			return &bpf_get_current_uid_gid_proto;
  5017		case BPF_FUNC_get_local_storage:
  5018			return &bpf_get_local_storage_proto;
  5019		default:
  5020			return bpf_base_func_proto(func_id);
  5021		}
  5022	}
  5023	
  5024	static const struct bpf_func_proto *
> 5025	sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  5026	{
  5027		switch (func_id) {
  5028		/* inet and inet6 sockets are created in a process
  5029		 * context so there is always a valid uid/gid
  5030		 */
  5031		case BPF_FUNC_get_current_uid_gid:
  5032			return &bpf_get_current_uid_gid_proto;
  5033		case BPF_FUNC_bind:
  5034			switch (prog->expected_attach_type) {
  5035			case BPF_CGROUP_INET4_CONNECT:
  5036			case BPF_CGROUP_INET6_CONNECT:
  5037				return &bpf_bind_proto;
  5038			default:
  5039				return NULL;
  5040			}
  5041		case BPF_FUNC_get_socket_cookie:
  5042			return &bpf_get_socket_cookie_sock_addr_proto;
  5043		case BPF_FUNC_get_local_storage:
  5044			return &bpf_get_local_storage_proto;
  5045		default:
  5046			return bpf_base_func_proto(func_id);
  5047		}
  5048	}
  5049	
  5050	static const struct bpf_func_proto *
> 5051	sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  5052	{
  5053		switch (func_id) {
  5054		case BPF_FUNC_skb_load_bytes:
  5055			return &bpf_skb_load_bytes_proto;
  5056		case BPF_FUNC_skb_load_bytes_relative:
  5057			return &bpf_skb_load_bytes_relative_proto;
  5058		case BPF_FUNC_get_socket_cookie:
  5059			return &bpf_get_socket_cookie_proto;
  5060		case BPF_FUNC_get_socket_uid:
  5061			return &bpf_get_socket_uid_proto;
  5062		default:
  5063			return bpf_base_func_proto(func_id);
  5064		}
  5065	}
  5066	
  5067	static const struct bpf_func_proto *
> 5068	cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  5069	{
  5070		switch (func_id) {
  5071		case BPF_FUNC_get_local_storage:
  5072			return &bpf_get_local_storage_proto;
  5073		default:
  5074			return sk_filter_func_proto(func_id, prog);
  5075		}
  5076	}
  5077	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26893 bytes --]

^ permalink raw reply

* Re: [PATCH bpf-next 07/11] bpf: Add helper to retrieve socket in BPF
From: kbuild test robot @ 2018-09-14  6:57 UTC (permalink / raw)
  To: Joe Stringer
  Cc: kbuild-all, daniel, netdev, ast, john.fastabend, tgraf, kafai,
	nitin.hande, mauricio.vasquez
In-Reply-To: <20180912003640.28316-8-joe@wand.net.nz>

[-- Attachment #1: Type: text/plain, Size: 19595 bytes --]

Hi Joe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Joe-Stringer/Add-socket-lookup-support/20180914-134632
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: xtensa-common_defconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   net/core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____bpf_sk_release'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^~~~
   include/linux/filter.h:443:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_2(name, ...) BPF_CALL_x(2, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:4930:1: note: in expansion of macro 'BPF_CALL_2'
    BPF_CALL_2(bpf_sk_release, struct sock *, sk, u64, flags)
    ^~~~~~~~~~
   net/core/filter.c:4941:11: error: initializer element is not constant
     .func  = bpf_sk_release,
              ^~~~~~~~~~~~~~
   net/core/filter.c:4941:11: note: (near initialization for 'bpf_sk_release_proto.func')
   net/core/filter.c:4980:1: error: invalid storage class for function 'bpf_base_func_proto'
    bpf_base_func_proto(enum bpf_func_id func_id)
    ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5009:1: error: invalid storage class for function 'sock_filter_func_proto'
    sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5025:1: error: invalid storage class for function 'sock_addr_func_proto'
    sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5051:1: error: invalid storage class for function 'sk_filter_func_proto'
    sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5068:1: error: invalid storage class for function 'cg_skb_func_proto'
    cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:5079:1: error: invalid storage class for function 'tc_cls_act_func_proto'
    tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5166:1: error: invalid storage class for function 'xdp_func_proto'
    xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~
   net/core/filter.c:5193:1: error: invalid storage class for function 'sock_ops_func_proto'
    sock_ops_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5216:1: error: invalid storage class for function 'sk_msg_func_proto'
    sk_msg_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:5237:1: error: invalid storage class for function 'sk_skb_func_proto'
    sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:5272:1: error: invalid storage class for function 'lwt_out_func_proto'
    lwt_out_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~
   net/core/filter.c:5299:1: error: invalid storage class for function 'lwt_in_func_proto'
    lwt_in_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:5310:1: error: invalid storage class for function 'lwt_xmit_func_proto'
    lwt_xmit_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5345:1: error: invalid storage class for function 'lwt_seg6local_func_proto'
    lwt_seg6local_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
    ^~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5361:13: error: invalid storage class for function 'bpf_skb_is_valid_access'
    static bool bpf_skb_is_valid_access(int off, int size, enum bpf_access_type type,
                ^~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5404:13: error: invalid storage class for function 'sk_filter_is_valid_access'
    static bool sk_filter_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5430:13: error: invalid storage class for function 'lwt_is_valid_access'
    static bool lwt_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5466:13: error: invalid storage class for function '__sock_filter_check_attach_type'
    static bool __sock_filter_check_attach_type(int off,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5509:13: error: invalid storage class for function '__sock_filter_check_size'
    static bool __sock_filter_check_size(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5536:13: error: invalid storage class for function 'sock_filter_is_valid_access'
    static bool sock_filter_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5547:12: error: invalid storage class for function 'bpf_unclone_prologue'
    static int bpf_unclone_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5586:12: error: invalid storage class for function 'bpf_gen_ld_abs'
    static int bpf_gen_ld_abs(const struct bpf_insn *orig,
               ^~~~~~~~~~~~~~
   net/core/filter.c:5621:12: error: invalid storage class for function 'tc_cls_act_prologue'
    static int tc_cls_act_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5627:13: error: invalid storage class for function 'tc_cls_act_is_valid_access'
    static bool tc_cls_act_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5662:13: error: invalid storage class for function '__is_valid_xdp_access'
    static bool __is_valid_xdp_access(int off, int size)
                ^~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5674:13: error: invalid storage class for function 'xdp_is_valid_access'
    static bool xdp_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:7,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from net/core/filter.c:24:
>> net/core/filter.c:5712:19: error: non-static declaration of 'bpf_warn_invalid_xdp_action' follows static declaration
    EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:79:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
   net/core/filter.c:5712:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:5704:6: note: previous definition of 'bpf_warn_invalid_xdp_action' was here
    void bpf_warn_invalid_xdp_action(u32 act)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5714:13: error: invalid storage class for function 'sock_addr_is_valid_access'
    static bool sock_addr_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5801:13: error: invalid storage class for function 'sock_ops_is_valid_access'
    static bool sock_ops_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5842:12: error: invalid storage class for function 'sk_skb_prologue'
    static int sk_skb_prologue(struct bpf_insn *insn_buf, bool direct_write,
               ^~~~~~~~~~~~~~~
   net/core/filter.c:5848:13: error: invalid storage class for function 'sk_skb_is_valid_access'
    static bool sk_skb_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5883:13: error: invalid storage class for function 'sk_msg_is_valid_access'
    static bool sk_msg_is_valid_access(int off, int size,
                ^~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:5915:12: error: invalid storage class for function 'bpf_convert_ctx_access'
    static u32 bpf_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6318:12: error: invalid storage class for function 'tc_cls_act_convert_ctx_access'
    static u32 tc_cls_act_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6342:12: error: invalid storage class for function 'xdp_convert_ctx_access'
    static u32 xdp_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6462:12: error: invalid storage class for function 'sock_addr_convert_ctx_access'
    static u32 sock_addr_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6551:12: error: invalid storage class for function 'sock_ops_convert_ctx_access'
    static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6890:12: error: invalid storage class for function 'sk_skb_convert_ctx_access'
    static u32 sk_skb_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   net/core/filter.c:6915:12: error: invalid storage class for function 'sk_msg_convert_ctx_access'
    static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7,
                    from include/linux/kernel.h:7,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from net/core/filter.c:24:
>> net/core/filter.c:7190:19: error: non-static declaration of 'sk_detach_filter' follows static declaration
    EXPORT_SYMBOL_GPL(sk_detach_filter);
                      ^~~~~~~~~~~~~~~~
   include/linux/export.h:79:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
   net/core/filter.c:7190:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(sk_detach_filter);
    ^~~~~~~~~~~~~~~~~
   net/core/filter.c:7172:5: note: previous definition of 'sk_detach_filter' was here
    int sk_detach_filter(struct sock *sk)
        ^~~~~~~~~~~~~~~~
   net/core/filter.c:7247:13: error: invalid storage class for function 'bpf_init_reuseport_kern'
    static void bpf_init_reuseport_kern(struct sk_reuseport_kern *reuse_kern,
                ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/net/sock.h:64,
                    from include/linux/sock_diag.h:8,
                    from net/core/filter.c:29:
   include/linux/filter.h:432:6: error: invalid storage class for function '____sk_select_reuseport'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^~~~
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net/core/filter.c:7277:12: error: static declaration of 'sk_select_reuseport' follows non-static declaration
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
               ^~~~~~~~~~~~~~~~~~~
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net/core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net/core/filter.c:7277:12: note: previous declaration of 'sk_select_reuseport' was here
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
               ^~~~~~~~~~~~~~~~~~~
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net/core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_select_reuseport':
   include/linux/filter.h:436:10: error: implicit declaration of function '____sk_select_reuseport'; did you mean 'sk_select_reuseport'? [-Werror=implicit-function-declaration]
      return ____##name(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
             ^~~~
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_lookup':
   include/linux/filter.h:439:6: error: invalid storage class for function '____sk_select_reuseport'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))
         ^~~~
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:7277:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_select_reuseport, struct sk_reuseport_kern *, reuse_kern,
    ^~~~~~~~~~
   net/core/filter.c:7323:20: error: initializer element is not constant
     .func           = sk_select_reuseport,
                       ^~~~~~~~~~~~~~~~~~~
   net/core/filter.c:7323:20: note: (near initialization for 'sk_select_reuseport_proto.func')
   In file included from include/net/sock.h:64,
                    from include/linux/sock_diag.h:8,
                    from net/core/filter.c:29:
   include/linux/filter.h:432:6: error: invalid storage class for function '____sk_reuseport_load_bytes'
     u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__));   \
         ^~~~
   include/linux/filter.h:445:31: note: in expansion of macro 'BPF_CALL_x'
    #define BPF_CALL_4(name, ...) BPF_CALL_x(4, name, __VA_ARGS__)
                                  ^~~~~~~~~~
   net/core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net/core/filter.c:7332:12: error: static declaration of 'sk_reuseport_load_bytes' follows non-static declaration
    BPF_CALL_4(sk_reuseport_load_bytes,
               ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/filter.h:434:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__))        \
         ^~~~
   net/core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net/core/filter.c:7332:12: note: previous declaration of 'sk_reuseport_load_bytes' was here
    BPF_CALL_4(sk_reuseport_load_bytes,
               ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/filter.h:433:6: note: in definition of macro 'BPF_CALL_x'
     u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__));        \
         ^~~~
   net/core/filter.c:7332:1: note: in expansion of macro 'BPF_CALL_4'
    BPF_CALL_4(sk_reuseport_load_bytes,
    ^~~~~~~~~~
   net/core/filter.c: In function 'sk_reuseport_load_bytes':
   include/linux/filter.h:436:10: error: implicit declaration of function '____sk_reuseport_load_bytes'; did you mean 'sk_reuseport_load_bytes'? [-Werror=implicit-function-declaration]

vim +/bpf_warn_invalid_xdp_action +5712 net/core/filter.c

6a773a15a Brenden Blanco  2016-07-19  5673  
6a773a15a Brenden Blanco  2016-07-19 @5674  static bool xdp_is_valid_access(int off, int size,
6a773a15a Brenden Blanco  2016-07-19  5675  				enum bpf_access_type type,
5e43f899b Andrey Ignatov  2018-03-30  5676  				const struct bpf_prog *prog,
239946314 Yonghong Song   2017-06-22  5677  				struct bpf_insn_access_aux *info)
6a773a15a Brenden Blanco  2016-07-19  5678  {
0d8300325 Jakub Kicinski  2018-05-08  5679  	if (type == BPF_WRITE) {
0d8300325 Jakub Kicinski  2018-05-08  5680  		if (bpf_prog_is_dev_bound(prog->aux)) {
0d8300325 Jakub Kicinski  2018-05-08  5681  			switch (off) {
0d8300325 Jakub Kicinski  2018-05-08  5682  			case offsetof(struct xdp_md, rx_queue_index):
0d8300325 Jakub Kicinski  2018-05-08  5683  				return __is_valid_xdp_access(off, size);
0d8300325 Jakub Kicinski  2018-05-08  5684  			}
0d8300325 Jakub Kicinski  2018-05-08  5685  		}
6a773a15a Brenden Blanco  2016-07-19  5686  		return false;
0d8300325 Jakub Kicinski  2018-05-08  5687  	}
6a773a15a Brenden Blanco  2016-07-19  5688  
6a773a15a Brenden Blanco  2016-07-19  5689  	switch (off) {
6a773a15a Brenden Blanco  2016-07-19  5690  	case offsetof(struct xdp_md, data):
239946314 Yonghong Song   2017-06-22  5691  		info->reg_type = PTR_TO_PACKET;
6a773a15a Brenden Blanco  2016-07-19  5692  		break;
de8f3a83b Daniel Borkmann 2017-09-25  5693  	case offsetof(struct xdp_md, data_meta):
de8f3a83b Daniel Borkmann 2017-09-25  5694  		info->reg_type = PTR_TO_PACKET_META;
de8f3a83b Daniel Borkmann 2017-09-25  5695  		break;
6a773a15a Brenden Blanco  2016-07-19  5696  	case offsetof(struct xdp_md, data_end):
239946314 Yonghong Song   2017-06-22  5697  		info->reg_type = PTR_TO_PACKET_END;
6a773a15a Brenden Blanco  2016-07-19  5698  		break;
6a773a15a Brenden Blanco  2016-07-19  5699  	}
6a773a15a Brenden Blanco  2016-07-19  5700  
1afaf661b Daniel Borkmann 2016-12-04  5701  	return __is_valid_xdp_access(off, size);
6a773a15a Brenden Blanco  2016-07-19  5702  }
6a773a15a Brenden Blanco  2016-07-19  5703  
6a773a15a Brenden Blanco  2016-07-19  5704  void bpf_warn_invalid_xdp_action(u32 act)
6a773a15a Brenden Blanco  2016-07-19  5705  {
9beb8bedb Daniel Borkmann 2017-09-09  5706  	const u32 act_max = XDP_REDIRECT;
9beb8bedb Daniel Borkmann 2017-09-09  5707  
9beb8bedb Daniel Borkmann 2017-09-09  5708  	WARN_ONCE(1, "%s XDP return value %u, expect packet loss!\n",
9beb8bedb Daniel Borkmann 2017-09-09  5709  		  act > act_max ? "Illegal" : "Driver unsupported",
9beb8bedb Daniel Borkmann 2017-09-09  5710  		  act);
6a773a15a Brenden Blanco  2016-07-19  5711  }
6a773a15a Brenden Blanco  2016-07-19 @5712  EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
6a773a15a Brenden Blanco  2016-07-19  5713  

:::::: The code at line 5712 was first introduced by commit
:::::: 6a773a15a1e8874e5eccd2f29190c31085912c95 bpf: add XDP prog type for early driver filter

:::::: TO: Brenden Blanco <bblanco@plumgrid.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 10358 bytes --]

^ permalink raw reply

* Re: mlx5 driver loading failing on v4.19 / net-next / bpf-next
From: Jesper Dangaard Brouer @ 2018-09-14  6:36 UTC (permalink / raw)
  To: Alexei Starovoitov, Moshe Shemesh, Eli Cohen, Or Gerlitz
  Cc: Tariq Toukan, Saeed Mahameed, netdev@vger.kernel.org,
	Eran Ben Elisha, brouer
In-Reply-To: <CAADnVQJR0NA-eBcPiEnUKoswhOZ7VKp+MNr3qg+b7gSXaw7+zw@mail.gmail.com>

On Thu, 13 Sep 2018 15:55:29 -0700
Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:

> On Thu, Aug 30, 2018 at 1:35 AM, Tariq Toukan <tariqt@mellanox.com> wrote:
> >
> >
> > On 29/08/2018 6:05 PM, Jesper Dangaard Brouer wrote:  
> >>
> >> Hi Saeed,
> >>
> >> I'm having issues loading mlx5 driver on v4.19 kernels (tested both
> >> net-next and bpf-next), while kernel v4.18 seems to work.  It happens
> >> with a Mellanox ConnectX-5 NIC (and also a CX4-Lx but I removed that
> >> from the system now).
> >>  
> >
> > Hi Jesper,
> >
> > Thanks for your report!
> >
> > We are working to analyze and debug the issue.  
> 
> looks like serious issue to me... while no news in 2 weeks.
> any update?

Mellanox took it offlist, and Sep 6th found that this is a regression
introduced by commit 269d26f47f6f ("net/mlx5: Reduce command polling
interval"), but only if CONFIG_PREEMPT is on. 

I can confirm that reverting this commit fixed the issue (and not the
firmware upgrade I also did).

I think Moshe (Cc) is responsible for this case, and I expect to soon
see a revert or alternative solution to this!?

Thanks for the kick Alexei :-)
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox