Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/6] mlxsw: SPAN: Support routes pointing at bridges
From: Ido Schimmel @ 2018-04-26  9:06 UTC (permalink / raw)
  To: netdev, bridge; +Cc: davem, stephen, jiri, nikolay, petrm, mlxsw, Ido Schimmel

Petr says:

When mirroring to a gretap or ip6gretap netdevice, the route that
directs the encapsulated packets can reference a bridge. In that case,
in the software model, the packet is switched.

Thus when offloading mirroring like that, take into consideration FDB,
STP, PVID configured at the bridge, and whether that VLAN ID should be
tagged on egress.

Patch #1 introduces a suite of functions to query various bridge bits of
configuration: FDB, VLAN groups, etc.

Patches #2 and #3 refactor some existing code and introduce a new
accessor function.

With patches #4 and #5 mlxsw calls mlxsw_sp_span_respin() on switchdev
events as well. There is no impact yet, because bridge as an underlay
device is still not allowed.

That is implemented in patch #6, which uses the new interfaces to figure
out on which one port the mirroring should be configured, and whether
the mirrored packets should be VLAN-tagged and how.

Petr Machata (6):
  net: bridge: Publish bridge accessor functions
  mlxsw: spectrum: Extract mlxsw_sp_stp_spms_state()
  mlxsw: spectrum_switchdev: Publish two functions
  mlxsw: spectrum: Register SPAN before switchdev
  mlxsw: Respin SPAN on switchdev events
  mlxsw: spectrum_span: Allow bridge for gretap mirror

 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     |  50 +++++-----
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h     |   1 +
 .../net/ethernet/mellanox/mlxsw/spectrum_span.c    | 102 +++++++++++++++++++--
 .../net/ethernet/mellanox/mlxsw/spectrum_span.h    |   1 +
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.c   |  72 ++++++++++++++-
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.h   |  43 +++++++++
 include/linux/if_bridge.h                          |  55 +++++++++++
 net/bridge/br_fdb.c                                |  25 +++++
 net/bridge/br_private.h                            |  17 ++--
 net/bridge/br_vlan.c                               |  32 +++++++
 10 files changed, 356 insertions(+), 42 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.h

-- 
2.14.3

^ permalink raw reply

* [PATCH net] mlxsw: spectrum_switchdev: Do not remove mrouter port from MDB's ports list
From: Ido Schimmel @ 2018-04-26  8:46 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, nogahf, colin.king, mlxsw, Ido Schimmel

When IGMP snooping is enabled on a bridge, traffic forwarded by an MDB
entry should be sent to both ports member in the MDB's ports list and
mrouter ports.

In case a port needs to be removed from an MDB's ports list, but this
port is also configured as an mrouter port, then do not update the
device so that it will continue to forward traffic through that port.

Fix a copy-paste error that checked that IGMP snooping is enabled twice
instead of checking the port's mrouter state.

Fixes: ded711c87a04 ("mlxsw: spectrum_switchdev: Consider mrouter status for mdb changes")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Colin King <colin.king@canonical.com>
Reviewed-by: Nogah Frankel <nogahf@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index c11c9a635866..4ed01182a82c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1718,13 +1718,11 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
 	struct net_device *dev = mlxsw_sp_port->dev;
 	int err;
 
-	if (bridge_port->bridge_device->multicast_enabled) {
-		if (bridge_port->bridge_device->multicast_enabled) {
-			err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid,
-						     false);
-			if (err)
-				netdev_err(dev, "Unable to remove port from SMID\n");
-		}
+	if (bridge_port->bridge_device->multicast_enabled &&
+	    !bridge_port->mrouter) {
+		err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false);
+		if (err)
+			netdev_err(dev, "Unable to remove port from SMID\n");
 	}
 
 	err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid);
-- 
2.14.3

^ permalink raw reply related

* Re: [PATCH 2/2] net: stmmac: dwmac-meson: extend phy mode setting
From: Jerome Brunet @ 2018-04-26  8:47 UTC (permalink / raw)
  To: Yixun Lan, David S. Miller, netdev
  Cc: Kevin Hilman, Carlo Caione, Rob Herring, Martin Blumenstingl,
	linux-amlogic, linux-arm-kernel, linux-kernel
In-Reply-To: <20180426160508.29380-3-yixun.lan@amlogic.com>

On Thu, 2018-04-26 at 16:05 +0000, Yixun Lan wrote:
>   In the Meson-AXG SoC, the phy mode setting of PRG_ETH0 in the glue layer
> is extended from bit[0] to bit[2:0].
>   There is no problem if we configure it to the RGMII 1000M PHY mode,
> since the register setting is coincidentally compatible with previous one,
> but for the RMII 100M PHY mode, the configuration need to be changed to
> value - b100.
>   This patch was verified with a RTL8201F 100M ethernet PHY.
> 
> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
> ---
>  .../ethernet/stmicro/stmmac/dwmac-meson8b.c   | 95 ++++++++++++++++---
>  1 file changed, 84 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
> index 7cb794094a70..e3688b6dd87c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
> @@ -18,6 +18,7 @@
>  #include <linux/io.h>
>  #include <linux/ioport.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
>  #include <linux/of_net.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/platform_device.h>
> @@ -29,6 +30,10 @@
>  
>  #define PRG_ETH0_RGMII_MODE		BIT(0)
>  
> +#define PRG_ETH0_EXT_PHY_MODE_MASK	GENMASK(2, 0)
> +#define PRG_ETH0_EXT_RGMII_MODE		1
> +#define PRG_ETH0_EXT_RMII_MODE		4
> +
>  /* mux to choose between fclk_div2 (bit unset) and mpll2 (bit set) */
>  #define PRG_ETH0_CLK_M250_SEL_SHIFT	4
>  #define PRG_ETH0_CLK_M250_SEL_MASK	GENMASK(4, 4)
> @@ -46,10 +51,16 @@
>  #define PRG_ETH0_TX_AND_PHY_REF_CLK	BIT(12)
>  
>  #define MUX_CLK_NUM_PARENTS		2
> +struct meson8b_dwmac_data {
> +	bool ext_phy_mode;
> +};
>  
>  struct meson8b_dwmac {
>  	struct device		*dev;
>  	void __iomem		*regs;
> +
> +	const struct meson8b_dwmac_data *data;
> +
>  	phy_interface_t		phy_mode;
>  	struct clk		*rgmii_tx_clk;
>  	u32			tx_delay_ns;
> @@ -171,6 +182,46 @@ static int meson8b_init_rgmii_tx_clk(struct meson8b_dwmac *dwmac)
>  	return 0;
>  }
>  
> +static int meson8b_init_set_mode(struct meson8b_dwmac *dwmac)
> +{
> +	bool ext_phy_mode = dwmac->data->ext_phy_mode;
> +
> +	switch (dwmac->phy_mode) {
> +	case PHY_INTERFACE_MODE_RGMII:
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +	case PHY_INTERFACE_MODE_RGMII_TXID:
> +		/* enable RGMII mode */
> +		if (ext_phy_mode)

Looks weird to have this if target at a specific SoC withing a function named
after another SoC

Couldn't you make one function per soc type, and pass that function pointer in
the match data ?

> +			meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
> +						PRG_ETH0_EXT_PHY_MODE_MASK,
> +						PRG_ETH0_EXT_RGMII_MODE);
> +		else
> +			meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
> +						PRG_ETH0_RGMII_MODE,
> +						PRG_ETH0_RGMII_MODE);
> +
> +		break;
> +	case PHY_INTERFACE_MODE_RMII:
> +		/* disable RGMII mode -> enables RMII mode */
> +		if (ext_phy_mode)
> +			meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
> +						PRG_ETH0_EXT_PHY_MODE_MASK,
> +						PRG_ETH0_EXT_RMII_MODE);
> +		else
> +			meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
> +						PRG_ETH0_RGMII_MODE, 0);
> +
> +		break;
> +	default:
> +		dev_err(dwmac->dev, "fail to set phy-mode %s\n",
> +			phy_modes(dwmac->phy_mode));
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}
> +
>  static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
>  {
>  	int ret;
> @@ -188,10 +239,6 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
>  
>  	case PHY_INTERFACE_MODE_RGMII_ID:
>  	case PHY_INTERFACE_MODE_RGMII_TXID:
> -		/* enable RGMII mode */
> -		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_RGMII_MODE,
> -					PRG_ETH0_RGMII_MODE);
> -
>  		/* only relevant for RMII mode -> disable in RGMII mode */
>  		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
>  					PRG_ETH0_INVERTED_RMII_CLK, 0);
> @@ -224,10 +271,6 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac)
>  		break;
>  
>  	case PHY_INTERFACE_MODE_RMII:
> -		/* disable RGMII mode -> enables RMII mode */
> -		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_RGMII_MODE,
> -					0);
> -
>  		/* invert internal clk_rmii_i to generate 25/2.5 tx_rx_clk */
>  		meson8b_dwmac_mask_bits(dwmac, PRG_ETH0,
>  					PRG_ETH0_INVERTED_RMII_CLK,
> @@ -274,6 +317,11 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
>  		goto err_remove_config_dt;
>  	}
>  
> +	dwmac->data = (const struct meson8b_dwmac_data *)
> +		of_device_get_match_data(&pdev->dev);
> +	if (!dwmac->data)
> +		return -EINVAL;
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  	dwmac->regs = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(dwmac->regs)) {
> @@ -298,6 +346,10 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_remove_config_dt;
>  
> +	ret = meson8b_init_set_mode(dwmac);
> +	if (ret)
> +		goto err_remove_config_dt;
> +
>  	ret = meson8b_init_prg_eth(dwmac);
>  	if (ret)
>  		goto err_remove_config_dt;
> @@ -316,10 +368,31 @@ static int meson8b_dwmac_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> +static const struct meson8b_dwmac_data meson8b_dwmac_data = {
> +	.ext_phy_mode = false,
> +};
> +
> +static const struct meson8b_dwmac_data meson_axg_dwmac_data = {
> +	.ext_phy_mode = true,
> +};
> +
>  static const struct of_device_id meson8b_dwmac_match[] = {
> -	{ .compatible = "amlogic,meson8b-dwmac" },
> -	{ .compatible = "amlogic,meson8m2-dwmac" },
> -	{ .compatible = "amlogic,meson-gxbb-dwmac" },
> +	{
> +		.compatible = "amlogic,meson8b-dwmac",
> +		.data = &meson8b_dwmac_data,
> +	},
> +	{
> +		.compatible = "amlogic,meson8m2-dwmac",
> +		.data = &meson8b_dwmac_data,
> +	},
> +	{
> +		.compatible = "amlogic,meson-gxbb-dwmac",
> +		.data = &meson8b_dwmac_data,
> +	},
> +	{
> +		.compatible = "amlogic,meson-axg-dwmac",
> +		.data = &meson_axg_dwmac_data,
> +	},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, meson8b_dwmac_match);

^ permalink raw reply

* Re: [bpf PATCH v2] bpf: fix for lex/yacc build error with gcc-5
From: Jiri Benc @ 2018-04-26  8:43 UTC (permalink / raw)
  To: John Fastabend; +Cc: ast, daniel, netdev
In-Reply-To: <20180425212245.25999.21181.stgit@john-Precision-Tower-5810>

On Wed, 25 Apr 2018 14:22:45 -0700, John Fastabend wrote:
> --- a/tools/bpf/Makefile
> +++ b/tools/bpf/Makefile
> @@ -76,6 +76,8 @@ $(OUTPUT)bpf_asm: $(OUTPUT)bpf_asm.o $(OUTPUT)bpf_exp.yacc.o $(OUTPUT)bpf_exp.le
>  	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^
>  
>  $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
> +$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
> +$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c

Looks better than v1, the first dependency is important.

For some reason, I did not need the other two rules.

By the way, make invoked from tools/bpf/ has never really worked, even
before my patchset. This works correctly:

cd tools
make bpf

 Jiri

^ permalink raw reply

* Re: [PATCH v4 ipsec-next] xfrm: remove VLA usage in __xfrm6_sort()
From: Steffen Klassert @ 2018-04-26  8:33 UTC (permalink / raw)
  To: Stefano Brivio
  Cc: Kees Cook, Andreas Christoforou, kernel-hardening, Herbert Xu,
	David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev,
	linux-kernel
In-Reply-To: <20180425165852.6c7460c2@epycfail>

On Wed, Apr 25, 2018 at 04:58:52PM +0200, Stefano Brivio wrote:
> On Wed, 25 Apr 2018 07:46:39 -0700
> Kees Cook <keescook@chromium.org> wrote:
> 
> > In the quest to remove all stack VLA usage removed from the kernel[1],
> > just use XFRM_MAX_DEPTH as already done for the "class" array. In one
> > case, it'll do this loop up to 5, the other caller up to 6.
> > 
> > [1] https://lkml.org/lkml/2018/3/7/621
> > 
> > Co-developed-by: Andreas Christoforou <andreaschristofo@gmail.com>
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> > v4:
> > - actually remove memset(). :)
> > v3:
> > - adjust Subject and commit log (Steffen)
> > - use "= { }" instead of memset() (Stefano)
> > v2:
> > - use XFRM_MAX_DEPTH for "count" array (Steffen and Mathias).
> > ---
> 
> Acked-by: Stefano Brivio <sbrivio@redhat.com>

