Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode
From: Yi Yang @ 2016-12-08  8:20 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, jbenc-H+wXaHxf7aLQT0dZR+AlfA

In ovs compat mode, ovs won't use LWT in current kernel, this is to
make sure ovs can work on the old kernels, Linux kernel v4.7 includes
VxLAN-gpe support but many Linux distributions' kernels are odler than
v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly
on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux
kernel 4.4.0-53-generic.

This does touch compat code, but it is necessary as Pravin commented.

Without this fix, ovs can't create VxLAN-gpe port, it is still a VxLAN
port.

vxlan_sys_4790 Link encap:Ethernet  HWaddr 72:23:60:c2:8b:8d
          inet6 addr: fe80::7023:60ff:fec2:8b8d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:65485  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:8 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

But with this fix applied, a real L3 port is created

vxlan_sys_4790 Link encap:UNSPEC  HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:65485  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Signed-off-by: Yi Yang <yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 include/uapi/linux/openvswitch.h |  1 +
 net/openvswitch/vport-vxlan.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 375d812..b0e27b3 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -265,6 +265,7 @@ enum ovs_vport_attr {
 enum {
 	OVS_VXLAN_EXT_UNSPEC,
 	OVS_VXLAN_EXT_GBP,	/* Flag or __u32 */
+	OVS_VXLAN_EXT_GPE,	/* Flag or __u32 */
 	__OVS_VXLAN_EXT_MAX,
 };
 
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
index 7eb955e..42e46af 100644
--- a/net/openvswitch/vport-vxlan.c
+++ b/net/openvswitch/vport-vxlan.c
@@ -52,6 +52,18 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
 			return -EMSGSIZE;
 
 		nla_nest_end(skb, exts);
+	} else if (vxlan->flags & VXLAN_F_GPE) {
+		struct nlattr *exts;
+
+		exts = nla_nest_start(skb, OVS_TUNNEL_ATTR_EXTENSION);
+		if (!exts)
+			return -EMSGSIZE;
+
+		if (vxlan->flags & VXLAN_F_GPE &&
+		    nla_put_flag(skb, OVS_VXLAN_EXT_GPE))
+			return -EMSGSIZE;
+
+		nla_nest_end(skb, exts);
 	}
 
 	return 0;
@@ -59,6 +71,7 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
 
 static const struct nla_policy exts_policy[OVS_VXLAN_EXT_MAX + 1] = {
 	[OVS_VXLAN_EXT_GBP]	= { .type = NLA_FLAG, },
+	[OVS_VXLAN_EXT_GPE]	= { .type = NLA_FLAG, },
 };
 
 static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr,
@@ -76,6 +89,8 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr,
 
 	if (exts[OVS_VXLAN_EXT_GBP])
 		conf->flags |= VXLAN_F_GBP;
+	else if (exts[OVS_VXLAN_EXT_GPE])
+		conf->flags |= VXLAN_F_GPE;
 
 	return 0;
 }
-- 
1.9.3

^ permalink raw reply related

* Re: [PATCH v3 2/6] net: stmmac: simplify the common DMA init API
From: Alexandre Torgue @ 2016-12-08  8:50 UTC (permalink / raw)
  To: Niklas Cassel, Giuseppe Cavallaro; +Cc: Niklas Cassel, netdev, linux-kernel
In-Reply-To: <1481120409-18103-3-git-send-email-niklass@axis.com>

Hi Niklas,

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> Use struct stmmac_dma_cfg *dma_cfg as an argument rather
> than using all the struct members as individual arguments.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>

Thanks for this patch. You can add my Acked-by.

Regards
Alex


> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h        |  4 ++--
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 13 +++++++------
>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c  |  7 ++++---
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c    | 14 ++++++++------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c   |  6 +-----
>  5 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 3ced2e1703c1..b13a144f72ad 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -412,8 +412,8 @@ extern const struct stmmac_desc_ops ndesc_ops;
>  struct stmmac_dma_ops {
>  	/* DMA core initialization */
>  	int (*reset)(void __iomem *ioaddr);
> -	void (*init)(void __iomem *ioaddr, int pbl, int fb, int mb,
> -		     int aal, u32 dma_tx, u32 dma_rx, int atds);
> +	void (*init)(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg,
> +		     u32 dma_tx, u32 dma_rx, int atds);
>  	/* Configure the AXI Bus Mode Register */
>  	void (*axi)(void __iomem *ioaddr, struct stmmac_axi *axi);
>  	/* Dump DMA registers */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> index f35385266fbf..318ae9f10104 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> @@ -84,8 +84,9 @@ static void dwmac1000_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
>  	writel(value, ioaddr + DMA_AXI_BUS_MODE);
>  }
>
> -static void dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
> -			       int aal, u32 dma_tx, u32 dma_rx, int atds)
> +static void dwmac1000_dma_init(void __iomem *ioaddr,
> +			       struct stmmac_dma_cfg *dma_cfg,
> +			       u32 dma_tx, u32 dma_rx, int atds)
>  {
>  	u32 value = readl(ioaddr + DMA_BUS_MODE);
>
> @@ -101,20 +102,20 @@ static void dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
>  	 */
>  	value |= DMA_BUS_MODE_MAXPBL;
>  	value &= ~DMA_BUS_MODE_PBL_MASK;
> -	value |= (pbl << DMA_BUS_MODE_PBL_SHIFT);
> +	value |= (dma_cfg->pbl << DMA_BUS_MODE_PBL_SHIFT);
>
>  	/* Set the Fixed burst mode */
> -	if (fb)
> +	if (dma_cfg->fixed_burst)
>  		value |= DMA_BUS_MODE_FB;
>
>  	/* Mixed Burst has no effect when fb is set */
> -	if (mb)
> +	if (dma_cfg->mixed_burst)
>  		value |= DMA_BUS_MODE_MB;
>
>  	if (atds)
>  		value |= DMA_BUS_MODE_ATDS;
>
> -	if (aal)
> +	if (dma_cfg->aal)
>  		value |= DMA_BUS_MODE_AAL;
>
>  	writel(value, ioaddr + DMA_BUS_MODE);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> index 61f54c99a7de..e5664da382f3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> @@ -32,11 +32,12 @@
>  #include "dwmac100.h"
>  #include "dwmac_dma.h"
>
> -static void dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
> -			      int aal, u32 dma_tx, u32 dma_rx, int atds)
> +static void dwmac100_dma_init(void __iomem *ioaddr,
> +			      struct stmmac_dma_cfg *dma_cfg,
> +			      u32 dma_tx, u32 dma_rx, int atds)
>  {
>  	/* Enable Application Access by writing to DMA CSR0 */
> -	writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT),
> +	writel(DMA_BUS_MODE_DEFAULT | (dma_cfg->pbl << DMA_BUS_MODE_PBL_SHIFT),
>  	       ioaddr + DMA_BUS_MODE);
>
>  	/* Mask interrupts by writing to CSR7 */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> index e81b6e565c29..7d82a3464097 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> @@ -99,27 +99,29 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr, int pbl,
>  	writel(dma_rx_phy, ioaddr + DMA_CHAN_RX_BASE_ADDR(channel));
>  }
>
> -static void dwmac4_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
> -			    int aal, u32 dma_tx, u32 dma_rx, int atds)
> +static void dwmac4_dma_init(void __iomem *ioaddr,
> +			    struct stmmac_dma_cfg *dma_cfg,
> +			    u32 dma_tx, u32 dma_rx, int atds)
>  {
>  	u32 value = readl(ioaddr + DMA_SYS_BUS_MODE);
>  	int i;
>
>  	/* Set the Fixed burst mode */
> -	if (fb)
> +	if (dma_cfg->fixed_burst)
>  		value |= DMA_SYS_BUS_FB;
>
>  	/* Mixed Burst has no effect when fb is set */
> -	if (mb)
> +	if (dma_cfg->mixed_burst)
>  		value |= DMA_SYS_BUS_MB;
>
> -	if (aal)
> +	if (dma_cfg->aal)
>  		value |= DMA_SYS_BUS_AAL;
>
>  	writel(value, ioaddr + DMA_SYS_BUS_MODE);
>
>  	for (i = 0; i < DMA_CHANNEL_NB_MAX; i++)
> -		dwmac4_dma_init_channel(ioaddr, pbl, dma_tx, dma_rx, i);
> +		dwmac4_dma_init_channel(ioaddr, dma_cfg->pbl,
> +					dma_tx, dma_rx, i);
>  }
>
>  static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 14366800e5e6..b1e42ddf0370 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1595,11 +1595,7 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>  		return ret;
>  	}
>
> -	priv->hw->dma->init(priv->ioaddr,
> -			    priv->plat->dma_cfg->pbl,
> -			    priv->plat->dma_cfg->fixed_burst,
> -			    priv->plat->dma_cfg->mixed_burst,
> -			    priv->plat->dma_cfg->aal,
> +	priv->hw->dma->init(priv->ioaddr, priv->plat->dma_cfg,
>  			    priv->dma_tx_phy, priv->dma_rx_phy, atds);
>
>  	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
>

^ permalink raw reply

* Re: [PATCH net-next] openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode
From: Jiri Benc @ 2016-12-08  8:54 UTC (permalink / raw)
  To: Yi Yang; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1481185210-13056-1-git-send-email-yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Thu,  8 Dec 2016 16:20:10 +0800, Yi Yang wrote:
> In ovs compat mode, ovs won't use LWT in current kernel, this is to
> make sure ovs can work on the old kernels, Linux kernel v4.7 includes
> VxLAN-gpe support but many Linux distributions' kernels are odler than
> v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly
> on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux
> kernel 4.4.0-53-generic.

NAK. We do have a way to configure this and that's rtnetlink. Open
vSwitch should use that to configure tunnels. Out of tree modules are
on their own. Upstream kernel does not accommodate out of tree modules.

 Jiri

^ permalink raw reply

* Re: [PATCH v4 net-next 1/4] bpf: xdp: Allow head adjustment in XDP prog
From: Daniel Borkmann @ 2016-12-08  9:02 UTC (permalink / raw)
  To: Martin KaFai Lau, netdev
  Cc: Alexei Starovoitov, Brenden Blanco, David Miller, Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend, Saeed Mahameed,
	Tariq Toukan, Kernel Team
In-Reply-To: <1481154794-2311034-2-git-send-email-kafai@fb.com>

On 12/08/2016 12:53 AM, Martin KaFai Lau wrote:
> This patch allows XDP prog to extend/remove the packet
> data at the head (like adding or removing header).  It is
> done by adding a new XDP helper bpf_xdp_adjust_head().
>
> It also renames bpf_helper_changes_skb_data() to
> bpf_helper_changes_pkt_data() to better reflect
> that XDP prog does not work on skb.
>
> This patch adds one "xdp_adjust_head" bit to bpf_prog for the
> XDP-capable driver to check if the XDP prog requires
> bpf_xdp_adjust_head() support.  The driver can then decide
> to error out during XDP_SETUP_PROG.
>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

^ permalink raw reply

* Re: [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT binding
From: Alexandre Torgue @ 2016-12-08  9:02 UTC (permalink / raw)
  To: Niklas Cassel, Giuseppe Cavallaro; +Cc: Niklas Cassel, netdev, linux-kernel
In-Reply-To: <1481120409-18103-4-git-send-email-niklass@axis.com>

Hi Niklas

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with DT")
> changed the parsing of the DT binding.
>
> Before 64c3b252e9fc, snps,fixed-burst and snps,mixed-burst were parsed
> regardless if the property snps,pbl existed or not.
> After the commit, fixed burst and mixed burst are only parsed if
> snps,pbl exists. Now when snps,aal has been added, it too is only
> parsed if snps,pbl exists.
>
> Since the DT binding does not specify that fixed burst, mixed burst
> or aal depend on snps,pbl being specified, undo changes introduced
> by 64c3b252e9fc.
>
> The issue commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with
> DT") tries to address is solved in another way:
> The databook specifies that all values other than
> 1, 2, 4, 8, 16, or 32 results in undefined behavior,
> so snps,pbl = <0> is invalid.
>
> If pbl is 0 after parsing, set pbl to DEFAULT_DMA_PBL.
> This handles the case where the property is omitted, and also handles
> the case where the property is specified without any data.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  4 +--
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 29 +++++++++++-----------
>  2 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b1e42ddf0370..b5188122bc15 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1581,8 +1581,8 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>  	int atds = 0;
>  	int ret = 0;
>
> -	if (!priv->plat->dma_cfg) {
> -		dev_err(priv->device, "DMA configuration not found\n");
> +	if (!priv->plat->dma_cfg || !priv->plat->dma_cfg->pbl) {

How "priv->plat->dma_cfg->pbl" could be equal to 0 if you force it to 
DEFAULT_DMA_PBL in "stmmac_probe_config_dt" in case of DT doesn't set 
pbl value?


> +		dev_err(priv->device, "Invalid DMA configuration\n");
>  		return -EINVAL;
>  	}
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index d3b6f92f350a..81800f23a9c4 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -304,21 +304,22 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>  		plat->force_sf_dma_mode = 1;
>  	}
>
> -	if (of_find_property(np, "snps,pbl", NULL)) {
> -		dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
> -				       GFP_KERNEL);
> -		if (!dma_cfg) {
> -			stmmac_remove_config_dt(pdev, plat);
> -			return ERR_PTR(-ENOMEM);
> -		}
> -		plat->dma_cfg = dma_cfg;
> -		of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
> -		dma_cfg->aal = of_property_read_bool(np, "snps,aal");
> -		dma_cfg->fixed_burst =
> -			of_property_read_bool(np, "snps,fixed-burst");
> -		dma_cfg->mixed_burst =
> -			of_property_read_bool(np, "snps,mixed-burst");
> +	dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
> +			       GFP_KERNEL);
> +	if (!dma_cfg) {
> +		stmmac_remove_config_dt(pdev, plat);
> +		return ERR_PTR(-ENOMEM);
>  	}
> +	plat->dma_cfg = dma_cfg;
> +
> +	of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
> +	if (!dma_cfg->pbl)
> +		dma_cfg->pbl = DEFAULT_DMA_PBL;
> +
> +	dma_cfg->aal = of_property_read_bool(np, "snps,aal");
> +	dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
> +	dma_cfg->mixed_burst = of_property_read_bool(np, "snps,mixed-burst");
> +
>  	plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
>  	if (plat->force_thresh_dma_mode) {
>  		plat->force_sf_dma_mode = 0;
>

^ permalink raw reply

* Re: 4.9.0-rc8: tg3 dead after resume
From: Siva Reddy Kallam @ 2016-12-08  9:03 UTC (permalink / raw)
  To: Billy Shuman; +Cc: Michael Chan, Netdev

On Thu, Dec 8, 2016 at 12:14 AM, Billy Shuman <wshuman3@gmail.com> wrote:
> On Wed, Dec 7, 2016 at 12:37 PM, Michael Chan <michael.chan@broadcom.com> wrote:
>> On Wed, Dec 7, 2016 at 7:20 AM, Billy Shuman <wshuman3@gmail.com> wrote:
>>> After resume on 4.9.0-rc8 tg3 is dead.
>>>
>>> In logs I see:
>>> kernel: tg3 0000:44:00.0: phy probe failed, err -19
>>> kernel: tg3 0000:44:00.0: Problem fetching invariants of chip, aborting
>>
>> -19 is -ENODEV which means tg3 cannot read the PHY ID.
>>
>> If it's a true suspend/resume operation, the driver does not have to
>> go through probe during resume.  Please explain how you do
>> suspend/resume.
>>
>
> Sorry my previous message was accidentally sent to early.
>
> I used systemd (systemctl suspend) to suspend.
>
We need more information to proceed further.
Without suspend, Are you able to use the tg3 port?
Which Broadcom card are you having in laptop?
Please provide complete tg3 specific logs in dmesg.

>> Did this work before?  There has been very few changes to tg3 recently.
>>
>
> This is a new laptop for me, but the same behavior is seen on 4.4.36 and 4.8.12.
>
>>>
>>> rmmod and modprobe does not fix the problem only a reboot resolves the issue.
>>>
>>> Billy

^ permalink raw reply

* Re: [PATCH v3 4/6] net: stmmac: dwmac1000: fix define DMA_BUS_MODE_RPBL_MASK
From: Alexandre Torgue @ 2016-12-08  9:12 UTC (permalink / raw)
  To: Niklas Cassel, Giuseppe Cavallaro; +Cc: Niklas Cassel, netdev, linux-kernel
In-Reply-To: <1481120409-18103-5-git-send-email-niklass@axis.com>

Hi Niklas

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> DMA_BUS_MODE_RPBL_MASK is really 6 bits,
> just like DMA_BUS_MODE_PBL_MASK.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
> index ff3e5ab39bd0..52b9407a8a39 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
> @@ -225,7 +225,7 @@ enum rx_tx_priority_ratio {
>
>  #define DMA_BUS_MODE_FB		0x00010000	/* Fixed burst */
>  #define DMA_BUS_MODE_MB		0x04000000	/* Mixed burst */
> -#define DMA_BUS_MODE_RPBL_MASK	0x003e0000	/* Rx-Programmable Burst Len */
> +#define DMA_BUS_MODE_RPBL_MASK	0x007e0000	/* Rx-Programmable Burst Len */

Well spot. You can add my Acked-by.

Regards
Alex

>  #define DMA_BUS_MODE_RPBL_SHIFT	17
>  #define DMA_BUS_MODE_USP	0x00800000
>  #define DMA_BUS_MODE_MAXPBL	0x01000000
>

^ permalink raw reply

* Re: [PATCH] vhost-vsock: fix orphan connection reset
From: Stefan Hajnoczi @ 2016-12-08  9:19 UTC (permalink / raw)
  To: Peng Tao; +Cc: Stefan Hajnoczi, netdev, stable, kvm, virtualization
In-Reply-To: <1481103947-76771-1-git-send-email-bergwolf@gmail.com>

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

On Wed, Dec 07, 2016 at 05:45:47PM +0800, Peng Tao wrote:
> local_addr.svm_cid is host cid. We should check guest cid instead,
> which is remote_addr.svm_cid.
> 
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: stable@vger.kernel.org #4.8+
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  drivers/vhost/vsock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

^ permalink raw reply

* Re: [PATCH v2 4/4] vsock: cancel packets when failing to connect
From: Stefan Hajnoczi @ 2016-12-08  9:24 UTC (permalink / raw)
  To: Peng Tao; +Cc: netdev, Jorgen Hansen, kvm, Stefan Hajnoczi, virtualization
In-Reply-To: <1481123652-80603-5-git-send-email-bergwolf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4076 bytes --]

On Wed, Dec 07, 2016 at 11:14:12PM +0800, Peng Tao wrote:
> Otherwise we'll leave the packets queued until releasing vsock device.
> E.g., if guest is slow to start up, resulting ETIMEDOUT on connect, guest
> will get the connect requests from failed host sockets.
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  include/linux/virtio_vsock.h            | 7 +++++++
>  net/vmw_vsock/af_vsock.c                | 7 +++++++
>  net/vmw_vsock/virtio_transport_common.c | 7 -------
>  3 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> index b92e88d..ff6850a 100644
> --- a/include/linux/virtio_vsock.h
> +++ b/include/linux/virtio_vsock.h
> @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs
>  u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted);
>  void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit);
>  
> +static inline const struct virtio_transport *virtio_transport_get_ops(void)
> +{
> +	const struct vsock_transport *t = vsock_core_get_transport();
> +
> +	return container_of(t, struct virtio_transport, transport);
> +}
> +
>  #endif /* _LINUX_VIRTIO_VSOCK_H */
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index 8a398b3..ebb50d6 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -104,6 +104,7 @@
>  #include <linux/unistd.h>
>  #include <linux/wait.h>
>  #include <linux/workqueue.h>
> +#include <linux/virtio_vsock.h>
>  #include <net/sock.h>
>  #include <net/af_vsock.h>
>  
> @@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
>  {
>  	struct sock *sk;
>  	struct vsock_sock *vsk;
> +	int cancel = 0;
>  
>  	vsk = container_of(work, struct vsock_sock, dwork.work);
>  	sk = sk_vsock(vsk);
> @@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
>  		sk->sk_state = SS_UNCONNECTED;
>  		sk->sk_err = ETIMEDOUT;
>  		sk->sk_error_report(sk);
> +		cancel = 1;
>  	}
>  	release_sock(sk);
> +	if (cancel)
> +		virtio_transport_get_ops()->cancel_pkt(vsk);

