Netdev List
 help / color / mirror / Atom feed
* 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

* Re: [PATCH net-next] openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode
From: Yang, Yi @ 2016-12-08 10:57 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev, dev, pshelar
In-Reply-To: <20161208095401.3e4054c9@griffin>

On Thu, Dec 08, 2016 at 09:54:00AM +0100, Jiri Benc wrote:
> 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, this has used rtnetlink to confgiure, te below is my test code in ovs.
As Pravin mentioned, in compat mode, ovs won't use current in-kernel
module which is vxlan in upstream kernel, but ovs has its own vport_vxlan
module for this, it has different behaviour from LWT in upstream kernel.
If you try this in the kernels below v4.7, you will clearly know this.

ovs will port this patch into the below files in ovs soure code
datapath/linux/compat/include/linux/openvswitch.h and datapath/vport-vxlan.c once it is accepted,this is ovs upstream process, if Linux kernel doesn't include this, ovs won't accept it.

So ovs out of tree modules need to adapt to upstream kernel, any
kernel-related changes must be accepted by Linux kernel at first. Pravin
is a dedicated person doing such work, your L3 patches merged into
net-next will be ported into ovs out of tree modules by Pravin in the
same way.

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 0d03334..7d8a0f4 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -1006,7 +1006,11 @@ netdev_vxlan_create(struct netdev *netdev)
     nl_msg_put_string(&request, IFLA_IFNAME, name);
     nl_msg_put_u32(&request, IFLA_MTU, UINT16_MAX);
     linkinfo_off = nl_msg_start_nested(&request, IFLA_LINKINFO);
+#ifdef USE_UPSTREAM_TUNNEL
         nl_msg_put_string(&request, IFLA_INFO_KIND, "vxlan");
+#else
+        nl_msg_put_string(&request, IFLA_INFO_KIND, "ovs_vxlan");
+#endif
         infodata_off = nl_msg_start_nested(&request, IFLA_INFO_DATA);
             nl_msg_put_u8(&request, IFLA_VXLAN_LEARNING, 0);
             nl_msg_put_u8(&request, IFLA_VXLAN_COLLECT_METADATA, 1);

^ permalink raw reply related

* Re: [PATCH] linux/types.h: enable endian checks for all sparse builds
From: Greg Kroah-Hartman @ 2016-12-08 11:13 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: kvm@vger.kernel.org, Michael S. Tsirkin, David Airlie,
	linux-remoteproc@vger.kernel.org, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux-foundation.org,
	linux-s390@vger.kernel.org, James E.J. Bottomley, Herbert Xu,
	linux-scsi@vger.kernel.org, Neil Armstrong, Christoph Hellwig,
	v9fs-developer@lists.sourceforge.net, Asias He, Arnd Bergmann,
	linux-kbuild@vger.kernel.org, Jens Axboe, Michal Marek <
In-Reply-To: <BLUPR02MB168304F8FBA50C916A6A4E6081840@BLUPR02MB1683.namprd02.prod.outlook.com>

On Thu, Dec 08, 2016 at 06:38:11AM +0000, Bart Van Assche wrote:
> On 12/07/16 21:54, Michael S. Tsirkin wrote:
> > On Thu, Dec 08, 2016 at 05:21:47AM +0000, Bart Van Assche wrote:
> >> Additionally, there are notable exceptions to the rule that most drivers
> >> are endian-clean, e.g. drivers/scsi/qla2xxx. I would appreciate it if it
> >> would remain possible to check such drivers with sparse without enabling
> >> endianness checks. Have you considered to change #ifdef __CHECK_ENDIAN__
> >> into e.g. #ifndef __DONT_CHECK_ENDIAN__?
> >
> > The right thing is probably just to fix these, isn't it?
> > Until then, why not just ignore the warnings?
> 
> Neither option is realistic. With endian-checking enabled the qla2xxx 
> driver triggers so many warnings that it becomes a real challenge to 
> filter the non-endian warnings out manually:
> 
> $ for f in "" CF=-D__CHECK_ENDIAN__; do make M=drivers/scsi/qla2xxx C=2\
>      $f | &grep -c ': warning:'; done
> 4
> 752
> 
> If you think it would be easy to fix the endian warnings triggered by 
> the qla2xxx driver, you are welcome to try to fix these.

