Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next 04/20] net: dsa: change scope of FDB handlers
From: Florian Fainelli @ 2017-05-22 19:25 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170519210055.9366-5-vivien.didelot@savoirfairelinux.com>

On 05/19/2017 02:00 PM, Vivien Didelot wrote:
> Change the scope of the switchdev FDB object handlers from the DSA slave
> device to the generic DSA port, so that the future port-wide API can
> also be used for other port types, such as CPU and DSA links.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next 03/20] net: dsa: change scope of bridging code
From: Florian Fainelli @ 2017-05-22 19:24 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170519210055.9366-4-vivien.didelot@savoirfairelinux.com>

On 05/19/2017 02:00 PM, Vivien Didelot wrote:
> Now that the bridge join and leave functions only deal with a DSA port,
> change their scope from the DSA slave net_device to the DSA generic
> dsa_port.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH 1/3] RDS: IB: Delete an error message for a failed memory allocation in rds_ib_add_one()
From: Santosh Shilimkar @ 2017-05-22 19:24 UTC (permalink / raw)
  To: SF Markus Elfring, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
	David S. Miller, Sowmini Varadhan
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <e3491aaa-f471-c67c-43dc-41d592159c8e-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

On 5/22/2017 7:11 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Date: Mon, 22 May 2017 15:34:28 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> ---
>   net/rds/ib.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/net/rds/ib.c b/net/rds/ib.c
> index 7a64c8db81ab..c5514d058171 100644
> --- a/net/rds/ib.c
> +++ b/net/rds/ib.c
> @@ -166,8 +166,5 @@ static void rds_ib_add_one(struct ib_device *device)
> -	if (!rds_ibdev->vector_load) {
> -		pr_err("RDS/IB: %s failed to allocate vector memory\n",
> -			__func__);
> +	if (!rds_ibdev->vector_load)
>   		goto put_dev;
> -	}
>   
Well the ENOMEM is not carried here so the message was usefu
but its not critical so its fine to clean that up.

Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 02/20] net: dsa: change scope of notifier call chain
From: Florian Fainelli @ 2017-05-22 19:24 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170519210055.9366-3-vivien.didelot@savoirfairelinux.com>

On 05/19/2017 02:00 PM, Vivien Didelot wrote:
> Change the scope of the fabric notification helper from the DSA slave to
> the DSA port, since this is a DSA layer specific notion, that can be
> used by non-slave ports (CPU and DSA).
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next 01/20] net: dsa: change scope of STP state setter
From: Florian Fainelli @ 2017-05-22 19:23 UTC (permalink / raw)
  To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn
In-Reply-To: <20170519210055.9366-2-vivien.didelot@savoirfairelinux.com>

On 05/19/2017 02:00 PM, Vivien Didelot wrote:
> Instead of having multiple STP state helpers scoping a slave device
> supporting both the DSA logic and the switchdev binding, provide a
> single dsa_port_set_state helper scoping a DSA port, as well as its
> dsa_port_set_state_now wrapper which skips the prepare phase.
> 
> This allows us to better separate the DSA logic from the slave device
> handling.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply

* Re: [PATCH 2/3] RDS: IB: Improve a size determination in rds_ib_add_one()
From: Santosh Shilimkar @ 2017-05-22 19:22 UTC (permalink / raw)
  To: SF Markus Elfring, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
	David S. Miller, Sowmini Varadhan
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <e8486283-62ac-ea77-1169-edca3e630637-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

On 5/22/2017 7:12 AM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Date: Mon, 22 May 2017 15:40:21 +0200
> 
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v1] ACPI: Switch to use generic UUID API
From: Andy Shevchenko @ 2017-05-22 19:08 UTC (permalink / raw)
  To: linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Felipe Balbi, Heikki Krogerus, Mathias Nyman, Yisen Zhuang,
	Amir Goldstein, Rafael J . Wysocki, Adrian Hunter,
	Jarkko Sakkinen, Liam Girdwood, Benjamin Tissoires, Mark Brown,
	Jani Nikula, Bjorn Helgaas, Dan Williams, Borislav Petkov,
	Mika Westerberg, Zhang Rui, Ben Skeggs
In-Reply-To: <20170504092151.88646-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

On Thu, 2017-05-04 at 12:21 +0300, Andy Shevchenko wrote:
> acpi_evaluate_dsm() and friends take a pointer to a raw buffer of 16
> bytes. Instead we convert them to use uuid_le type. At the same time
> we
> convert current users.
> 
> acpi_str_to_uuid() becomes useless after the conversion and it's safe
> to
> get rid of it.
> 
> The conversion fixes a potential bug in int340x_thermal as well since
> we have to use memcmp() on binary data.
> 
> Cc: Rafael J. Wysocki <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>
> Cc: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
> Cc: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Amir Goldstein <amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: Jani Nikula <jani.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Benjamin Tissoires <benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
> Cc: Adrian Hunter <adrian.hunter-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Yisen Zhuang <yisen.zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Cc: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Cc: Zhang Rui <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Mathias Nyman <mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Heikki Krogerus <heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Thank you everyone who gave a tag to this.

I'm going to split and rebase on top of Christoph's branch
http://git.infradead.org/users/hch/vfs.git/shortlog/refs/heads/uuid-type
s

followed by changing types and API calls accordingly (without changing a
logic!).

So, I would like to keep tags in place. If there is any objection, speak
up now!
 
Thanks!

-- 
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Intel Finland Oy

^ permalink raw reply

* Re: arch: arm: bpf: Converting cBPF to eBPF for arm 32 bit
From: Florian Fainelli @ 2017-05-22 19:08 UTC (permalink / raw)
  To: Kees Cook, Shubham Bansal
  Cc: Daniel Borkmann, kernel-hardening@lists.openwall.com,
	Network Development, ast, Mircea Gherzan, David Miller,
	linux-arm-kernel@lists.infradead.org, nschichan, andrew
In-Reply-To: <CAGXu5j+k+NMQGmmhuW-4pHFd6agfndJfxQ9k--h+ZpsDBVB8ig@mail.gmail.com>

On 05/22/2017 11:58 AM, Kees Cook wrote:
> On Sat, May 20, 2017 at 1:01 PM, Shubham Bansal
> <illusionist.neo@gmail.com> wrote:
>> Hi Daniel and Kees,
>>
>> Before I send the patch, I have tested the JIT compiler on ARMv7 but
>> not on ARMv5 or ARMv6. So can you tell me which arch versions I should
>> test it for?
>> Also for my testing, CONFIG_FRAME_POINTER and CONFIG_CPU_BIG_ENDIAN
>> are both disabled. But I need to test JIT with these flags as well.
>> Whenever I put these flags in .config file, the arm kernel is not
>> getting compiler with these flags. Can you tell me why? If you need
>> more information regarding this, please let me know.
> 
> I think it is fine to only target ARMv7. It is harder and harder to
> find devices on v5 or v6 CPUs that would want to be using BPF JIT,
> IMO.