This doesn't work with the VMCI transport.  Remember af_vsock.c is
common code shared by all transports.

You need to add a struct vsock_transport->cancel_pkt() callback instead
os a struct virtio_transport->cancel_pkt() callback.  And you need to
handle the case where cancel_pkt == NULL if you don't implement it for
VMCI.

>  
>  	sock_put(sk);
>  }
> @@ -1223,11 +1228,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,
>  			err = sock_intr_errno(timeout);
>  			sk->sk_state = SS_UNCONNECTED;
>  			sock->state = SS_UNCONNECTED;
> +			virtio_transport_get_ops()->cancel_pkt(vsk);
>  			goto out_wait;
>  		} else if (timeout == 0) {
>  			err = -ETIMEDOUT;
>  			sk->sk_state = SS_UNCONNECTED;
>  			sock->state = SS_UNCONNECTED;
> +			virtio_transport_get_ops()->cancel_pkt(vsk);
>  			goto out_wait;
>  		}
>  
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index cc1eeb5..72c5dff 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -25,13 +25,6 @@
>  /* How long to wait for graceful shutdown of a connection */
>  #define VSOCK_CLOSE_TIMEOUT (8 * HZ)
>  
> -static const struct virtio_transport *virtio_transport_get_ops(void)
> -{
> -	const struct vsock_transport *t = vsock_core_get_transport();
> -
> -	return container_of(t, struct virtio_transport, transport);
> -}
> -
>  struct virtio_vsock_pkt *
>  virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info,
>  			   size_t len,
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: [PATCH v2 1/4] vsock: track pkt owner vsock
From: Stefan Hajnoczi @ 2016-12-08  9:30 UTC (permalink / raw)
  To: Peng Tao; +Cc: netdev, kvm, Stefan Hajnoczi, virtualization
In-Reply-To: <1481123652-80603-2-git-send-email-bergwolf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1013 bytes --]