Please don't let one crappy, obviously broken, driver prevent this good
change from happening which will help ensure that the rest of the kernel
(i.e. 99% of it) can be easily tested and fixed for endian issues.

Sounds like you should just fix the driver up if it has so many
problems, and it annoys you so much that you have to filter out some
warnings to see the others :)

thanks,

greg k-h

^ permalink raw reply

* netlink: GPF in netlink_dump
From: Dmitry Vyukov @ 2016-12-08 11:14 UTC (permalink / raw)
  To: David Miller, Matti Vaittinen, Tycho Andersen, stephen hemminger,
	Cong Wang, Florian Westphal, netdev, LKML, Eric Dumazet
  Cc: syzkaller

Hello,

The following program triggers GPF in netlink_dump:

// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/uio.h>

int main()
{
  syscall(__NR_mmap, 0x20000000ul, 0xd25000ul, 0x3ul, 0x32ul, -1, 0);
  int fd = syscall(__NR_socket, 0x10ul, 0x3ul, 0x10ul);
  struct iovec iov;
  iov.iov_base = "\x16\x00\x00\x00\x23\x00\x19\x07\x00\x00\x00\x46"
                    "\xf1\xff\xff\xe8\x03\x00\x04\xff\xff\x75";
  iov.iov_len = 22;
  syscall(__NR_writev, fd, &iov, 1);
  return 0;
}


kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
Modules linked in:
CPU: 0 PID: 6913 Comm: a.out Not tainted 4.9.0-rc7+ #76
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff88006716a840 task.stack: ffff880063a38000
RIP: 0010:[<ffffffff81567f65>]  [<ffffffff81567f65>]
__lock_acquire+0xb35/0x3380 kernel/locking/lockdep.c:3221
RSP: 0018:ffff880063a3e578  EFLAGS: 00010006
RAX: dffffc0000000000 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: 000000000000000c RSI: 0000000000000000 RDI: 1ffff1000c747d09
RBP: ffff880063a3eab0 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000060 R11: 0000000000000000 R12: ffff88006716a840
R13: 0000000000000001 R14: ffffffff8baba1a0 R15: 0000000000000001
FS:  000000000082a880(0000) GS:ffff88003ec00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000004b20e0 CR3: 000000003dd5d000 CR4: 00000000000006f0
Stack:
 ffff88006716b060 ffff880063a3e5f0 ffff88006716b088 0000000041b58ab3
 ffffffff894ee650 ffffffff81562600 ffff88006716b058 ffff880063a3e930
 00000000894d005b 1ffff1000c747cbe 0000000100000000 ffffffff81557640
Call Trace:
 [<ffffffff8156b682>] lock_acquire+0x2a2/0x790 kernel/locking/lockdep.c:3746
 [<     inline     >] __mutex_lock_common kernel/locking/mutex.c:521
 [<ffffffff88193a3f>] mutex_lock_nested+0x23f/0xf20 kernel/locking/mutex.c:621
 [<ffffffff86cb2228>] netlink_dump+0xd8/0xd70 net/netlink/af_netlink.c:2067
 [<ffffffff86cb6e8a>] __netlink_dump_start+0x4ea/0x760
net/netlink/af_netlink.c:2200
 [<ffffffff86cc12e7>] genl_family_rcv_msg+0xa77/0x1070
