[patch net-next RFC 12/13] mlxsw: spectrum_buffers: Cache shared buffer configuration

2016-03-18 Thread Jiri Pirko
From: Jiri Pirko 

In order to achieve faster dumping of current setting and also
for possibility to get pool mode without need to query hardware,
cache the configuration in driver.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 28 
 .../net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 81 --
 2 files changed, 89 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 22a5a94..ed3c871 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -99,6 +99,33 @@ static inline bool mlxsw_sp_fid_is_vfid(u16 fid)
return fid >= MLXSW_SP_VFID_BASE;
 }
 
+struct mlxsw_sp_sb_pr {
+   enum mlxsw_reg_sbpr_mode mode;
+   u32 size;
+};
+
+struct mlxsw_sp_sb_cm {
+   u32 min_buff;
+   u32 max_buff;
+   u8 pool;
+};
+
+struct mlxsw_sp_sb_pm {
+   u32 min_buff;
+   u32 max_buff;
+};
+
+#define MLXSW_SP_SB_POOL_COUNT 4
+#define MLXSW_SP_SB_TC_COUNT   8
+
+struct mlxsw_sp_sb {
+   struct mlxsw_sp_sb_pr prs[2][MLXSW_SP_SB_POOL_COUNT];
+   struct {
+   struct mlxsw_sp_sb_cm cms[2][MLXSW_SP_SB_TC_COUNT];
+   struct mlxsw_sp_sb_pm pms[2][MLXSW_SP_SB_POOL_COUNT];
+   } ports[MLXSW_PORT_MAX_PORTS];
+};
+
 struct mlxsw_sp {
struct {
struct list_head list;
@@ -129,6 +156,7 @@ struct mlxsw_sp {
struct mlxsw_sp_upper master_bridge;
struct mlxsw_sp_upper lags[MLXSW_SP_LAG_MAX];
u8 port_to_module[MLXSW_PORT_MAX_PORTS];
+   struct mlxsw_sp_sb sb;
 };
 
 static inline struct mlxsw_sp_upper *
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
index 41212c0..beca792 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c
@@ -40,14 +40,46 @@
 #include "port.h"
 #include "reg.h"
 
+static struct mlxsw_sp_sb_pr *mlxsw_sp_sb_pr_get(struct mlxsw_sp *mlxsw_sp,
+u8 pool,
+enum mlxsw_reg_sbxx_dir dir)
+{
+   return _sp->sb.prs[dir][pool];
+}
+
+static struct mlxsw_sp_sb_cm *mlxsw_sp_sb_cm_get(struct mlxsw_sp *mlxsw_sp,
+u8 local_port, u8 pg_buff,
+enum mlxsw_reg_sbxx_dir dir)
+{
+   return _sp->sb.ports[local_port].cms[dir][pg_buff];
+}
+
+static struct mlxsw_sp_sb_pm *mlxsw_sp_sb_pm_get(struct mlxsw_sp *mlxsw_sp,
+u8 local_port, u8 pool,
+enum mlxsw_reg_sbxx_dir dir)
+{
+   return _sp->sb.ports[local_port].pms[dir][pool];
+}
+
 static int mlxsw_sp_sb_pr_write(struct mlxsw_sp *mlxsw_sp, u8 pool,
enum mlxsw_reg_sbxx_dir dir,
enum mlxsw_reg_sbpr_mode mode, u32 size)
 {
char sbpr_pl[MLXSW_REG_SBPR_LEN];
+   int err;
 
mlxsw_reg_sbpr_pack(sbpr_pl, pool, dir, mode, size);
-   return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpr), sbpr_pl);
+   err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbpr), sbpr_pl);
+   if (err)
+   return err;
+   if (pool < MLXSW_SP_SB_POOL_COUNT) {
+   struct mlxsw_sp_sb_pr *pr;
+
+   pr = mlxsw_sp_sb_pr_get(mlxsw_sp, pool, dir);
+   pr->mode = mode;
+   pr->size = size;
+   }
+   return 0;
 }
 
 static int mlxsw_sp_sb_cm_write(struct mlxsw_sp *mlxsw_sp, u8 local_port,
@@ -55,10 +87,22 @@ static int mlxsw_sp_sb_cm_write(struct mlxsw_sp *mlxsw_sp, 
u8 local_port,
u32 min_buff, u32 max_buff, u8 pool)
 {
char sbcm_pl[MLXSW_REG_SBCM_LEN];
+   int err;
 
mlxsw_reg_sbcm_pack(sbcm_pl, local_port, pg_buff, dir,
min_buff, max_buff, pool);
-   return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbcm), sbcm_pl);
+   err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sbcm), sbcm_pl);
+   if (err)
+   return err;
+   if (pg_buff < MLXSW_SP_SB_TC_COUNT) {
+   struct mlxsw_sp_sb_cm *cm;
+
+   cm = mlxsw_sp_sb_cm_get(mlxsw_sp, local_port, pg_buff, dir);
+   cm->min_buff = min_buff;
+   cm->max_buff = max_buff;
+   cm->pool = pool;
+   }
+   return 0;
 }
 
 static int mlxsw_sp_sb_pm_write(struct mlxsw_sp *mlxsw_sp, u8 local_port,
@@ -66,9 +110,20 @@ static int mlxsw_sp_sb_pm_write(struct mlxsw_sp *mlxsw_sp, 
u8 local_port,
u32 min_buff, u32 max_buff)
 {
char sbpm_pl[MLXSW_REG_SBPM_LEN];
+   int err;
 
mlxsw_reg_sbpm_pack(sbpm_pl, local_port, pool, 

[PATCH net-next] net/mlx4_core: Fix backward compatibility on VFs

2016-03-18 Thread Eli Cohen
Commit 85743f1eb345 ("net/mlx4_core: Set UAR page size to 4KB regardless
of system page size") introduced dependency where old VF drivers without
this fix fail to load if the PF driver runs with this commit.

To resolve this add a module parameter which disables that functionality
by default.  If both the PF and VFs are running with a driver with that
commit the administrator may set the module param to true.

The module parameter is called enable_4k_uar.

Fixes: 85743f1eb345 ('net/mlx4_core: Set UAR page size to 4KB ...')
Signed-off-by: Eli Cohen 
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c 
b/drivers/net/ethernet/mellanox/mlx4/main.c
index 503ec23e84cc..358f7230da58 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -105,6 +105,11 @@ module_param(enable_64b_cqe_eqe, bool, 0444);
 MODULE_PARM_DESC(enable_64b_cqe_eqe,
 "Enable 64 byte CQEs/EQEs when the FW supports this (default: 
True)");
 
+static bool enable_4k_uar;
+module_param(enable_4k_uar, bool, 0444);
+MODULE_PARM_DESC(enable_4k_uar,
+"Enable using 4K UAR. Should not be enabled if have VFs which 
do not support 4K UARs (default: false)");
+
 #define PF_CONTEXT_BEHAVIOUR_MASK  (MLX4_FUNC_CAP_64B_EQE_CQE | \
 MLX4_FUNC_CAP_EQE_CQE_STRIDE | \
 MLX4_FUNC_CAP_DMFS_A0_STATIC)
@@ -423,7 +428,11 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct 
mlx4_dev_cap *dev_cap)
/* Virtual PCI function needs to determine UAR page size from
 * firmware. Only master PCI function can set the uar page size
 */
-   dev->uar_page_shift = DEFAULT_UAR_PAGE_SHIFT;
+   if (enable_4k_uar)
+   dev->uar_page_shift = DEFAULT_UAR_PAGE_SHIFT;
+   else
+   dev->uar_page_shift = PAGE_SHIFT;
+
mlx4_set_num_reserved_uars(dev, dev_cap);
}
 
@@ -2233,11 +2242,14 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
 
dev->caps.max_fmr_maps = (1 << (32 - 
ilog2(dev->caps.num_mpts))) - 1;
 
-   /* Always set UAR page size 4KB, set log_uar_sz accordingly */
-   init_hca.log_uar_sz = ilog2(dev->caps.num_uars) +
- PAGE_SHIFT -
- DEFAULT_UAR_PAGE_SHIFT;
-   init_hca.uar_page_sz = DEFAULT_UAR_PAGE_SHIFT - 12;
+   if (enable_4k_uar) {
+   init_hca.log_uar_sz = ilog2(dev->caps.num_uars) +
+   PAGE_SHIFT - 
DEFAULT_UAR_PAGE_SHIFT;
+   init_hca.uar_page_sz = DEFAULT_UAR_PAGE_SHIFT - 12;
+   } else {
+   init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
+   init_hca.uar_page_sz = PAGE_SHIFT - 12;
+   }
 
init_hca.mw_enabled = 0;
if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
-- 
1.8.3.1



Re: [PATCH (net-next.git) 2/2] stmmac: fix MDIO settings

2016-03-18 Thread Giuseppe CAVALLARO

Hello

On 3/16/2016 12:03 PM, Andreas Färber wrote:

Am 16.03.2016 um 12:01 schrieb Gabriel Fernandez:

Hi Pepe,

i have a kernel crash

[2.714097] Unable to handle kernel NULL pointer dereference at
virtual address 01d6
[2.722188] pgd = c0204000
[2.724886] [01d6] *pgd=
[2.728452] Internal error: Oops: 5 [#1] SMP ARM
[2.733054] Modules linked in:
[2.736095] CPU: 1 PID: 1 Comm: swapper/0 Not tainted
4.5.0-rc7-01768-g3407893 #36
[2.743649] Hardware name: STiH415/416 SoC with Flattened Device Tree
[2.750074] task: ee07 ti: ee05e000 task.ti: ee05e000
[2.755467] PC is at stmmac_open+0xcc/0xc40
[2.759641] LR is at of_phy_connect+0x44/0x5c



diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4c5ce98..943500b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -278,7 +278,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
   */
  bool stmmac_eee_init(struct stmmac_priv *priv)
  {
-   char *phy_bus_name = priv->plat->phy_bus_name;
 unsigned long flags;
 bool ret = false;

@@ -290,7 +289,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
 goto out;

 /* Never init EEE in case of a switch is attached */
-   if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
+   if (priv->phydev->is_pseudo_fixed_link)


priv->phydev is not yet affected
replace by if (phydev->is_pseudo_fixed_link) instead ?


Indeed that's how I had it in my own patch before. Thanks for spotting.



thanks for spotting and I have just sent the V2 of these patches
and I have understood why I did not catch it on my test :-(
my fault, sorry !

Cheers
Peppe



Regards,
Andreas





Re: [PATCH] openvswitch: call only into reachable nf-nat code

2016-03-18 Thread Pablo Neira Ayuso
On Wed, Mar 16, 2016 at 01:47:13PM +0100, Arnd Bergmann wrote:
> The openvswitch code has gained support for calling into the
> nf-nat-ipv4/ipv6 modules, however those can be loadable modules
> in a configuration in which openvswitch is built-in, leading
> to link errors:
> 
> net/built-in.o: In function `__ovs_ct_lookup':
> :(.text+0x2cc2c8): undefined reference to `nf_nat_icmp_reply_translation'
> :(.text+0x2cc66c): undefined reference to `nf_nat_icmpv6_reply_translation'
> 
> The dependency on (!NF_NAT || NF_NAT) was meant to prevent
> this, but NF_NAT is set to 'y' if any of the symbols selecting
> it are built-in, but the link error happens when any of them
> are modular.
> 
> A second issue is that even if CONFIG_NF_NAT_IPV6 is built-in,
> CONFIG_NF_NAT_IPV4 might be completely disabled. This is unlikely
> to be useful in practice, but the driver currently only handles
> IPv6 being optional.
> 
> This patch improves the Kconfig dependency so that openvswitch
> cannot be built-in if either of the two other symbols are set
> to 'm', and it replaces the incorrect #ifdef in ovs_ct_nat_execute()
> with two "if (IS_ENABLED())" checks that should catch all corner
> cases also make the code more readable.
> 
> The same #ifdef exists ovs_ct_nat_to_attr(), where it does not
> cause a link error, but for consistency I'm changing it the same
> way.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 05752523e565 ("openvswitch: Interface with NAT.")
> ---
>  net/openvswitch/Kconfig |  3 ++-
>  net/openvswitch/conntrack.c | 16 
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/net/openvswitch/Kconfig b/net/openvswitch/Kconfig
> index 234a73344c6e..961fb60115df 100644
> --- a/net/openvswitch/Kconfig
> +++ b/net/openvswitch/Kconfig
> @@ -7,7 +7,8 @@ config OPENVSWITCH
>   depends on INET
>   depends on !NF_CONNTRACK || \
>  (NF_CONNTRACK && ((!NF_DEFRAG_IPV6 || NF_DEFRAG_IPV6) && \
> -  (!NF_NAT || NF_NAT)))
> +  (!NF_NAT_IPV4 || NF_NAT_IPV4) && \
> +  (!NF_NAT_IPV6 || NF_NAT_IPV6)))

Not related with this patch, just a side note/recommendation.

I understand this code just got into tree, and that this needs a bit
work/iterations but this thing above is ugly, I wonder if there is a
better way to avoid this.

Probably with some modularization of the openvswitch code this will
look better, I mean:

1) adding Kconfig switches to enable conntrack and NAT support to
   net/openvswitch/Kconfig.

2) Move the NAT code to the corresponding openvswitch/nat.c file.

Just my two cents.


Re: [PATCH] net: phy: at803x: don't depend on GPIOLIB

2016-03-18 Thread Sebastian Frias
Hi Uwe, Daniel,

On 03/18/2016 01:54 PM, Uwe Kleine-König wrote:
> [expand cc a bit more]
> 
> Hello,
> 
> On Wed, Mar 16, 2016 at 06:25:59PM +0100, Sebastian Frias wrote:
>> Commit 687908c2b649 ("net: phy: at803x: simplify using
>> devm_gpiod_get_optional and its 4th argument") introduced a dependency
>> on GPIOLIB that was not there before.
>>
>> This commit removes such dependency by checking the return code and
>> comparing it against ENOSYS which is returned when GPIOLIB is not
>> selected.
>>
>> Fixes: 687908c2b649 ("net: phy: at803x: simplify using 
>> devm_gpiod_get_optional and its 4th argument")
>>
>> Signed-off-by: Sebastian Frias 
>> ---
>>  drivers/net/phy/at803x.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
>> index 2174ec9..88b7ff3 100644
>> --- a/drivers/net/phy/at803x.c
>> +++ b/drivers/net/phy/at803x.c
>> @@ -252,7 +252,9 @@ static int at803x_probe(struct phy_device *phydev)
>>  return -ENOMEM;
>>
>>  gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>> -if (IS_ERR(gpiod_reset))
>> +if (PTR_ERR(gpiod_reset) == -ENOSYS)
>> +gpiod_reset = NULL;
>> +else if (IS_ERR(gpiod_reset))
> 
> this isn't better either (IMHO it's worse, but maybe this is debatable
> and also depends on your POV).

Well, from the code, the reset hack is only required when the PHY is
ATH8030_PHY_ID, right?
However, such change was introduced by Daniel Mack on commit 13a56b449325.
Hopefully he can chime in and give his opinion on this.

Daniel, while on the subject, I have a question for you:

Change 2b8f2a28eac1 introduced "link_status_notify" callback which is
called systematically on the PHY state machine.
Any reason to make the call systematic as opposed to let say:

if (phydev->state != old_state) {
if (phydev->drv->link_change_notify)
phydev->drv->link_change_notify(phydev);
}

(it does means that the callback would be called after the state machine
processing though)

> 
> With 687908c2b649 I made kernels without GPIOLIB fail to bind this
> device. I admit this is not maximally nice.

I see, that was not clear from the commit message, sorry.

> 
> Your change makes the driver bind in this case again and then the reset
> gpio isn't handled at all which might result in a later and harder to
> debug error.
> 
> The better approach to fix your problem is: make the driver depend (or
> force) on GPIOLIB. 

It was one of the solutions I had in mind, but:
- since the dependency on GPIOLIB was not included on the patch
- and given that the previous code had provision to work without GPIO
I thought it was an overlook.

>Or alternatively, drop reset-handling from the
> driver.
> 
> From a driver perspecitive, it would be nice if devm_gpiod_get_optional
> returned NULL iff the respective gpio isn't specified even with
> GPIOLIB=n, but this isn't sensible either because it would result in
> quite some gpiolib code to not being conditionally compiled on
> CONFIG_GPIOLIB any more.

Let's say that was the case, what would the PHY code do?

I mean, it did not get a GPIO, whether it was because GPIOLIB=n or
because there's no 'reset' GPIO attached
Shall it fail? Shall it continue in a sort of degraded mode? Shall it warn?
Because that's the real question here.

What would you think of making at803x_link_change_notify() print a
message every time it should do a reset but does not has a way to do it?
I can make such change to my patch if everybody agrees on it.
By the way, in that case, can somebody suggest a way to print such warning?
Would printk() be ok or should I use dev_dbg() ?

Best regards,

Sebastian

> 
> Best regards
> Uwe
> 


Re: [PATCH v2 3/3] phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.

2016-03-18 Thread Andreas Färber
Am 16.03.2016 um 23:54 schrieb David Daney:
> On 03/16/2016 03:50 PM, Andreas Färber wrote:
>> Am 11.03.2016 um 18:53 schrieb David Daney:
>>> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
>>> index 40faec9..075a4cc 100644
>>> --- a/drivers/net/phy/Kconfig
>>> +++ b/drivers/net/phy/Kconfig
>>> @@ -196,6 +196,17 @@ config MDIO_OCTEON
>>> buses. It is required by the Octeon and ThunderX ethernet device
>>> drivers on some systems.
>>>
>>> +config MDIO_THUNDER
>>> +tristate "Support for MDIO buses on on ThunderX SOCs"
>>
>> Double "on", spotted in next-20160316.
>>
>>> +depends on 64BIT
>>> +depends on PCI
>>> +select MDIO_CAVIUM
>>> +help
>>> +  This driver supports the MDIO interfaces found on Cavium
>>> +  ThunderX SoCs when the MDIO bus device appears on as a PCI
>>> +  device.
>>
>> While at it, this sentence sounds weird. Did you mean s/as/is/? Or is
>> there another verb missing in there?
> 
> Should be "... appears as a PCI device."
> 
> davem already merged the patch, so this would have to be fixed as a
> follow-on patch.
> 
> Since you found this, do you want to send the patch?

Done.

Cheers,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)


Re: [PATCH] openvswitch: call only into reachable nf-nat code

2016-03-18 Thread Arnd Bergmann
On Wednesday 16 March 2016 13:47:13 Arnd Bergmann wrote:
> The openvswitch code has gained support for calling into the
> nf-nat-ipv4/ipv6 modules, however those can be loadable modules
> in a configuration in which openvswitch is built-in, leading
> to link errors:
> 
> net/built-in.o: In function `__ovs_ct_lookup':
> :(.text+0x2cc2c8): undefined reference to `nf_nat_icmp_reply_translation'
> :(.text+0x2cc66c): undefined reference to `nf_nat_icmpv6_reply_translation'
> 
> The dependency on (!NF_NAT || NF_NAT) was meant to prevent
> this, but NF_NAT is set to 'y' if any of the symbols selecting
> it are built-in, but the link error happens when any of them
> are modular.
> 
> A second issue is that even if CONFIG_NF_NAT_IPV6 is built-in,
> CONFIG_NF_NAT_IPV4 might be completely disabled. This is unlikely
> to be useful in practice, but the driver currently only handles
> IPv6 being optional.
> 
> This patch improves the Kconfig dependency so that openvswitch
> cannot be built-in if either of the two other symbols are set
> to 'm', and it replaces the incorrect #ifdef in ovs_ct_nat_execute()
> with two "if (IS_ENABLED())" checks that should catch all corner
> cases also make the code more readable.
> 
> The same #ifdef exists ovs_ct_nat_to_attr(), where it does not
> cause a link error, but for consistency I'm changing it the same
> way.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 05752523e565 ("openvswitch: Interface with NAT.")
> ---
>  net/openvswitch/Kconfig |  3 ++-
>  net/openvswitch/conntrack.c | 16 
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/net/openvswitch/Kconfig b/net/openvswitch/Kconfig
> index 234a73344c6e..961fb60115df 100644
> --- a/net/openvswitch/Kconfig
> +++ b/net/openvswitch/Kconfig
> @@ -7,7 +7,8 @@ config OPENVSWITCH
>   depends on INET
>   depends on !NF_CONNTRACK || \
>  (NF_CONNTRACK && ((!NF_DEFRAG_IPV6 || NF_DEFRAG_IPV6) && \
> -  (!NF_NAT || NF_NAT)))
> +  (!NF_NAT_IPV4 || NF_NAT_IPV4) && \
> +  (!NF_NAT_IPV6 || NF_NAT_IPV6)))
>   select LIBCRC32C
>   select MPLS
>   select NET_MPLS_GSO

I've now seen a new regression:

net/built-in.o: In function `__ovs_ct_lookup':
switchdev.c:(.text+0x136e8c): undefined reference to `nf_ct_nat_ext_add'
switchdev.c:(.text+0x136f38): undefined reference to `nf_nat_packet'
switchdev.c:(.text+0x136f80): undefined reference to `nf_nat_setup_info'
switchdev.c:(.text+0x136f98): undefined reference to `nf_nat_alloc_null_binding'

Apparently, the (!NF_NAT || NF_NAT) statement is also needed in addition to
the other two. I'm resending the fixed patch, as it doesn't seem to have
been merged yet.

If it's in some other tree already and you'd rather have a patch on top,
I can send that too.

Arnd


Re: [PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-18 Thread Alexey Brodkin
Hi Sergei,

On Thu, 2016-03-17 at 14:59 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 3/17/2016 2:41 PM, Vineet Gupta wrote:
> 
> > 
> > > 
> > > > 
> > > > > 
> > > > > Following commit broke DW GMAC functionality on AXS10x boards:
> > > > > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461e
> > > > > d763
> > > >  Note that scripts/checkpatch.pl now enforces certain format for 
> > > > citing
> > > > commits: commit <12-digit SHA1> ("").
> > 
> > > 
> > > Frankly I haven't run that patch through checkpatch due to patch
> > > simplicity.
> > > 
> > > But I'll try to not do any assumptions from now on and will try to
> > > use checkpatch for each and every thing I send :)
> > > 
> > > Thanks for spotting all his!
> > > 
> Sorry for not reporting everything on the 1st review.
> 
> > 
> > > 
> > > -Alexey
> > Sergei, do you mind providing a Ack/Reviewed-by on the patch below
>  >
> 
> Reviewed-by: Sergei Shtylyov 
> 
> The patch here is white space damaged however: tabs were converted to 
> spaces. :-(

Well, I'm not really sure why that substitution happened because my local patch
is indeed with tabs.

That's an output of checkpatch:
>8
./scripts/checkpatch.pl 
0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch 
[1]+  Donegedit 
0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch
WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per 
line)
#7: 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

ERROR: Please use git commit description style 'commit <12+ chars of sha1> 
("")' - ie: 'commit e34d65696d2e
("stmmac: create of compatible mdio bus for stmmac driver")'
#7: 
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

total: 1 errors, 1 warnings, 14 lines checked

0001-ARC-axs10x-add-Ethernet-PHY-description-in-.dts.patch has style problems, 
please review.
>8

If there were spaces we would see tons of:
>8
ERROR: code indent should use tabs where possible
#43: FILE: arch/arc/boot/dts/axs10x_mb.dtsi:50:
+mdio0 {$
>8
which I didn't see.

-Alexey


[PATCH] qmi_wwan: Added support for Gemalto's Cinterion PHxx WWAN interface

2016-03-18 Thread Schemmel Hans-Christoph
Added support for Gemalto's Cinterion PHxx WWAN interfaces 
by adding QMI_FIXED_INTF with Cinterion's VID and PID.

PHxx can have:
2 RmNet Interfaces (PID 0x0082) or
1 RmNet + 1 USB Audio interface (PID 0x0083).

Signed-off-by: Hans-Christoph Schemmel 
---
patch is against linux-4.5
--- linux/drivers/net/usb/qmi_wwan.c.orig   2016-03-14 12:18:07.153497489 
+0100
+++ linux/drivers/net/usb/qmi_wwan.c2016-03-14 12:21:37.722541644 +0100
@@ -881,6 +881,9 @@ static const struct usb_device_id produc
{QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)},/* Olivetti Olicard 500 */
{QMI_FIXED_INTF(0x1e2d, 0x0060, 4)},/* Cinterion PLxx */
{QMI_FIXED_INTF(0x1e2d, 0x0053, 4)},/* Cinterion PHxx,PXxx */
+   {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)},/* Cinterion PHxx,PXxx (2 
RmNet) */
+   {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)},/* Cinterion PHxx,PXxx (2 
RmNet) */
+   {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)},/* Cinterion PHxx,PXxx (1 RmNet 
+ USB Audio)*/
{QMI_FIXED_INTF(0x413c, 0x81a2, 8)},/* Dell Wireless 5806 Gobi(TM) 
4G LTE Mobile Broadband Card */
{QMI_FIXED_INTF(0x413c, 0x81a3, 8)},/* Dell Wireless 5570 HSPA+ 
(42Mbps) Mobile Broadband Card */
{QMI_FIXED_INTF(0x413c, 0x81a4, 8)},/* Dell Wireless 5570e HSPA+ 
(42Mbps) Mobile Broadband Card */


smime.p7s
Description: S/MIME cryptographic signature


[PATCH v5 1/4] net: ethernet: dwmac: add Ethernet glue logic for stm32 chip

2016-03-18 Thread Alexandre TORGUE
stm324xx family chips support Synopsys MAC 3.510 IP.
This patch adds settings for logical glue logic:
-clocks
-mode selection MII or RMII.

Reviewed-by: Joachim Eastwood 
Acked-by: Giuseppe Cavallaro 
Tested-by: Maxime Coquelin 
Signed-off-by: Alexandre TORGUE 

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig 
b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cec147d..235d679 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -104,6 +104,18 @@ config DWMAC_STI
  device driver. This driver is used on for the STi series
  SOCs GMAC ethernet controller.
 
+config DWMAC_STM32
+   tristate "STM32 DWMAC support"
+   default ARCH_STM32
+   depends on OF && HAS_IOMEM
+   select MFD_SYSCON
+   ---help---
+ Support for ethernet controller on STM32 SOCs.
+
+ This selects STM32 SoC glue layer support for the stmmac
+ device driver. This driver is used on for the STM32 series
+ SOCs GMAC ethernet controller.
+
 config DWMAC_SUNXI
tristate "Allwinner GMAC support"
default ARCH_SUNXI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile 
b/drivers/net/ethernet/stmicro/stmmac/Makefile
index b390161..5f7ff0a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)   += dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_STI)+= dwmac-sti.o
+obj-$(CONFIG_DWMAC_STM32)  += dwmac-stm32.o
 obj-$(CONFIG_DWMAC_SUNXI)  += dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_GENERIC)+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c 
b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
new file mode 100644
index 000..88c8573
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
@@ -0,0 +1,193 @@
+/*
+ * dwmac-stm32.c - DWMAC Specific Glue layer for STM32 MCU
+ *
+ * Copyright (C) Alexandre Torgue 2015
+ * Author:  Alexandre Torgue 
+ * License terms:  GNU General Public License (GPL), version 2
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "stmmac_platform.h"
+
+#define MII_PHY_SEL_MASK   BIT(23)
+
+struct stm32_dwmac {
+   struct clk *clk_tx;
+   struct clk *clk_rx;
+   u32 mode_reg;   /* MAC glue-logic mode register */
+   struct regmap *regmap;
+   u32 speed;
+};
+
+static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat)
+{
+   struct stm32_dwmac *dwmac = plat_dat->bsp_priv;
+   u32 reg = dwmac->mode_reg;
+   u32 val;
+   int ret;
+
+   val = (plat_dat->interface == PHY_INTERFACE_MODE_MII) ? 0 : 1;
+   ret = regmap_update_bits(dwmac->regmap, reg, MII_PHY_SEL_MASK, val);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(dwmac->clk_tx);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(dwmac->clk_rx);
+   if (ret)
+   clk_disable_unprepare(dwmac->clk_tx);
+
+   return ret;
+}
+
+static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac)
+{
+   clk_disable_unprepare(dwmac->clk_tx);
+   clk_disable_unprepare(dwmac->clk_rx);
+}
+
+static int stm32_dwmac_parse_data(struct stm32_dwmac *dwmac,
+ struct device *dev)
+{
+   struct device_node *np = dev->of_node;
+   int err;
+
+   /*  Get TX/RX clocks */
+   dwmac->clk_tx = devm_clk_get(dev, "tx-clk");
+   if (IS_ERR(dwmac->clk_tx)) {
+   dev_err(dev, "No tx clock provided...\n");
+   return PTR_ERR(dwmac->clk_tx);
+   }
+   dwmac->clk_rx = devm_clk_get(dev, "rx-clk");
+   if (IS_ERR(dwmac->clk_rx)) {
+   dev_err(dev, "No rx clock provided...\n");
+   return PTR_ERR(dwmac->clk_rx);
+   }
+
+   /* Get mode register */
+   dwmac->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscon");
+   if (IS_ERR(dwmac->regmap))
+   return PTR_ERR(dwmac->regmap);
+
+   err = of_property_read_u32_index(np, "st,syscon", 1, >mode_reg);
+   if (err)
+   dev_err(dev, "Can't get sysconfig mode offset (%d)\n", err);
+
+   return err;
+}
+
+static int stm32_dwmac_probe(struct platform_device *pdev)
+{
+   struct plat_stmmacenet_data *plat_dat;
+   struct stmmac_resources stmmac_res;
+   struct stm32_dwmac *dwmac;
+   int ret;
+
+   ret = stmmac_get_platform_resources(pdev, _res);
+   if (ret)
+   return ret;
+
+   plat_dat = stmmac_probe_config_dt(pdev, _res.mac);
+   if (IS_ERR(plat_dat))
+   

[RFC PATCH linux-next] net: dst_cache_per_cpu_dst_set() can be static

2016-03-18 Thread kbuild test robot

Signed-off-by: Fengguang Wu 
---
 dst_cache.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
index 3938f3f..554d364 100644
--- a/net/core/dst_cache.c
+++ b/net/core/dst_cache.c
@@ -28,8 +28,8 @@ struct dst_cache_pcpu {
};
 };
 
-void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache,
-  struct dst_entry *dst, u32 cookie)
+static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache,
+ struct dst_entry *dst, u32 cookie)
 {
dst_release(dst_cache->dst);
if (dst)
@@ -39,8 +39,8 @@ void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu 
*dst_cache,
dst_cache->dst = dst;
 }
 
-struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache,
-   struct dst_cache_pcpu *idst)
+static struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache,
+  struct dst_cache_pcpu *idst)
 {
struct dst_entry *dst;
 


Re: [PATCH] xfrm: don't segment UFO packets

2016-03-18 Thread Steffen Klassert
On Fri, Mar 18, 2016 at 10:36:53AM +0800, Herbert Xu wrote:
> On Thu, Mar 17, 2016 at 06:08:55PM +0100, Jiri Bohac wrote:
> > On Thu, Mar 17, 2016 at 11:24:59AM +0100, Steffen Klassert wrote:
> > > In IPv6 this check is missing, so this could be the
> > > problem if this is IPv6.
> > 
> > indeed, this patch also fixes my problem:
> 
> Hmm, is this what you really want? If I understood you correctly,
> you want the fragmentation to occur after IPsec.

The main problem was probably that UFO handling does not work at
all on IPv6 IPsec. 

> So while this
> might generate the same output, it is still going to prefragment
> the data, only to merge them back for IPsec and then refragment
> again.

This is far away from being optimal, but this is what usually
happens if a local application sends data that we need to
fragment.

We currently work on avoiding the linearization on IPsec,
but having a skb with a fraglist is really the worst case.


Re: Extreme slowness in IPIP tunnel when routing through kernel 3.18 and later

2016-03-18 Thread Jesse Gross
On Thu, Mar 17, 2016 at 7:02 AM, Patrick Boutilier  wrote:
> I have an IPIP tunnel setup between two hosts in different buildings. The
> Linux router they route through causes extreme slowness in the tunnel when
> running kernels from 3.18 on . tcpdump shows many cksum errors which don't
> show up in the 3.17 and earlier kernels. Speed goes back to normal when
> rx-checksumming and tx-checksumming are turned off using ethtool on the
> Linux router . Would this be an effect of bulk network packet transmission
> that was introduced in 3.18 or some other issue?

I just sent out a likely fix, would you mind testing it?
https://patchwork.ozlabs.org/patch/599213/


[PATCH][net-next] ipv6: rework the lock in addrconf_permanent_addr

2016-03-18 Thread roy . qing . li
From: Li RongQing 

1. nothing of idev is changed, so read lock is enough
2. ifp is changed, so used ifp->lock or cmpxchg to protect it

Signed-off-by: Li RongQing 
---
 net/ipv6/addrconf.c | 26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8c0dab2..08a9ee9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3178,14 +3178,21 @@ static void addrconf_gre_config(struct net_device *dev)
 static void l3mdev_check_host_rt(struct inet6_dev *idev,
  struct inet6_ifaddr *ifp)
 {
+   struct rt6_info *rt = NULL;
+
+   spin_lock(>lock);
if (ifp->rt) {
u32 tb_id = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL;
 
if (tb_id != ifp->rt->rt6i_table->tb6_id) {
-   ip6_del_rt(ifp->rt);
+   rt = ifp->rt;
ifp->rt = NULL;
}
}
+   spin_unlock(>lock);
+
+   if (rt)
+   ip6_del_rt(rt);
 }
 #else
 static void l3mdev_check_host_rt(struct inet6_dev *idev,
@@ -3197,6 +3204,8 @@ static void l3mdev_check_host_rt(struct inet6_dev *idev,
 static int fixup_permanent_addr(struct inet6_dev *idev,
struct inet6_ifaddr *ifp)
 {
+   struct rt6_info *prev;
+
l3mdev_check_host_rt(idev, ifp);
 
if (!ifp->rt) {
@@ -3206,7 +3215,12 @@ static int fixup_permanent_addr(struct inet6_dev *idev,
if (unlikely(IS_ERR(rt)))
return PTR_ERR(rt);
 
-   ifp->rt = rt;
+   prev = cmpxchg(>rt, NULL, rt);
+
+   /*if cmpxchg failed*/
+   if (prev) {
+   ip6_rt_put(rt);
+   }
}
 
if (!(ifp->flags & IFA_F_NOPREFIXROUTE)) {
@@ -3228,21 +3242,21 @@ static void addrconf_permanent_addr(struct net_device 
*dev)
if (!idev)
return;
 
-   write_lock_bh(>lock);
+   read_lock_bh(>lock);
 
list_for_each_entry_safe(ifp, tmp, >addr_list, if_list) {
if ((ifp->flags & IFA_F_PERMANENT) &&
fixup_permanent_addr(idev, ifp) < 0) {
-   write_unlock_bh(>lock);
+   read_unlock_bh(>lock);
ipv6_del_addr(ifp);
-   write_lock_bh(>lock);
+   read_lock_bh(>lock);
 
net_info_ratelimited("%s: Failed to add prefix route 
for address %pI6c; dropping\n",
 idev->dev->name, >addr);
}
}
 
-   write_unlock_bh(>lock);
+   read_unlock_bh(>lock);
 }
 
 static int addrconf_notify(struct notifier_block *this, unsigned long event,
-- 
2.1.4



Re: [PATCH net-next] vxlan: fix too large pskb_may_pull with remote checksum

2016-03-18 Thread Tom Herbert
On Wed, Mar 16, 2016 at 9:35 AM, Jiri Benc  wrote:
> The vxlan header is pulled at this point, don't include it again in the
> calculation.
>
Hmm, I think I missing something obvious. Where was the pull of the
vxlan header done?

Thanks,
Tom

> Signed-off-by: Jiri Benc 
> ---
> This was previously part of the VXLAN-GPE patchset but it's not really
> related (especially not after the discussion that RCO should not be allowed
> together with GPE). I'm sending it separately.
> ---
>  drivers/net/vxlan.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 800106a7246c..1eb8347f440c 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1143,7 +1143,7 @@ static int vxlan_igmp_leave(struct vxlan_dev *vxlan)
>  static bool vxlan_remcsum(struct vxlanhdr *unparsed,
>   struct sk_buff *skb, u32 vxflags)
>  {
> -   size_t start, offset, plen;
> +   size_t start, offset;
>
> if (!(unparsed->vx_flags & VXLAN_HF_RCO) || skb->remcsum_offload)
> goto out;
> @@ -1151,9 +1151,7 @@ static bool vxlan_remcsum(struct vxlanhdr *unparsed,
> start = vxlan_rco_start(unparsed->vx_vni);
> offset = start + vxlan_rco_offset(unparsed->vx_vni);
>
> -   plen = sizeof(struct vxlanhdr) + offset + sizeof(u16);
> -
> -   if (!pskb_may_pull(skb, plen))
> +   if (!pskb_may_pull(skb, offset + sizeof(u16)))
> return false;
>
> skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset,
> --
> 1.8.3.1
>


Re: [PATCH] iwlwifi: dvm: convert create_singlethread_workqueue() to alloc_workqueue()

2016-03-18 Thread t...@kernel.org
Hello,

On Thu, Mar 17, 2016 at 12:43:35PM +, Grumbach, Emmanuel wrote:
> > 
> > Use alloc_workqueue() to allocate the workqueue instead of
> > create_singlethread_workqueue() since the latter is deprecated and is
> > scheduled
> > for removal.
> 
> I can't see any indication of that in the code of workqueue.
> Can you share details about that?

create*_workqueue()'s have been deprecated and replaced by
alloc*_workqueue()'s for some years now.  I probably should note that
in the header file.

Thanks.

-- 
tejun


[iproute PATCH 5/8] man: tc-police.8: Emphasize on the two rate control mechanisms

2016-03-18 Thread Phil Sutter
As Jamal pointed out, there are two different approaches to bandwidth
measurement. Try to make this clear by separating them in synopsis and
also documenting the way to fine-tune avrate.

Signed-off-by: Phil Sutter 
---
 man/man8/tc-police.8 | 29 +
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/man/man8/tc-police.8 b/man/man8/tc-police.8
index 2b1537ec52875..5c5a632335dc9 100644
--- a/man/man8/tc-police.8
+++ b/man/man8/tc-police.8
@@ -12,13 +12,21 @@ police - policing action
 .IR BYTES [\fB/ BYTES "] ] ["
 .BI peakrate " RATE"
 ] [
-.BI avrate " RATE"
-] [
 .BI overhead " BYTES"
 ] [
 .BI linklayer " TYPE"
 ] [
-.BI conform-exceed " EXCEEDACT\fR[\fB/\fIEXCEEDACT\fR]"
+.IR CONTROL " ]"
+
+.ti -8
+.BR tc " ... " filter " ... [ " estimator
+.IR "SAMPLE AVERAGE " ]
+.BR "action police avrate"
+.IR RATE " [ " CONTROL " ]"
+
+.ti -8
+.IR CONTROL " :="
+.BI conform-exceed " EXCEEDACT\fR[\fB/\fIEXCEEDACT"
 
 .ti -8
 .IR EXCEEDACT " := { "
@@ -27,7 +35,14 @@ police - policing action
 The
 .B police
 action allows to limit bandwidth of traffic matched by the filter it is
-attached to.
+attached to. Basically there are two different algorithms available to measure
+the packet rate: The first one uses an internal dual token bucket and is
+configured using the
+.BR rate ", " burst ", " mtu ", " peakrate ", " overhead " and " linklayer
+parameters. The second one uses an in-kernel sampling mechanism. It can be
+fine-tuned using the
+.B estimator
+filter parameter.
 .SH OPTIONS
 .TP
 .BI rate " RATE"
@@ -73,6 +88,12 @@ cell sizes, for
 .B ethernet
 no action is taken.
 .TP
+.BI estimator " SAMPLE AVERAGE"
+Fine-tune the in-kernel packet rate estimator.
+.IR SAMPLE " and " AVERAGE
+are time values and control the frequency in which samples are taken and over
+what timespan an average is built.
+.TP
 .BI conform-exceed " EXCEEDACT\fR[\fB/\fIEXCEEDACT\fR]"
 Define how to handle packets which exceed (and, if the second
 .I EXCEEDACT
-- 
2.7.2



[patch net-next RFC 08/13] mlxsw: core: Add devlink shared buffer callbacks

2016-03-18 Thread Jiri Pirko
From: Jiri Pirko 

Add middle layer in mlxsw core code to forward shared buffer calls
into specific ASIC drivers.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 105 -
 drivers/net/ethernet/mellanox/mlxsw/core.h |  20 ++
 2 files changed, 123 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 3958195..1278260 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -816,9 +816,110 @@ static int mlxsw_devlink_port_unsplit(struct devlink 
*devlink,
return mlxsw_core->driver->port_unsplit(mlxsw_core, port_index);
 }
 
+static int
+mlxsw_devlink_sb_pool_get(struct devlink *devlink,
+ unsigned int sb_index, u16 pool_index,
+ struct devlink_sb_pool_info *pool_info)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+
+   if (!mlxsw_driver->sb_pool_get)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_pool_get(mlxsw_core, sb_index,
+pool_index, pool_info);
+}
+
+static int
+mlxsw_devlink_sb_pool_set(struct devlink *devlink,
+ unsigned int sb_index, u16 pool_index, u32 size,
+ enum devlink_sb_threshold_type threshold_type)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+
+   if (!mlxsw_driver->sb_pool_set)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_pool_set(mlxsw_core, sb_index,
+pool_index, size, threshold_type);
+}
+
+static void *__dl_port(struct devlink_port *devlink_port)
+{
+   return container_of(devlink_port, struct mlxsw_core_port, devlink_port);
+}
+
+static int mlxsw_devlink_sb_port_pool_get(struct devlink_port *devlink_port,
+ unsigned int sb_index, u16 pool_index,
+ u32 *p_threshold)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+   struct mlxsw_core_port *mlxsw_core_port = __dl_port(devlink_port);
+
+   if (!mlxsw_driver->sb_port_pool_get)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_port_pool_get(mlxsw_core_port, sb_index,
+ pool_index, p_threshold);
+}
+
+static int mlxsw_devlink_sb_port_pool_set(struct devlink_port *devlink_port,
+ unsigned int sb_index, u16 pool_index,
+ u32 threshold)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+   struct mlxsw_core_port *mlxsw_core_port = __dl_port(devlink_port);
+
+   if (!mlxsw_driver->sb_port_pool_set)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_port_pool_set(mlxsw_core_port, sb_index,
+ pool_index, threshold);
+}
+
+static int
+mlxsw_devlink_sb_tc_pool_bind_get(struct devlink_port *devlink_port,
+ unsigned int sb_index, u16 tc_index,
+ enum devlink_sb_pool_type pool_type,
+ u16 *p_pool_index, u32 *p_threshold)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+   struct mlxsw_core_port *mlxsw_core_port = __dl_port(devlink_port);
+
+   if (!mlxsw_driver->sb_tc_pool_bind_get)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_tc_pool_bind_get(mlxsw_core_port, sb_index,
+tc_index, pool_type,
+p_pool_index, p_threshold);
+}
+
+static int
+mlxsw_devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
+ unsigned int sb_index, u16 tc_index,
+ enum devlink_sb_pool_type pool_type,
+ u16 pool_index, u32 threshold)
+{
+   struct mlxsw_core *mlxsw_core = devlink_priv(devlink_port->devlink);
+   struct mlxsw_driver *mlxsw_driver = mlxsw_core->driver;
+   struct mlxsw_core_port *mlxsw_core_port = __dl_port(devlink_port);
+
+   if (!mlxsw_driver->sb_tc_pool_bind_set)
+   return -EOPNOTSUPP;
+   return mlxsw_driver->sb_tc_pool_bind_set(mlxsw_core_port, sb_index,
+tc_index, pool_type,
+pool_index, threshold);
+}
+

Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory

2016-03-18 Thread Arnd Bergmann
On Thursday 17 March 2016 12:06:40 Rob Herring wrote:
> > diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt 
> > b/Documentation/devicetree/bindings/soc/fsl/guts.txt
> > similarity index 91%
> > rename from Documentation/devicetree/bindings/powerpc/fsl/guts.txt
> > rename to Documentation/devicetree/bindings/soc/fsl/guts.txt
> > index b71b203..07adca9 100644
> > --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt
> > +++ b/Documentation/devicetree/bindings/soc/fsl/guts.txt
> > @@ -25,6 +25,9 @@ Recommended properties:
> >   - fsl,liodn-bits : Indicates the number of defined bits in the LIODN
> > registers, for those SOCs that have a PAMU device.
> >  
> > + - little-endian : Indicates that the global utilities block is little
> > +   endian. The default is big endian.
> 
> The default is "the native endianness of the system".

This may be what is currently documented, but not what we are doing
in practice, as there is no "native endianess" for either PowerPC or
ARM -- both allow running big-endian or little-endian kernels and the
device registers are fixed.

I think the property here is fine.

Arnd


Re: [PATCH net-next 0/6] bridge: support sending rntl info when we set attributes through sysfs/ioctl

2016-03-18 Thread David Miller
From: Xin Long 
Date: Wed, 16 Mar 2016 21:34:43 +0800

> This patchset is used to support sending rntl info to user in some places,
> and ensure that whenever those attributes change internally or from sysfs,
> that a netlink notification is sent out to listeners.

This is too late for net-next, please wait until after the merge window.

Thanks.


[PATCH net-next 0/2] ovs: refresh a flow via netlink

2016-03-18 Thread Samuel Gauthier
This patchset adds a netlink api to refresh an existing flow in
openvswitch.

When a packet is sent in the openvswitch kernel datapath and no
flow is found, the packet is sent to the ovs-vswitchd daemon,
which will process the packet, and ask the kernel to create a new
flow. The next packets for this flow will be processed by the
kernel datapath. If a flow is not used for a (configurable)
period of time, ovs-vswitchd removes the flow from the kernel.

As a result, it can be tricky to test the kernel datapath against
packets, as the first packets of each flow will have to go
through the ovs-vswitchd daemon. For instance, to do a zeroloss
performance test, you establish the flows, and then you have to
perform your zeroloss test before the flow is removed by
ovs-vswitchd.

It is possible to configure a flow timeout in ovs-vswitchd (using
other_config:max-idle option), but it changes the behavior for
all the flows, which is not always what you want.

I tested this with a patch for the openvswitch tree of the
ovs-dpctl mod-flow command, which adds a --refresh flag. I will
submit the patch if this patchset is accepted.

Samuel Gauthier (2):
  ovs: split ovs_flow_stats_update into skb and stats
  ovs: support to refresh a flow via netlink

 net/openvswitch/datapath.c |  4 +++-
 net/openvswitch/flow.c | 23 ++-
 net/openvswitch/flow.h |  5 +++--
 3 files changed, 24 insertions(+), 8 deletions(-)

-- 
2.2.1.62.g3f15098



Re: [PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-18 Thread Vineet Gupta
On Thursday 17 March 2016 04:28 PM, Sergei Shtylyov wrote:
> On 3/17/2016 12:41 PM, Alexey Brodkin wrote:
>
>> > Following commit broke DW GMAC functionality on AXS10x boards:
>> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763
> Note that scripts/checkpatch.pl now enforces certain format for citing 
> commits: commit <12-digit SHA1> ("").
>
> [...]
>
> MBR, Sergei

Indeed - I've fixed this up and added to arc for-curr !

-Vineet


Os empréstimos baratos de diamante Finanças

2016-03-18 Thread Você encontra a tentar obter um empréstimo intimidante?
Oferecemos empréstimos legítimos para a taxa de juro de apenas 1,8%, com
as melhores condições, Sem garantias necessárias,
apenas pessoas sérias Aplicar em baixo;
Nomes completos:
Endereço completo:
ocupação:
Montante do empréstimo :
Empréstimo Duração:
Finalidade do empréstimo:
Telefone / Telemóvel / celular:
Você está disposto a assinar um documento?
mailto: diamondfin.servic...@gmail.com









Re: Micrel Phy - Is there a way to configure the Phy not to do 802.3x flow control?

2016-03-18 Thread Florian Fainelli
On March 16, 2016 8:08:14 AM PDT, Murali Karicheri
>> What it means before your patch is that flow control is reported to
>the
>> PHY device if the link partner advertises that, with your patch
>applied,
>> it is reported only if the link partner and yourself advertise flow
>control.
>> 
>> You seem to be willing to have phydev->pause and phydev->asym_pause
>> reflect the resolved pause capability, as opposed to the link
>partner's
>> pause capability, which I am not convinced is correct here, because
>we
>> need to take into account the user-configured pause configuration as
>> well. Your adjust_link function should be the one deciding whether
>pause
>> frame advertising and enabling is appropriate based on: locally
>> configured pause settings (enabled, disabled, autoneg) and the link
>> partner's pause capability.
>> 
>> I do agree that the two fields are confusing and poorly documented,
>and
>> we should probably be consolidating the pause frame behavior in
>PHYLIB
>> as opposed to letting drivers deal with like e.g: gianfar,
>bcm63xx_enet,
>> tg3 etc.
>> 
>>>  
>>> Could you explain, why the common maximum capability is not reported
>to the
>>> driver as per standard?? Or Am I understood it wrong?
>> 
>> I do not understand the question, what is "maximum capability" in
>that
>> context and what standard are you refering to?
>> 
>I assume the Phylib is responsible for deciding what is the flow
>control pause and asym pause status to the driver through adjust_link.

Not exclusively, the Ethernet MAC driver is responsible for getting the
full picture: whether pause frames need to be advertised, enabled
locally and supported by the link partner. PHYLIB helps with the later
since the former may come from ethtool:: get_pauseparam and need to
program MAC specific registers within the adjust_link callback.

>When driver starts the phy, it also tells its capabilities (for example
>it can reset some of the capabilities available in the Phy driver. In
>this
>particular case, Pause is a feature supported by Micrel phy. I have
>reset
>this feature in my driver by resetting this feature bit in the
>phy_device
>as suggested earlier in this discussion). So phylib has all knowledge
>available to disable flow control in this scenario even if LP is
>capable
>of flow control. Wondering why every driver has to take this decision
>again to enable or disable flow control instead of telling the driver
>what to do. 

PHYLIB still misses the MAC driver decisions like whether pause frames
are to be enabled by default through autoneg or manually enforced via an
user, which is why it reports what the link partner's pause capability
so as to get your driver to be able to make the right decisions here.


>
>Looks like Marvel driver (reproduced below) does this logic. I think
>the
>802.3x flow control states, but I don't have access to the standard
>documentation.
>However I find the documentation at 
>http://www.studioreti.it/slide/08_SwFlowContr_E_A.pdf.
>
>Page 17 states the behavior based on Local device & Link partner's 
>capabilities. Probably adjust_link() should tell the outcome in pause
>and asym_pause so that driver can enable/disable fc. Also user's action
>to be taken into account as well so that fc can be disabled if desired.
>
>Code from drivers/net/phy/marvel.c


Well, thanks for poing that piece of code, that seems to be duplicating
a bit of what genphy_read_status() is already doing.
--
Florian


[PATCH v2 net-next 0/2] lan78xx: patch series

2016-03-18 Thread Woojung.Huh
From: Woojung Huh 

Woojung Huh (2):
  lan78xx: handle statistics counter rollover
  lan78xx: add ndo_get_stats64

 drivers/net/usb/lan78xx.c | 301 --
 1 file changed, 288 insertions(+), 13 deletions(-)

-- 
2.7.0


[RFC PATCH 7/9] GSO: Support partial segmentation offload

2016-03-18 Thread Alexander Duyck
This patch adds support for something I am referring to as GSO partial.
The basic idea is that we can support a broader range of devices for
segmentation if we use fixed outer headers and have the hardware only
really deal with segmenting the inner header.  The idea behind the naming
is due to the fact that everything before csum_start will be fixed headers,
and everything after will be the region that is handled by hardware.

With the current implementation it allows us to add support for the
following GSO types with an inner TSO or TSO6 offload:
NETIF_F_GSO_GRE
NETIF_F_GSO_GRE_CSUM
NETIF_F_UDP_TUNNEL
NETIF_F_UDP_TUNNEL_CSUM

Signed-off-by: Alexander Duyck 
---
 include/linux/netdev_features.h |7 ++-
 include/linux/netdevice.h   |2 ++
 include/linux/skbuff.h  |7 ++-
 net/core/dev.c  |   31 ++-
 net/core/ethtool.c  |1 +
 net/core/skbuff.c   |   21 -
 net/ipv4/af_inet.c  |   12 ++--
 net/ipv4/gre_offload.c  |   23 +++
 net/ipv4/tcp_offload.c  |   10 --
 net/ipv4/udp_offload.c  |   20 
 net/ipv6/ip6_offload.c  |9 -
 11 files changed, 126 insertions(+), 17 deletions(-)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index a734bf43d190..8df3c5553af0 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -48,8 +48,12 @@ enum {
NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */
+   NETIF_F_GSO_PARTIAL_BIT,/* ... Only segment inner-most L4
+* in hardware and all other
+* headers in software.
+*/
/**/NETIF_F_GSO_LAST =  /* last bit, see GSO_MASK */
-   NETIF_F_GSO_TUNNEL_REMCSUM_BIT,
+   NETIF_F_GSO_PARTIAL_BIT,
 
NETIF_F_FCOE_CRC_BIT,   /* FCoE CRC32 */
NETIF_F_SCTP_CRC_BIT,   /* SCTP checksum offload */
@@ -121,6 +125,7 @@ enum {
 #define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
 #define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
 #define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)
+#define NETIF_F_GSO_PARTIAL __NETIF_F(GSO_PARTIAL)
 #define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
 #define NETIF_F_HW_VLAN_STAG_RX__NETIF_F(HW_VLAN_STAG_RX)
 #define NETIF_F_HW_VLAN_STAG_TX__NETIF_F(HW_VLAN_STAG_TX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 31474d9d8a96..427d748ad8f9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1647,6 +1647,7 @@ struct net_device {
netdev_features_t   vlan_features;
netdev_features_t   hw_enc_features;
netdev_features_t   mpls_features;
+   netdev_features_t   gso_partial_features;
 
int ifindex;
int group;
@@ -4014,6 +4015,7 @@ static inline bool net_gso_ok(netdev_features_t features, 
int gso_type)
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> 
NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> 
NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> 
NETIF_F_GSO_SHIFT));
+   BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> 
NETIF_F_GSO_SHIFT));
 
return (features & feature) == feature;
 }
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 15d0df943466..c291a282f8b6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -482,6 +482,8 @@ enum {
SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11,
 
SKB_GSO_TUNNEL_REMCSUM = 1 << 12,
+
+   SKB_GSO_PARTIAL = 1 << 13,
 };
 
 #if BITS_PER_LONG > 32
@@ -3584,7 +3586,10 @@ static inline struct sec_path *skb_sec_path(struct 
sk_buff *skb)
  * Keeps track of level of encapsulation of network headers.
  */
 struct skb_gso_cb {
-   int mac_offset;
+   union {
+   int mac_offset;
+   int data_offset;
+   };
int encap_level;
__wsum  csum;
__u16   csum_start;
diff --git a/net/core/dev.c b/net/core/dev.c
index edb7179bc051..666cf427898b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2711,6 +2711,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
return ERR_PTR(err);
}
 
+   /* Only report GSO partial support if it will enable us to
+* support segmentation on this frame without needing additional
+* work.
+*/
+   if 

Re: [PATCH net 1/1] qlge: Fix receive packets drop.

2016-03-18 Thread David Miller
From: Manish Chopra 
Date: Tue, 15 Mar 2016 07:13:45 -0400

> When running small packets [length < 256 bytes] traffic, packets were
> being dropped due to invalid data in those packets which were
> delivered by the driver upto the stack. Using pci_dma_sync_single_for_cpu
> ensures copying latest and updated data into skb from the receive buffer.
> 
> Signed-off-by: Sony Chacko 
> Signed-off-by: Manish Chopra 

Applied and queued up for -stable.


Re: [PATCH net] bnx2x: Prevent false warning for lack of FC NPIV

2016-03-18 Thread David Miller
From: Yuval Mintz 
Date: Tue, 15 Mar 2016 19:52:04 +0200

> Not all adapters have FC-NPIV configured. If bnx2fc is used with such an
> adapter, driver would read irrelevant data from the the nvram and log
> "FC-NPIV table with bad length..." In system logs.
> 
> Simply accept that reading '0' as the feature offset in nvram indicates
> the feature isn't there and return.
> 
> Reported-by: Andrew Patterson 
> Signed-off-by: Yuval Mintz 

Applied.


[patch net-next RFC 02/13] devlink: add shared buffer configuration

2016-03-18 Thread Jiri Pirko
From: Jiri Pirko 

Define userspace API and drivers API for configuration of shared
buffers. Four basic objects are defined:
shared buffer - attributes are size, number of pools and TCs
pool - chunk of sharedbuffer definition, it has some size and either
   static or dynamic threshold
port pool threshold - to set per-port threshold for each pool
port tc threshold bind - to bind port and TC to specified pool with threshold.

Signed-off-by: Jiri Pirko 
---
 include/net/devlink.h|  46 +++
 include/uapi/linux/devlink.h |  41 ++
 net/core/devlink.c   | 911 +++
 3 files changed, 998 insertions(+)

diff --git a/include/net/devlink.h b/include/net/devlink.h
index c37d257..343d8cf 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -24,6 +24,7 @@ struct devlink_ops;
 struct devlink {
struct list_head list;
struct list_head port_list;
+   struct list_head sb_list;
const struct devlink_ops *ops;
struct device *dev;
possible_net_t _net;
@@ -42,6 +43,12 @@ struct devlink_port {
u32 split_group;
 };
 
+struct devlink_sb_pool_info {
+   enum devlink_sb_pool_type pool_type;
+   u32 size;
+   enum devlink_sb_threshold_type threshold_type;
+};
+
 struct devlink_ops {
size_t priv_size;
int (*port_type_set)(struct devlink_port *devlink_port,
@@ -49,6 +56,28 @@ struct devlink_ops {
int (*port_split)(struct devlink *devlink, unsigned int port_index,
  unsigned int count);
int (*port_unsplit)(struct devlink *devlink, unsigned int port_index);
+   int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
+  u16 pool_index,
+  struct devlink_sb_pool_info *pool_info);
+   int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
+  u16 pool_index, u32 size,
+  enum devlink_sb_threshold_type threshold_type);
+   int (*sb_port_pool_get)(struct devlink_port *devlink_port,
+   unsigned int sb_index, u16 pool_index,
+   u32 *p_threshold);
+   int (*sb_port_pool_set)(struct devlink_port *devlink_port,
+   unsigned int sb_index, u16 pool_index,
+   u32 threshold);
+   int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
+  unsigned int sb_index,
+  u16 tc_index,
+  enum devlink_sb_pool_type pool_type,
+  u16 *p_pool_index, u32 *p_threshold);
+   int (*sb_tc_pool_bind_set)(struct devlink_port *devlink_port,
+  unsigned int sb_index,
+  u16 tc_index,
+  enum devlink_sb_pool_type pool_type,
+  u16 pool_index, u32 threshold);
 };
 
 static inline void *devlink_priv(struct devlink *devlink)
@@ -82,6 +111,10 @@ void devlink_port_type_ib_set(struct devlink_port 
*devlink_port,
 void devlink_port_type_clear(struct devlink_port *devlink_port);
 void devlink_port_split_set(struct devlink_port *devlink_port,
u32 split_group);
+int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
+   u32 size, u16 ingress_pools_count,
+   u16 egress_pools_count, u16 tc_count);
+void devlink_sb_unregister(struct devlink *devlink, unsigned int sb_index);
 
 #else
 
@@ -135,6 +168,19 @@ static inline void devlink_port_split_set(struct 
devlink_port *devlink_port,
 {
 }
 
+static inline int devlink_sb_register(struct devlink *devlink,
+ unsigned int sb_index, u32 size,
+ u16 ingress_pools_count,
+ u16 egress_pools_count, u16 tc_count)
+{
+   return 0;
+}
+
+static inline void devlink_sb_unregister(struct devlink *devlink,
+unsigned int sb_index)
+{
+}
+
 #endif
 
 #endif /* _NET_DEVLINK_H_ */
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index c9fee57..9bf34c7 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -33,6 +33,26 @@ enum devlink_command {
DEVLINK_CMD_PORT_SPLIT,
DEVLINK_CMD_PORT_UNSPLIT,
 
+   DEVLINK_CMD_SB_GET, /* can dump */
+   DEVLINK_CMD_SB_SET,
+   DEVLINK_CMD_SB_NEW,
+   DEVLINK_CMD_SB_DEL,
+
+   DEVLINK_CMD_SB_POOL_GET,/* can dump */
+   DEVLINK_CMD_SB_POOL_SET,
+   DEVLINK_CMD_SB_POOL_NEW,
+   DEVLINK_CMD_SB_POOL_DEL,
+
+   DEVLINK_CMD_SB_PORT_POOL_GET,   /* can dump */
+   DEVLINK_CMD_SB_PORT_POOL_SET,
+   DEVLINK_CMD_SB_PORT_POOL_NEW,
+   

Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory

2016-03-18 Thread Rob Herring
On Wed, Mar 09, 2016 at 06:08:49PM +0800, Yangbo Lu wrote:
> Move guts devicetree doc to Documentation/devicetree/bindings/soc/fsl/
> since it's used by not only PowerPC but also ARM. And add a specification
> for 'little-endian' property.
> 
> Signed-off-by: Yangbo Lu 
> ---
> Changes for v2:
>   - None
> Changes for v3:
>   - None
> Changes for v4:
>   - Added this patch
> Changes for v5:
>   - Modified the description for little-endian property
> Changes for v6:
>   - None
> ---
>  Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++
>  1 file changed, 3 insertions(+)
>  rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)
> 
> diff --git a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt 
> b/Documentation/devicetree/bindings/soc/fsl/guts.txt
> similarity index 91%
> rename from Documentation/devicetree/bindings/powerpc/fsl/guts.txt
> rename to Documentation/devicetree/bindings/soc/fsl/guts.txt
> index b71b203..07adca9 100644
> --- a/Documentation/devicetree/bindings/powerpc/fsl/guts.txt
> +++ b/Documentation/devicetree/bindings/soc/fsl/guts.txt
> @@ -25,6 +25,9 @@ Recommended properties:
>   - fsl,liodn-bits : Indicates the number of defined bits in the LIODN
> registers, for those SOCs that have a PAMU device.
>  
> + - little-endian : Indicates that the global utilities block is little
> +   endian. The default is big endian.

The default is "the native endianness of the system". So absence on an 
ARM system would be LE. This property is valid for any simple-bus 
device, so it isn't really required to document per device. You can, but 
your description had better match the documented behaviour.

Rob


Re: [PATCH ethtool 3/3] Documentation for IPv6 NFC

2016-03-18 Thread Edward Cree
On 13/03/16 16:47, Ben Hutchings wrote:
> Why is ip6 added in the middle of the IPv4 flow-types here...
> ...and here...
> ...but not here?
Good catch; I will make them all like the last one.
> Missing nexthdr?
On the contrary, it needed to be removed from all the other places - there
is no nexthdr input, only l4proto.

-Ed


Re: [PATCH 2/2] lan78xx: add ndo_get_stats64

2016-03-18 Thread Sergei Shtylyov

Hello.

On 3/16/2016 1:52 AM, woojung@microchip.com wrote:


From: Woojung Huh 

Add lan78xx_get_stats64 of ndo_get_stats64 to report
all statistics counters including errors from HW statistics.

Read from HW when auto suspend is disabled, use saved counter when
auto suspend is enabled because periodic call to ndo_get_stats64
prevents USB auto suspend.

Signed-off-by: Woojung Huh 
---
  drivers/net/usb/lan78xx.c | 49 +++
  1 file changed, 49 insertions(+)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index f20890e..f4a9708f 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3261,6 +3261,54 @@ void lan78xx_tx_timeout(struct net_device *net)
tasklet_schedule(>bh);
  }

+struct rtnl_link_stats64 *lan78xx_get_stats64(struct net_device *netdev,
+ struct rtnl_link_stats64 *storage)
+{

[...]

+   storage->rx_length_errors = (stats.rx_undersize_frame_errors +
+stats.rx_oversize_frame_errors);


   Parens not needed.


+   storage->rx_crc_errors = stats.rx_fcs_errors;
+   storage->rx_frame_errors = stats.rx_alignment_errors;
+   storage->rx_fifo_errors = stats.rx_dropped_frames;
+   storage->rx_over_errors = stats.rx_oversize_frame_errors;
+   storage->rx_errors = (stats.rx_fcs_errors +
+ stats.rx_alignment_errors +
+ stats.rx_fragment_errors +
+ stats.rx_jabber_errors +
+ stats.rx_undersize_frame_errors +
+ stats.rx_oversize_frame_errors +
+ stats.rx_dropped_frames);


   Neither here.


+
+   storage->tx_carrier_errors = stats.tx_carrier_errors;
+   storage->tx_errors = (stats.tx_fcs_errors +
+ stats.tx_excess_deferral_errors +
+ stats.tx_carrier_errors);


   And here.

[...]

MBR, Sergei



Re: [PATCH net-next v2 4/4] vxlan: implement GPE

2016-03-18 Thread Jiri Benc
On Wed, 16 Mar 2016 10:31:10 -0700, Tom Herbert wrote:
> Sorry, I still don't like this. For VXLAN-GPE packets the above two
> conditionals are a complete waste of time and I shouldn't have to go
> pawing through configuration to determine what protocol has actually
> be implemented.  Please, at least move these into the else block of
> "if (vs->flags & VXLAN_F_GPE) {" above. This saves two conditionals in
> the data path, makes the parsing code more readable, and you don't
> need to reference configuration to figure things out.

As I already wrote, this is not possible. GPE parsing needs to occur
before iptunnel_pull_header (because we need to know the protocol), GBP
parsing needs to happen after it (after udp_tun_rx_dst specifically).

Believe me, I would do it that way if it was possible.

I also considered splitting rx path for GPE and non-GPE case and the
result was much uglier and longer code.

 Jiri


Re: [PATCH v2 1/2] Revert "vsock: Fix blocking ops call in prepare_to_wait"

2016-03-18 Thread Laura Abbott

On 03/17/2016 09:12 AM, Claudio Imbrenda wrote:

This reverts commit 5988818008257ca42010d6b43a3e0e48afec9898 ("vsock: Fix
blocking ops call in prepare_to_wait")



I don't think having this as a separate patch does a lot of good. You
can probably fold this into the next patch with a note saying that
you are removing this broken behavior. If you really want this to
be separate, please add a description of why this is being reverted.

Thanks,
Laura


Signed-off-by: Claudio Imbrenda 
---
  net/vmw_vsock/af_vsock.c | 19 +--
  1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index bbe65dc..7fd1220 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1557,6 +1557,8 @@ static int vsock_stream_sendmsg(struct socket *sock, 
struct msghdr *msg,
if (err < 0)
goto out;

+   prepare_to_wait(sk_sleep(sk), , TASK_INTERRUPTIBLE);
+
while (total_written < len) {
ssize_t written;

@@ -1576,9 +1578,7 @@ static int vsock_stream_sendmsg(struct socket *sock, 
struct msghdr *msg,
goto out_wait;

release_sock(sk);
-   prepare_to_wait(sk_sleep(sk), , 
TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
-   finish_wait(sk_sleep(sk), );
lock_sock(sk);
if (signal_pending(current)) {
err = sock_intr_errno(timeout);
@@ -1588,6 +1588,8 @@ static int vsock_stream_sendmsg(struct socket *sock, 
struct msghdr *msg,
goto out_wait;
}

+   prepare_to_wait(sk_sleep(sk), ,
+   TASK_INTERRUPTIBLE);
}

/* These checks occur both as part of and after the loop
@@ -1633,6 +1635,7 @@ static int vsock_stream_sendmsg(struct socket *sock, 
struct msghdr *msg,
  out_wait:
if (total_written > 0)
err = total_written;
+   finish_wait(sk_sleep(sk), );
  out:
release_sock(sk);
return err;
@@ -1713,6 +1716,7 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
if (err < 0)
goto out;

+   prepare_to_wait(sk_sleep(sk), , TASK_INTERRUPTIBLE);

while (1) {
s64 ready = vsock_stream_has_data(vsk);
@@ -1723,7 +1727,7 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
 */

err = -ENOMEM;
-   goto out;
+   goto out_wait;
} else if (ready > 0) {
ssize_t read;

@@ -1746,7 +1750,7 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
vsk, target, read,
!(flags & MSG_PEEK), _data);
if (err < 0)
-   goto out;
+   goto out_wait;

if (read >= target || flags & MSG_PEEK)
break;
@@ -1769,9 +1773,7 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
break;

release_sock(sk);
-   prepare_to_wait(sk_sleep(sk), , 
TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
-   finish_wait(sk_sleep(sk), );
lock_sock(sk);

if (signal_pending(current)) {
@@ -1781,6 +1783,9 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
err = -EAGAIN;
break;
}
+
+   prepare_to_wait(sk_sleep(sk), ,
+   TASK_INTERRUPTIBLE);
}
}

@@ -1811,6 +1816,8 @@ vsock_stream_recvmsg(struct socket *sock, struct msghdr 
*msg, size_t len,
err = copied;
}

+out_wait:
+   finish_wait(sk_sleep(sk), );
  out:
release_sock(sk);
return err;





[PATCH v2 ethtool 2/2] Documentation for IPv6 NFC

2016-03-18 Thread Edward Cree
Leaves 'src-ip' and 'dst-ip' documented as taking x.x.x.x, because there's
more low-level nroff here than I can parse, let alone emit.

Signed-off-by: Edward Cree 
---
 ethtool.8.in | 29 -
 ethtool.c|  4 +++-
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/ethtool.8.in b/ethtool.8.in
index 009711d..36da10e 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -74,7 +74,7 @@
 .\"
 .\"\(*NC - Network Classifier type values
 .\"
-.ds NC 
\fBether\fP|\fBip4\fP|\fBtcp4\fP|\fBudp4\fP|\fBsctp4\fP|\fBah4\fP|\fBesp4\fP
+.ds NC 
\fBether\fP|\fBip4\fP|\fBtcp4\fP|\fBudp4\fP|\fBsctp4\fP|\fBah4\fP|\fBesp4\fP|\fBip6\fP|\fBtcp6\fP|\fBudp6\fP|\fBah6\fP|\fBesp6\fP|\fBsctp6\fP
 ..
 .\"
 .\" Start URL.
@@ -263,6 +263,7 @@ ethtool \- query or control network driver and hardware 
settings
 .RB [ src\-ip \ \*(PA\ [ m \ \*(PA]]
 .RB [ dst\-ip \ \*(PA\ [ m \ \*(PA]]
 .BM tos
+.BM tclass
 .BM l4proto
 .BM src\-port
 .BM dst\-port
@@ -710,6 +711,12 @@ udp4   UDP over IPv4
 sctp4  SCTP over IPv4
 ah4IPSEC AH over IPv4
 esp4   IPSEC ESP over IPv4
+ip6Raw IPv6
+tcp6   TCP over IPv6
+udp6   UDP over IPv6
+sctp6  SCTP over IPv6
+ah6IPSEC AH over IPv6
+esp6   IPSEC ESP over IPv6
 .TE
 .PP
 For all fields that allow both a value and a mask to be specified, the
@@ -734,38 +741,42 @@ Valid only for flow-type ether.
 .TP
 .BR src\-ip \ \*(PA\ [ m \ \*(PA]
 Specify the source IP address of the incoming packet to match along with
-an optional mask.  Valid for all IPv4 based flow-types.
+an optional mask.  Valid for all IP based flow-types.
 .TP
 .BR dst\-ip \ \*(PA\ [ m \ \*(PA]
 Specify the destination IP address of the incoming packet to match along
-with an optional mask.  Valid for all IPv4 based flow-types.
+with an optional mask.  Valid for all IP based flow-types.
 .TP
 .BI tos \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Specify the value of the Type of Service field in the incoming packet to
 match along with an optional mask.  Applies to all IPv4 based flow-types.
 .TP
+.BI tclass \ N \\fR\ [\\fPm \ N \\fR]\\fP
+Specify the value of the Traffic Class field in the incoming packet to
+match along with an optional mask.  Applies to all IPv6 based flow-types.
+.TP
 .BI l4proto \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Includes the layer 4 protocol number and optional mask.  Valid only for
-flow-type ip4.
+flow-types ip4 and ip6.
 .TP
 .BI src\-port \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Specify the value of the source port field (applicable to TCP/UDP packets)
 in the incoming packet to match along with an optional mask.  Valid for
-flow-types ip4, tcp4, udp4, and sctp4.
+flow-types ip4, tcp4, udp4, and sctp4 and their IPv6 equivalents.
 .TP
 .BI dst\-port \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Specify the value of the destination port field (applicable to TCP/UDP
 packets)in the incoming packet to match along with an optional mask.
-Valid for flow-types ip4, tcp4, udp4, and sctp4.
+Valid for flow-types ip4, tcp4, udp4, and sctp4 and their IPv6 equivalents.
 .TP
 .BI spi \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Specify the value of the security parameter index field (applicable to
 AH/ESP packets)in the incoming packet to match along with an optional
-mask.  Valid for flow-types ip4, ah4, and esp4.
+mask.  Valid for flow-types ip4, ah4, and esp4 and their IPv6 equivalents.
 .TP
 .BI l4data \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Specify the value of the first 4 Bytes of Layer 4 in the incoming packet to
-match along with an optional mask.  Valid for ip4 flow-type.
+match along with an optional mask.  Valid for ip4 and ip6 flow-types.
 .TP
 .BI vlan\-etype \ N \\fR\ [\\fPm \ N \\fR]\\fP
 Includes the VLAN tag Ethertype and an optional mask.
@@ -779,7 +790,7 @@ Includes 64-bits of user-specific data and an optional mask.
 .BR dst-mac \ \*(MA\ [ m \ \*(MA]
 Includes the destination MAC address, specified as 6 bytes in hexadecimal
 separated by colons, along with an optional mask.
-Valid for all IPv4 based flow-types.
+Valid for all IP based flow-types.
 .TP
 .BI action \ N
 Specifies the Rx queue to send packets to, or some other action.
diff --git a/ethtool.c b/ethtool.c
index b476dcc..a92137f 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4158,13 +4158,15 @@ static const struct option {
  "Configure Rx network flow classification options or rules",
  " rx-flow-hash tcp4|udp4|ah4|esp4|sctp4|"
  "tcp6|udp6|ah6|esp6|sctp6 m|v|t|s|d|f|n|r... |\n"
- " flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4\n"
+ " flow-type ether|ip4|tcp4|udp4|sctp4|ah4|esp4|"
+ "ip6|tcp6|udp6|ah6|esp6|sctp6\n"
  " [ src %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] 
]\n"
  " [ dst %x:%x:%x:%x:%x:%x [m %x:%x:%x:%x:%x:%x] 
]\n"
  " [ proto %d [m %x] ]\n"
  " [ src-ip %d.%d.%d.%d [m %d.%d.%d.%d] ]\n"
  " [ dst-ip %d.%d.%d.%d [m 

[patch net-next RFC 03/13] mlxsw: Move devlink port registration into common core code

2016-03-18 Thread Jiri Pirko
From: Jiri Pirko 

Remove devlink port reg/unreg from spectrum and switchx2 code and rather
do the common work in core. That also ensures code separation where
devlink is only used in core.c.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 22 ++
 drivers/net/ethernet/mellanox/mlxsw/core.h | 19 
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 31 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h |  3 +--
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 30 +
 5 files changed, 64 insertions(+), 41 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
b/drivers/net/ethernet/mellanox/mlxsw/core.c
index f69f628..004fb8b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -1358,6 +1358,28 @@ void mlxsw_core_lag_mapping_clear(struct mlxsw_core 
*mlxsw_core,
 }
 EXPORT_SYMBOL(mlxsw_core_lag_mapping_clear);
 
+int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core,
+struct mlxsw_core_port *mlxsw_core_port, u8 local_port,
+struct net_device *dev, bool split, u32 split_group)
+{
+   struct devlink *devlink = priv_to_devlink(mlxsw_core);
+   struct devlink_port *devlink_port = _core_port->devlink_port;
+
+   if (split)
+   devlink_port_split_set(devlink_port, split_group);
+   devlink_port_type_eth_set(devlink_port, dev);
+   return devlink_port_register(devlink, devlink_port, local_port);
+}
+EXPORT_SYMBOL(mlxsw_core_port_init);
+
+void mlxsw_core_port_fini(struct mlxsw_core_port *mlxsw_core_port)
+{
+   struct devlink_port *devlink_port = _core_port->devlink_port;
+
+   devlink_port_unregister(devlink_port);
+}
+EXPORT_SYMBOL(mlxsw_core_port_fini);
+
 int mlxsw_cmd_exec(struct mlxsw_core *mlxsw_core, u16 opcode, u8 opcode_mod,
   u32 in_mod, bool out_mbox_direct,
   char *in_mbox, size_t in_mbox_size,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h 
b/drivers/net/ethernet/mellanox/mlxsw/core.h
index c73d1c0..cc8fceb 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "trap.h"
 #include "reg.h"
@@ -131,6 +132,24 @@ u8 mlxsw_core_lag_mapping_get(struct mlxsw_core 
*mlxsw_core,
 void mlxsw_core_lag_mapping_clear(struct mlxsw_core *mlxsw_core,
  u16 lag_id, u8 local_port);
 
+struct mlxsw_core_port {
+   struct devlink_port devlink_port;
+};
+
+static inline void *
+mlxsw_core_port_driver_priv(struct mlxsw_core_port *mlxsw_core_port)
+{
+   /* mlxsw_core_port is ensured to be always the first field in driver
+* port structure
+*/
+   return mlxsw_core_port;
+}
+
+int mlxsw_core_port_init(struct mlxsw_core *mlxsw_core,
+struct mlxsw_core_port *mlxsw_core_port, u8 local_port,
+struct net_device *dev, bool split, u32 split_group);
+void mlxsw_core_port_fini(struct mlxsw_core_port *mlxsw_core_port);
+
 #define MLXSW_CONFIG_PROFILE_SWID_COUNT 8
 
 struct mlxsw_swid_config {
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 4afbc3e..22bba32 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -49,7 +49,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -1405,9 +1404,7 @@ mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port 
*mlxsw_sp_port, u8 width)
 static int __mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
  bool split, u8 module, u8 width)
 {
-   struct devlink *devlink = priv_to_devlink(mlxsw_sp->core);
struct mlxsw_sp_port *mlxsw_sp_port;
-   struct devlink_port *devlink_port;
struct net_device *dev;
size_t bytes;
int err;
@@ -1460,16 +1457,6 @@ static int __mlxsw_sp_port_create(struct mlxsw_sp 
*mlxsw_sp, u8 local_port,
 */
dev->hard_header_len += MLXSW_TXHDR_LEN;
 
-   devlink_port = _sp_port->devlink_port;
-   if (mlxsw_sp_port->split)
-   devlink_port_split_set(devlink_port, module);
-   err = devlink_port_register(devlink, devlink_port, local_port);
-   if (err) {
-   dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to register 
devlink port\n",
-   mlxsw_sp_port->local_port);
-   goto err_devlink_port_register;
-   }
-
err = mlxsw_sp_port_system_port_mapping_set(mlxsw_sp_port);
if (err) {
dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set system 
port mapping\n",
@@ -1517,7 +1504,14 @@ static int __mlxsw_sp_port_create(struct mlxsw_sp 
*mlxsw_sp, u8 local_port,
   

[PATCH] net: removes duplicate skb_mark_napi_id() calls.

2016-03-18 Thread Weongyo Jeong
Because napi_gro_receive() function calls skb_mark_napi_id() function,
it doesn't need to set it twice.

Signed-off-by: Weongyo Jeong 
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 --
 drivers/net/ethernet/cisco/enic/enic_main.c   |  7 ---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  7 ---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  3 +--
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c 
b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 82f1913..f6aa24f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1112,11 +1112,12 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct 
bnxt_napi *bnapi, u32 *raw_cons,
rc = -ENOMEM;
if (likely(skb)) {
skb_record_rx_queue(skb, bnapi->index);
-   skb_mark_napi_id(skb, >napi);
-   if (bnxt_busy_polling(bnapi))
+   if (bnxt_busy_polling(bnapi)) {
+   skb_mark_napi_id(skb, >napi);
netif_receive_skb(skb);
-   else
+   } else {
napi_gro_receive(>napi, skb);
+   }
rc = 1;
}
goto next_rx_no_prod;
@@ -1215,11 +1216,12 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct 
bnxt_napi *bnapi, u32 *raw_cons,
}
 
skb_record_rx_queue(skb, bnapi->index);
-   skb_mark_napi_id(skb, >napi);
-   if (bnxt_busy_polling(bnapi))
+   if (bnxt_busy_polling(bnapi)) {
+   skb_mark_napi_id(skb, >napi);
netif_receive_skb(skb);
-   else
+   } else {
napi_gro_receive(>napi, skb);
+   }
rc = 1;
 
 next_rx:
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c 
b/drivers/net/ethernet/cisco/enic/enic_main.c
index b2182d3..1b15323 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1186,12 +1186,13 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
if (vlan_stripped)
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), 
vlan_tci);
 
-   skb_mark_napi_id(skb, >napi[rq->index]);
if (enic_poll_busy_polling(rq) ||
-   !(netdev->features & NETIF_F_GRO))
+   !(netdev->features & NETIF_F_GRO)) {
+   skb_mark_napi_id(skb, >napi[rq->index]);
netif_receive_skb(skb);
-   else
+   } else {
napi_gro_receive(>napi[q_number], skb);
+   }
if (enic->rx_coalesce_setting.use_adaptive_rx_coalesce)
enic_intr_update_pkt_size(>pkt_size_counter,
  bytes_written);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index c4003a8..18067e1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1659,11 +1659,12 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring 
*rx_ring,
 static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
 struct sk_buff *skb)
 {
-   skb_mark_napi_id(skb, _vector->napi);
-   if (ixgbe_qv_busy_polling(q_vector))
+   if (ixgbe_qv_busy_polling(q_vector)) {
+   skb_mark_napi_id(skb, _vector->napi);
netif_receive_skb(skb);
-   else
+   } else {
napi_gro_receive(_vector->napi, skb);
+   }
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c 
b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 3558f01..a2955fd 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -447,9 +447,8 @@ static void ixgbevf_rx_skb(struct ixgbevf_q_vector 
*q_vector,
   struct sk_buff *skb)
 {
 #ifdef CONFIG_NET_RX_BUSY_POLL
-   skb_mark_napi_id(skb, _vector->napi);
-
if (ixgbevf_qv_busy_polling(q_vector)) {
+   skb_mark_napi_id(skb, _vector->napi);
netif_receive_skb(skb);
/* exit early if we busy polled */
return;
-- 
2.1.3



Re: [PATCH net 1/3] ipip: Properly mark ipip GRO packets as encapsulated.

2016-03-18 Thread Eric Dumazet
On Thu, 2016-03-17 at 11:25 -0700, Jesse Gross wrote:
> ipip encapsulated packets can be merged together by GRO but the result
> does not have the proper GSO type set or even marked as being
> encapsulated at all. Later retransmission of these packets will likely
> fail if the device does not support ipip offloads. This is similar to
> the issue resolved in IPv6 sit in feec0cb3
> ("ipv6: gro: support sit protocol").
> 
> Reported-by: Patrick Boutilier 
> Fixes: 9667e9bb ("ipip: Add gro callbacks to ipip offload")
> Signed-off-by: Jesse Gross 
> ---

Acked-by: Eric Dumazet 




[PATCH] openvswitch: reduce padding in struct sw_flow_key

2016-03-18 Thread Arnd Bergmann
It's been a while since the last time sw_flow_key was made smaller in
1139e241ec43 ("openvswitch: Compact sw_flow_key."), and it has seen five
patches adding new members since then.

With the current linux-next kernel and gcc-6.0 on ARM, this has tipped
us slightly over the stack frame warning limit of 1024 bytes:

net/openvswitch/datapath.c: In function 'ovs_flow_cmd_set':
net/openvswitch/datapath.c:1202:1: error: the frame size of 1032 bytes is 
larger than 1024 bytes [-Werror=frame-larger-than=]

This slightly rearranges the members in struct sw_flow_key to minimize
the amount of padding we have between them, bringing us again slightly
below the warning limit (checking all files against 128 bytes limit):

datapath.c: In function 'get_flow_actions.constprop':
datapath.c:1083:1: warning: the frame size of 464 bytes is larger than 128 bytes
datapath.c: In function 'ovs_flow_cmd_new':
datapath.c:1061:1: warning: the frame size of 984 bytes is larger than 128 bytes
datapath.c: In function 'ovs_flow_cmd_del':
datapath.c:1336:1: warning: the frame size of 528 bytes is larger than 128 bytes
datapath.c: In function 'ovs_flow_cmd_get':
datapath.c:1261:1: warning: the frame size of 504 bytes is larger than 128 bytes
datapath.c: In function 'ovs_flow_cmd_set':
datapath.c:1202:1: warning: the frame size of 1016 bytes is larger than 128 
bytes
datapath.c: In function 'queue_gso_packets':
datapath.c:379:1: warning: the frame size of 472 bytes is larger than 128 bytes
flow_table.c: In function 'masked_flow_lookup':
flow_table.c:489:1: warning: the frame size of 488 bytes is larger than 128 
bytes
flow_netlink.c: In function 'validate_and_copy_set_tun':
flow_netlink.c:1994:1: warning: the frame size of 512 bytes is larger than 128 
bytes

This means it's still too large really, we just don't warn about it any more,
and will get the warning again once another member is added. My patch is a
band-aid at best, but more work is needed here. One problem is that
ovs_flow_cmd_new and ovs_flow_cmd_set have two copies of struct sw_flow_key on
the stack, one of them nested within sw_flow_mask. If we could reduce that to
a single instance, the stack usage would be cut in half here.

Signed-off-by: Arnd Bergmann 
Fixes: 00a93babd06a ("openvswitch: add tunnel protocol to sw_flow_key")
Fixes: c2ac66735870 ("openvswitch: Allow matching on conntrack label")
Fixes: 182e3042e15d ("openvswitch: Allow matching on conntrack mark")
Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Fixes: 971427f353f3 ("openvswitch: Add recirc and hash action.")
---
 net/openvswitch/flow.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index 1d055c559eaf..41d15c50a43f 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -63,7 +63,11 @@ struct sw_flow_key {
u32 skb_mark;   /* SKB mark. */
u16 in_port;/* Input switch port (or DP_MAX_PORTS). 
*/
} __packed phy; /* Safe when right after 'tun_key'. */
-   u8 tun_proto;   /* Protocol of encapsulating tunnel. */
+   struct {
+   __be16 src; /* TCP/UDP/SCTP source port. */
+   __be16 dst; /* TCP/UDP/SCTP destination port. */
+   __be16 flags;   /* TCP flags. */
+   } tp;
u32 ovs_flow_hash;  /* Datapath computed hash value.  */
u32 recirc_id;  /* Recirculation ID.  */
struct {
@@ -83,11 +87,6 @@ struct sw_flow_key {
u8 frag;/* One of OVS_FRAG_TYPE_*. */
} ip;
};
-   struct {
-   __be16 src; /* TCP/UDP/SCTP source port. */
-   __be16 dst; /* TCP/UDP/SCTP destination port. */
-   __be16 flags;   /* TCP flags. */
-   } tp;
union {
struct {
struct {
@@ -114,11 +113,12 @@ struct sw_flow_key {
};
struct {
/* Connection tracking fields. */
-   u16 zone;
u32 mark;
+   u16 zone;
u8 state;
struct ovs_key_ct_labels labels;
} ct;
+   u8 tun_proto;   /* Protocol of encapsulating tunnel. */
 
 } __aligned(BITS_PER_LONG/8); /* Ensure that we can do comparisons as longs. */
 
-- 
2.7.0



Re: [RFC v2 -next 1/2] virtio: Start feature MTU support

2016-03-18 Thread Stephen Hemminger
On Tue, 15 Mar 2016 17:04:12 -0400
Aaron Conole  wrote:

> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -55,6 +55,7 @@
>  #define VIRTIO_NET_F_MQ  22  /* Device supports Receive Flow
>* Steering */
>  #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */
> +#define VIRTIO_NET_F_MTU 25  /* Device supports Default MTU Negotiation */
>  
>  #ifndef VIRTIO_NET_NO_LEGACY
>  #define VIRTIO_NET_F_GSO 6   /* Host handles pkts w/ any GSO type */
> @@ -73,6 +74,8 @@ struct virtio_net_config {
>* Legal values are between 1 and 0x8000
>*/
>   __u16 max_virtqueue_pairs;
> + /* Default maximum transmit unit advice */
> + __u16 mtu;
>  } __attribute__((packed));
>  
>  /*

You can't change user visible headers without breaking ABI.
This structure might be used by other user code. Also how can this
work if host is using old size of structure.


Re: [PATCH v6 net-next 0/2] tcp: Redundant Data Bundling (RDB)

2016-03-18 Thread Bendik Rønning Opstad
On 14/03/16 22:59, Yuchung Cheng wrote:
> OK that makes sense.
>
> I left some detailed comments on the actual patches. I would encourage
> to submit an IETF draft to gather feedback from tcpm b/c the feature
> seems portable.

Thank you for the suggestion, we appreciate the confidence. We have
had in mind to eventually pursue a standardization process, but have
been unsure about how a mechanism that actively introduces redundancy
would be received by the IETF. It may now be the right time to propose
the RDB mechanism, and we will aim to present an IEFT draft in the
near future.


Bendik



Re: Micrel Phy - Is there a way to configure the Phy not to do 802.3x flow control?

2016-03-18 Thread Murali Karicheri
On 03/16/2016 11:08 AM, Murali Karicheri wrote:
> On 03/11/2016 02:51 PM, Florian Fainelli wrote:
>> On 11/03/16 10:31, Murali Karicheri wrote:
>>> On 03/10/2016 02:38 PM, Murali Karicheri wrote:
 On 03/10/2016 01:05 PM, Florian Fainelli wrote:
> On 10/03/16 08:48, Murali Karicheri wrote:
>> On 03/03/2016 07:16 PM, Florian Fainelli wrote:
>>> On 03/03/16 14:18, Murali Karicheri wrote:
 Hi,

 We are using Micrel Phy in one of our board and wondering if we can 
 force the
 Phy to disable flow control at start. I have a 1G ethernet switch 
 connected
 to Phy and the phy always enable flow control. I would like to 
 configure the
 phy not to flow control. Is that possible and if yes, what should I do 
 in the
 my Ethernet driver to tell the Phy not to enable flow control?
>>>
>>> The PHY is not doing flow control per-se, your pseudo Ethernet MAC in
>>> the switch is doing, along with the link partner advertising support for
>>> it. You would want to make sure that your PHY device interface (provided
>>> that you are using the PHY library) is not starting with Pause
>>> advertised, but it could be supported.
>>
>> Understood that Phy is just advertise FC. The Micrel phy for 9031 
>> advertise
>> by default FC supported. After negotiation, I see that Phylib provide 
>> the 
>> link status with parameter pause = 1, asym_pause = 1. How do I tell the 
>> Phy not
>> to advertise?
>>
>> I call following sequence in the Ethernet driver.
>>
>> of_phy_connect(x,y,hndlr,a,z);
>
> Here you should be able to change phydev->advertising and
> phydev->supported to mask the ADVERTISED_Pause | ADVERTISED_AsymPause
> bits and have phy_start() restart with that which should disable pause
> and asym_pause as seen by your adjust_link handler.
>
 Ok. Good point. I will try this. Thanks for your suggestion.

>>> I had to make following changes to the phy_device.c to allow the phy device
>>> report maximum common flow control capability to Ethernet driver through
>>> handler. My driver code looks like this.
>>>
>>> slave->phy = of_phy_connect(gbe_intf->ndev,
>>> slave->phy_node,
>>> hndlr, 0,
>>> phy_mode);
>>> if (!slave->phy) {
>>> dev_err(priv->dev, "phy not found on slave %d\n",
>>> slave->slave_num);
>>> return -ENODEV;
>>> }
>>> dev_dbg(priv->dev, "phy found: id is: 0x%s\n",
>>> dev_name(>phy->dev));
>>>
>>> slave->phy->supported &=
>>> ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause);
>>> slave->phy->advertising = slave->phy->supported;
>>> phy_start(slave->phy);
>>> phy_read_status(slave->phy);
>>>
>>> And then in the phy_device.c, I did to get flow control off reported in
>>> handler for link status update.
>>
>>
>>
>>>
>>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>>> index d551df6..55412ad 100644
>>> --- a/drivers/net/phy/phy_device.c
>>> +++ b/drivers/net/phy/phy_device.c
>>> @@ -1021,8 +1021,8 @@ int genphy_read_status(struct phy_device *phydev)
>>> phydev->duplex = DUPLEX_FULL;
>>>  
>>> if (phydev->duplex == DUPLEX_FULL) {
>>> -   phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
>>> -   phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
>>> +   phydev->pause = adv & lpa & LPA_PAUSE_CAP ? 1 : 0;
>>> +   phydev->asym_pause = adv & lpa & LPA_PAUSE_ASYM ? 1 
>>> : 0;
>>
>> What it means before your patch is that flow control is reported to the
>> PHY device if the link partner advertises that, with your patch applied,
>> it is reported only if the link partner and yourself advertise flow control.
>>
>> You seem to be willing to have phydev->pause and phydev->asym_pause
>> reflect the resolved pause capability, as opposed to the link partner's
>> pause capability, which I am not convinced is correct here, because we
>> need to take into account the user-configured pause configuration as
>> well. Your adjust_link function should be the one deciding whether pause
>> frame advertising and enabling is appropriate based on: locally
>> configured pause settings (enabled, disabled, autoneg) and the link
>> partner's pause capability.
>>
>> I do agree that the two fields are confusing and poorly documented, and
>> we should probably be consolidating the pause frame behavior in PHYLIB
>> as opposed to letting drivers deal with like e.g: gianfar, bcm63xx_enet,
>> tg3 etc.
>>
>>>  
>>> Could you 

Re: linux-next: manual merge of the rdma tree with the net-next tree

2016-03-18 Thread Linus Torvalds
On Wed, Mar 16, 2016 at 1:52 PM, Stephen Rothwell  wrote:
>
> How about "This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may want also want to
> consider cooperate with the maintainer of the conflicting tree to
> minimise any particularly complex conflicts."

Yup, sounds fine.

Maybe you could even say "don't merge this to hide the problem",
because that has been another reaction in the past, but the above
already sounds pretty good.

Linus


Re: [PATCH v2] netfilter: fix race condition in ipset save, swap and delete

2016-03-18 Thread Jozsef Kadlecsik
Hi,

On Mon, 14 Mar 2016, Vishwanath Pai wrote:

> I have updated the patch according to comments by Jozsef. Renamed
> ref_kernel to ref_netlink, renamed _put/_get functions and updated the
> description in commit log.

Patch is applied to the ipset git tree - you use some older kernel tree 
and I had to apply it manually. I'll send the patch for kernel inclusion.

Best regards,
Jozsef

> --
> 
> netfilter: fix race condition in ipset save, swap and delete
> 
> This fix adds a new reference counter (ref_netlink) for the struct ip_set.
> The other reference counter (ref) can be swapped out by ip_set_swap and we
> need a separate counter to keep track of references for netlink events
> like dump. Using the same ref counter for dump causes a race condition
> which can be demonstrated by the following script:
> 
> #!/bin/sh
> ipset create hash_ip1 hash:ip family inet hashsize 1024 maxelem 50 \
> counters
> ipset create hash_ip2 hash:ip family inet hashsize 30 maxelem 50 \
> counters
> ipset create hash_ip3 hash:ip family inet hashsize 1024 maxelem 50 \
> counters
> 
> ipset save &
> 
> ipset swap hash_ip3 hash_ip2
> ipset destroy hash_ip3 /* will crash the machine */
> 
> Swap will exchange the values of ref so destroy will see ref = 0 instead of
> ref = 1. With this fix in place swap will not succeed because ipset save
> still has ref_netlink on the set (ip_set_swap doesn't swap ref_netlink).
> 
> Both delete and swap will error out if ref_netlink != 0 on the set.
> 
> Note: The changes to *_head functions is because previously we would
> increment ref whenever we called these functions, we don't do that
> anymore.
> 
> Reviewed-by: Joshua Hunt 
> Signed-off-by: Vishwanath Pai 
> 
> --
> 
> diff --git a/include/linux/netfilter/ipset/ip_set.h 
> b/include/linux/netfilter/ipset/ip_set.h
> index 0e1f433..f48b8a6 100644
> --- a/include/linux/netfilter/ipset/ip_set.h
> +++ b/include/linux/netfilter/ipset/ip_set.h
> @@ -234,6 +234,10 @@ struct ip_set {
>   spinlock_t lock;
>   /* References to the set */
>   u32 ref;
> + /* References to the set for netlink events like dump,
> +  * ref can be swapped out by ip_set_swap
> +  */
> + u32 ref_netlink;
>   /* The core set type */
>   struct ip_set_type *type;
>   /* The type variant doing the real job */
> diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h 
> b/net/netfilter/ipset/ip_set_bitmap_gen.h
> index b0bc475..2e8e7e5 100644
> --- a/net/netfilter/ipset/ip_set_bitmap_gen.h
> +++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
> @@ -95,7 +95,7 @@ mtype_head(struct ip_set *set, struct sk_buff *skb)
>   if (!nested)
>   goto nla_put_failure;
>   if (mtype_do_head(skb, map) ||
> - nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
> + nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref)) ||
>   nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)))
>   goto nla_put_failure;
>   if (unlikely(ip_set_put_flags(skb, set)))
> diff --git a/net/netfilter/ipset/ip_set_core.c 
> b/net/netfilter/ipset/ip_set_core.c
> index 95db43f..a558075 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -497,6 +497,26 @@ __ip_set_put(struct ip_set *set)
>   write_unlock_bh(_set_ref_lock);
>  }
>  
> +/* set->ref can be swapped out by ip_set_swap, netlink events (like dump) 
> need
> + * a separate reference counter
> + */
> +static inline void
> +__ip_set_get_netlink(struct ip_set *set)
> +{
> + write_lock_bh(_set_ref_lock);
> + set->ref_netlink++;
> + write_unlock_bh(_set_ref_lock);
> +}
> +
> +static inline void
> +__ip_set_put_netlink(struct ip_set *set)
> +{
> + write_lock_bh(_set_ref_lock);
> + BUG_ON(set->ref_netlink == 0);
> + set->ref_netlink--;
> + write_unlock_bh(_set_ref_lock);
> +}
> +
>  /* Add, del and test set entries from kernel.
>   *
>   * The set behind the index must exist and must be referenced
> @@ -999,7 +1019,7 @@ static int ip_set_destroy(struct net *net, struct sock 
> *ctnl,
>   if (!attr[IPSET_ATTR_SETNAME]) {
>   for (i = 0; i < inst->ip_set_max; i++) {
>   s = ip_set(inst, i);
> - if (s && s->ref) {
> + if (s && (s->ref || s->ref_netlink)) {
>   ret = -IPSET_ERR_BUSY;
>   goto out;
>   }
> @@ -1021,7 +1041,7 @@ static int ip_set_destroy(struct net *net, struct sock 
> *ctnl,
>   if (!s) {
>   ret = -ENOENT;
>   goto out;
> - } else if (s->ref) {
> + } else if (s->ref || s->ref_netlink) {
>   ret = -IPSET_ERR_BUSY;
>   goto out;
>   }
> @@ -1168,6 +1188,9 @@ static int ip_set_swap(struct net *net, struct sock 
> *ctnl, struct sk_buff *skb,
>  

Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2016-03-18 Thread Murali Karicheri
David,

On 08/18/2015 04:47 PM, David Miller wrote:
> I see some drivers where the foo_debugfs.c file is larger than the rest
> of the driver.  Once people start using it, it's like crack, and they
> dump every single debugging widget they found useful at some point into
> there.
> 
> This is not what we want.  Most things I see in debugfs support was
> probably useful for debugging one particular bug but then it was never
> really useful again in the future.  Those kinds of things can be done
> locally in someone's tree.
> 
> I often see various kinds of "statistics" ending up in these things,
> or register dumps, both of which are 'ethtool' or similar material.
Very late to this discussion, but I need to port some of the internal code
to display the content of a ALE (Address Learning Engine) table maintained
in hardwareat L2 layer. Currently I have a sysfs implementation that dumps
information like below.

root@k2e-evm:~# cat /sys/devices/platform/soc/2620110.netcp/ale_table
index 0, raw: 07fc d000 , type: addr(1), addr: 
ff:ff:ff:ff:ff:ff, mcstate: f(3), port mask: 1ff, no super
index 1, raw:  1800 28329a1c, type: addr(1), addr: 
08:00:28:32:9a:1c, uctype: persistent(0), port: 0
index 2, raw: 07fc d100 5e01, type: addr(1), addr: 
01:00:5e:00:00:01, mcstate: f(3), port mask: 1ff, no super
index 19, raw: 0004 d000d4be d93db6c1, type: addr(1), addr: 
d4:be:d9:3d:b6:c1, uctype: touched(3), port: 1

What is the available interface in kernel to expose this information
to user space as debugfs is not suggested based on this thread?

-- 
Murali Karicheri
Linux Kernel, Keystone


[iproute PATCH 0/8] Follow-up to my action man pages series

2016-03-18 Thread Phil Sutter
The following patch series aims at addressing feedback provided by Jamal
and Alexei. Thanks a lot for your input!

Phil Sutter (8):
  doc/tc-filters.tex: Drop overly subjective paragraphs
  tc: connmark, pedit: Rename BRANCH to CONTROL
  man: tc-csum.8: Add an example
  man: tc-mirred.8: Reword man page a bit, add generic mirror example
  man: tc-police.8: Emphasize on the two rate control mechanisms
  man: tc-skbedit.8: Elaborate a bit on TX queues
  tc/m_vlan.c: mention CONTROL option in help text
  man: tc-vlan.8: Describe CONTROL option

 doc/tc-filters.tex | 23 -
 man/man8/tc-connmark.8 |  6 +++---
 man/man8/tc-csum.8 | 15 ++
 man/man8/tc-mirred.8   | 26 ---
 man/man8/tc-pedit.8|  6 +++---
 man/man8/tc-police.8   | 29 ++
 man/man8/tc-skbedit.8  | 14 +
 man/man8/tc-vlan.8 | 56 +-
 tc/m_connmark.c|  4 ++--
 tc/m_pedit.c   |  4 ++--
 tc/m_vlan.c|  3 ++-
 11 files changed, 144 insertions(+), 42 deletions(-)

-- 
2.7.2



Re: [PATCH] sctp: align MTU to a word

2016-03-18 Thread Eric Dumazet
On Fri, 2016-03-18 at 18:39 -0300, Marcelo Ricardo Leitner wrote:

> - transport->pathmtu = dst_mtu(transport->dst);
> + transport->pathmtu = dst_mtu(transport->dst) & ~3;


Well, surely a helper doing this would be better than spreading & ~3 all
over the places ;)





Re: [RFC PATCH 6/9] ethtool: Add support for toggling any of the GSO offloads

2016-03-18 Thread Ben Hutchings
On Fri, 2016-03-18 at 17:30 -0700, Alexander Duyck wrote:
> On Fri, Mar 18, 2016 at 5:18 PM, Ben Hutchings  wrote:
> > 
> > On Fri, 2016-03-18 at 16:25 -0700, Alexander Duyck wrote:
> > 
> > > 
> > > The strings were missing for several of the GSO offloads that are
> > > available.  This patch provides the missing strings so that we can toggle
> > > or query any of them via the ethtool command.
> > > 
> > > Signed-off-by: Alexander Duyck 
> > > ---
> > >  net/core/ethtool.c |3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> > > index 2966cd0d7c93..b3c39d531469 100644
> > > --- a/net/core/ethtool.c
> > > +++ b/net/core/ethtool.c
> > > @@ -82,9 +82,12 @@ static const char 
> > > netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
> > >   [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
> > >   [NETIF_F_FSO_BIT] =  "tx-fcoe-segmentation",
> > >   [NETIF_F_GSO_GRE_BIT] =  "tx-gre-segmentation",
> > > + [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation",
> > All of the existing checksum offload names include the word "checksum"
> > in full, so I think the new names should do the same.
> It isn't a checksum offload though, it is a segmentation offload for a
> tunnel that has an outer checksum.  I was hoping to avoid using the
> word checksum as that might make it confusing as it is a segmentation
> offload, not a checksum offload.

Yes, but my point is that we haven't used the abbreviation "csum".

> > > 
> > >   [NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
> > >   [NETIF_F_GSO_SIT_BIT] =  "tx-sit-segmentation",
> > >   [NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
> > > + [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
> > > + [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-remcsum-segmentation",
> > I think this should be "tx-tunnel-remote-checksum-segmentation", though
> > that is getting quite unwieldy.
> Right.  As it is I think we might be coming up on the 32 character
> limit for the strings.  Replacing csum with checksum would probably
> push us over.

Right, I wasn't even thinking about the static limit!  That does weigh
rather heavily in favour of abbreviation here.

Please do at least hyphenate "remcsum" though.

Ben.

-- 
Ben Hutchings
To err is human; to really foul things up requires a computer.

signature.asc
Description: This is a digitally signed message part


Re: [PATCH] ipv6: Fix the pmtu path for connected UDP socket

2016-03-18 Thread Cong Wang
On Fri, Mar 18, 2016 at 2:26 PM, Wei Wang  wrote:
> I don't think ip6_sk_update_pmtu() is a good place to put it as all it
> does is to call ip6_update_pmtu(). And ip6_update_pmtu() does the
> route lookup and call __ip6_rt_update_pmtu.
> We can put it in ip6_update_pmtu(). But that still means we need to
> pass sk to ip6_update_pmtu() and I don't think it makes any difference
> compared to the current fix.
>

Well, your patch touches all the callers of ip6_update_pmtu() , if you just
fix ip6_sk_update_pmtu() as I suggested, you only need to change one
function, ideally. And the ipv4 code is there, although I am not sure, it
looks like we can just mimic the logic here:

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ed44663..b88c2ff 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1417,8 +1417,28 @@ EXPORT_SYMBOL_GPL(ip6_update_pmtu);

 void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
 {
-   ip6_update_pmtu(skb, sock_net(sk), mtu,
-   sk->sk_bound_dev_if, sk->sk_mark);
+   const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
+   struct net *net = sock_net(sk);
+   struct dst_entry *dst;
+   struct flowi6 fl6;
+
+   bh_lock_sock(sk);
+
+   memset(, 0, sizeof(fl6));
+   fl6.flowi6_oif = sk->sk_bound_dev_if;
+   fl6.flowi6_mark = sk->sk_mark ? : IP6_REPLY_MARK(net, skb->mark);
+   fl6.daddr = iph->daddr;
+   fl6.saddr = iph->saddr;
+   fl6.flowlabel = ip6_flowinfo(iph);
+
+   dst = ip6_route_output(net, NULL, );
+   if (!dst->error)
+   __ip6_rt_update_pmtu(dst, NULL, iph, ntohl(mtu));
+
+   sk_dst_set(sk, >dst);
+   bh_unlock_sock(sk);
+
+   dst_release(dst);
 }


Please don't judge me on the code, it could still miss a lot of things,
but it can show my idea...


Re: [net-next] net: fix a comment typo

2016-03-18 Thread David Miller
From: Zhang Shengju 
Date: Wed, 16 Mar 2016 09:12:46 +

> Fix a comment typo.
> 
> Signed-off-by: Zhang Shengju 

Applied.


Re: [RFC PATCH 6/9] ethtool: Add support for toggling any of the GSO offloads

2016-03-18 Thread Ben Hutchings
On Fri, 2016-03-18 at 16:25 -0700, Alexander Duyck wrote:

> The strings were missing for several of the GSO offloads that are
> available.  This patch provides the missing strings so that we can toggle
> or query any of them via the ethtool command.
> 
> Signed-off-by: Alexander Duyck 
> ---
>  net/core/ethtool.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 2966cd0d7c93..b3c39d531469 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -82,9 +82,12 @@ static const char 
> netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
>   [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
>   [NETIF_F_FSO_BIT] =  "tx-fcoe-segmentation",
>   [NETIF_F_GSO_GRE_BIT] =  "tx-gre-segmentation",
> + [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation",

All of the existing checksum offload names include the word "checksum"
in full, so I think the new names should do the same.

>   [NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
>   [NETIF_F_GSO_SIT_BIT] =  "tx-sit-segmentation",
>   [NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
> + [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
> + [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-remcsum-segmentation",

I think this should be "tx-tunnel-remote-checksum-segmentation", though
that is getting quite unwieldy.

Ben.

>   [NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc",
>   [NETIF_F_SCTP_CRC_BIT] ="tx-checksum-sctp",
> 
-- 
Ben Hutchings
To err is human; to really foul things up requires a computer.

signature.asc
Description: This is a digitally signed message part


Re: [PATCH net-next] cls_bpf: reset class and reuse major in da

2016-03-18 Thread David Miller
From: Daniel Borkmann 
Date: Tue, 15 Mar 2016 22:41:22 +0100

> There are two issues with the current code. First one is that we need
> to set res->class to 0 in case we use non-default classid matching.
> 
> This is important for the case where cls_bpf was initially set up with
> an optional binding to a default class with tcf_bind_filter(), where
> the underlying qdisc implements bind_tcf() that fills res->class and
> tests for it later on when doing the classification. Convention for
> these cases is that after tc_classify() was called, such qdiscs (atm,
> drr, qfq, cbq, hfsc, htb) first test class, and if 0, then they lookup
> based on classid.
> 
> Second, there's a bug with da mode, where res->classid is only assigned
> a 16 bit minor, but it needs to expand to the full 32 bit major/minor
> combination instead, therefore we need to expand with the bound major.
> This is fine as classes belonging to a classful qdisc must share the
> same major.
> 
> Fixes: 045efa82ff56 ("cls_bpf: introduce integrated actions")
> Signed-off-by: Daniel Borkmann 
> Acked-by: Alexei Starovoitov 

Applied, thanks Daniel.


Re: [PATCH] netdev: Move octeon/octeon_mgmt driver to cavium directory.

2016-03-18 Thread David Miller
From: David Daney 
Date: Mon, 14 Mar 2016 17:57:08 -0700

> From: David Daney 
> 
> No code changes.  Since OCTEON is a Cavium product, move the driver to
> the vendor directory to unclutter things a bit.
> 
> Signed-off-by: David Daney 

Applied, thanks.


Re: [patch 2/2 net-next] mediatek: unlock on error in mtk_tx_map()

2016-03-18 Thread David Miller
From: Dan Carpenter 
Date: Tue, 15 Mar 2016 10:19:04 +0300

> There was a missing unlock on the error path.
> 
> Fixes: 656e705243fd ('net-next: mediatek: add support for MT7623 ethernet')
> Signed-off-by: Dan Carpenter 

Applied.


Re: [PATCH net-next v2 0/4] ldmvsw: Add ldmvsw driver

2016-03-18 Thread David Miller
From: Aaron Young 
Date: Tue, 15 Mar 2016 11:35:36 -0700

> This series adds a new Logical Domains vSwitch (ldmvsw) driver.

Series applied, thanks Aaron.


[RFC PATCH 9/9] ixgbe/ixgbevf: Add support for GSO partial

2016-03-18 Thread Alexander Duyck
This patch adds support for partial GSO segmentation in the case of GRE or
UDP encapsulated frames.

The one bit in this patch that is a bit controversial is the fact that we
are leaving the inner IPv4 IP ID as a static value in the case of
segmentation.  As per RFC6864 this should be acceptable as TCP frames set
the DF bit so the IP ID should be ignored.  However this is not always the
case as header compression schemes for PPP and SLIP can end up taking a
performance hit as they have to record the fact that the ID didn't change
as expected.

In addition GRO was examining the IP ID field as well.  As such on older
GRO implementations TSO frames from this driver may end up blocking GRO on
the other end which will likely hurt performance instead of helping it.

Signed-off-by: Alexander Duyck 
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   72 +---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   77 ++---
 2 files changed, 99 insertions(+), 50 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 59b43ce200be..bef69306fb65 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7178,9 +7178,18 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
 struct ixgbe_tx_buffer *first,
 u8 *hdr_len)
 {
+   u32 vlan_macip_lens, type_tucmd, mss_l4len_idx;
struct sk_buff *skb = first->skb;
-   u32 vlan_macip_lens, type_tucmd;
-   u32 mss_l4len_idx, l4len;
+   union {
+   struct iphdr *v4;
+   struct ipv6hdr *v6;
+   unsigned char *hdr;
+   } ip;
+   union {
+   struct tcphdr *tcp;
+   unsigned char *hdr;
+   } l4;
+   u32 paylen, l4_offset;
int err;
 
if (skb->ip_summed != CHECKSUM_PARTIAL)
@@ -7193,46 +7202,52 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,
if (err < 0)
return err;
 
+   ip.hdr = skb_network_header(skb);
+   l4.hdr = skb_checksum_start(skb);
+
/* ADV DTYP TUCMD MKRLOC/ISCSIHEDLEN */
type_tucmd = IXGBE_ADVTXD_TUCMD_L4T_TCP;
 
-   if (first->protocol == htons(ETH_P_IP)) {
-   struct iphdr *iph = ip_hdr(skb);
-   iph->tot_len = 0;
-   iph->check = 0;
-   tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
-iph->daddr, 0,
-IPPROTO_TCP,
-0);
+   /* initialize outer IP header fields */
+   if (ip.v4->version == 4) {
+   /* IP header will have to cancel out any data that
+* is not a part of the outer IP header
+*/
+   ip.v4->check = csum_fold(csum_add(lco_csum(skb),
+ csum_unfold(l4.tcp->check)));
type_tucmd |= IXGBE_ADVTXD_TUCMD_IPV4;
+
+   ip.v4->tot_len = 0;
first->tx_flags |= IXGBE_TX_FLAGS_TSO |
   IXGBE_TX_FLAGS_CSUM |
   IXGBE_TX_FLAGS_IPV4;
-   } else if (skb_is_gso_v6(skb)) {
-   ipv6_hdr(skb)->payload_len = 0;
-   tcp_hdr(skb)->check =
-   ~csum_ipv6_magic(_hdr(skb)->saddr,
-_hdr(skb)->daddr,
-0, IPPROTO_TCP, 0);
+   } else {
+   ip.v6->payload_len = 0;
first->tx_flags |= IXGBE_TX_FLAGS_TSO |
   IXGBE_TX_FLAGS_CSUM;
}
 
-   /* compute header lengths */
-   l4len = tcp_hdrlen(skb);
-   *hdr_len = skb_transport_offset(skb) + l4len;
+   /* determine offset of inner transport header */
+   l4_offset = l4.hdr - skb->data;
+
+   /* compute length of segmentation header */
+   *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+
+   /* remove payload length from inner checksum */
+   paylen = skb->len - l4_offset;
+   csum_replace_by_diff(>check, htonl(paylen));
 
/* update gso size and bytecount with header size */
first->gso_segs = skb_shinfo(skb)->gso_segs;
first->bytecount += (first->gso_segs - 1) * *hdr_len;
 
/* mss_l4len_id: use 0 as index for TSO */
-   mss_l4len_idx = l4len << IXGBE_ADVTXD_L4LEN_SHIFT;
+   mss_l4len_idx = (*hdr_len - l4_offset) << IXGBE_ADVTXD_L4LEN_SHIFT;
mss_l4len_idx |= skb_shinfo(skb)->gso_size << IXGBE_ADVTXD_MSS_SHIFT;
 
/* vlan_macip_lens: HEADLEN, MACLEN, VLAN tag */
-   vlan_macip_lens = skb_network_header_len(skb);
-   vlan_macip_lens |= skb_network_offset(skb) << IXGBE_ADVTXD_MACLEN_SHIFT;
+   vlan_macip_lens = l4.hdr - ip.hdr;
+   vlan_macip_lens 

[RFC PATCH 6/9] ethtool: Add support for toggling any of the GSO offloads

2016-03-18 Thread Alexander Duyck
The strings were missing for several of the GSO offloads that are
available.  This patch provides the missing strings so that we can toggle
or query any of them via the ethtool command.

Signed-off-by: Alexander Duyck 
---
 net/core/ethtool.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2966cd0d7c93..b3c39d531469 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -82,9 +82,12 @@ static const char 
netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
[NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
[NETIF_F_FSO_BIT] =  "tx-fcoe-segmentation",
[NETIF_F_GSO_GRE_BIT] =  "tx-gre-segmentation",
+   [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation",
[NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
[NETIF_F_GSO_SIT_BIT] =  "tx-sit-segmentation",
[NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
+   [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
+   [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-remcsum-segmentation",
 
[NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc",
[NETIF_F_SCTP_CRC_BIT] ="tx-checksum-sctp",



[RFC PATCH 8/9] i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM

2016-03-18 Thread Alexander Duyck
This patch makes it so that i40e and i40evf can use GSO_PARTIAL to support
segmentation for frames with checksums enabled in outer headers.  As a
result we can now send data over these types of tunnels at over 20Gb/s
versus the 12Gb/s that was previously possible on my system.

The advantage with the i40e parts is that this offload is mostly
transparent as the hardware still deals with the inner and/or outer IPv4
headers so the IP ID is still incrementing for both when this offload is
performed.

Signed-off-by: Alexander Duyck 
---
 drivers/net/ethernet/intel/i40e/i40e_main.c |8 +++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c |   14 +++---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c   |   14 +++---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c |8 +++-
 4 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 39b0009253c2..ac3964a9f5c0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -9050,6 +9050,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
   NETIF_F_TSO6|
   NETIF_F_TSO_ECN |
   NETIF_F_GSO_GRE |
+  NETIF_F_GSO_GRE_CSUM|
   NETIF_F_GSO_UDP_TUNNEL  |
   NETIF_F_GSO_UDP_TUNNEL_CSUM |
   0;
@@ -9074,7 +9075,12 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
netdev->features |= NETIF_F_NTUPLE;
if (pf->flags & I40E_FLAG_OUTER_UDP_CSUM_CAPABLE)
-   netdev->features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
+   netdev->features = NETIF_F_GSO_UDP_TUNNEL_CSUM;
+   else
+   netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM;
+
+   netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
+   netdev->features |= NETIF_F_GSO_PARTIAL | netdev->gso_partial_features;
 
/* copy netdev features into list of user selectable features */
netdev->hw_features |= netdev->features;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c 
b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 5d5fa5359a1d..50aa76d7f92e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2297,9 +2297,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct 
sk_buff *skb,
ip.v6->payload_len = 0;
}
 
-   if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL | SKB_GSO_GRE |
+   if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+SKB_GSO_GRE_CSUM |
+SKB_GSO_UDP_TUNNEL |
 SKB_GSO_UDP_TUNNEL_CSUM)) {
-   if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) {
+   if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL |
+SKB_GSO_UDP_TUNNEL_CSUM))
+   l4.udp->len = 0;
+
+   if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
+   (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) {
/* determine offset of outer transport header */
l4_offset = l4.hdr - skb->data;
 
@@ -2470,7 +2477,8 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 
*tx_flags,
 
/* indicate if we need to offload outer UDP header */
if ((*tx_flags & I40E_TX_FLAGS_TSO) &&
-   (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
+   (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) &&
+   !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL))
tunnel |= I40E_TXD_CTX_QW0_L4T_CS_MASK;
 
/* record tunnel offload values */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c 
b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 04aabc52ba0d..1bb7c3efa36c 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1564,9 +1564,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct 
sk_buff *skb,
ip.v6->payload_len = 0;
}
 
-   if (skb_shinfo(skb)->gso_type & (SKB_GSO_UDP_TUNNEL | SKB_GSO_GRE |
+   if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+SKB_GSO_GRE_CSUM |
+SKB_GSO_UDP_TUNNEL |
 SKB_GSO_UDP_TUNNEL_CSUM)) {
-   if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM) {
+   if (skb_shinfo(skb)->gso_type & 

Re: [PATCH 1/1] net: stmmac: Don't search for phys if mdio node is defined.

2016-03-18 Thread David Miller
From: Phil Reid 
Date: Tue, 15 Mar 2016 15:34:33 +0800

> If a dt mdio entry has been added least assume that we wont
> search for phys attached. The DT and of_mdiobus_register already do
> this. This stops DSA phys being found and phys created for them, as
> this is handled by the DSA driver.
> 
> Signed-off-by: Phil Reid 

Applied.


Re: [PATCH net] ravb: fix result value overwrite

2016-03-18 Thread David Miller
From: Yoshihiro Kaneko 
Date: Wed, 16 Mar 2016 00:52:16 +0900

> The result value is overwritten by a return value of
> ravb_ptp_interrupt().
> 
> Signed-off-by: Yoshihiro Kaneko 

Applied.


Re: [PATCH] sctp: align MTU to a word

2016-03-18 Thread Marcelo Ricardo Leitner
On Fri, Mar 18, 2016 at 03:09:34PM -0700, Eric Dumazet wrote:
> On Fri, 2016-03-18 at 18:39 -0300, Marcelo Ricardo Leitner wrote:
> 
> > -   transport->pathmtu = dst_mtu(transport->dst);
> > +   transport->pathmtu = dst_mtu(transport->dst) & ~3;
> 
> 
> Well, surely a helper doing this would be better than spreading & ~3 all
> over the places ;)

Heh.. agreed
for this and the other patch too, will post a v2
Thanks



Re: [RFC PATCH 6/9] ethtool: Add support for toggling any of the GSO offloads

2016-03-18 Thread Alexander Duyck
On Fri, Mar 18, 2016 at 7:01 PM, Jesse Gross  wrote:
> On Fri, Mar 18, 2016 at 6:42 PM, Ben Hutchings  wrote:
>> On Fri, 2016-03-18 at 17:30 -0700, Alexander Duyck wrote:
>>> On Fri, Mar 18, 2016 at 5:18 PM, Ben Hutchings  wrote:
>>> > On Fri, 2016-03-18 at 16:25 -0700, Alexander Duyck wrote:
>>> > >   [NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
>>> > >   [NETIF_F_GSO_SIT_BIT] =  "tx-sit-segmentation",
>>> > >   [NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
>>> > > + [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = 
>>> > > "tx-udp_tnl-csum-segmentation",
>>> > > + [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-remcsum-segmentation",
>>> > I think this should be "tx-tunnel-remote-checksum-segmentation", though
>>> > that is getting quite unwieldy.
>>> Right.  As it is I think we might be coming up on the 32 character
>>> limit for the strings.  Replacing csum with checksum would probably
>>> push us over.
>>
>> Right, I wasn't even thinking about the static limit!  That does weigh
>> rather heavily in favour of abbreviation here.
>>
>> Please do at least hyphenate "remcsum" though.
>
> I think that remote checksum offload is just a purely internal feature
> - that is no device will ever expose support for it, since it is
> explicitly to work around lack of hardware support. As a result, I
> don't know if it makes sense to show it through ethtool at all.

That's true.  I can probably drop that.  The two I cared about where
the GRE and UDP bits anyway.

- Alex


Re: [patch 1/2 net-next] mediatek: checking for IS_ERR() instead of NULL

2016-03-18 Thread David Miller
From: Dan Carpenter 
Date: Tue, 15 Mar 2016 10:18:49 +0300

> of_phy_connect() returns NULL on error, it never returns error pointers.
> 
> Fixes: 656e705243fd ('net-next: mediatek: add support for MT7623 ethernet')
> Signed-off-by: Dan Carpenter 

Applied.


Re: [PATCH net] vlan: propagate gso_max_segs

2016-03-18 Thread Eric Dumazet
On Wed, 2016-03-16 at 21:59 -0700, Eric Dumazet wrote:
> From: Eric Dumazet 
> 
> vlan drivers lack proper propagation of gso_max_segs from
> lower device.
> 

BTW, I suspect bridge code needs an update too.

This might be the time to add IFLA_MAX_GSO_SEGS and IFLA_MAX_GSO_SIZE to
help debugging these issues with "ip link show"





Re: [PATCH 0/5] net: macb: Checkpatch cleanups

2016-03-18 Thread Nicolas Ferre
Le 13/03/2016 20:10, Moritz Fischer a écrit :
> Hi all,
> 
> I backed out the variable scope changes and made a separate
> patch for the ether_addr_copy change.
> 
> Changes from v1:

As it's v2, it's better to add it in each subject of the patch series like:
"[PATCH v2 0/5] net: macb: Checkpatch cleanups"


> * Backed out variable scope changes
> * Separated out ether_addr_copy into it's own commit
> * Fixed typo in comments as suggested by Joe
> 
> Cheers,
> 
> Moritz
> 
> Moritz Fischer (5):
>   net: macb: Fix coding style error message
>   net: macb: Fix coding style warnings
>   net: macb: Address checkpatch 'check' suggestions
>   net: macb: Use ether_addr_copy over memcpy
>   net: macb: Fix simple typo.
> 
>  drivers/net/ethernet/cadence/macb.c | 153 
> +---
>  1 file changed, 70 insertions(+), 83 deletions(-)
> 


-- 
Nicolas Ferre


RE: [PATCH] iwlwifi: dvm: convert create_singlethread_workqueue() to alloc_workqueue()

2016-03-18 Thread Grumbach, Emmanuel
> Hello,
> 
> On Thu, Mar 17, 2016 at 01:43:22PM +0100, Johannes Berg wrote:
> > On Thu, 2016-03-17 at 20:37 +0800, Eva Rachel Retuya wrote:
> > > Use alloc_workqueue() to allocate the workqueue instead of
> > > create_singlethread_workqueue() since the latter is deprecated and
> > > is scheduled for removal.
> >
> > Scheduled where?
> 
> They've been deprecated for years now.  I should note that in the header.
> 
> > >  static void iwl_setup_deferred_work(struct iwl_priv *priv)
> > >  {
> > > - priv->workqueue = create_singlethread_workqueue(DRV_NAME);
> > > + priv->workqueue = alloc_workqueue(DRV_NAME, WQ_HIGHPRI |
> > > WQ_UNBOUND |
> > > +   WQ_MEM_RECLAIM, 1);
> >
> > Seems like you should use alloc_ordered_workqueue() though? That also
> > gets you UNBOUND immediately, and the "1".
> 
> Right, this one should have been alloc_ordered_workqueue().
> 
> > I'm not really sure HIGHPRI is needed either.
> 
> So, no WQ_MEM_RECLAIM either then, I suppose?  What are the latency
> requirements here - what happens if a thermal management work gets
> delayed?
> 

This worker is not supposed to free memory, so no WQ_MEM_RECLAIM needed. The 
latency is not critical.



Re: [PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-18 Thread Vineet Gupta
On Thursday 17 March 2016 05:08 PM, Alexey Brodkin wrote:
> Hi Sergei,
>
> On Thu, 2016-03-17 at 13:58 +0300, Sergei Shtylyov wrote:
>> On 3/17/2016 12:41 PM, Alexey Brodkin wrote:
>>
>>> Following commit broke DW GMAC functionality on AXS10x boards:
>>> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763
>> Note that scripts/checkpatch.pl now enforces certain format for citing 
>> commits: commit <12-digit SHA1> ("").
> Frankly I haven't run that patch through checkpatch due to patch
> simplicity.
>
> But I'll try to not do any assumptions from now on and will try to
> use checkpatch for each and every thing I send :)
>
> Thanks for spotting all his!
>
> -Alexey

Sergei, do you mind providing a Ack/Reviewed-by on the patch below

>
>From 67216d835d8c2a5748ba1631c8bfc19da4fb87fa Mon Sep 17 00:00:00 2001
From: Alexey Brodkin 
Date: Thu, 17 Mar 2016 12:41:52 +0300
Subject: [PATCH] ARC: axs10x - add Ethernet PHY description in .dts

Commit e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac
driver") broke DW GMAC functionality on ARC AXS10x boards:

That's what happens on eth0 up:
  --->8
| libphy: PHY stmmac-0: not found
| eth0: Could not attach to PHY
| stmmac_open: Cannot attach to PHY (error: -19)
  --->8

Simplest solution is to add PHY description in board's .dts.
And so we do here.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Phil Reid 
Cc: David S. Miller 
Cc: linux-ker...@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: sta...@vger.kernel.org # 4.5
Cc: Sergei Shtylyov 
Signed-off-by: Vineet Gupta 
---
 arch/arc/boot/dts/axs10x_mb.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c10732..ab5d5701e11d 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -47,6 +47,14 @@
 clocks = <>;
 clock-names = "stmmaceth";
 max-speed = <100>;
+mdio0 {
+#address-cells = <1>;
+#size-cells = <0>;
+compatible = "snps,dwmac-mdio";
+phy1: ethernet-phy@1 {
+reg = <1>;
+};
+};
 };
 
 ehci@0x4 {
-- 
2.5.0



Re: [RFC PATCH kernel] Revert "net/mlx4_core: Set UAR page size to 4KB regardless of system page size"

2016-03-18 Thread Alexey Kardashevskiy

On 03/16/2016 08:45 PM, Or Gerlitz wrote:

On Wed, Mar 16, 2016 at 10:34 AM, Alexey Kardashevskiy  wrote:


Oh. ok. It also looks like even with the reverted patch, mlx4 VF does not
work in a guest:


So where is the breakage point for you? does 4.4 works? if not, what?


Ah, my bad. It is unrelated to the kernel version.

I tried passing a PF to a guest while its VFs are already passed to another 
guest and see how exactly it blows up (AER/EEH were thrown but the host 
recovered => good) but this left the device in a weird state when I could 
not use VF in a guest anymore but it seemed to keep working on the host.


It seems like the actual adapter does not reset completely when the machine 
is rebooted, I had unplug/replug power cables to fix this.



--
Alexey


Re: [PATCH net-next v3] rocker: add debugfs support to dump internal tables

2016-03-18 Thread Murali Karicheri
On 03/17/2016 05:53 PM, Ido Schimmel wrote:
> Thu, Mar 17, 2016 at 10:25:19PM IST, and...@lunn.ch wrote:
>> On Thu, Mar 17, 2016 at 04:10:31PM -0400, Murali Karicheri wrote:
>>> David,
>>>
>>> On 08/18/2015 04:47 PM, David Miller wrote:
 I see some drivers where the foo_debugfs.c file is larger than the rest
 of the driver.  Once people start using it, it's like crack, and they
 dump every single debugging widget they found useful at some point into
 there.

 This is not what we want.  Most things I see in debugfs support was
 probably useful for debugging one particular bug but then it was never
 really useful again in the future.  Those kinds of things can be done
 locally in someone's tree.

 I often see various kinds of "statistics" ending up in these things,
 or register dumps, both of which are 'ethtool' or similar material.
>>> Very late to this discussion, but I need to port some of the internal code
>>> to display the content of a ALE (Address Learning Engine) table maintained
>>> in hardwareat L2 layer. Currently I have a sysfs implementation that dumps
>>> information like below.
>>>
>>> root@k2e-evm:~# cat /sys/devices/platform/soc/2620110.netcp/ale_table
>>> index 0, raw: 07fc d000 , type: addr(1), addr: 
>>> ff:ff:ff:ff:ff:ff, mcstate: f(3), port mask: 1ff, no super
>>> index 1, raw:  1800 28329a1c, type: addr(1), addr: 
>>> 08:00:28:32:9a:1c, uctype: persistent(0), port: 0
>>> index 2, raw: 07fc d100 5e01, type: addr(1), addr: 
>>> 01:00:5e:00:00:01, mcstate: f(3), port mask: 1ff, no super
>>> index 19, raw: 0004 d000d4be d93db6c1, type: addr(1), addr: 
>>> d4:be:d9:3d:b6:c1, uctype: touched(3), port: 1
>>>
>>> What is the available interface in kernel to expose this information
>>> to user space as debugfs is not suggested based on this thread?
>>
>> This looks a lot like what the mv88e6xxx_port_fdb_dump() callback
>> returns to DSA when SWITCHDEV_OBJ_ID_PORT_FDB is passed to
>> switchdev_port_obj_dump() in the switchdev ops.
> 
> +1
> 
> Also, Murali, using standard interfaces instead of debugfs will allow
> you to:
> 
> 1) Upstream your code
> 2) Use existing tests for your code. In particular, the following
> (which is used for mlxsw testing):
> 
> https://github.com/jpirko/lnst/blob/master/recipes/switchdev/l2-002-bridge_fdb.py
> 
> There are a bunch of others there which you'll probably find useful.
> 
> BTW, are you familiar with the following document?
> https://www.kernel.org/doc/Documentation/networking/switchdev.txt
> I believe it answers your question.

Yes. I have support for DSA and switchdev for netcp driver in my TODO list.
Will post more questions on this once I start work on this.

Thanks

Murali
> 
> Good luck!
> 
>>
>>Andrew
> 


-- 
Murali Karicheri
Linux Kernel, Keystone


[PATCH v2] ARC: axs10x - add Ethernet PHY description in .dts

2016-03-18 Thread Alexey Brodkin
Following commit broke DW GMAC functionality on AXS10x boards:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e34d65696d2ef13dc32f2a162556c86c461ed763

That's what happens on eth0 up:
--->8
libphy: PHY stmmac-0: not found
eth0: Could not attach to PHY
stmmac_open: Cannot attach to PHY (error: -19)
--->8

Simplest solution is to add PHY description in board's .dts.
And so we do here.

Signed-off-by: Alexey Brodkin 
Cc: Rob Herring 
Cc: Phil Reid 
Cc: David S. Miller 
Cc: linux-ker...@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: sta...@vger.kernel.org # 4.5.x
Cc: Sergei Shtylyov 
---

Changes v1 -> v2:
 * PHY node name changed to match real PHY number being used (Sergei)

 arch/arc/boot/dts/axs10x_mb.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 44a578c..ab5d570 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -47,6 +47,14 @@
clocks = <>;
clock-names = "stmmaceth";
max-speed = <100>;
+   mdio0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "snps,dwmac-mdio";
+   phy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+   };
};
 
ehci@0x4 {
-- 
2.5.0



Re: [PATCH] net: mvneta: bm: clarify dependencies

2016-03-18 Thread David Miller
From: Arnd Bergmann 
Date: Tue, 15 Mar 2016 22:47:14 +0100

> MVNETA_BM has a dependency on MVNETA, so we can only select the former
> if the latter is enabled. However, the code dependency is the reverse:
> The mvneta module can call into the mvneta_bm module, so mvneta cannot
> be a built-in if mvneta_bm is a module, or we get a link error:
> 
> drivers/net/built-in.o: In function `mvneta_remove':
> drivers/net/ethernet/marvell/mvneta.c:4211: undefined reference to 
> `mvneta_bm_pool_destroy'
> drivers/net/built-in.o: In function `mvneta_bm_update_mtu':
> drivers/net/ethernet/marvell/mvneta.c:1034: undefined reference to 
> `mvneta_bm_bufs_free'
> 
> This avoids the problem by further clarifying the dependency so that
> MVNETA_BM is a silent Kconfig option that gets turned on by the
> new MVNETA_BM_ENABLE option. This way both the core HWBM module and
> the MVNETA_BM code are always built-in when needed.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: dc35a10f68d3 ("net: mvneta: bm: add support for hardware buffer 
> management")

Applied.


Re: [PATCH v1 1/2] ethtool: minor doc update

2016-03-18 Thread Ben Hutchings
On Thu, 2016-03-17 at 17:03 -0700, David Decotigny wrote:
> From: David Decotigny 
> 
> Updates: commit 793cf87de9d1 ("ethtool: Set cmd field in
>  ETHTOOL_GLINKSETTINGS response to wrong nwords")
> 
> Signed-off-by: David Decotigny 

Reviewed-by: Ben Hutchings 

> ---
>  include/uapi/linux/ethtool.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 2835b07..9222db8 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -1648,9 +1648,9 @@ enum ethtool_reset_flags {
>   *   %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
>   *   (>= 0); on return, if handshake in progress, negative if
>   *   request size unsupported by kernel: absolute value indicates
> - *   kernel recommended size and cmd field is 0, as well as all the
> - *   other fields; otherwise (handshake completed), strictly
> - *   positive to indicate size used by kernel and cmd field is
> + *   kernel expected size and all the other fields but cmd
> + *   are 0; otherwise (handshake completed), strictly positive
> + *   to indicate size used by kernel and cmd field stays
>   *   %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
>   *   %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
>   *   value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
-- 
Ben Hutchings
Absolutum obsoletum. (If it works, it's out of date.) - Stafford Beer

signature.asc
Description: This is a digitally signed message part


Re: [PATCH] mac80211: fix order of flag descriptions

2016-03-18 Thread Luis de Bethencourt
On 18/03/16 17:46, Luis de Bethencourt wrote:
> On 18/03/16 16:49, Johannes Berg wrote:
>> On Fri, 2016-03-18 at 16:35 +, Luis de Bethencourt wrote:
>>> Fix order of mac80211_rx_flags description to match the enum.
>>>
>>> Signed-off-by: Luis de Bethencourt 
>>> ---
>>> Hi,
>>>
>>> I want ahead and fixed the order of the descriptions. checkpatch.pl
>>> was giving
>>> a warning to my previous patch and I had a hunch it was because the
>>> wrong order
>>> breaks the parser. Indeed it does and with this patch below
>>> checkpatch.pl does
>>> not complain about this flag descriptions anymore.
>>>
>> Huh. I think we should fix checkpatch.pl instead. While the current
>> order isn't likely really good, I believe kernel-doc will output the
>> documentation in the order it's listed, and that can be useful for the
>> documentation output to group related things, even if their bits may be
>> further apart.
>>
>> johannes
>>
> 
> I agree checkpatch.pl should be fixed. I can look into it. No promises
> though, it has been a long time since I look at Perl code.
> 
> I understand the logic of grouping the documentation in logical blocks.
> It is unfortunate though that this means the enum and documentation won't
> match, which makes reading the code harder.
> 
> In this particular case I don't see the order of the documentation broken
> because flags are being grouped.
> 
> Thanks for the review :)
> Luis
> 

Sorry Johannes,

Update. checkpatch doesn't need fixing and it does see the documentation
independently of the order. It was my mistake.

Joe Perches pointed it out in this email branch:
https://lkml.org/lkml/2016/3/18/532


Thanks for looking into this, sorry for my blunder.
Luis


[patch net-next RFC 05/13] mlxsw: Do not pass around driver_priv directly

2016-03-18 Thread Jiri Pirko
From: Jiri Pirko 

Instead of that, pass mlxsw_core and use a helper to get driver priv
from driver code. Looks much cleaner that way.

Signed-off-by: Jiri Pirko 
---
 drivers/net/ethernet/mellanox/mlxsw/core.c | 19 +++
 drivers/net/ethernet/mellanox/mlxsw/core.h | 11 +++
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 17 +
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c |  8 
 4 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c 
b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 39161fb..3958195 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -114,6 +114,12 @@ struct mlxsw_core {
/* driver_priv has to be always the last item */
 };
 
+void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core)
+{
+   return mlxsw_core->driver_priv;
+}
+EXPORT_SYMBOL(mlxsw_core_driver_priv);
+
 struct mlxsw_rx_listener_item {
struct list_head list;
struct mlxsw_rx_listener rxl;
@@ -795,8 +801,7 @@ static int mlxsw_devlink_port_split(struct devlink *devlink,
return -EINVAL;
if (!mlxsw_core->driver->port_split)
return -EOPNOTSUPP;
-   return mlxsw_core->driver->port_split(mlxsw_core->driver_priv,
- port_index, count);
+   return mlxsw_core->driver->port_split(mlxsw_core, port_index, count);
 }
 
 static int mlxsw_devlink_port_unsplit(struct devlink *devlink,
@@ -808,8 +813,7 @@ static int mlxsw_devlink_port_unsplit(struct devlink 
*devlink,
return -EINVAL;
if (!mlxsw_core->driver->port_unsplit)
return -EOPNOTSUPP;
-   return mlxsw_core->driver->port_unsplit(mlxsw_core->driver_priv,
-   port_index);
+   return mlxsw_core->driver->port_unsplit(mlxsw_core, port_index);
 }
 
 static const struct devlink_ops mlxsw_devlink_ops = {
@@ -880,8 +884,7 @@ int mlxsw_core_bus_device_register(const struct 
mlxsw_bus_info *mlxsw_bus_info,
if (err)
goto err_devlink_register;
 
-   err = mlxsw_driver->init(mlxsw_core->driver_priv, mlxsw_core,
-mlxsw_bus_info);
+   err = mlxsw_driver->init(mlxsw_core, mlxsw_bus_info);
if (err)
goto err_driver_init;
 
@@ -892,7 +895,7 @@ int mlxsw_core_bus_device_register(const struct 
mlxsw_bus_info *mlxsw_bus_info,
return 0;
 
 err_debugfs_init:
-   mlxsw_core->driver->fini(mlxsw_core->driver_priv);
+   mlxsw_core->driver->fini(mlxsw_core);
 err_driver_init:
devlink_unregister(devlink);
 err_devlink_register:
@@ -918,7 +921,7 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core 
*mlxsw_core)
struct devlink *devlink = priv_to_devlink(mlxsw_core);
 
mlxsw_core_debugfs_fini(mlxsw_core);
-   mlxsw_core->driver->fini(mlxsw_core->driver_priv);
+   mlxsw_core->driver->fini(mlxsw_core);
devlink_unregister(devlink);
mlxsw_emad_fini(mlxsw_core);
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h 
b/drivers/net/ethernet/mellanox/mlxsw/core.h
index f8054a7..85ded38 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -62,6 +62,8 @@ struct mlxsw_driver;
 struct mlxsw_bus;
 struct mlxsw_bus_info;
 
+void *mlxsw_core_driver_priv(struct mlxsw_core *mlxsw_core);
+
 int mlxsw_core_driver_register(struct mlxsw_driver *mlxsw_driver);
 void mlxsw_core_driver_unregister(struct mlxsw_driver *mlxsw_driver);
 
@@ -201,11 +203,12 @@ struct mlxsw_driver {
const char *kind;
struct module *owner;
size_t priv_size;
-   int (*init)(void *driver_priv, struct mlxsw_core *mlxsw_core,
+   int (*init)(struct mlxsw_core *mlxsw_core,
const struct mlxsw_bus_info *mlxsw_bus_info);
-   void (*fini)(void *driver_priv);
-   int (*port_split)(void *driver_priv, u8 local_port, unsigned int count);
-   int (*port_unsplit)(void *driver_priv, u8 local_port);
+   void (*fini)(struct mlxsw_core *mlxsw_core);
+   int (*port_split)(struct mlxsw_core *mlxsw_core, u8 local_port,
+ unsigned int count);
+   int (*port_unsplit)(struct mlxsw_core *mlxsw_core, u8 local_port);
void (*txhdr_construct)(struct sk_buff *skb,
const struct mlxsw_tx_info *tx_info);
u8 txhdr_len;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 1e4dc5e..324848d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1650,9 +1650,10 @@ static u8 mlxsw_sp_cluster_base_port_get(u8 local_port)
return local_port - offset;
 }
 
-static 

Re: [PATCH] net: removes duplicate skb_mark_napi_id() calls.

2016-03-18 Thread David Miller
From: Weongyo Jeong 
Date: Wed, 16 Mar 2016 10:04:53 -0700

> Because napi_gro_receive() function calls skb_mark_napi_id() function,
> it doesn't need to set it twice.
> 
> Signed-off-by: Weongyo Jeong 

Unless you can show a significant performance argument, or other
significant improvement resulting from this patch, I am not applying
it.


Re: [RFC net-next 0/2] Create ancient subdirectories for old hardware

2016-03-18 Thread Joe Perches
On Fri, 2016-03-18 at 22:11 -0400, David Miller wrote:
> From: Joe Perches 
> Date: Fri, 18 Mar 2016 17:33:29 -0700
> 
> > Maybe something like this:
> > 
> > Old, rare, and unsupported hardware should be exposed as ancient.
> > 
> > The drivers for these ancient hardwares are generally untested with
> > current kernels.
> 
> Moving drivers has a long term maintainence cost.
> 
> If they've moved into drivers/net proper, we have to maintain
> them there forever.

I don't doubt that.

All files are still in drivers/net, just possibly in
separate subdirectories for easier visibility to
determine if changes like what were proposed for cxgb
should actually be done or not.



Re: [PATCH v3 1/9] net: arc_emac: make the rockchip emac document more compatible

2016-03-18 Thread Rob Herring
On Mon, Mar 14, 2016 at 04:01:52PM +0800, Caesar Wang wrote:
> Add the rk3036 SoCs to match driver for document since the emac driver
> has supported the rk3036 SoCs.
> 
> This patch adds the rk3036/rk3066/rk3188 SoCS to compatible for rockchip
> emac ducument. Also, that will suit for other SoCs in the future.
> 
> Signed-off-by: Caesar Wang 
> Cc: Rob Herring 
> Cc: devicet...@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: "David S. Miller" 
> Cc: Alexander Kochetkov 
> 
> ---
> 
> Changes in v3:
> - %s/he/the
> - Add the Cc people
> 
> Changes in v2:
> - change the commit and remove the repeat the name 'rockchip'.
> 
>  Documentation/devicetree/bindings/net/emac_rockchip.txt | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Acked-by: Rob Herring 


Re: [RFC PATCH 6/9] ethtool: Add support for toggling any of the GSO offloads

2016-03-18 Thread Alexander Duyck
On Fri, Mar 18, 2016 at 5:18 PM, Ben Hutchings  wrote:
> On Fri, 2016-03-18 at 16:25 -0700, Alexander Duyck wrote:
>
>> The strings were missing for several of the GSO offloads that are
>> available.  This patch provides the missing strings so that we can toggle
>> or query any of them via the ethtool command.
>>
>> Signed-off-by: Alexander Duyck 
>> ---
>>  net/core/ethtool.c |3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
>> index 2966cd0d7c93..b3c39d531469 100644
>> --- a/net/core/ethtool.c
>> +++ b/net/core/ethtool.c
>> @@ -82,9 +82,12 @@ static const char 
>> netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
>>   [NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
>>   [NETIF_F_FSO_BIT] =  "tx-fcoe-segmentation",
>>   [NETIF_F_GSO_GRE_BIT] =  "tx-gre-segmentation",
>> + [NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation",
>
> All of the existing checksum offload names include the word "checksum"
> in full, so I think the new names should do the same.

It isn't a checksum offload though, it is a segmentation offload for a
tunnel that has an outer checksum.  I was hoping to avoid using the
word checksum as that might make it confusing as it is a segmentation
offload, not a checksum offload.

>>   [NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
>>   [NETIF_F_GSO_SIT_BIT] =  "tx-sit-segmentation",
>>   [NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
>> + [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
>> + [NETIF_F_GSO_TUNNEL_REMCSUM_BIT] = "tx-remcsum-segmentation",
>
> I think this should be "tx-tunnel-remote-checksum-segmentation", though
> that is getting quite unwieldy.

Right.  As it is I think we might be coming up on the 32 character
limit for the strings.  Replacing csum with checksum would probably
push us over.

- Alex


[RFC PATCH 3/9] geneve: Enforce IP ID verification on outer headers

2016-03-18 Thread Alexander Duyck
This change enforces the IP ID verification on outer headers.  As a result
if the DF flag is not set on the outer header we will force the flow to be
flushed in the event that the IP ID is out of sequence with the existing
flow.

Signed-off-by: Alexander Duyck 
---
 drivers/net/geneve.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 192631a345df..2dac5496c965 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -473,6 +473,20 @@ static struct sk_buff **geneve_gro_receive(struct sk_buff 
**head,
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
+
+   /* Include the IP ID check from the outer IP hdr */
+   if (!NAPI_GRO_CB(p)->flush_id)
+   continue;
+
+   /* If flush_id is non-zero and rfc6864 is enabled for
+* the new frame the only possibility is that we are
+* incrementing so we can xor by count to cancel out
+* the one acceptable value.
+*/
+   NAPI_GRO_CB(p)->flush |= NAPI_GRO_CB(skb)->rfc6864 ?
+NAPI_GRO_CB(p)->flush_id ^
+NAPI_GRO_CB(p)->count :
+NAPI_GRO_CB(p)->flush_id;
}
 
type = gh->proto_type;



[RFC PATCH 4/9] vxlan: Enforce IP ID verification on outer headers

2016-03-18 Thread Alexander Duyck
This change enforces the IP ID verification on outer headers.  As a result
if the DF flag is not set on the outer header we will force the flow to be
flushed in the event that the IP ID is out of sequence with the existing
flow.

Signed-off-by: Alexander Duyck 
---
 drivers/net/vxlan.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 800106a7246c..d6838a30e772 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -601,6 +601,20 @@ static struct sk_buff **vxlan_gro_receive(struct sk_buff 
**head,
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
+
+   /* Include the IP ID check from the outer IP hdr */
+   if (!NAPI_GRO_CB(p)->flush_id)
+   continue;
+
+   /* If flush_id is non-zero and rfc6864 is enabled for
+* the new frame the only possibility is that we are
+* incrementing so we can xor by count to cancel out
+* the one acceptable value.
+*/
+   NAPI_GRO_CB(p)->flush |= NAPI_GRO_CB(skb)->rfc6864 ?
+NAPI_GRO_CB(p)->flush_id ^
+NAPI_GRO_CB(p)->count :
+NAPI_GRO_CB(p)->flush_id;
}
 
pp = eth_gro_receive(head, skb);



[RFC PATCH 2/9] gre: Enforce IP ID verification on outer headers

2016-03-18 Thread Alexander Duyck
This change enforces the IP ID verification on outer headers.  As a result
if the DF flag is not set on the outer header we will force the flow to be
flushed in the event that the IP ID is out of sequence with the existing
flow.

Signed-off-by: Alexander Duyck 
---
 net/ipv4/gre_offload.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index 540866dbd27d..7ea14ced9222 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -203,6 +203,20 @@ static struct sk_buff **gre_gro_receive(struct sk_buff 
**head,
continue;
}
}
+
+   /* Include the IP ID check from the outer IP hdr */
+   if (!NAPI_GRO_CB(p)->flush_id)
+   continue;
+
+   /* If flush_id is non-zero and rfc6864 is enabled for
+* the new frame the only possibility is that we are
+* incrementing so we can xor by count to cancel out
+* the one acceptable value.
+*/
+   NAPI_GRO_CB(p)->flush |= NAPI_GRO_CB(skb)->rfc6864 ?
+NAPI_GRO_CB(p)->flush_id ^
+NAPI_GRO_CB(p)->count :
+NAPI_GRO_CB(p)->flush_id;
}
 
skb_gro_pull(skb, grehlen);



[RFC PATCH 5/9] gue: Enforce IP ID verification on outer headers

2016-03-18 Thread Alexander Duyck
This change enforces the IP ID verification on outer headers.  As a result
if the DF flag is not set on the outer header we will force the flow to be
flushed in the event that the IP ID is out of sequence with the existing
flow.

Signed-off-by: Alexander Duyck 
---
 net/ipv4/fou.c |   14 ++
 1 file changed, 14 insertions(+)

diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 780484243e14..2be35e4f6d88 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -341,6 +341,20 @@ static struct sk_buff **gue_gro_receive(struct sk_buff 
**head,
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
+
+   /* Include the IP ID check from the outer IP hdr */
+   if (!NAPI_GRO_CB(p)->flush_id)
+   continue;
+
+   /* If flush_id is non-zero and rfc6864 is enabled for
+* the new frame the only possibility is that we are
+* incrementing so we can xor by count to cancel out
+* the one acceptable value.
+*/
+   NAPI_GRO_CB(p)->flush |= NAPI_GRO_CB(skb)->rfc6864 ?
+NAPI_GRO_CB(p)->flush_id ^
+NAPI_GRO_CB(p)->count :
+NAPI_GRO_CB(p)->flush_id;
}
 
rcu_read_lock();



[RFC net-next 0/2] Create ancient subdirectories for old hardware

2016-03-18 Thread Joe Perches
Maybe something like this:

Old, rare, and unsupported hardware should be exposed as ancient.

The drivers for these ancient hardwares are generally untested with
current kernels.

Joe Perches (2):
  drivers/net: Create an ANCIENT_NETDEVICES symbol
  chelsio: Move original cxgb driver into ancient subdirectory

 drivers/net/Kconfig   | 19 +++
 drivers/net/ethernet/chelsio/Kconfig  |  2 +-
 drivers/net/ethernet/chelsio/Makefile |  2 +-
 drivers/net/ethernet/chelsio/ancient/Makefile |  1 +
 .../net/ethernet/chelsio/{ => ancient}/cxgb/Makefile  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/common.h  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/cphy.h|  0
 .../ethernet/chelsio/{ => ancient}/cxgb/cpl5_cmd.h|  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/cxgb2.c   |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/elmer0.h  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/espi.c|  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/espi.h|  0
 .../ethernet/chelsio/{ => ancient}/cxgb/fpga_defs.h   |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/gmac.h|  0
 .../ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.c   |  0
 .../ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.h   |  0
 .../ethernet/chelsio/{ => ancient}/cxgb/mv88x201x.c   |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/my3126.c  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/pm3393.c  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/regs.h|  0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.c |  0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.h |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/subr.c|  0
 .../chelsio/{ => ancient}/cxgb/suni1x10gexp_regs.h|  0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.c  |  0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.h  |  0
 .../net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326.c |  0
 .../ethernet/chelsio/{ => ancient}/cxgb/vsc7326_reg.h |  0
 28 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/chelsio/ancient/Makefile
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/Makefile (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/common.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cphy.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cpl5_cmd.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cxgb2.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/elmer0.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/fpga_defs.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/gmac.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88x201x.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/my3126.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/pm3393.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/regs.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/subr.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/suni1x10gexp_regs.h 
(100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326_reg.h (100%)

-- 
2.6.3.368.gf34be46



[RFC net-next 2/2] chelsio: Move original cxgb driver into ancient subdirectory

2016-03-18 Thread Joe Perches
This hardware is no longer sold or supported by Chelsio.
The hardware is relatively rare, so move it to an ancient subdirectory.

Signed-off-by: Joe Perches 
---
 drivers/net/ethernet/chelsio/Kconfig| 2 +-
 drivers/net/ethernet/chelsio/Makefile   | 2 +-
 drivers/net/ethernet/chelsio/ancient/Makefile   | 1 +
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/Makefile| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/common.h| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cphy.h  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cpl5_cmd.h  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cxgb2.c | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/elmer0.h| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.c  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.h  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/fpga_defs.h | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/gmac.h  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.c | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.h | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88x201x.c | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/my3126.c| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/pm3393.c| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/regs.h  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.c   | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.h   | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/subr.c  | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/suni1x10gexp_regs.h | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.c| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.h| 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326.c   | 0
 drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326_reg.h   | 0
 27 files changed, 3 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/chelsio/ancient/Makefile
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/Makefile (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/common.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cphy.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cpl5_cmd.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/cxgb2.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/elmer0.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/espi.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/fpga_defs.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/gmac.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88e1xxx.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/mv88x201x.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/my3126.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/pm3393.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/regs.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/sge.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/subr.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/suni1x10gexp_regs.h 
(100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/tp.h (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326.c (100%)
 rename drivers/net/ethernet/chelsio/{ => ancient}/cxgb/vsc7326_reg.h (100%)

diff --git a/drivers/net/ethernet/chelsio/Kconfig 
b/drivers/net/ethernet/chelsio/Kconfig
index 4d187f2..25f4931 100644
--- a/drivers/net/ethernet/chelsio/Kconfig
+++ b/drivers/net/ethernet/chelsio/Kconfig
@@ -18,7 +18,7 @@ if NET_VENDOR_CHELSIO
 
 config CHELSIO_T1
tristate "Chelsio 10Gb Ethernet support"
-   depends on PCI
+   depends on PCI && ANCIENT_NETDEVICES
select CRC32
select MDIO
---help---
diff --git a/drivers/net/ethernet/chelsio/Makefile 
b/drivers/net/ethernet/chelsio/Makefile
index 390510b..10a8f92 100644
--- a/drivers/net/ethernet/chelsio/Makefile
+++ b/drivers/net/ethernet/chelsio/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the Chelsio network device drivers.
 #
 
-obj-$(CONFIG_CHELSIO_T1) += cxgb/
+obj-y += ancient/
 obj-$(CONFIG_CHELSIO_T3) += cxgb3/
 obj-$(CONFIG_CHELSIO_T4) += cxgb4/
 obj-$(CONFIG_CHELSIO_T4VF) += cxgb4vf/
diff --git a/drivers/net/ethernet/chelsio/ancient/Makefile 

[RFC PATCH 0/9] RFC6864 compliant GRO and GSO partial offload

2016-03-18 Thread Alexander Duyck
This patch series addresses two things.

First it enables what I am calling RFC6864 compliant GRO.  Basically what
I am doing is allowing one of two patterns for incoming frames.  Either the
IP ID will increment, or if the DF bit is set it can either increment or
stay the same value.  This allows us to perform GRO if the IP ID is forced
to stay at a static value as may occur if we are replicating an IP header
instead of actually having it offloaded.

The last 3 patches introduce what I am calling GSO partial.  The best way
to describe it is that it is a GSO offload in which the portion pointed to
by csum_start must be handled by the hardware, and the region before that
can be optionally handled.  So for example with i40e the only pieces it was
missing from the full offload was the checksum so this is computed in
software and the hardware will update inner and outer IP headers.  In the
example for ixgbe the hardware will only update the outer IP header.  The
outer UDP or GRE header and inner IP header are unmodified.

The bits remaining to be worked out are what to do about drivers that
wouldn't be able to handle updating the outer IP header.  So for example
should I require the driver to have to update the outer IP header or handle
it in software.  The one concern here is that if the outer IP header does
not have the DF bit set and does not update the IP ID field we run the risk
of causing all sorts of problems if the packet is fragmented in flight.

---

Alexander Duyck (9):
  ipv4/GRO: Allow multiple frames to use the same IP ID
  gre: Enforce IP ID verification on outer headers
  geneve: Enforce IP ID verification on outer headers
  vxlan: Enforce IP ID verification on outer headers
  gue: Enforce IP ID verification on outer headers
  ethtool: Add support for toggling any of the GSO offloads
  GSO: Support partial segmentation offload
  i40e/i40evf: Add support for GSO partial with UDP_TUNNEL_CSUM and GRE_CSUM
  ixgbe/ixgbevf: Add support for GSO partial


 drivers/net/ethernet/intel/i40e/i40e_main.c   |8 ++
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   |   14 +++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c |   14 +++-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c   |8 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   72 +---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   77 ++---
 drivers/net/geneve.c  |   14 
 drivers/net/vxlan.c   |   14 
 include/linux/netdev_features.h   |7 ++
 include/linux/netdevice.h |7 ++
 include/linux/skbuff.h|7 ++
 net/core/dev.c|   31 
 net/core/ethtool.c|4 +
 net/core/skbuff.c |   21 +-
 net/ipv4/af_inet.c|   20 -
 net/ipv4/fou.c|   14 
 net/ipv4/gre_offload.c|   37 +-
 net/ipv4/tcp_offload.c|   25 ++-
 net/ipv4/udp_offload.c|   20 -
 net/ipv6/ip6_offload.c|9 ++
 20 files changed, 344 insertions(+), 79 deletions(-)

--


[RFC PATCH 1/9] ipv4/GRO: Allow multiple frames to use the same IP ID

2016-03-18 Thread Alexander Duyck
In RFC 6864 it is stated that we can essentially ignore the IPv4 ID field
if we have not and will not use fragmentation.  Such a frame is defined
as having the DF flag set to 1, and the MF and frag_offset as 0.  Currently
for GRO we were requiring that the inner header always have an increasing
IPv4 ID, but we are ignoring the outer value.

This patch is a first step in trying to reverse some of that.  Specifically
what this patch does is allow us to coalesce frames that have a static IPv4
ID value.  So for example if we had a series of frames where the DF flag
was set we would allow the same IPv4 ID value to be used for all the frames
belonging to that flow.  This would become the standard behavior for TCP so
it would support either a fixed IPv4 ID value, or one in which the value
increments.

Signed-off-by: Alexander Duyck 
---
 include/linux/netdevice.h |5 -
 net/ipv4/af_inet.c|8 ++--
 net/ipv4/tcp_offload.c|   15 ++-
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index be693b34662f..31474d9d8a96 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2113,7 +2113,10 @@ struct napi_gro_cb {
/* Used in foo-over-udp, set in udp[46]_gro_receive */
u8  is_ipv6:1;
 
-   /* 7 bit hole */
+   /* Flag indicating if IP ID can be ignored on receive */
+   u8  rfc6864:1;
+
+   /* 6 bit hole */
 
/* used to support CHECKSUM_COMPLETE for tunneling protocols */
__wsum  csum;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 0cc923f83e10..5e3885672907 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1320,6 +1320,8 @@ static struct sk_buff **inet_gro_receive(struct sk_buff 
**head,
 
id = ntohl(*(__be32 *)>id);
flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & 
~IP_DF));
+
+   NAPI_GRO_CB(skb)->rfc6864 = !!(id & IP_DF);
id >>= 16;
 
for (p = *head; p; p = p->next) {
@@ -1352,8 +1354,10 @@ static struct sk_buff **inet_gro_receive(struct sk_buff 
**head,
 * This is because some GSO/TSO implementations do not
 * correctly increment the IP ID for the outer hdrs.
 */
-   NAPI_GRO_CB(p)->flush_id =
-   ((u16)(ntohs(iph2->id) + NAPI_GRO_CB(p)->count) ^ 
id);
+   NAPI_GRO_CB(p)->flush_id = (u16)(id - ntohs(iph2->id));
+   if (!NAPI_GRO_CB(p)->rfc6864 || !NAPI_GRO_CB(skb)->rfc6864)
+   NAPI_GRO_CB(p)->flush_id ^= NAPI_GRO_CB(p)->count;
+
NAPI_GRO_CB(p)->flush |= flush;
}
 
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index 773083b7f1e9..1a2e9957c177 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -237,7 +237,7 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, 
struct sk_buff *skb)
 
 found:
/* Include the IP ID check below from the inner most IP hdr */
-   flush = NAPI_GRO_CB(p)->flush | NAPI_GRO_CB(p)->flush_id;
+   flush = NAPI_GRO_CB(p)->flush;
flush |= (__force int)(flags & TCP_FLAG_CWR);
flush |= (__force int)((flags ^ tcp_flag_word(th2)) &
  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
@@ -246,6 +246,19 @@ found:
flush |= *(u32 *)((u8 *)th + i) ^
 *(u32 *)((u8 *)th2 + i);
 
+   /* Some devices may make use of RFC6864 to skip the need to
+* increment the IP ID on inner headers of tunneled frames.  This
+* allows them to make use of TSO by not updating the headers from
+* the outer L4 to inner L3.  We should be able to identify any such
+* frames on the second frame received and then after that we expect
+* the same ID on all remaining frames in the flow.
+*/
+   if ((NAPI_GRO_CB(p)->flush_id == 1) && NAPI_GRO_CB(p)->rfc6864 &&
+   (NAPI_GRO_CB(p)->count == 1))
+   NAPI_GRO_CB(p)->rfc6864 = 0;
+   else
+   flush |= NAPI_GRO_CB(p)->flush_id;
+
mss = skb_shinfo(p)->gso_size;
 
flush |= (len - 1) >= mss;



[RFC net-next 1/2] drivers/net: Create an ANCIENT_NETDEVICES symbol

2016-03-18 Thread Joe Perches
Many drivers are ancient and written for hardware that is no longer
available.  These drivers are effectively untested under current
kernels.  Add a symbol that could guard inclusions of these drivers
into modern kernels unless specifically requested.

Signed-off-by: Joe Perches 
---
 drivers/net/Kconfig | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 2a1ba62b..0878363 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -21,6 +21,25 @@ menuconfig NETDEVICES
 
  If unsure, say Y.
 
+menuconfig ANCIENT_NETDEVICES
+  default n
+  depends on NET && NETDEVICES
+  bool "Network ancient device support"
+  ---help---
+  Many old devices are no longer manufactured.
+
+  The drivers for these devices likely worked with the original
+  kernel version when the devices were manufactured, but do not
+  necessarily function well today.
+
+  If these devices still exist and are still functional, the drivers
+  for these devices get scant testing.
+
+  The drivers for these devices are unmaintained and not supported by
+  the vendor.
+
+  If you are unsure that you need drivers for old hardware, say N.
+
 # All the following symbols are dependent on NETDEVICES - do not repeat
 # that for each of the symbols.
 if NETDEVICES
-- 
2.6.3.368.gf34be46



Re: [RFC net-next 0/2] Create ancient subdirectories for old hardware

2016-03-18 Thread David Miller
From: Joe Perches 
Date: Fri, 18 Mar 2016 19:28:02 -0700

> On Fri, 2016-03-18 at 22:11 -0400, David Miller wrote:
>> From: Joe Perches 
>> Date: Fri, 18 Mar 2016 17:33:29 -0700
>> 
>> > Maybe something like this:
>> > 
>> > Old, rare, and unsupported hardware should be exposed as ancient.
>> > 
>> > The drivers for these ancient hardwares are generally untested with
>> > current kernels.
>> 
>> Moving drivers has a long term maintainence cost.
>> 
>> If they've moved into drivers/net proper, we have to maintain
>> them there forever.
> 
> I don't doubt that.
> 
> All files are still in drivers/net, just possibly in
> separate subdirectories for easier visibility to
> determine if changes like what were proposed for cxgb
> should actually be done or not.

You don't understand my concern, backporting patches to -stable
releases is more painful if you move the driver anywhere other
than where it has been for years.

I'm not entertaining this idea, sorry Joe.


Re: [PATCH v2 net-next 0/2] lan78xx: patch series

2016-03-18 Thread David Miller

Series applied, thanks.


Re: [PATCH net] bonding: fix bond_get_stats()

2016-03-18 Thread David Miller
From: Eric Dumazet 
Date: Thu, 17 Mar 2016 17:23:36 -0700

> From: Eric Dumazet 
> 
> bond_get_stats() can be called from rtnetlink (with RTNL held)
> or from /proc/net/dev seq handler (with RCU held)
> 
> The logic added in commit 5f0c5f73e5ef ("bonding: make global bonding
> stats more reliable") kind of assumed only one cpu could run there.
> 
> If multiple threads are reading /proc/net/dev, stats can be really
> messed up after a while.
> 
> A second problem is that some fields are 32bit, so we need to properly
> handle the wrap around problem.
> 
> Given that RTNL is not always held, we need to use
> bond_for_each_slave_rcu().
> 
> Fixes: 5f0c5f73e5ef ("bonding: make global bonding stats more reliable")
> Signed-off-by: Eric Dumazet 

Applied and queued up for -stable, thanks Eric.


Re: [PATCH net] net: bcmgenet: fix dma api length mismatch

2016-03-18 Thread David Miller
From: Eric Dumazet 
Date: Thu, 17 Mar 2016 11:57:06 -0700

> From: Eric Dumazet 
> 
> When un-mapping skb->data in __bcmgenet_tx_reclaim(),
> we must use the length that was used in original dma_map_single(),
> instead of skb->len that might be bigger (includes the frags)
> 
> We simply can store skb_len into tx_cb_ptr->dma_len and use it
> at unmap time.
> 
> Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
> Signed-off-by: Eric Dumazet 

Applied and queued up for -stable, thanks.


Re: [PATCH v2] net: smc911x: convert pxa dma to dmaengine

2016-03-18 Thread David Miller
From: Robert Jarzmik 
Date: Wed, 16 Mar 2016 18:26:02 +0100

> Convert the dma transfers to be dmaengine based, now pxa has a dmaengine
> slave driver. This makes this driver a bit more PXA agnostic.
> 
> The driver was only compile tested. The risk is quite small as no
> current PXA platform I'm aware of is using smc911x driver.
> 
> Signed-off-by: Robert Jarzmik 
> Tested-by: Fabio Estevam 
> ---
> Since v1: added Fabio's Tested-by

Applied, thanks.


Re: [RFC PATCH 9/9] ixgbe/ixgbevf: Add support for GSO partial

2016-03-18 Thread Jesse Gross
On Fri, Mar 18, 2016 at 4:25 PM, Alexander Duyck  wrote:
> This patch adds support for partial GSO segmentation in the case of GRE or
> UDP encapsulated frames.
>
> The one bit in this patch that is a bit controversial is the fact that we
> are leaving the inner IPv4 IP ID as a static value in the case of
> segmentation.  As per RFC6864 this should be acceptable as TCP frames set
> the DF bit so the IP ID should be ignored.  However this is not always the
> case as header compression schemes for PPP and SLIP can end up taking a
> performance hit as they have to record the fact that the ID didn't change
> as expected.
>
> In addition GRO was examining the IP ID field as well.  As such on older
> GRO implementations TSO frames from this driver may end up blocking GRO on
> the other end which will likely hurt performance instead of helping it.
>
> Signed-off-by: Alexander Duyck 

I wasn't able to apply this patch, it seems like it might be based on
some Intel driver patches that haven't been merged into net-next yet?


Re: [PATCH] phy: mdio-thunder: Fix some Kconfig typos

2016-03-18 Thread David Miller
From: Andreas Färber 
Date: Thu, 17 Mar 2016 00:23:37 +0100

> Drop two extra occurrences of "on" in option title and help text.
> 
> Fixes: 379d7ac7ca31 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC 
> MDIO buses.")
> Cc: David Daney 
> Signed-off-by: Andreas Färber 

Applied.


Re: [PATCH net-next] vxlan: fix too large pskb_may_pull with remote checksum

2016-03-18 Thread David Miller
From: Jiri Benc 
Date: Wed, 16 Mar 2016 17:35:47 +0100

> The vxlan header is pulled at this point, don't include it again in the
> calculation.
> 
> Signed-off-by: Jiri Benc 

Please update the commit log message to explain where that pull
happens.

Thanks.


Re: [ovs-dev] [PATCH] openvswitch: reduce padding in struct sw_flow_key

2016-03-18 Thread Jesse Gross
On Fri, Mar 18, 2016 at 6:34 AM, Arnd Bergmann  wrote:
> This means it's still too large really, we just don't warn about it any more,
> and will get the warning again once another member is added. My patch is a
> band-aid at best, but more work is needed here. One problem is that
> ovs_flow_cmd_new and ovs_flow_cmd_set have two copies of struct sw_flow_key on
> the stack, one of them nested within sw_flow_mask. If we could reduce that to
> a single instance, the stack usage would be cut in half here.

I think it should be possible to reduce those two functions to only
use a single instance of the structure.

For new flows, we're already allocating the key structure on the heap,
it seems like we could just translate the key into that rather than to
intermediate location on the stack. And when setting flows, I'm not
sure that we really need the mask at all - we don't do anything with
it other than check it against the actions but we really should be
using the original mask for that rather than the new one.

It seems like it would be preferable to go down that route rather than
this patch, since as you say, this patch is really only suppressing
the warning and doesn't have a significant impact on the actual stack
consumption. Plus, the ordering of the flow layout affects how much
data needs to be compared during packet lookup, so this change will
likely be bad for forwarding performance.


Re: [PATCH net 1/3] ipip: Properly mark ipip GRO packets as encapsulated.

2016-03-18 Thread David Miller

Jesse, can you repost this series with a patch introductory "PATCH
0/3" email explaining things at a high level about what this series is
doing?

Thanks.



Re: [PATCH net-next] net/mlx4_core: Fix backward compatibility on VFs

2016-03-18 Thread David Miller
From: Eli Cohen 
Date: Thu, 17 Mar 2016 18:49:42 +0200

> Commit 85743f1eb345 ("net/mlx4_core: Set UAR page size to 4KB regardless
> of system page size") introduced dependency where old VF drivers without
> this fix fail to load if the PF driver runs with this commit.
> 
> To resolve this add a module parameter which disables that functionality
> by default.  If both the PF and VFs are running with a driver with that
> commit the administrator may set the module param to true.
> 
> The module parameter is called enable_4k_uar.
> 
> Fixes: 85743f1eb345 ('net/mlx4_core: Set UAR page size to 4KB ...')
> Signed-off-by: Eli Cohen 

Applied.


Re: [net-next 0/2] remove duplicate set of flag IFF_MULTICAST

2016-03-18 Thread David Miller
From: Zhang Shengju 
Date: Wed, 16 Mar 2016 09:59:14 +

> This patch series remove duplicate set of flag IFF_MULTICAST.

Series applied, thanks.


Re: [RFC net-next 0/2] Create ancient subdirectories for old hardware

2016-03-18 Thread David Miller
From: Joe Perches 
Date: Fri, 18 Mar 2016 17:33:29 -0700

> Maybe something like this:
> 
> Old, rare, and unsupported hardware should be exposed as ancient.
> 
> The drivers for these ancient hardwares are generally untested with
> current kernels.

Moving drivers has a long term maintainence cost.

If they've moved into drivers/net proper, we have to maintain
them there forever.


  1   2   >