Applied to ipsec-next, thanks everyone!

^ permalink raw reply

* [PATCH 3/3] selftests/bpf: .gitignore: add test_btf
From: Sirio Balmelli @ 2018-04-26  8:31 UTC (permalink / raw)
  To: ast; +Cc: daniel, netdev

Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
---
 tools/testing/selftests/bpf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index 5e1ab2f..9513c77 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -12,6 +12,7 @@ test_tcpbpf_user
 test_verifier_log
 feature
 test_libbpf_open
+test_btf
 test_sock
 test_sock_addr
 urandom_read
-- 
2.7.4

^ permalink raw reply related

* [PATCH 2/3] selftests/bpf: test_xdp_noinline.c: fix 'noinline' macro expansion
From: Sirio Balmelli @ 2018-04-26  8:31 UTC (permalink / raw)
  To: ast; +Cc: daniel, netdev

Compiling with clang 7.0.0 yields:
test_xdp_noinline.c:470:24: warning: unknown attribute '__attribute__' ignored [-Wunknown-attributes]
../../../include/linux/compiler-gcc.h:24:19: note: expanded from macro 'noinline'
                        ^
test_xdp_noinline.c:494:24: error: use of undeclared identifier 'noinline'; did you mean 'inline'?
static __attribute__ ((noinline))

This appears to be the 'noinline' attribute being itself macro-expanded,
so the compiler sees '__attribute__ ((__attribute__((noinline))))'.

Fix using an #ifndef.
Homogenize function declarations.

Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
---
 tools/testing/selftests/bpf/test_xdp_noinline.c | 79 +++++++++++++------------
 1 file changed, 42 insertions(+), 37 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_xdp_noinline.c b/tools/testing/selftests/bpf/test_xdp_noinline.c
index 5e4aac7..5b5f3f2 100644
--- a/tools/testing/selftests/bpf/test_xdp_noinline.c
+++ b/tools/testing/selftests/bpf/test_xdp_noinline.c
@@ -15,6 +15,11 @@
 #include <linux/udp.h>
 #include "bpf_helpers.h"
 