There are still a ton of Marvell-based routers out there (e.g: Kirkwood,
Orion5x) that are ARMv5 and that prompted Nicholas (hey there) to fix
the cBPF JIT a while ago. I don't think you can just ignore those, it's
fine not to target them initially, but arguably, QEMU has decent support
for some ARMv5 platforms that could be used for testing as well
(realview-eb, versatileab/pbm.

These devices are actually perfect candidates for running eBPF and to
some extent XDP because they are slightly under powered compared to
their newest ARMv7/ARMv8 counterparts.

> 
> When they "disappear", it's because there isn't a prerequisite met. I
> either read the Kconfig files or use "make menuconfig" and "search" to
> tell me where a config is defined and what is needed to meet the
> prerequisites.
> 
> In the case of CPU_BIG_ENDIAN, you need ARCH_SUPPORTS_BIG_ENDIAN,
> which appears to be only ARCH_IXP4XX. I don't think you're going to
> find an emulator that will handle this, so I'd suggest ignoring this
> config for now unless you can find someone with that hardware that you
> can work with to test it.
> 
> In the case of CONFIG_FRAME_POINTER, I assume you built a
> THUMB2_KERNEL? I'd read the notes in arch/arm/Kconfig.debug for
> 'config FRAME_POINTER'.

It sounds like we are at the point where Shubham's patches should be
posted so people could test/fix on earlier ARM devices for instance.

Thanks
-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next v2 00/13] nfp: introduce nfp_port and nfp_app
From: David Miller @ 2017-05-22 19:00 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: netdev, oss-drivers
In-Reply-To: <20170522175934.27447-1-jakub.kicinski@netronome.com>

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Mon, 22 May 2017 10:59:21 -0700

> This series builds foundation for upcoming development.  So far the nfp
> driver was focused on delivering basic NIC-like functionality.  We want
> to switch gears a bit going forward and support more advanced applications.
 ...

Series applied, thanks.

^ permalink raw reply

* Re: arch: arm: bpf: Converting cBPF to eBPF for arm 32 bit
From: Kees Cook @ 2017-05-22 18:58 UTC (permalink / raw)
  To: Shubham Bansal
  Cc: Daniel Borkmann, David Miller, Mircea Gherzan,
	Network Development, kernel-hardening@lists.openwall.com,
	linux-arm-kernel@lists.infradead.org, ast
In-Reply-To: <CAHgaXdKKbRVSpX-036TXpV5z=1=QCnPoku0+CeHxHco8-aasPQ@mail.gmail.com>

On Sat, May 20, 2017 at 1:01 PM, Shubham Bansal
<illusionist.neo@gmail.com> wrote:
> Hi Daniel and Kees,
>
> Before I send the patch, I have tested the JIT compiler on ARMv7 but
> not on ARMv5 or ARMv6. So can you tell me which arch versions I should
> test it for?
> Also for my testing, CONFIG_FRAME_POINTER and CONFIG_CPU_BIG_ENDIAN
> are both disabled. But I need to test JIT with these flags as well.
> Whenever I put these flags in .config file, the arm kernel is not
> getting compiler with these flags. Can you tell me why? If you need
> more information regarding this, please let me know.

I think it is fine to only target ARMv7. It is harder and harder to
find devices on v5 or v6 CPUs that would want to be using BPF JIT,
IMO.

When they "disappear", it's because there isn't a prerequisite met. I
either read the Kconfig files or use "make menuconfig" and "search" to
tell me where a config is defined and what is needed to meet the
prerequisites.

In the case of CPU_BIG_ENDIAN, you need ARCH_SUPPORTS_BIG_ENDIAN,
which appears to be only ARCH_IXP4XX. I don't think you're going to
find an emulator that will handle this, so I'd suggest ignoring this
config for now unless you can find someone with that hardware that you
can work with to test it.

In the case of CONFIG_FRAME_POINTER, I assume you built a
THUMB2_KERNEL? I'd read the notes in arch/arm/Kconfig.debug for
'config FRAME_POINTER'.

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply

* Re: [patch net-next] net: sched: cls_matchall: fix null pointer dereference
From: David Miller @ 2017-05-22 18:54 UTC (permalink / raw)
  To: jiri; +Cc: netdev, jhs, xiyou.wangcong, mlxsw, colin.king, yotamg
In-Reply-To: <20170522144613.22848-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 22 May 2017 16:46:13 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Since the head is guaranteed by the check above to be null, the call_rcu
> would explode. Remove the previously logically dead code that was made
> logically very much alive and kicking.
> 
> Fixes: 985538eee06f ("net/sched: remove redundant null check on head")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Ouch... that's kinda scary.

This fix is needed in the 'net' tree so that's where I have applied
it.

Thanks.

^ permalink raw reply

* Re: [PATCH v2 4/4] net-next: stmmac: rework the speed selection
From: David Miller @ 2017-05-22 18:49 UTC (permalink / raw)
  To: clabbe.montjoie; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel
In-Reply-To: <20170522123347.5295-5-clabbe.montjoie@gmail.com>

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Mon, 22 May 2017 14:33:47 +0200

> The current stmmac_adjust_link() part which handle speed have
> some if (has_platform) code and my dwmac-sun8i will add more of them.
> 
> So we need to handle better speed selection.
> Moreover the struct link member speed and port are hard to guess their
> purpose. And their unique usage are to be combined for writing speed.
> 
> So this patch replace speed/port by simpler
> speed10/speed100/speed1000/speed_mask variables.
> 
> In dwmac4_core_init and dwmac1000_core_init, port/speed value was used
> directly without using the struct link. This patch convert also their
> usage to speedxxx.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/common.h       |  8 ++++---
>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   | 26 +++++++++++++---------
>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |  6 +++--
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  | 26 +++++++++++++---------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 21 ++++-------------
>  5 files changed, 43 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index b7ce3fbb5375..e82b4b70b7be 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -549,9 +549,11 @@ extern const struct stmmac_hwtimestamp stmmac_ptp;
>  extern const struct stmmac_mode_ops dwmac4_ring_mode_ops;
>  
>  struct mac_link {
> -	int port;
> -	int duplex;
> -	int speed;
> +	u32 speed_mask;
> +	u32 speed10;
> +	u32 speed100;
> +	u32 speed1000;
> +	u32 duplex;
>  };
>  
>  struct mii_regs {
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> index f3d9305e5f70..b8848a9d70c5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> @@ -45,15 +45,17 @@ static void dwmac1000_core_init(struct mac_device_info *hw, int mtu)
>  	if (hw->ps) {
>  		value |= GMAC_CONTROL_TE;
>  
> -		if (hw->ps == SPEED_1000) {
> -			value &= ~GMAC_CONTROL_PS;
> -		} else {
> -			value |= GMAC_CONTROL_PS;
> -
> -			if (hw->ps == SPEED_10)
> -				value &= ~GMAC_CONTROL_FES;
> -			else
> -				value |= GMAC_CONTROL_FES;
> +		value &= ~hw->link.speed_mask;
> +		switch (hw->ps) {
> +		case SPEED_1000:
> +			value |= hw->link.speed1000;
> +			break;
> +		case SPEED_100:
> +			value |= hw->link.speed100;
> +			break;
> +		case SPEED_10:
> +			value |= hw->link.speed10;
> +			break;
>  		}
>  	}
>  
> @@ -531,9 +533,11 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
>  	mac->mac = &dwmac1000_ops;
>  	mac->dma = &dwmac1000_dma_ops;
>  
> -	mac->link.port = GMAC_CONTROL_PS;
>  	mac->link.duplex = GMAC_CONTROL_DM;
> -	mac->link.speed = GMAC_CONTROL_FES;
> +	mac->link.speed10 = GMAC_CONTROL_PS;
> +	mac->link.speed100 = GMAC_CONTROL_PS | GMAC_CONTROL_FES;
> +	mac->link.speed1000 = 0;
> +	mac->link.speed_mask = GENMASK(15, 14);

Neither GMAC_CONTROL_PS nor GMAC_CONTROL_FES are defined with
the GENMASK() macro.  So it is very confusing to see constant
bit specifications here in C code.

There are two ways to do this properly:

1) Use "(GMAC_CONTROL_PS | GMAC_CONTROL_FES)"

2) Define a new GMAC_CONTROL_SPDMASK to "GMAC_CONTROL_PS | GMAC_CONTROL_FES"
   and use that here.