net/netlink/genetlink.c:597
 [<ffffffff86cc1a90>] genl_rcv_msg+0x1b0/0x260 net/netlink/genetlink.c:660
 [<ffffffff86cbf66c>] netlink_rcv_skb+0x2bc/0x3a0 net/netlink/af_netlink.c:2281
 [<ffffffff86cc085d>] genl_rcv+0x2d/0x40 net/netlink/genetlink.c:671
 [<     inline     >] netlink_unicast_kernel net/netlink/af_netlink.c:1214
 [<ffffffff86cbde8a>] netlink_unicast+0x51a/0x740 net/netlink/af_netlink.c:1240
 [<ffffffff86cbeb54>] netlink_sendmsg+0xaa4/0xe50 net/netlink/af_netlink.c:1786
 [<     inline     >] sock_sendmsg_nosec net/socket.c:621
 [<ffffffff86a7517f>] sock_sendmsg+0xcf/0x110 net/socket.c:631
 [<ffffffff86a754eb>] sock_write_iter+0x32b/0x620 net/socket.c:829
 [<ffffffff81a6ef33>] do_iter_readv_writev+0x363/0x670 fs/read_write.c:695
 [<ffffffff81a71981>] do_readv_writev+0x431/0x9b0 fs/read_write.c:872
 [<ffffffff81a724bc>] vfs_writev+0x8c/0xc0 fs/read_write.c:911
 [<ffffffff81a72605>] do_writev+0x115/0x2d0 fs/read_write.c:944
 [<     inline     >] SYSC_writev fs/read_write.c:1017
 [<ffffffff81a75dbc>] SyS_writev+0x2c/0x40 fs/read_write.c:1014
 [<ffffffff881a3d05>] entry_SYSCALL_64_fastpath+0x23/0xc6
arch/x86/entry/entry_64.S:209
Code: e9 03 f3 48 ab 48 81 c4 10 05 00 00 44 89 e8 5b 41 5c 41 5d 41
5e 41 5f 5d c3 4c 89 d2 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80>
3c 02 00 0f 85 00 26 00 00 49 81 3a c0 64 e2 8a 41 bf 00 00
RIP  [<ffffffff81567f65>] __lock_acquire+0xb35/0x3380
kernel/locking/lockdep.c:3221
 RSP <ffff880063a3e578>
---[ end trace 8d9cfd5e00f7ff0c ]---
==================================================================



On commit 2caceb3294a78c389b462e7e236a4e744a53a474 (Dec 1).

^ permalink raw reply

* [PATCH] drivers: net: xgene: initialize slots
From: Colin King @ 2016-12-08 11:17 UTC (permalink / raw)
  To: Iyappan Subramanian, Keyur Chudgar, netdev; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

static analysis using cppcheck detected that slots was uninitialized.
Fix this by initializing it to buf_pool->slots - 1

Found using static analysis with CoverityScan, CID #1387620