+/* some compiler-specific header might define this */
+#ifndef noinline
+#define noinline (__attribute__ ((noinline)))
+#endif
+
 #define bpf_printk(fmt, ...)				\
 ({							\
 	char ____fmt[] = fmt;				\
@@ -55,7 +60,7 @@ static __u32 rol32(__u32 word, unsigned int shift)
 
 typedef unsigned int u32;
 
-static __attribute__ ((noinline))
+static noinline
 u32 jhash(const void *key, u32 length, u32 initval)
 {
 	u32 a, b, c;
@@ -92,7 +97,7 @@ u32 jhash(const void *key, u32 length, u32 initval)
 	return c;
 }
 
-static __attribute__ ((noinline))
+static noinline
 u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
 {
 	a += initval;
@@ -102,7 +107,7 @@ u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
 	return c;
 }
 
-static __attribute__ ((noinline))
+static noinline
 u32 jhash_2words(u32 a, u32 b, u32 initval)
 {
 	return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2));
@@ -239,7 +244,7 @@ static inline __u64 calc_offset(bool is_ipv6, bool is_icmp)
 	return off;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool parse_udp(void *data, void *data_end,
 	       bool is_ipv6, struct packet_description *pckt)
 {
@@ -261,7 +266,7 @@ bool parse_udp(void *data, void *data_end,
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool parse_tcp(void *data, void *data_end,
 	       bool is_ipv6, struct packet_description *pckt)
 {
@@ -285,7 +290,7 @@ bool parse_tcp(void *data, void *data_end,
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool encap_v6(struct xdp_md *xdp, struct ctl_value *cval,
 	      struct packet_description *pckt,
 	      struct real_definition *dst, __u32 pkt_bytes)
@@ -328,7 +333,7 @@ bool encap_v6(struct xdp_md *xdp, struct ctl_value *cval,
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool encap_v4(struct xdp_md *xdp, struct ctl_value *cval,
 	      struct packet_description *pckt,
 	      struct real_definition *dst, __u32 pkt_bytes)
@@ -382,7 +387,7 @@ bool encap_v4(struct xdp_md *xdp, struct ctl_value *cval,
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool decap_v6(struct xdp_md *xdp, void **data, void **data_end, bool inner_v4)
 {
 	struct eth_hdr *new_eth;
@@ -403,7 +408,7 @@ bool decap_v6(struct xdp_md *xdp, void **data, void **data_end, bool inner_v4)
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 bool decap_v4(struct xdp_md *xdp, void **data, void **data_end)
 {
 	struct eth_hdr *new_eth;
@@ -421,7 +426,7 @@ bool decap_v4(struct xdp_md *xdp, void **data, void **data_end)
 	return 1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 int swap_mac_and_send(void *data, void *data_end)
 {
 	unsigned char tmp_mac[6];
@@ -434,7 +439,7 @@ int swap_mac_and_send(void *data, void *data_end)
 	return XDP_TX;
 }
 
-static __attribute__ ((noinline))
+static noinline
 int send_icmp_reply(void *data, void *data_end)
 {
 	struct icmphdr *icmp_hdr;
@@ -467,7 +472,7 @@ int send_icmp_reply(void *data, void *data_end)
 	return swap_mac_and_send(data, data_end);
 }
 
-static __attribute__ ((noinline))
+static noinline
 int send_icmp6_reply(void *data, void *data_end)
 {
 	struct icmp6hdr *icmp_hdr;
@@ -491,7 +496,7 @@ int send_icmp6_reply(void *data, void *data_end)
 	return swap_mac_and_send(data, data_end);
 }
 
-static __attribute__ ((noinline))
+static noinline
 int parse_icmpv6(void *data, void *data_end, __u64 off,
 		 struct packet_description *pckt)
 {
@@ -516,7 +521,7 @@ int parse_icmpv6(void *data, void *data_end, __u64 off,
 	return -1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 int parse_icmp(void *data, void *data_end, __u64 off,
 	       struct packet_description *pckt)
 {
@@ -543,7 +548,7 @@ int parse_icmp(void *data, void *data_end, __u64 off,
 	return -1;
 }
 
-static __attribute__ ((noinline))
+static noinline
 __u32 get_packet_hash(struct packet_description *pckt,
 		      bool hash_16bytes)
 {
@@ -555,11 +560,11 @@ __u32 get_packet_hash(struct packet_description *pckt,
 				    24);
 }
 
-__attribute__ ((noinline))
-static bool get_packet_dst(struct real_definition **real,
-			   struct packet_description *pckt,
-			   struct vip_meta *vip_info,
-			   bool is_ipv6, void *lru_map)
+static noinline
+bool get_packet_dst(struct real_definition **real,
+		    struct packet_description *pckt,
+		    struct vip_meta *vip_info,
+		    bool is_ipv6, void *lru_map)
 {
 	struct real_pos_lru new_dst_lru = { };
 	bool hash_16bytes = is_ipv6;
@@ -608,10 +613,10 @@ static bool get_packet_dst(struct real_definition **real,
 	return 1;
 }
 
-__attribute__ ((noinline))
-static void connection_table_lookup(struct real_definition **real,
-				    struct packet_description *pckt,
-				    void *lru_map)
+static noinline
+void connection_table_lookup(struct real_definition **real,
+			     struct packet_description *pckt,
+			     void *lru_map)
 {
 
 	struct real_pos_lru *dst_lru;
@@ -635,11 +640,11 @@ static void connection_table_lookup(struct real_definition **real,
  * below function has 6 arguments whereas bpf and llvm allow maximum of 5
  * but since it's _static_ llvm can optimize one argument away
  */
-__attribute__ ((noinline))
-static int process_l3_headers_v6(struct packet_description *pckt,
-				 __u8 *protocol, __u64 off,
-				 __u16 *pkt_bytes, void *data,
-				 void *data_end)
+static noinline
+int process_l3_headers_v6(struct packet_description *pckt,
+			  __u8 *protocol, __u64 off,
+			  __u16 *pkt_bytes, void *data,
+			  void *data_end)
 {
 	struct ipv6hdr *ip6h;
 	__u64 iph_len;
@@ -666,11 +671,11 @@ static int process_l3_headers_v6(struct packet_description *pckt,
 	return -1;
 }
 
-__attribute__ ((noinline))
-static int process_l3_headers_v4(struct packet_description *pckt,
-				 __u8 *protocol, __u64 off,
-				 __u16 *pkt_bytes, void *data,
-				 void *data_end)
+static noinline
+int process_l3_headers_v4(struct packet_description *pckt,
+			  __u8 *protocol, __u64 off,
+			  __u16 *pkt_bytes, void *data,
+			  void *data_end)
 {
 	struct iphdr *iph;
 	__u64 iph_len;
@@ -698,9 +703,9 @@ static int process_l3_headers_v4(struct packet_description *pckt,
 	return -1;
 }
 
-__attribute__ ((noinline))
-static int process_packet(void *data, __u64 off, void *data_end,
-			  bool is_ipv6, struct xdp_md *xdp)
+static inline
+int process_packet(void *data, __u64 off, void *data_end,
+		   bool is_ipv6, struct xdp_md *xdp)
 {
 
 	struct real_definition *dst = NULL;
-- 
2.7.4

^ permalink raw reply related

* [PATCH 1/3] selftests/bpf: Makefile: add includes to fix broken test build
From: Sirio Balmelli @ 2018-04-26  8:31 UTC (permalink / raw)
  To: ast; +Cc: daniel, netdev

several bpf tests fail to build with clang 7.0.0:
...
In file included from ../../../include/uapi/linux/bpf.h:11:
In file included from ./include/uapi/linux/types.h:5:
/usr/include/asm-generic/int-ll64.h:11:10: fatal error: 'asm/bitsperlong.h' file not found

/usr/include/asm-generic/int-ll64.h is from outside the kernel repo,
probably a good idea to repoint to -I$(ROOT)/include/uapi.
asm/bitsperlong.h is architecture-specific, cater for this with an
architecture-specific include -I$(ROOT)/$(ARCH)/include/uapi.

Re-building now yields:
../../../../include/uapi/linux/stddef.h:2:10: fatal error: 'linux/compiler_types.h' file not found

Fix this with -I$(ROOT)/include

Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
---
 tools/testing/selftests/bpf/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 0b72cc7..6a8cfaf 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -80,8 +80,14 @@ else
   CPU ?= generic
 endif
 
-CLANG_FLAGS = -I. -I./include/uapi -I../../../include/uapi \
-	      -Wno-compare-distinct-pointer-types
+ARCH := arch/$(subst _64,,$(shell uname -p))
+ROOT :=../../../..
+TOOLS :=../../..
+CLANG_FLAGS = -I. -I./include/uapi \
+	-I$(TOOLS)/include/uapi -I$(TOOLS)/include \
+	-I$(ROOT)/$(ARCH)/include/uapi \
+	-I$(ROOT)/include/uapi -I$(ROOT)/include \
+	-Wno-compare-distinct-pointer-types
 
 $(OUTPUT)/test_l4lb_noinline.o: CLANG_FLAGS += -fno-inline
 $(OUTPUT)/test_xdp_noinline.o: CLANG_FLAGS += -fno-inline
-- 
2.7.4

^ permalink raw reply related

* [PATCH 0/3] selftests/bpf
From: Sirio Balmelli @ 2018-04-26  8:30 UTC (permalink / raw)
  To: ast; +Cc: daniel, netdev

Fix some errors getting BPF selftests to build in 4.17.0-rc2 from net-next.

uname -a
Linux vm4 4.17.0-rc2-net-next+ #2 SMP Wed Apr 25 22:51:20 CEST 2018 x86_64 x86_64 x86_64 GNU/Linux

clang --version
clang version 7.0.0 (trunk 330819)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

llc --version
LLVM (http://llvm.org/):
  LLVM version 7.0.0svn
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: haswell

Sirio Balmelli (3):
  selftests/bpf: Makefile: add includes to fix broken test build
  selftests/bpf: test_xdp_noinline.c: fix 'noinline' macro expansion
  selftests/bpf: .gitignore: add test_btf

 tools/testing/selftests/bpf/.gitignore          |  1 +
 tools/testing/selftests/bpf/Makefile            | 10 +++-
 tools/testing/selftests/bpf/test_xdp_noinline.c | 79 +++++++++++++------------
 3 files changed, 51 insertions(+), 39 deletions(-)

-- 
2.7.4

^ permalink raw reply

* Re: [net-next v3] ipv6: sr: Compute flowlabel for outer IPv6 header of seg6 encap mode
From: Ahmed Abdelsalam @ 2018-04-26  8:23 UTC (permalink / raw)
  To: David Miller; +Cc: dav.lebrun, kuznet, yoshfuji, netdev, linux-kernel
In-Reply-To: <20180425.130304.1605881647944477071.davem@davemloft.net>

On Wed, 25 Apr 2018 13:03:04 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:

> From: Ahmed Abdelsalam <amsalam20@gmail.com>
> Date: Tue, 24 Apr 2018 20:23:16 +0200
> 
> > ECMP (equal-cost multipath) hashes are typically computed on the packets'
> > 5-tuple(src IP, dst IP, src port, dst port, L4 proto).
> > 
> > For encapsulated packets, the L4 data is not readily available and ECMP
> > hashing will often revert to (src IP, dst IP). This will lead to traffic
> > polarization on a single ECMP path, causing congestion and waste of network
> > capacity.
> > 
> > In IPv6, the 20-bit flow label field is also used as part of the ECMP hash.
> > In the lack of L4 data, the hashing will be on (src IP, dst IP, flow
> > label). Having a non-zero flow label is thus important for proper traffic
> > load balancing when L4 data is unavailable (i.e., when packets are
> > encapsulated).
> > 
> > Currently, the seg6_do_srh_encap() function extracts the original packet's
> > flow label and set it as the outer IPv6 flow label. There are two issues
> > with this behaviour:
> > 
> > a) There is no guarantee that the inner flow label is set by the source.
> > b) If the original packet is not IPv6, the flow label will be set to
> > zero (e.g., IPv4 or L2 encap).
> > 
> > This patch adds a function, named seg6_make_flowlabel(), that computes a
> > flow label from a given skb. It supports IPv6, IPv4 and L2 payloads, and
> > leverages the per namespace 'seg6_flowlabel" sysctl value.
> > 
> > The currently support behaviours are as follows:
> > -1 set flowlabel to zero.
> > 0 copy flowlabel from Inner paceket in case of Inner IPv6
> > (Set flowlabel to 0 in case IPv4/L2)
> > 1 Compute the flowlabel using seg6_make_flowlabel()
> > 
> > This patch has been tested for IPv6, IPv4, and L2 traffic.
> > 
> > Signed-off-by: Ahmed Abdelsalam <amsalam20@gmail.com>
> 
> Applied.
> 
> Please submit a patch which adds appropriate documentation for this new sysctl
> to Documentation/networking/ip-sysctl.txt

Thanks David
I will send you a patch for ip-sysctl.txt

-- 
Ahmed Abdelsalam <amsalam20@gmail.com>

^ permalink raw reply

* [PATCHv3 3/3] tools bpftool: Display license GPL compatible in prog show/list
From: Jiri Olsa @ 2018-04-26  8:18 UTC (permalink / raw)
  To: Daniel Borkmann
  Cc: Jakub Kicinski, Jiri Olsa, Alexei Starovoitov, lkml, netdev,
	Quentin Monnet
In-Reply-To: <639b2b78-af9e-4605-2b33-9bd1af8e760a@iogearbox.net>

On Thu, Apr 26, 2018 at 09:53:26AM +0200, Daniel Borkmann wrote:
> On 04/26/2018 09:39 AM, Jiri Olsa wrote:
> > On Wed, Apr 25, 2018 at 11:14:30PM +0200, Daniel Borkmann wrote:
> >> On 04/25/2018 11:03 PM, Jakub Kicinski wrote:
> >>> On Wed, 25 Apr 2018 19:41:08 +0200, Jiri Olsa wrote:
> >>>> @@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
> >>>>  	printf("tag ");
> >>>>  	fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
> >>>>  	print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
> >>>> +	printf(" license GPL %scompatible", info->gpl_compatible ? "" : "NON ");
> >>>
> >>> 3 nit picks:
> >>>
> >>> Other "fields" are separated by two spaces between each other:
> >>>
> >>>   4: kprobe  name func_begin  tag 57cd311f2e27366b license GPL compatible
> >>>            ^^               ^^                    X
> >>>           loaded_at Apr 25/11:20  uid 0
> >>>                                 ^^
> >>>           xlated 16B  not jited  memlock 4096B
> >>>                     ^^         ^^
> >>>
> >>> Could you also update the example outputs in the man page:
> >>>
> >>> tools/bpf/bpftool/Documentation/bpftool-prog.rst
> >>>
> >>> Sorry about the bike shedding but I would also vote for:
> >>>
> >>> "[not] GPL compatible"
> >>>
> >>> rather than
> >>>
> >>> "license GPL [NON] compatible"
> >>>
> >>> for brevity..
> >>
> >> While we're at it, can we also squeeze this whole thing a bit? Feels like
> >> huge string wasted for very little information compared to the rest of the
> >> dump. Just append the string "gpl" at the end of the line if info->gpl_compatible
> >> is set, otherwise just add nothing. This also allows to naturally grep
> >> for it e.g. `bpftool p | grep gpl` if you need a quick summary.
> > 
> > that's fine with me.. so 'gpl' in here:
> > 
> > 5: tracepoint  name func  tag 57cd311f2e27366b  gpl
> >         loaded_at Apr 26/09:37  uid 0
> >         xlated 16B  not jited  memlock 4096B
> > 
> > and keeping tyhe whole name in json output:
> > 
> > [{
> >         "id": 5,
> >         "type": "tracepoint",
> >         "name": "func",
> >         "tag": "57cd311f2e27366b",
> >         "gpl_compatible": true,
> >         "loaded_at": "Apr 26/09:37",
> >         "uid": 0,
> >         "bytes_xlated": 16,
> >         "jited": false,
> >         "bytes_memlock": 4096
> >     }
> > ]
> > 
> > how about that?
> 
> Sounds good, thanks Jiri!

v3 of the last patch attached, the branch is also updated

thanks,
jirka


---
Display the license "gpl" string in bpftool prog command, like:

  # bpftool prog list
  5: tracepoint  name func  tag 57cd311f2e27366b  gpl
          loaded_at Apr 26/09:37  uid 0
          xlated 16B  not jited  memlock 4096B

  # bpftool --json --pretty prog show
  [{
          "id": 5,
          "type": "tracepoint",
          "name": "func",
          "tag": "57cd311f2e27366b",
          "gpl_compatible": true,
          "loaded_at": "Apr 26/09:37",
          "uid": 0,
          "bytes_xlated": 16,
          "jited": false,
          "bytes_memlock": 4096
      }
  ]

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/bpf/bpftool/Documentation/bpftool-prog.rst | 3 ++-
 tools/bpf/bpftool/prog.c                         | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index 67ca6c69376c..43d34a5c3ec5 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -95,7 +95,7 @@ EXAMPLES
 **# bpftool prog show**
 ::
 
-  10: xdp  name some_prog  tag 005a3d2123620c8b
+  10: xdp  name some_prog  tag 005a3d2123620c8b  gpl
 	loaded_at Sep 29/20:11  uid 0
 	xlated 528B  jited 370B  memlock 4096B  map_ids 10
 
@@ -108,6 +108,7 @@ EXAMPLES
                 "id": 10,
                 "type": "xdp",
                 "tag": "005a3d2123620c8b",
+                "gpl_compatible": true,
                 "loaded_at": "Sep 29/20:11",
                 "uid": 0,
                 "bytes_xlated": 528,
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 548adb9b7317..e71a0a11afde 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -235,6 +235,8 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
 		     info->tag[0], info->tag[1], info->tag[2], info->tag[3],
 		     info->tag[4], info->tag[5], info->tag[6], info->tag[7]);
 
+	jsonw_bool_field(json_wtr, "gpl_compatible", info->gpl_compatible);
+
 	print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);
 
 	if (info->load_time) {
@@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
 	printf("tag ");
 	fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
 	print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
+	printf("%s", info->gpl_compatible ? "  gpl" : "");
 	printf("\n");
 
 	if (info->load_time) {
-- 
2.13.6

^ permalink raw reply related

* Re: [PATCH] net: rfkill: gpio: fix memory leak in probe error path
From: Heikki Krogerus @ 2018-04-26  8:14 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, stable
In-Reply-To: <20180426073152.7953-1-johan@kernel.org>

On Thu, Apr 26, 2018 at 09:31:52AM +0200, Johan Hovold wrote:
> Make sure to free the rfkill device in case registration fails during
> probe.
> 
> Fixes: 5e7ca3937fbe ("net: rfkill: gpio: convert to resource managed allocation")
> Cc: stable <stable@vger.kernel.org>	# 3.13
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Good catch. FWIW:

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  net/rfkill/rfkill-gpio.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index 41bd496531d4..00192a996be0 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -137,13 +137,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>  
>  	ret = rfkill_register(rfkill->rfkill_dev);
>  	if (ret < 0)
> -		return ret;
> +		goto err_destroy;
>  
>  	platform_set_drvdata(pdev, rfkill);
>  
>  	dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);
>  
>  	return 0;
> +
> +err_destroy:
> +	rfkill_destroy(rfkill->rfkill_dev);
> +
> +	return ret;
>  }
>  
>  static int rfkill_gpio_remove(struct platform_device *pdev)
> -- 
> 2.17.0

-- 
heikki

^ permalink raw reply

* Re: WARNING: kobject bug in br_add_if
From: Dmitry Vyukov @ 2018-04-26  8:04 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: syzbot, bridge, David Miller, LKML, netdev, stephen hemminger,
	syzkaller-bugs, Greg Kroah-Hartman
In-Reply-To: <20180426061314.GH20683@leo.usersys.redhat.com>

On Thu, Apr 26, 2018 at 8:13 AM, Hangbin Liu <liuhangbin@gmail.com> wrote:
> On Wed, Apr 11, 2018 at 05:18:23PM +0200, Dmitry Vyukov wrote:
>> On Wed, Apr 11, 2018 at 5:15 PM, syzbot
>> <syzbot+de73361ee4971b6e6f75@syzkaller.appspotmail.com> wrote:
>> > Hello,
>> >
>> > syzbot hit the following crash on upstream commit
>> > 10b84daddbec72c6b440216a69de9a9605127f7a (Sat Mar 31 17:59:00 2018 +0000)
>> > Merge branch 'perf-urgent-for-linus' of
>> > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
>> > syzbot dashboard link:
>> > https://syzkaller.appspot.com/bug?extid=de73361ee4971b6e6f75
>> >
>> > So far this crash happened 4 times on net-next, upstream.
>> > Unfortunately, I don't have any reproducer for this crash yet.
>> > Raw console output:
>> > https://syzkaller.appspot.com/x/log.txt?id=5007286875455488
>> > Kernel config:
>> > https://syzkaller.appspot.com/x/.config?id=-2760467897697295172
>> > compiler: gcc (GCC) 7.1.1 20170620
>> >
>> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> > Reported-by: syzbot+de73361ee4971b6e6f75@syzkaller.appspotmail.com
>> > It will help syzbot understand when the bug is fixed. See footer for
>> > details.
>> > If you forward the report, please keep this part and the footer.
>>
>> +Greg
>>
>> The plan is to remove this WARNING from kobject_add, if there are no objections.
>
> Hi Dmitry,
>
> For this bug, why should we remove the WARNING instead of adding a check in
> br_add_if()? Something like


Mainline because nobody wants to fix these.
If you think this is a real bug and you are ready to fix it, please
mail an official patch.


> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 82c1a6f..79dcc3d 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -518,8 +518,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
>                 return -ELOOP;
>         }
>
> -       /* Device is already being bridged */
> -       if (br_port_exists(dev))
> +       /* Device still has master upper dev */
> +       if (netdev_master_upper_dev_get(dev))
>                 return -EBUSY;
>
>         /* No bridging devices that dislike that (e.g. wireless) */
>
> Thanks
> Hangbin
>>
>> > ------------[ cut here ]------------
>> > binder: 23650:23651 unknown command 1078223622
>> > kobject_add_internal failed for brport (error: -12 parent: bond0)
>> > binder: 23650:23651 ioctl c0306201 2000dfd0 returned -22
>> > WARNING: CPU: 1 PID: 23647 at lib/kobject.c:242
>> > kobject_add_internal+0x3f6/0xbc0 lib/kobject.c:240
>> > Kernel panic - not syncing: panic_on_warn set ...
>> >
>> > CPU: 1 PID: 23647 Comm: syz-executor7 Not tainted 4.16.0-rc7+ #374
>> > binder: BINDER_SET_CONTEXT_MGR already set
>> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> > Google 01/01/2011
>> > Call Trace:
>> >  __dump_stack lib/dump_stack.c:17 [inline]
>> >  dump_stack+0x194/0x24d lib/dump_stack.c:53
>> >  panic+0x1e4/0x41c kernel/panic.c:183
>> >  __warn+0x1dc/0x200 kernel/panic.c:547
>> >  report_bug+0x1f4/0x2b0 lib/bug.c:186
>> >  fixup_bug.part.10+0x37/0x80 arch/x86/kernel/traps.c:178
>> >  fixup_bug arch/x86/kernel/traps.c:247 [inline]
>> >  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
>> >  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
>> >  invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:986
>> > RIP: 0010:kobject_add_internal+0x3f6/0xbc0 lib/kobject.c:240
>> > RSP: 0018:ffff8801d089f560 EFLAGS: 00010286
>> > RAX: dffffc0000000008 RBX: ffff8801adbee178 RCX: ffffffff815b193e
>> > RDX: 0000000000040000 RSI: ffffc900022aa000 RDI: 1ffff1003a113e31
>> > RBP: ffff8801d089f658 R08: 1ffff1003a113df3 R09: 0000000000000000
>> > R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff1003a113eb2
>> > R13: 00000000fffffff4 R14: ffff8801abd88828 R15: ffff8801d75a1e00
>> >  kobject_add_varg lib/kobject.c:364 [inline]
>> >  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>> >  br_add_if+0x79a/0x1a70 net/bridge/br_if.c:533
>> >  add_del_if+0xf4/0x140 net/bridge/br_ioctl.c:101
>> >  br_dev_ioctl+0xa2/0xc0 net/bridge/br_ioctl.c:396
>> >  dev_ifsioc+0x333/0x9b0 net/core/dev_ioctl.c:334
>> >  dev_ioctl+0x176/0xbe0 net/core/dev_ioctl.c:500
>> >  sock_do_ioctl+0x1ba/0x390 net/socket.c:981
>> >  sock_ioctl+0x367/0x670 net/socket.c:1081
>> >  vfs_ioctl fs/ioctl.c:46 [inline]
>> >  do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
>> >  SYSC_ioctl fs/ioctl.c:701 [inline]
>> >  SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
>> >  do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
>> >  entry_SYSCALL_64_after_hwframe+0x42/0xb7
>> > RIP: 0033:0x454e79
>> > RSP: 002b:00007eff7dab7c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
>> > RAX: ffffffffffffffda RBX: 00007eff7dab86d4 RCX: 0000000000454e79
>> > RDX: 0000000020000000 RSI: 00000000000089a2 RDI: 0000000000000014
>> > RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
>> > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000015
>> > R13: 0000000000000369 R14: 00000000006f7278 R15: 0000000000000006
>> > Dumping ftrace buffer:
>> >    (ftrace buffer empty)
>> > Kernel Offset: disabled
>> > Rebooting in 86400 seconds..

^ permalink raw reply

* Re: linux-next: manual merge of the bpf-next tree with the bpf tree
From: Daniel Borkmann @ 2018-04-26  7:57 UTC (permalink / raw)
  To: Stephen Rothwell, Alexei Starovoitov, Networking
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	John Fastabend
In-Reply-To: <20180426105313.792db06a@canb.auug.org.au>

On 04/26/2018 02:53 AM, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the bpf-next tree got a conflict in:
> 
>   samples/sockmap/Makefile
> 
> between commit:
> 
>   4dfe1bb95235 ("bpf: sockmap sample use clang flag, -target bpf")
> 
> from the bpf tree and commit:
> 
>   2e04eb1dd1ca ("bpf: sockmap, remove samples program")
> 
> from the bpf-next tree.
> 
> I fixed it up (I just removed the file) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.

That's correct as well, thank you!

^ permalink raw reply

* Re: [PATCH stable v4.4+] r8152: add Linksys USB3GIGV1 id
From: Krzysztof Kozlowski @ 2018-04-26  7:56 UTC (permalink / raw)
  To: Grant Grundler; +Cc: Oliver Neukum, David S. Miller, linux-usb, netdev, LKML
In-Reply-To: <CANEJEGsTh671Gezgq6dAMu5e1PT_J3GiJ1ypDPPORt86N3VH=g@mail.gmail.com>

On Thu, Apr 26, 2018 at 2:40 AM, Grant Grundler <grundler@chromium.org> wrote:
> On Wed, Apr 25, 2018 at 2:54 AM, Krzysztof Kozlowski <krzk@kernel.org>
> wrote:
>>
>> commit 90841047a01b452cc8c3f9b990698b264143334a upstream
>>
>> This linksys dongle by default comes up in cdc_ether mode.
>> This patch allows r8152 to claim the device:
>>    Bus 002 Device 002: ID 13b1:0041 Linksys
>>
>> Signed-off-by: Grant Grundler <grundler@chromium.org>
>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>> [krzk: Rebase on v4.4]'
>
>
> thanks krzk!
>
> FTR, to support RTL8153B (HW ID 0x6010), the follow patch series to bring
> r8152 v1.09.9 driver from 4.14 kernel.org to 3 (of 5) older Chrome OS
> kernels:
>
> 3.14:
> https://chromium-review.googlesource.com/q/topic:%22update_r8152-3.14%22+(status:open%20OR%20status:merged)
> 3.18:
> https://chromium-review.googlesource.com/q/topic:%2522update-r8152-3.18%2522+(status:open+OR+status:merged)
> 4.4:
> https://chromium-review.googlesource.com/q/topic:%2522update_r8152-4.4%2522+(status:open+OR+status:merged)
>
> caveat: These series are not suitable directly for kernel.org submission
> (extraneous stuff in the commit messages, order is different). Using the
> original SHA1 (in each commit message), this can all be fixed up by
> hand/simple scripts.

Hi Grant,

These are regular feature/patch backports so they do not fit into
stable process. Only new quirks and IDs are accepted for stable.

Best regards,
Krzysztof

^ permalink raw reply

* Re: linux-next: manual merge of the bpf-next tree with the net-next tree
From: Daniel Borkmann @ 2018-04-26  7:56 UTC (permalink / raw)
  To: Stephen Rothwell, Alexei Starovoitov, Networking, David Miller
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Anders Roxell
In-Reply-To: <20180426104902.548c3fdb@canb.auug.org.au>

On 04/26/2018 02:49 AM, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the bpf-next tree got a conflict in:
> 
>   tools/testing/selftests/bpf/.gitignore
> 
> between commit:
> 
>   0abf854d7cbb ("selftests: bpf: update .gitignore with missing generated files")
> 
> from the net-next tree and commit:
> 
>   b6fd9cf796e6 ("selftests: bpf: update .gitignore with missing file")
> 
> from the bpf-next tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Looks good, thanks!

^ permalink raw reply

* Re: [PATCH] net: phy: marvell: clear wol event before setting it
From: Jisheng Zhang @ 2018-04-26  7:56 UTC (permalink / raw)
  To: Bhadram Varka
  Cc: Andrew Lunn, Florian Fainelli, David S. Miller, netdev,
	linux-kernel, Jingju Hou
In-Reply-To: <be2addb5-b3fd-13cb-ad33-f0527931a0d2@nvidia.com>


On Thu, 26 Apr 2018 11:56:33 +0530 Bhadram Varka wrote:

> Hi,
> On 4/26/2018 11:45 AM, Jisheng Zhang wrote:
> > Hi,
> >
> > On Thu, 26 Apr 2018 11:10:21 +0530 Bhadram Varka wrote:
> >  
> >> Hi,
> >>
> >> On 4/19/2018 5:48 PM, Andrew Lunn wrote:  
> >>> On Thu, Apr 19, 2018 at 04:02:32PM +0800, Jisheng Zhang wrote:  

<snip>

> >>>>    		if (err < 0)
> >>>>    			goto error;
> >>>>    
> >>>> +		/* If WOL event happened once, the LED[2] interrupt pin
> >>>> +		 * will not be cleared unless reading the CSISR register.
> >>>> +		 * So clear the WOL event first before enabling it.
> >>>> +		 */
> >>>> +		phy_read(phydev, MII_88E1318S_PHY_CSISR);
> >>>> +  
> >>> Hi Jisheng
> >>>
> >>> The problem with this is, you could be clearing a real interrupt, link
> >>> down/up etc. If interrupts are in use, i think the normal interrupt
> >>> handling will clear the WOL interrupt? So can you make this read
> >>> conditional on !phy_interrupt_is_valid()?  
> >> So this will clear WoL interrupt bit from Copper Interrupt status register.
> >>
> >> How about clearing WoL status (Page 17, register 17) for every WOL event ?
> >>  
> > This is already properly done by setting MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS
> > in m88e1318_set_wol()  
> This part of the code executes only when we enable WOL through ethtool 
> (ethtool -s eth0 wol g)
> 
> Lets say once WOL enabled through magic packet - HW generates WOL 
> interrupt once magic packet received.
> The problem that I see here is that for the next immediate magic packet 
> I don't see WOL interrupt generated by the HW.

hmm, so you want a "stick" WOL feature, I dunno whether Linux kernel
requires WOL should be "stick".

^ permalink raw reply

* Re: [PATCH 3/3] tools bpftool: Display license GPL compatible in prog show/list
From: Daniel Borkmann @ 2018-04-26  7:53 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jakub Kicinski, Jiri Olsa, Alexei Starovoitov, lkml, netdev,
	Quentin Monnet
In-Reply-To: <20180426073905.GI3396@krava>

On 04/26/2018 09:39 AM, Jiri Olsa wrote:
> On Wed, Apr 25, 2018 at 11:14:30PM +0200, Daniel Borkmann wrote:
>> On 04/25/2018 11:03 PM, Jakub Kicinski wrote:
>>> On Wed, 25 Apr 2018 19:41:08 +0200, Jiri Olsa wrote:
>>>> @@ -295,6 +297,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
>>>>  	printf("tag ");
>>>>  	fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
>>>>  	print_dev_plain(info->ifindex, info->netns_dev, info->netns_ino);
>>>> +	printf(" license GPL %scompatible", info->gpl_compatible ? "" : "NON ");
>>>
>>> 3 nit picks:
>>>
>>> Other "fields" are separated by two spaces between each other:
>>>
>>>   4: kprobe  name func_begin  tag 57cd311f2e27366b license GPL compatible
>>>            ^^               ^^                    X
>>>           loaded_at Apr 25/11:20  uid 0
>>>                                 ^^
>>>           xlated 16B  not jited  memlock 4096B
>>>                     ^^         ^^
>>>
>>> Could you also update the example outputs in the man page:
>>>
>>> tools/bpf/bpftool/Documentation/bpftool-prog.rst
>>>
>>> Sorry about the bike shedding but I would also vote for:
>>>
>>> "[not] GPL compatible"
>>>
>>> rather than
>>>
>>> "license GPL [NON] compatible"
>>>
>>> for brevity..
>>
>> While we're at it, can we also squeeze this whole thing a bit? Feels like
>> huge string wasted for very little information compared to the rest of the
>> dump. Just append the string "gpl" at the end of the line if info->gpl_compatible
>> is set, otherwise just add nothing. This also allows to naturally grep
>> for it e.g. `bpftool p | grep gpl` if you need a quick summary.
> 
> that's fine with me.. so 'gpl' in here:
> 
> 5: tracepoint  name func  tag 57cd311f2e27366b  gpl
>         loaded_at Apr 26/09:37  uid 0
>         xlated 16B  not jited  memlock 4096B
> 
> and keeping tyhe whole name in json output:
> 
> [{
>         "id": 5,
>         "type": "tracepoint",
>         "name": "func",
>         "tag": "57cd311f2e27366b",
>         "gpl_compatible": true,
>         "loaded_at": "Apr 26/09:37",
>         "uid": 0,
>         "bytes_xlated": 16,
>         "jited": false,
>         "bytes_memlock": 4096
>     }
> ]
> 
> how about that?

Sounds good, thanks Jiri!

^ permalink raw reply

* [PATCH net-next 13/13] s390/qeth: improve fallback to random MAC address
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Julian Wiedmann <jwi@linux.vnet.ibm.com>

If READ MAC fails to fetch a valid MAC address, allow some more device
types (IQD and z/VM OSD) to fall back to a random address.
Also use eth_hw_addr_random(), for indicating to userspace that the
address type is NET_ADDR_RANDOM.

Note that while z/VM has various protection schemes to prohibit
custom addresses on its NICs, they are all optional. So we should at
least give it a try.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 810d69bd9991..a7cb37da6a21 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -439,7 +439,6 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
 static int qeth_l2_request_initial_mac(struct qeth_card *card)
 {
 	int rc = 0;
-	char vendor_pre[] = {0x02, 0x00, 0x00};
 
 	QETH_DBF_TEXT(SETUP, 2, "l2reqmac");
 	QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card));
@@ -459,16 +458,20 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
 	    card->info.type == QETH_CARD_TYPE_OSX ||
 	    card->info.guestlan) {
 		rc = qeth_setadpparms_change_macaddr(card);
-		if (rc) {
-			QETH_DBF_MESSAGE(2, "couldn't get MAC address on "
-				"device %s: x%x\n", CARD_BUS_ID(card), rc);
-			QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
-			return rc;
-		}
-	} else {
-		eth_random_addr(card->dev->dev_addr);
-		memcpy(card->dev->dev_addr, vendor_pre, 3);
+		if (!rc)
+			goto out;
+		QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %s: x%x\n",
+				 CARD_BUS_ID(card), rc);
+		QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
+		/* fall back once more: */
 	}
+
+	/* some devices don't support a custom MAC address: */
+	if (card->info.type == QETH_CARD_TYPE_OSM ||
+	    card->info.type == QETH_CARD_TYPE_OSX)
+		return (rc) ? rc : -EADDRNOTAVAIL;
+	eth_hw_addr_random(card->dev);
+
 out:
 	QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, card->dev->addr_len);
 	return 0;
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 12/13] s390/qeth: add IPv6 RX checksum offload support
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>

Check if a qeth device supports IPv6 RX checksum offload, and hook it up
into the existing NETIF_F_RXCSUM support.
As NETIF_F_RXCSUM is now backed by a combination of HW Assists, we need
to be a little smarter when dealing with errors during a configuration
change:
- switching on NETIF_F_RXCSUM only makes sense if at least one HW Assist
  was enabled successfully.
- for switching off NETIF_F_RXCSUM, all available HW Assists need to be
  deactivated.

Signed-off-by: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 31 +++++++++++++++++++++++++++----
 drivers/s390/net/qeth_core_mpc.h  |  1 +
 drivers/s390/net/qeth_l2_main.c   |  9 +++++----
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 55b05d9c1cb6..06415b6a8f68 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -6430,6 +6430,29 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on)
 	return rc;
 }
 
+static int qeth_set_ipa_rx_csum(struct qeth_card *card, bool on)
+{
+	int rc_ipv4 = (on) ? -EOPNOTSUPP : 0;
+	int rc_ipv6;
+
+	if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
+		rc_ipv4 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
+					    QETH_PROT_IPV4);
+	if (!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
+		/* no/one Offload Assist available, so the rc is trivial */
+		return rc_ipv4;
+
+	rc_ipv6 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM,
+				    QETH_PROT_IPV6);
+
+	if (on)
+		/* enable: success if any Assist is active */
+		return (rc_ipv6) ? rc_ipv4 : 0;
+
+	/* disable: failure if any Assist is still active */
+	return (rc_ipv6) ? rc_ipv6 : rc_ipv4;
+}
+
 #define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO | \
 			  NETIF_F_IPV6_CSUM)
 /**
@@ -6477,9 +6500,8 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features)
 		if (rc)
 			changed ^= NETIF_F_IPV6_CSUM;
 	}
-	if ((changed & NETIF_F_RXCSUM)) {
-		rc = qeth_set_ipa_csum(card, features & NETIF_F_RXCSUM,
-				       IPA_INBOUND_CHECKSUM, QETH_PROT_IPV4);
+	if (changed & NETIF_F_RXCSUM) {
+		rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM);
 		if (rc)
 			changed ^= NETIF_F_RXCSUM;
 	}
@@ -6508,7 +6530,8 @@ netdev_features_t qeth_fix_features(struct net_device *dev,
 		features &= ~NETIF_F_IP_CSUM;
 	if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6))
 		features &= ~NETIF_F_IPV6_CSUM;
-	if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
+	if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) &&
+	    !qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6))
 		features &= ~NETIF_F_RXCSUM;
 	if (!qeth_is_supported(card, IPA_OUTBOUND_TSO))
 		features &= ~NETIF_F_TSO;
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h
index af3c35fbfa9e..878e62f35169 100644
--- a/drivers/s390/net/qeth_core_mpc.h
+++ b/drivers/s390/net/qeth_core_mpc.h
@@ -246,6 +246,7 @@ enum qeth_ipa_funcs {
 	IPA_QUERY_ARP_ASSIST	= 0x00040000L,
 	IPA_INBOUND_TSO         = 0x00080000L,
 	IPA_OUTBOUND_TSO        = 0x00100000L,
+	IPA_INBOUND_CHECKSUM_V6 = 0x00400000L,
 	IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L,
 };
 
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 5b1780fa4cb5..810d69bd9991 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -992,15 +992,16 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
 			card->dev->hw_features |= NETIF_F_IP_CSUM;
 			card->dev->vlan_features |= NETIF_F_IP_CSUM;
 		}
-		if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
-			card->dev->hw_features |= NETIF_F_RXCSUM;
-			card->dev->vlan_features |= NETIF_F_RXCSUM;
-		}
 	}
 	if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {
 		card->dev->hw_features |= NETIF_F_IPV6_CSUM;
 		card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
 	}
+	if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) ||
+	    qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) {
+		card->dev->hw_features |= NETIF_F_RXCSUM;
+		card->dev->vlan_features |= NETIF_F_RXCSUM;
+	}
 
 	card->info.broadcast_capable = 1;
 	qeth_l2_request_initial_mac(card);
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 11/13] s390/qeth: add IPv6 TX checksum offload support
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>

Check if a qeth device supports IPv6 TX checksum offload, and advertise
NETIF_F_IPV6_CSUM accordingly. Add support for setting the relevant bits
in IPv6 packet descriptors.

Currently this has only limited use (ie. UDP, or Jumbo Frames). For any
TCP traffic with a standard MSS, the TCP checksum gets calculated
as part of the linear GSO segmentation.

Signed-off-by: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core.h      | 13 ++++++++-----
 drivers/s390/net/qeth_core_main.c | 18 +++++++++++++-----
 drivers/s390/net/qeth_core_mpc.h  |  1 +
 drivers/s390/net/qeth_l2_main.c   | 14 ++++++++++----
 drivers/s390/net/qeth_l3_main.c   |  7 ++++++-
 5 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 7cbc9bf5d6b0..2a5fec55bf60 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -878,14 +878,17 @@ static inline void qeth_rx_csum(struct qeth_card *card, struct sk_buff *skb,
 	}
 }
 
-static inline void qeth_tx_csum(struct sk_buff *skb, u8 *flags)
+static inline void qeth_tx_csum(struct sk_buff *skb, u8 *flags, int ipv)
 {
 	*flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ;
-	if (ip_hdr(skb)->protocol == IPPROTO_UDP)
+	if ((ipv == 4 && ip_hdr(skb)->protocol == IPPROTO_UDP) ||
+	    (ipv == 6 && ipv6_hdr(skb)->nexthdr == IPPROTO_UDP))
 		*flags |= QETH_HDR_EXT_UDP;
-	/* some HW requires combined L3+L4 csum offload: */
-	*flags |= QETH_HDR_EXT_CSUM_HDR_REQ;
-	ip_hdr(skb)->check = 0;
+	if (ipv == 4) {
+		/* some HW requires combined L3+L4 csum offload: */
+		*flags |= QETH_HDR_EXT_CSUM_HDR_REQ;
+		ip_hdr(skb)->check = 0;
+	}
 }
 
 static inline void qeth_put_buffer_pool_entry(struct qeth_card *card,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 5e4a509822f1..55b05d9c1cb6 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -6349,12 +6349,12 @@ static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
 static int qeth_send_checksum_on(struct qeth_card *card, int cstype,
 				 enum qeth_prot_versions prot)
 {
-	const __u32 required_features = QETH_IPA_CHECKSUM_IP_HDR |
-					QETH_IPA_CHECKSUM_UDP |
-					QETH_IPA_CHECKSUM_TCP;
+	u32 required_features = QETH_IPA_CHECKSUM_UDP | QETH_IPA_CHECKSUM_TCP;
 	struct qeth_checksum_cmd chksum_cb;
 	int rc;
 
+	if (prot == QETH_PROT_IPV4)
+		required_features |= QETH_IPA_CHECKSUM_IP_HDR;
 	rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_START, 0,
 				       &chksum_cb, prot);
 	if (!rc) {
@@ -6430,8 +6430,8 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on)
 	return rc;
 }
 
-#define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO)
-
+#define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO | \
+			  NETIF_F_IPV6_CSUM)
 /**
  * qeth_recover_features() - Restore device features after recovery
  * @dev:	the recovering net_device
@@ -6471,6 +6471,12 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features)
 		if (rc)
 			changed ^= NETIF_F_IP_CSUM;
 	}
+	if (changed & NETIF_F_IPV6_CSUM) {
+		rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM,
+				       IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV6);
+		if (rc)
+			changed ^= NETIF_F_IPV6_CSUM;
+	}
 	if ((changed & NETIF_F_RXCSUM)) {
 		rc = qeth_set_ipa_csum(card, features & NETIF_F_RXCSUM,
 				       IPA_INBOUND_CHECKSUM, QETH_PROT_IPV4);
@@ -6500,6 +6506,8 @@ netdev_features_t qeth_fix_features(struct net_device *dev,
 	QETH_DBF_TEXT(SETUP, 2, "fixfeat");
 	if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM))
 		features &= ~NETIF_F_IP_CSUM;
+	if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6))
+		features &= ~NETIF_F_IPV6_CSUM;
 	if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM))
 		features &= ~NETIF_F_RXCSUM;
 	if (!qeth_is_supported(card, IPA_OUTBOUND_TSO))
diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h
index f4d1ec0b8f5a..af3c35fbfa9e 100644
--- a/drivers/s390/net/qeth_core_mpc.h
+++ b/drivers/s390/net/qeth_core_mpc.h
@@ -246,6 +246,7 @@ enum qeth_ipa_funcs {
 	IPA_QUERY_ARP_ASSIST	= 0x00040000L,
 	IPA_INBOUND_TSO         = 0x00080000L,
 	IPA_OUTBOUND_TSO        = 0x00100000L,
+	IPA_OUTBOUND_CHECKSUM_V6 = 0x00800000L,
 };
 
 /* SETIP/DELIP IPA Command: ***************************************************/
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 945df56434fd..5b1780fa4cb5 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -660,7 +660,8 @@ static int qeth_l2_xmit_iqd(struct qeth_card *card, struct sk_buff *skb,
 }
 
 static int qeth_l2_xmit_osa(struct qeth_card *card, struct sk_buff *skb,
-			    struct qeth_qdio_out_q *queue, int cast_type)
+			    struct qeth_qdio_out_q *queue, int cast_type,
+			    int ipv)
 {
 	int push_len = sizeof(struct qeth_hdr);
 	unsigned int elements, nr_frags;
@@ -699,7 +700,7 @@ static int qeth_l2_xmit_osa(struct qeth_card *card, struct sk_buff *skb,
 	}
 	qeth_l2_fill_header(hdr, skb, cast_type, skb->len - push_len);
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
-		qeth_tx_csum(skb, &hdr->hdr.l2.flags[1]);
+		qeth_tx_csum(skb, &hdr->hdr.l2.flags[1], ipv);
 		if (card->options.performance_stats)
 			card->perf_stats.tx_csum++;
 	}
@@ -754,6 +755,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
 {
 	struct qeth_card *card = dev->ml_priv;
 	int cast_type = qeth_l2_get_cast_type(card, skb);
+	int ipv = qeth_get_ip_version(skb);
 	struct qeth_qdio_out_q *queue;
 	int tx_bytes = skb->len;
 	int rc;
@@ -761,7 +763,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
 	if (card->qdio.do_prio_queueing || (cast_type &&
 					card->info.is_multicast_different))
 		queue = card->qdio.out_qs[qeth_get_priority_queue(card, skb,
-					qeth_get_ip_version(skb), cast_type)];
+					ipv, cast_type)];
 	else
 		queue = card->qdio.out_qs[card->qdio.default_out_queue];
 
@@ -784,7 +786,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
 		rc = qeth_l2_xmit_iqd(card, skb, queue, cast_type);
 		break;
 	default:
-		rc = qeth_l2_xmit_osa(card, skb, queue, cast_type);
+		rc = qeth_l2_xmit_osa(card, skb, queue, cast_type, ipv);
 	}
 
 	if (!rc) {
@@ -995,6 +997,10 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
 			card->dev->vlan_features |= NETIF_F_RXCSUM;
 		}
 	}