> @@ -747,9 +749,11 @@ struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
>  	if (mac->multicast_filter_bins)
>  		mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
>  
> -	mac->link.port = GMAC_CONFIG_PS;
>  	mac->link.duplex = GMAC_CONFIG_DM;
> -	mac->link.speed = GMAC_CONFIG_FES;
> +	mac->link.speed10 = GMAC_CONFIG_PS;
> +	mac->link.speed100 = GMAC_CONFIG_FES | GMAC_CONFIG_PS;
> +	mac->link.speed1000 = 0;
> +	mac->link.speed_mask = GENMASK(15, 14);
>  	mac->mii.addr = GMAC_MDIO_ADDR;
>  	mac->mii.data = GMAC_MDIO_DATA;
>  	mac->mii.addr_shift = 21;

Likewise.

^ permalink raw reply

* Re: [PATCH] include stdint.h explicitly for UINT16_MAX)
From: Stephen Hemminger @ 2017-05-22 18:44 UTC (permalink / raw)
  To: Khem Raj; +Cc: netdev
In-Reply-To: <20170520212846.3534-1-raj.khem@gmail.com>

On Sat, 20 May 2017 14:28:46 -0700
Khem Raj <raj.khem@gmail.com> wrote:

> Fixes
> | tc_core.c:190:29: error: 'UINT16_MAX' undeclared (first use in this function); did you mean '__INT16_MAX__'?
> |    if ((sz >> s->size_log) > UINT16_MAX) {
> |                              ^~~~~~~~~~
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v2] bridge: fix hello and hold timers starting/stopping
From: David Miller @ 2017-05-22 18:41 UTC (permalink / raw)
  To: cera; +Cc: netdev, sashok, stephen, bridge, lucien.xin, nikolay
In-Reply-To: <20170519173043.10201-1-cera@cera.cz>

From: Ivan Vecera <cera@cera.cz>
Date: Fri, 19 May 2017 19:30:43 +0200

> Current bridge code incorrectly handles starting/stopping of hello and
> hold timers during STP enable/disable.
> 
> 1. Timers are stopped in br_stp_start() during NO_STP->USER_STP
>    transition. The timers are already stopped in NO_STP state so
>    this is confusing no-op.
> 
> 2. During USER_STP->NO_STP transition the timers are started. This
>    does not make sense and is confusion because the timer should not be
>    active in NO_STP state.
> 
> Cc: davem@davemloft.net
> Cc: sashok@cumulusnetworks.com
> Cc: stephen@networkplumber.org
> Cc: bridge@lists.linux-foundation.org
> Cc: lucien.xin@gmail.com
> Cc: nikolay@cumulusnetworks.com
> Signed-off-by: Ivan Vecera <cera@cera.cz>

Applied.

^ permalink raw reply

* Re: [Patch net] vsock: use new wait API for vsock_stream_sendmsg()
From: David Miller @ 2017-05-22 18:39 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, stefanha, jhansen, mst, imbrenda
In-Reply-To: <1495218119-12358-1-git-send-email-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Fri, 19 May 2017 11:21:59 -0700

> As reported by Michal, vsock_stream_sendmsg() could still
> sleep at vsock_stream_has_space() after prepare_to_wait():
> 
>   vsock_stream_has_space
>     vmci_transport_stream_has_space
>       vmci_qpair_produce_free_space
>         qp_lock
>           qp_acquire_queue_mutex
>             mutex_lock
> 
> Just switch to the new wait API like we did for commit
> d9dc8b0f8b4e ("net: fix sleeping for sk_wait_event()").
> 
> Reported-by: Michal Kubecek <mkubecek@suse.cz>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Jorgen Hansen <jhansen@vmware.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH net] bonding: fix randomly populated arp target array
From: David Miller @ 2017-05-22 18:38 UTC (permalink / raw)
  To: jarod; +Cc: linux-kernel, maheshb, j.vosburgh, vfalico, andy, netdev, stable
In-Reply-To: <20170519184646.42572-1-jarod@redhat.com>

From: Jarod Wilson <jarod@redhat.com>
Date: Fri, 19 May 2017 14:46:46 -0400

> In commit dc9c4d0fe023, the arp_target array moved from a static global
> to a local variable. By the nature of static globals, the array used to
> be initialized to all 0. At present, it's full of random data, which
> that gets interpreted as arp_target values, when none have actually been
> specified. Systems end up booting with spew along these lines:
 ...
> None of these were actually specified as ARP targets, and the driver does
> seem to clean up the mess okay, but it's rather noisy and confusing, leaks
> values to userspace, and the 255.255.255.255 spew shows up even when debug
> prints are disabled.
> 
> The fix: just zero out arp_target at init time.
> 
> While we're in here, init arp_all_targets_value in the right place.
> 
> Fixes: dc9c4d0fe023 ("bonding: reduce scope of some global variables")
> CC: Mahesh Bandewar <maheshb@google.com>
> CC: Jay Vosburgh <j.vosburgh@gmail.com>
> CC: Veaceslav Falico <vfalico@gmail.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> CC: netdev@vger.kernel.org
> CC: stable@vger.kernel.org
> Signed-off-by: Jarod Wilson <jarod@redhat.com>

Whoops... applied, thanks Jarod.

^ permalink raw reply

* Re: [PATCH net-next 01/11] qede: Fix sparse warnings
From: David Miller @ 2017-05-22 18:29 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: netdev, Manish.Chopra
In-Reply-To: <BLUPR0701MB20043F202421D02E697198338DF80@BLUPR0701MB2004.namprd07.prod.outlook.com>