On Wed, Dec 07, 2016 at 11:14:09PM +0800, Peng Tao wrote:
> So that we can cancel a queued pkt later if necessary.
> 
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  include/linux/virtio_vsock.h            | 2 ++
>  net/vmw_vsock/virtio_transport_common.c | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> index 9638bfe..6dd3242 100644
> --- a/include/linux/virtio_vsock.h
> +++ b/include/linux/virtio_vsock.h
> @@ -48,6 +48,7 @@ struct virtio_vsock_pkt {
>  	struct virtio_vsock_hdr	hdr;
>  	struct work_struct work;
>  	struct list_head list;
> +	struct vsock_sock *vsk;

To prevent future bugs, please add a comment here:
/* socket refcnt not held, only use for cancellation */

This field is just an opaque token used for cancellation rather than a
struct vsock_sock pointer that we are allowed to dereference.  You could
change this field to void *cancel_token to make the code harder to
misuse.

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

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: [PATCH net-next] udp: under rx pressure, try to condense skbs
From: Jesper Dangaard Brouer @ 2016-12-08  9:46 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: brouer, David Miller, netdev, Paolo Abeni
In-Reply-To: <1481131173.4930.36.camel@edumazet-glaptop3.roam.corp.google.com>

On Wed, 07 Dec 2016 09:19:33 -0800
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> From: Eric Dumazet <edumazet@google.com>
> 
> Under UDP flood, many softirq producers try to add packets to
> UDP receive queue, and one user thread is burning one cpu trying
> to dequeue packets as fast as possible.
> 
> Two parts of the per packet cost are :
> - copying payload from kernel space to user space,
> - freeing memory pieces associated with skb.
> 
> If socket is under pressure, softirq handler(s) can try to pull in
> skb->head the payload of the packet if it fits.
> 
> Meaning the softirq handler(s) can free/reuse the page fragment
> immediately, instead of letting udp_recvmsg() do this hundreds of usec
> later, possibly from another node.
> 
> 
> Additional gains :
> - We reduce skb->truesize and thus can store more packets per SO_RCVBUF
> - We avoid cache line misses at copyout() time and consume_skb() time,
> and avoid one put_page() with potential alien freeing on NUMA hosts.
> 
> This comes at the cost of a copy, bounded to available tail room, which
> is usually small. (We might have to fix GRO_MAX_HEAD which looks bigger
> than necessary)
> 
> This patch gave me about 5 % increase in throughput in my tests.

Hmmm... I'm not thrilled to have such heuristics, that change memory
behavior when half of the queue size (sk->sk_rcvbuf) is reached.

Most of the win comes from doing a local atomic page-refcnt decrement
oppose to doing a remote CPU refcnf-dec.  And as you noticed the
benefit is quite high saving 241 cycles (see [1]).  And you patch is
"using" these cycles to copy the packet instead.

This might no be a win in the future.  I'm working on a more generic
solution (page_pool) that (as one objective) target this remote recfnt.


[1] https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/mm/bench/page_bench03.c
 Measured on: i7-4790K CPU @ 4.00GHz
 Same CPU release cost  : 251 cycles
 Remote CPU release cost: 492 cycles

 
> skb_condense() helper could probably used in other contexts.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
> ---
[...]
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index b45cd1494243fc99686016949f4546dbba11f424..84151cf40aebb973bad5bee3ee4be0758084d83c 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4931,3 +4931,31 @@ struct sk_buff *pskb_extract(struct sk_buff *skb, int off,
>  EXPORT_SYMBOL(pskb_extract);
> +
> +/**
> + * skb_condense - try to get rid of fragments/frag_list if possible
> + * @skb: buffer
> + *
> + * Can be used to save memory before skb is added to a busy queue.
> + * If packet has bytes in frags and enough tail room in skb->head,
> + * pull all of them, so that we can free the frags right now and adjust
> + * truesize.
> + * Notes:
> + *	We do not reallocate skb->head thus can not fail.
> + *	Caller must re-evaluate skb->truesize if needed.
> + */
> +void skb_condense(struct sk_buff *skb)
> +{
> +	if (!skb->data_len ||
> +	    skb->data_len > skb->end - skb->tail ||
> +	    skb_cloned(skb))
> +		return;

So this only active, depending on how driver constructed the SKB, but
all end-up doing a function call (not inlined).

> +	/* Nice, we can free page frag(s) right now */
> +	__pskb_pull_tail(skb, skb->data_len);
> +
> +	/* Now adjust skb->truesize, since __pskb_pull_tail() does
> +	 * not do this.
> +	 */
> +	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
> +}
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 16d88ba9ff1c402f77063cfb5eea2708d86da2fc..f5628ada47b53f0d92d08210e5d7e4132a107f73 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
[...]
> @@ -1208,6 +1208,16 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
>  	if (rmem > sk->sk_rcvbuf)
>  		goto drop;
>  
> +	/* Under mem pressure, it might be helpful to help udp_recvmsg()
> +	 * having linear skbs :
> +	 * - Reduce memory overhead and thus increase receive queue capacity
> +	 * - Less cache line misses at copyout() time
> +	 * - Less work at consume_skb() (less alien page frag freeing)
> +	 */
> +	if (rmem > (sk->sk_rcvbuf >> 1))
> +		skb_condense(skb);
> +	size = skb->truesize;
> +



-- 
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 v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT binding
From: Niklas Cassel @ 2016-12-08  9:46 UTC (permalink / raw)
  To: Alexandre Torgue, Giuseppe Cavallaro; +Cc: netdev, linux-kernel
In-Reply-To: <62474778-78da-d34e-bc36-022b2206a8db@st.com>

On 12/08/2016 10:02 AM, Alexandre Torgue wrote:
> Hi Niklas
>
> On 12/07/2016 03:20 PM, Niklas Cassel wrote:
>> From: Niklas Cassel <niklas.cassel@axis.com>
>>
>> commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with DT")
>> changed the parsing of the DT binding.
>>
>> Before 64c3b252e9fc, snps,fixed-burst and snps,mixed-burst were parsed
>> regardless if the property snps,pbl existed or not.
>> After the commit, fixed burst and mixed burst are only parsed if
>> snps,pbl exists. Now when snps,aal has been added, it too is only
>> parsed if snps,pbl exists.
>>
>> Since the DT binding does not specify that fixed burst, mixed burst
>> or aal depend on snps,pbl being specified, undo changes introduced
>> by 64c3b252e9fc.
>>
>> The issue commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with
>> DT") tries to address is solved in another way:
>> The databook specifies that all values other than
>> 1, 2, 4, 8, 16, or 32 results in undefined behavior,
>> so snps,pbl = <0> is invalid.
>>
>> If pbl is 0 after parsing, set pbl to DEFAULT_DMA_PBL.
>> This handles the case where the property is omitted, and also handles
>> the case where the property is specified without any data.
>>
>> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
>> ---
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  4 +--
>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 29 +++++++++++-----------
>>  2 files changed, 17 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index b1e42ddf0370..b5188122bc15 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -1581,8 +1581,8 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>>      int atds = 0;
>>      int ret = 0;
>>
>> -    if (!priv->plat->dma_cfg) {
>> -        dev_err(priv->device, "DMA configuration not found\n");
>> +    if (!priv->plat->dma_cfg || !priv->plat->dma_cfg->pbl) {
>
> How "priv->plat->dma_cfg->pbl" could be equal to 0 if you force it to DEFAULT_DMA_PBL in "stmmac_probe_config_dt" in case of DT doesn't set pbl value?

The PCI glue code does not call stmmac_probe_config_dt.

Also any glue driver could override the value set by stmmac_probe_config_dt
before calling stmmac_dvr_probe. So I guess if we want any trustworthy
sanity-checking, it actually has to be done in stmmac_main.c.


>
>
>> +        dev_err(priv->device, "Invalid DMA configuration\n");
>>          return -EINVAL;
>>      }
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> index d3b6f92f350a..81800f23a9c4 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>> @@ -304,21 +304,22 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>>          plat->force_sf_dma_mode = 1;
>>      }
>>
>> -    if (of_find_property(np, "snps,pbl", NULL)) {
>> -        dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
>> -                       GFP_KERNEL);
>> -        if (!dma_cfg) {
>> -            stmmac_remove_config_dt(pdev, plat);
>> -            return ERR_PTR(-ENOMEM);
>> -        }
>> -        plat->dma_cfg = dma_cfg;
>> -        of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
>> -        dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>> -        dma_cfg->fixed_burst =
>> -            of_property_read_bool(np, "snps,fixed-burst");
>> -        dma_cfg->mixed_burst =
>> -            of_property_read_bool(np, "snps,mixed-burst");
>> +    dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
>> +                   GFP_KERNEL);
>> +    if (!dma_cfg) {
>> +        stmmac_remove_config_dt(pdev, plat);
>> +        return ERR_PTR(-ENOMEM);
>>      }
>> +    plat->dma_cfg = dma_cfg;
>> +
>> +    of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
>> +    if (!dma_cfg->pbl)
>> +        dma_cfg->pbl = DEFAULT_DMA_PBL;
>> +
>> +    dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>> +    dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
>> +    dma_cfg->mixed_burst = of_property_read_bool(np, "snps,mixed-burst");
>> +
>>      plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
>>      if (plat->force_thresh_dma_mode) {
>>          plat->force_sf_dma_mode = 0;
>>

^ permalink raw reply

* Re: [PATCH v2 2/4] vhost-vsock: add pkt cancel capability
From: Stefan Hajnoczi @ 2016-12-08  9:51 UTC (permalink / raw)
  To: Peng Tao; +Cc: netdev, kvm, Stefan Hajnoczi, virtualization
In-Reply-To: <1481123652-80603-3-git-send-email-bergwolf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 383 bytes --]

On Wed, Dec 07, 2016 at 11:14:10PM +0800, Peng Tao wrote:
> To allow canceling all packets of a connection.
> 
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  drivers/vhost/vsock.c        | 41 +++++++++++++++++++++++++++++++++++++++++
>  include/linux/virtio_vsock.h |  3 +++
>  2 files changed, 44 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: commit : ppp: add rtnetlink device creation support - breaks netcf on my machine.
From: Guillaume Nault @ 2016-12-08  9:54 UTC (permalink / raw)
  To: Brad Campbell
  Cc: Thomas Haller, Dan Williams, netdev, Thomas Graf, David Miller
In-Reply-To: <ad3f11b0-6814-4589-5b31-028d889237f0@fnarfbargle.com>

On Thu, Dec 08, 2016 at 10:29:44AM +0800, Brad Campbell wrote:
> On 08/12/16 01:43, Thomas Haller wrote:
> > On Tue, 2016-12-06 at 17:12 -0600, Dan Williams wrote:
> > > 
> > > > libnl1 rejects the IFLA_INFO_DATA attribute because it expects it
> > > > to
> > > > contain a sub-attribute. Since the payload size is zero it doesn't
> > > > match the policy and parsing fails.
> > > > 
> > > > There's no problem with libnl3 because its policy accepts empty
> > > > payloads for NLA_NESTED attributes (see libnl3 commit 4be02ace4826
> > 
> > Hi,
> > 
> > libnl1 is unmaintained these days. I don't think it makes sense to
> > backport that patch. The last upstream release was 3+ years ago, with
> > no upstream development since then.
> > 
> > IMHO netcf should drop libnl-1 support.
> > 
> 
> G'day Thomas,
> 
> I'm not sure anyone was suggesting fixing libnl1, it was more around a
> discussion with regard to a change in the kernel breaking old userspace and
> whether it needs to be fixed in the kernel.
> 
Yes, I could add a sub-attribute in IFLA_INFO_DATA (e.g. the PPP unit).
That'd be enough to make libnl1 happy. But that wouldn't make much
sense if not backported to stable kernel versions. Given that the
netlink message is already properly formatted and that the problem only
appears with an obsolete library, I'm not sure that's worth it.

Proper message parsing is a must, or we'd loose the extensibility
proprety of netlink (which was the fundamental reason for creating it
in the first place). So for now, I prefer to leave the code as is,
unless someone asks me otherwise.

> Personally, now I have a solution to *my* immediate problem (that being any
> kernel 4.7 or later prevented libvirtd starting on my servers because my
> netcf was compiled against libnl1) I can upgrade the relevant userspace
> components to work around the issue.
> 
> Also, now this issue is a number of months old and I appear to be the only
> person reporting it, maybe it's not worth tackling. I would absolutely say
> that netcf needs to drop libnl1 now though as it *is* broken on newer
> kernels under the right circumstances.
> 
> I appreciate the assistance in tracking it down anyway. Thanks guys.
> 
You're welcome. Thanks for your clear and detailed report.

Regards,

Guillaume

^ permalink raw reply

* Re: [PATCH v3 3/6] net: stmmac: stmmac_platform: fix parsing of DT binding
From: Alexandre Torgue @ 2016-12-08  9:54 UTC (permalink / raw)
  To: Niklas Cassel, Giuseppe Cavallaro; +Cc: netdev, linux-kernel
In-Reply-To: <3f1ee075-0c21-f162-451d-e87882f8f55e@axis.com>

Hi

On 12/08/2016 10:46 AM, Niklas Cassel wrote:
> On 12/08/2016 10:02 AM, Alexandre Torgue wrote:
>> Hi Niklas
>>
>> On 12/07/2016 03:20 PM, Niklas Cassel wrote:
>>> From: Niklas Cassel <niklas.cassel@axis.com>
>>>
>>> commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with DT")
>>> changed the parsing of the DT binding.
>>>
>>> Before 64c3b252e9fc, snps,fixed-burst and snps,mixed-burst were parsed
>>> regardless if the property snps,pbl existed or not.
>>> After the commit, fixed burst and mixed burst are only parsed if
>>> snps,pbl exists. Now when snps,aal has been added, it too is only
>>> parsed if snps,pbl exists.
>>>
>>> Since the DT binding does not specify that fixed burst, mixed burst
>>> or aal depend on snps,pbl being specified, undo changes introduced
>>> by 64c3b252e9fc.
>>>
>>> The issue commit 64c3b252e9fc ("net: stmmac: fixed the pbl setting with
>>> DT") tries to address is solved in another way:
>>> The databook specifies that all values other than
>>> 1, 2, 4, 8, 16, or 32 results in undefined behavior,
>>> so snps,pbl = <0> is invalid.
>>>
>>> If pbl is 0 after parsing, set pbl to DEFAULT_DMA_PBL.
>>> This handles the case where the property is omitted, and also handles
>>> the case where the property is specified without any data.
>>>
>>> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
>>> ---
>>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  4 +--
>>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 29 +++++++++++-----------
>>>  2 files changed, 17 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> index b1e42ddf0370..b5188122bc15 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> @@ -1581,8 +1581,8 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>>>      int atds = 0;
>>>      int ret = 0;
>>>
>>> -    if (!priv->plat->dma_cfg) {
>>> -        dev_err(priv->device, "DMA configuration not found\n");
>>> +    if (!priv->plat->dma_cfg || !priv->plat->dma_cfg->pbl) {
>>
>> How "priv->plat->dma_cfg->pbl" could be equal to 0 if you force it to DEFAULT_DMA_PBL in "stmmac_probe_config_dt" in case of DT doesn't set pbl value?
>
> The PCI glue code does not call stmmac_probe_config_dt.
>
> Also any glue driver could override the value set by stmmac_probe_config_dt
> before calling stmmac_dvr_probe. So I guess if we want any trustworthy
> sanity-checking, it actually has to be done in stmmac_main.c.

Ok I see, it is more safe. You can add my Acked-by.

Thanks
Alex

>
>
>>
>>
>>> +        dev_err(priv->device, "Invalid DMA configuration\n");
>>>          return -EINVAL;
>>>      }
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> index d3b6f92f350a..81800f23a9c4 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
>>> @@ -304,21 +304,22 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>>>          plat->force_sf_dma_mode = 1;
>>>      }
>>>
>>> -    if (of_find_property(np, "snps,pbl", NULL)) {
>>> -        dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
>>> -                       GFP_KERNEL);
>>> -        if (!dma_cfg) {
>>> -            stmmac_remove_config_dt(pdev, plat);
>>> -            return ERR_PTR(-ENOMEM);
>>> -        }
>>> -        plat->dma_cfg = dma_cfg;
>>> -        of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
>>> -        dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>>> -        dma_cfg->fixed_burst =
>>> -            of_property_read_bool(np, "snps,fixed-burst");
>>> -        dma_cfg->mixed_burst =
>>> -            of_property_read_bool(np, "snps,mixed-burst");
>>> +    dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
>>> +                   GFP_KERNEL);
>>> +    if (!dma_cfg) {
>>> +        stmmac_remove_config_dt(pdev, plat);
>>> +        return ERR_PTR(-ENOMEM);
>>>      }
>>> +    plat->dma_cfg = dma_cfg;
>>> +
>>> +    of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
>>> +    if (!dma_cfg->pbl)
>>> +        dma_cfg->pbl = DEFAULT_DMA_PBL;
>>> +
>>> +    dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>>> +    dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
>>> +    dma_cfg->mixed_burst = of_property_read_bool(np, "snps,mixed-burst");
>>> +
>>>      plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
>>>      if (plat->force_thresh_dma_mode) {
>>>          plat->force_sf_dma_mode = 0;
>>>
>

^ permalink raw reply

* Re: [PATCH v2 3/4] vsock: add pkt cancel capability
From: Stefan Hajnoczi @ 2016-12-08  9:54 UTC (permalink / raw)
  To: Peng Tao; +Cc: netdev, kvm, Stefan Hajnoczi, virtualization
In-Reply-To: <1481123652-80603-4-git-send-email-bergwolf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 281 bytes --]

On Wed, Dec 07, 2016 at 11:14:11PM +0800, Peng Tao wrote:
> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> ---
>  net/vmw_vsock/virtio_transport.c | 42 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* Re: [RFC PATCH net-next v3 1/2] macb: Add 1588 support in Cadence GEM.
From: Nicolas Ferre @ 2016-12-08  9:59 UTC (permalink / raw)
  To: Richard Cochran, Andrei Pistirica
  Cc: netdev, linux-kernel, linux-arm-kernel, davem, harinikatakamlinux,
	harini.katakam, punnaia, michals, anirudh, boris.brezillon,
	alexandre.belloni, tbultel, rafalo
In-Reply-To: <20161207193908.GA13062@netboy>

Le 07/12/2016 à 20:39, Richard Cochran a écrit :
> On Wed, Dec 07, 2016 at 08:21:51PM +0200, Andrei Pistirica wrote:
>> +#ifdef CONFIG_MACB_USE_HWSTAMP
>> +void gem_ptp_init(struct net_device *ndev);
>> +void gem_ptp_remove(struct net_device *ndev);
>> +
>> +void gem_ptp_do_txstamp(struct macb *bp, struct sk_buff *skb);
>> +void gem_ptp_do_rxstamp(struct macb *bp, struct sk_buff *skb);
> 
> These are in the hot path, and so you should do the test before
> calling the global function, something like this:
> 
> void gem_ptp_txstamp(struct macb *bp, struct sk_buff *skb);
> 
> static void gem_ptp_do_txstamp(struct macb *bp, struct sk_buff *skb)
> {
> 	if (!bp->hwts_tx_en)
> 		return;
> 	gem_ptp_txstamp(bp, skb);
> }
> 
> Ditto for Rx.

Hi Richard,

So you mean that as the "global" function won't be "inlined" by the
compiler as the function is not "static" neither in the same file and
that the jump will be implemented anyway. And this even if the function
is only called at a single location...

This way, if we add a kind or accessors function like the one that you
propose, with the test in it, the branch prediction can play his role
without breaking the processor pipeline as the accessors function will
be inlined by the compiler: Am I right?

So, yes, makes sense. Thanks for the hint.

Regards,
-- 
Nicolas Ferre

^ permalink raw reply

* Re: [PATCH v3 5/6] net: stmmac: add support for independent DMA pbl for tx/rx
From: Alexandre Torgue @ 2016-12-08 10:30 UTC (permalink / raw)
  To: Niklas Cassel, Rob Herring, Mark Rutland, Jonathan Corbet,
	Giuseppe Cavallaro, David S. Miller, Phil Reid, Eric Engestrom,
	Pavel Machek, Joachim Eastwood, Andreas Färber,
	Vincent Palatin, Gabriel Fernandez
  Cc: Niklas Cassel, netdev, devicetree, linux-kernel, linux-doc
In-Reply-To: <1481120409-18103-6-git-send-email-niklass@axis.com>

Hi Niklas

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> GMAC and newer supports independent programmable burst lengths for
> DMA tx/rx. Add new optional devicetree properties representing this.
>
> To be backwards compatible, snps,pbl will still be valid, but
> snps,txpbl/snps,rxpbl will override the value in snps,pbl if set.
>
> If the IP is synthesized to use the AXI interface, there is a register
> and a matching DT property inside the optional stmmac-axi-config DT node
> for controlling burst lengths, named snps,blen.
> However, using this register, it is not possible to control tx and rx
> independently. Also, this register is not available if the IP was
> synthesized with, e.g., the AHB interface.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>

Thanks, you can add my Acked-by.

Regards
Alex

> ---
>  Documentation/devicetree/bindings/net/stmmac.txt      |  6 +++++-
>  Documentation/networking/stmmac.txt                   | 19 +++++++++++++------
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c   | 12 ++++++------
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c      | 12 +++++++-----
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c |  2 ++
>  include/linux/stmmac.h                                |  2 ++
>  6 files changed, 35 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
> index b95ff998ba73..8080038ff1b2 100644
> --- a/Documentation/devicetree/bindings/net/stmmac.txt
> +++ b/Documentation/devicetree/bindings/net/stmmac.txt
> @@ -34,7 +34,11 @@ Optional properties:
>    platforms.
>  - tx-fifo-depth: See ethernet.txt file in the same directory
>  - rx-fifo-depth: See ethernet.txt file in the same directory
> -- snps,pbl		Programmable Burst Length
> +- snps,pbl		Programmable Burst Length (tx and rx)
> +- snps,txpbl		Tx Programmable Burst Length. Only for GMAC and newer.
> +			If set, DMA tx will use this value rather than snps,pbl.
> +- snps,rxpbl		Rx Programmable Burst Length. Only for GMAC and newer.
> +			If set, DMA rx will use this value rather than snps,pbl.
>  - snps,aal		Address-Aligned Beats
>  - snps,fixed-burst	Program the DMA to use the fixed burst mode
>  - snps,mixed-burst	Program the DMA to use the mixed burst mode
> diff --git a/Documentation/networking/stmmac.txt b/Documentation/networking/stmmac.txt
> index 014f4f756cb7..6add57374f70 100644
> --- a/Documentation/networking/stmmac.txt
> +++ b/Documentation/networking/stmmac.txt
> @@ -153,7 +153,8 @@ Where:
>     o pbl: the Programmable Burst Length is maximum number of beats to
>         be transferred in one DMA transaction.
>         GMAC also enables the 4xPBL by default.
> -   o fixed_burst/mixed_burst/burst_len
> +   o txpbl/rxpbl: GMAC and newer supports independent DMA pbl for tx/rx.
> +   o fixed_burst/mixed_burst/aal
>   o clk_csr: fixed CSR Clock range selection.
>   o has_gmac: uses the GMAC core.
>   o enh_desc: if sets the MAC will use the enhanced descriptor structure.
> @@ -205,16 +206,22 @@ tuned according to the HW capabilities.
>
>  struct stmmac_dma_cfg {
>  	int pbl;
> +	int txpbl;
> +	int rxpbl;
>  	int fixed_burst;
> -	int burst_len_supported;
> +	int mixed_burst;
> +	bool aal;
>  };
>
>  Where:
> - o pbl: Programmable Burst Length
> + o pbl: Programmable Burst Length (tx and rx)
> + o txpbl: Transmit Programmable Burst Length. Only for GMAC and newer.
> +	 If set, DMA tx will use this value rather than pbl.
> + o rxpbl: Receive Programmable Burst Length. Only for GMAC and newer.
> +	 If set, DMA rx will use this value rather than pbl.
>   o fixed_burst: program the DMA to use the fixed burst mode
> - o burst_len: this is the value we put in the register
> -	      supported values are provided as macros in
> -	      linux/stmmac.h header file.
> + o mixed_burst: program the DMA to use the mixed burst mode
> + o aal: Address-Aligned Beats
>
>  ---
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> index 318ae9f10104..99b8040af592 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> @@ -89,20 +89,20 @@ static void dwmac1000_dma_init(void __iomem *ioaddr,
>  			       u32 dma_tx, u32 dma_rx, int atds)
>  {
>  	u32 value = readl(ioaddr + DMA_BUS_MODE);
> +	int txpbl = dma_cfg->txpbl ?: dma_cfg->pbl;
> +	int rxpbl = dma_cfg->rxpbl ?: dma_cfg->pbl;
>
>  	/*
>  	 * Set the DMA PBL (Programmable Burst Length) mode.
>  	 *
>  	 * Note: before stmmac core 3.50 this mode bit was 4xPBL, and
>  	 * post 3.5 mode bit acts as 8*PBL.
> -	 *
> -	 * This configuration doesn't take care about the Separate PBL
> -	 * so only the bits: 13-8 are programmed with the PBL passed from the
> -	 * platform.
>  	 */
>  	value |= DMA_BUS_MODE_MAXPBL;
> -	value &= ~DMA_BUS_MODE_PBL_MASK;
> -	value |= (dma_cfg->pbl << DMA_BUS_MODE_PBL_SHIFT);
> +	value |= DMA_BUS_MODE_USP;
> +	value &= ~(DMA_BUS_MODE_PBL_MASK | DMA_BUS_MODE_RPBL_MASK);
> +	value |= (txpbl << DMA_BUS_MODE_PBL_SHIFT);
> +	value |= (rxpbl << DMA_BUS_MODE_RPBL_SHIFT);
>
>  	/* Set the Fixed burst mode */
>  	if (dma_cfg->fixed_burst)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> index 7d82a3464097..2c3b2098f350 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> @@ -71,11 +71,14 @@ static void dwmac4_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
>  	writel(value, ioaddr + DMA_SYS_BUS_MODE);
>  }
>
> -static void dwmac4_dma_init_channel(void __iomem *ioaddr, int pbl,
> +static void dwmac4_dma_init_channel(void __iomem *ioaddr,
> +				    struct stmmac_dma_cfg *dma_cfg,
>  				    u32 dma_tx_phy, u32 dma_rx_phy,
>  				    u32 channel)
>  {
>  	u32 value;
> +	int txpbl = dma_cfg->txpbl ?: dma_cfg->pbl;
> +	int rxpbl = dma_cfg->rxpbl ?: dma_cfg->pbl;
>
>  	/* set PBL for each channels. Currently we affect same configuration
>  	 * on each channel
> @@ -85,11 +88,11 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr, int pbl,
>  	writel(value, ioaddr + DMA_CHAN_CONTROL(channel));
>
>  	value = readl(ioaddr + DMA_CHAN_TX_CONTROL(channel));
> -	value = value | (pbl << DMA_BUS_MODE_PBL_SHIFT);
> +	value = value | (txpbl << DMA_BUS_MODE_PBL_SHIFT);
>  	writel(value, ioaddr + DMA_CHAN_TX_CONTROL(channel));
>
>  	value = readl(ioaddr + DMA_CHAN_RX_CONTROL(channel));
> -	value = value | (pbl << DMA_BUS_MODE_RPBL_SHIFT);
> +	value = value | (rxpbl << DMA_BUS_MODE_RPBL_SHIFT);
>  	writel(value, ioaddr + DMA_CHAN_RX_CONTROL(channel));
>
>  	/* Mask interrupts by writing to CSR7 */
> @@ -120,8 +123,7 @@ static void dwmac4_dma_init(void __iomem *ioaddr,
>  	writel(value, ioaddr + DMA_SYS_BUS_MODE);
>
>  	for (i = 0; i < DMA_CHANNEL_NB_MAX; i++)
> -		dwmac4_dma_init_channel(ioaddr, dma_cfg->pbl,
> -					dma_tx, dma_rx, i);
> +		dwmac4_dma_init_channel(ioaddr, dma_cfg, dma_tx, dma_rx, i);
>  }
>
>  static void _dwmac4_dump_dma_regs(void __iomem *ioaddr, u32 channel)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 81800f23a9c4..96afe0561c99 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -315,6 +315,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>  	of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
>  	if (!dma_cfg->pbl)
>  		dma_cfg->pbl = DEFAULT_DMA_PBL;
> +	of_property_read_u32(np, "snps,txpbl", &dma_cfg->txpbl);
> +	of_property_read_u32(np, "snps,rxpbl", &dma_cfg->rxpbl);
>
>  	dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>  	dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 3537fb33cc90..e6d7a5940819 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -88,6 +88,8 @@ struct stmmac_mdio_bus_data {
>
>  struct stmmac_dma_cfg {
>  	int pbl;
> +	int txpbl;
> +	int rxpbl;
>  	int fixed_burst;
>  	int mixed_burst;
>  	bool aal;
>

^ permalink raw reply

* Re: [PATCH 1/1] orinoco: fix improper return value
From: Arend Van Spriel @ 2016-12-08 10:30 UTC (permalink / raw)
  To: Pan Bian, Kalle Valo, linux-wireless, netdev; +Cc: linux-kernel
In-Reply-To: <1481157602-4011-1-git-send-email-bianpan2016@163.com>

On 8-12-2016 1:40, Pan Bian wrote:
> Function orinoco_ioctl_commit() returns 0 (indicates success) when the
> call to orinoco_lock() fails. Thus, the return value is inconsistent with
> the execution status. It may be better to return "-EBUSY" when the call 
> to orinoco_lock() fails.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188671
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  drivers/net/wireless/intersil/orinoco/wext.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intersil/orinoco/wext.c b/drivers/net/wireless/intersil/orinoco/wext.c
> index 1d4dae4..fee57ea 100644
> --- a/drivers/net/wireless/intersil/orinoco/wext.c
> +++ b/drivers/net/wireless/intersil/orinoco/wext.c
> @@ -1314,7 +1314,7 @@ static int orinoco_ioctl_commit(struct net_device *dev,
>  		return 0;
>  
>  	if (orinoco_lock(priv, &flags) != 0)
> -		return err;
> +		return -EBUSY;

Actually, orinoco_lock will return either -EBUSY or 0 so maybe better to
just do:

	err = orinoco_lock(priv, &flags);
	if (err < 0)
		return err;

Regards,
Arend

>  	err = orinoco_commit(priv);
>  
> 

^ permalink raw reply

* RE: [Intel-wired-lan] [RFC PATCH] i40e: enable PCIe relax ordering for SPARC
From: David Laight @ 2016-12-08 10:31 UTC (permalink / raw)
  To: 'Alexander Duyck', Tushar Dave
  Cc: Jeff Kirsher, intel-wired-lan, Netdev
In-Reply-To: <CAKgT0UcyRSub0NCi7oHX2Vf+N4vQxzwdWmcc+V+jOX_J=RYgfg@mail.gmail.com>

From: Alexander Duyck
> Sent: 05 December 2016 21:55
...
> > @@ -1010,6 +1018,11 @@ int i40e_setup_tx_descriptors(struct i40e_ring *tx_ring)
> >          */
> >         tx_ring->size += sizeof(u32);
> >         tx_ring->size = ALIGN(tx_ring->size, 4096);
> > +#ifdef CONFIG_SPARC
> > +       tx_ring->dma_attrs = DMA_ATTR_WEAK_ORDERING;
> > +#else
> > +       tx_ring->dma_attrs = 0;
> > +#endif
> >         tx_ring->desc = dma_alloc_coherent(dev, tx_ring->size,
> >                                            &tx_ring->dma, GFP_KERNEL);
> >         if (!tx_ring->desc) {
> 
> Also not a fan of adding yet ring attribute.  Is there any reason why
> you couldn't simply add a set of inline functions at the start of
> i40e_txrx.c that could replace the DMA map/unmap operations in this
> code but pass either 0 or DMA_ATTR_WEAK_ORDERING as needed for the
> drivers?  Then the x86 code doesn't have to change while the SPARC
> code will be able to be passed the attribute.

Or use something like:
#ifdef CONFIG_SPARC
       #define RING_DMA_ATTR DMA_ATTR_WEAK_ORDERING
#else
       #define RING_DMA_ATTR 0
#endif
and pass the constant to the function calls.

Is there actually ever a problem passing DMA_ATTR_WEAK_ORDERING?
I'd guess that it will be ignored if it can't be implemented (or isn't needed).

	David


^ permalink raw reply

* Re: [PATCH v2 4/4] vsock: cancel packets when failing to connect
From: Peng Tao @ 2016-12-08 10:37 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Stefan Hajnoczi, kvm, virtualization, netdev@vger.kernel.org,
	Jorgen Hansen
In-Reply-To: <20161208092446.GB10780@stefanha-x1.localdomain>

On Thu, Dec 8, 2016 at 5:24 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Wed, Dec 07, 2016 at 11:14:12PM +0800, Peng Tao wrote:
>> Otherwise we'll leave the packets queued until releasing vsock device.
>> E.g., if guest is slow to start up, resulting ETIMEDOUT on connect, guest
>> will get the connect requests from failed host sockets.
>>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> Signed-off-by: Peng Tao <bergwolf@gmail.com>
>> ---
>>  include/linux/virtio_vsock.h            | 7 +++++++
>>  net/vmw_vsock/af_vsock.c                | 7 +++++++
>>  net/vmw_vsock/virtio_transport_common.c | 7 -------
>>  3 files changed, 14 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>> index b92e88d..ff6850a 100644
>> --- a/include/linux/virtio_vsock.h
>> +++ b/include/linux/virtio_vsock.h
>> @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs
>>  u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted);
>>  void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit);
>>
>> +static inline const struct virtio_transport *virtio_transport_get_ops(void)
>> +{
>> +     const struct vsock_transport *t = vsock_core_get_transport();
>> +
>> +     return container_of(t, struct virtio_transport, transport);
>> +}
>> +
>>  #endif /* _LINUX_VIRTIO_VSOCK_H */
>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>> index 8a398b3..ebb50d6 100644
>> --- a/net/vmw_vsock/af_vsock.c
>> +++ b/net/vmw_vsock/af_vsock.c
>> @@ -104,6 +104,7 @@
>>  #include <linux/unistd.h>
>>  #include <linux/wait.h>
>>  #include <linux/workqueue.h>
>> +#include <linux/virtio_vsock.h>
>>  #include <net/sock.h>
>>  #include <net/af_vsock.h>
>>
>> @@ -1105,6 +1106,7 @@ static void vsock_connect_timeout(struct work_struct *work)
>>  {
>>       struct sock *sk;
>>       struct vsock_sock *vsk;
>> +     int cancel = 0;
>>
>>       vsk = container_of(work, struct vsock_sock, dwork.work);
>>       sk = sk_vsock(vsk);
>> @@ -1115,8 +1117,11 @@ static void vsock_connect_timeout(struct work_struct *work)
>>               sk->sk_state = SS_UNCONNECTED;
>>               sk->sk_err = ETIMEDOUT;
>>               sk->sk_error_report(sk);
>> +             cancel = 1;
>>       }
>>       release_sock(sk);
>> +     if (cancel)
>> +             virtio_transport_get_ops()->cancel_pkt(vsk);
>
> This doesn't work with the VMCI transport.  Remember af_vsock.c is
> common code shared by all transports.
>
> You need to add a struct vsock_transport->cancel_pkt() callback instead
> os a struct virtio_transport->cancel_pkt() callback.  And you need to
> handle the case where cancel_pkt == NULL if you don't implement it for
> VMCI.
>
I see. Thanks for reviewing! I'll fix it and resend later.

Cheers,
Tao

^ permalink raw reply

* Re: [PATCH v2 1/4] vsock: track pkt owner vsock
From: Peng Tao @ 2016-12-08 10:37 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: netdev@vger.kernel.org, kvm, Stefan Hajnoczi, virtualization
In-Reply-To: <20161208093010.GC10780@stefanha-x1.localdomain>

On Thu, Dec 8, 2016 at 5:30 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Wed, Dec 07, 2016 at 11:14:09PM +0800, Peng Tao wrote:
>> So that we can cancel a queued pkt later if necessary.
>>
>> Signed-off-by: Peng Tao <bergwolf@gmail.com>
>> ---
>>  include/linux/virtio_vsock.h            | 2 ++
>>  net/vmw_vsock/virtio_transport_common.c | 7 +++++++
>>  2 files changed, 9 insertions(+)
>>
>> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>> index 9638bfe..6dd3242 100644
>> --- a/include/linux/virtio_vsock.h
>> +++ b/include/linux/virtio_vsock.h
>> @@ -48,6 +48,7 @@ struct virtio_vsock_pkt {
>>       struct virtio_vsock_hdr hdr;
>>       struct work_struct work;
>>       struct list_head list;
>> +     struct vsock_sock *vsk;
>
> To prevent future bugs, please add a comment here:
> /* socket refcnt not held, only use for cancellation */
>
> This field is just an opaque token used for cancellation rather than a
> struct vsock_sock pointer that we are allowed to dereference.  You could
> change this field to void *cancel_token to make the code harder to
> misuse.
Will do. Thanks!

Cheers,
Tao

^ permalink raw reply

* Re: [PATCH v3 6/6] net: smmac: allow configuring lower pbl values
From: Alexandre Torgue @ 2016-12-08 10:42 UTC (permalink / raw)
  To: Niklas Cassel, Rob Herring, Mark Rutland, Jonathan Corbet,
	Giuseppe Cavallaro, David S. Miller, Phil Reid, Eric Engestrom,
	Pavel Machek, Andreas Färber, Joachim Eastwood,
	Vincent Palatin, Gabriel Fernandez
  Cc: Niklas Cassel, netdev, devicetree, linux-kernel, linux-doc
In-Reply-To: <1481120409-18103-7-git-send-email-niklass@axis.com>

Hi Niklas,

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> The driver currently always sets the PBLx8/PBLx4 bit, which means that
> the pbl values configured via the pbl/txpbl/rxpbl DT properties are
> always multiplied by 8/4 in the hardware.
>
> In order to allow the DT to configure lower pbl values, while at the
> same time not changing behavior of any existing device trees using the
> pbl/txpbl/rxpbl settings, add a property to disable the multiplication
> of the pbl by 8/4 in the hardware.
>
> Suggested-by: Rabin Vincent <rabinv@axis.com>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>

Thanks for this patch, you can add my Acked-by.

Thanks for the whole series.

Alex

> ---
>  Documentation/devicetree/bindings/net/stmmac.txt      | 2 ++
>  Documentation/networking/stmmac.txt                   | 5 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c   | 3 ++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c      | 3 ++-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c      | 2 ++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 +
>  include/linux/stmmac.h                                | 1 +
>  7 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
> index 8080038ff1b2..128da752fec9 100644
> --- a/Documentation/devicetree/bindings/net/stmmac.txt
> +++ b/Documentation/devicetree/bindings/net/stmmac.txt
> @@ -39,6 +39,8 @@ Optional properties:
>  			If set, DMA tx will use this value rather than snps,pbl.
>  - snps,rxpbl		Rx Programmable Burst Length. Only for GMAC and newer.
>  			If set, DMA rx will use this value rather than snps,pbl.
> +- snps,no-pbl-x8	Don't multiply the pbl/txpbl/rxpbl values by 8.
> +			For core rev < 3.50, don't multiply the values by 4.
>  - snps,aal		Address-Aligned Beats
>  - snps,fixed-burst	Program the DMA to use the fixed burst mode
>  - snps,mixed-burst	Program the DMA to use the mixed burst mode
> diff --git a/Documentation/networking/stmmac.txt b/Documentation/networking/stmmac.txt
> index 6add57374f70..2bb07078f535 100644
> --- a/Documentation/networking/stmmac.txt
> +++ b/Documentation/networking/stmmac.txt
> @@ -152,8 +152,9 @@ Where:
>   o dma_cfg: internal DMA parameters
>     o pbl: the Programmable Burst Length is maximum number of beats to
>         be transferred in one DMA transaction.
> -       GMAC also enables the 4xPBL by default.
> +       GMAC also enables the 4xPBL by default. (8xPBL for GMAC 3.50 and newer)
>     o txpbl/rxpbl: GMAC and newer supports independent DMA pbl for tx/rx.
> +   o pblx8: Enable 8xPBL (4xPBL for core rev < 3.50). Enabled by default.
>     o fixed_burst/mixed_burst/aal
>   o clk_csr: fixed CSR Clock range selection.
>   o has_gmac: uses the GMAC core.
> @@ -208,6 +209,7 @@ struct stmmac_dma_cfg {
>  	int pbl;
>  	int txpbl;
>  	int rxpbl;
> +	bool pblx8;
>  	int fixed_burst;
>  	int mixed_burst;
>  	bool aal;
> @@ -219,6 +221,7 @@ Where:
>  	 If set, DMA tx will use this value rather than pbl.
>   o rxpbl: Receive Programmable Burst Length. Only for GMAC and newer.
>  	 If set, DMA rx will use this value rather than pbl.
> + o pblx8: Enable 8xPBL (4xPBL for core rev < 3.50). Enabled by default.
>   o fixed_burst: program the DMA to use the fixed burst mode
>   o mixed_burst: program the DMA to use the mixed burst mode
>   o aal: Address-Aligned Beats
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> index 99b8040af592..612d3aaac9a4 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
> @@ -98,7 +98,8 @@ static void dwmac1000_dma_init(void __iomem *ioaddr,
>  	 * Note: before stmmac core 3.50 this mode bit was 4xPBL, and
>  	 * post 3.5 mode bit acts as 8*PBL.
>  	 */
> -	value |= DMA_BUS_MODE_MAXPBL;
> +	if (dma_cfg->pblx8)
> +		value |= DMA_BUS_MODE_MAXPBL;
>  	value |= DMA_BUS_MODE_USP;
>  	value &= ~(DMA_BUS_MODE_PBL_MASK | DMA_BUS_MODE_RPBL_MASK);
>  	value |= (txpbl << DMA_BUS_MODE_PBL_SHIFT);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> index 2c3b2098f350..8196ab5fc33c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
> @@ -84,7 +84,8 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr,
>  	 * on each channel
>  	 */
>  	value = readl(ioaddr + DMA_CHAN_CONTROL(channel));
> -	value = value | DMA_BUS_MODE_PBL;
> +	if (dma_cfg->pblx8)
> +		value = value | DMA_BUS_MODE_PBL;
>  	writel(value, ioaddr + DMA_CHAN_CONTROL(channel));
>
>  	value = readl(ioaddr + DMA_CHAN_TX_CONTROL(channel));
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> index 56c8a2342c14..a2831773431a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> @@ -81,6 +81,7 @@ static void stmmac_default_data(struct plat_stmmacenet_data *plat)
>  	plat->mdio_bus_data->phy_mask = 0;
>
>  	plat->dma_cfg->pbl = 32;
> +	plat->dma_cfg->pblx8 = true;
>  	/* TODO: AXI */
>
>  	/* Set default value for multicast hash bins */
> @@ -115,6 +116,7 @@ static int quark_default_data(struct plat_stmmacenet_data *plat,
>  	plat->mdio_bus_data->phy_mask = 0;
>
>  	plat->dma_cfg->pbl = 16;
> +	plat->dma_cfg->pblx8 = true;
>  	plat->dma_cfg->fixed_burst = 1;
>  	/* AXI (TODO) */
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index 96afe0561c99..082cd48db6a7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -317,6 +317,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>  		dma_cfg->pbl = DEFAULT_DMA_PBL;
>  	of_property_read_u32(np, "snps,txpbl", &dma_cfg->txpbl);
>  	of_property_read_u32(np, "snps,rxpbl", &dma_cfg->rxpbl);
> +	dma_cfg->pblx8 = !of_property_read_bool(np, "snps,no-pbl-x8");
>
>  	dma_cfg->aal = of_property_read_bool(np, "snps,aal");
>  	dma_cfg->fixed_burst = of_property_read_bool(np, "snps,fixed-burst");
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index e6d7a5940819..266dab9ad782 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -90,6 +90,7 @@ struct stmmac_dma_cfg {
>  	int pbl;
>  	int txpbl;
>  	int rxpbl;
> +	bool pblx8;
>  	int fixed_burst;
>  	int mixed_burst;
>  	bool aal;
>

^ permalink raw reply

* RE: [Intel-wired-lan] [RFC PATCH] i40e: enable PCIe relax ordering for SPARC
From: David Laight @ 2016-12-08 10:43 UTC (permalink / raw)
  To: 'Alexander Duyck', tndave; +Cc: Jeff Kirsher, intel-wired-lan, Netdev
In-Reply-To: <CAKgT0UfTP+BrvDBzUJAVr9-DRCKgM7T3aS=LgRic8UZz8x82eg@mail.gmail.com>

From: Alexander Duyck
> Sent: 06 December 2016 17:10
...
> I was thinking about it and I realized we can probably simplify this
> even further.  In the case of most other architectures the
> DMA_ATTR_WEAK_ORDERING has no effect anyway.  So from what I can tell
> there is probably no reason not to just always pass that attribute
> with the DMA mappings.  From what I can tell the only other
> architecture that uses this is the PowerPC Cell architecture.

And I should have read all the thread :-(

> Also I was wondering if you actually needed to enable this attribute
> for both Rx and Tx buffers or just Rx buffers?  The patch that enabled
> DMA_ATTR_WEAK_ORDERING for Sparc64 seems to call out writes, but I
> didn't see anything about reads.  I'm just wondering if changing the
> code for Tx has any effect?  If not you could probably drop those
> changes and just focus on Rx.

'Weak ordering' only applies to PCIe read transfers, so can only have
an effect on descriptor reads and transmit buffer reads.

Basically PCIe is a comms protocol and an endpoint (or the host) can
have multiple outstanding read requests (each of which might generate
multiple response messages.
The responses for each request must arrive in order, but responses for
different requests can be interleaved.
Setting 'not weak ordering' lets the host interwork with broken endpoints.
(Or, like we did, you fix the fpga's PCIe implementation.)

In this case you need the reads of both transmit and receive rings to
'overtake' reads of transmit data.

I'm not at all clear how this 'flag' can be set on dma_map().
It is a property of the PCIe subsystem.

	David



^ permalink raw reply

* Re: [PATCH v3 1/6] net: stmmac: return error if no DMA configuration is found
From: Alexandre Torgue @ 2016-12-08 10:44 UTC (permalink / raw)
  To: Niklas Cassel, Giuseppe Cavallaro; +Cc: Niklas Cassel, netdev, linux-kernel
In-Reply-To: <1481120409-18103-2-git-send-email-niklass@axis.com>

Hi Niklas,

On 12/07/2016 03:20 PM, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@axis.com>
>
> All drivers except pci glue layer calls stmmac_probe_config_dt.
> stmmac_probe_config_dt does a kzalloc dma_cfg.
>
> pci glue layer does kzalloc dma_cfg explicitly, so all current
> drivers does a kzalloc dma_cfg.
>
> Return an error if no DMA configuration is found, that way
> we can assume that the DMA configuration always exists.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>

Acked-by: Alexandre Torgue <alexandre.torgue@stcom>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 982c95213da4..14366800e5e6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1578,16 +1578,12 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv)
>   */
>  static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>  {
> -	int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, aal = 0;
> -	int mixed_burst = 0;
>  	int atds = 0;
>  	int ret = 0;
>
> -	if (priv->plat->dma_cfg) {
> -		pbl = priv->plat->dma_cfg->pbl;
> -		fixed_burst = priv->plat->dma_cfg->fixed_burst;
> -		mixed_burst = priv->plat->dma_cfg->mixed_burst;
> -		aal = priv->plat->dma_cfg->aal;
> +	if (!priv->plat->dma_cfg) {
> +		dev_err(priv->device, "DMA configuration not found\n");
> +		return -EINVAL;
>  	}
>
>  	if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
> @@ -1599,8 +1595,12 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
>  		return ret;
>  	}
>
> -	priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst,
> -			    aal, priv->dma_tx_phy, priv->dma_rx_phy, atds);
> +	priv->hw->dma->init(priv->ioaddr,
> +			    priv->plat->dma_cfg->pbl,
> +			    priv->plat->dma_cfg->fixed_burst,
> +			    priv->plat->dma_cfg->mixed_burst,
> +			    priv->plat->dma_cfg->aal,
> +			    priv->dma_tx_phy, priv->dma_rx_phy, atds);
>
>  	if (priv->synopsys_id >= DWMAC_CORE_4_00) {
>  		priv->rx_tail_addr = priv->dma_rx_phy +
>

^ 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