+	if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {
+		card->dev->hw_features |= NETIF_F_IPV6_CSUM;
+		card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
+	}
 
 	card->info.broadcast_capable = 1;
 	qeth_l2_request_initial_mac(card);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index dd233fe3d6c4..e7fa479adf47 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2281,7 +2281,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
 		}
 
 		if (new_skb->ip_summed == CHECKSUM_PARTIAL) {
-			qeth_tx_csum(new_skb, &hdr->hdr.l3.ext_flags);
+			qeth_tx_csum(new_skb, &hdr->hdr.l3.ext_flags, ipv);
 			if (card->options.performance_stats)
 				card->perf_stats.tx_csum++;
 		}
@@ -2507,6 +2507,11 @@ static int qeth_l3_setup_netdev(struct qeth_card *card)
 			card->dev->vlan_features |= NETIF_F_TSO |
 				NETIF_F_RXCSUM | NETIF_F_IP_CSUM;
 		}
+
+		if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) {
+			card->dev->hw_features |= NETIF_F_IPV6_CSUM;
+			card->dev->vlan_features |= NETIF_F_IPV6_CSUM;
+		}
 	} else if (card->info.type == QETH_CARD_TYPE_IQD) {
 		card->dev = alloc_netdev(0, "hsi%d", NET_NAME_UNKNOWN,
 					 ether_setup);
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 09/13] s390/qeth: query IPv6 assists during hardsetup
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>