From: "Mintz, Yuval" <Yuval.Mintz@cavium.com>
Date: Mon, 22 May 2017 17:44:12 +0000

>> >> Please.
>> >> 
>> >> This is exactly the problem when such a terse commit message, or lack of any
>> >> message at all as is the case here, occurs.
>> >> 
>> >> I have no idea what removing this method assignment has to do with fixing
>> >> sparse warnings.
>> > 
>> > It's currently defined twice in the qede_dcbnl_ops struct -
> 
>> >Ok, so what's important is that you don't just post a patch with no
>> commit message, just saying "sparse warning fixes."
> 
>> At a minimum, if you're too lazy to explain what exactly each thing
>> is fixing, provide the sparse warnings you are eliminating in the
>> commit message.
> 
> Well, this time it was intentional lazines; Thought it would have been
> wasted reading. But sure, here it is:
> 
> drivers/net/ethernet/qlogic/qede/qede_fp.c:349:34: warning: invalid assignment: |=
> drivers/net/ethernet/qlogic/qede/qede_fp.c:349:34:    left side has type restricted __le16
> drivers/net/ethernet/qlogic/qede/qede_fp.c:349:34:    right side has type int
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1516:50: warning: invalid assignment: |=
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1516:50:    left side has type restricted __le16
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1516:50:    right side has type int
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1525:50: warning: invalid assignment: ^=
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1525:50:    left side has type restricted __le16
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1525:50:    right side has type int
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1590:42: warning: invalid assignment: |=
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1590:42:    left side has type restricted __le16
> drivers/net/ethernet/qlogic/qede/qede_fp.c:1590:42:    right side has type unsigned int
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1315:34: warning: invalid assignment: |=
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1315:34:    left side has type restricted __le16
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1315:34:    right side has type int
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1330:13: warning: incorrect type in assignment (different base types)
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1330:13:    expected int [signed] [assigned] val
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1330:13:    got restricted __le16 [usertype] <noident>
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1331:33: warning: incorrect type in assignment (different base types)
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1331:33:    expected restricted __le16 [usertype] bd_prod
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:1331:33:    got int [signed] [assigned] val
> drivers/net/ethernet/qlogic/qede/qede_roce.c:224:29: warning: symbol 'qede_roce_get_free_event_node' was not declared. Should it be static?
> 
> Do you want us to re-spin the series with the updated commit message?

Where in that log above does it say that the method is defined twice
in qede_dcbnl_ops?

I hate to say this, but this is why I get frustrated with such across
the board cleanups with empty commit messages.

^ permalink raw reply

* Re: [RFC net-next PATCH 2/5] mlx5: fix bug reading rss_hash_type from CQE
From: Jesper Dangaard Brouer @ 2017-05-22 18:27 UTC (permalink / raw)
  To: David Miller
  Cc: borkmann, alexei.starovoitov, john.r.fastabend, netdev, brouer
In-Reply-To: <20170519.193818.1096111302686413939.davem@davemloft.net>

On Fri, 19 May 2017 19:38:18 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:

> From: Jesper Dangaard Brouer <brouer@redhat.com>
> Date: Thu, 18 May 2017 17:41:38 +0200
> 
> > Masks for extracting part of the Completion Queue Entry (CQE)
> > field rss_hash_type was swapped, namely CQE_RSS_HTYPE_IP and
> > CQE_RSS_HTYPE_L4.
> > 
> > The bug resulted in setting skb->l4_hash, even-though the
> > rss_hash_type indicated that hash was NOT computed over the
> > L4 (UDP or TCP) part of the packet.
> > 
> > Added comments from the datasheet, to make it more clear what
> > these masks are selecting.
> > 
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>  
> 
> Please pass this along to the mlx5 developers as a standalone
> bug fix for 'net', thank you.

Done, send as separate patch.
 http://patchwork.ozlabs.org/patch/765537/

-- 
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 0/3] stmmac: pci: Refactor DMI probing
From: David Miller @ 2017-05-22 18:23 UTC (permalink / raw)
  To: jan.kiszka
  Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel,
	andy.shevchenko
In-Reply-To: <16d9bbf6-0579-f16c-4177-251fa3837a2a@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>
Date: Mon, 22 May 2017 19:06:07 +0200

> On 2017-05-22 18:35, David Miller wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>> Date: Mon, 22 May 2017 13:12:06 +0200
>> 
>>> Some cleanups of the way we probe DMI platforms in the driver. Reduces
>>> a bit of open-coding and makes the logic easier reusable for any
>>> potential DMI platform != Quark.
>>>
>>> Tested on IOT2000 and Galileo Gen2.
>> 
>> This doesn't compile:
>> 
>> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:285:3: error: initializer element is not computable at load time
>>    (kernel_ulong_t)&stmmac_default_setup,
>>    ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:285:3: note: (near initialization for ‘stmmac_id_table[0].class’)
>> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:289:3: error: initializer element is not computable at load time
>>    (kernel_ulong_t)&stmmac_default_setup,
>>    ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:289:3: note: (near initialization for ‘stmmac_id_table[1].class’)
>> scripts/Makefile.build:302: recipe for target 'drivers/net/ethernet/stmicro/stmmac/stmmac_pci.o' failed
>> make[5]: *** [drivers/net/ethernet/stmicro/stmmac/stmmac_pci.o] Error 1
>> 
> 
> Hmm. Which arch is this?

x86_64, allmodconfig

^ permalink raw reply

* Re: [PATCH] net: set default value for somaxconn
From: David Miller @ 2017-05-22 18:18 UTC (permalink / raw)
  To: roman.kapl; +Cc: netdev
In-Reply-To: <20170522122241.28389-1-roman.kapl@sysgo.com>

From: Roman Kapl <roman.kapl@sysgo.com>
Date: Mon, 22 May 2017 14:22:41 +0200

> The default value for somaxconn is set in sysctl_core_net_init(), but this
> function is not called when kernel is configured without CONFIG_SYSCTL.
> 
> This results in the kernel not being able to accept TCP connections,
> because the backlog has zero size. Usually, the user ends up with:
> "TCP: request_sock_TCP: Possible SYN flooding on port 7. Dropping request.  Check SNMP counters."
> 
> Before ef547f2ac16 (tcp: remove max_qlen_log), the effects were less
> severe, because the backlog was always at least eight slots long.
> 
> Signed-off-by: Roman Kapl <roman.kapl@sysgo.com>

I see the problem, but this changes behavior.

Existing code will set somaxconn to the default value for every namespace
that is created.

But with you changes, any modification made to init_net's value will
get inherited by any namespace created as a child thereafterwards.

You really need to make this happen via pernet_operations, or even
inside of setup_net().

^ permalink raw reply