Fixes: a9380b0f7be818 ("drivers: net: xgene: Add support for Jumbo frame")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 6c7eea8..899163c 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -636,6 +636,7 @@ static void xgene_enet_free_pagepool(struct xgene_enet_desc_ring *buf_pool,
 
 	dev = ndev_to_dev(buf_pool->ndev);
 	head = buf_pool->head;
+	slots = buf_pool->slots - 1;
 
 	for (i = 0; i < 4; i++) {
 		frag_size = xgene_enet_get_data_len(le64_to_cpu(desc[i ^ 1]));
-- 
2.10.2

^ permalink raw reply related

* Re: [PATCH] linux/types.h: enable endian checks for all sparse builds
From: Cornelia Huck @ 2016-12-08 11:25 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: kvm, Neil Armstrong, David Airlie, linux-remoteproc, dri-devel,
	virtualization, linux-s390, James E.J.  Bottomley, Herbert Xu,
	linux-scsi, Christoph Hellwig, v9fs-developer, Asias He,
	Arnd Bergmann, linux-kbuild, Jens Axboe, Michal Marek,
	Stefan Hajnoczi, Matt Mackall, Greg Kroah-Hartman, linux-kernel,
	linux-crypto, netdev, Linus Torvalds, David S. Miller
In-Reply-To: <1481164052-28036-1-git-send-email-mst@redhat.com>

On Thu, 8 Dec 2016 04:29:39 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> By now, linux is mostly endian-clean. Enabling endian-ness
> checks for everyone produces about 200 new sparse warnings for me -
> less than 10% over the 2000 sparse warnings already there.

Out of curiousity: Where do most of those warnings show up?

> 
> Not a big deal, OTOH enabling this helps people notice
> they are introducing new bugs.
> 
> So let's just drop __CHECK_ENDIAN__. Follow-up patches
> can drop distinction between __bitwise and __bitwise__.
> 
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Linus, could you ack this for upstream? If yes I'll
> merge through my tree as a replacement for enabling
> this just for virtio.
> 
>  include/uapi/linux/types.h | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
> index acf0979..41e5914 100644
> --- a/include/uapi/linux/types.h
> +++ b/include/uapi/linux/types.h
> @@ -23,11 +23,7 @@
>  #else
>  #define __bitwise__
>  #endif
> -#ifdef __CHECK_ENDIAN__
>  #define __bitwise __bitwise__
> -#else
> -#define __bitwise
> -#endif
> 
>  typedef __u16 __bitwise __le16;
>  typedef __u16 __bitwise __be16;

FWIW, I like this better than just enabling it for the virtio code.

^ 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 11:37 UTC (permalink / raw)
  To: Yang, Yi; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161208105750.GA14898-re2EX8HDrk21gSHoDXDV2kEOCMrvLtNR@public.gmane.org>

On Thu, 8 Dec 2016 18:57:51 +0800, Yang, Yi wrote:
> So ovs out of tree modules need to adapt to upstream kernel, any
> kernel-related changes must be accepted by Linux kernel at first.

I'm perfectly aware of that and I'm saying that your patch is
unacceptable for upstream kernel. This is a long standing policy of the
kernel: there's no way you can get a patch into the kernel to
accommodate an out of tree kernel module. The policy is there for good
reasons and as paradoxical as it may sound, it benefits the projects
that employ out of tree modules in the long run.

If Open vSwitch wants to carry a non-upstream patch, it's its choice
and we can have that discussion but that's not something to discuss on
netdev@vger nor propose for net-next.

 Jiri

^ permalink raw reply

* Re: [PATCH net-next] openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode
From: Yang, Yi @ 2016-12-08 12:01 UTC (permalink / raw)
  To: Jiri Benc; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161208123756.204af819@griffin>

On Thu, Dec 08, 2016 at 12:37:56PM +0100, Jiri Benc wrote:
> On Thu, 8 Dec 2016 18:57:51 +0800, Yang, Yi wrote:
> > So ovs out of tree modules need to adapt to upstream kernel, any
> > kernel-related changes must be accepted by Linux kernel at first.
> 
> I'm perfectly aware of that and I'm saying that your patch is
> unacceptable for upstream kernel. This is a long standing policy of the
> kernel: there's no way you can get a patch into the kernel to
> accommodate an out of tree kernel module. The policy is there for good
> reasons and as paradoxical as it may sound, it benefits the projects
> that employ out of tree modules in the long run.
> 
> If Open vSwitch wants to carry a non-upstream patch, it's its choice
> and we can have that discussion but that's not something to discuss on
> netdev@vger nor propose for net-next.
>
Jiri, according to your statement, we have to switch Linux 4.7 or above
if we want to use ovs VxLAN-gpe, Ubuntu 16.04 has had new kernel, but it
just use Linux kernel 4.4, you know Linux distributuions nerver uses the
latest stable Linux kernel because they have their own patches to
maintain, that will be a nightmare if they take the latest stable
kernel. You know RHEL also follows the same philosophy.

Current ovs master can be built on Ubuntu 14.04 which have Linux kernel
3.13, I think compatibility backward is very important, out of tree
modules are very important to ovs. If ovs installation will depend on
the latest kernel and force users to switch to new kernel, I believe it
nerver will be so popular in the industies.

^ permalink raw reply

* [PATCH] net: gianfar: add ethtool eee support
From: Shaohui Xie @ 2016-12-08 11:27 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shaohui Xie

Gianfar does not support EEE, but it can connect to a PHY which supports
EEE and the PHY advertises EEE by default, and its link partner also
advertises EEE, so the PHY enters low power mode when traffic rate is low,
which causes packet loss if an application's traffic rate is low. This
patch provides .get_eee and .set_eee so that to disable the EEE
advertisement via ethtool if needed, other EEE features are not supported.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
---
 drivers/net/ethernet/freescale/gianfar_ethtool.c | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 56588f2..9375078 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -184,6 +184,32 @@ static void gfar_gdrvinfo(struct net_device *dev,
 	strlcpy(drvinfo->bus_info, "N/A", sizeof(drvinfo->bus_info));
 }
 
+static int gfar_get_eee(struct net_device *dev, struct ethtool_eee *et_eee)
+{
+	struct phy_device *phydev = dev->phydev;
+
+	if (!phydev)
+		return -ENODEV;
+
+	return phy_ethtool_get_eee(phydev, et_eee);
+}
+
+static int gfar_set_eee(struct net_device *dev, struct ethtool_eee *et_eee)
+{
+	struct phy_device *phydev = dev->phydev;
+
+	if (!phydev)
+		return -ENODEV;
+
+	if (et_eee->eee_enabled ||
+	    et_eee->tx_lpi_enabled ||
+	    et_eee->tx_lpi_timer) {
+		return -EOPNOTSUPP;
+	}
+
+	return phy_ethtool_set_eee(phydev, et_eee);
+}
+
 /* Return the length of the register structure */
 static int gfar_reglen(struct net_device *dev)
 {
@@ -1548,6 +1574,8 @@ const struct ethtool_ops gfar_ethtool_ops = {
 	.get_strings = gfar_gstrings,
 	.get_sset_count = gfar_sset_count,
 	.get_ethtool_stats = gfar_fill_stats,
+	.get_eee = gfar_get_eee,
+	.set_eee = gfar_set_eee,
 	.get_msglevel = gfar_get_msglevel,
 	.set_msglevel = gfar_set_msglevel,
 #ifdef CONFIG_PM
-- 
2.1.0.27.g96db324

^ permalink raw reply related

* Re: [PATCH] sh_eth: add wake-on-lan support via magic packet
From: Sergei Shtylyov @ 2016-12-08 12:28 UTC (permalink / raw)
  To: Niklas Söderlund, Simon Horman, netdev, linux-renesas-soc
In-Reply-To: <20161207162843.4731-1-niklas.soderlund+renesas@ragnatech.se>

Hello!

    Good to see that somebody cares still about this driver, one more task off 
my back. :-)

On 12/07/2016 07:28 PM, Niklas Söderlund wrote:

   You only enable the WOL support fo the R-Car gen2 chips but never say that 
explicitly, neither in the subject nor here.

> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  drivers/net/ethernet/renesas/sh_eth.c | 120 +++++++++++++++++++++++++++++++---
>  drivers/net/ethernet/renesas/sh_eth.h |   4 ++
>  2 files changed, 116 insertions(+), 8 deletions(-)

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 05b0dc5..3974046 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -624,7 +624,7 @@ static struct sh_eth_cpu_data r8a779x_data = {
>
>  	.register_type	= SH_ETH_REG_FAST_RCAR,
>
> -	.ecsr_value	= ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD,
> +	.ecsr_value	= ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
>  	.ecsipr_value	= ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP,
>  	.eesipr_value	= 0x01ff009f,
>
> @@ -641,6 +641,7 @@ static struct sh_eth_cpu_data r8a779x_data = {
>  	.tpauser	= 1,
>  	.hw_swap	= 1,
>  	.rmiimode	= 1,
> +	.magic		= 1,
>  };
>  #endif /* CONFIG_OF */

    So I suggest that you add the general WOL support code in the 1st patch 
and enable the new feature per SoC family in the follow up patches.

> @@ -1657,6 +1658,10 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
>  		goto out;
>
>  	if (!likely(mdp->irq_enabled)) {

    Oops, I guess unlikely(!mdp->irq_enabled) was meant here...

> +		/* Handle MagicPacket interrupt */
> +		if (sh_eth_read(ndev, ECSR) & ECSR_MPD)

    Why do it here?

> +			sh_eth_modify(ndev, ECSR, 0, ECSR_MPD);
> +
>  		sh_eth_write(ndev, 0, EESIPR);
>  		goto out;
>  	}
[...]
> @@ -3017,6 +3051,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>  		goto out_release;
>  	}
>
> +	/* Get clock, if not found that's OK but Wake-On-Lan is unavailable */
> +	mdp->clk = devm_clk_get(&pdev->dev, NULL);

    Luckily, we have <linux/clk.h> #include'd...

> +	if (IS_ERR(mdp->clk))
> +		mdp->clk = NULL;
> +
>  	ndev->base_addr = res->start;
>
>  	spin_lock_init(&mdp->lock);
> @@ -3111,6 +3150,10 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto out_napi_del;
>
> +	mdp->wol_enabled = false;

    No need, the '*mdp' was kzalloc'ed.

> +	if (mdp->cd->magic && mdp->clk)
> +		device_set_wakeup_capable(&pdev->dev, 1);
> +
>  	/* print device information */
>  	netdev_info(ndev, "Base address at 0x%x, %pM, IRQ %d.\n",
>  		    (u32)ndev->base_addr, ndev->dev_addr, ndev->irq);
> @@ -3150,15 +3193,71 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
>
>  #ifdef CONFIG_PM
>  #ifdef CONFIG_PM_SLEEP
> +static int sh_eth_wol_setup(struct net_device *ndev)
> +{
> +	struct sh_eth_private *mdp = netdev_priv(ndev);
> +
> +	/* Only allow ECI interrupts */
> +	mdp->irq_enabled = false;

    Why 'false' if you enable IRQs below?

> +	synchronize_irq(ndev->irq);
> +	napi_disable(&mdp->napi);
> +	sh_eth_write(ndev, DMAC_M_ECI, EESIPR);
> +
> +	/* Enable ECI MagicPacket interrupt */
> +	sh_eth_write(ndev, ECSIPR_MPDIP, ECSIPR);
> +
> +	/* Enable MagicPacket */
> +	sh_eth_modify(ndev, ECMR, 0, ECMR_PMDE);
> +
> +	/* Increased clock usage so device won't be suspended */
> +	clk_enable(mdp->clk);

    Hum, intermixiggn runtime PM with clock API doesn't look good...

> +
> +	return enable_irq_wake(ndev->irq);
> +}
> +
> +static int sh_eth_wol_restore(struct net_device *ndev)
> +{
> +	struct sh_eth_private *mdp = netdev_priv(ndev);
> +	int ret;
> +
> +	napi_enable(&mdp->napi);
> +
> +	/* Disable MagicPacket */
> +	sh_eth_modify(ndev, ECMR, ECMR_PMDE, 0);
> +
> +	/* The device need to be reset to restore MagicPacket logic
> +	 * for next wakeup. If we close and open the device it will
> +	 * both be reset and all registers restored. This is what
> +	 * happens during suspend and resume without WoL enabled.
> +	 */
> +	ret = sh_eth_close(ndev);
> +	if (ret < 0)
> +		return ret;
> +	ret = sh_eth_open(ndev);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* Restore clock usage count */
> +	clk_disable(mdp->clk);

    Hm... and RPM will think the clock is still enabled?
Why disable the clock here anyway if we're resuming?

> +
> +	return disable_irq_wake(ndev->irq);
> +}
> +
[...]
> @@ -3166,14 +3265,19 @@ static int sh_eth_suspend(struct device *dev)
>  static int sh_eth_resume(struct device *dev)
>  {
>  	struct net_device *ndev = dev_get_drvdata(dev);
> +	struct sh_eth_private *mdp = netdev_priv(ndev);
>  	int ret = 0;
>
> -	if (netif_running(ndev)) {
> +	if (!netif_running(ndev))
> +		return 0;
> +
> +	if (mdp->wol_enabled)
> +		ret = sh_eth_wol_restore(ndev);
> +	else
>  		ret = sh_eth_open(ndev);
> -		if (ret < 0)
> -			return ret;
> +
> +	if (!ret)

    Please keep the original error return logic, so that you can return 0 at 
the end...

>  		netif_device_attach(ndev);
> -	}
>
>  	return ret;
>  }
> diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
> index d050f37..26c6620 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.h
> +++ b/drivers/net/ethernet/renesas/sh_eth.h
> @@ -493,6 +493,7 @@ struct sh_eth_cpu_data {
>  	unsigned shift_rd0:1;	/* shift Rx descriptor word 0 right by 16 */
>  	unsigned rmiimode:1;	/* EtherC has RMIIMODE register */
>  	unsigned rtrate:1;	/* EtherC has RTRATE register */
> +	unsigned magic:1;	/* EtherC have PMDE in ECMR and MPDIP in ECSIPR */

    OK, e.g. RZ/A1 doesn't have these bits...

[...]

MBR, Sergei

^ permalink raw reply

* [PATCH] cxgb4/cxgb4vf: Assign netdev->dev_port with port ID
From: Ganesh Goudar @ 2016-12-08 12:39 UTC (permalink / raw)
  To: netdev, davem
  Cc: nirranjan, Arjun V, Casey Leedom, Hariprasad Shenai,
	Ganesh Goudar

From: Arjun V <arjun@chelsio.com>

Added missing dev_port assignment in cxgb4vf driver.
Also made dev_port assignment of cxgb4 in sync with cxgb4vf driver.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Arjun V <arjun@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c     | 1 +
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c          | 1 -
 drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 48113c6..66c37fa 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4921,6 +4921,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 */
 	for_each_port(adapter, i) {
 		pi = adap2pinfo(adapter, i);
+		adapter->port[i]->dev_port = pi->lport;
 		netif_set_real_num_tx_queues(adapter->port[i], pi->nqsets);
 		netif_set_real_num_rx_queues(adapter->port[i], pi->nqsets);
 
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 20dec85..e813951 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -7851,7 +7851,6 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
 			return ret;
 
 		memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN);
-		adap->port[i]->dev_port = j;
 		j++;
 	}
 	return 0;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index fa43e06d..0d1a134 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -2960,6 +2960,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
 
 		netdev->netdev_ops = &cxgb4vf_netdev_ops;
 		netdev->ethtool_ops = &cxgb4vf_ethtool_ops;
+		netdev->dev_port = pi->port_id;
 
 		/*
 		 * Initialize the hardware/software state for the port.
-- 
2.1.0

^ permalink raw reply related

* [PATCH] cxgb4: Support compressed error vector for T6
From: Ganesh Goudar @ 2016-12-08 13:01 UTC (permalink / raw)
  To: netdev, davem
  Cc: nirranjan, Arjun V, Santosh Rastapur, Hariprasad Shenai,
	Ganesh Goudar

From: Arjun V <arjun@chelsio.com>

t6fw-1.15.15.0 enabled compressed error vector in cpl_rx_pkt for T6.
Updating driver to take care of these changes.

Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
Signed-off-by: Arjun V <arjun@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h   |  5 +++++
 drivers/net/ethernet/chelsio/cxgb4/sge.c     | 16 ++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c   |  7 +++++++
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h  | 10 ++++++++++
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h |  4 ++++
 5 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 0bce1bf..9a49c42 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -263,6 +263,11 @@ struct tp_params {
 	u32 vlan_pri_map;               /* cached TP_VLAN_PRI_MAP */
 	u32 ingress_config;             /* cached TP_INGRESS_CONFIG */
 
+	/* cached TP_OUT_CONFIG compressed error vector
+	 * and passing outer header info for encapsulated packets.
+	 */
+	int rx_pkt_encap;
+
 	/* TP_VLAN_PRI_MAP Compressed Filter Tuple field offsets.  This is a
 	 * subset of the set of fields which may be present in the Compressed
 	 * Filter Tuple portion of filters and TCP TCB connections.  The
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 9f60647..4576225 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2038,13 +2038,20 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
 	struct sge *s = &q->adap->sge;
 	int cpl_trace_pkt = is_t4(q->adap->params.chip) ?
 			    CPL_TRACE_PKT : CPL_TRACE_PKT_T5;
+	u16 err_vec;
 	struct port_info *pi;
 
 	if (unlikely(*(u8 *)rsp == cpl_trace_pkt))
 		return handle_trace_pkt(q->adap, si);
 
 	pkt = (const struct cpl_rx_pkt *)rsp;
-	csum_ok = pkt->csum_calc && !pkt->err_vec &&
+	/* Compressed error vector is enabled for T6 only */
+	if (q->adap->params.tp.rx_pkt_encap)
+		err_vec = T6_COMPR_RXERR_VEC_G(be16_to_cpu(pkt->err_vec));
+	else
+		err_vec = be16_to_cpu(pkt->err_vec);
+
+	csum_ok = pkt->csum_calc && !err_vec &&
 		  (q->netdev->features & NETIF_F_RXCSUM);
 	if ((pkt->l2info & htonl(RXF_TCP_F)) &&
 	    !(cxgb_poll_busy_polling(q)) &&
@@ -2092,7 +2099,12 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
 		if (!(pkt->l2info & cpu_to_be32(CPL_RX_PKT_FLAGS))) {
 			if ((pkt->l2info & cpu_to_be32(RXF_FCOE_F)) &&
 			    (pi->fcoe.flags & CXGB_FCOE_ENABLED)) {
-				if (!(pkt->err_vec & cpu_to_be16(RXERR_CSUM_F)))
+				if (adapter->params.tp.rx_pkt_encap)
+					csum_ok = err_vec &
+						  T6_COMPR_RXERR_CSUM_F;
+				else
+					csum_ok = err_vec & RXERR_CSUM_F;
+				if (!csum_ok)
 					skb->ip_summed = CHECKSUM_UNNECESSARY;
 			}
 		}
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index e813951..cd5f437 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -7686,6 +7686,13 @@ int t4_init_tp_params(struct adapter *adap)
 				 &adap->params.tp.ingress_config, 1,
 				 TP_INGRESS_CONFIG_A);
 	}
+	/* For T6, cache the adapter's compressed error vector
+	 * and passing outer header info for encapsulated packets.
+	 */
+	if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {
+		v = t4_read_reg(adap, TP_OUT_CONFIG_A);
+		adap->params.tp.rx_pkt_encap = (v & CRXPKTENC_F) ? 1 : 0;
+	}
 
 	/* Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field
 	 * shift positions of several elements of the Compressed Filter Tuple
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
index fba3b2a..5ca38e0 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
@@ -1162,6 +1162,16 @@ struct cpl_rx_pkt {
 #define RXERR_CSUM_V(x) ((x) << RXERR_CSUM_S)
 #define RXERR_CSUM_F    RXERR_CSUM_V(1U)
 
+#define T6_COMPR_RXERR_LEN_S    1
+#define T6_COMPR_RXERR_LEN_V(x) ((x) << T6_COMPR_RXERR_LEN_S)
+#define T6_COMPR_RXERR_LEN_F    T6_COMPR_RXERR_LEN_V(1U)
+
+#define T6_COMPR_RXERR_VEC_S    0
+#define T6_COMPR_RXERR_VEC_M    0x3F
+#define T6_COMPR_RXERR_VEC_V(x) ((x) << T6_COMPR_RXERR_LEN_S)
+#define T6_COMPR_RXERR_VEC_G(x) \
+		(((x) >> T6_COMPR_RXERR_VEC_S) & T6_COMPR_RXERR_VEC_M)
+
 struct cpl_trace_pkt {
 	u8 opcode;
 	u8 intf;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
index 9fea255..e685163 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
@@ -1276,6 +1276,10 @@
 #define DBGLARPTR_M    0x7fU
 #define DBGLARPTR_V(x) ((x) << DBGLARPTR_S)
 
+#define CRXPKTENC_S    3
+#define CRXPKTENC_V(x) ((x) << CRXPKTENC_S)
+#define CRXPKTENC_F    CRXPKTENC_V(1U)
+
 #define TP_DBG_LA_DATAL_A	0x7ed8
 #define TP_DBG_LA_CONFIG_A	0x7ed4
 #define TP_OUT_CONFIG_A		0x7d04
-- 
2.1.0

^ permalink raw reply related

* [PATCH] net: socket: preferred __aligned(size) for control buffer
From: kushwaha.a @ 2016-12-08 12:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, akkushwaha9896

From: Amit Kushwaha <kushwaha.a@samsung.com>

This patch cleanup checkpatch.pl warning
WARNING: __aligned(size) is preferred over __attribute__((aligned(size)))

Signed-off-by: Amit Kushwaha <kushwaha.a@samsung.com>
---
 net/socket.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/socket.c b/net/socket.c
index e631894..5835383 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1,3 +1,4 @@
+
 /*
  * NET		An implementation of the SOCKET network access protocol.
  *
@@ -1918,7 +1919,7 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
 	struct sockaddr_storage address;
 	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
 	unsigned char ctl[sizeof(struct cmsghdr) + 20]
-	    __attribute__ ((aligned(sizeof(__kernel_size_t))));
+				__aligned(sizeof(__kernel_size_t));
 	/* 20 is size of ipv6_pktinfo */
 	unsigned char *ctl_buf = ctl;
 	int ctl_len;
-- 
1.7.9.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