For new functionality, the L2 subdriver will start using IPv6 assists.
So move the query from the L3 subdriver into the common setup path.

Signed-off-by: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 5 +++++
 drivers/s390/net/qeth_l3_main.c   | 8 --------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index b90f38d78ad9..9ec1bb7f8b84 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5201,6 +5201,11 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
 	rc = qeth_query_ipassists(card, QETH_PROT_IPV4);
 	if (rc == -ENOMEM)
 		goto out;
+	if (qeth_is_supported(card, IPA_IPV6)) {
+		rc = qeth_query_ipassists(card, QETH_PROT_IPV6);
+		if (rc == -ENOMEM)
+			goto out;
+	}
 	if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
 		rc = qeth_query_setadapterparms(card);
 		if (rc < 0) {
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index bc359e322ae7..9d9c743e7433 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -851,14 +851,6 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card)
 
 	QETH_CARD_TEXT(card, 3, "softipv6");
 
-	rc = qeth_query_ipassists(card, QETH_PROT_IPV6);
-	if (rc) {
-		dev_err(&card->gdev->dev,
-			"Activating IPv6 support for %s failed\n",
-			QETH_CARD_IFNAME(card));
-		return rc;
-	}
-
 	if (card->info.type == QETH_CARD_TYPE_IQD)
 		goto out;
 
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 10/13] s390/qeth: extend Checksum Offload Assists for IPv6
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>