* [net PATCH] mlx5: fix bug reading rss_hash_type from CQE
From: Jesper Dangaard Brouer @ 2017-05-22 18:13 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Daniel Borkmann, netdev, Tariq Toukan, Alexei Starovoitov,
	Jesper Dangaard Brouer

Masks for extracting part of the Completion Queue Entry (CQE)
field rss_hash_type was swapped, namely CQE_RSS_HTYPE_IP and
CQE_RSS_HTYPE_L4.

The bug resulted in setting skb->l4_hash, even-though the
rss_hash_type indicated that hash was NOT computed over the
L4 (UDP or TCP) part of the packet.

Added comments from the datasheet, to make it more clear what
these masks are selecting.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 include/linux/mlx5/device.h |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index dd9a263ed368..a940ec6a046c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -787,8 +787,14 @@ enum {
 };
 
 enum {
-	CQE_RSS_HTYPE_IP	= 0x3 << 6,
-	CQE_RSS_HTYPE_L4	= 0x3 << 2,
+	CQE_RSS_HTYPE_IP	= 0x3 << 2,
+	/* cqe->rss_hash_type[3:2] - IP destination selected for hash
+	 * (00 = none,  01 = IPv4, 10 = IPv6, 11 = Reserved)
+	 */
+	CQE_RSS_HTYPE_L4	= 0x3 << 6,
+	/* cqe->rss_hash_type[7:6] - L4 destination selected for hash
+	 * (00 = none, 01 = TCP. 10 = UDP, 11 = IPSEC.SPI
+	 */
 };
 
 enum {

^ permalink raw reply related

* Re: [PATCH iproute2] ip: add support for more MPLS labels
From: Stephen Hemminger @ 2017-05-22 18:04 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev
In-Reply-To: <20170514012702.1083-1-dsahern@gmail.com>

On Sat, 13 May 2017 19:27:02 -0600
David Ahern <dsahern@gmail.com> wrote:

> Kernel now supports up to 30 labels but not defined as part of the uapi.
> iproute2 handles up to 8 labels but in a non-consistent way. Update ip
> to handle more labels, but in a more programmatic way.
> 
> For the MPLS address family, the data field in inet_prefix is used for
> labels.  Increase that field to 64 u32's -- 64 as nothing more than a
> convenient power of 2 number.
> 
> Update mpls_pton to take the length of the address field, convert that
> length to number of labels and add better error handling to the parsing
> of the user supplied string.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>

Looks good applied

^ permalink raw reply

* Re: [PATCH v2 00/10] rt2x00: rt2x00: improve calling conventions for register accessors
From: Jes Sorensen @ 2017-05-22 18:03 UTC (permalink / raw)
  To: Arnd Bergmann, linux-wireless
  Cc: Stanislaw Gruszka, David Miller, Helmut Schaa, Kalle Valo,
	Daniel Golle, Mathias Kresin, Johannes Berg, Serge Vasilugin,
	Roman Yeryomin, Networking, Linux Kernel Mailing List,
	Tom Psyborg
In-Reply-To: <20170517144702.1381136-1-arnd-r2nGTMty4D4@public.gmane.org>

On 05/17/2017 10:46 AM, Arnd Bergmann wrote:
> I've managed to split up my long patch into a series of reasonble
> steps now.
> 
> The first two are required to fix a regression from commit 41977e86c984
> ("rt2x00: add support for MT7620"), the rest are just cleanups to
> have a consistent state across all the register access functions.
> 
>       Arnd

Nice work! This is a textbook example of how to do this the right way!

Reviewed-by: Jes Sorensen <jsorensen-b10kYP2dOMg@public.gmane.org>

Jes

^ permalink raw reply

* [PATCH net-next v2 12/13] nfp: mark port state as stale if update failed
From: Jakub Kicinski @ 2017-05-22 17:59 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski
In-Reply-To: <20170522175934.27447-1-jakub.kicinski@netronome.com>

If reading new state of the port failed, mark the port back as CHANGED.
This way next user state request will trigger refresh, which will
hopefully succeed.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 12cbf21df3b9..dd1118c7e1a4 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -528,6 +528,7 @@ nfp_net_eth_port_update(struct nfp_cpp *cpp, struct nfp_port *port,
 
 	eth_port = nfp_net_find_port(eth_table, port->eth_id);
 	if (!eth_port) {
+		set_bit(NFP_PORT_CHANGED, &port->flags);
 		nfp_warn(cpp, "Warning: port #%d not present after reconfig\n",
 			 port->eth_id);
 		return -EIO;
@@ -563,6 +564,9 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 
 	eth_table = nfp_eth_read_ports(pf->cpp);
 	if (!eth_table) {
+		list_for_each_entry(port, &pf->ports, port_list)
+			if (__nfp_port_get_eth_port(port))
+				set_bit(NFP_PORT_CHANGED, &port->flags);
 		rtnl_unlock();
 		nfp_err(pf->cpp, "Error refreshing port config!\n");
 		goto out;
@@ -611,6 +615,7 @@ int nfp_net_refresh_eth_port(struct nfp_port *port)
 
 	eth_table = nfp_eth_read_ports(cpp);
 	if (!eth_table) {
+		set_bit(NFP_PORT_CHANGED, &port->flags);
 		nfp_err(cpp, "Error refreshing port state table!\n");
 		return -EIO;
 	}
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 07/13] nfp: introduce nfp_port
From: Jakub Kicinski @ 2017-05-22 17:59 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski
In-Reply-To: <20170522175934.27447-1-jakub.kicinski@netronome.com>

Encapsulate port information into struct nfp_port.  nfp_port will
soon be extended to contain devlink_port information.  It also makes
it easier to reuse port-related code between vNICs and representors.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/Makefile        |   3 +-
 drivers/net/ethernet/netronome/nfp/nfp_net.h       |  14 ++-
 .../net/ethernet/netronome/nfp/nfp_net_common.c    |  25 +----
 .../net/ethernet/netronome/nfp/nfp_net_ethtool.c   |  39 +++++---
 drivers/net/ethernet/netronome/nfp/nfp_net_main.c  |  68 +++++++++-----
 drivers/net/ethernet/netronome/nfp/nfp_port.c      | 104 +++++++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_port.h      |  85 +++++++++++++++++
 7 files changed, 275 insertions(+), 63 deletions(-)
 create mode 100644 drivers/net/ethernet/netronome/nfp/nfp_port.c
 create mode 100644 drivers/net/ethernet/netronome/nfp/nfp_port.h

diff --git a/drivers/net/ethernet/netronome/nfp/Makefile b/drivers/net/ethernet/netronome/nfp/Makefile
index a6b9c4dcbe12..e8333283ada6 100644
--- a/drivers/net/ethernet/netronome/nfp/Makefile
+++ b/drivers/net/ethernet/netronome/nfp/Makefile
@@ -20,7 +20,8 @@ nfp-objs := \
 	    nfp_net_ethtool.o \
 	    nfp_net_offload.o \
 	    nfp_net_main.o \
-	    nfp_netvf_main.o
+	    nfp_netvf_main.o \
+	    nfp_port.o
 
 ifeq ($(CONFIG_BPF_SYSCALL),y)
 nfp-objs += \
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h
index d8edd61a5ad1..8132dd31a6dd 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h
@@ -116,6 +116,7 @@ struct nfp_cpp;
 struct nfp_eth_table_port;
 struct nfp_net;
 struct nfp_net_r_vector;
+struct nfp_port;
 
 /* Convenience macro for wrapping descriptor index on ring size */
 #define D_IDX(ring, idx)	((idx) & ((ring)->cnt - 1))
@@ -558,7 +559,7 @@ struct nfp_net_dp {
  * @vnic_list:		Entry on device vNIC list
  * @pdev:		Backpointer to PCI device
  * @app:		APP handle if available
- * @eth_port:		Translated ETH Table port entry
+ * @port:		Pointer to nfp_port structure if vNIC is a port
  */
 struct nfp_net {
 	struct nfp_net_dp dp;
@@ -630,7 +631,7 @@ struct nfp_net {
 	struct pci_dev *pdev;
 	struct nfp_app *app;
 
-	struct nfp_eth_table_port *eth_port;
+	struct nfp_port *port;
 };
 
 /* Functions to read/write from/to a BAR
@@ -802,6 +803,13 @@ static inline u32 nfp_qcp_wr_ptr_read(u8 __iomem *q)
 /* Globals */
 extern const char nfp_driver_version[];
 
+extern const struct net_device_ops nfp_net_netdev_ops;
+
+static inline bool nfp_netdev_is_nfp_net(struct net_device *netdev)
+{
+	return netdev->netdev_ops == &nfp_net_netdev_ops;
+}
+
 /* Prototypes */
 void nfp_net_get_fw_version(struct nfp_net_fw_version *fw_ver,
 			    void __iomem *ctrl_bar);
@@ -835,8 +843,6 @@ int nfp_net_ring_reconfig(struct nfp_net *nn, struct nfp_net_dp *new,
 			  struct netlink_ext_ack *extack);
 
 bool nfp_net_link_changed_read_clear(struct nfp_net *nn);
-int nfp_net_refresh_eth_port(struct nfp_net *nn);
-void nfp_net_refresh_port_table(struct nfp_net *nn);
 
 #ifdef CONFIG_NFP_DEBUG
 void nfp_net_debugfs_create(void);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index b427c95c5acd..15ef45a05c1e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -70,6 +70,7 @@
 #include "nfpcore/nfp_nsp.h"
 #include "nfp_net_ctrl.h"
 #include "nfp_net.h"
+#include "nfp_port.h"
 
 /**
  * nfp_net_get_fw_version() - Read and parse the FW version
@@ -2846,26 +2847,6 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
 	return features;
 }
 
-static int
-nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
-{
-	struct nfp_net *nn = netdev_priv(netdev);
-	int err;
-
-	if (!nn->eth_port)
-		return -EOPNOTSUPP;
-
-	if (!nn->eth_port->is_split)
-		err = snprintf(name, len, "p%d", nn->eth_port->label_port);
-	else
-		err = snprintf(name, len, "p%ds%d", nn->eth_port->label_port,
-			       nn->eth_port->label_subport);
-	if (err >= len)
-		return -EINVAL;
-
-	return 0;
-}
-
 /**
  * nfp_net_set_vxlan_port() - set vxlan port in SW and reconfigure HW
  * @nn:   NFP Net device to reconfigure
@@ -3028,7 +3009,7 @@ static int nfp_net_xdp(struct net_device *netdev, struct netdev_xdp *xdp)
 	}
 }
 
-static const struct net_device_ops nfp_net_netdev_ops = {
+const struct net_device_ops nfp_net_netdev_ops = {
 	.ndo_open		= nfp_net_netdev_open,
 	.ndo_stop		= nfp_net_netdev_close,
 	.ndo_start_xmit		= nfp_net_tx,
@@ -3040,7 +3021,7 @@ static const struct net_device_ops nfp_net_netdev_ops = {
 	.ndo_set_mac_address	= eth_mac_addr,
 	.ndo_set_features	= nfp_net_set_features,
 	.ndo_features_check	= nfp_net_features_check,
-	.ndo_get_phys_port_name	= nfp_net_get_phys_port_name,
+	.ndo_get_phys_port_name	= nfp_port_get_phys_port_name,
 	.ndo_udp_tunnel_add	= nfp_net_add_vxlan_port,
 	.ndo_udp_tunnel_del	= nfp_net_del_vxlan_port,
 	.ndo_xdp		= nfp_net_xdp,
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index b9a70659530d..334020347ff2 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -53,6 +53,7 @@
 #include "nfp_app.h"
 #include "nfp_net_ctrl.h"
 #include "nfp_net.h"
+#include "nfp_port.h"
 
 enum nfp_dump_diag {
 	NFP_DUMP_NSP_DIAG = 0,
@@ -196,33 +197,42 @@ nfp_net_get_link_ksettings(struct net_device *netdev,
 		[NFP_NET_CFG_STS_LINK_RATE_50G]		= SPEED_50000,
 		[NFP_NET_CFG_STS_LINK_RATE_100G]	= SPEED_100000,
 	};
-	struct nfp_net *nn = netdev_priv(netdev);
+	struct nfp_eth_table_port *eth_port;
+	struct nfp_port *port;
+	struct nfp_net *nn;
 	u32 sts, ls;
 
+	/* Init to unknowns */
 	ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
 	cmd->base.port = PORT_OTHER;
 	cmd->base.speed = SPEED_UNKNOWN;
 	cmd->base.duplex = DUPLEX_UNKNOWN;
 
-	if (nn->eth_port)
-		cmd->base.autoneg = nn->eth_port->aneg != NFP_ANEG_DISABLED ?
+	port = nfp_port_from_netdev(netdev);
+	eth_port = __nfp_port_get_eth_port(port);
+	if (eth_port)
+		cmd->base.autoneg = eth_port->aneg != NFP_ANEG_DISABLED ?
 			AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	if (!netif_carrier_ok(netdev))
 		return 0;
 
+	if (!nfp_netdev_is_nfp_net(netdev))
+		return -EOPNOTSUPP;
+	nn = netdev_priv(netdev);
+
 	/* Use link speed from ETH table if available, otherwise try the BAR */
-	if (nn->eth_port) {
+	if (eth_port) {
 		int err;
 
 		if (nfp_net_link_changed_read_clear(nn)) {
-			err = nfp_net_refresh_eth_port(nn);
+			err = nfp_net_refresh_eth_port(port);
 			if (err)
 				return err;
 		}
 
-		cmd->base.port = nn->eth_port->port_type;
-		cmd->base.speed = nn->eth_port->speed;
+		cmd->base.port = eth_port->port_type;
+		cmd->base.speed = eth_port->speed;
 		cmd->base.duplex = DUPLEX_FULL;
 		return 0;
 	}
@@ -247,19 +257,22 @@ static int
 nfp_net_set_link_ksettings(struct net_device *netdev,
 			   const struct ethtool_link_ksettings *cmd)
 {
-	struct nfp_net *nn = netdev_priv(netdev);
+	struct nfp_eth_table_port *eth_port;
+	struct nfp_port *port;
 	struct nfp_nsp *nsp;
 	int err;
 
-	if (!nn->eth_port)
+	port = nfp_port_from_netdev(netdev);
+	eth_port = __nfp_port_get_eth_port(port);
+	if (!eth_port)
 		return -EOPNOTSUPP;
 
 	if (netif_running(netdev)) {
-		nn_warn(nn, "Changing settings not allowed on an active interface. It may cause the port to be disabled until reboot.\n");
+		netdev_warn(netdev, "Changing settings not allowed on an active interface. It may cause the port to be disabled until reboot.\n");
 		return -EBUSY;
 	}
 
-	nsp = nfp_eth_config_start(nn->app->cpp, nn->eth_port->index);
+	nsp = nfp_eth_config_start(port->app->cpp, eth_port->index);
 	if (IS_ERR(nsp))
 		return PTR_ERR(nsp);
 
@@ -268,7 +281,7 @@ nfp_net_set_link_ksettings(struct net_device *netdev,
 	if (err)
 		goto err_bad_set;
 	if (cmd->base.speed != SPEED_UNKNOWN) {
-		u32 speed = cmd->base.speed / nn->eth_port->lanes;
+		u32 speed = cmd->base.speed / eth_port->lanes;
 
 		err = __nfp_eth_set_speed(nsp, speed);
 		if (err)
@@ -279,7 +292,7 @@ nfp_net_set_link_ksettings(struct net_device *netdev,
 	if (err > 0)
 		return 0; /* no change */
 
-	nfp_net_refresh_port_table(nn);
+	nfp_net_refresh_port_table(port);
 
 	return err;
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 8f267b1534e2..8e1e55187262 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -58,6 +58,7 @@
 #include "nfp_net_ctrl.h"
 #include "nfp_net.h"
 #include "nfp_main.h"
+#include "nfp_port.h"
 
 #define NFP_PF_CSR_SLICE_SIZE	(32 * 1024)
 
@@ -142,14 +143,16 @@ static u8 __iomem *nfp_net_map_area(struct nfp_cpp *cpp,
 static void
 nfp_net_get_mac_addr(struct nfp_net *nn, struct nfp_cpp *cpp, unsigned int id)
 {
+	struct nfp_eth_table_port *eth_port;
 	struct nfp_net_dp *dp = &nn->dp;
 	u8 mac_addr[ETH_ALEN];
 	const char *mac_str;
 	char name[32];
 
-	if (nn->eth_port) {
-		ether_addr_copy(dp->netdev->dev_addr, nn->eth_port->mac_addr);
-		ether_addr_copy(dp->netdev->perm_addr, nn->eth_port->mac_addr);
+	eth_port = __nfp_port_get_eth_port(nn->port);
+	if (eth_port) {
+		ether_addr_copy(dp->netdev->dev_addr, eth_port->mac_addr);
+		ether_addr_copy(dp->netdev->perm_addr, eth_port->mac_addr);
 		return;
 	}
 
@@ -270,6 +273,7 @@ static u8 __iomem *nfp_net_pf_map_ctrl_bar(struct nfp_pf *pf)
 
 static void nfp_net_pf_free_vnic(struct nfp_pf *pf, struct nfp_net *nn)
 {
+	nfp_port_free(nn->port);
 	list_del(&nn->vnic_list);
 	pf->num_vnics--;
 	nfp_net_free(nn);
@@ -291,6 +295,7 @@ nfp_net_pf_alloc_vnic(struct nfp_pf *pf, void __iomem *ctrl_bar,
 		      int stride, struct nfp_net_fw_version *fw_ver,
 		      unsigned int eth_id)
 {
+	struct nfp_eth_table_port *eth_port;
 	u32 n_tx_rings, n_rx_rings;
 	struct nfp_net *nn;
 
@@ -310,7 +315,18 @@ nfp_net_pf_alloc_vnic(struct nfp_pf *pf, void __iomem *ctrl_bar,
 	nn->dp.is_vf = 0;
 	nn->stride_rx = stride;
 	nn->stride_tx = stride;
-	nn->eth_port = nfp_net_find_port(pf->eth_tbl, eth_id);
+
+	eth_port = nfp_net_find_port(pf->eth_tbl, eth_id);
+	if (eth_port) {
+		nn->port = nfp_port_alloc(pf->app, NFP_PORT_PHYS_PORT,
+					  nn->dp.netdev);
+		if (IS_ERR(nn->port)) {
+			nfp_net_free(nn);
+			return ERR_CAST(nn->port);
+		}
+		nn->port->eth_id = eth_id;
+		nn->port->eth_port = eth_port;
+	}
 
 	pf->num_vnics++;
 	list_add_tail(&nn->vnic_list, &pf->vnics);
@@ -380,12 +396,12 @@ nfp_net_pf_alloc_vnics(struct nfp_pf *pf, void __iomem *ctrl_bar,
 		ctrl_bar += NFP_PF_CSR_SLICE_SIZE;
 
 		/* Check if vNIC has external port associated and cfg is OK */
-		if (pf->eth_tbl && !nn->eth_port) {
+		if (pf->eth_tbl && !nn->port) {
 			nfp_err(pf->cpp, "NSP port entries don't match vNICs (no entry for port #%d)\n", i);
 			err = -EINVAL;
 			goto err_free_prev;
 		}
-		if (nn->eth_port && nn->eth_port->override_changed) {
+		if (nn->port && nn->port->eth_port->override_changed) {
 			nfp_warn(pf->cpp, "Config changed for port #%d, reboot required before port will be operational\n", i);
 			nfp_net_pf_free_vnic(pf, nn);
 			continue;
@@ -526,13 +542,20 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 
 	rtnl_lock();
 	list_for_each_entry(nn, &pf->vnics, vnic_list) {
-		if (!nn->eth_port)
+		if (!__nfp_port_get_eth_port(nn->port))
 			continue;
-		nn->eth_port = nfp_net_find_port(eth_table,
-						 nn->eth_port->eth_index);
-		if (!nn->eth_port)
-			nfp_err(pf->cpp,
-				"Warning: port disappeared after reconfig\n");
+		nn->port->eth_port = nfp_net_find_port(eth_table,
+						       nn->port->eth_id);
+		if (!nn->port->eth_port) {
+			nfp_warn(pf->cpp, "Warning: port #%d not present after reconfig\n",
+				 nn->port->eth_id);
+			continue;
+		}
+		if (nn->port->eth_port->override_changed) {
+			nfp_warn(pf->cpp, "Port config changed, unregistering. Reboot required before port will be operational again.\n");
+			nn->port->type = NFP_PORT_INVALID;
+			continue;
+		}
 	}
 	rtnl_unlock();
 
@@ -540,11 +563,9 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 	pf->eth_tbl = eth_table;
 
 	list_for_each_entry_safe(nn, next, &pf->vnics, vnic_list) {
-		if (nn->eth_port && !nn->eth_port->override_changed)
+		if (!nn->port || nn->port->type != NFP_PORT_INVALID)
 			continue;
 
-		nn_warn(nn, "Port config changed, unregistering. Reboot required before port will be operational again.\n");
-
 		nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
 		nfp_net_clean(nn);
 
@@ -557,32 +578,33 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 	mutex_unlock(&pf->lock);
 }
 
-void nfp_net_refresh_port_table(struct nfp_net *nn)
+void nfp_net_refresh_port_table(struct nfp_port *port)
 {
-	struct nfp_pf *pf = pci_get_drvdata(nn->pdev);
+	struct nfp_pf *pf = port->app->pf;
 
 	schedule_work(&pf->port_refresh_work);
 }
 
-int nfp_net_refresh_eth_port(struct nfp_net *nn)
+int nfp_net_refresh_eth_port(struct nfp_port *port)
 {
+	struct nfp_cpp *cpp = port->app->cpp;
 	struct nfp_eth_table_port *eth_port;
 	struct nfp_eth_table *eth_table;
 
-	eth_table = nfp_eth_read_ports(nn->app->cpp);
+	eth_table = nfp_eth_read_ports(cpp);
 	if (!eth_table) {
-		nn_err(nn, "Error refreshing port state table!\n");
+		nfp_err(cpp, "Error refreshing port state table!\n");
 		return -EIO;
 	}
 
-	eth_port = nfp_net_find_port(eth_table, nn->eth_port->eth_index);
+	eth_port = nfp_net_find_port(eth_table, port->eth_id);
 	if (!eth_port) {
-		nn_err(nn, "Error finding state of the port!\n");
+		nfp_err(cpp, "Error finding state of the port!\n");
 		kfree(eth_table);
 		return -EIO;
 	}
 
-	memcpy(nn->eth_port, eth_port, sizeof(*eth_port));
+	memcpy(port->eth_port, eth_port, sizeof(*eth_port));
 
 	kfree(eth_table);
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
new file mode 100644
index 000000000000..95726e01592d
--- /dev/null
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 Netronome Systems, Inc.
+ *
+ * This software is dual licensed under the GNU General License Version 2,
+ * June 1991 as shown in the file COPYING in the top-level directory of this
+ * source tree or the BSD 2-Clause License provided below.  You have the
+ * option to license this software under the complete terms of either license.
+ *
+ * The BSD 2-Clause License:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      1. Redistributions of source code must retain the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer.
+ *
+ *      2. Redistributions in binary form must reproduce the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer in the documentation and/or other materials
+ *         provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "nfpcore/nfp_nsp.h"
+#include "nfp_app.h"
+#include "nfp_main.h"
+#include "nfp_net.h"
+#include "nfp_port.h"
+
+struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
+{
+	struct nfp_net *nn;
+
+	if (WARN_ON(!nfp_netdev_is_nfp_net(netdev)))
+		return NULL;
+	nn = netdev_priv(netdev);
+
+	return nn->port;
+}
+
+struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port)
+{
+	if (!port)
+		return NULL;
+	if (port->type != NFP_PORT_PHYS_PORT)
+		return NULL;
+
+	return port->eth_port;
+}
+
+int
+nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
+{
+	struct nfp_eth_table_port *eth_port;
+	struct nfp_port *port;
+	int n;
+
+	port = nfp_port_from_netdev(netdev);
+	eth_port = __nfp_port_get_eth_port(port);
+	if (!eth_port)
+		return -EOPNOTSUPP;
+
+	if (!eth_port->is_split)
+		n = snprintf(name, len, "p%d", eth_port->label_port);
+	else
+		n = snprintf(name, len, "p%ds%d", eth_port->label_port,
+			     eth_port->label_subport);
+	if (n >= len)
+		return -EINVAL;
+
+	return 0;
+}
+
+struct nfp_port *
+nfp_port_alloc(struct nfp_app *app, enum nfp_port_type type,
+	       struct net_device *netdev)
+{
+	struct nfp_port *port;
+
+	port = kzalloc(sizeof(*port), GFP_KERNEL);
+	if (!port)
+		return ERR_PTR(-ENOMEM);
+
+	port->netdev = netdev;
+	port->type = type;
+	port->app = app;
+
+	return port;
+}
+
+void nfp_port_free(struct nfp_port *port)
+{
+	kfree(port);
+}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
new file mode 100644
index 000000000000..341e7e128233
--- /dev/null
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2017 Netronome Systems, Inc.
+ *
+ * This software is dual licensed under the GNU General License Version 2,
+ * June 1991 as shown in the file COPYING in the top-level directory of this
+ * source tree or the BSD 2-Clause License provided below.  You have the
+ * option to license this software under the complete terms of either license.
+ *
+ * The BSD 2-Clause License:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      1. Redistributions of source code must retain the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer.
+ *
+ *      2. Redistributions in binary form must reproduce the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer in the documentation and/or other materials
+ *         provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _NFP_PORT_H_
+#define _NFP_PORT_H_
+
+struct net_device;
+struct nfp_app;
+struct nfp_port;
+
+/**
+ * enum nfp_port_type - type of port NFP can switch traffic to
+ * @NFP_PORT_INVALID:	port is invalid, %NFP_PORT_PHYS_PORT transitions to this
+ *			state when port disappears because of FW fault or config
+ *			change
+ * @NFP_PORT_PHYS_PORT:	external NIC port
+ */
+enum nfp_port_type {
+	NFP_PORT_INVALID,
+	NFP_PORT_PHYS_PORT,
+};
+
+/**
+ * struct nfp_port - structure representing NFP port
+ * @netdev:	backpointer to associated netdev
+ * @type:	what port type does the entity represent
+ * @app:	backpointer to the app structure
+ * @eth_id:	for %NFP_PORT_PHYS_PORT port ID in NFP enumeration scheme
+ * @eth_port:	for %NFP_PORT_PHYS_PORT translated ETH Table port entry
+ */
+struct nfp_port {
+	struct net_device *netdev;
+	enum nfp_port_type type;
+
+	struct nfp_app *app;
+
+	unsigned int eth_id;
+	struct nfp_eth_table_port *eth_port;
+};
+
+struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
+struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
+
+int
+nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len);
+
+struct nfp_port *
+nfp_port_alloc(struct nfp_app *app, enum nfp_port_type type,
+	       struct net_device *netdev);
+void nfp_port_free(struct nfp_port *port);
+
+int nfp_net_refresh_eth_port(struct nfp_port *port);
+void nfp_net_refresh_port_table(struct nfp_port *port);
+
+#endif
-- 
2.11.0

^ 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