Add some wrappers to make the protocol-specific Assist code a little
more generic, and use them for sending protocol-agnostic commands in
the Checksum Offload Assist code.

Signed-off-by: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core.h      | 23 ++++++++++++--
 drivers/s390/net/qeth_core_main.c | 65 +++++++++++++++++++++------------------
 drivers/s390/net/qeth_l3_main.c   | 24 +++------------
 3 files changed, 60 insertions(+), 52 deletions(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index e8108f6891b2..7cbc9bf5d6b0 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -900,6 +900,27 @@ static inline int qeth_is_diagass_supported(struct qeth_card *card,
 	return card->info.diagass_support & (__u32)cmd;
 }
 
+int qeth_send_simple_setassparms_prot(struct qeth_card *card,
+				      enum qeth_ipa_funcs ipa_func,
+				      u16 cmd_code, long data,
+				      enum qeth_prot_versions prot);
+/* IPv4 variant */
+static inline int qeth_send_simple_setassparms(struct qeth_card *card,
+					       enum qeth_ipa_funcs ipa_func,
+					       u16 cmd_code, long data)
+{
+	return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code,
+						 data, QETH_PROT_IPV4);
+}
+
+static inline int qeth_send_simple_setassparms_v6(struct qeth_card *card,
+						  enum qeth_ipa_funcs ipa_func,
+						  u16 cmd_code, long data)
+{
+	return qeth_send_simple_setassparms_prot(card, ipa_func, cmd_code,
+						 data, QETH_PROT_IPV6);
+}
+
 extern struct qeth_discipline qeth_l2_discipline;
 extern struct qeth_discipline qeth_l3_discipline;
 extern const struct attribute_group *qeth_generic_attr_groups[];
@@ -994,8 +1015,6 @@ int qeth_hw_trap(struct qeth_card *, enum qeth_diags_trap_action);
 int qeth_query_ipassists(struct qeth_card *, enum qeth_prot_versions prot);
 void qeth_trace_features(struct qeth_card *);
 void qeth_close_dev(struct qeth_card *);
-int qeth_send_simple_setassparms(struct qeth_card *, enum qeth_ipa_funcs,
-				 __u16, long);
 int qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *, __u16,
 			  long,
 			  int (*reply_cb)(struct qeth_card *,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 9ec1bb7f8b84..5e4a509822f1 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5513,26 +5513,26 @@ int qeth_send_setassparms(struct qeth_card *card,
 }
 EXPORT_SYMBOL_GPL(qeth_send_setassparms);
 
-int qeth_send_simple_setassparms(struct qeth_card *card,
-				 enum qeth_ipa_funcs ipa_func,
-				 __u16 cmd_code, long data)
+int qeth_send_simple_setassparms_prot(struct qeth_card *card,
+				      enum qeth_ipa_funcs ipa_func,
+				      u16 cmd_code, long data,
+				      enum qeth_prot_versions prot)
 {
 	int rc;
 	int length = 0;
 	struct qeth_cmd_buffer *iob;
 
-	QETH_CARD_TEXT(card, 4, "simassp4");
+	QETH_CARD_TEXT_(card, 4, "simassp%i", prot);
 	if (data)
 		length = sizeof(__u32);
-	iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code,
-				       length, QETH_PROT_IPV4);
+	iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code, length, prot);
 	if (!iob)
 		return -ENOMEM;
 	rc = qeth_send_setassparms(card, iob, length, data,
 				   qeth_setassparms_cb, NULL);
 	return rc;
 }
-EXPORT_SYMBOL_GPL(qeth_send_simple_setassparms);
+EXPORT_SYMBOL_GPL(qeth_send_simple_setassparms_prot);
 
 static void qeth_unregister_dbf_views(void)
 {
@@ -6330,14 +6330,15 @@ static int qeth_ipa_checksum_run_cmd_cb(struct qeth_card *card,
 static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
 				     enum qeth_ipa_funcs ipa_func,
 				     __u16 cmd_code, long data,
-				     struct qeth_checksum_cmd *chksum_cb)
+				     struct qeth_checksum_cmd *chksum_cb,
+				     enum qeth_prot_versions prot)
 {
 	struct qeth_cmd_buffer *iob;
 	int rc = -ENOMEM;
 
 	QETH_CARD_TEXT(card, 4, "chkdocmd");
 	iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code,
-				       sizeof(__u32), QETH_PROT_IPV4);
+				       sizeof(__u32), prot);
 	if (iob)
 		rc = qeth_send_setassparms(card, iob, sizeof(__u32), data,
 					   qeth_ipa_checksum_run_cmd_cb,
@@ -6345,7 +6346,8 @@ static int qeth_ipa_checksum_run_cmd(struct qeth_card *card,
 	return rc;
 }
 
-static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
+static int qeth_send_checksum_on(struct qeth_card *card, int cstype,
+				 enum qeth_prot_versions prot)
 {
 	const __u32 required_features = QETH_IPA_CHECKSUM_IP_HDR |
 					QETH_IPA_CHECKSUM_UDP |
@@ -6354,7 +6356,7 @@ static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
 	int rc;
 
 	rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_START, 0,
-				       &chksum_cb);
+				       &chksum_cb, prot);
 	if (!rc) {
 		if ((required_features & chksum_cb.supported) !=
 		    required_features)
@@ -6366,37 +6368,42 @@ static int qeth_send_checksum_on(struct qeth_card *card, int cstype)
 				 QETH_CARD_IFNAME(card));
 	}
 	if (rc) {
-		qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
+		qeth_send_simple_setassparms_prot(card, cstype,
+						  IPA_CMD_ASS_STOP, 0, prot);
 		dev_warn(&card->gdev->dev,
-			 "Starting HW checksumming for %s failed, using SW checksumming\n",
-			 QETH_CARD_IFNAME(card));
+			 "Starting HW IPv%d checksumming for %s failed, using SW checksumming\n",
+			 prot, QETH_CARD_IFNAME(card));
 		return rc;
 	}
 	rc = qeth_ipa_checksum_run_cmd(card, cstype, IPA_CMD_ASS_ENABLE,
-				       chksum_cb.supported, &chksum_cb);
+				       chksum_cb.supported, &chksum_cb,
+				       prot);
 	if (!rc) {
 		if ((required_features & chksum_cb.enabled) !=
 		    required_features)
 			rc = -EIO;
 	}
 	if (rc) {
-		qeth_send_simple_setassparms(card, cstype, IPA_CMD_ASS_STOP, 0);
+		qeth_send_simple_setassparms_prot(card, cstype,
+						  IPA_CMD_ASS_STOP, 0, prot);
 		dev_warn(&card->gdev->dev,
-			 "Enabling HW checksumming for %s failed, using SW checksumming\n",
-			 QETH_CARD_IFNAME(card));
+			 "Enabling HW IPv%d checksumming for %s failed, using SW checksumming\n",
+			 prot, QETH_CARD_IFNAME(card));
 		return rc;
 	}
 
-	dev_info(&card->gdev->dev, "HW Checksumming (%sbound) enabled\n",
-		 cstype == IPA_INBOUND_CHECKSUM ? "in" : "out");
+	dev_info(&card->gdev->dev, "HW Checksumming (%sbound IPv%d) enabled\n",
+		 cstype == IPA_INBOUND_CHECKSUM ? "in" : "out", prot);
 	return 0;
 }
 
-static int qeth_set_ipa_csum(struct qeth_card *card, int on, int cstype)
+static int qeth_set_ipa_csum(struct qeth_card *card, bool on, int cstype,
+			     enum qeth_prot_versions prot)
 {
-	int rc = (on) ? qeth_send_checksum_on(card, cstype)
-		      : qeth_send_simple_setassparms(card, cstype,
-						     IPA_CMD_ASS_STOP, 0);
+	int rc = (on) ? qeth_send_checksum_on(card, cstype, prot)
+		      : qeth_send_simple_setassparms_prot(card, cstype,
+							  IPA_CMD_ASS_STOP, 0,
+							  prot);
 	return rc ? -EIO : 0;
 }
 
@@ -6459,16 +6466,14 @@ int qeth_set_features(struct net_device *dev, netdev_features_t features)
 	QETH_DBF_HEX(SETUP, 2, &features, sizeof(features));
 
 	if ((changed & NETIF_F_IP_CSUM)) {
-		rc = qeth_set_ipa_csum(card,
-				       features & NETIF_F_IP_CSUM ? 1 : 0,
-				       IPA_OUTBOUND_CHECKSUM);
+		rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM,
+				       IPA_OUTBOUND_CHECKSUM, QETH_PROT_IPV4);
 		if (rc)
 			changed ^= NETIF_F_IP_CSUM;
 	}
 	if ((changed & NETIF_F_RXCSUM)) {
-		rc = qeth_set_ipa_csum(card,
-					features & NETIF_F_RXCSUM ? 1 : 0,
-					IPA_INBOUND_CHECKSUM);
+		rc = qeth_set_ipa_csum(card, features & NETIF_F_RXCSUM,
+				       IPA_INBOUND_CHECKSUM, QETH_PROT_IPV4);
 		if (rc)
 			changed ^= NETIF_F_RXCSUM;
 	}
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 9d9c743e7433..dd233fe3d6c4 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -735,22 +735,6 @@ static int qeth_l3_setadapter_parms(struct qeth_card *card)
 	return rc;
 }
 
-static int qeth_l3_send_simple_setassparms_ipv6(struct qeth_card *card,
-		enum qeth_ipa_funcs ipa_func, __u16 cmd_code)
-{
-	int rc;
-	struct qeth_cmd_buffer *iob;
-
-	QETH_CARD_TEXT(card, 4, "simassp6");
-	iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code,
-				       0, QETH_PROT_IPV6);
-	if (!iob)
-		return -ENOMEM;
-	rc = qeth_send_setassparms(card, iob, 0, 0,
-				   qeth_setassparms_cb, NULL);
-	return rc;
-}
-
 static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card)
 {
 	int rc;
@@ -862,16 +846,16 @@ static int qeth_l3_softsetup_ipv6(struct qeth_card *card)
 			QETH_CARD_IFNAME(card));
 		return rc;
 	}
-	rc = qeth_l3_send_simple_setassparms_ipv6(card, IPA_IPV6,
-					       IPA_CMD_ASS_START);
+	rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6,
+					     IPA_CMD_ASS_START, 0);
 	if (rc) {
 		dev_err(&card->gdev->dev,
 			"Activating IPv6 support for %s failed\n",
 			 QETH_CARD_IFNAME(card));
 		return rc;
 	}
-	rc = qeth_l3_send_simple_setassparms_ipv6(card, IPA_PASSTHRU,
-					       IPA_CMD_ASS_START);
+	rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU,
+					     IPA_CMD_ASS_START, 0);
 	if (rc) {
 		dev_warn(&card->gdev->dev,
 			"Enabling the passthrough mode for %s failed\n",
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 07/13] s390/qeth: disregard IPv4 header for RX csum offload
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Julian Wiedmann <jwi@linux.vnet.ibm.com>

The kernel does its own validation of the IPv4 header checksum,
drivers/HW are not required to handle this.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index a8114758075f..2cfeae485a08 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -868,7 +868,6 @@ static inline void qeth_rx_csum(struct qeth_card *card, struct sk_buff *skb,
 				u8 flags)
 {
 	if ((card->dev->features & NETIF_F_RXCSUM) &&
-	    (flags & QETH_HDR_EXT_CSUM_HDR_REQ) &&
 	    (flags & QETH_HDR_EXT_CSUM_TRANSP_REQ))
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 	else
-- 
2.13.5

^ permalink raw reply related

* [PATCH net-next 08/13] s390/qeth: add stats counter for RX csum offload
From: Julian Wiedmann @ 2018-04-26  7:42 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, linux-s390, Martin Schwidefsky, Heiko Carstens,
	Stefan Raspl, Ursula Braun, Julian Wiedmann
In-Reply-To: <20180426074224.100432-1-jwi@linux.ibm.com>

From: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>

This matches the statistics we gather for the TX offload path.

Signed-off-by: Kittipon Meesompop <kmeesomp@linux.vnet.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
---
 drivers/s390/net/qeth_core.h      | 8 ++++++--
 drivers/s390/net/qeth_core_main.c | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 2cfeae485a08..e8108f6891b2 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -148,6 +148,7 @@ struct qeth_perf_stats {
 	unsigned int tx_csum;
 	unsigned int tx_lin;
 	unsigned int tx_linfail;
+	unsigned int rx_csum;
 };
 
 /* Routing stuff */
@@ -868,10 +869,13 @@ static inline void qeth_rx_csum(struct qeth_card *card, struct sk_buff *skb,
 				u8 flags)
 {
 	if ((card->dev->features & NETIF_F_RXCSUM) &&
-	    (flags & QETH_HDR_EXT_CSUM_TRANSP_REQ))
+	    (flags & QETH_HDR_EXT_CSUM_TRANSP_REQ)) {
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
-	else
+		if (card->options.performance_stats)
+			card->perf_stats.rx_csum++;
+	} else {
 		skb->ip_summed = CHECKSUM_NONE;
+	}
 }
 
 static inline void qeth_tx_csum(struct sk_buff *skb, u8 *flags)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 7feb50ac0a8b..b90f38d78ad9 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -6005,7 +6005,8 @@ static struct {
 	{"tx lin"},
 	{"tx linfail"},
 	{"cq handler count"},
-	{"cq handler time"}
+	{"cq handler time"},
+	{"rx csum"}
 };
 
 int qeth_core_get_sset_count(struct net_device *dev, int stringset)
@@ -6067,6 +6068,7 @@ void qeth_core_get_ethtool_stats(struct net_device *dev,
 	data[35] = card->perf_stats.tx_linfail;
 	data[36] = card->perf_stats.cq_cnt;
 	data[37] = card->perf_stats.cq_time;
+	data[38] = card->perf_stats.rx_csum;
 }
 EXPORT_SYMBOL_GPL(qeth_core_get_ethtool_stats);
 
-- 
2.13.5

^ permalink raw reply related


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