Re: [PATCH net-next] switchdev: fix BUG when port driver doesn't support set attr op

2015-06-11 Thread David Miller
From: sfel...@gmail.com
Date: Wed, 10 Jun 2015 13:56:02 -0700

> From: Scott Feldman 
> 
> Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged
> port does not support switchdec_port_attr_set op.  Don't BUG() if
> -EOPNOTSUPP is returned.
> 
> Signed-off-by: Scott Feldman 
> Reported-by: Brenden Blanco 
> ---
>  net/switchdev/switchdev.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index e008057..99bced4 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct 
> work_struct *work)
>  
>   rtnl_lock();
>   err = switchdev_port_attr_set(asw->dev, &asw->attr);
> - BUG_ON(err);
> + BUG_ON(err && err != -EOPNOTSUPP);
>   rtnl_unlock();
>  
>   dev_put(asw->dev);

I agree with other feedback, in that this function can return other "normal"
errors like -ENOMEM and that's not absolutely not BUG_ON() material.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 net-next 1/2] tcp: export tcp_enter_cwr()

2015-06-11 Thread David Miller
From: Kenneth Klette Jonassen 
Date: Wed, 10 Jun 2015 19:08:16 +0200

> Upcoming tcp_cdg uses tcp_enter_cwr() to initiate PRR. Export this
> function so that CDG can be compiled as a module.
> 
> Cc: Eric Dumazet 
> Cc: Yuchung Cheng 
> Cc: Stephen Hemminger 
> Cc: Neal Cardwell 
> Cc: David Hayes 
> Cc: Andreas Petlund 
> Cc: Dave Taht 
> Cc: Nicolas Kuhn 
> Signed-off-by: Kenneth Klette Jonassen 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 net-next 2/2] tcp: add CDG congestion control

2015-06-11 Thread David Miller
From: Kenneth Klette Jonassen 
Date: Wed, 10 Jun 2015 19:08:17 +0200

> CAIA Delay-Gradient (CDG) is a TCP congestion control that modifies
> the TCP sender in order to [1]:
> 
>   o Use the delay gradient as a congestion signal.
>   o Back off with an average probability that is independent of the RTT.
>   o Coexist with flows that use loss-based congestion control, i.e.,
> flows that are unresponsive to the delay signal.
>   o Tolerate packet loss unrelated to congestion. (Disabled by default.)
> 
> Its FreeBSD implementation was presented for the ICCRG in July 2012;
> slides are available at http://www.ietf.org/proceedings/84/iccrg.html
> 
> Running the experiment scenarios in [1] suggests that our implementation
> achieves more goodput compared with FreeBSD 10.0 senders, although it also
> causes more queueing delay for a given backoff factor.
> 
> The loss tolerance heuristic is disabled by default due to safety concerns
> for its use in the Internet [2, p. 45-46].
> 
> We use a variant of the Hybrid Slow start algorithm in tcp_cubic to reduce
> the probability of slow start overshoot.
> 
> [1] D.A. Hayes and G. Armitage. "Revisiting TCP congestion control using
> delay gradients." In Networking 2011, pages 328-341. Springer, 2011.
> [2] K.K. Jonassen. "Implementing CAIA Delay-Gradient in Linux."
> MSc thesis. Department of Informatics, University of Oslo, 2015.
> 
> Cc: Eric Dumazet 
> Cc: Yuchung Cheng 
> Cc: Stephen Hemminger 
> Cc: Neal Cardwell 
> Cc: David Hayes 
> Cc: Andreas Petlund 
> Cc: Dave Taht 
> Cc: Nicolas Kuhn 
> Signed-off-by: Kenneth Klette Jonassen 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 1/2] Renesas Ethernet AVB driver proper

2015-06-11 Thread David Miller
From: Sergei Shtylyov 
Date: Thu, 11 Jun 2015 01:01:43 +0300

> Ethernet AVB includes an Gigabit Ethernet controller (E-MAC) that is basically
> compatible with SuperH Gigabit Ethernet E-MAC.  Ethernet AVB has  a  dedicated
> direct memory access controller (AVB-DMAC) that is a new design compared to 
> the
> SuperH E-DMAC. The AVB-DMAC is compliant with 3 standards formulated for IEEE
> 802.1BA: IEEE 802.1AS timing and synchronization protocol, IEEE 802.1Qav real-
> time transfer, and the IEEE 802.1Qat stream reservation protocol.
> 
> The  driver only supports device tree probing, so the binding document is
> included in this patch.
> 
> Based on the original patches by Mitsuhiro Kimura.
> 
> Signed-off-by: Mitsuhiro Kimura 
> Signed-off-by: Sergei Shtylyov 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver

2015-06-11 Thread David Miller
From: Sergei Shtylyov 
Date: Thu, 11 Jun 2015 01:02:30 +0300

> Ethernet AVB device includes the gPTP  timer, so we can implement a PTP clock
> driver.  We're doing that in a separate file, with  the main Ethernet driver
> calling the PTP driver's [de]initialization and interrupt handler functions.
> Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when that
> one leaves the operation mode, we have to unregister the PTP clock... :-(
> 
> Based on the original patches by Masaru Nagai.
> 
> Signed-off-by: Masaru Nagai 
> Signed-off-by: Sergei Shtylyov 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Problem with patch "make nlmsg_end() and genlmsg_end() void"

2015-06-11 Thread David Miller
From: David Woodhouse 
Date: Thu, 11 Jun 2015 01:31:28 +0100

> On Tue, 2015-06-09 at 17:49 -0700, Eric Dumazet wrote:
>> > I've added some debugging, and it seems that when it deadlocks, glibc
>> > doesn't get *any* response to its RTM_GETADDR request. I know we'd get
>> > ENOBUFS is a *response* was dropped... but what about when the request
>> > itself is dropped? ... 
>> 
>> Please check that this patch fixes your issue :
>> 
>> http://patchwork.ozlabs.org/patch/473041/
> 
> Looks likely; thanks. I'm running with that patch now. I haven't been
> able to quickly reproduce the problem on demand, but it usually happens
> within a day or two. So it'll be a few days at least before I call it a
> success.

Yeah, and I just sent that to -stable just over a day ago.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver

2015-06-11 Thread David Miller
From: David Miller 
Date: Thu, 11 Jun 2015 00:14:55 -0700 (PDT)

> From: Sergei Shtylyov 
> Date: Thu, 11 Jun 2015 01:02:30 +0300
> 
>> Ethernet AVB device includes the gPTP  timer, so we can implement a PTP clock
>> driver.  We're doing that in a separate file, with  the main Ethernet driver
>> calling the PTP driver's [de]initialization and interrupt handler functions.
>> Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when 
>> that
>> one leaves the operation mode, we have to unregister the PTP clock... :-(
>> 
>> Based on the original patches by Masaru Nagai.
>> 
>> Signed-off-by: Masaru Nagai 
>> Signed-off-by: Sergei Shtylyov 
> 
> Applied.

I had to fix up this patch because:

obj-$(CONFIG_RAVB) += ravb_main.o ravb_ptp.o

Doesn't do what you want it to for the modular case.

You instead need to say something like:

ravb-objs := ravb_main.o ravb_ptp.o

obj-$(CONFIG_RAVB) += ravb.o

and that's how I fixed up this commit before pushing it out.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next V1] net/ethtool: Add current supported tunable options

2015-06-11 Thread Hadar Hen Zion
Add strings array of the current supported tunable options.

Signed-off-by: Hadar Hen Zion 
Reviewed-by: Amir Vadai 
---
Changes from V0:
- s/ETHTOOL_TUNABLE_COUNT/__ETHTOOL_TUNABLE_COUNT/

 include/uapi/linux/ethtool.h |  6 ++
 net/core/ethtool.c   | 12 
 2 files changed, 18 insertions(+)

diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 0594933..cd67aec 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -215,6 +215,11 @@ enum tunable_id {
ETHTOOL_ID_UNSPEC,
ETHTOOL_RX_COPYBREAK,
ETHTOOL_TX_COPYBREAK,
+   /*
+* Add your fresh new tubale attribute above and remember to update
+* tunable_strings[] in net/core/ethtool.c
+*/
+   __ETHTOOL_TUNABLE_COUNT,
 };
 
 enum tunable_type_id {
@@ -545,6 +550,7 @@ enum ethtool_stringset {
ETH_SS_NTUPLE_FILTERS,
ETH_SS_FEATURES,
ETH_SS_RSS_HASH_FUNCS,
+   ETH_SS_TUNABLES,
 };
 
 /**
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index eb0c3ac..b495ab1 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -106,6 +106,13 @@ 
rss_hash_func_strings[ETH_RSS_HASH_FUNCS_COUNT][ETH_GSTRING_LEN] = {
[ETH_RSS_HASH_XOR_BIT] ="xor",
 };
 
+static const char
+tunable_strings[__ETHTOOL_TUNABLE_COUNT][ETH_GSTRING_LEN] = {
+   [ETHTOOL_ID_UNSPEC] = "Unspec",
+   [ETHTOOL_RX_COPYBREAK]  = "rx-copybreak",
+   [ETHTOOL_TX_COPYBREAK]  = "tx-copybreak",
+};
+
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
 {
struct ethtool_gfeatures cmd = {
@@ -194,6 +201,9 @@ static int __ethtool_get_sset_count(struct net_device *dev, 
int sset)
if (sset == ETH_SS_RSS_HASH_FUNCS)
return ARRAY_SIZE(rss_hash_func_strings);
 
+   if (sset == ETH_SS_TUNABLES)
+   return ARRAY_SIZE(tunable_strings);
+
if (ops->get_sset_count && ops->get_strings)
return ops->get_sset_count(dev, sset);
else
@@ -211,6 +221,8 @@ static void __ethtool_get_strings(struct net_device *dev,
else if (stringset == ETH_SS_RSS_HASH_FUNCS)
memcpy(data, rss_hash_func_strings,
   sizeof(rss_hash_func_strings));
+   else if (stringset == ETH_SS_TUNABLES)
+   memcpy(data, tunable_strings, sizeof(tunable_strings));
else
/* ops->get_strings is valid because checked earlier */
ops->get_strings(dev, stringset, data);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] net: phy: davicom: add IDs for DM9161B and C variants

2015-06-11 Thread David Miller
From: Gustavo Zacarias 
Date: Wed, 10 Jun 2015 13:48:20 -0300

> Add PHY IDs for Davicom DM9161B and DM9161C variants.
> Tested with a DM9161C on a custom Atmel-based SAM9X25 board in RMII
> mode.
> 
> The DM9161B uses the same model id with just the LSB bit of the version
> id changing (which is masked out).
> 
> For all intents and purposes they're the same as the DM9161A with an
> added GPSI mode and better fabrication process.
> 
> Signed-off-by: Gustavo Zacarias 

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v2 0/2] net: broadcom MDIO support for broken turn-around

2015-06-11 Thread David Miller
From: Florian Fainelli 
Date: Wed, 10 Jun 2015 12:24:09 -0700

> These two patches update the GENET and UniMAC MDIO controllers to deal with
> PHYs that are known to have a broken turn-around bug (e.g: BCM53125 and 
> others)
> 
> This utilizes the infrastructure that code recently added to do that in 
> 'net-next'.
> 
> Note that the changes look nearly identical and I will try to address the MDIO
> code duplication between GENET and UniMAC in a future patch series.

Ok, series applied, thanks Florian.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next V1] net/ethtool: Add current supported tunable options

2015-06-11 Thread David Miller
From: Hadar Hen Zion 
Date: Thu, 11 Jun 2015 10:28:16 +0300

> Add strings array of the current supported tunable options.
> 
> Signed-off-by: Hadar Hen Zion 
> Reviewed-by: Amir Vadai 
> ---
> Changes from V0:
> - s/ETHTOOL_TUNABLE_COUNT/__ETHTOOL_TUNABLE_COUNT/

Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net/ps3_gelic: Fix build error with DEBUG

2015-06-11 Thread David Miller
From: Geoff Levand 
Date: Wed, 10 Jun 2015 10:19:48 -0700

> When the DEBUG preprocessor macro is defined the ps3_gelic_net driver build
> fails due to an undeclared routine gelic_descr_get_status().  This problem
> was introduced during the code cleanup of commit
> 6b0c21cede22be1f68f0a632c0ca38008ce1abe7 (net: Fix p3_gelic_net sparse 
> warnings),
> which re-arranged the ordering of some of the gelic routines.
> 
> This change just moves the gelic_descr_get_status() routine up in the
> ps3_gelic_net.c source file. There is no functional change.
> 
> Fixes build errors like these:
> 
>   drivers/net/ethernet/toshiba/ps3_gelic_net.c: error: implicit declaration 
> of function gelic_descr_get_status
> 
> Signed-off-by: Geoff Levand 

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] NET: Add ezchip ethernet driver

2015-06-11 Thread Noam Camus
From: Tal Zilcer 

Simple LAN device without multicast support.
Device performance is not high and may be used for
debug or management purposes.
Device supports interrupts for RX and TX end.
Device does not support NAPI and also does not support DMA.
It is used in EZchip NPS devices.

Signed-off-by: Noam Camus 
Signed-off-by: Tal Zilcer 
Acked-by: Alexey Brodkin 
---
 .../devicetree/bindings/net/ezchip_enet.txt|   15 +
 drivers/net/ethernet/Kconfig   |1 +
 drivers/net/ethernet/Makefile  |1 +
 drivers/net/ethernet/ezchip/Kconfig|   29 +
 drivers/net/ethernet/ezchip/Makefile   |1 +
 drivers/net/ethernet/ezchip/nps_enet.c |  597 
 drivers/net/ethernet/ezchip/nps_enet.h |  311 ++
 7 files changed, 955 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ezchip_enet.txt
 create mode 100644 drivers/net/ethernet/ezchip/Kconfig
 create mode 100644 drivers/net/ethernet/ezchip/Makefile
 create mode 100644 drivers/net/ethernet/ezchip/nps_enet.c
 create mode 100644 drivers/net/ethernet/ezchip/nps_enet.h

diff --git a/Documentation/devicetree/bindings/net/ezchip_enet.txt 
b/Documentation/devicetree/bindings/net/ezchip_enet.txt
new file mode 100644
index 000..d2bf9ab
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ezchip_enet.txt
@@ -0,0 +1,15 @@
+* EZchip NPS ENET 10/100 Ethernet driver (ENET)
+
+Required properties:
+- compatible: Should be "ezchip,nps-enet"
+- reg: Address and length of the register set for the device
+- interrupts: Should contain the ENET interrupt
+
+Examples:
+
+   ethernet@f0003000 {
+   compatible = "ezchip,nps-enet";
+   reg = <0xf0003000 0x44>;
+   interrupts = <7>;
+   mac-address = [ 00 11 22 33 44 55 ];
+   };
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index eadcb05..1a6b1ba 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -66,6 +66,7 @@ config DNET
 source "drivers/net/ethernet/dec/Kconfig"
 source "drivers/net/ethernet/dlink/Kconfig"
 source "drivers/net/ethernet/emulex/Kconfig"
+source "drivers/net/ethernet/ezchip/Kconfig"
 source "drivers/net/ethernet/neterion/Kconfig"
 source "drivers/net/ethernet/faraday/Kconfig"
 source "drivers/net/ethernet/freescale/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 1367afc..489f9cc 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_DNET) += dnet.o
 obj-$(CONFIG_NET_VENDOR_DEC) += dec/
 obj-$(CONFIG_NET_VENDOR_DLINK) += dlink/
 obj-$(CONFIG_NET_VENDOR_EMULEX) += emulex/
+obj-$(CONFIG_NET_VENDOR_EZCHIP) += ezchip/
 obj-$(CONFIG_NET_VENDOR_EXAR) += neterion/
 obj-$(CONFIG_NET_VENDOR_FARADAY) += faraday/
 obj-$(CONFIG_NET_VENDOR_FREESCALE) += freescale/
diff --git a/drivers/net/ethernet/ezchip/Kconfig 
b/drivers/net/ethernet/ezchip/Kconfig
new file mode 100644
index 000..e830d2e
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/Kconfig
@@ -0,0 +1,29 @@
+#
+# EZchip network device configuration
+#
+
+config NET_VENDOR_EZCHIP
+   bool "EZchip devices"
+   default y
+   ---help---
+ If you have a network (Ethernet) device belonging to this class, say Y
+ and read the Ethernet-HOWTO, available from
+ .
+
+ Note that the answer to this question doesn't directly affect the
+ kernel: saying N will just cause the configurator to skip all
+ the questions about EZchip devices. If you say Y, you will be asked 
for
+ your specific device in the following questions.
+
+if NET_VENDOR_EZCHIP
+
+config EZCHIP_NPS_LAN
+   tristate "EZchip NPS LAN support"
+   ---help---
+ Simple LAN device without multicast support.
+ Device performance is not high and may be used for
+ debug or management purposes.
+ Device supports interrupts for RX and TX(end).
+ Device does not support NAPI and also does not support DMA.
+
+endif
diff --git a/drivers/net/ethernet/ezchip/Makefile 
b/drivers/net/ethernet/ezchip/Makefile
new file mode 100644
index 000..806e13d
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EZCHIP_NPS_LAN) += nps_enet.o
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c 
b/drivers/net/ethernet/ezchip/nps_enet.c
new file mode 100644
index 000..00f115a
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -0,0 +1,597 @@
+/*
+ * Copyright(c) 2015 EZchip Technologies.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY;

[patch -next] net/mlx5_core: fix an error code

2015-06-11 Thread Dan Carpenter
We return success if mlx5e_alloc_sq_db() fails but we should return an
error code.

Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet 
functionality')
Signed-off-by: Dan Carpenter 

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 7348c51..075e517 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -525,7 +525,8 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
sq->uar_map = sq->uar.map;
sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
 
-   if (mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu)))
+   err = mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu));
+   if (err)
goto err_sq_wq_destroy;
 
sq->txq = netdev_get_tx_queue(priv->netdev,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/12] fsl/fman: Add Frame Manager support

2015-06-11 Thread Paul Bolle
You should note that I started with scanning this patch for basic, say,
build system issues. Which I did find. But then I kept spotting all kind
of oddities. After a while I stopped looking closely. So, to note
something, I haven't yet looked into the 24 symbols this series exports.
There might be a reason for all 24 of them, but I just thought it a bit
suspect.

But, anyhow, my guess is this series needs a close look or two before
the people understanding ethernet drivers (I'm not one of them) will
consider reviewing it for more substantial issues.

On Wed, 2015-06-10 at 18:21 +0300, Madalin Bucur wrote:
> --- a/drivers/net/ethernet/freescale/fman/Kconfig
> +++ b/drivers/net/ethernet/freescale/fman/Kconfig
 
> +if FSL_FMAN
> +
> +config FSL_FM_MAX_FRAME_SIZE
> + int "Maximum L2 frame size"
> + depends on FSL_FMAN

This dependency is already provided through "if FSL_MAN" above.

> + range 64 9600
> + default "1522"
> + help
> + Configure this in relation to the maximum possible MTU of your
> + network configuration. In particular, one would need to
> + increase this value in order to use jumbo frames.
> + FSL_FM_MAX_FRAME_SIZE must accommodate the Ethernet FCS
> + (4 bytes) and one ETH+VLAN header (18 bytes), to a total of
> + 22 bytes in excess of the desired L3 MTU.
> +
> + Note that having too large a FSL_FM_MAX_FRAME_SIZE (much larger
> + than the actual MTU) may lead to buffer exhaustion, especially
> + in the case of badly fragmented datagrams on the Rx path.
> + Conversely, having a FSL_FM_MAX_FRAME_SIZE smaller than the
> + actual MTU will lead to frames being dropped.
> +
> +config FSL_FM_RX_EXTRA_HEADROOM
> + int "Add extra headroom at beginning of data buffers"
> + depends on FSL_FMAN

Ditto.

> + range 16 384
> + default "64"
> + help
> + Configure this to tell the Frame Manager to reserve some extra
> + space at the beginning of a data buffer on the receive path,
> + before Internal Context fields are copied. This is in addition
> + to the private data area already reserved for driver internal
> + use. The provided value must be a multiple of 16.
> +
> + This option does not affect in any way the layout of
> + transmitted buffers.
> +
> +endif# FSL_FMAN

> --- a/drivers/net/ethernet/freescale/fman/Makefile
> +++ b/drivers/net/ethernet/freescale/fman/Makefile
>  
>  obj-y+= fsl_fman.o
>  
> -fsl_fman-objs:= fman.o fm_muram.o
> +fsl_fman-objs:= fman.o fm_muram.o fm.o fm_drv.o

> --- /dev/null
> +++ b/drivers/net/ethernet/freescale/fman/fm.c

> +/* static functions */

There's no need to tell us that.

> +static int check_fm_parameters(struct fm_t *p_fm)
> +{

> +#ifdef FM_AID_MODE_NO_TNUM_SW005

I think this is always defined (I already deleted that part of the
patch, so perhaps I'm missing some subtle issue).

> + if (p_fm->p_fm_state_struct->rev_info.major_rev >= 6 &&
> + p_fm->p_fm_drv_param->dma_aid_mode !=
> + E_FMAN_DMA_AID_OUT_PORT_ID) {
> + pr_err("dma_aid_mode not supported by this 
> integration.\n");
> + return -EDOM;
> + }
> +#endif /* FM_AID_MODE_NO_TNUM_SW005 */

> +#ifdef FM_HAS_TOTAL_DMAS

Ditto.

> + if ((p_fm->p_fm_state_struct->rev_info.major_rev < 6) &&
> + (!p_fm->p_fm_state_struct->max_num_of_open_dmas ||
> +  (p_fm->p_fm_state_struct->max_num_of_open_dmas >
> + p_fm->intg->bmi_max_num_of_dmas))) {
> + pr_err("max_num_of_open_dmas number has to be in the range 1 - 
> %d\n",
> +p_fm->intg->bmi_max_num_of_dmas);
> + return -EDOM;
> + }
> +#endif /* FM_HAS_TOTAL_DMAS */

> +#ifdef FM_NO_WATCHDOG

Ditto. I'll stop checking for this stuff now. Please clean them up (or
show me that I'm wrong).

> + if ((p_fm->p_fm_state_struct->rev_info.major_rev == 2) &&
> + (p_fm->p_fm_drv_param->dma_watchdog)) {
> + pr_err("watchdog!\n");
> + return -EINVAL;
> + }
> +#endif /* FM_NO_WATCHDOG */

> +/* fm_init
> + *
> + *  Initializes the FM module
> + *
> + * @Param[in] p_fm - FM module descriptor
> + *
> + * @Return0 on success; Error code otherwise.
> + */

I know little about kerneldoc, but this is not kerneldoc, right?

> +/* fm_free
> + * Frees all resources that were assigned to FM module.
> + * Calling this routine invalidates the descriptor.
> + * p_fm - FM module descriptor
> + *Return0 on success; Error code otherwise.
> + */

Ditto.

> +void fm_event_isr(struct fm_t *p_fm)
> +{
> +#define FM_M_CALL_MAC_ISR(_id)\
> + (p_fm->intr_mng[(enum fm_inter_module_event)(FM_EV_MAC0 + _id)]. \
> + f_isr(p_fm->intr_mng[(enum fm_inter_module_event)(FM_EV_MAC0

Re: [RFC 00/10] NFS: add AF_VSOCK support to NFS client

2015-06-11 Thread Stefan Hajnoczi
On Wed, Jun 10, 2015 at 02:09:26PM -0400, J. Bruce Fields wrote:
> On Wed, Jun 10, 2015 at 05:43:15PM +0100, Stefan Hajnoczi wrote:
> > These are all at the SUNRPC level rather than at the NFS protocol level.
> > 
> > Any idea who I need to talk to?
> 
> Anyay, if there is anything to be worked out, nf...@ietf.org is the
> place to go.

Thanks, I can write a summary and send it there.

Stefan


pgpFWaqBobsIi.pgp
Description: PGP signature


Re: isdn: pcbit: another off-by-one issue?

2015-06-11 Thread Rasmus Villemoes
[adding some emails I should Cc'ed in the first place]

On Thu, Jun 11 2015, Dan Carpenter  wrote:

> On Wed, Jun 10, 2015 at 09:50:53PM +0200, Rasmus Villemoes wrote:
>> Hi Dan
>> 
>> You were last to touch drivers/isdn/pcbit/drv.c (7bcc6738eef), but I
>> think there may still be an off-by-one in pcbit_set_msn: At the end of
>> the loop, sp is incremented by len, but if the string contained a comma,
>> sp will now point at that. At that point, we seem to be stuck in an
>> infinite loop where we'll always get cp==sp and len==0, until we run out
>> of memory.
>> 
>> Am I reading this completely wrong?
>
> Nope.  You're right.  That bug has been there since before the start of
> git.  We could fix it by doing:
>
> diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
> index 4172e22..b156d5b 100644
> --- a/drivers/isdn/pcbit/drv.c
> +++ b/drivers/isdn/pcbit/drv.c
> @@ -1053,7 +1053,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char 
> *list)
>   else
>   back->next = ptr;
>   back = ptr;
> - sp += len;
> + sp += len + 1;
>   } while (cp);
>  }

Yep, that's also what I would do. 

Since nobody seems to have been hit by this ever, I wonder whether it's
stable@ material. It probably doesn't make sense to fix this without
also backporting 7bcc6738eef.

Rasmus
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/12] fsl/fman: Add Frame Manager support

2015-06-11 Thread Paul Bolle
So I couldn't help having yet another look at the code, just to drive
home my point.

On Thu, 2015-06-11 at 10:55 +0200, Paul Bolle wrote:
> > +void *fm_drv_init(void)
> 
> static.
> 
> > +{
> > +   memset(&fm_drvs, 0, sizeof(fm_drvs));

fm_drvs is an external variable. It is guaranteed to be zero, isn't it?

> > +   mutex_init(&fm_drv_mutex);
> > +
> > +   /* Register to the DTB for basic FM API */
> > +   platform_driver_register(&fm_driver);
> > +
> > +   return &fm_drvs;

You're returning a pointer to external variable. How's that useful?

And note this is the last time we'll ever see fm_drvs. So I think that
all this variable does for the code is getting initialized to zero,
twice.

> > +}
> > +
> > +int fm_drv_free(void *p_fm_drv)
> 
> static.
> 
> > +{
> > +   platform_driver_unregister(&fm_driver);
> > +   mutex_destroy(&fm_drv_mutex);
> > +
> > +   return 0;

This function has one caller, which doesn't check the return value. So
this should be a function returning void. Of course, a wrapper of two
lines called only once means you should actually not put this into a
separate function.

> > +}

> > +static void *p_fm_drv;
> 
> > +static int __init __cold fm_load(void)
> > +{
> > +   p_fm_drv = fm_drv_init();
> > +   if (!p_fm_drv) {

fm_drv_init() returns a pointer to an external variable. So how can this
happen?

> > +   pr_err("Failed to init FM wrapper!\n");
> > +   return -ENODEV;
> > +   }
> > +
> > +   pr_info("Freescale FM module\n");
> > +   return 0;
> > +}

This is all rather basic. It must be, otherwise I wouldn't spot it.

So I keep spotting these basic oddities, with every cup of coffee I
treat myself to while reading through this, wherever I look. By now I'm
sure there's no need for the netdev people to look at this, not yet. 


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*

2015-06-11 Thread Ivan Vecera

On 06/10/2015 10:29 PM, Joe Perches wrote:

On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote:

Signed-off-by: Ivan Vecera 


There should be some indication a few messages have
been deleted in the commit log and a reason why too.


diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
b/drivers/net/ethernet/brocade/bna/bnad.c

[]

@@ -965,10 +964,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
/*
 * Force an immediate
 * Transmit Schedule */
-   printk(KERN_INFO "bna: %s %d "
- "TXQ_STARTED\n",
-  bnad->netdev->name,
-  txq_id);


[]


@@ -1057,8 +1051,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx)
txq_id = tcb->id;
clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags);
netif_stop_subqueue(bnad->netdev, txq_id);
-   printk(KERN_INFO "bna: %s %d TXQ_STOPPED\n",
-   bnad->netdev->name, txq_id);


etc...

I'm sorry I have removed them as logging noise. IMHO it is not necessary 
to log when .probe() and .remove() are called or when TxQ is started or 
stopped.


Ivan
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH] net: Add sock_common_listen for TCP and DCCP

2015-06-11 Thread Firo Yang
Code refactoring:
1. Move the common code of inet_listen() and inet_dccp_listen() to
sock_common_listen().
Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen().

2. Modify and rename inet_listen() to tcp_listen().

3. Modify and rename inet_dccp_listen() to dccp_listen().

4. Add new callback pointer listen in struct proto for
tcp_listen() and dccp_listen().

This patch makes codes more modularized and removes redudant codes.

Signed-off-by: Firo Yang 
---
I test it on my x86 pc.

 include/net/sock.h  | 18 
 include/net/tcp.h   |  1 +
 net/core/sock.c | 36 +++
 net/dccp/dccp.h |  2 +-
 net/dccp/ipv4.c |  4 ++--
 net/dccp/ipv6.c |  3 ++-
 net/dccp/proto.c| 62 -
 net/ipv4/af_inet.c  | 58 +
 net/ipv4/tcp.c  | 35 ++
 net/ipv4/tcp_ipv4.c |  1 +
 net/ipv6/af_inet6.c |  2 +-
 net/ipv6/tcp_ipv6.c |  1 +
 12 files changed, 118 insertions(+), 105 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 26c1c31..5adc7f4 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -934,6 +934,7 @@ struct proto {
int (*connect)(struct sock *sk,
struct sockaddr *uaddr,
int addr_len);
+   int (*listen)(struct sock *sk, int backlog);
int (*disconnect)(struct sock *sk, int flags);
 
struct sock *   (*accept)(struct sock *sk, int flags, int *err);
@@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int 
size);
 #define SOCK_BINDADDR_LOCK 4
 #define SOCK_BINDPORT_LOCK 8
 
+/*
+ * Sock common state
+ * These values must be enqual to correspondent TCP state
+ * and DCCP state.
+ */
+enum {
+   SOCK_CLOSE  = TCP_CLOSE,
+   SOCK_LISTEN = TCP_LISTEN
+};
+
+enum {
+   SOCKF_CLOSE = TCPF_CLOSE,
+   SOCKF_LISTEN= TCPF_LISTEN,
+};
+
 struct socket_alloc {
struct socket socket;
struct inode vfs_inode;
@@ -1587,6 +1603,8 @@ int compat_sock_common_setsockopt(struct socket *sock, 
int level,
 
 void sk_common_release(struct sock *sk);
 
+int sock_common_listen(struct socket *sock, int backlog);
+
 /*
  * Default socket callbacks and setup code
  */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 978cebe..70d3f64 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -434,6 +434,7 @@ int compat_tcp_setsockopt(struct sock *sk, int level, int 
optname,
  char __user *optval, unsigned int optlen);
 void tcp_set_keepalive(struct sock *sk, int val);
 void tcp_syn_ack_timeout(const struct request_sock *req);
+int tcp_listen(struct sock *sk, int backlog);
 int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
int flags, int *addr_len);
 void tcp_parse_options(const struct sk_buff *skb,
diff --git a/net/core/sock.c b/net/core/sock.c
index e72633c..8016a1e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2559,6 +2559,42 @@ int sock_common_recvmsg(struct socket *sock, struct 
msghdr *msg, size_t size,
 EXPORT_SYMBOL(sock_common_recvmsg);
 
 /*
+ * Move a socket into listening state.
+ */
+int sock_common_listen(struct socket *sock, int backlog)
+{
+   struct sock *sk = sock->sk;
+   unsigned char old_state;
+   int err;
+
+   lock_sock(sk);
+
+   err = -EINVAL;
+   if (sock->state != SS_UNCONNECTED)
+   goto out;
+
+   old_state = sk->sk_state;
+   if (!((1 << old_state) & (SOCKF_CLOSE | SOCKF_LISTEN)))
+   goto out;
+
+   /* Really, if the socket is already in listen state
+* we can only allow the backlog to be adjusted.
+*/
+   if (old_state != SOCK_LISTEN) {
+   err = sk->sk_prot->listen(sk, backlog);
+   if (err)
+   goto out;
+   }
+   sk->sk_max_ack_backlog = backlog;
+   err = 0;
+
+out:
+   release_sock(sk);
+   return err;
+}
+EXPORT_SYMBOL(sock_common_listen);
+
+/*
  * Set socket options on an inet socket.
  */
 int sock_common_setsockopt(struct socket *sock, int level, int optname,
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index bebc735..5a5acbb 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -313,7 +313,7 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, 
size_t size);
 int dccp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
 int flags, int *addr_len);
 void dccp_shutdown(struct sock *sk, int how);
-int inet_dccp_listen(struct socket *sock, int backlog);
+int dccp_listen(struct sock *sk, int backlog);
 unsigned int dccp_poll(struct file *file, struct socket *sock,
   poll_table *wait);
 int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_

Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops

2015-06-11 Thread Andy Gospodarek
On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote:
> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
>  wrote:
> > Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are
> > reachable via an interface where carrier is off.  No action is taken,
> > but additional flags are passed to userspace to indicate carrier status.
> 
> Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar
> and I'm wondering if this could be done without introducing a new flag
> and just use RTNH_F_DEAD.  The link change event would set RTNH_F_DEAD
> on nh on dev link down, and clear on link up.  The sysctl knob would
> be something like "nexthop_dead_on_linkdown", default off.  So
> basically expanding the ways RTNH_F_DEAD can be set.  That would
> simplify the patch set quite a bit and require no changes to iproute2.
> 

You are absolutely correct that what you describe would be less churn to
userspace.  From a functionality standpoint that is close to what was
originally proposed, but Alex specifically did not like the behavioral
change to what having RTNH_F_DEAD set (at least that was what I
understood).

That was what made me make the move to add this additional flag that was
exported to userspace, so it was possible to differentiate the old dead
routes/nexthop functionality from those that were not going to be dead
due to link being down.  

At this point I think I prefer the additional data provided by the new
flag exported to userspace.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch -next] net/mlx5_core: fix an error code

2015-06-11 Thread Or Gerlitz
On Thu, Jun 11, 2015 at 11:50 AM, Dan Carpenter
 wrote:
> We return success if mlx5e_alloc_sq_db() fails but we should return an
> error code.
>
> Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4 
> Ethernet functionality')
> Signed-off-by: Dan Carpenter 
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
> b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index 7348c51..075e517 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -525,7 +525,8 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
> sq->uar_map = sq->uar.map;
> sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
>
> -   if (mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu)))
> +   err = mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu));
> +   if (err)
> goto err_sq_wq_destroy;
>
> sq->txq = netdev_get_tx_queue(priv->netdev,

Dan, nice catch, the team here just handed me the same fix, but you
submitted 1st...

Acked-by: Or Gerlitz 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: isdn: pcbit: another off-by-one issue?

2015-06-11 Thread Paul Bolle
On Thu, 2015-06-11 at 11:28 +0200, Rasmus Villemoes wrote:
> Since nobody seems to have been hit by this ever, I wonder whether it's
> stable@ material. It probably doesn't make sense to fix this without
> also backporting 7bcc6738eef.

I'm guessing nobody is using this anymore. I would be really surprised
if anyone is. Let's test my idea. Hands up anyone that has:
- a PCBIT ISDN-card ("manufactured in Portugal by Octal", according to
  its Kconfig entry);
- a working X86 machine with ISA;
- a working ISDN line;
- and, say, an ISP picking up the stuff you send down that ISDN line
  at the other end;
- and cares how 2.6.32 (and higher) runs that setup.

[Crickets.]

Besides, it is, apparently, an I4L driver. (Though there's a CAPI part
too. I need to check how that fits into the picture.) I4L is deprecated
for ten years now (or is it even longer?).

Perhaps pcbit, and the other I4L drivers, should be (finally) tossed
out? That was discussed last year too, but nothing really was decided.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/7] net/mlx5e: Add HW cacheline start padding

2015-06-11 Thread Or Gerlitz
From: Saeed Mahameed 

Enable HW cacheline start padding and align RX WQE size to cacheline
while considering HW start padding. Also, fix dma_unmap call to use
the correct SKB data buffer size.

Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |5 -
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   |   10 +-
 include/linux/mlx5/device.h   |4 
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index f9fdeac..95772dc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -309,12 +309,15 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
 
rq->wqe_sz = (priv->params.lro_en) ? priv->params.lro_wqe_sz :
 MLX5E_SW2HW_MTU(priv->netdev->mtu);
+   rq->wqe_sz = SKB_DATA_ALIGN(rq->wqe_sz + MLX5E_NET_IP_ALIGN);
 
for (i = 0; i < wq_sz; i++) {
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i);
+   u32 byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN;
 
wqe->data.lkey   = c->mkey_be;
-   wqe->data.byte_count = cpu_to_be32(rq->wqe_sz);
+   wqe->data.byte_count =
+   cpu_to_be32(byte_count | MLX5_HW_START_PADDING);
}
 
rq->pdev= c->pdev;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index ce1317c..06e7c74 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -45,18 +45,18 @@ static inline int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq,
if (unlikely(!skb))
return -ENOMEM;
 
-   skb_reserve(skb, MLX5E_NET_IP_ALIGN);
-
dma_addr = dma_map_single(rq->pdev,
  /* hw start padding */
- skb->data - MLX5E_NET_IP_ALIGN,
- /* hw   end padding */
+ skb->data,
+ /* hw end padding */
  rq->wqe_sz,
  DMA_FROM_DEVICE);
 
if (unlikely(dma_mapping_error(rq->pdev, dma_addr)))
goto err_free_skb;
 
+   skb_reserve(skb, MLX5E_NET_IP_ALIGN);
+
*((dma_addr_t *)skb->cb) = dma_addr;
wqe->data.addr = cpu_to_be64(dma_addr + MLX5E_NET_IP_ALIGN);
 
@@ -217,7 +217,7 @@ bool mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget)
 
dma_unmap_single(rq->pdev,
 *((dma_addr_t *)skb->cb),
-skb_end_offset(skb),
+rq->wqe_sz,
 DMA_FROM_DEVICE);
 
if (unlikely((cqe->op_own >> 4) != MLX5_CQE_RESP_SEND)) {
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index b2c4350..b943cd9 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -132,6 +132,10 @@ enum {
 };
 
 enum {
+   MLX5_HW_START_PADDING = MLX5_INLINE_SEG,
+};
+
+enum {
MLX5_MIN_PKEY_TABLE_SIZE = 128,
MLX5_MAX_LOG_PKEY_TABLE  = 5,
 };
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 1/7] net/mlx5e: Fix HW MTU settings

2015-06-11 Thread Or Gerlitz
From: Saeed Mahameed 

Previously we configured HW MTU to be netdev->mtu, actually we
need to configure netdev->mtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN).

Also, query MTU can not fail, hence make the relevant helper a
void functionm, add mlx5e_set_dev_port_mtu, helper function to
handle MTU setting.

Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/infiniband/hw/mlx5/main.c |8 +--
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |1 -
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   61 +++--
 drivers/net/ethernet/mellanox/mlx5/core/port.c|   36 +---
 include/linux/mlx5/driver.h   |   10 ++--
 5 files changed, 55 insertions(+), 61 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index d4dea86..79dadd6 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -446,15 +446,11 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, 
u8 port,
if (err)
goto out;
 
-   err = mlx5_query_port_max_mtu(mdev, &max_mtu, port);
-   if (err)
-   goto out;
+   mlx5_query_port_max_mtu(mdev, &max_mtu, port);
 
props->max_mtu = mlx5_mtu_to_ib_mtu(max_mtu);
 
-   err = mlx5_query_port_oper_mtu(mdev, &oper_mtu, port);
-   if (err)
-   goto out;
+   mlx5_query_port_oper_mtu(mdev, &oper_mtu, port);
 
props->active_mtu = mlx5_mtu_to_ib_mtu(oper_mtu);
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index e9edb72..71f38bb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -57,7 +57,6 @@
 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS  0x20
 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES0x80
 #define MLX5E_PARAMS_DEFAULT_RX_HASH_LOG_TBL_SZ 0x7
-#define MLX5E_PARAMS_MIN_MTU46
 
 #define MLX5E_TX_CQ_POLL_BUDGET128
 #define MLX5E_UPDATE_STATS_INTERVAL200 /* msecs */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 7348c51..f9fdeac 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -277,6 +277,9 @@ static void mlx5e_send_nop(struct mlx5e_sq *sq)
mlx5e_tx_notify_hw(sq, wqe);
 }
 
+#define MLX5E_HW2SW_MTU(hwmtu) (hwmtu - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
+#define MLX5E_SW2HW_MTU(swmtu) (swmtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
+
 static int mlx5e_create_rq(struct mlx5e_channel *c,
   struct mlx5e_rq_param *param,
   struct mlx5e_rq *rq)
@@ -305,7 +308,7 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
}
 
rq->wqe_sz = (priv->params.lro_en) ? priv->params.lro_wqe_sz :
-   priv->netdev->mtu + ETH_HLEN + VLAN_HLEN;
+MLX5E_SW2HW_MTU(priv->netdev->mtu);
 
for (i = 0; i < wq_sz; i++) {
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i);
@@ -1366,11 +1369,30 @@ static void mlx5e_close_tirs(struct mlx5e_priv *priv)
mlx5e_close_tir(priv, i);
 }
 
-int mlx5e_open_locked(struct net_device *netdev)
+static int mlx5e_set_dev_port_mtu(struct net_device *netdev)
 {
struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5_core_dev *mdev = priv->mdev;
-   int actual_mtu;
+   int hw_mtu;
+   int err;
+
+   err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(netdev->mtu), 1);
+   if (err)
+   return err;
+
+   mlx5_query_port_oper_mtu(mdev, &hw_mtu, 1);
+
+   if (MLX5E_HW2SW_MTU(hw_mtu) != netdev->mtu)
+   netdev_warn(netdev, "%s: Port MTU %d is different than netdev 
mtu %d\n",
+   __func__, MLX5E_HW2SW_MTU(hw_mtu), netdev->mtu);
+
+   netdev->mtu = MLX5E_HW2SW_MTU(hw_mtu);
+   return 0;
+}
+
+int mlx5e_open_locked(struct net_device *netdev)
+{
+   struct mlx5e_priv *priv = netdev_priv(netdev);
int num_txqs;
int err;
 
@@ -1379,25 +1401,9 @@ int mlx5e_open_locked(struct net_device *netdev)
netif_set_real_num_tx_queues(netdev, num_txqs);
netif_set_real_num_rx_queues(netdev, priv->params.num_channels);
 
-   err = mlx5_set_port_mtu(mdev, netdev->mtu);
-   if (err) {
-   netdev_err(netdev, "%s: mlx5_set_port_mtu failed %d\n",
-  __func__, err);
+   err = mlx5e_set_dev_port_mtu(netdev);
+   if (err)
return err;
-   }
-
-   err = mlx5_query_port_oper_mtu(mdev, &actual_mtu, 1);
-   if (err) {
-   netdev_err(netdev, "%s: mlx5_query_port_oper_mtu failed %d\n",
-  __func__, err);
-   return err;
-   }
-
- 

[PATCH net-next 4/7] net/mlx5e: Enforce max flow-tables level >= 3

2015-06-11 Thread Or Gerlitz
From: Gal Pressman 

The Ethernet driver requires at least 3 flow table levels to
operate, enforce that.

Signed-off-by: Gal Pressman 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3cba6a6..1a655fd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1662,7 +1662,10 @@ static int mlx5e_check_required_hca_cap(struct 
mlx5_core_dev *mdev)
!MLX5_CAP_ETH(mdev, csum_cap) ||
!MLX5_CAP_ETH(mdev, max_lso_cap) ||
!MLX5_CAP_ETH(mdev, vlan_cap) ||
-   !MLX5_CAP_ETH(mdev, rss_ind_tbl_cap)) {
+   !MLX5_CAP_ETH(mdev, rss_ind_tbl_cap) ||
+   MLX5_CAP_FLOWTABLE(mdev,
+  flow_table_properties_nic_receive.max_ft_level)
+  < 3) {
mlx5_core_warn(mdev,
   "Not creating net device, some required device 
capabilities are missing\n");
return -ENOTSUPP;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 7/7] net/mlx5e: Add transport domain to the ethernet TIRs/TISs

2015-06-11 Thread Or Gerlitz
From: Achiad Shochat 

Allocate and use transport domain by the Ethernet driver code.

Signed-off-by: Achiad Shochat 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   16 +++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 23cc3bf..e14120e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -389,6 +389,7 @@ struct mlx5e_priv {
struct mutex   state_lock; /* Protects Interface state */
struct mlx5_uarcq_uar;
u32pdn;
+   u32tdn;
struct mlx5_core_mrmr;
 
struct mlx5e_channel **channel;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5458cc6..4e8b0c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1101,6 +1101,7 @@ static int mlx5e_open_tis(struct mlx5e_priv *priv, int tc)
memset(in, 0, sizeof(in));
 
MLX5_SET(tisc, tisc, prio,  tc);
+   MLX5_SET(tisc, tisc, transport_domain, priv->tdn);
 
return mlx5_core_create_tis(mdev, in, sizeof(in), &priv->tisn[tc]);
 }
@@ -1199,6 +1200,8 @@ static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, 
u32 *tirc, int tt)
 {
void *hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer);
 
+   MLX5_SET(tirc, tirc, transport_domain, priv->tdn);
+
 #define ROUGH_MAX_L2_L3_HDR_SZ 256
 
 #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP   |\
@@ -1818,11 +1821,18 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev 
*mdev)
goto err_unmap_free_uar;
}
 
+   err = mlx5_alloc_transport_domain(mdev, &priv->tdn);
+   if (err) {
+   netdev_err(netdev, "%s: mlx5_alloc_transport_domain failed, 
%d\n",
+  __func__, err);
+   goto err_dealloc_pd;
+   }
+
err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr);
if (err) {
netdev_err(netdev, "%s: mlx5e_create_mkey failed, %d\n",
   __func__, err);
-   goto err_dealloc_pd;
+   goto err_dealloc_transport_domain;
}
 
err = register_netdev(netdev);
@@ -1839,6 +1849,9 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev 
*mdev)
 err_destroy_mkey:
mlx5_core_destroy_mkey(mdev, &priv->mr);
 
+err_dealloc_transport_domain:
+   mlx5_dealloc_transport_domain(mdev, priv->tdn);
+
 err_dealloc_pd:
mlx5_core_dealloc_pd(mdev, priv->pdn);
 
@@ -1858,6 +1871,7 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev 
*mdev, void *vpriv)
 
unregister_netdev(netdev);
mlx5_core_destroy_mkey(priv->mdev, &priv->mr);
+   mlx5_dealloc_transport_domain(priv->mdev, priv->tdn);
mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
mlx5e_disable_async_events(priv);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 0/7] mlx5 Ethernet driver update - Jun 11 2015

2015-06-11 Thread Or Gerlitz
Hi Dave,

This series from Saeed, Achiad and Gal contains few fixes
to the recently introduced mlx5 Ethernet functionality.

Or.

Achiad Shochat (2):
  net/mlx5_core: Add transport domain alloc/dealloc support
  net/mlx5e: Add transport domain to the ethernet TIRs/TISs

Gal Pressman (1):
  net/mlx5e: Enforce max flow-tables level >= 3

Saeed Mahameed (4):
  net/mlx5e: Fix HW MTU settings
  net/mlx5e: Add HW cacheline start padding
  net/mlx5e: Disable client vlan TX acceleration
  net/mlx5e: Support NETIF_F_SG

 drivers/infiniband/hw/mlx5/main.c  |8 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h   |5 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  112 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c|   10 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c|   58 ++
 drivers/net/ethernet/mellanox/mlx5/core/port.c |   36 +++
 drivers/net/ethernet/mellanox/mlx5/core/transobj.c |   35 ++
 drivers/net/ethernet/mellanox/mlx5/core/transobj.h |2 +
 include/linux/mlx5/device.h|4 +
 include/linux/mlx5/driver.h|   10 +-
 10 files changed, 166 insertions(+), 114 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 6/7] net/mlx5_core: Add transport domain alloc/dealloc support

2015-06-11 Thread Or Gerlitz
From: Achiad Shochat 

Each transport object, namely TIR and TIS, must have a transport domain
number (TDN) identifier.

The driver wrongly assumed that it is OK to use TDN=0 without explicit
TDN allocation from the device.

The TDN will also be used for isolating different processes once user
mode Ethernet will be supported.

Signed-off-by: Achiad Shochat 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/transobj.c |   35 
 drivers/net/ethernet/mellanox/mlx5/core/transobj.h |2 +
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c 
b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
index 7a12028..8d98b03 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
@@ -34,6 +34,41 @@
 #include "mlx5_core.h"
 #include "transobj.h"
 
+int mlx5_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn)
+{
+   u32 in[MLX5_ST_SZ_DW(alloc_transport_domain_in)];
+   u32 out[MLX5_ST_SZ_DW(alloc_transport_domain_out)];
+   int err;
+
+   memset(in, 0, sizeof(in));
+   memset(out, 0, sizeof(out));
+
+   MLX5_SET(alloc_transport_domain_in, in, opcode,
+MLX5_CMD_OP_ALLOC_TRANSPORT_DOMAIN);
+
+   err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
+   if (!err)
+   *tdn = MLX5_GET(alloc_transport_domain_out, out,
+   transport_domain);
+
+   return err;
+}
+
+void mlx5_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn)
+{
+   u32 in[MLX5_ST_SZ_DW(dealloc_transport_domain_in)];
+   u32 out[MLX5_ST_SZ_DW(dealloc_transport_domain_out)];
+
+   memset(in, 0, sizeof(in));
+   memset(out, 0, sizeof(out));
+
+   MLX5_SET(dealloc_transport_domain_in, in, opcode,
+MLX5_CMD_OP_DEALLOC_TRANSPORT_DOMAIN);
+   MLX5_SET(dealloc_transport_domain_in, in, transport_domain, tdn);
+
+   mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
+}
+
 int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen, u32 
*rqn)
 {
u32 out[MLX5_ST_SZ_DW(create_rq_out)];
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.h 
b/drivers/net/ethernet/mellanox/mlx5/core/transobj.h
index 90322c1..f9ef244 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.h
@@ -33,6 +33,8 @@
 #ifndef __TRANSOBJ_H__
 #define __TRANSOBJ_H__
 
+int mlx5_alloc_transport_domain(struct mlx5_core_dev *dev, u32 *tdn);
+void mlx5_dealloc_transport_domain(struct mlx5_core_dev *dev, u32 tdn);
 int mlx5_core_create_rq(struct mlx5_core_dev *dev, u32 *in, int inlen,
u32 *rqn);
 int mlx5_core_modify_rq(struct mlx5_core_dev *dev, u32 rqn, u32 *in, int 
inlen);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 3/7] net/mlx5e: Disable client vlan TX acceleration

2015-06-11 Thread Or Gerlitz
From: Saeed Mahameed 

We need to resolve a HW configuration issue for enabling HW CVLAN
insertion. Meanwhile, no need to implement the VLAN insertion in
the driver, rather use the generic kernel VLAN insertion method.

Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |1 -
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   |   23 +---
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 95772dc..3cba6a6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1755,7 +1755,6 @@ static void mlx5e_build_netdev(struct net_device *netdev)
netdev->vlan_features|= NETIF_F_LRO;
 
netdev->hw_features   = netdev->vlan_features;
-   netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_TX;
netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_RX;
netdev->hw_features  |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 8020986..3cfd2bc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -89,21 +89,6 @@ static inline u16 mlx5e_get_inline_hdr_size(struct mlx5e_sq 
*sq,
return MLX5E_MIN_INLINE;
 }
 
-static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
-{
-   struct vlan_ethhdr *vhdr = (struct vlan_ethhdr *)start;
-   int cpy1_sz = 2 * ETH_ALEN;
-   int cpy2_sz = ihs - cpy1_sz - VLAN_HLEN;
-
-   skb_copy_from_linear_data(skb, vhdr, cpy1_sz);
-   skb_pull_inline(skb, cpy1_sz);
-   vhdr->h_vlan_proto = skb->vlan_proto;
-   vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
-   skb_copy_from_linear_data(skb, &vhdr->h_vlan_encapsulated_proto,
- cpy2_sz);
-   skb_pull_inline(skb, cpy2_sz);
-}
-
 static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 {
struct mlx5_wq_cyc   *wq   = &sq->wq;
@@ -149,12 +134,8 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, 
struct sk_buff *skb)
ETH_ZLEN);
}
 
-   if (skb_vlan_tag_present(skb)) {
-   mlx5e_insert_vlan(eseg->inline_hdr_start, skb, ihs);
-   } else {
-   skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
-   skb_pull_inline(skb, ihs);
-   }
+   skb_copy_from_linear_data(skb, eseg->inline_hdr_start, ihs);
+   skb_pull_inline(skb, ihs);
 
eseg->inline_hdr_sz = cpu_to_be16(ihs);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 5/7] net/mlx5e: Support NETIF_F_SG

2015-06-11 Thread Or Gerlitz
From: Saeed Mahameed 

When NETIF_F_SG is set, each send WQE may have a different size since
each skb can have different number of fragments as of LSO header etc.

This implies that a given WQE may wrap around the send queue, i.e begin
at its end and continue at its start. While it is legal by the device spec,
we preferred a solution that avoids it - when building of current WQE is
done, if the next WQE may wrap around the send queue, fill the send queue
with NOPs WQEs till its end, so that the next WQE will begin at send queue
start.

NOP WQE for itself cannot wrap around the send queue since it is of
minimal size - 64 bytes, and all send WQEs are a multiple of that size.

Signed-off-by: Achiad Shochat 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Or Gerlitz 
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |3 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   26 ++-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   |   35 +++-
 3 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h 
b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 71f38bb..23cc3bf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -283,6 +283,8 @@ struct mlx5e_sq {
struct netdev_queue   *txq;
u32sqn;
u32bf_buf_size;
+   u16max_inline;
+   u16edge;
struct device *pdev;
__be32 mkey_be;
unsigned long  state;
@@ -453,6 +455,7 @@ enum mlx5e_link_mode {
 
 #define MLX5E_PROT_MASK(link_mode) (1 << link_mode)
 
+void mlx5e_send_nop(struct mlx5e_sq *sq, bool notify_hw);
 u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
   void *accel_priv, select_queue_fallback_t fallback);
 netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 1a655fd..5458cc6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -257,26 +257,6 @@ static void mlx5e_disable_async_events(struct mlx5e_priv 
*priv)
spin_unlock_irq(&priv->async_events_spinlock);
 }
 
-static void mlx5e_send_nop(struct mlx5e_sq *sq)
-{
-   struct mlx5_wq_cyc*wq  = &sq->wq;
-
-   u16 pi = sq->pc & wq->sz_m1;
-   struct mlx5e_tx_wqe  *wqe  = mlx5_wq_cyc_get_wqe(wq, pi);
-
-   struct mlx5_wqe_ctrl_seg *cseg = &wqe->ctrl;
-
-   memset(cseg, 0, sizeof(*cseg));
-
-   cseg->opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | MLX5_OPCODE_NOP);
-   cseg->qpn_ds   = cpu_to_be32((sq->sqn << 8) | 0x01);
-   cseg->fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE;
-
-   sq->skb[pi] = NULL;
-   sq->pc++;
-   mlx5e_tx_notify_hw(sq, wqe);
-}
-
 #define MLX5E_HW2SW_MTU(hwmtu) (hwmtu - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
 #define MLX5E_SW2HW_MTU(swmtu) (swmtu + (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN))
 
@@ -453,7 +433,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
goto err_disable_rq;
 
set_bit(MLX5E_RQ_STATE_POST_WQES_ENABLE, &rq->state);
-   mlx5e_send_nop(&c->sq[0]); /* trigger mlx5e_post_rx_wqes() */
+   mlx5e_send_nop(&c->sq[0], true); /* trigger mlx5e_post_rx_wqes() */
 
return 0;
 
@@ -541,6 +521,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
sq->mkey_be = c->mkey_be;
sq->channel = c;
sq->tc  = tc;
+   sq->edge= (sq->wq.sz_m1 + 1) - MLX5_SEND_WQE_MAX_WQEBBS;
 
return 0;
 
@@ -694,7 +675,7 @@ static void mlx5e_close_sq(struct mlx5e_sq *sq)
 
/* ensure hw is notified of all pending wqes */
if (mlx5e_sq_has_room_for(sq, 1))
-   mlx5e_send_nop(sq);
+   mlx5e_send_nop(sq, true);
 
mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
while (sq->cc != sq->pc) /* wait till sq is empty */
@@ -1746,6 +1727,7 @@ static void mlx5e_build_netdev(struct net_device *netdev)
 
netdev->ethtool_ops   = &mlx5e_ethtool_ops;
 
+   netdev->vlan_features|= NETIF_F_SG;
netdev->vlan_features|= NETIF_F_IP_CSUM;
netdev->vlan_features|= NETIF_F_IPV6_CSUM;
netdev->vlan_features|= NETIF_F_GRO;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c 
b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 3cfd2bc..bac268a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -34,6 +34,33 @@
 #include 
 #include "en.h"
 
+#define MLX5E_SQ_NOPS_ROOM  MLX5_SEND_WQE_MAX_WQEBBS
+#define MLX5E_SQ_STOP_ROOM (MLX5_SEND_WQE_MAX_WQEBBS +\
+   MLX5E_SQ_NOPS_ROOM)
+

[PATCH ethtool V3 2/2] ethtool.8.in: Add man page for tunable copybreak

2015-06-11 Thread Hadar Hen Zion
From: Govindarajulu Varadarajan <_gov...@gmx.com>

Signed-off-by: Govindarajulu Varadarajan <_gov...@gmx.com>
Signed-off-by: Hadar Hen Zion 
---
 ethtool.8.in | 20 
 1 file changed, 20 insertions(+)

diff --git a/ethtool.8.in b/ethtool.8.in
index ae56293..eae630e 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -176,6 +176,14 @@ ethtool \- query or control network driver and hardware 
settings
 .BN rx\-jumbo
 .BN tx
 .HP
+.B ethtool \-b|\-\-show\-tunable
+.I devname
+.HP
+.B ethtool \-B|\-\-set\-tunable
+.I devname
+.BN rx-copybreak
+.BN tx-copybreak
+.HP
 .B ethtool \-i|\-\-driver
 .I devname
 .HP
@@ -399,6 +407,18 @@ Changes the number of ring entries for the Rx Jumbo ring.
 .BI tx \ N
 Changes the number of ring entries for the Tx ring.
 .TP
+.B \-b|\-\-show\-tunable
+Get device tunable values
+.TP
+.B \-B|\-\-set\-tunable
+Set device tunable values
+.TP
+.BI rx-copybreak \ N
+Change rx_copybreak
+.TP
+.BI tx-copybreak \ N
+Change tx_copybreak
+.TP
 .B \-i \-\-driver
 Queries the specified network device for associated driver information.
 .TP
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH ethtool V3 0/2] Add copybreak support

2015-06-11 Thread Hadar Hen Zion
Hi Ben,

This series add support for setting/getting driver's tx/rx_copybreak value.

Copybreak is handled through a new ethtool tunable interface.

The kernel support will be avilable from kernel 4.2, commit "net/ethtool: Add
current supported tunable options".

The series was originally sent by Govindarajulu Varadarajan, I fixed the
comments and resend the series.

Thanks,
Hadar

Changes form V2:
- Change "-B/-b" to generic tunable option.
- Remove tunable names from user space, defined tunable strings names in the
  kernel.
- Remove the third patch - "ethtool-copy.h: Sync with net-next 3.17.0-rc7"

Govindarajulu Varadarajan (2):
  ethtool: Add copybreak support
  ethtool.8.in: Add man page for tunable copybreak

 ethtool-copy.h |   1 +
 ethtool.8.in   |  20 +
 ethtool.c  | 227 +
 3 files changed, 248 insertions(+)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH ethtool V3 1/2] ethtool: Add copybreak support

2015-06-11 Thread Hadar Hen Zion
From: Govindarajulu Varadarajan <_gov...@gmx.com>

Add support for setting/getting driver's tx/rx_copybreak value.

Copybreak is handled through a new ethtool tunable interface.

The kernel support was added in 3.18, commit f0db9b07341 "ethtool:
Add generic options for tunables"

Signed-off-by: Govindarajulu Varadarajan <_gov...@gmx.com>
Signed-off-by: Hadar Hen Zion 
---
 ethtool-copy.h |   1 +
 ethtool.c  | 227 +
 2 files changed, 228 insertions(+)

diff --git a/ethtool-copy.h b/ethtool-copy.h
index d23ffc4..f92743b 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -545,6 +545,7 @@ enum ethtool_stringset {
ETH_SS_NTUPLE_FILTERS,
ETH_SS_FEATURES,
ETH_SS_RSS_HASH_FUNCS,
+   ETH_SS_TUNABLES,
 };
 
 /**
diff --git a/ethtool.c b/ethtool.c
index 01b13a6..16b5c41 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -145,6 +145,12 @@ struct cmdline_info {
void *seen_val;
 };
 
+struct ethtool_stunable {
+   cmdline_type_t type;
+   __u32 u32_val;
+   int seen_val;
+};
+
 struct flag_info {
const char *name;
u32 value;
@@ -1800,6 +1806,223 @@ static int do_gring(struct cmd_context *ctx)
return 0;
 }
 
+static int get_u32tunable(struct cmd_context *ctx, enum tunable_id id,
+ __u32 *value)
+{
+   struct ethtool_tunable *etuna;
+   int ret;
+
+   etuna = calloc(sizeof(*etuna) + sizeof(__u32), 1);
+   if (!etuna)
+   return 1;
+   etuna->cmd = ETHTOOL_GTUNABLE;
+   etuna->id = id;
+   etuna->type_id = ETHTOOL_TUNABLE_U32;
+   etuna->len = sizeof(__u32);
+   ret = send_ioctl(ctx, etuna);
+   *value = *(__u32 *)((void *)etuna + sizeof(*etuna));
+   free(etuna);
+
+   return ret;
+}
+
+static int print_u32tunable(int err, struct ethtool_gstrings *tunables,
+   enum tunable_id id, const __u32 value)
+{
+   char *tunable_name = (char *)tunables->data + id * ETH_GSTRING_LEN;
+
+   if (err) {
+   switch (errno) {
+   /* Driver does not support this particular tunable
+* Usually displays 0
+*/
+   case EINVAL:
+   goto print;
+   /* Driver does not support get tunables ops or no such device
+* No point in proceeding further
+*/
+   case EOPNOTSUPP:
+   case ENODEV:
+   perror("Cannot get device settings");
+   exit(err);
+   default:
+   perror(tunable_name);
+   return err;
+   }
+   }
+print:
+   fprintf(stdout, "%s: %u\n", tunable_name, value);
+
+   return 0;
+}
+
+static int do_gtunables(struct cmd_context *ctx)
+{
+   int err, anyerror = 0;
+   __u32 u32value = 0;
+   struct ethtool_gstrings *tunables;
+   int idx;
+   __u32 n_tunables;
+
+   if (ctx->argc != 0)
+   exit_bad_args();
+
+   tunables = get_stringset(ctx, ETH_SS_TUNABLES, 0, 1);
+   if (!tunables) {
+   perror("Cannot get tunables names");
+   return 1;
+   }
+   if (tunables->len == 0) {
+   fprintf(stderr, "No tunables defined\n");
+   return 1;
+   }
+   n_tunables = tunables->len;
+
+   fprintf(stdout, "Tunables settings for device %s\n", ctx->devname);
+
+   for (idx = 0; idx < n_tunables; idx++) {
+   switch(idx) {
+   case ETHTOOL_ID_UNSPEC:
+   break;
+   case ETHTOOL_RX_COPYBREAK:
+   case ETHTOOL_TX_COPYBREAK:
+   err = get_u32tunable(ctx, idx, &u32value);
+   err = print_u32tunable(err, tunables, idx, u32value);
+   if (err)
+   anyerror = err;
+   break;
+   default:
+   anyerror = EINVAL;
+   }
+   }
+   if (anyerror)
+   fprintf(stderr, "Failed to get all settings. displayed partial 
settings\n");
+
+   free(tunables);
+   return anyerror;
+}
+
+static int set_u32tunable(struct cmd_context *ctx, enum tunable_id id,
+ const __u32 value)
+{
+   struct ethtool_tunable *etuna;
+   int ret;
+   __u32 *data;
+
+   etuna = malloc(sizeof(*etuna) + sizeof(__u32));
+   if (!etuna) {
+   perror("Set tunable:");
+   return 1;
+   }
+   data = (void *)etuna + sizeof(*etuna);
+   *data = value;
+   etuna->cmd = ETHTOOL_STUNABLE;
+   etuna->id = id;
+   etuna->type_id = ETHTOOL_TUNABLE_U32;
+   etuna->len = sizeof(__u32);
+   ret = send_ioctl(ctx, etuna);
+   free(etuna);
+
+   return ret;
+}
+
+static int check_set_u32tunable(int err, enum tunable_id id)
+{
+   if (err) {
+   

[PATCH net] net: igb: fix the start time for periodic output signals

2015-06-11 Thread Richard Cochran
When programming the start of a periodic output, the code wrongly places
the seconds value into the "low" register and the nanoseconds into the
"high" register.  Even though this is backwards, it slipped through my
testing, because the re-arming code in the interrupt service routine is
correct, and the signal does appear starting with the second edge.

This patch fixes the issue by programming the registers correctly.

Signed-off-by: Richard Cochran 
---
 drivers/net/ethernet/intel/igb/igb_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c 
b/drivers/net/ethernet/intel/igb/igb_ptp.c
index e3b9b63..c3a9392c 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -538,8 +538,8 @@ static int igb_ptp_feature_enable_i210(struct 
ptp_clock_info *ptp,
igb->perout[i].start.tv_nsec = rq->perout.start.nsec;
igb->perout[i].period.tv_sec = ts.tv_sec;
igb->perout[i].period.tv_nsec = ts.tv_nsec;
-   wr32(trgttiml, rq->perout.start.sec);
-   wr32(trgttimh, rq->perout.start.nsec);
+   wr32(trgttimh, rq->perout.start.sec);
+   wr32(trgttiml, rq->perout.start.nsec);
tsauxc |= tsauxc_mask;
tsim |= tsim_mask;
} else {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net] net: igb: fix the start time for periodic output signals

2015-06-11 Thread Richard Cochran
On Thu, Jun 11, 2015 at 02:51:30PM +0200, Richard Cochran wrote:
> This patch fixes the issue by programming the registers correctly.

Please also consider this for stable.

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: /net/mpls/conf/ethX//input duplicate entry

2015-06-11 Thread Robert Shearman

On 11/06/15 00:23, Scott Feldman wrote:

On Wed, Jun 10, 2015 at 2:58 PM, roopa  wrote:

On 6/10/15, 1:43 PM, Scott Feldman wrote:


I'm getting this dump_stack when reloading rocker driver.  Did some
sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER?

Steps to repro: load rocker (on system) with rocker device, rmmod
rocker, and then modprobe rocker.  I doubt this is specific to rocker:
and re-registration of a netdev should hit it. I am using UDEV rules
to rename kernel's ethX to a different name.  Maybe that's what
tripped it up?


On a quick look, wondering if this is because mpls driver does not seem to
do a unregister and re-register sysctl
on device name change.


Mea culpa. Thanks for looking at this.



diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 7b3f732..ec21a5d 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this,
unsigned long event,
 case NETDEV_UNREGISTER:
 mpls_ifdown(dev);
 break;
+   case NETDEV_CHANGENAME:
+   mpls_ifdown(dev);
+   if ((dev->type == ARPHRD_ETHER) ||
+   (dev->type == ARPHRD_LOOPBACK)) {
+   mdev = mpls_add_dev(dev);
+   if (IS_ERR(mdev))
+   return notifier_from_errno(PTR_ERR(mdev));
+   }
 }
 return NOTIFY_OK;
  }


Roopa, I tested this patch and problem goes away.  (It's missing a
break statement, BTW).  I didn't look into the correctness of the
patch, but at first glance it seems liek the right thing to do.  Maybe
breaking out the renaming portions into sub-functions could keep the
work done in NETDEV_CHANGENAME to a minimum.


I agree that breaking out the sysctl registration/unregistration is a 
good idea to not have to do more work than is necessary, and to avoid 
unintended consequences (like routes using the interface being made 
unusable).




Are you sending official fix?


Roopa, let me know if you'd like me to carry this forward.

Thanks,
Rob
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 2/2] Renesas Ethernet AVB PTP clock driver

2015-06-11 Thread Sergei Shtylyov

Hello.

On 6/11/2015 10:24 AM, David Miller wrote:


Ethernet AVB device includes the gPTP  timer, so we can implement a PTP clock
driver.  We're doing that in a separate file, with  the main Ethernet driver
calling the PTP driver's [de]initialization and interrupt handler functions.
Unfortunately, the clock seems tightly coupled with the AVB-DMAC, so when that
one leaves the operation mode, we have to unregister the PTP clock... :-(



Based on the original patches by Masaru Nagai.



Signed-off-by: Masaru Nagai 
Signed-off-by: Sergei Shtylyov 



Applied.


   Thank you!


I had to fix up this patch because:



obj-$(CONFIG_RAVB) += ravb_main.o ravb_ptp.o



Doesn't do what you want it to for the modular case.


   Oh, crap, I forgot to test the modular build after splitting the driver 
again into separate files. Sorry about that... :-<



You instead need to say something like:



ravb-objs := ravb_main.o ravb_ptp.o



obj-$(CONFIG_RAVB) += ravb.o



and that's how I fixed up this commit before pushing it out.


   And the code base I was using as a reference had this issue fixed quite 
similarly...


WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 5/5] rocker: remove support for legacy VLAN ndo ops

2015-06-11 Thread Jamal Hadi Salim

Full quote below. So what is the consensus on this topic?
I read the emails but i dont see a resolution.

cheers,
jamal

On 06/03/15 08:08, Jamal Hadi Salim wrote:

On 06/02/15 10:30, Scott Feldman wrote:

On Tue, Jun 2, 2015 at 4:43 AM, Jamal Hadi Salim 
wrote:

On 06/02/15 03:10, Scott Feldman wrote:




Question to ask when looking at something of this nature:
Will it work with no suprises if you used today's unmodified app?
The default behavior shouldnt change and unfortunately it does here.


The default behavior does change, yes, but there shouldn't be any
surprises even if using today's unmodified app.


[..]

[]



Ha, you're giving the behavior for "bridge fdb" command, where self is
the default.



Yes, sorry ;->


For "bridge link" and "bridge vlan", the default is master.  The user
must explicitly specify "self" to act on the device side of the port.




Not sure what "device side of the port" is intended to mean. But:
iproute2, user can specify device is either the bridge or bridge port.
I think that is the key.
This is used in combination with the self/master flags to decide
behavior in the kernel.
Summary, assuming flag bits master:self

user setting: 00 (none set - which is default iproute2 behavior).
Kernel behavior:
if (bridge port targeted)
 sets the vlan bitmap on the bridge port.
else
 sets the vlan bitmap on the bridge.

*** Above is what we want to maintain unchanged.
If you are saying it doesnt change, then we are fine.

user setting: 01 (self on)
kernel behavior: no difference from default

user setting: 1x (master on, self doesnt matter)
kernel behavior:
if (bridge port targeted)
 sets the bitmap on the bridge port.
 sets the bitmap on the bridge as well. <
else
 sets the bitmap on the bridge.


BTW: given the vlan change are reflected from the bowels of
br_vlan_info() - is it redundant there is a call in br_afset
afterwards which says something like
"if master is set and target is bridge port then call hardware
setting thing"?

dont have much time - so i may be confusing something.


It's unfortunate the iproute2 defaults aren't consistent between
commands.  Maybe someone knows the history here and can explain.



Not sure. Too many cooks with specific use cases? There are many
thing in bridge that i wish were different.
Unfortunately when things get to this level Dave's famous "a horse has
left the barn"  principle applies. Despite my whining, over time,
even shit doesnt smell anymore. I almost feel we need an
ABI police force (refer to Jiri's talk at netconf).
It is much easier to fix kernel changes.

cheers,
jamal


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ipv6: Fix protocol resubmission

2015-06-11 Thread Hajime Tazaki

At Wed, 10 Jun 2015 16:57:25 -0500,
Josh Hunt wrote:

> Dave
> 
> Can you please revert this change?
> 
> commit 0243508edd317ff1fa63b495643a7c192fbfcd92
> Author: Josh Hunt 
> Date:   Mon Jun 8 12:00:59 2015 -0400
> 
>  ipv6: Fix protocol resubmission
> 
> Let me know if you need a patch to do this and I will submit something.
> 
> I will fix the original issue in the UDP code in another patch.

feel free to Cc me if you would like me to test the new patch.

thanks.

-- Hajime
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 01/19] bna: use ether_addr_copy instead of memcpy

2015-06-11 Thread Ivan Vecera

On 06/10/2015 07:57 PM, Joe Perches wrote:

On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote:

Signed-off-by: Ivan Vecera 


Have you verified that all of these are __aligned(2)?

I haven't, but you should verify that you have in the
commit log.
I have checked an alignment of all instances and they are all aligned 
properly... An exception is global variable bnad_bcast_addr, its 
alignment is 1 according __alignof__ but according generated assembly it 
is aligned to 2. Anyway I'm going to put __aligned directive for sure.



btw: this use looks odd to me:

static int
bnad_set_mac_address(struct net_device *netdev, void *mac_addr)
{
int err;
struct bnad *bnad = netdev_priv(netdev);
struct sockaddr *sa = (struct sockaddr *)mac_addr;
unsigned long flags;

spin_lock_irqsave(&bnad->bna_lock, flags);

err = bnad_mac_addr_set_locked(bnad, sa->sa_data);

as it casts what seems to be a mac address to a
sockaddr and uses a different offset for sa->sa_data
than the mac_addr passed.

and the mac_addr as it's void doesn't need a cast.
No, bnad_set_mac_address() is an implementation of 
.ndo_set_mac_address() and this is called with pointer to struct 
sockaddr. The mac_addr name is a little bit confusing.


Will post v2.

Ivan

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 02/19] bna: get rid of mac_t

2015-06-11 Thread Ivan Vecera
The patch converts mac_t type to widely used 'u8 [ETH_ALEN]'.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_defs.h |  4 ++--
 drivers/net/ethernet/brocade/bna/bfa_defs_cna.h |  2 +-
 drivers/net/ethernet/brocade/bna/bfa_ioc.c  |  8 
 drivers/net/ethernet/brocade/bna/bfa_ioc.h  |  2 +-
 drivers/net/ethernet/brocade/bna/bfi.h  |  6 +++---
 drivers/net/ethernet/brocade/bna/bfi_enet.h |  6 +++---
 drivers/net/ethernet/brocade/bna/bna.h  |  4 ++--
 drivers/net/ethernet/brocade/bna/bna_enet.c |  4 ++--
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c|  4 ++--
 drivers/net/ethernet/brocade/bna/bnad.c | 10 +-
 drivers/net/ethernet/brocade/bna/bnad.h |  2 +-
 drivers/net/ethernet/brocade/bna/cna.h  |  6 --
 12 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs.h
index 3bfd9da..f55887b 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h
@@ -55,7 +55,7 @@ struct bfa_adapter_attr {
charoptrom_ver[BFA_VERSION_LEN];
charos_type[BFA_ADAPTER_OS_TYPE_LEN];
struct bfa_mfg_vpd vpd;
-   struct mac mac;
+   u8  mac[ETH_ALEN];
 
u8  nports;
u8  max_speed;
@@ -211,7 +211,7 @@ struct bfa_mfg_block {
charsupplier_partnum[STRSZ(BFA_MFG_SUPPLIER_PARTNUM_SIZE)];
charsupplier_serialnum[STRSZ(BFA_MFG_SUPPLIER_SERIALNUM_SIZE)];
charsupplier_revision[STRSZ(BFA_MFG_SUPPLIER_REVISION_SIZE)];
-   mac_t   mfg_mac;/* base mac address */
+   u8  mfg_mac[ETH_ALEN]; /* base mac address */
u8  num_mac;/* number of mac addresses */
u8  rsv2;
u32 card_type;  /* card type  */
diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
index a37326d..ce0b228 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
@@ -188,7 +188,7 @@ struct bfa_cee_attr {
u8 error_reason;
struct bfa_cee_lldp_cfg lldp_remote;
struct bfa_cee_dcbx_cfg dcbx_remote;
-   mac_t src_mac;
+   u8 src_mac[ETH_ALEN];
u8 link_speed;
u8 nw_priority;
u8 filler[2];
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 68f3c13..82c95f8 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -2796,7 +2796,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc *ioc,
ad_attr->prototype = 0;
 
ad_attr->pwwn = bfa_ioc_get_pwwn(ioc);
-   ad_attr->mac  = bfa_nw_ioc_get_mac(ioc);
+   bfa_nw_ioc_get_mac(ioc, ad_attr->mac);
 
ad_attr->pcie_gen = ioc_attr->pcie_gen;
ad_attr->pcie_lanes = ioc_attr->pcie_lanes;
@@ -2942,10 +2942,10 @@ bfa_ioc_get_pwwn(struct bfa_ioc *ioc)
return ioc->attr->pwwn;
 }
 
-mac_t
-bfa_nw_ioc_get_mac(struct bfa_ioc *ioc)
+void
+bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac)
 {
-   return ioc->attr->mac;
+   ether_addr_copy(mac, ioc->attr->mac);
 }
 
 /* Firmware failure detected. Start recovery actions. */
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
index effb715..b37bc16 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
@@ -309,7 +309,7 @@ void bfa_nw_ioc_fwver_get(struct bfa_ioc *ioc,
struct bfi_ioc_image_hdr *fwhdr);
 bool bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc,
struct bfi_ioc_image_hdr *fwhdr);
-mac_t bfa_nw_ioc_get_mac(struct bfa_ioc *ioc);
+void bfa_nw_ioc_get_mac(struct bfa_ioc *ioc, u8 *mac);
 void bfa_nw_ioc_debug_memclaim(struct bfa_ioc *ioc, void *dbg_fwsave);
 int bfa_nw_ioc_debug_fwtrc(struct bfa_ioc *ioc, void *trcdata, int *trclen);
 int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void *trcdata, int *trclen);
diff --git a/drivers/net/ethernet/brocade/bna/bfi.h 
b/drivers/net/ethernet/brocade/bna/bfi.h
index 2bcde40..63645ac 100644
--- a/drivers/net/ethernet/brocade/bna/bfi.h
+++ b/drivers/net/ethernet/brocade/bna/bfi.h
@@ -189,14 +189,14 @@ struct bfi_ioc_getattr_req {
 struct bfi_ioc_attr {
u64 mfg_pwwn;   /*!< Mfg port wwn  */
u64 mfg_nwwn;   /*!< Mfg node wwn  */
-   mac_t   mfg_mac;/*!< Mfg mac   */
+   u8  mfg_mac[ETH_ALEN]; /*!< Mfg mac*/
u8  port_mode;  /* enum bfi_port_mode  */
u8  rsvd_a;
u64 pwwn;
u64 nwwn;
-   mac_t   mac;/*!< PBC or Mfg mac*/
+ 

[PATCH net-next v2 12/19] bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag

2015-06-11 Thread Ivan Vecera
TX_E_PRIO_CHANGE event is never sent for bna_tx so it doesn't need to be
handled. After this change bna_tx->flags cannot contain
BNA_TX_F_PRIO_CHANGED flag and it can be also eliminated.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 22 --
 drivers/net/ethernet/brocade/bna/bna_types.h |  1 -
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 896aa82..54ad169 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -2901,7 +2901,6 @@ enum bna_tx_event {
TX_E_FAIL   = 3,
TX_E_STARTED= 4,
TX_E_STOPPED= 5,
-   TX_E_PRIO_CHANGE= 6,
TX_E_CLEANUP_DONE   = 7,
TX_E_BW_UPDATE  = 8,
 };
@@ -2942,9 +2941,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event 
event)
/* No-op */
break;
 
-   case TX_E_PRIO_CHANGE:
-   break;
-
case TX_E_BW_UPDATE:
/* No-op */
break;
@@ -2965,28 +2961,23 @@ bna_tx_sm_start_wait(struct bna_tx *tx, enum 
bna_tx_event event)
 {
switch (event) {
case TX_E_STOP:
-   tx->flags &= ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED);
+   tx->flags &= ~BNA_TX_F_BW_UPDATED;
bfa_fsm_set_state(tx, bna_tx_sm_stop_wait);
break;
 
case TX_E_FAIL:
-   tx->flags &= ~(BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED);
+   tx->flags &= ~BNA_TX_F_BW_UPDATED;
bfa_fsm_set_state(tx, bna_tx_sm_stopped);
break;
 
case TX_E_STARTED:
-   if (tx->flags & (BNA_TX_F_PRIO_CHANGED | BNA_TX_F_BW_UPDATED)) {
-   tx->flags &= ~(BNA_TX_F_PRIO_CHANGED |
-   BNA_TX_F_BW_UPDATED);
+   if (tx->flags & BNA_TX_F_BW_UPDATED) {
+   tx->flags &= ~BNA_TX_F_BW_UPDATED;
bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait);
} else
bfa_fsm_set_state(tx, bna_tx_sm_started);
break;
 
-   case TX_E_PRIO_CHANGE:
-   tx->flags |=  BNA_TX_F_PRIO_CHANGED;
-   break;
-
case TX_E_BW_UPDATE:
tx->flags |= BNA_TX_F_BW_UPDATED;
break;
@@ -3028,7 +3019,6 @@ bna_tx_sm_started(struct bna_tx *tx, enum bna_tx_event 
event)
tx->tx_cleanup_cbfn(tx->bna->bnad, tx);
break;
 
-   case TX_E_PRIO_CHANGE:
case TX_E_BW_UPDATE:
bfa_fsm_set_state(tx, bna_tx_sm_prio_stop_wait);
break;
@@ -3061,7 +3051,6 @@ bna_tx_sm_stop_wait(struct bna_tx *tx, enum bna_tx_event 
event)
bna_tx_enet_stop(tx);
break;
 
-   case TX_E_PRIO_CHANGE:
case TX_E_BW_UPDATE:
/* No-op */
break;
@@ -3081,7 +3070,6 @@ bna_tx_sm_cleanup_wait(struct bna_tx *tx, enum 
bna_tx_event event)
 {
switch (event) {
case TX_E_FAIL:
-   case TX_E_PRIO_CHANGE:
case TX_E_BW_UPDATE:
/* No-op */
break;
@@ -3119,7 +3107,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum 
bna_tx_event event)
bfa_fsm_set_state(tx, bna_tx_sm_prio_cleanup_wait);
break;
 
-   case TX_E_PRIO_CHANGE:
case TX_E_BW_UPDATE:
/* No-op */
break;
@@ -3147,7 +3134,6 @@ bna_tx_sm_prio_cleanup_wait(struct bna_tx *tx, enum 
bna_tx_event event)
bfa_fsm_set_state(tx, bna_tx_sm_failed);
break;
 
-   case TX_E_PRIO_CHANGE:
case TX_E_BW_UPDATE:
/* No-op */
break;
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index 134abf7..e0e797f 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -135,7 +135,6 @@ enum bna_tx_type {
 enum bna_tx_flags {
BNA_TX_F_ENET_STARTED   = 1,
BNA_TX_F_ENABLED= 2,
-   BNA_TX_F_PRIO_CHANGED   = 4,
BNA_TX_F_BW_UPDATED = 8,
 };
 
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 15/19] bna: remove useless pointer assignment

2015-06-11 Thread Ivan Vecera
Pointer cmpl used to iterate through completion entries is updated at
the beginning of while loop as well as at the end. The update at the end
of the loop is useless.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bnad.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
b/drivers/net/ethernet/brocade/bna/bnad.c
index 0f833e4..fc97428 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -725,7 +725,6 @@ next:
cmpl->valid = 0;
BNA_QE_INDX_INC(ccb->producer_index, ccb->q_depth);
}
-   cmpl = &cq[ccb->producer_index];
}
 
napi_gro_flush(&rx_ctrl->napi, false);
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 19/19] bna: use netdev_* and dev_* instead of printk and pr_*

2015-06-11 Thread Ivan Vecera
...and remove some of them. It is not necessary to log when .probe() and
.remove() are called or when TxQ is started or stopped. Also log level
of some of them was changed to more appropriate one (link up/down,
firmware loading failure.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bnad.c | 46 +
 drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 34 --
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c |  9 ++---
 drivers/net/ethernet/brocade/bna/cna_fwimg.c|  2 +-
 4 files changed, 36 insertions(+), 55 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
b/drivers/net/ethernet/brocade/bna/bnad.c
index 4542eb2..6be31ae 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -946,8 +946,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
if (link_up) {
if (!netif_carrier_ok(bnad->netdev)) {
uint tx_id, tcb_id;
-   printk(KERN_WARNING "bna: %s link up\n",
-   bnad->netdev->name);
+   netdev_info(bnad->netdev, "link up\n");
netif_carrier_on(bnad->netdev);
BNAD_UPDATE_CTR(bnad, link_toggle);
for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) {
@@ -966,10 +965,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
/*
 * Force an immediate
 * Transmit Schedule */
-   printk(KERN_INFO "bna: %s %d "
- "TXQ_STARTED\n",
-  bnad->netdev->name,
-  txq_id);
netif_wake_subqueue(
bnad->netdev,
txq_id);
@@ -987,8 +982,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
}
} else {
if (netif_carrier_ok(bnad->netdev)) {
-   printk(KERN_WARNING "bna: %s link down\n",
-   bnad->netdev->name);
+   netdev_info(bnad->netdev, "link down\n");
netif_carrier_off(bnad->netdev);
BNAD_UPDATE_CTR(bnad, link_toggle);
}
@@ -1058,8 +1052,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx)
txq_id = tcb->id;
clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags);
netif_stop_subqueue(bnad->netdev, txq_id);
-   printk(KERN_INFO "bna: %s %d TXQ_STOPPED\n",
-   bnad->netdev->name, txq_id);
}
 }
 
@@ -1082,8 +1074,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx)
BUG_ON(*(tcb->hw_consumer_index) != 0);
 
if (netif_carrier_ok(bnad->netdev)) {
-   printk(KERN_INFO "bna: %s %d TXQ_STARTED\n",
-   bnad->netdev->name, txq_id);
netif_wake_subqueue(bnad->netdev, txq_id);
BNAD_UPDATE_CTR(bnad, netif_queue_wakeup);
}
@@ -2136,7 +2126,7 @@ bnad_reinit_rx(struct bnad *bnad)
current_err = bnad_setup_rx(bnad, rx_id);
if (current_err && !err) {
err = current_err;
-   pr_err("RXQ:%u setup failed\n", rx_id);
+   netdev_err(netdev, "RXQ:%u setup failed\n", rx_id);
}
}
 
@@ -2672,8 +2662,9 @@ bnad_enable_msix(struct bnad *bnad)
if (ret < 0) {
goto intx_mode;
} else if (ret < bnad->msix_num) {
-   pr_warn("BNA: %d MSI-X vectors allocated < %d requested\n",
-   ret, bnad->msix_num);
+   dev_warn(&bnad->pcidev->dev,
+"%d MSI-X vectors allocated < %d requested\n",
+ret, bnad->msix_num);
 
spin_lock_irqsave(&bnad->bna_lock, flags);
/* ret = #of vectors that we got */
@@ -2695,7 +2686,8 @@ bnad_enable_msix(struct bnad *bnad)
return;
 
 intx_mode:
-   pr_warn("BNA: MSI-X enable failed - operating in INTx mode\n");
+   dev_warn(&bnad->pcidev->dev,
+"MSI-X enable failed - operating in INTx mode\n");
 
kfree(bnad->msix_table);
bnad->msix_table = NULL;
@@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad,
dev_err(&pdev->dev, "ioremap for bar0 failed\n");
return -ENOMEM;
}
-   pr_info("bar0 mapped to %p, len %llu\n", bnad->bar0,
-  (unsigned long long) bnad->mmio_len);
+   dev_info(&

[PATCH net-next v2 18/19] bna: fix timeout API argument type

2015-06-11 Thread Ivan Vecera
Timeout functions are defined with 'void *' ptr argument. They should
be defined directly with 'struct bfa_ioc *' type to avoid type conversions.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_ioc.c | 16 +---
 drivers/net/ethernet/brocade/bna/bfa_ioc.h |  8 
 drivers/net/ethernet/brocade/bna/bnad.c|  8 
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 2c74beb..b009fd7 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1895,10 +1895,8 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force)
 }
 
 void
-bfa_nw_ioc_timeout(void *ioc_arg)
+bfa_nw_ioc_timeout(struct bfa_ioc *ioc)
 {
-   struct bfa_ioc *ioc = (struct bfa_ioc *) ioc_arg;
-
bfa_fsm_send_event(ioc, IOC_E_TIMEOUT);
 }
 
@@ -1963,10 +1961,9 @@ bfa_ioc_send_getattr(struct bfa_ioc *ioc)
 }
 
 void
-bfa_nw_ioc_hb_check(void *cbarg)
+bfa_nw_ioc_hb_check(struct bfa_ioc *ioc)
 {
-   struct bfa_ioc *ioc = cbarg;
-   u32 hb_count;
+   u32 hb_count;
 
hb_count = readl(ioc->ioc_regs.heartbeat);
if (ioc->hb_count == hb_count) {
@@ -2983,9 +2980,8 @@ bfa_iocpf_stop(struct bfa_ioc *ioc)
 }
 
 void
-bfa_nw_iocpf_timeout(void *ioc_arg)
+bfa_nw_iocpf_timeout(struct bfa_ioc *ioc)
 {
-   struct bfa_ioc  *ioc = (struct bfa_ioc *) ioc_arg;
enum bfa_iocpf_state iocpf_st;
 
iocpf_st = bfa_sm_to_state(iocpf_sm_table, ioc->iocpf.fsm);
@@ -2997,10 +2993,8 @@ bfa_nw_iocpf_timeout(void *ioc_arg)
 }
 
 void
-bfa_nw_iocpf_sem_timeout(void *ioc_arg)
+bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc)
 {
-   struct bfa_ioc  *ioc = (struct bfa_ioc *) ioc_arg;
-
bfa_ioc_hw_sem_get(ioc);
 }
 
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
index b6ad2c5..2c0b4c0 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
@@ -304,10 +304,10 @@ int bfa_nw_ioc_debug_fwsave(struct bfa_ioc *ioc, void 
*trcdata, int *trclen);
 /*
  * Timeout APIs
  */
-void bfa_nw_ioc_timeout(void *ioc);
-void bfa_nw_ioc_hb_check(void *ioc);
-void bfa_nw_iocpf_timeout(void *ioc);
-void bfa_nw_iocpf_sem_timeout(void *ioc);
+void bfa_nw_ioc_timeout(struct bfa_ioc *ioc);
+void bfa_nw_ioc_hb_check(struct bfa_ioc *ioc);
+void bfa_nw_iocpf_timeout(struct bfa_ioc *ioc);
+void bfa_nw_iocpf_sem_timeout(struct bfa_ioc *ioc);
 
 /*
  * F/W Image Size & Chunk
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
b/drivers/net/ethernet/brocade/bna/bnad.c
index fc97428..4542eb2 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -1703,7 +1703,7 @@ bnad_ioc_timeout(unsigned long data)
unsigned long flags;
 
spin_lock_irqsave(&bnad->bna_lock, flags);
-   bfa_nw_ioc_timeout((void *) &bnad->bna.ioceth.ioc);
+   bfa_nw_ioc_timeout(&bnad->bna.ioceth.ioc);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
 }
 
@@ -1714,7 +1714,7 @@ bnad_ioc_hb_check(unsigned long data)
unsigned long flags;
 
spin_lock_irqsave(&bnad->bna_lock, flags);
-   bfa_nw_ioc_hb_check((void *) &bnad->bna.ioceth.ioc);
+   bfa_nw_ioc_hb_check(&bnad->bna.ioceth.ioc);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
 }
 
@@ -1725,7 +1725,7 @@ bnad_iocpf_timeout(unsigned long data)
unsigned long flags;
 
spin_lock_irqsave(&bnad->bna_lock, flags);
-   bfa_nw_iocpf_timeout((void *) &bnad->bna.ioceth.ioc);
+   bfa_nw_iocpf_timeout(&bnad->bna.ioceth.ioc);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
 }
 
@@ -1736,7 +1736,7 @@ bnad_iocpf_sem_timeout(unsigned long data)
unsigned long flags;
 
spin_lock_irqsave(&bnad->bna_lock, flags);
-   bfa_nw_iocpf_sem_timeout((void *) &bnad->bna.ioceth.ioc);
+   bfa_nw_iocpf_sem_timeout(&bnad->bna.ioceth.ioc);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
 }
 
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 03/19] bna: replace pragma(pack) with attribute __packed

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_defs.h|   6 +-
 drivers/net/ethernet/brocade/bna/bfa_defs_cna.h|  14 +--
 .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h   |   6 +-
 drivers/net/ethernet/brocade/bna/bfi.h |  70 +++---
 drivers/net/ethernet/brocade/bna/bfi_cna.h |  30 +++---
 drivers/net/ethernet/brocade/bna/bfi_enet.h| 104 ++---
 6 files changed, 103 insertions(+), 127 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs.h
index f55887b..6827d91 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h
@@ -187,8 +187,6 @@ enum {
 #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE20
 #define BFA_MFG_SUPPLIER_REVISION_SIZE 4
 
-#pragma pack(1)
-
 /* BFA adapter manufacturing block definition.
  *
  * All numerical fields are in big-endian format.
@@ -227,9 +225,7 @@ struct bfa_mfg_block {
charinitial_mode[8]; /* initial mode: hba/cna/nic */
u8  rsv4[84];
u8  md5_chksum[BFA_MFG_CHKSUM_SIZE]; /* md5 checksum */
-};
-
-#pragma pack()
+} __packed;
 
 /* -- pci definitions  */
 
diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
index ce0b228..f048887 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs_cna.h
@@ -109,8 +109,6 @@ union bfa_port_stats_u {
struct bfa_port_eth_stats eth;
 };
 
-#pragma pack(1)
-
 #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
 #define BFA_CEE_DCBX_MAX_PRIORITY  (8)
 #define BFA_CEE_DCBX_MAX_PGID  (8)
@@ -133,7 +131,7 @@ struct bfa_cee_lldp_str {
u8 len;
u8 rsvd[2];
u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
-};
+} __packed;
 
 /* LLDP parameters */
 struct bfa_cee_lldp_cfg {
@@ -145,7 +143,7 @@ struct bfa_cee_lldp_cfg {
struct bfa_cee_lldp_str mgmt_addr;
u16 time_to_live;
u16 enabled_system_cap;
-};
+} __packed;
 
 enum bfa_cee_dcbx_version {
DCBX_PROTOCOL_PRECEE= 1,
@@ -171,7 +169,7 @@ struct bfa_cee_dcbx_cfg {
u8 lls_fcoe; /* FCoE Logical Link Status */
u8 lls_lan; /* LAN Logical Link Status */
u8 rsvd[2];
-};
+} __packed;
 
 /* CEE status */
 /* Making this to tri-state for the benefit of port list command */
@@ -192,7 +190,7 @@ struct bfa_cee_attr {
u8 link_speed;
u8 nw_priority;
u8 filler[2];
-};
+} __packed;
 
 /* LLDP/DCBX/CEE Statistics */
 struct bfa_cee_stats {
@@ -214,8 +212,6 @@ struct bfa_cee_stats {
u32 cee_status_up;  /*!< CEE status up */
u32 cee_hw_cfg_changed; /*!< CEE hw cfg changed */
u32 cee_rx_invalid_cfg; /*!< CEE invalid cfg */
-};
-
-#pragma pack()
+} __packed;
 
 #endif /* __BFA_DEFS_CNA_H__ */
diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
index 7a45cd0..679a503 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
@@ -59,8 +59,6 @@ enum {
BFA_MFG_TYPE_INVALID = 0,/*!< Invalid card type */
 };
 
-#pragma pack(1)
-
 /* Check if Mezz card */
 #define bfa_mfg_is_mezz(type) (( \
(type) == BFA_MFG_TYPE_JAYHAWK || \
@@ -148,8 +146,6 @@ struct bfa_mfg_vpd {
u8  len;/*!< vpd data length excluding header */
u8  rsv;
u8  data[BFA_MFG_VPD_LEN];  /*!< vpd data */
-};
-
-#pragma pack()
+} __packed;
 
 #endif /* __BFA_DEFS_MFG_H__ */
diff --git a/drivers/net/ethernet/brocade/bna/bfi.h 
b/drivers/net/ethernet/brocade/bna/bfi.h
index 63645ac..3e97077 100644
--- a/drivers/net/ethernet/brocade/bna/bfi.h
+++ b/drivers/net/ethernet/brocade/bna/bfi.h
@@ -21,8 +21,6 @@
 
 #include "bfa_defs.h"
 
-#pragma pack(1)
-
 /* BFI FW image type */
 #defineBFI_FLASH_CHUNK_SZ  256 /*!< Flash 
chunk size */
 #defineBFI_FLASH_CHUNK_SZ_WORDS(BFI_FLASH_CHUNK_SZ/sizeof(u32))
@@ -36,10 +34,10 @@ struct bfi_mhdr {
struct {
u8  qid;
u8  fn_lpu; /*!< msg destination*/
-   } h2i;
+   } __packed h2i;
u16 i2htok; /*!< token in msgs to host  */
-   } mtag;
-};
+   } __packed mtag;
+} __packed;
 
 #define bfi_fn_lpu(__fn, __lpu)((__fn) << 1 | (__lpu))
 #define bfi_mhdr_2_fn(_mh) ((_mh)->mtag.h2i.fn_lpu >> 1)
@@ -75,14 +73,14 @@ union bfi_addr_u {
struct {
u32 addr_lo;
u32 addr_hi;
-   } a32;
-};
+   } __packed a32;
+} __packed;
 
 /* Generic DMA addr-len pair. */
 struct bfi_alen {
union bfi_addr_ual_addr;/* DMA addr o

[PATCH net-next v2 16/19] bna: get rid of private macros for manipulation with lists

2015-06-11 Thread Ivan Vecera
Remove macros for manipulation with struct list_head and replace them
with standard ones.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_cee.c   |   1 -
 drivers/net/ethernet/brocade/bna/bfa_ioc.c   |  10 +-
 drivers/net/ethernet/brocade/bna/bfa_msgq.c  |  10 +-
 drivers/net/ethernet/brocade/bna/bna.h   |   1 -
 drivers/net/ethernet/brocade/bna/bna_enet.c  |  50 ++---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 310 +--
 drivers/net/ethernet/brocade/bna/cna.h   |  56 -
 7 files changed, 130 insertions(+), 308 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_cee.c 
b/drivers/net/ethernet/brocade/bna/bfa_cee.c
index cf9f395..95bc8b6 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_cee.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_cee.c
@@ -282,7 +282,6 @@ bfa_nw_cee_attach(struct bfa_cee *cee, struct bfa_ioc *ioc,
cee->ioc = ioc;
 
bfa_nw_ioc_mbox_regisr(cee->ioc, BFI_MC_CEE, bfa_cee_isr, cee);
-   bfa_q_qe_init(&cee->ioc_notify);
bfa_ioc_notify_init(&cee->ioc_notify, bfa_cee_notify, cee);
bfa_nw_ioc_notify_register(cee->ioc, &cee->ioc_notify);
 }
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 52fc439..dabbb30 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -2163,7 +2163,8 @@ bfa_ioc_mbox_poll(struct bfa_ioc *ioc)
/**
 * Enqueue command to firmware.
 */
-   bfa_q_deq(&mod->cmd_q, &cmd);
+   cmd = list_first_entry(&mod->cmd_q, struct bfa_mbox_cmd, qe);
+   list_del(&cmd->qe);
bfa_ioc_mbox_send(ioc, cmd->msg, sizeof(cmd->msg));
 
/**
@@ -2184,8 +2185,10 @@ bfa_ioc_mbox_flush(struct bfa_ioc *ioc)
struct bfa_ioc_mbox_mod *mod = &ioc->mbox_mod;
struct bfa_mbox_cmd *cmd;
 
-   while (!list_empty(&mod->cmd_q))
-   bfa_q_deq(&mod->cmd_q, &cmd);
+   while (!list_empty(&mod->cmd_q)) {
+   cmd = list_first_entry(&mod->cmd_q, struct bfa_mbox_cmd, qe);
+   list_del(&cmd->qe);
+   }
 }
 
 /**
@@ -3231,7 +3234,6 @@ bfa_nw_flash_attach(struct bfa_flash *flash, struct 
bfa_ioc *ioc, void *dev)
flash->op_busy = 0;
 
bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash);
-   bfa_q_qe_init(&flash->ioc_notify);
bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash);
list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q);
 }
diff --git a/drivers/net/ethernet/brocade/bna/bfa_msgq.c 
b/drivers/net/ethernet/brocade/bna/bfa_msgq.c
index c07d5b9..9c5bb24 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_msgq.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_msgq.c
@@ -66,8 +66,9 @@ cmdq_sm_stopped_entry(struct bfa_msgq_cmdq *cmdq)
cmdq->offset = 0;
cmdq->bytes_to_copy = 0;
while (!list_empty(&cmdq->pending_q)) {
-   bfa_q_deq(&cmdq->pending_q, &cmdq_ent);
-   bfa_q_qe_init(&cmdq_ent->qe);
+   cmdq_ent = list_first_entry(&cmdq->pending_q,
+   struct bfa_msgq_cmd_entry, qe);
+   list_del(&cmdq_ent->qe);
call_cmdq_ent_cbfn(cmdq_ent, BFA_STATUS_FAILED);
}
 }
@@ -242,8 +243,8 @@ bfa_msgq_cmdq_ci_update(struct bfa_msgq_cmdq *cmdq, struct 
bfi_mbmsg *mb)
 
/* Walk through pending list to see if the command can be posted */
while (!list_empty(&cmdq->pending_q)) {
-   cmd =
-   (struct bfa_msgq_cmd_entry *)bfa_q_first(&cmdq->pending_q);
+   cmd = list_first_entry(&cmdq->pending_q,
+  struct bfa_msgq_cmd_entry, qe);
if (ntohs(cmd->msg_hdr->num_entries) <=
BFA_MSGQ_FREE_CNT(cmdq)) {
list_del(&cmd->qe);
@@ -615,7 +616,6 @@ bfa_msgq_attach(struct bfa_msgq *msgq, struct bfa_ioc *ioc)
bfa_msgq_rspq_attach(&msgq->rspq, msgq);
 
bfa_nw_ioc_mbox_regisr(msgq->ioc, BFI_MC_MSGQ, bfa_msgq_isr, msgq);
-   bfa_q_qe_init(&msgq->ioc_notify);
bfa_ioc_notify_init(&msgq->ioc_notify, bfa_msgq_notify, msgq);
bfa_nw_ioc_notify_register(msgq->ioc, &msgq->ioc_notify);
 }
diff --git a/drivers/net/ethernet/brocade/bna/bna.h 
b/drivers/net/ethernet/brocade/bna/bna.h
index 4f16ee2..66e6e09 100644
--- a/drivers/net/ethernet/brocade/bna/bna.h
+++ b/drivers/net/ethernet/brocade/bna/bna.h
@@ -283,7 +283,6 @@ void bna_hw_stats_get(struct bna *bna);
 
 /* APIs for RxF */
 struct bna_mac *bna_cam_mod_mac_get(struct list_head *head);
-void bna_cam_mod_mac_put(struct list_head *tail, struct bna_mac *mac);
 struct bna_mcam_handle *bna_mcam_mod_handle_get(struct bna_mcam_mod *mod);
 void bna_mcam_mod_handle_put(struct bna_mcam_mod *mcam_mod,
  struct bna_mcam_handle *handle);
diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c 
b

[PATCH net-next v2 14/19] bna: use memdup_user to copy userspace buffers

2015-06-11 Thread Ivan Vecera
Patch converts kzalloc->copy_from_user sequence to memdup_user. There
is also one useless assignment of NULL to bnad->regdata as it is followed
by assignment of kzalloc output.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 27 -
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c 
b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
index 72c8955..ad7af5c 100644
--- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
+++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
@@ -321,15 +321,10 @@ bnad_debugfs_write_regrd(struct file *file, const char 
__user *buf,
unsigned long flags;
void *kern_buf;
 
-   /* Allocate memory to store the user space buf */
-   kern_buf = kzalloc(nbytes, GFP_KERNEL);
-   if (!kern_buf)
-   return -ENOMEM;
-
-   if (copy_from_user(kern_buf, (void  __user *)buf, nbytes)) {
-   kfree(kern_buf);
-   return -ENOMEM;
-   }
+   /* Copy the user space buf */
+   kern_buf = memdup_user(buf, nbytes);
+   if (IS_ERR(kern_buf))
+   return PTR_ERR(kern_buf);
 
rc = sscanf(kern_buf, "%x:%x", &addr, &len);
if (rc < 2) {
@@ -341,7 +336,6 @@ bnad_debugfs_write_regrd(struct file *file, const char 
__user *buf,
 
kfree(kern_buf);
kfree(bnad->regdata);
-   bnad->regdata = NULL;
bnad->reglen = 0;
 
bnad->regdata = kzalloc(len << 2, GFP_KERNEL);
@@ -388,15 +382,10 @@ bnad_debugfs_write_regwr(struct file *file, const char 
__user *buf,
unsigned long flags;
void *kern_buf;
 
-   /* Allocate memory to store the user space buf */
-   kern_buf = kzalloc(nbytes, GFP_KERNEL);
-   if (!kern_buf)
-   return -ENOMEM;
-
-   if (copy_from_user(kern_buf, (void  __user *)buf, nbytes)) {
-   kfree(kern_buf);
-   return -ENOMEM;
-   }
+   /* Copy the user space buf */
+   kern_buf = memdup_user(buf, nbytes);
+   if (IS_ERR(kern_buf))
+   return PTR_ERR(kern_buf);
 
rc = sscanf(kern_buf, "%x:%x", &addr, &val);
if (rc < 2) {
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 08/19] bna: remove oper_state_cbfn from struct bna_rxf

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna.h   | 15 ---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c |  6 --
 drivers/net/ethernet/brocade/bna/bna_types.h |  4 
 3 files changed, 25 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna.h 
b/drivers/net/ethernet/brocade/bna/bna.h
index 0962e54..4f16ee2 100644
--- a/drivers/net/ethernet/brocade/bna/bna.h
+++ b/drivers/net/ethernet/brocade/bna/bna.h
@@ -119,21 +119,6 @@ do {   
\
}   \
 } while (0)
 
-#definecall_rxf_pause_cbfn(rxf)
\
-do {   \
-   if ((rxf)->oper_state_cbfn) {   \
-   void (*cbfn)(struct bnad *, struct bna_rx *);   \
-   struct bnad *cbarg; \
-   cbfn = (rxf)->oper_state_cbfn;  \
-   cbarg = (rxf)->oper_state_cbarg;\
-   (rxf)->oper_state_cbfn = NULL;  \
-   (rxf)->oper_state_cbarg = NULL; \
-   cbfn(cbarg, rxf->rx);   \
-   }   \
-} while (0)
-
-#definecall_rxf_resume_cbfn(rxf) call_rxf_pause_cbfn(rxf)
-
 #define is_xxx_enable(mode, bitmask, xxx) ((bitmask & xxx) && (mode & xxx))
 
 #define is_xxx_disable(mode, bitmask, xxx) ((bitmask & xxx) && !(mode & xxx))
diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 16d36df..27f75d7 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -103,12 +103,10 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum 
bna_rxf_event event)
 
case RXF_E_PAUSE:
rxf->flags |= BNA_RXF_F_PAUSED;
-   call_rxf_pause_cbfn(rxf);
break;
 
case RXF_E_RESUME:
rxf->flags &= ~BNA_RXF_F_PAUSED;
-   call_rxf_resume_cbfn(rxf);
break;
 
default:
@@ -119,7 +117,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event 
event)
 static void
 bna_rxf_sm_paused_entry(struct bna_rxf *rxf)
 {
-   call_rxf_pause_cbfn(rxf);
 }
 
 static void
@@ -166,7 +163,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum bna_rxf_event 
event)
bna_rxf_cfg_reset(rxf);
call_rxf_start_cbfn(rxf);
call_rxf_cam_fltr_cbfn(rxf);
-   call_rxf_resume_cbfn(rxf);
bfa_fsm_set_state(rxf, bna_rxf_sm_stopped);
break;
 
@@ -197,7 +193,6 @@ bna_rxf_sm_started_entry(struct bna_rxf *rxf)
 {
call_rxf_start_cbfn(rxf);
call_rxf_cam_fltr_cbfn(rxf);
-   call_rxf_resume_cbfn(rxf);
 }
 
 static void
@@ -238,7 +233,6 @@ bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum 
bna_rxf_event event)
switch (event) {
case RXF_E_FAIL:
bna_rxf_cfg_reset(rxf);
-   call_rxf_pause_cbfn(rxf);
bfa_fsm_set_state(rxf, bna_rxf_sm_stopped);
break;
 
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index a50ee99..96a02f2 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -739,10 +739,6 @@ struct bna_rxf {
void (*stop_cbfn) (struct bna_rx *rx);
struct bna_rx *stop_cbarg;
 
-   /* callback for bna_rx_receive_pause() / bna_rx_receive_resume() */
-   void (*oper_state_cbfn) (struct bnad *bnad, struct bna_rx *rx);
-   struct bnad *oper_state_cbarg;
-
/**
 * callback for:
 *  bna_rxf_ucast_set()
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 17/19] bna: use list_for_each_entry where appropriate

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_ioc.c   |   5 +-
 drivers/net/ethernet/brocade/bna/bna.h   |  41 --
 drivers/net/ethernet/brocade/bna/bna_enet.c  |  23 --
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 117 +--
 4 files changed, 37 insertions(+), 149 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index dabbb30..2c74beb 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1091,12 +1091,9 @@ static void
 bfa_ioc_event_notify(struct bfa_ioc *ioc, enum bfa_ioc_event event)
 {
struct bfa_ioc_notify *notify;
-   struct list_head*qe;
 
-   list_for_each(qe, &ioc->notify_q) {
-   notify = (struct bfa_ioc_notify *)qe;
+   list_for_each_entry(notify, &ioc->notify_q, qe)
notify->cbfn(notify->cbarg, event);
-   }
 }
 
 static void
diff --git a/drivers/net/ethernet/brocade/bna/bna.h 
b/drivers/net/ethernet/brocade/bna/bna.h
index 66e6e09..dc845b2 100644
--- a/drivers/net/ethernet/brocade/bna/bna.h
+++ b/drivers/net/ethernet/brocade/bna/bna.h
@@ -208,28 +208,24 @@ do {  
\
 #define bna_rx_rid_mask(_bna) ((_bna)->rx_mod.rid_mask)
 
 #define bna_tx_from_rid(_bna, _rid, _tx)   \
-do {   \
-   struct bna_tx_mod *__tx_mod = &(_bna)->tx_mod;\
-   struct bna_tx *__tx;\
-   struct list_head *qe;  \
-   _tx = NULL;  \
-   list_for_each(qe, &__tx_mod->tx_active_q) {  \
-   __tx = (struct bna_tx *)qe;  \
-   if (__tx->rid == (_rid)) {\
-   (_tx) = __tx;  \
-   break;\
-   }  \
-   }  \
+do {   \
+   struct bna_tx_mod *__tx_mod = &(_bna)->tx_mod;  \
+   struct bna_tx *__tx;\
+   _tx = NULL; \
+   list_for_each_entry(__tx, &__tx_mod->tx_active_q, qe) { \
+   if (__tx->rid == (_rid)) {  \
+   (_tx) = __tx;   \
+   break;  \
+   }   \
+   }   \
 } while (0)
 
 #define bna_rx_from_rid(_bna, _rid, _rx)   \
 do {   \
struct bna_rx_mod *__rx_mod = &(_bna)->rx_mod;  \
struct bna_rx *__rx;\
-   struct list_head *qe;   \
_rx = NULL; \
-   list_for_each(qe, &__rx_mod->rx_active_q) { \
-   __rx = (struct bna_rx *)qe; \
+   list_for_each_entry(__rx, &__rx_mod->rx_active_q, qe) { \
if (__rx->rid == (_rid)) {  \
(_rx) = __rx;   \
break;  \
@@ -249,15 +245,12 @@ do {  
\
 
 static inline struct bna_mac *bna_mac_find(struct list_head *q, u8 *addr)
 {
-   struct bna_mac *mac = NULL;
-   struct list_head *qe;
-   list_for_each(qe, q) {
-   if (ether_addr_equal(((struct bna_mac *)qe)->addr, addr)) {
-   mac = (struct bna_mac *)qe;
-   break;
-   }
-   }
-   return mac;
+   struct bna_mac *mac;
+
+   list_for_each_entry(mac, q, qe)
+   if (ether_addr_equal(mac->addr, addr))
+   return mac;
+   return NULL;
 }
 
 #define bna_attr(_bna) (&(_bna)->ioceth.attr)
diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c 
b/drivers/net/ethernet/brocade/bna/bna_enet.c
index bd8f2c2..05680e0 100644
--- a/drivers/net/ethernet/brocade/bna/bna_enet.c
+++ b/drivers/net/ethernet/brocade/bna/bna_enet.c
@@ -1806,17 +1806,6 @@ bna_ucam_mod_init(struct bna_ucam_mod *ucam_mod, struct 
bna *bna,
 static void
 bna_ucam_

[PATCH net-next v2 01/19] bna: use ether_addr_copy instead of memcpy

2015-06-11 Thread Ivan Vecera
Parameters of all ether_addr_copy instances were checked for proper
alignment. Alignment of bnad_bcast_addr is forced to 2 as the implicit
alignment is 1.
I have also renamed address parameter of bnad_set_mac_address() to addr.
The name mac_addr was a little bit confusing as the real parameter is
struct sockaddr *.

v2: added __aligned directive to bnad_bcast_addr, renamed parameter of
bnad_set_mac_address() (thx j...@perches.com)

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 12 ++--
 drivers/net/ethernet/brocade/bna/bnad.c  | 22 ++
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 8ab3a5f..30d5e7f 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -876,7 +876,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
bfa_q_qe_init(&rxf->ucast_pending_mac->qe);
}
 
-   memcpy(rxf->ucast_pending_mac->addr, ucmac, ETH_ALEN);
+   ether_addr_copy(rxf->ucast_pending_mac->addr, ucmac);
rxf->ucast_pending_set = 1;
rxf->cam_fltr_cbfn = cbfn;
rxf->cam_fltr_cbarg = rx->bna->bnad;
@@ -905,7 +905,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr,
if (mac == NULL)
return BNA_CB_MCAST_LIST_FULL;
bfa_q_qe_init(&mac->qe);
-   memcpy(mac->addr, addr, ETH_ALEN);
+   ether_addr_copy(mac->addr, addr);
list_add_tail(&mac->qe, &rxf->mcast_pending_add_q);
 
rxf->cam_fltr_cbfn = cbfn;
@@ -955,7 +955,7 @@ bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 
*uclist,
if (mac == NULL)
goto err_return;
bfa_q_qe_init(&mac->qe);
-   memcpy(mac->addr, mcaddr, ETH_ALEN);
+   ether_addr_copy(mac->addr, mcaddr);
list_add_tail(&mac->qe, &list_head);
mcaddr += ETH_ALEN;
}
@@ -1026,7 +1026,7 @@ bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 
*mclist,
if (mac == NULL)
goto err_return;
bfa_q_qe_init(&mac->qe);
-   memcpy(mac->addr, mcaddr, ETH_ALEN);
+   ether_addr_copy(mac->addr, mcaddr);
list_add_tail(&mac->qe, &list_head);
 
mcaddr += ETH_ALEN;
@@ -1149,8 +1149,8 @@ bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf)
/* Set default unicast MAC */
if (rxf->ucast_pending_set) {
rxf->ucast_pending_set = 0;
-   memcpy(rxf->ucast_active_mac.addr,
-   rxf->ucast_pending_mac->addr, ETH_ALEN);
+   ether_addr_copy(rxf->ucast_active_mac.addr,
+   rxf->ucast_pending_mac->addr);
rxf->ucast_active_set = 1;
bna_bfi_ucast_req(rxf, &rxf->ucast_active_mac,
BFI_ENET_H2I_MAC_UCAST_SET_REQ);
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
b/drivers/net/ethernet/brocade/bna/bnad.c
index caae6cb..3e7c092 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -57,7 +57,8 @@ static u32 bnad_rxqs_per_cq = 2;
 static u32 bna_id;
 static struct mutex bnad_list_mutex;
 static LIST_HEAD(bnad_list);
-static const u8 bnad_bcast_addr[] =  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+static const u8 bnad_bcast_addr[] __aligned(2) =
+   { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 /*
  * Local MACROS
@@ -875,9 +876,9 @@ bnad_set_netdev_perm_addr(struct bnad *bnad)
 {
struct net_device *netdev = bnad->netdev;
 
-   memcpy(netdev->perm_addr, &bnad->perm_addr, netdev->addr_len);
+   ether_addr_copy(netdev->perm_addr, bnad->perm_addr.mac);
if (is_zero_ether_addr(netdev->dev_addr))
-   memcpy(netdev->dev_addr, &bnad->perm_addr, netdev->addr_len);
+   ether_addr_copy(netdev->dev_addr, bnad->perm_addr.mac);
 }
 
 /* Control Path Handlers */
@@ -1862,8 +1863,7 @@ bnad_netdev_mc_list_get(struct net_device *netdev, u8 
*mc_list)
struct netdev_hw_addr *mc_addr;
 
netdev_for_each_mc_addr(mc_addr, netdev) {
-   memcpy(&mc_list[i * ETH_ALEN], &mc_addr->addr[0],
-   ETH_ALEN);
+   ether_addr_copy(&mc_list[i * ETH_ALEN], &mc_addr->addr[0]);
i++;
}
 }
@@ -3141,8 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad)
 
entry = 0;
netdev_for_each_uc_addr(ha, netdev) {
-   memcpy(&mac_list[entry * ETH_ALEN],
-  &ha->addr[0], ETH_ALEN);
+   ether_addr_copy(&mac_list[entry * ETH_ALEN], &ha->addr[0]);
entry++;
}
 
@@ -3183,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad)
if (mac_list == NULL)
goto mode_allmulti;
 
-   memcpy(&mac_list[0], &bna

[PATCH net-next v2 06/19] bna: remove unused cbfn parameter

2015-06-11 Thread Ivan Vecera
removed:
bna_rx_ucast_add
bna_rx_ucast_del

simplified:
bna_enet_pause_config
bna_rx_mcast_delall
bna_rx_mcast_listset
bna_rx_mode_set
bna_rx_ucast_listset
bna_rx_ucast_set

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna.h  | 24 +
 drivers/net/ethernet/brocade/bna/bna_enet.c |  5 +---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c| 35 +++--
 drivers/net/ethernet/brocade/bna/bnad.c | 18 ++---
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c |  2 +-
 5 files changed, 25 insertions(+), 59 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna.h 
b/drivers/net/ethernet/brocade/bna/bna.h
index 130010d..0962e54 100644
--- a/drivers/net/ethernet/brocade/bna/bna.h
+++ b/drivers/net/ethernet/brocade/bna/bna.h
@@ -386,30 +386,19 @@ void bna_rx_coalescing_timeo_set(struct bna_rx *rx, int 
coalescing_timeo);
 void bna_rx_dim_reconfig(struct bna *bna, const u32 vector[][BNA_BIAS_T_MAX]);
 void bna_rx_dim_update(struct bna_ccb *ccb);
 enum bna_cb_status
-bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
-void (*cbfn)(struct bnad *, struct bna_rx *));
-enum bna_cb_status
-bna_rx_ucast_add(struct bna_rx *rx, u8* ucmac,
-void (*cbfn)(struct bnad *, struct bna_rx *));
-enum bna_cb_status
-bna_rx_ucast_del(struct bna_rx *rx, u8 *ucmac,
-void (*cbfn)(struct bnad *, struct bna_rx *));
+bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac);
 enum bna_cb_status
-bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist,
-void (*cbfn)(struct bnad *, struct bna_rx *));
+bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist);
 enum bna_cb_status
 bna_rx_mcast_add(struct bna_rx *rx, u8 *mcmac,
 void (*cbfn)(struct bnad *, struct bna_rx *));
 enum bna_cb_status
-bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac,
-void (*cbfn)(struct bnad *, struct bna_rx *));
+bna_rx_mcast_listset(struct bna_rx *rx, int count, u8 *mcmac);
 void
-bna_rx_mcast_delall(struct bna_rx *rx,
-   void (*cbfn)(struct bnad *, struct bna_rx *));
+bna_rx_mcast_delall(struct bna_rx *rx);
 enum bna_cb_status
 bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode rxmode,
-   enum bna_rxmode bitmask,
-   void (*cbfn)(struct bnad *, struct bna_rx *));
+   enum bna_rxmode bitmask);
 void bna_rx_vlan_add(struct bna_rx *rx, int vlan_id);
 void bna_rx_vlan_del(struct bna_rx *rx, int vlan_id);
 void bna_rx_vlanfilter_enable(struct bna_rx *rx);
@@ -429,8 +418,7 @@ void bna_enet_enable(struct bna_enet *enet);
 void bna_enet_disable(struct bna_enet *enet, enum bna_cleanup_type type,
  void (*cbfn)(void *));
 void bna_enet_pause_config(struct bna_enet *enet,
-  struct bna_pause_config *pause_config,
-  void (*cbfn)(struct bnad *));
+  struct bna_pause_config *pause_config);
 void bna_enet_mtu_set(struct bna_enet *enet, int mtu,
  void (*cbfn)(struct bnad *));
 void bna_enet_perm_mac_get(struct bna_enet *enet, u8 *mac);
diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c 
b/drivers/net/ethernet/brocade/bna/bna_enet.c
index 54902ce..b8de17b 100644
--- a/drivers/net/ethernet/brocade/bna/bna_enet.c
+++ b/drivers/net/ethernet/brocade/bna/bna_enet.c
@@ -1308,13 +1308,10 @@ bna_enet_disable(struct bna_enet *enet, enum 
bna_cleanup_type type,
 
 void
 bna_enet_pause_config(struct bna_enet *enet,
- struct bna_pause_config *pause_config,
- void (*cbfn)(struct bnad *))
+ struct bna_pause_config *pause_config)
 {
enet->pause_config = *pause_config;
 
-   enet->pause_cbfn = cbfn;
-
bfa_fsm_send_event(enet, ENET_E_PAUSE_CFG);
 }
 
diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 2c85f72..16d36df 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -863,8 +863,7 @@ bna_rxf_fail(struct bna_rxf *rxf)
 }
 
 enum bna_cb_status
-bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
-void (*cbfn)(struct bnad *, struct bna_rx *))
+bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac)
 {
struct bna_rxf *rxf = &rx->rxf;
 
@@ -878,7 +877,7 @@ bna_rx_ucast_set(struct bna_rx *rx, u8 *ucmac,
 
ether_addr_copy(rxf->ucast_pending_mac->addr, ucmac);
rxf->ucast_pending_set = 1;
-   rxf->cam_fltr_cbfn = cbfn;
+   rxf->cam_fltr_cbfn = NULL;
rxf->cam_fltr_cbarg = rx->bna->bnad;
 
bfa_fsm_send_event(rxf, RXF_E_CONFIG);
@@ -917,8 +916,7 @@ bna_rx_mcast_add(struct bna_rx *rx, u8 *addr,
 }
 
 enum bna_cb_status
-bna_rx_ucast_listset(struct bna_rx *rx, int count, u8 *uclist,
-void (*cbfn)(struct bnad *, struct bna_rx *))
+bna_rx_ucast_listset(struct bna_rx *rx, int count, u8

[PATCH net-next v2 05/19] bna: use BIT(x) instead of (1 << x)

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h   |  2 +-
 drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c  |  2 +-
 drivers/net/ethernet/brocade/bna/bfi_enet.h| 66 ++--
 drivers/net/ethernet/brocade/bna/bna_enet.c|  4 +-
 drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 70 +++---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c   | 22 +++
 6 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
index 679a503..16090fd 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs_mfg_comm.h
@@ -75,7 +75,7 @@ enum {
CB_GPIO_FC4P2   = (4),  /*!< 4G 2port FC card   */
CB_GPIO_FC4P1   = (5),  /*!< 4G 1port FC card   */
CB_GPIO_DFLY= (6),  /*!< 8G 2port FC mezzanine card */
-   CB_GPIO_PROTO   = (1 << 7)  /*!< 8G 2port FC prototypes */
+   CB_GPIO_PROTO   = BIT(7)/*!< 8G 2port FC prototypes */
 };
 
 #define bfa_mfg_adapter_prop_init_gpio(gpio, card_type, prop)  \
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c
index 2e72445..4247d8a 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c
@@ -24,7 +24,7 @@
 #include "bfa_defs.h"
 
 #define bfa_ioc_ct_sync_pos(__ioc) \
-   ((u32) (1 << bfa_ioc_pcifn(__ioc)))
+   ((u32)BIT(bfa_ioc_pcifn(__ioc)))
 #define BFA_IOC_SYNC_REQD_SH   16
 #define bfa_ioc_ct_get_sync_ackd(__val) (__val & 0x)
 #define bfa_ioc_ct_clear_sync_ackd(__val) (__val & 0x)
diff --git a/drivers/net/ethernet/brocade/bna/bfi_enet.h 
b/drivers/net/ethernet/brocade/bna/bfi_enet.h
index fad3a12..d7be7ea8 100644
--- a/drivers/net/ethernet/brocade/bna/bfi_enet.h
+++ b/drivers/net/ethernet/brocade/bna/bfi_enet.h
@@ -68,13 +68,13 @@ union bfi_addr_be_u {
 #define BFI_ENET_TXQ_WI_EXTENSION  (0x104) /* Extension WI */
 
 /* TxQ Entry Control Flags */
-#define BFI_ENET_TXQ_WI_CF_FCOE_CRC(1 << 8)
-#define BFI_ENET_TXQ_WI_CF_IPID_MODE   (1 << 5)
-#define BFI_ENET_TXQ_WI_CF_INS_PRIO(1 << 4)
-#define BFI_ENET_TXQ_WI_CF_INS_VLAN(1 << 3)
-#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM   (1 << 2)
-#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM   (1 << 1)
-#define BFI_ENET_TXQ_WI_CF_IP_CKSUM(1 << 0)
+#define BFI_ENET_TXQ_WI_CF_FCOE_CRCBIT(8)
+#define BFI_ENET_TXQ_WI_CF_IPID_MODE   BIT(5)
+#define BFI_ENET_TXQ_WI_CF_INS_PRIOBIT(4)
+#define BFI_ENET_TXQ_WI_CF_INS_VLANBIT(3)
+#define BFI_ENET_TXQ_WI_CF_UDP_CKSUM   BIT(2)
+#define BFI_ENET_TXQ_WI_CF_TCP_CKSUM   BIT(1)
+#define BFI_ENET_TXQ_WI_CF_IP_CKSUMBIT(0)
 
 struct bfi_enet_txq_wi_base {
u8  reserved;
@@ -122,32 +122,32 @@ struct bfi_enet_rxq_entry {
 
 /*   R X   C O M P L E T I O N   Q U E U E   D E F I N E S   */
 /* CQ Entry Flags */
-#defineBFI_ENET_CQ_EF_MAC_ERROR(1 <<  0)
-#defineBFI_ENET_CQ_EF_FCS_ERROR(1 <<  1)
-#defineBFI_ENET_CQ_EF_TOO_LONG (1 <<  2)
-#defineBFI_ENET_CQ_EF_FC_CRC_OK(1 <<  3)
+#define BFI_ENET_CQ_EF_MAC_ERROR   BIT(0)
+#define BFI_ENET_CQ_EF_FCS_ERROR   BIT(1)
+#define BFI_ENET_CQ_EF_TOO_LONGBIT(2)
+#define BFI_ENET_CQ_EF_FC_CRC_OK   BIT(3)
 
-#defineBFI_ENET_CQ_EF_RSVD1(1 <<  4)
-#defineBFI_ENET_CQ_EF_L4_CKSUM_OK  (1 <<  5)
-#defineBFI_ENET_CQ_EF_L3_CKSUM_OK  (1 <<  6)
-#defineBFI_ENET_CQ_EF_HDS_HEADER   (1 <<  7)
+#define BFI_ENET_CQ_EF_RSVD1   BIT(4)
+#define BFI_ENET_CQ_EF_L4_CKSUM_OK BIT(5)
+#define BFI_ENET_CQ_EF_L3_CKSUM_OK BIT(6)
+#define BFI_ENET_CQ_EF_HDS_HEADER  BIT(7)
 
-#defineBFI_ENET_CQ_EF_UDP  (1 <<  8)
-#defineBFI_ENET_CQ_EF_TCP  (1 <<  9)
-#defineBFI_ENET_CQ_EF_IP_OPTIONS   (1 << 10)
-#defineBFI_ENET_CQ_EF_IPV6 (1 << 11)
+#define BFI_ENET_CQ_EF_UDP BIT(8)
+#define BFI_ENET_CQ_EF_TCP BIT(9)
+#define BFI_ENET_CQ_EF_IP_OPTIONS  BIT(10)
+#define BFI_ENET_CQ_EF_IPV6BIT(11)
 
-#defineBFI_ENET_CQ_EF_IPV4 (1 << 12)
-#defineBFI_ENET_CQ_EF_VLAN (1 << 13)
-#defineBFI_ENET_CQ_EF_RSS  (1 << 14)
-#defineBFI_ENET_CQ_EF_RSVD2(1 << 15)
+#define BFI_ENET_CQ_EF_IPV4BIT(12)
+#define BFI_ENET_CQ_EF_VLANBIT(13)
+#define BFI_ENET_CQ_EF_RSS BIT(14)
+#define BFI_ENET_CQ_EF_RSVD2   BIT(15)
 
-#defineBFI_ENET_CQ_EF_MCAST_MATCH  (1 << 16)
-#defineBFI_ENET_CQ_EF_MCAST(1 << 17)
-#define BFI_ENET_CQ_EF_BCAST   (1 << 18)
-#defineBFI_ENET_CQ_EF_REMOTE

[PATCH net-next v2 00/19] bna: clean-up

2015-06-11 Thread Ivan Vecera
The patches clean the bna driver.

v2: changes & comments requested by Joe

Ivan Vecera (19):
  bna: use ether_addr_copy instead of memcpy
  bna: get rid of mac_t
  bna: replace pragma(pack) with attribute __packed
  bna: get rid of duplicate and unused macros
  bna: use BIT(x) instead of (1 << x)
  bna: remove unused cbfn parameter
  bna: remove pause_cbfn from struct bna_enet
  bna: remove oper_state_cbfn from struct bna_rxf
  bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx
  bna: remove RXF_E_PAUSE and RXF_E_RESUME events
  bna: remove paused from bna_rx_config and flags from bna_rxf
  bna: remove TX_E_PRIO_CHANGE event and BNA_TX_F_PRIO_CHANGED flag
  bna: correct comparisons/assignments to bool
  bna: use memdup_user to copy userspace buffers
  bna: remove useless pointer assignment
  bna: get rid of private macros for manipulation with lists
  bna: use list_for_each_entry where appropriate
  bna: fix timeout API argument type
  bna: use netdev_* and dev_* instead of printk and pr_*

 drivers/net/ethernet/brocade/bna/bfa_cee.c |   1 -
 drivers/net/ethernet/brocade/bna/bfa_cs.h  |  14 -
 drivers/net/ethernet/brocade/bna/bfa_defs.h|  11 +-
 drivers/net/ethernet/brocade/bna/bfa_defs_cna.h|  16 +-
 .../net/ethernet/brocade/bna/bfa_defs_mfg_comm.h   |   8 +-
 drivers/net/ethernet/brocade/bna/bfa_ioc.c |  61 +-
 drivers/net/ethernet/brocade/bna/bfa_ioc.h |  23 +-
 drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c  |   2 +-
 drivers/net/ethernet/brocade/bna/bfa_msgq.c|  10 +-
 drivers/net/ethernet/brocade/bna/bfi.h |  84 ++-
 drivers/net/ethernet/brocade/bna/bfi_cna.h |  30 +-
 drivers/net/ethernet/brocade/bna/bfi_enet.h| 176 +++---
 drivers/net/ethernet/brocade/bna/bna.h | 186 +-
 drivers/net/ethernet/brocade/bna/bna_enet.c| 101 +---
 drivers/net/ethernet/brocade/bna/bna_hw_defs.h |  70 +--
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c   | 665 +
 drivers/net/ethernet/brocade/bna/bna_types.h   |  19 -
 drivers/net/ethernet/brocade/bna/bnad.c| 101 ++--
 drivers/net/ethernet/brocade/bna/bnad.h|   2 +-
 drivers/net/ethernet/brocade/bna/bnad_debugfs.c|  61 +-
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c|  15 +-
 drivers/net/ethernet/brocade/bna/cna.h |  62 --
 drivers/net/ethernet/brocade/bna/cna_fwimg.c   |   2 +-
 23 files changed, 491 insertions(+), 1229 deletions(-)

-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 04/19] bna: get rid of duplicate and unused macros

2015-06-11 Thread Ivan Vecera
replaced macros:
BNA_MAC_IS_EQUAL -> ether_addr_equal
BNA_POWER_OF_2 -> is_power_of_2
BNA_TO_POWER_OF_2_HIGH -> roundup_pow_of_two

removed unused macros:
bfa_fsm_get_state
bfa_ioc_clr_stats
bfa_ioc_fetch_stats
bfa_ioc_get_alt_ioc_fwstate
bfa_ioc_isr_mode_set
bfa_ioc_maxfrsize
bfa_ioc_mbox_cmd_pending
bfa_ioc_ownership_reset
bfa_ioc_rx_bbcredit
bfa_ioc_state_disabled
bfa_sm_cmp_state
bfa_sm_get_state
bfa_sm_send_event
bfa_sm_set_state
bfa_sm_state_decl
BFA_STRING_32
BFI_ADAPTER_IS_{PROTO,TTV,UNSUPP)
BFI_IOC_ENDIAN_SIG
BNA_{C,RX,TX}Q_PAGE_INDEX_MAX
BNA_{C,RX,TX}Q_PAGE_INDEX_MAX_SHIFT
BNA_{C,RX,TX}Q_QPGE_PTR_GET
BNA_IOC_TIMER_FREQ
BNA_MESSAGE_SIZE
BNA_QE_INDX_2_PTR
BNA_QE_INDX_RANGE
BNA_Q_GET_{C,P}I
BNA_Q_{C,P}I_ADD
BNA_Q_FREE_COUNT
BNA_Q_IN_USE_COUNT
BNA_TO_POWER_OF_2
containing_rec

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_cs.h   |  14 
 drivers/net/ethernet/brocade/bna/bfa_defs.h |   1 -
 drivers/net/ethernet/brocade/bna/bfa_ioc.c  |  14 
 drivers/net/ethernet/brocade/bna/bfa_ioc.h  |  13 ---
 drivers/net/ethernet/brocade/bna/bfi.h  |   8 --
 drivers/net/ethernet/brocade/bna/bna.h  | 105 +---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c|  13 ++-
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c |   4 +-
 8 files changed, 9 insertions(+), 163 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_cs.h 
b/drivers/net/ethernet/brocade/bna/bfa_cs.h
index af25d8e..1d11d66 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_cs.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_cs.h
@@ -28,19 +28,6 @@
 
 typedef void (*bfa_sm_t)(void *sm, int event);
 
-/* oc - object class eg. bfa_ioc
- * st - state, eg. reset
- * otype - object type, eg. struct bfa_ioc
- * etype - object type, eg. enum ioc_event
- */
-#define bfa_sm_state_decl(oc, st, otype, etype)\
-   static void oc ## _sm_ ## st(otype * fsm, etype event)
-
-#define bfa_sm_set_state(_sm, _state)  ((_sm)->sm = (bfa_sm_t)(_state))
-#define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event)))
-#define bfa_sm_get_state(_sm)  ((_sm)->sm)
-#define bfa_sm_cmp_state(_sm, _state)  ((_sm)->sm == (bfa_sm_t)(_state))
-
 /* For converting from state machine function to state encoding. */
 struct bfa_sm_table {
bfa_sm_tsm; /*!< state machine function */
@@ -67,7 +54,6 @@ typedef void (*bfa_fsm_t)(void *fsm, int event);
 } while (0)
 
 #define bfa_fsm_send_event(_fsm, _event)   ((_fsm)->fsm((_fsm), (_event)))
-#define bfa_fsm_get_state(_fsm)((_fsm)->fsm)
 #define bfa_fsm_cmp_state(_fsm, _state)
\
((_fsm)->fsm == (bfa_fsm_t)(_state))
 
diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h 
b/drivers/net/ethernet/brocade/bna/bfa_defs.h
index 6827d91..d152b3f 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h
@@ -24,7 +24,6 @@
 #include "bfa_defs_status.h"
 #include "bfa_defs_mfg_comm.h"
 
-#define BFA_STRING_32  32
 #define BFA_VERSION_LEN 64
 
 /* -- adapter definitions  */
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 82c95f8..29e0428 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -23,14 +23,6 @@
 
 /* IOC local definitions */
 
-#define bfa_ioc_state_disabled(__sm)   \
-   (((__sm) == BFI_IOC_UNINIT) ||  \
-((__sm) == BFI_IOC_INITING) || \
-((__sm) == BFI_IOC_HWINIT) ||  \
-((__sm) == BFI_IOC_DISABLED) ||\
-((__sm) == BFI_IOC_FAIL) ||\
-((__sm) == BFI_IOC_CFG_DISABLED))
-
 /* Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details. */
 
 #define bfa_ioc_firmware_lock(__ioc)   \
@@ -57,12 +49,6 @@
((__ioc)->ioc_hwif->ioc_get_fwstate(__ioc))
 #define bfa_ioc_set_alt_ioc_fwstate(__ioc, __fwstate)  \
((__ioc)->ioc_hwif->ioc_set_alt_fwstate(__ioc, __fwstate))
-#define bfa_ioc_get_alt_ioc_fwstate(__ioc) \
-   ((__ioc)->ioc_hwif->ioc_get_alt_fwstate(__ioc))
-
-#define bfa_ioc_mbox_cmd_pending(__ioc)\
-   (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \
-   readl((__ioc)->ioc_regs.hfn_mbox_cmd))
 
 static bool bfa_nw_auto_recover = true;
 
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
index b37bc16..b6ad2c5 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h
@@ -232,12 +232,6 @@ struct bfa_ioc_hwif {
 #define bfa_ioc_asic_gen(__ioc)((__ioc)->asic_gen)
 #define bfa_ioc_is_default(__ioc)  \
(bfa_ioc_pcifn(_

[PATCH net-next v2 09/19] bna: remove prio_change_cbfn oper_state_cbfn from struct bna_tx

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 13 -
 drivers/net/ethernet/brocade/bna/bna_types.h |  3 ---
 2 files changed, 16 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 27f75d7..471e74d 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -3000,16 +3000,6 @@ do { 
\
}   \
 } while (0)
 
-#define call_tx_prio_change_cbfn(tx)   \
-do {   \
-   if ((tx)->prio_change_cbfn) {   \
-   void (*cbfn)(struct bnad *, struct bna_tx *);   \
-   cbfn = (tx)->prio_change_cbfn;  \
-   (tx)->prio_change_cbfn = NULL;  \
-   cbfn((tx)->bna->bnad, (tx));\
-   }   \
-} while (0)
-
 static void bna_tx_mod_cb_tx_stopped(void *tx_mod, struct bna_tx *tx);
 static void bna_bfi_tx_enet_start(struct bna_tx *tx);
 static void bna_tx_enet_stop(struct bna_tx *tx);
@@ -3062,7 +3052,6 @@ bna_tx_sm_stopped(struct bna_tx *tx, enum bna_tx_event 
event)
break;
 
case TX_E_PRIO_CHANGE:
-   call_tx_prio_change_cbfn(tx);
break;
 
case TX_E_BW_UPDATE:
@@ -3232,7 +3221,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum 
bna_tx_event event)
 
case TX_E_FAIL:
bfa_fsm_set_state(tx, bna_tx_sm_failed);
-   call_tx_prio_change_cbfn(tx);
tx->tx_cleanup_cbfn(tx->bna->bnad, tx);
break;
 
@@ -3253,7 +3241,6 @@ bna_tx_sm_prio_stop_wait(struct bna_tx *tx, enum 
bna_tx_event event)
 static void
 bna_tx_sm_prio_cleanup_wait_entry(struct bna_tx *tx)
 {
-   call_tx_prio_change_cbfn(tx);
tx->tx_cleanup_cbfn(tx->bna->bnad, tx);
 }
 
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index 96a02f2..095bd63 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -495,9 +495,6 @@ struct bna_tx {
void (*stop_cbfn)(void *arg, struct bna_tx *tx);
void*stop_cbarg;
 
-   /* callback for bna_tx_prio_set() */
-   void (*prio_change_cbfn)(struct bnad *bnad, struct bna_tx *tx);
-
struct bfa_msgq_cmd_entry msgq_cmd;
union {
struct bfi_enet_tx_cfg_req  cfg_req;
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 11/19] bna: remove paused from bna_rx_config and flags from bna_rxf

2015-06-11 Thread Ivan Vecera
The bna_rx_config struct member paused can be removed as it is never
written and as it cannot have non-zero value the bna_rxf struct member
flags also cannot have BNA_RXF_F_PAUSED value and is always zero.
So the flags member can be removed as well as bna_rxf_flags enum and
the code-paths that needs to have non-zero bna_rxf->flags.
This clean-up makes bna_rxf_sm_paused state unsed and can be also removed.
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 36 +---
 drivers/net/ethernet/brocade/bna/bna_types.h |  6 -
 2 files changed, 1 insertion(+), 41 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index ccf48a1..896aa82 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -59,8 +59,6 @@ static int bna_rxf_allmulti_cfg_reset(struct bna_rxf *rxf,
 
 bfa_fsm_state_decl(bna_rxf, stopped, struct bna_rxf,
enum bna_rxf_event);
-bfa_fsm_state_decl(bna_rxf, paused, struct bna_rxf,
-   enum bna_rxf_event);
 bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf,
enum bna_rxf_event);
 bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf,
@@ -79,11 +77,7 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event 
event)
 {
switch (event) {
case RXF_E_START:
-   if (rxf->flags & BNA_RXF_F_PAUSED) {
-   bfa_fsm_set_state(rxf, bna_rxf_sm_paused);
-   call_rxf_start_cbfn(rxf);
-   } else
-   bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait);
+   bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait);
break;
 
case RXF_E_STOP:
@@ -104,29 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event 
event)
 }
 
 static void
-bna_rxf_sm_paused_entry(struct bna_rxf *rxf)
-{
-}
-
-static void
-bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event event)
-{
-   switch (event) {
-   case RXF_E_STOP:
-   case RXF_E_FAIL:
-   bfa_fsm_set_state(rxf, bna_rxf_sm_stopped);
-   break;
-
-   case RXF_E_CONFIG:
-   call_rxf_cam_fltr_cbfn(rxf);
-   break;
-
-   default:
-   bfa_sm_fault(event);
-   }
-}
-
-static void
 bna_rxf_sm_cfg_wait_entry(struct bna_rxf *rxf)
 {
if (!bna_rxf_cfg_apply(rxf)) {
@@ -679,9 +650,6 @@ bna_rxf_init(struct bna_rxf *rxf,
INIT_LIST_HEAD(&rxf->mcast_active_q);
INIT_LIST_HEAD(&rxf->mcast_handle_q);
 
-   if (q_config->paused)
-   rxf->flags |= BNA_RXF_F_PAUSED;
-
rxf->rit = (u8 *)
res_info[BNA_RX_RES_MEM_T_RIT].res_u.mem_info.mdl[0].kva;
bna_rit_init(rxf, q_config->num_paths);
@@ -742,8 +710,6 @@ bna_rxf_uninit(struct bna_rxf *rxf)
rxf->rss_pending = 0;
rxf->vlan_strip_pending = false;
 
-   rxf->flags = 0;
-
rxf->rx = NULL;
 }
 
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index e56f650..134abf7 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -182,10 +182,6 @@ enum bna_rx_mod_flags {
BNA_RX_MOD_F_ENET_LOOPBACK  = 2,
 };
 
-enum bna_rxf_flags {
-   BNA_RXF_F_PAUSED= 1,
-};
-
 enum bna_rxf_event {
RXF_E_START = 1,
RXF_E_STOP  = 2,
@@ -668,7 +664,6 @@ struct bna_rx_config {
enum bna_rx_type rx_type;
int num_paths;
enum bna_rxp_type rxp_type;
-   int paused;
int coalescing_timeo;
/*
 * Small/Large (or Header/Data) buffer size to be configured
@@ -713,7 +708,6 @@ struct bna_rxp {
 /* RxF structure (hardware Rx Function) */
 struct bna_rxf {
bfa_fsm_t   fsm;
-   enum bna_rxf_flags flags;
 
struct bfa_msgq_cmd_entry msgq_cmd;
union {
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 13/19] bna: correct comparisons/assignments to bool

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bfa_ioc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c 
b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 29e0428..52fc439 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -1373,7 +1373,7 @@ static enum bfi_ioc_img_ver_cmp
 bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr *base_fwhdr,
 struct bfi_ioc_image_hdr *fwhdr_to_cmp)
 {
-   if (bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp) == false)
+   if (!bfa_ioc_fw_ver_compatible(base_fwhdr, fwhdr_to_cmp))
return BFI_IOC_IMG_VER_INCOMP;
 
if (fwhdr_to_cmp->fwver.patch > base_fwhdr->fwver.patch)
@@ -1384,7 +1384,7 @@ bfa_ioc_fw_ver_patch_cmp(struct bfi_ioc_image_hdr 
*base_fwhdr,
/* GA takes priority over internal builds of the same patch stream.
 * At this point major minor maint and patch numbers are same.
 */
-   if (fwhdr_is_ga(base_fwhdr) == true)
+   if (fwhdr_is_ga(base_fwhdr))
if (fwhdr_is_ga(fwhdr_to_cmp))
return BFI_IOC_IMG_VER_SAME;
else
@@ -2209,7 +2209,7 @@ bfa_nw_ioc_smem_read(struct bfa_ioc *ioc, void *tbuf, u32 
soff, u32 sz)
/*
 *  Hold semaphore to serialize pll init and fwtrc.
*/
-   if (bfa_nw_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg) == 0)
+   if (!bfa_nw_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg))
return 1;
 
writel(pgnum, ioc->ioc_regs.host_page_num_fn);
@@ -2264,7 +2264,7 @@ bfa_nw_ioc_debug_save_ftrc(struct bfa_ioc *ioc)
int tlen;
 
if (ioc->dbg_fwsave_once) {
-   ioc->dbg_fwsave_once = 0;
+   ioc->dbg_fwsave_once = false;
if (ioc->dbg_fwsave_len) {
tlen = ioc->dbg_fwsave_len;
bfa_nw_ioc_debug_fwtrc(ioc, ioc->dbg_fwsave, &tlen);
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 07/19] bna: remove pause_cbfn from struct bna_enet

2015-06-11 Thread Ivan Vecera
Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna_enet.c  | 15 ---
 drivers/net/ethernet/brocade/bna/bna_types.h |  3 ---
 2 files changed, 18 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_enet.c 
b/drivers/net/ethernet/brocade/bna/bna_enet.c
index b8de17b..dc9f73b 100644
--- a/drivers/net/ethernet/brocade/bna/bna_enet.c
+++ b/drivers/net/ethernet/brocade/bna/bna_enet.c
@@ -884,16 +884,6 @@ do {   
\
}   \
 } while (0)
 
-#define call_enet_pause_cbfn(enet) \
-do {   \
-   if ((enet)->pause_cbfn) {   \
-   void (*cbfn)(struct bnad *);\
-   cbfn = (enet)->pause_cbfn;  \
-   (enet)->pause_cbfn = NULL;  \
-   cbfn((enet)->bna->bnad);\
-   }   \
-} while (0)
-
 #define call_enet_mtu_cbfn(enet)   \
 do {   \
if ((enet)->mtu_cbfn) { \
@@ -925,7 +915,6 @@ bfa_fsm_state_decl(bna_enet, chld_stop_wait, struct 
bna_enet,
 static void
 bna_enet_sm_stopped_entry(struct bna_enet *enet)
 {
-   call_enet_pause_cbfn(enet);
call_enet_mtu_cbfn(enet);
call_enet_stop_cbfn(enet);
 }
@@ -947,7 +936,6 @@ bna_enet_sm_stopped(struct bna_enet *enet, enum 
bna_enet_event event)
break;
 
case ENET_E_PAUSE_CFG:
-   call_enet_pause_cbfn(enet);
break;
 
case ENET_E_MTU_CFG:
@@ -1039,7 +1027,6 @@ bna_enet_sm_started_entry(struct bna_enet *enet)
 * NOTE: Do not call bna_enet_chld_start() here, since it will be
 * inadvertently called during cfg_wait->started transition as well
 */
-   call_enet_pause_cbfn(enet);
call_enet_mtu_cbfn(enet);
 }
 
@@ -1211,8 +1198,6 @@ bna_enet_init(struct bna_enet *enet, struct bna *bna)
enet->stop_cbfn = NULL;
enet->stop_cbarg = NULL;
 
-   enet->pause_cbfn = NULL;
-
enet->mtu_cbfn = NULL;
 
bfa_fsm_set_state(enet, bna_enet_sm_stopped);
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index d0a7a56..a50ee99 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -362,9 +362,6 @@ struct bna_enet {
void (*stop_cbfn)(void *);
void*stop_cbarg;
 
-   /* Callback for bna_enet_pause_config() */
-   void (*pause_cbfn)(struct bnad *);
-
/* Callback for bna_enet_mtu_set() */
void (*mtu_cbfn)(struct bnad *);
 
-- 
2.3.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2 10/19] bna: remove RXF_E_PAUSE and RXF_E_RESUME events

2015-06-11 Thread Ivan Vecera
RXF_E_PAUSE & RXF_E_RESUME events are never sent for bna_rxf object so
they needn't to be handled. The bna_rxf's state bna_rxf_sm_fltr_clr_wait
and function bna_rxf_fltr_clear are unused after this so remove them also.

Signed-off-by: Ivan Vecera 
---
 drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 75 
 drivers/net/ethernet/brocade/bna/bna_types.h |  2 -
 2 files changed, 77 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c 
b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
index 471e74d..ccf48a1 100644
--- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
+++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c
@@ -46,7 +46,6 @@ do {  
\
 
 static int bna_rxf_cfg_apply(struct bna_rxf *rxf);
 static void bna_rxf_cfg_reset(struct bna_rxf *rxf);
-static int bna_rxf_fltr_clear(struct bna_rxf *rxf);
 static int bna_rxf_ucast_cfg_apply(struct bna_rxf *rxf);
 static int bna_rxf_promisc_cfg_apply(struct bna_rxf *rxf);
 static int bna_rxf_allmulti_cfg_apply(struct bna_rxf *rxf);
@@ -66,8 +65,6 @@ bfa_fsm_state_decl(bna_rxf, cfg_wait, struct bna_rxf,
enum bna_rxf_event);
 bfa_fsm_state_decl(bna_rxf, started, struct bna_rxf,
enum bna_rxf_event);
-bfa_fsm_state_decl(bna_rxf, fltr_clr_wait, struct bna_rxf,
-   enum bna_rxf_event);
 bfa_fsm_state_decl(bna_rxf, last_resp_wait, struct bna_rxf,
enum bna_rxf_event);
 
@@ -101,14 +98,6 @@ bna_rxf_sm_stopped(struct bna_rxf *rxf, enum bna_rxf_event 
event)
call_rxf_cam_fltr_cbfn(rxf);
break;
 
-   case RXF_E_PAUSE:
-   rxf->flags |= BNA_RXF_F_PAUSED;
-   break;
-
-   case RXF_E_RESUME:
-   rxf->flags &= ~BNA_RXF_F_PAUSED;
-   break;
-
default:
bfa_sm_fault(event);
}
@@ -132,11 +121,6 @@ bna_rxf_sm_paused(struct bna_rxf *rxf, enum bna_rxf_event 
event)
call_rxf_cam_fltr_cbfn(rxf);
break;
 
-   case RXF_E_RESUME:
-   rxf->flags &= ~BNA_RXF_F_PAUSED;
-   bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait);
-   break;
-
default:
bfa_sm_fault(event);
}
@@ -170,12 +154,6 @@ bna_rxf_sm_cfg_wait(struct bna_rxf *rxf, enum 
bna_rxf_event event)
/* No-op */
break;
 
-   case RXF_E_PAUSE:
-   rxf->flags |= BNA_RXF_F_PAUSED;
-   call_rxf_start_cbfn(rxf);
-   bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait);
-   break;
-
case RXF_E_FW_RESP:
if (!bna_rxf_cfg_apply(rxf)) {
/* No more pending config updates */
@@ -209,40 +187,6 @@ bna_rxf_sm_started(struct bna_rxf *rxf, enum bna_rxf_event 
event)
bfa_fsm_set_state(rxf, bna_rxf_sm_cfg_wait);
break;
 
-   case RXF_E_PAUSE:
-   rxf->flags |= BNA_RXF_F_PAUSED;
-   if (!bna_rxf_fltr_clear(rxf))
-   bfa_fsm_set_state(rxf, bna_rxf_sm_paused);
-   else
-   bfa_fsm_set_state(rxf, bna_rxf_sm_fltr_clr_wait);
-   break;
-
-   default:
-   bfa_sm_fault(event);
-   }
-}
-
-static void
-bna_rxf_sm_fltr_clr_wait_entry(struct bna_rxf *rxf)
-{
-}
-
-static void
-bna_rxf_sm_fltr_clr_wait(struct bna_rxf *rxf, enum bna_rxf_event event)
-{
-   switch (event) {
-   case RXF_E_FAIL:
-   bna_rxf_cfg_reset(rxf);
-   bfa_fsm_set_state(rxf, bna_rxf_sm_stopped);
-   break;
-
-   case RXF_E_FW_RESP:
-   if (!bna_rxf_fltr_clear(rxf)) {
-   /* No more pending CAM entries to clear */
-   bfa_fsm_set_state(rxf, bna_rxf_sm_paused);
-   }
-   break;
-
default:
bfa_sm_fault(event);
}
@@ -652,25 +596,6 @@ bna_rxf_cfg_apply(struct bna_rxf *rxf)
return 0;
 }
 
-/* Only software reset */
-static int
-bna_rxf_fltr_clear(struct bna_rxf *rxf)
-{
-   if (bna_rxf_ucast_cfg_reset(rxf, BNA_HARD_CLEANUP))
-   return 1;
-
-   if (bna_rxf_mcast_cfg_reset(rxf, BNA_HARD_CLEANUP))
-   return 1;
-
-   if (bna_rxf_promisc_cfg_reset(rxf, BNA_HARD_CLEANUP))
-   return 1;
-
-   if (bna_rxf_allmulti_cfg_reset(rxf, BNA_HARD_CLEANUP))
-   return 1;
-
-   return 0;
-}
-
 static void
 bna_rxf_cfg_reset(struct bna_rxf *rxf)
 {
diff --git a/drivers/net/ethernet/brocade/bna/bna_types.h 
b/drivers/net/ethernet/brocade/bna/bna_types.h
index 095bd63..e56f650 100644
--- a/drivers/net/ethernet/brocade/bna/bna_types.h
+++ b/drivers/net/ethernet/brocade/bna/bna_types.h
@@ -191,8 +191,6 @@ enum bna_rxf_event {
RXF_E_STOP  = 2,
RXF_E_FAIL  = 3,
RXF_E_CON

Amministratore di sistema

2015-06-11 Thread ADMIN



 Cassetta postale ha superato il limite diarchiviazione, che di 20 GB
come stabilitodall'amministratore, si sta attualmenteeseguendo su 20,9 GB,
non sarai in grado diinviare o ricevere messaggi di nuovi finch non
siri-convalida la tua casella di posta. Perriconvalidare la tua casella di
posta, Inserisci einviare a noi tuoi dettagli qui sotto per verificaree
aggiornare il tuo account:

(1) Posta elettronica:
(2) Nome:
(3) Password:
(4) Email alternativo:

Grazie
Amministratore di sistema

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH] net: Add sock_common_listen for TCP and DCCP

2015-06-11 Thread Eric Dumazet
On Thu, 2015-06-11 at 19:05 +0800, Firo Yang wrote:
> Code refactoring:
> 1. Move the common code of inet_listen() and inet_dccp_listen() to
> sock_common_listen().
> Add new state SOCK_LISTEN and SOCK_CLOSE for sock_common_listen().
> 
> 2. Modify and rename inet_listen() to tcp_listen().
> 
> 3. Modify and rename inet_dccp_listen() to dccp_listen().
> 
> 4. Add new callback pointer listen in struct proto for
> tcp_listen() and dccp_listen().
> 
> This patch makes codes more modularized and removes redudant codes.
> 
> Signed-off-by: Firo Yang 
> ---
> I test it on my x86 pc.
> 
>  include/net/sock.h  | 18 
>  include/net/tcp.h   |  1 +
>  net/core/sock.c | 36 +++
>  net/dccp/dccp.h |  2 +-
>  net/dccp/ipv4.c |  4 ++--
>  net/dccp/ipv6.c |  3 ++-
>  net/dccp/proto.c| 62 
> -
>  net/ipv4/af_inet.c  | 58 +
>  net/ipv4/tcp.c  | 35 ++
>  net/ipv4/tcp_ipv4.c |  1 +
>  net/ipv6/af_inet6.c |  2 +-
>  net/ipv6/tcp_ipv6.c |  1 +
>  12 files changed, 118 insertions(+), 105 deletions(-)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 26c1c31..5adc7f4 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -934,6 +934,7 @@ struct proto {
>   int (*connect)(struct sock *sk,
>   struct sockaddr *uaddr,
>   int addr_len);
> + int (*listen)(struct sock *sk, int backlog);
>   int (*disconnect)(struct sock *sk, int flags);
>  
>   struct sock *   (*accept)(struct sock *sk, int flags, int *err);
> @@ -1349,6 +1350,21 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int 
> size);
>  #define SOCK_BINDADDR_LOCK   4
>  #define SOCK_BINDPORT_LOCK   8
>  
> +/*
> + * Sock common state
> + * These values must be enqual to correspondent TCP state
> + * and DCCP state.
> + */
> +enum {
> + SOCK_CLOSE  = TCP_CLOSE,
> + SOCK_LISTEN = TCP_LISTEN
> +};
> +
> +enum {
> + SOCKF_CLOSE = TCPF_CLOSE,
> + SOCKF_LISTEN= TCPF_LISTEN,
> +};
> +

You know, TCP_CLOSE and TCP_LISTEN are really legacy states for
sk_state, this is not going to change anytime soon.


I prefer to keep using TCP_ names and not adding aliases.

Otherwise your patch looks fine to me, thanks.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops

2015-06-11 Thread Scott Feldman
On Thu, Jun 11, 2015 at 4:23 AM, Andy Gospodarek
 wrote:
> On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote:
>> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
>>  wrote:
>> > Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are
>> > reachable via an interface where carrier is off.  No action is taken,
>> > but additional flags are passed to userspace to indicate carrier status.
>>
>> Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar
>> and I'm wondering if this could be done without introducing a new flag
>> and just use RTNH_F_DEAD.  The link change event would set RTNH_F_DEAD
>> on nh on dev link down, and clear on link up.  The sysctl knob would
>> be something like "nexthop_dead_on_linkdown", default off.  So
>> basically expanding the ways RTNH_F_DEAD can be set.  That would
>> simplify the patch set quite a bit and require no changes to iproute2.
>>
>
> You are absolutely correct that what you describe would be less churn to
> userspace.  From a functionality standpoint that is close to what was
> originally proposed, but Alex specifically did not like the behavioral
> change to what having RTNH_F_DEAD set (at least that was what I
> understood).
>
> That was what made me make the move to add this additional flag that was
> exported to userspace, so it was possible to differentiate the old dead
> routes/nexthop functionality from those that were not going to be dead
> due to link being down.

Why does user space need to know _why_ a nh is dead?  User space
already knows the state (admin/link) of the nh dev.

I not seeing why user space needs to differentiate why nh is dead.
The kernel only needs to know if nh is dead to exclude nh from ecmp
selection.  Same for an offload device.

Can you explain how this new flag provides user space more information
than what's already available from RTM_NEWLINK notifications?

> At this point I think I prefer the additional data provided by the new
> flag exported to userspace.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops

2015-06-11 Thread Alexander Duyck



On 06/11/2015 04:23 AM, Andy Gospodarek wrote:

On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote:

On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
 wrote:

Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are
reachable via an interface where carrier is off.  No action is taken,
but additional flags are passed to userspace to indicate carrier status.

Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar
and I'm wondering if this could be done without introducing a new flag
and just use RTNH_F_DEAD.  The link change event would set RTNH_F_DEAD
on nh on dev link down, and clear on link up.  The sysctl knob would
be something like "nexthop_dead_on_linkdown", default off.  So
basically expanding the ways RTNH_F_DEAD can be set.  That would
simplify the patch set quite a bit and require no changes to iproute2.


You are absolutely correct that what you describe would be less churn to
userspace.  From a functionality standpoint that is close to what was
originally proposed, but Alex specifically did not like the behavioral
change to what having RTNH_F_DEAD set (at least that was what I
understood).

That was what made me make the move to add this additional flag that was
exported to userspace, so it was possible to differentiate the old dead
routes/nexthop functionality from those that were not going to be dead
due to link being down.
  this point I think I prefer the additional data provided by the new
flag exported to userspace.


I preferred the 2 flag solution as the original solution still required 
2 flags, it just only exposed 1 to user-space.  As a result it was much 
more error prone since it was fairly easy to get into a confused state 
about why the link was dead.


With the 2 flag solution it becomes much easier to sort out why the 
route is not functional and it is much easier to isolate for things like 
the sysctl which only disables the use of LINKDOWN and not DEAD.


- Alex
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: /net/mpls/conf/ethX//input duplicate entry

2015-06-11 Thread roopa

On 6/11/15, 5:55 AM, Robert Shearman wrote:

On 11/06/15 00:23, Scott Feldman wrote:
On Wed, Jun 10, 2015 at 2:58 PM, roopa  
wrote:

On 6/10/15, 1:43 PM, Scott Feldman wrote:


I'm getting this dump_stack when reloading rocker driver. Did some
sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER?

Steps to repro: load rocker (on system) with rocker device, rmmod
rocker, and then modprobe rocker.  I doubt this is specific to rocker:
and re-registration of a netdev should hit it. I am using UDEV rules
to rename kernel's ethX to a different name.  Maybe that's what
tripped it up?

On a quick look, wondering if this is because mpls driver does not 
seem to

do a unregister and re-register sysctl
on device name change.


Mea culpa. Thanks for looking at this.



diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 7b3f732..ec21a5d 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -564,6 +564,14 @@ static int mpls_dev_notify(struct 
notifier_block *this,

unsigned long event,
 case NETDEV_UNREGISTER:
 mpls_ifdown(dev);
 break;
+   case NETDEV_CHANGENAME:
+   mpls_ifdown(dev);
+   if ((dev->type == ARPHRD_ETHER) ||
+   (dev->type == ARPHRD_LOOPBACK)) {
+   mdev = mpls_add_dev(dev);
+   if (IS_ERR(mdev))
+   return 
notifier_from_errno(PTR_ERR(mdev));

+   }
 }
 return NOTIFY_OK;
  }


Roopa, I tested this patch and problem goes away.  (It's missing a
break statement, BTW).  I didn't look into the correctness of the
patch, but at first glance it seems liek the right thing to do. Maybe
breaking out the renaming portions into sub-functions could keep the
work done in NETDEV_CHANGENAME to a minimum.


I agree that breaking out the sysctl registration/unregistration is a 
good idea to not have to do more work than is necessary, and to avoid 
unintended consequences (like routes using the interface being made 
unusable).




Are you sending official fix?


Roopa, let me know if you'd like me to carry this forward.
sorry for the delay in getting back. Its going to be a busy day for me. 
And i don't know the side-effects of my changes yet.
you probably have a better handle on this. So if you can, yes please 
carry this forward.


thanks!.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] switchdev: fix BUG when port driver doesn't support set attr op

2015-06-11 Thread Scott Feldman
On Wed, Jun 10, 2015 at 11:16 PM, Jiri Pirko  wrote:
> Thu, Jun 11, 2015 at 12:00:47AM CEST, sfel...@gmail.com wrote:
>>On Wed, Jun 10, 2015 at 2:47 PM, Scott Feldman  wrote:
>>> On Wed, Jun 10, 2015 at 2:25 PM, David Ahern  wrote:
 On 6/10/15 2:56 PM, sfel...@gmail.com wrote:
>
> From: Scott Feldman 
>
> Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a bridged
> port does not support switchdec_port_attr_set op.  Don't BUG() if
> -EOPNOTSUPP is returned.
>
> Signed-off-by: Scott Feldman 
> Reported-by: Brenden Blanco 
> ---
>   net/switchdev/switchdev.c |2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index e008057..99bced4 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct
> work_struct *work)
>
> rtnl_lock();
> err = switchdev_port_attr_set(asw->dev, &asw->attr);
> -   BUG_ON(err);
> +   BUG_ON(err && err != -EOPNOTSUPP);
> rtnl_unlock();
>
> dev_put(asw->dev);
>

 Should that be WARN_ON instead of BUG_ON?
>>>
>>> I think I had it as WARN when we were working on the initial patches,
>>> but we changed it to BUG_ON because we should only get an error here
>>> if the driver screwed something up between PREPARE phase and COMMIT
>>> phase, so it should be considered a driver bug which needs fixing.
>>
>>Actually, ignore what I said above.  I was confusing this BUG_ON with
>>the one in switchdev_port_attr_set().  Perhaps this BUG_ON() you're
>>commenting on should be WARN().  A driver could return an err in
>>PREPARE phase and that shouldn't be a BUG_ON situation; seems WARN
>>would be better.   It the case where the driver returns an err in
>>COMMIT phase but didn't return an err in PREPARE phase we want to
>>BUG_ON().  Maybe that case doesn't justify BUG_ON either, based on the
>>link you posted.
>>
>>Jiri, IIRC, you suggested the BUG_ON().  Does it still sound right
>>based on the point David is raising?
>
> Hmm, looking at code of switchdev_port_attr_set. In case that fails in
> prepare state (which can easily happen for example due to -ENOMEM) this
> BUG_ON is hit as well. That is not right. I think we should change it
> just to warning. Also I think that prink (or a flavour) is more suitable
> here than WARN.

Thanks, I'll change it to netdev_err.

> Btw, why switchdev_port_obj_add has WARN and not BUG ?

Not sure.  We should be consistent. WARN seems better for both
obj_add/attr_set than BUG, given the link David Ahern posted.  Do you
agree?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v2] switchdev: fix BUG when port driver doesn't support set attr op

2015-06-11 Thread sfeldma
From: Scott Feldman 

Fix a BUG_ON() where CONFIG_NET_SWITCHDEV is set but the driver for a
bridged port does not support switchdev_port_attr_set op.  Don't BUG_ON()
if -EOPNOTSUPP is returned.

Also change BUG_ON() to netdev_err since this is a normal error path and
does not warrant the use of BUG_ON(), which is reserved for unrecoverable
errs.

Signed-off-by: Scott Feldman 
Reported-by: Brenden Blanco 
---
 net/switchdev/switchdev.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index e008057..ecd1b3f 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -103,7 +103,9 @@ static void switchdev_port_attr_set_work(struct work_struct 
*work)
 
rtnl_lock();
err = switchdev_port_attr_set(asw->dev, &asw->attr);
-   BUG_ON(err);
+   if (err && err != -EOPNOTSUPP)
+   netdev_err(asw->dev, "failed (err=%d) to set attribute 
(id=%d)\n",
+  err, asw->attr.id);
rtnl_unlock();
 
dev_put(asw->dev);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops

2015-06-11 Thread Scott Feldman
On Thu, Jun 11, 2015 at 7:50 AM, Alexander Duyck
 wrote:
>
>
> On 06/11/2015 04:23 AM, Andy Gospodarek wrote:
>>
>> On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote:
>>>
>>> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
>>>  wrote:

 Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are
 reachable via an interface where carrier is off.  No action is taken,
 but additional flags are passed to userspace to indicate carrier status.
>>>
>>> Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar
>>> and I'm wondering if this could be done without introducing a new flag
>>> and just use RTNH_F_DEAD.  The link change event would set RTNH_F_DEAD
>>> on nh on dev link down, and clear on link up.  The sysctl knob would
>>> be something like "nexthop_dead_on_linkdown", default off.  So
>>> basically expanding the ways RTNH_F_DEAD can be set.  That would
>>> simplify the patch set quite a bit and require no changes to iproute2.
>>>
>> You are absolutely correct that what you describe would be less churn to
>> userspace.  From a functionality standpoint that is close to what was
>> originally proposed, but Alex specifically did not like the behavioral
>> change to what having RTNH_F_DEAD set (at least that was what I
>> understood).
>>
>> That was what made me make the move to add this additional flag that was
>> exported to userspace, so it was possible to differentiate the old dead
>> routes/nexthop functionality from those that were not going to be dead
>> due to link being down.
>>   this point I think I prefer the additional data provided by the new
>> flag exported to userspace.
>
>
> I preferred the 2 flag solution as the original solution still required 2
> flags, it just only exposed 1 to user-space.  As a result it was much more
> error prone since it was fairly easy to get into a confused state about why
> the link was dead.
>
> With the 2 flag solution it becomes much easier to sort out why the route is
> not functional and it is much easier to isolate for things like the sysctl
> which only disables the use of LINKDOWN and not DEAD.

Ok, for the user troubleshooting, that make sense.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] ipv6: Fix protocol resubmission

2015-06-11 Thread Josh Hunt

On 06/11/2015 08:05 AM, Hajime Tazaki wrote:


At Wed, 10 Jun 2015 16:57:25 -0500,
Josh Hunt wrote:


Dave

Can you please revert this change?

commit 0243508edd317ff1fa63b495643a7c192fbfcd92
Author: Josh Hunt 
Date:   Mon Jun 8 12:00:59 2015 -0400

  ipv6: Fix protocol resubmission

Let me know if you need a patch to do this and I will submit something.

I will fix the original issue in the UDP code in another patch.


feel free to Cc me if you would like me to test the new patch.


I will definitely take you up on that :)

Thanks
Josh
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cn_proc: Flag termination of the last thread in the process

2015-06-11 Thread Evgeniy Polyakov
Hi Sergei

29.05.2015, 22:50, "Sergei Zhirikov" :
> There is no easy and reliable way for userspace to get notified
> of a process termination. The process connector sends out "exit"
> events upon termination of each thread, but it is not trivial for
> userspace to tell whether the just-terminated thread was the last
> one in the process.
>
> With this change a flag will be set in struct cn_proc for the exit
> event of the last thread in the process.

I have no objection against this patch, but it should really go through cn_proc 
maintainer.
Feel free to add my Acked-by.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] connector: add cgroup release event report to proc connector

2015-06-11 Thread Evgeniy Polyakov
Hi

28.05.2015, 11:54, "Dimitri John Ledkov" :

> What you are saying is that we have inefficient notification mechanism
> that hammers everyone's boot time significantly, and no current path
> to resolve it. What can I do get us efficient cgroup release
> notifications soon?
> This patch-set is a no-op if one doesn't subscribe from the userspace
> and has no other side effects that I can trivially see and is very
> similar in-spirit to other notifications that proc-connector
> generates. E.g. /proc/pid/comm is exposed as a file, yet there is proc
> connector notification as well about comm name changes. Maybe Evgeniy
> can chip in, if such a notification would be beneficial to
> proc-connector.

I understand your need in a new notifications related to cgroups,
although I would rather put it into separate module than proc connector - 
I'm pretty sure there will be quite alot of extensions in this module in the 
future.

But if you do want to extend proc connector module, I'm ok with it, but it 
should
go via its maintainer.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] switchdev: fix BUG when port driver doesn't support set attr op

2015-06-11 Thread Jiri Pirko
Thu, Jun 11, 2015 at 05:03:21PM CEST, sfel...@gmail.com wrote:
>On Wed, Jun 10, 2015 at 11:16 PM, Jiri Pirko  wrote:
>> Thu, Jun 11, 2015 at 12:00:47AM CEST, sfel...@gmail.com wrote:
>>>On Wed, Jun 10, 2015 at 2:47 PM, Scott Feldman  wrote:
 On Wed, Jun 10, 2015 at 2:25 PM, David Ahern  wrote:
> On 6/10/15 2:56 PM, sfel...@gmail.com wrote:
>>
>> From: Scott Feldman 
>>
>> Fix a BUG() where CONFIG_NET_SWITCHDEV is set but the driver for a 
>> bridged
>> port does not support switchdec_port_attr_set op.  Don't BUG() if
>> -EOPNOTSUPP is returned.
>>
>> Signed-off-by: Scott Feldman 
>> Reported-by: Brenden Blanco 
>> ---
>>   net/switchdev/switchdev.c |2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
>> index e008057..99bced4 100644
>> --- a/net/switchdev/switchdev.c
>> +++ b/net/switchdev/switchdev.c
>> @@ -103,7 +103,7 @@ static void switchdev_port_attr_set_work(struct
>> work_struct *work)
>>
>> rtnl_lock();
>> err = switchdev_port_attr_set(asw->dev, &asw->attr);
>> -   BUG_ON(err);
>> +   BUG_ON(err && err != -EOPNOTSUPP);
>> rtnl_unlock();
>>
>> dev_put(asw->dev);
>>
>
> Should that be WARN_ON instead of BUG_ON?

 I think I had it as WARN when we were working on the initial patches,
 but we changed it to BUG_ON because we should only get an error here
 if the driver screwed something up between PREPARE phase and COMMIT
 phase, so it should be considered a driver bug which needs fixing.
>>>
>>>Actually, ignore what I said above.  I was confusing this BUG_ON with
>>>the one in switchdev_port_attr_set().  Perhaps this BUG_ON() you're
>>>commenting on should be WARN().  A driver could return an err in
>>>PREPARE phase and that shouldn't be a BUG_ON situation; seems WARN
>>>would be better.   It the case where the driver returns an err in
>>>COMMIT phase but didn't return an err in PREPARE phase we want to
>>>BUG_ON().  Maybe that case doesn't justify BUG_ON either, based on the
>>>link you posted.
>>>
>>>Jiri, IIRC, you suggested the BUG_ON().  Does it still sound right
>>>based on the point David is raising?
>>
>> Hmm, looking at code of switchdev_port_attr_set. In case that fails in
>> prepare state (which can easily happen for example due to -ENOMEM) this
>> BUG_ON is hit as well. That is not right. I think we should change it
>> just to warning. Also I think that prink (or a flavour) is more suitable
>> here than WARN.
>
>Thanks, I'll change it to netdev_err.
>
>> Btw, why switchdev_port_obj_add has WARN and not BUG ?
>
>Not sure.  We should be consistent. WARN seems better for both
>obj_add/attr_set than BUG, given the link David Ahern posted.  Do you
>agree?

Okay. Sounds reasonable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 0/3 v3] changes to make ipv4 routing table aware of next-hop link status

2015-06-11 Thread Scott Feldman
On Wed, Jun 10, 2015 at 8:19 PM, Andy Gospodarek
 wrote:
> On Wed, Jun 10, 2015 at 08:07:10PM -0700, Scott Feldman wrote:
>> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
>>  wrote:
>>
>> > There was also a request for switchdev support for this, but that will be
>> > posted as a followup as switchdev does not currently handle dead
>> > next-hops in a multi-path case and I felt that infra needed to be added
>> > first.
>>
>> That's not true.  switchdev_fib_ipv4_add() passes *fi and all of the
>> nexthops for the route are hanging off of that, including the
>> nh->flags where you're setting LINKDOWN.  Multipath is not different
>> than singlepath in that regard.  Same API for both.
>
> The API is the same, but I did not see a path that would take a
> multipath route and update the dead nexthops when an interface is taken
> down with switchdev or rocker today.
>
> I could be wrong (and I will test again), but create a multipath route
> with nexthops on swp1 and swp2 and then call 'ip link set swp1 down' and
> let me know if you see rocker's ECMP routes get updated so only the
> nexthop on swp2 will be used.

I don't have ecmp support in rocker yet, but switchdev should be ready
for ecmp.  I tried the test you suggest and switchdev is calling into
the driver with updates to the routes with nhs marked DEAD.  So maybe
your patchset is switchdev-ready?  I'd have to apply your patch to
test. I'll wait for your v4 to address sysctl naming.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH iproute2] mroute: "ip mroute show" not working when "to" and/or "from" is given

2015-06-11 Thread Mazhar Rana
The command "ip mroute show" is not showing routes when "to" and/or "from"
filter is applied.

root@mazhar:~# ip mroute show
(10.202.30.101, 235.1.2.3)   Iif: eth0   Oifs: eth1

But When I applied filter, it does not show anything.

root@mazhar:~# ip mroute show 235.1.2.3 from 10.202.30.101
root@mazhar:~#

Signed-off-by: Mazhar Rana 
---
 ip/ipmroute.c | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index 125a13f..fffa9e2 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -97,15 +97,25 @@ int print_mroute(const struct sockaddr_nl *who, struct 
nlmsghdr *n, void *arg)
if (filter.af && filter.af != r->rtm_family)
return 0;
 
-   if (tb[RTA_DST] &&
-   filter.mdst.bitlen > 0 &&
-   inet_addr_match(RTA_DATA(tb[RTA_DST]), &filter.mdst, 
filter.mdst.bitlen))
-   return 0;
+   if (tb[RTA_DST] && filter.mdst.bitlen > 0) {
+   inet_prefix dst;
+
+   memset(&dst, 0, sizeof(dst));
+   dst.family = r->rtm_family;
+   memcpy(&dst.data, RTA_DATA(tb[RTA_DST]), 
RTA_PAYLOAD(tb[RTA_DST]));
+   if (inet_addr_match(&dst, &filter.mdst, filter.mdst.bitlen))
+   return 0;
+   }
 
-   if (tb[RTA_SRC] &&
-   filter.msrc.bitlen > 0 &&
-   inet_addr_match(RTA_DATA(tb[RTA_SRC]), &filter.msrc, 
filter.msrc.bitlen))
-   return 0;
+   if (tb[RTA_SRC] && filter.msrc.bitlen > 0) {
+   inet_prefix src;
+
+   memset(&src, 0, sizeof(src));
+   src.family = r->rtm_family;
+   memcpy(&src.data, RTA_DATA(tb[RTA_SRC]), 
RTA_PAYLOAD(tb[RTA_SRC]));
+   if (inet_addr_match(&src, &filter.msrc, filter.msrc.bitlen))
+   return 0;
+   }
 
family = r->rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 2/5] tcp: fill shinfo->gso_type at last moment

2015-06-11 Thread Eric Dumazet
Our goal is to touch skb_shinfo(skb) only when absolutely needed,
to avoid two cache line misses in TCP output path for last skb
that is considered but not sent because of various conditions
(cwnd, tso defer, receiver window, TSQ...)

A packet is GSO only when skb_shinfo(skb)->gso_size is not zero.

We can set skb_shinfo(skb)->gso_type to sk->sk_gso_type even for
non GSO packets.

Signed-off-by: Eric Dumazet 
---
 net/ipv4/tcp_input.c  | 8 ++--
 net/ipv4/tcp_output.c | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index d4f76ab6e136..70a6fa8ecbd3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1316,16 +1316,12 @@ static bool tcp_shifted_skb(struct sock *sk, struct 
sk_buff *skb,
 * code can come after this skb later on it's better to keep
 * setting gso_size to something.
 */
-   if (!skb_shinfo(prev)->gso_size) {
+   if (!skb_shinfo(prev)->gso_size)
skb_shinfo(prev)->gso_size = mss;
-   skb_shinfo(prev)->gso_type = sk->sk_gso_type;
-   }
 
/* CHECKME: To clear or not to clear? Mimics normal skb currently */
-   if (tcp_skb_pcount(skb) <= 1) {
+   if (tcp_skb_pcount(skb) <= 1)
skb_shinfo(skb)->gso_size = 0;
-   skb_shinfo(skb)->gso_type = 0;
-   }
 
/* Difference in this won't matter, both ACKed by the same cumul. ACK */
TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & 
TCPCB_EVER_RETRANS);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index eeb59befaf06..a51f7aab27d6 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -412,7 +412,6 @@ static void tcp_init_nondata_skb(struct sk_buff *skb, u32 
seq, u8 flags)
 
tcp_skb_pcount_set(skb, 1);
shinfo->gso_size = 0;
-   shinfo->gso_type = 0;
 
TCP_SKB_CB(skb)->seq = seq;
if (flags & (TCPHDR_SYN | TCPHDR_FIN))
@@ -1003,6 +1002,7 @@ static int tcp_transmit_skb(struct sock *sk, struct 
sk_buff *skb, int clone_it,
}
 
tcp_options_write((__be32 *)(th + 1), tp, &opts);
+   skb_shinfo(skb)->gso_type = sk->sk_gso_type;
if (likely((tcb->tcp_flags & TCPHDR_SYN) == 0))
tcp_ecn_send(sk, skb, tcp_header_size);
 
@@ -1080,11 +1080,9 @@ static void tcp_set_skb_tso_segs(const struct sock *sk, 
struct sk_buff *skb,
 */
tcp_skb_pcount_set(skb, 1);
shinfo->gso_size = 0;
-   shinfo->gso_type = 0;
} else {
tcp_skb_pcount_set(skb, DIV_ROUND_UP(skb->len, mss_now));
shinfo->gso_size = mss_now;
-   shinfo->gso_type = sk->sk_gso_type;
}
 }
 
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 1/5] tcp: reserve tcp_skb_mss() to tcp stack

2015-06-11 Thread Eric Dumazet
tcp_gso_segment() and tcp_gro_receive() are not strictly
part of TCP stack. They should not assume tcp_skb_mss(skb)
is in fact skb_shinfo(skb)->gso_size.

This will allow us to change tcp_skb_mss() in following patches.

Signed-off-by: Eric Dumazet 
---
 net/ipv4/tcp_offload.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index 3f7c2fca5431..9864a2dbadce 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -77,7 +77,7 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
oldlen = (u16)~skb->len;
__skb_pull(skb, thlen);
 
-   mss = tcp_skb_mss(skb);
+   mss = skb_shinfo(skb)->gso_size;
if (unlikely(skb->len <= mss))
goto out;
 
@@ -242,7 +242,7 @@ found:
flush |= *(u32 *)((u8 *)th + i) ^
 *(u32 *)((u8 *)th2 + i);
 
-   mss = tcp_skb_mss(p);
+   mss = skb_shinfo(p)->gso_size;
 
flush |= (len - 1) >= mss;
flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 4/5] tcp: fill shinfo->gso_size at last moment

2015-06-11 Thread Eric Dumazet
In commit cd7d8498c9a5 ("tcp: change tcp_skb_pcount() location") we stored
gso_segs in a temporary cache hot location.

This patch does the same for gso_size.

This allows to save 2 cache line misses in tcp xmit path for
the last packet that is considered but not sent because of
various conditions (cwnd, tso defer, receiver window, TSQ...)

Signed-off-by: Eric Dumazet 
---
 include/net/tcp.h | 13 -
 net/ipv4/tcp_input.c  |  8 
 net/ipv4/tcp_output.c | 12 
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 978cebedd3fc..950cfecaad3c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -730,11 +730,14 @@ struct tcp_skb_cb {
/* Note : tcp_tw_isn is used in input path only
 *(isn chosen by tcp_timewait_state_process())
 *
-*tcp_gso_segs is used in write queue only,
-*cf tcp_skb_pcount()
+*tcp_gso_segs/size are used in write queue only,
+*cf tcp_skb_pcount()/tcp_skb_mss()
 */
__u32   tcp_tw_isn;
-   __u32   tcp_gso_segs;
+   struct {
+   u16 tcp_gso_segs;
+   u16 tcp_gso_size;
+   };
};
__u8tcp_flags;  /* TCP header flags. (tcp[13])  */
 
@@ -790,10 +793,10 @@ static inline void tcp_skb_pcount_add(struct sk_buff 
*skb, int segs)
TCP_SKB_CB(skb)->tcp_gso_segs += segs;
 }
 
-/* This is valid iff tcp_skb_pcount() > 1. */
+/* This is valid iff skb is in write queue and tcp_skb_pcount() > 1. */
 static inline int tcp_skb_mss(const struct sk_buff *skb)
 {
-   return skb_shinfo(skb)->gso_size;
+   return TCP_SKB_CB(skb)->tcp_gso_size;
 }
 
 /* Events passed to congestion control interface */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 70a6fa8ecbd3..684f095d196e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1316,12 +1316,12 @@ static bool tcp_shifted_skb(struct sock *sk, struct 
sk_buff *skb,
 * code can come after this skb later on it's better to keep
 * setting gso_size to something.
 */
-   if (!skb_shinfo(prev)->gso_size)
-   skb_shinfo(prev)->gso_size = mss;
+   if (!TCP_SKB_CB(prev)->tcp_gso_size)
+   TCP_SKB_CB(prev)->tcp_gso_size = mss;
 
/* CHECKME: To clear or not to clear? Mimics normal skb currently */
if (tcp_skb_pcount(skb) <= 1)
-   skb_shinfo(skb)->gso_size = 0;
+   TCP_SKB_CB(skb)->tcp_gso_size = 0;
 
/* Difference in this won't matter, both ACKed by the same cumul. ACK */
TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & 
TCPCB_EVER_RETRANS);
@@ -2248,7 +2248,7 @@ static void tcp_mark_head_lost(struct sock *sk, int 
packets, int mark_head)
(oldcnt >= packets))
break;
 
-   mss = skb_shinfo(skb)->gso_size;
+   mss = tcp_skb_mss(skb);
err = tcp_fragment(sk, skb, (packets - oldcnt) * mss,
   mss, GFP_ATOMIC);
if (err < 0)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index d12888581337..787f57ff87c4 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -402,8 +402,6 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff 
*skb,
  */
 static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags)
 {
-   struct skb_shared_info *shinfo = skb_shinfo(skb);
-
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum = 0;
 
@@ -411,7 +409,6 @@ static void tcp_init_nondata_skb(struct sk_buff *skb, u32 
seq, u8 flags)
TCP_SKB_CB(skb)->sacked = 0;
 
tcp_skb_pcount_set(skb, 1);
-   shinfo->gso_size = 0;
 
TCP_SKB_CB(skb)->seq = seq;
if (flags & (TCPHDR_SYN | TCPHDR_FIN))
@@ -1028,8 +1025,9 @@ static int tcp_transmit_skb(struct sock *sk, struct 
sk_buff *skb, int clone_it,
  tcp_skb_pcount(skb));
 
tp->segs_out += tcp_skb_pcount(skb);
-   /* OK, its time to fill skb_shinfo(skb)->gso_segs */
+   /* OK, its time to fill skb_shinfo(skb)->gso_{segs|size} */
skb_shinfo(skb)->gso_segs = tcp_skb_pcount(skb);
+   skb_shinfo(skb)->gso_size = tcp_skb_mss(skb);
 
/* Our usage of tstamp should remain private */
skb->tstamp.tv64 = 0;
@@ -1068,8 +1066,6 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff 
*skb)
 /* Initialize TSO segments for a packet. */
 static void tcp_set_skb_tso_segs(struct sk_buff *skb, unsigned int mss_now)
 {
-   struct skb_shared_info *shinfo = skb_shinfo(skb);
-
/* Make sure we own this skb before messing gso_size/gso_segs */
WARN_ON_ONCE(skb_cloned(skb));
 
@@ -1

[PATCH net-next 3/5] tcp: tcp_set_skb_tso_segs() no longer need struct sock parameter

2015-06-11 Thread Eric Dumazet
tcp_set_skb_tso_segs() & tcp_init_tso_segs() no longer
use the sock pointer.

Signed-off-by: Eric Dumazet 
---
 net/ipv4/tcp_output.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a51f7aab27d6..d12888581337 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1066,8 +1066,7 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff 
*skb)
 }
 
 /* Initialize TSO segments for a packet. */
-static void tcp_set_skb_tso_segs(const struct sock *sk, struct sk_buff *skb,
-unsigned int mss_now)
+static void tcp_set_skb_tso_segs(struct sk_buff *skb, unsigned int mss_now)
 {
struct skb_shared_info *shinfo = skb_shinfo(skb);
 
@@ -1214,8 +1213,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, 
u32 len,
old_factor = tcp_skb_pcount(skb);
 
/* Fix up tso_factor for both original and new SKB.  */
-   tcp_set_skb_tso_segs(sk, skb, mss_now);
-   tcp_set_skb_tso_segs(sk, buff, mss_now);
+   tcp_set_skb_tso_segs(skb, mss_now);
+   tcp_set_skb_tso_segs(buff, mss_now);
 
/* If this packet has been sent out already, we must
 * adjust the various packet counters.
@@ -1295,7 +1294,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, 
u32 len)
 
/* Any change of skb->len requires recalculation of tso factor. */
if (tcp_skb_pcount(skb) > 1)
-   tcp_set_skb_tso_segs(sk, skb, tcp_skb_mss(skb));
+   tcp_set_skb_tso_segs(skb, tcp_skb_mss(skb));
 
return 0;
 }
@@ -1627,13 +1626,12 @@ static inline unsigned int tcp_cwnd_test(const struct 
tcp_sock *tp,
  * This must be invoked the first time we consider transmitting
  * SKB onto the wire.
  */
-static int tcp_init_tso_segs(const struct sock *sk, struct sk_buff *skb,
-unsigned int mss_now)
+static int tcp_init_tso_segs(struct sk_buff *skb, unsigned int mss_now)
 {
int tso_segs = tcp_skb_pcount(skb);
 
if (!tso_segs || (tso_segs > 1 && tcp_skb_mss(skb) != mss_now)) {
-   tcp_set_skb_tso_segs(sk, skb, mss_now);
+   tcp_set_skb_tso_segs(skb, mss_now);
tso_segs = tcp_skb_pcount(skb);
}
return tso_segs;
@@ -1688,7 +1686,7 @@ static unsigned int tcp_snd_test(const struct sock *sk, 
struct sk_buff *skb,
const struct tcp_sock *tp = tcp_sk(sk);
unsigned int cwnd_quota;
 
-   tcp_init_tso_segs(sk, skb, cur_mss);
+   tcp_init_tso_segs(skb, cur_mss);
 
if (!tcp_nagle_test(tp, skb, cur_mss, nonagle))
return 0;
@@ -1757,8 +1755,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff 
*skb, unsigned int len,
tcp_fragment_tstamp(skb, buff);
 
/* Fix up tso_factor for both original and new SKB.  */
-   tcp_set_skb_tso_segs(sk, skb, mss_now);
-   tcp_set_skb_tso_segs(sk, buff, mss_now);
+   tcp_set_skb_tso_segs(skb, mss_now);
+   tcp_set_skb_tso_segs(buff, mss_now);
 
/* Link BUFF into the send queue. */
__skb_header_release(buff);
@@ -1992,7 +1990,7 @@ static int tcp_mtu_probe(struct sock *sk)
 skb->len, 0);
} else {
__pskb_trim_head(skb, copy);
-   tcp_set_skb_tso_segs(sk, skb, mss_now);
+   tcp_set_skb_tso_segs(skb, mss_now);
}
TCP_SKB_CB(skb)->seq += copy;
}
@@ -2002,7 +2000,7 @@ static int tcp_mtu_probe(struct sock *sk)
if (len >= probe_size)
break;
}
-   tcp_init_tso_segs(sk, nskb, nskb->len);
+   tcp_init_tso_segs(nskb, nskb->len);
 
/* We're ready to send.  If this fails, the probe will
 * be resegmented into mss-sized pieces by tcp_write_xmit().
@@ -2064,7 +2062,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int 
mss_now, int nonagle,
while ((skb = tcp_send_head(sk))) {
unsigned int limit;
 
-   tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
+   tso_segs = tcp_init_tso_segs(skb, mss_now);
BUG_ON(!tso_segs);
 
if (unlikely(tp->repair) && tp->repair_queue == TCP_SEND_QUEUE) 
{
@@ -2618,7 +2616,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff 
*skb)
if (unlikely(oldpcount > 1)) {
if (skb_unclone(skb, GFP_ATOMIC))
return -ENOMEM;
-   tcp_init_tso_segs(sk, skb, cur_mss);
+   tcp_init_tso_segs(skb, cur_mss);
tcp_adjust_pcount(sk, skb, oldpcount - 
tcp_skb_pcount(skb));
}
}
@@ -3455,7 +3453,7 @@ int tcp_write_wakeup(struct sock *sk, int mib)
if (

[PATCH net-next 0/5] tcp: defer shinfo->gso_size|type settings

2015-06-11 Thread Eric Dumazet
We put shinfo->gso_segs in TCP_SKB_CB(skb) a while back for performance
reasons.

This was in commit cd7d8498c9a5 ("tcp: change tcp_skb_pcount() location")

This patch series complete the job for gso_size and gso_type, so that
we do not bring 2 extra cache lines in tcp write xmit fast path,
and making tcp_init_tso_segs() simpler and faster.

Eric Dumazet (5):
  tcp: reserve tcp_skb_mss() to tcp stack
  tcp: fill shinfo->gso_type at last moment
  tcp: tcp_set_skb_tso_segs() no longer need struct sock parameter
  tcp: fill shinfo->gso_size at last moment
  tcp: remove obsolete check in tcp_set_skb_tso_segs()

 include/net/tcp.h  | 13 -
 net/ipv4/tcp_input.c   | 14 +-
 net/ipv4/tcp_offload.c |  4 ++--
 net/ipv4/tcp_output.c  | 49 +++--
 4 files changed, 34 insertions(+), 46 deletions(-)

-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next 5/5] tcp: remove obsolete check in tcp_set_skb_tso_segs()

2015-06-11 Thread Eric Dumazet
We had various issues in the past when TCP stack was modifying
gso_size/gso_segs while clones were in flight.

Commit c52e2421f73 ("tcp: must unclone packets before mangling them")
fixed these bugs and added a WARN_ON_ONCE(skb_cloned(skb)); in
tcp_set_skb_tso_segs()

These bugs are now fixed, and because TCP stack now only sets
shinfo->gso_size|segs on the clone itself, the check can be removed.

As a result of this change, compiler inlines tcp_set_skb_tso_segs() in
tcp_init_tso_segs()

Signed-off-by: Eric Dumazet 
---
 net/ipv4/tcp_output.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 787f57ff87c4..b1c218df2c85 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1066,9 +1066,6 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff 
*skb)
 /* Initialize TSO segments for a packet. */
 static void tcp_set_skb_tso_segs(struct sk_buff *skb, unsigned int mss_now)
 {
-   /* Make sure we own this skb before messing gso_size/gso_segs */
-   WARN_ON_ONCE(skb_cloned(skb));
-
if (skb->len <= mss_now || skb->ip_summed == CHECKSUM_NONE) {
/* Avoid the costly divide in the normal
 * non-TSO case.
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: txrx: remove unreachable negative return check and fixup type

2015-06-11 Thread Nicholas Mc Guire
wait_event_timeout(), introduced in 'commit 5e3dd157d7e7 ("ath10k: mac80211
driver for Qualcomm Atheros 802.11ac CQA98xx devices")' never returns < 0
so the only failure condition to be checked is == 0 (timeout). Further the
return type is long not int - an appropriately named variable is added
and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire 
---

Patch was compile tested with x86_64_defconfig + CONFIG_ATH_CARD=y
CONFIG_ATH10K=m

Patch is against 4.1-rc7 (localversion-next is -next-20150611)
 
 drivers/net/wireless/ath/ath10k/txrx.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 826500b..6cf2891 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -147,9 +147,9 @@ struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k 
*ar, int peer_id)
 static int ath10k_wait_for_peer_common(struct ath10k *ar, int vdev_id,
   const u8 *addr, bool expect_mapped)
 {
-   int ret;
+   long time_left;
 
-   ret = wait_event_timeout(ar->peer_mapping_wq, ({
+   time_left = wait_event_timeout(ar->peer_mapping_wq, ({
bool mapped;
 
spin_lock_bh(&ar->data_lock);
@@ -160,7 +160,7 @@ static int ath10k_wait_for_peer_common(struct ath10k *ar, 
int vdev_id,
 test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags));
}), 3*HZ);
 
-   if (ret <= 0)
+   if (time_left == 0)
return -ETIMEDOUT;
 
return 0;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: mac: remove unreachable negative return check

2015-06-11 Thread Nicholas Mc Guire
wait_event_timeout(), introduced in 'commit 5e3dd157d7e7 ("ath10k: mac80211
driver for Qualcomm Atheros 802.11ac CQA98xx devices")' never returns < 0
so the only failure condition to be checked is ==0 (timeout). Further the
return type is long not int - an appropriately named variable is added 
and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire 
---

Patch was compile tested with x86_64_defconfig + CONFIG_ATH_CARD=y
CONFIG_ATH10K=m

Patch is against 4.1-rc7 (localversion-next is -next-20150611)

 drivers/net/wireless/ath/ath10k/mac.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 0ed422a..cc67de9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5643,7 +5643,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
 {
struct ath10k *ar = hw->priv;
bool skip;
-   int ret;
+   long time_left;
 
/* mac80211 doesn't care if we really xmit queued frames or not
 * we'll collect those frames either way if we stop/delete vdevs */
@@ -5655,7 +5655,7 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
if (ar->state == ATH10K_STATE_WEDGED)
goto skip;
 
-   ret = wait_event_timeout(ar->htt.empty_tx_wq, ({
+   time_left = wait_event_timeout(ar->htt.empty_tx_wq, ({
bool empty;
 
spin_lock_bh(&ar->htt.tx_lock);
@@ -5669,9 +5669,9 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
(empty || skip);
}), ATH10K_FLUSH_TIMEOUT_HZ);
 
-   if (ret <= 0 || skip)
-   ath10k_warn(ar, "failed to flush transmit queue (skip %i 
ar-state %i): %i\n",
-   skip, ar->state, ret);
+   if (time_left == 0 || skip)
+   ath10k_warn(ar, "failed to flush transmit queue (skip %i 
ar-state %i): %ld\n",
+   skip, ar->state, time_left);
 
 skip:
mutex_unlock(&ar->conf_mutex);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 19/19] bna: use netdev_* and dev_* instead of printk and pr_*

2015-06-11 Thread Joe Perches
On Thu, 2015-06-11 at 11:43 +0200, Ivan Vecera wrote:
> On 06/10/2015 10:29 PM, Joe Perches wrote:
> > On Wed, 2015-06-10 at 18:43 +0200, Ivan Vecera wrote:
> >> Signed-off-by: Ivan Vecera 
> >
> > There should be some indication a few messages have
> > been deleted in the commit log and a reason why too.
> >
> >> diff --git a/drivers/net/ethernet/brocade/bna/bnad.c 
> >> b/drivers/net/ethernet/brocade/bna/bnad.c
> > []
> >> @@ -965,10 +964,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
> >>/*
> >> * Force an immediate
> >> * Transmit Schedule */
> >> -  printk(KERN_INFO "bna: %s %d "
> >> -"TXQ_STARTED\n",
> >> - bnad->netdev->name,
> >> - txq_id);
> >
> > []
> >
> >> @@ -1057,8 +1051,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx 
> >> *tx)
> >>txq_id = tcb->id;
> >>clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags);
> >>netif_stop_subqueue(bnad->netdev, txq_id);
> >> -  printk(KERN_INFO "bna: %s %d TXQ_STOPPED\n",
> >> -  bnad->netdev->name, txq_id);
> >
> > etc...
> >
> I'm sorry I have removed them as logging noise. IMHO it is not necessary 
> to log when .probe() and .remove() are called or when TxQ is started or 
> stopped.

I don't disagree at all, but it should be mentioned
in the commit message.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 1/3 v3] net: track link-status of ipv4 nexthops

2015-06-11 Thread Dinesh Dutt
Yes, this is what I liked about the 2 flag solution too compared to
the original.

Dinesh

On Thu, Jun 11, 2015 at 7:50 AM, Alexander Duyck
 wrote:
>
>
> On 06/11/2015 04:23 AM, Andy Gospodarek wrote:
>>
>> On Wed, Jun 10, 2015 at 11:07:28PM -0700, Scott Feldman wrote:
>>>
>>> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
>>>  wrote:

 Add a fib flag called RTNH_F_LINKDOWN to any ipv4 nexthops that are
 reachable via an interface where carrier is off.  No action is taken,
 but additional flags are passed to userspace to indicate carrier status.
>>>
>>> Andy, it seems now RTNH_F_LINKDOWN and RTNH_F_DEAD are very similar
>>> and I'm wondering if this could be done without introducing a new flag
>>> and just use RTNH_F_DEAD.  The link change event would set RTNH_F_DEAD
>>> on nh on dev link down, and clear on link up.  The sysctl knob would
>>> be something like "nexthop_dead_on_linkdown", default off.  So
>>> basically expanding the ways RTNH_F_DEAD can be set.  That would
>>> simplify the patch set quite a bit and require no changes to iproute2.
>>>
>> You are absolutely correct that what you describe would be less churn to
>> userspace.  From a functionality standpoint that is close to what was
>> originally proposed, but Alex specifically did not like the behavioral
>> change to what having RTNH_F_DEAD set (at least that was what I
>> understood).
>>
>> That was what made me make the move to add this additional flag that was
>> exported to userspace, so it was possible to differentiate the old dead
>> routes/nexthop functionality from those that were not going to be dead
>> due to link being down.
>>   this point I think I prefer the additional data provided by the new
>> flag exported to userspace.
>
>
> I preferred the 2 flag solution as the original solution still required 2
> flags, it just only exposed 1 to user-space.  As a result it was much more
> error prone since it was fairly easy to get into a confused state about why
> the link was dead.
>
> With the 2 flag solution it becomes much easier to sort out why the route is
> not functional and it is much easier to isolate for things like the sysctl
> which only disables the use of LINKDOWN and not DEAD.
>
> - Alex
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net] net: igb: fix the start time for periodic output signals

2015-06-11 Thread Keller, Jacob E
Reviewed-by: Jacob Keller 

Thanks Richard! Easy detail to miss.

Regards,
Jake

On Thu, 2015-06-11 at 14:51 +0200, Richard Cochran wrote:
> When programming the start of a periodic output, the code wrongly 
> places
> the seconds value into the "low" register and the nanoseconds into 
> the
> "high" register.  Even though this is backwards, it slipped through 
> my
> testing, because the re-arming code in the interrupt service routine 
> is
> correct, and the signal does appear starting with the second edge.
> 
> This patch fixes the issue by programming the registers correctly.
> 
> Signed-off-by: Richard Cochran 
> ---
>  drivers/net/ethernet/intel/igb/igb_ptp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c 
> b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index e3b9b63..c3a9392c 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -538,8 +538,8 @@ static int igb_ptp_feature_enable_i210(struct 
> ptp_clock_info *ptp,
>   igb->perout[i].start.tv_nsec = rq
> ->perout.start.nsec;
>   igb->perout[i].period.tv_sec = ts.tv_sec;
>   igb->perout[i].period.tv_nsec = ts.tv_nsec;
> - wr32(trgttiml, rq->perout.start.sec);
> - wr32(trgttimh, rq->perout.start.nsec);
> + wr32(trgttimh, rq->perout.start.sec);
> + wr32(trgttiml, rq->perout.start.nsec);
>   tsauxc |= tsauxc_mask;
>   tsim |= tsim_mask;
>   } else {

Re: [PATCH net-next v2] switchdev: fix BUG when port driver doesn't support set attr op

2015-06-11 Thread Brenden Blanco
On Thu, Jun 11, 2015 at 8:19 AM,   wrote:
> From: Scott Feldman 
>
> Fix a BUG_ON() where CONFIG_NET_SWITCHDEV is set but the driver for a
> bridged port does not support switchdev_port_attr_set op.  Don't BUG_ON()
> if -EOPNOTSUPP is returned.
>
> Also change BUG_ON() to netdev_err since this is a normal error path and
> does not warrant the use of BUG_ON(), which is reserved for unrecoverable
> errs.
>
> Signed-off-by: Scott Feldman 
> Reported-by: Brenden Blanco 
> ---
>  net/switchdev/switchdev.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index e008057..ecd1b3f 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -103,7 +103,9 @@ static void switchdev_port_attr_set_work(struct 
> work_struct *work)
>
> rtnl_lock();
> err = switchdev_port_attr_set(asw->dev, &asw->attr);
> -   BUG_ON(err);
> +   if (err && err != -EOPNOTSUPP)
> +   netdev_err(asw->dev, "failed (err=%d) to set attribute 
> (id=%d)\n",
> +  err, asw->attr.id);
> rtnl_unlock();
>
> dev_put(asw->dev);
> --
> 1.7.10.4
>

I just tried this patch against the original test case, and this one
works well for me. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 12/13] net/core: Add reading VF statistics through the PF netdevice

2015-06-11 Thread Or Gerlitz
On Wed, Jun 10, 2015 at 6:23 PM, John Fastabend
 wrote:
> On 06/10/2015 07:59 AM, Or Gerlitz wrote:
>>
>> From: Eran Ben Elisha 
>>
>> Add ndo_get_vf_stats where the PF retrieves and fills the VFs traffic
>> statistics. Add rtnl_link_vf_stats64 for passing the VF statistics from
>> the PF to user-space.
>>
>> Signed-off-by: Eran Ben Elisha 
>> Signed-off-by: Hadar Hen Zion 
>> Signed-off-by: Or Gerlitz 
>> ---
>>   include/linux/netdevice.h|4 
>>   include/uapi/linux/if_link.h |   11 +++
>>   net/core/rtnetlink.c |   12 ++--
>>   3 files changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index 6f5f71f..b1d3b88 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1100,6 +1100,10 @@ struct net_device_ops {
>>  struct ifla_vf_info
>> *ivf);
>> int (*ndo_set_vf_link_state)(struct net_device
>> *dev,
>>  int vf, int
>> link_state);
>> +   int (*ndo_get_vf_stats)(struct net_device
>> *dev,
>> +   int vf,
>> +   struct
>> rtnl_link_vf_stats64
>> +   *vf_stats);
>> int (*ndo_set_vf_port)(struct net_device *dev,
>>int vf,
>>struct nlattr *port[]);
>> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
>> index 1737b7a..9c25aeb 100644
>> --- a/include/uapi/linux/if_link.h
>> +++ b/include/uapi/linux/if_link.h
>> @@ -70,6 +70,16 @@ struct rtnl_link_stats64 {
>> __u64   tx_compressed;
>>   };
>>
>> +/* VF statistics structure */
>> +struct rtnl_link_vf_stats64 {
>> +   __u64   rx_packets; /* total packets received   */
>> +   __u64   tx_packets; /* total packets transmitted*/
>> +   __u64   rx_bytes;   /* total bytes received */
>> +   __u64   tx_bytes;   /* total bytes transmitted  */
>> +   __u64   broadcast;  /* broadcast packets received   */
>> +   __u64   multicast;  /* multicast packets received   */
>> +};
>
>
> Can we encode this in a nested netlink structure when its passed
> up to userspace? I have more stats I would like to export in the
> future such as dropped packets and if we put the structure in the UAPI
> we wont be able to easily extend this.

Yep, makes sense, I asked Eran to look on doing so.

> The structure could be moved into ./include/linux/if_link.h though.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] NET: Add ezchip ethernet driver

2015-06-11 Thread Noam Camus
From: Tal Zilcer 

Simple LAN device without multicast support.
Device performance is not high and may be used for
debug or management purposes.
Device supports interrupts for RX and TX end.
Device does not support NAPI and also does not support DMA.
It is used in EZchip NPS devices.

Signed-off-by: Noam Camus 
Signed-off-by: Tal Zilcer 
Acked-by: Alexey Brodkin 
---
Chahges in patch v2,v3:
1) Did some renaming:
a) EZCHIP_NPS_LAN to EZCHIP_NPS_MANAGEMENT_ENET
b) nps_enet to nps_mgt_enet
2) Update GPL to version 2
3) Remove driver default configuration (y)
4) Change integer type to u32/s32 to more clear
5) More comments e.g. reset function
6) Add signed-off-by of driver author
---
 .../devicetree/bindings/net/ezchip_enet.txt|   15 +
 drivers/net/ethernet/Kconfig   |1 +
 drivers/net/ethernet/Makefile  |1 +
 drivers/net/ethernet/ezchip/Kconfig|   29 +
 drivers/net/ethernet/ezchip/Makefile   |1 +
 drivers/net/ethernet/ezchip/nps_enet.c |  597 
 drivers/net/ethernet/ezchip/nps_enet.h |  311 ++
 7 files changed, 955 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ezchip_enet.txt
 create mode 100644 drivers/net/ethernet/ezchip/Kconfig
 create mode 100644 drivers/net/ethernet/ezchip/Makefile
 create mode 100644 drivers/net/ethernet/ezchip/nps_enet.c
 create mode 100644 drivers/net/ethernet/ezchip/nps_enet.h

diff --git a/Documentation/devicetree/bindings/net/ezchip_enet.txt 
b/Documentation/devicetree/bindings/net/ezchip_enet.txt
new file mode 100644
index 000..4e29b2b
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ezchip_enet.txt
@@ -0,0 +1,15 @@
+* EZchip NPS Management Ethernet port driver
+
+Required properties:
+- compatible: Should be "ezchip,nps-mgt-enet"
+- reg: Address and length of the register set for the device
+- interrupts: Should contain the ENET interrupt
+
+Examples:
+
+   ethernet@f0003000 {
+   compatible = "ezchip,nps-mgt-enet";
+   reg = <0xf0003000 0x44>;
+   interrupts = <7>;
+   mac-address = [ 00 11 22 33 44 55 ];
+   };
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index eadcb05..1a6b1ba 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -66,6 +66,7 @@ config DNET
 source "drivers/net/ethernet/dec/Kconfig"
 source "drivers/net/ethernet/dlink/Kconfig"
 source "drivers/net/ethernet/emulex/Kconfig"
+source "drivers/net/ethernet/ezchip/Kconfig"
 source "drivers/net/ethernet/neterion/Kconfig"
 source "drivers/net/ethernet/faraday/Kconfig"
 source "drivers/net/ethernet/freescale/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 1367afc..489f9cc 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_DNET) += dnet.o
 obj-$(CONFIG_NET_VENDOR_DEC) += dec/
 obj-$(CONFIG_NET_VENDOR_DLINK) += dlink/
 obj-$(CONFIG_NET_VENDOR_EMULEX) += emulex/
+obj-$(CONFIG_NET_VENDOR_EZCHIP) += ezchip/
 obj-$(CONFIG_NET_VENDOR_EXAR) += neterion/
 obj-$(CONFIG_NET_VENDOR_FARADAY) += faraday/
 obj-$(CONFIG_NET_VENDOR_FREESCALE) += freescale/
diff --git a/drivers/net/ethernet/ezchip/Kconfig 
b/drivers/net/ethernet/ezchip/Kconfig
new file mode 100644
index 000..23883b4
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/Kconfig
@@ -0,0 +1,29 @@
+#
+# EZchip network device configuration
+#
+
+config NET_VENDOR_EZCHIP
+   bool "EZchip devices"
+   default y
+   ---help---
+ If you have a network (Ethernet) device belonging to this class, say Y
+ and read the Ethernet-HOWTO, available from
+ .
+
+ Note that the answer to this question doesn't directly affect the
+ kernel: saying N will just cause the configurator to skip all
+ the questions about EZchip devices. If you say Y, you will be asked 
for
+ your specific device in the following questions.
+
+if NET_VENDOR_EZCHIP
+
+config EZCHIP_NPS_MANAGEMENT_ENET
+   tristate "EZchip NPS management enet support"
+   ---help---
+ Simple LAN device without multicast support.
+ Device performance is not high and may be used for
+ debug or management purposes.
+ Device supports interrupts for RX and TX(end).
+ Device does not support NAPI and also does not support DMA.
+
+endif
diff --git a/drivers/net/ethernet/ezchip/Makefile 
b/drivers/net/ethernet/ezchip/Makefile
new file mode 100644
index 000..e490176
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EZCHIP_NPS_MANAGEMENT_ENET) += nps_enet.o
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c 
b/drivers/net/ethernet/ezchip/nps_enet.c
new file mode 100644
index 000..4b23ed9
--- /dev/null
+++ b/drivers/net/ethernet/ezchip/nps_ene

[PATCH] sctp: allow authenticating DATA chunks that are bundled with COOKIE_ECHO

2015-06-11 Thread mleitner
From: Marcelo Ricardo Leitner 

Currently, we can ask to authenticate DATA chunks and we can send DATA
chunks on the same packet as COOKIE_ECHO, but if you try to combine
both, the DATA chunk will be sent unauthenticated and peer won't accept
it, leading to a communication failure.

This happens because even though the data was queued after it was
requested to authenticate DATA chunks, it was also queued before we
could know that remote peer can handle authenticating, so
sctp_auth_send_cid() returns false.

The fix is whenever we set up an active key, re-check send queue for
chunks that now should be authenticated. As a result, such packet will
now contain COOKIE_ECHO + AUTH + DATA chunks, in that order.

Reported-by: Liu Wei 
Signed-off-by: Marcelo Ricardo Leitner 
---
 net/sctp/auth.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 
fb7976aee61c84f38aecdc5c5f0d8be20e577fa9..4f15b7d730e13d6aaa58ba7a28262c9831afea95
 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -381,13 +381,14 @@ nomem:
 }
 
 
-/* Public interface to creat the association shared key.
+/* Public interface to create the association shared key.
  * See code above for the algorithm.
  */
 int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
 {
struct sctp_auth_bytes  *secret;
struct sctp_shared_key *ep_key;
+   struct sctp_chunk *chunk;
 
/* If we don't support AUTH, or peer is not capable
 * we don't need to do anything.
@@ -410,6 +411,14 @@ int sctp_auth_asoc_init_active_key(struct sctp_association 
*asoc, gfp_t gfp)
sctp_auth_key_put(asoc->asoc_shared_key);
asoc->asoc_shared_key = secret;
 
+   /* Update send queue in case any chunk already in there now
+* needs authenticating
+*/
+   list_for_each_entry(chunk, &asoc->outqueue.out_chunk_list, list) {
+   if (sctp_auth_send_cid(chunk->chunk_hdr->type, asoc))
+   chunk->auth = 1;
+   }
+
return 0;
 }
 
-- 
2.4.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ssh connections hanging on 4.1rc7

2015-06-11 Thread Dave Jones
Just hit this weird problem where I can ssh into a machine once,
then after logging out, subsequent ssh connections hang.

The client side looks like..

13:39:06.307781 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [S], seq 319726787, win 29200, options [mss 1460,sackOK,TS val 77408596 
ecr 0,nop,wscale 7], length 0
13:39:06.308580 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 319726788:319726820, ack 1404309216, win 229, options 
[nop,nop,TS val 77408597 ecr 19368680], length 32
13:39:06.332551 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 32:2000, ack 33, win 229, options [nop,nop,TS val 77408621 ecr 
19368703], length 1968
13:39:06.370042 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 2048:2064, ack 1265, win 258, options [nop,nop,TS val 77408658 
ecr 19368734], length 16
13:39:06.449511 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [.], ack 1309, win 258, options [nop,nop,TS val 77408738 ecr 19368782], 
length 0

until I ctrl-c which then sends the FIN

13:40:06.914614 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [F.], seq 2108, ack 1309, win 258, options [nop,nop,TS val 77469203 ecr 
19368782], length 0


On the sshd side..


13:39:06.311005 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [S], seq 319726787, win 29200, options [mss 1460,sackOK,TS val 77408596 
ecr 0,nop,wscale 7], length 0
13:39:06.311254 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [.], ack 1404309216, win 229, options [nop,nop,TS val 77408596 ecr 
19368680], length 0
13:39:06.311778 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 0:32, ack 1, win 229, options [nop,nop,TS val 77408597 ecr 
19368680], length 32
13:39:06.334546 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [.], ack 33, win 229, options [nop,nop,TS val 77408619 ecr 19368703], 
length 0
13:39:06.335779 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 32:2000, ack 33, win 229, options [nop,nop,TS val 77408621 ecr 
19368703], length 1968
13:39:06.347867 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 2000:2048, ack 985, win 243, options [nop,nop,TS val 77408633 
ecr 19368711], length 48
13:39:06.373232 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 2048:2064, ack 1265, win 258, options [nop,nop,TS val 77408658 
ecr 19368734], length 16
13:39:06.413173 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [P.], seq 2064:2108, ack 1265, win 258, options [nop,nop,TS val 77408698 
ecr 19368782], length 44
13:39:06.452714 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [.], ack 1309, win 258, options [nop,nop,TS val 77408738 ecr 19368782], 
length 0

until the ctrl-c...

13:40:06.917807 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [F.], seq 2108, ack 1309, win 258, options [nop,nop,TS val 77469203 ecr 
19368782], length 0
13:40:06.921241 IP wopr.kernelslacker.org.43982 > gelk.kernelslacker.org.ssh: 
Flags [.], ack 1310, win 258, options [nop,nop,TS val 77469206 ecr 19429290], 
length 0


Is there anything out of the ordinary here that I'm missing, or is this perhaps
an sshd bug ?

The odd thing is that it seems repeatable with every host I try to ssh to.

4.1rc7 on both sides, haven't tried reproducing with different kernels yet.

Dave

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ssh connections hanging on 4.1rc7

2015-06-11 Thread Dave Jones
On Thu, Jun 11, 2015 at 01:46:18PM -0400, Dave Jones wrote:
 > Just hit this weird problem where I can ssh into a machine once,
 > then after logging out, subsequent ssh connections hang.
 > 
 > The client side looks like..
 
derp, missed half the tcpdump capture on both sides, and now
I can't reproduce it.  I'll resend if it happens again.

Dave
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 0/3 v3] changes to make ipv4 routing table aware of next-hop link status

2015-06-11 Thread Andy Gospodarek
On Thu, Jun 11, 2015 at 08:44:55AM -0700, Scott Feldman wrote:
> On Wed, Jun 10, 2015 at 8:19 PM, Andy Gospodarek
>  wrote:
> > On Wed, Jun 10, 2015 at 08:07:10PM -0700, Scott Feldman wrote:
> >> On Wed, Jun 10, 2015 at 7:37 PM, Andy Gospodarek
> >>  wrote:
> >>
> >> > There was also a request for switchdev support for this, but that will be
> >> > posted as a followup as switchdev does not currently handle dead
> >> > next-hops in a multi-path case and I felt that infra needed to be added
> >> > first.
> >>
> >> That's not true.  switchdev_fib_ipv4_add() passes *fi and all of the
> >> nexthops for the route are hanging off of that, including the
> >> nh->flags where you're setting LINKDOWN.  Multipath is not different
> >> than singlepath in that regard.  Same API for both.
> >
> > The API is the same, but I did not see a path that would take a
> > multipath route and update the dead nexthops when an interface is taken
> > down with switchdev or rocker today.
> >
> > I could be wrong (and I will test again), but create a multipath route
> > with nexthops on swp1 and swp2 and then call 'ip link set swp1 down' and
> > let me know if you see rocker's ECMP routes get updated so only the
> > nexthop on swp2 will be used.
> 
> I don't have ecmp support in rocker yet, but switchdev should be ready
> for ecmp.  I tried the test you suggest and switchdev is calling into
> the driver with updates to the routes with nhs marked DEAD.  So maybe
> your patchset is switchdev-ready?  I'd have to apply your patch to
> test. I'll wait for your v4 to address sysctl naming.

That isn't exactly what I expected by inspection, so I'm pleasantly
surprised.  I'll hold off on the excitement until I get v4 out (which
should be shortly as the request should not be too bad to resolve).

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case

2015-06-11 Thread sfeldma
From: Scott Feldman 

This particular BUG_ON condition was checking for attr set err in the
COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is
OK but COMMIT fails).  But BUG_ON() is too strong for this case, so change
to WARN().  BUG_ON() would be warranted if the system was corrupted beyond
repair, but this is not the case here.

Signed-off-by: Scott Feldman 
---
 net/switchdev/switchdev.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 658bc3a..a5d0f8e 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -184,7 +184,8 @@ int switchdev_port_attr_set(struct net_device *dev, struct 
switchdev_attr *attr)
 
attr->trans = SWITCHDEV_TRANS_COMMIT;
err = __switchdev_port_attr_set(dev, attr);
-   BUG_ON(err);
+   WARN(err, "%s: Commit of attribute (id=%d) failed.\n",
+dev->name, attr->id);
 
return err;
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ssh connections hanging on 4.1rc7

2015-06-11 Thread Eric Dumazet
On Thu, 2015-06-11 at 13:46 -0400, Dave Jones wrote:
> Just hit this weird problem where I can ssh into a machine once,
> then after logging out, subsequent ssh connections hang.
> 
> The client side looks like..
> 
> 13:39:06.307781 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [S], seq 319726787, win 29200,
> options [mss 1460,sackOK,TS val 77408596 ecr 0,nop,wscale 7], length 0
> 13:39:06.308580 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 319726788:319726820, ack
> 1404309216, win 229, options [nop,nop,TS val 77408597 ecr 19368680],
> length 32
> 13:39:06.332551 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 32:2000, ack 33, win 229,
> options [nop,nop,TS val 77408621 ecr 19368703], length 1968
> 13:39:06.370042 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 2048:2064, ack 1265, win
> 258, options [nop,nop,TS val 77408658 ecr 19368734], length 16
> 13:39:06.449511 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [.], ack 1309, win 258, options
> [nop,nop,TS val 77408738 ecr 19368782], length 0
> 
> until I ctrl-c which then sends the FIN
> 
> 13:40:06.914614 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [F.], seq 2108, ack 1309, win 258,
> options [nop,nop,TS val 77469203 ecr 19368782], length 0
> 
> 
> On the sshd side..
> 
> 
> 13:39:06.311005 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [S], seq 319726787, win 29200,
> options [mss 1460,sackOK,TS val 77408596 ecr 0,nop,wscale 7], length 0
> 13:39:06.311254 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [.], ack 1404309216, win 229,
> options [nop,nop,TS val 77408596 ecr 19368680], length 0
> 13:39:06.311778 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 0:32, ack 1, win 229,
> options [nop,nop,TS val 77408597 ecr 19368680], length 32
> 13:39:06.334546 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [.], ack 33, win 229, options
> [nop,nop,TS val 77408619 ecr 19368703], length 0
> 13:39:06.335779 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 32:2000, ack 33, win 229,
> options [nop,nop,TS val 77408621 ecr 19368703], length 1968
> 13:39:06.347867 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 2000:2048, ack 985, win
> 243, options [nop,nop,TS val 77408633 ecr 19368711], length 48
> 13:39:06.373232 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 2048:2064, ack 1265, win
> 258, options [nop,nop,TS val 77408658 ecr 19368734], length 16
> 13:39:06.413173 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [P.], seq 2064:2108, ack 1265, win
> 258, options [nop,nop,TS val 77408698 ecr 19368782], length 44
> 13:39:06.452714 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [.], ack 1309, win 258, options
> [nop,nop,TS val 77408738 ecr 19368782], length 0
> 
> until the ctrl-c...
> 
> 13:40:06.917807 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [F.], seq 2108, ack 1309, win 258,
> options [nop,nop,TS val 77469203 ecr 19368782], length 0
> 13:40:06.921241 IP wopr.kernelslacker.org.43982 >
> gelk.kernelslacker.org.ssh: Flags [.], ack 1310, win 258, options
> [nop,nop,TS val 77469206 ecr 19429290], length 0
> 
> 
> Is there anything out of the ordinary here that I'm missing, or is
> this perhaps
> an sshd bug ?
> 
> The odd thing is that it seems repeatable with every host I try to ssh
> to.
> 
> 4.1rc7 on both sides, haven't tried reproducing with different kernels
> yet.

Your tcpdumps look one way only.

Could this be some routing or mtu problem ?


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next 5/5] rocker: remove support for legacy VLAN ndo ops

2015-06-11 Thread Scott Feldman
On Thu, Jun 11, 2015 at 6:00 AM, Jamal Hadi Salim  wrote:
> Full quote below. So what is the consensus on this topic?
> I read the emails but i dont see a resolution.

I think I dropped the ball on this one.  I'll go ahead and submit the
last patch I posted to this email thread to resume the conversation.
I think we're close; just need to make sure we have buy-in.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: /net/mpls/conf/ethX//input duplicate entry

2015-06-11 Thread Eric W. Biederman
Robert Shearman  writes:

> On 11/06/15 00:23, Scott Feldman wrote:
>> On Wed, Jun 10, 2015 at 2:58 PM, roopa  wrote:
>>> On 6/10/15, 1:43 PM, Scott Feldman wrote:

 I'm getting this dump_stack when reloading rocker driver.  Did some
 sysctl MPLS nodes not get cleaned up on NETDEV_UNREGISTER?

 Steps to repro: load rocker (on system) with rocker device, rmmod
 rocker, and then modprobe rocker.  I doubt this is specific to rocker:
 and re-registration of a netdev should hit it. I am using UDEV rules
 to rename kernel's ethX to a different name.  Maybe that's what
 tripped it up?

>>> On a quick look, wondering if this is because mpls driver does not seem to
>>> do a unregister and re-register sysctl
>>> on device name change.
>
> Mea culpa. Thanks for looking at this.
>
>>>
>>> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
>>> index 7b3f732..ec21a5d 100644
>>> --- a/net/mpls/af_mpls.c
>>> +++ b/net/mpls/af_mpls.c
>>> @@ -564,6 +564,14 @@ static int mpls_dev_notify(struct notifier_block *this,
>>> unsigned long event,
>>>  case NETDEV_UNREGISTER:
>>>  mpls_ifdown(dev);
>>>  break;
>>> +   case NETDEV_CHANGENAME:
>>> +   mpls_ifdown(dev);
>>> +   if ((dev->type == ARPHRD_ETHER) ||
>>> +   (dev->type == ARPHRD_LOOPBACK)) {
>>> +   mdev = mpls_add_dev(dev);
>>> +   if (IS_ERR(mdev))
>>> +   return notifier_from_errno(PTR_ERR(mdev));
>>> +   }
>>>  }
>>>  return NOTIFY_OK;
>>>   }
>>
>> Roopa, I tested this patch and problem goes away.  (It's missing a
>> break statement, BTW).  I didn't look into the correctness of the
>> patch, but at first glance it seems liek the right thing to do.  Maybe
>> breaking out the renaming portions into sub-functions could keep the
>> work done in NETDEV_CHANGENAME to a minimum.
>
> I agree that breaking out the sysctl registration/unregistration is a good 
> idea
> to not have to do more work than is necessary, and to avoid unintended
> consequences (like routes using the interface being made unusable).

Yes.  It needs to be something like:

+   case NETDEV_CHANGENAME:
+   mdev = mpls_dev_get(dev);
+   if (mdev) {
+   mpls_dev_sysctl_unregister(mdev);
+   mpls_dev_sysctl_register(dev, mdev);
+   }
+   break;

Eric
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net] mpls: handle device renames for per-device sysctls

2015-06-11 Thread Robert Shearman
If a device is renamed and the original name is subsequently reused
for a new device, the following warning is generated:

sysctl duplicate entry: /net/mpls/conf/veth0//input
CPU: 3 PID: 1379 Comm: ip Not tainted 4.1.0-rc4+ #20
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
1.7.5-20140531_083030-gandalf 04/01/2014
   81566aaf 
 81236279 88002f7d7f00  88000db336d8
 88000db33698 0005 88002e046000 8800168c9280
Call Trace:
 [] ? dump_stack+0x40/0x50
 [] ? __register_sysctl_table+0x289/0x5a0
 [] ? mpls_dev_notify+0x1ff/0x300 [mpls_router]
 [] ? notifier_call_chain+0x4f/0x70
 [] ? register_netdevice+0x2b2/0x480
 [] ? veth_newlink+0x178/0x2d3 [veth]
 [] ? rtnl_newlink+0x73c/0x8e0
 [] ? rtnl_newlink+0x16a/0x8e0
 [] ? __kmalloc_reserve.isra.30+0x32/0x90
 [] ? rtnetlink_rcv_msg+0x8d/0x250
 [] ? __alloc_skb+0x47/0x1f0
 [] ? __netlink_lookup+0xab/0xe0
 [] ? rtnetlink_rcv+0x30/0x30
 [] ? netlink_rcv_skb+0xb0/0xd0
 [] ? rtnetlink_rcv+0x24/0x30
 [] ? netlink_unicast+0x107/0x1a0
 [] ? netlink_sendmsg+0x50e/0x630
 [] ? sock_sendmsg+0x3c/0x50
 [] ? ___sys_sendmsg+0x27b/0x290
 [] ? mem_cgroup_try_charge+0x88/0x110
 [] ? mem_cgroup_commit_charge+0x56/0xa0
 [] ? do_filp_open+0x30/0xa0
 [] ? __sys_sendmsg+0x3e/0x80
 [] ? system_call_fastpath+0x16/0x75

Fix this by unregistering the previous sysctl table (registered for
the path containing the original device name) and re-registering the
table for the path containing the new device name.

Fixes: 37bde79979c3 ("mpls: Per-device enabling of packet input")
Reported-by: Scott Feldman 
Signed-off-by: Robert Shearman 
---
 net/mpls/af_mpls.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index bff427f31924..1f93a5978f2a 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -564,6 +564,17 @@ static int mpls_dev_notify(struct notifier_block *this, 
unsigned long event,
case NETDEV_UNREGISTER:
mpls_ifdown(dev);
break;
+   case NETDEV_CHANGENAME:
+   mdev = mpls_dev_get(dev);
+   if (mdev) {
+   int err;
+
+   mpls_dev_sysctl_unregister(mdev);
+   err = mpls_dev_sysctl_register(dev, mdev);
+   if (err)
+   return notifier_from_errno(err);
+   }
+   break;
}
return NOTIFY_OK;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] bridge: use either ndo VLAN ops or switchdev VLAN ops to install MASTER vlans

2015-06-11 Thread sfeldma
From: Scott Feldman 

To maintain backward compatibility with the existing iproute2 "bridge vlan"
command, let bridge's setlink/dellink handler call into either the port
driver's 8021q ndo ops or the port driver's bridge_setlink/dellink ops.

This allows port driver to choose 8021q ops or the newer
bridge_setlink/dellink ops when implementing VLAN add/del filtering on the
device.  The iproute "bridge vlan" command does not need to be modified.

To summarize using the "bridge vlan" command examples, we have:

1) bridge vlan add|del vid VID dev DEV

Here iproute2 sets MASTER flag.  Bridge's bridge_setlink/dellink is called.
Vlan is set on bridge for port.  If port driver implements ndo 8021q ops,
call those to port driver can install vlan filter on device.  Otherwise, if
port driver implements bridge_setlink/dellink ops, call those to install
vlan filter to device.  This option only works if port is bridged.

2) bridge vlan add|del vid VID dev DEV master

Same as 1)

3) bridge vlan add|del vid VID dev DEV self

Bridge's bridge_setlink/dellink isn't called.  Port driver's
bridge_setlink/dellink is called, if implemented.  This option works if
port is bridged or not.  If port is not bridged, a VLAN can still be
added/deleted to device filter using this variant.

4) bridge vlan add|del vid VID dev DEV master self

This is a combination of 1) and 3), but will only work if port is bridged.

Signed-off-by: Scott Feldman 
---
 net/bridge/br_vlan.c |   56 --
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 13013fe..a7cfa58 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -2,6 +2,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "br_private.h"
 
@@ -36,6 +37,35 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 
vid, u16 flags)
clear_bit(vid, v->untagged_bitmap);
 }
 
+static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,
+ u16 vid, u16 flags)
+{
+   const struct net_device_ops *ops = dev->netdev_ops;
+   struct switchdev_obj vlan_obj = {
+   .id = SWITCHDEV_OBJ_PORT_VLAN,
+   .u.vlan = {
+   .flags = flags,
+   .vid_start = vid,
+   .vid_end = vid,
+   },
+   };
+   int err;
+
+   /* If driver uses VLAN ndo ops, use 8021q to install vid
+* on device, otherwise try switchdev ops to install vid.
+*/
+
+   if (ops->ndo_vlan_rx_add_vid) {
+   err = vlan_vid_add(dev, br->vlan_proto, vid);
+   } else {
+   err = switchdev_port_obj_add(dev, &vlan_obj);
+   if (err == -EOPNOTSUPP)
+   err = 0;
+   }
+
+   return err;
+}
+
 static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
 {
struct net_bridge_port *p = NULL;
@@ -62,7 +92,7 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 
flags)
 * This ensures tagged traffic enters the bridge when
 * promiscuous mode is disabled by br_manage_promisc().
 */
-   err = vlan_vid_add(dev, br->vlan_proto, vid);
+   err = __vlan_vid_add(dev, br, vid, flags);
if (err)
return err;
}
@@ -86,6 +116,28 @@ out_filt:
return err;
 }
 
+static void __vlan_vid_del(struct net_device *dev, struct net_bridge *br,
+  u16 vid)
+{
+   const struct net_device_ops *ops = dev->netdev_ops;
+   struct switchdev_obj vlan_obj = {
+   .id = SWITCHDEV_OBJ_PORT_VLAN,
+   .u.vlan = {
+   .vid_start = vid,
+   .vid_end = vid,
+   },
+   };
+
+   /* If driver uses VLAN ndo ops, use 8021q to delete vid
+* on device, otherwise try switchdev ops to delete vid.
+*/
+
+   if (ops->ndo_vlan_rx_kill_vid)
+   vlan_vid_del(dev, br->vlan_proto, vid);
+   else
+   switchdev_port_obj_del(dev, &vlan_obj);
+}
+
 static int __vlan_del(struct net_port_vlans *v, u16 vid)
 {
if (!test_bit(vid, v->vlan_bitmap))
@@ -96,7 +148,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
 
if (v->port_idx) {
struct net_bridge_port *p = v->parent.port;
-   vlan_vid_del(p->dev, p->br->vlan_proto, vid);
+   __vlan_vid_del(p->dev, p->br, vid);
}
 
clear_bit(vid, v->vlan_bitmap);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next] bridge: use either ndo VLAN ops or switchdev VLAN ops to install MASTER vlans

2015-06-11 Thread Scott Feldman
Drats, sorry Stephen, forgot to add you.

On Thu, Jun 11, 2015 at 12:15 PM,   wrote:
> From: Scott Feldman 
>
> To maintain backward compatibility with the existing iproute2 "bridge vlan"
> command, let bridge's setlink/dellink handler call into either the port
> driver's 8021q ndo ops or the port driver's bridge_setlink/dellink ops.
>
> This allows port driver to choose 8021q ops or the newer
> bridge_setlink/dellink ops when implementing VLAN add/del filtering on the
> device.  The iproute "bridge vlan" command does not need to be modified.
>
> To summarize using the "bridge vlan" command examples, we have:
>
> 1) bridge vlan add|del vid VID dev DEV
>
> Here iproute2 sets MASTER flag.  Bridge's bridge_setlink/dellink is called.
> Vlan is set on bridge for port.  If port driver implements ndo 8021q ops,
> call those to port driver can install vlan filter on device.  Otherwise, if
> port driver implements bridge_setlink/dellink ops, call those to install
> vlan filter to device.  This option only works if port is bridged.
>
> 2) bridge vlan add|del vid VID dev DEV master
>
> Same as 1)
>
> 3) bridge vlan add|del vid VID dev DEV self
>
> Bridge's bridge_setlink/dellink isn't called.  Port driver's
> bridge_setlink/dellink is called, if implemented.  This option works if
> port is bridged or not.  If port is not bridged, a VLAN can still be
> added/deleted to device filter using this variant.
>
> 4) bridge vlan add|del vid VID dev DEV master self
>
> This is a combination of 1) and 3), but will only work if port is bridged.
>
> Signed-off-by: Scott Feldman 
> ---
>  net/bridge/br_vlan.c |   56 
> --
>  1 file changed, 54 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 13013fe..a7cfa58 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -2,6 +2,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "br_private.h"
>
> @@ -36,6 +37,35 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 
> vid, u16 flags)
> clear_bit(vid, v->untagged_bitmap);
>  }
>
> +static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br,
> + u16 vid, u16 flags)
> +{
> +   const struct net_device_ops *ops = dev->netdev_ops;
> +   struct switchdev_obj vlan_obj = {
> +   .id = SWITCHDEV_OBJ_PORT_VLAN,
> +   .u.vlan = {
> +   .flags = flags,
> +   .vid_start = vid,
> +   .vid_end = vid,
> +   },
> +   };
> +   int err;
> +
> +   /* If driver uses VLAN ndo ops, use 8021q to install vid
> +* on device, otherwise try switchdev ops to install vid.
> +*/
> +
> +   if (ops->ndo_vlan_rx_add_vid) {
> +   err = vlan_vid_add(dev, br->vlan_proto, vid);
> +   } else {
> +   err = switchdev_port_obj_add(dev, &vlan_obj);
> +   if (err == -EOPNOTSUPP)
> +   err = 0;
> +   }
> +
> +   return err;
> +}
> +
>  static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
>  {
> struct net_bridge_port *p = NULL;
> @@ -62,7 +92,7 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, 
> u16 flags)
>  * This ensures tagged traffic enters the bridge when
>  * promiscuous mode is disabled by br_manage_promisc().
>  */
> -   err = vlan_vid_add(dev, br->vlan_proto, vid);
> +   err = __vlan_vid_add(dev, br, vid, flags);
> if (err)
> return err;
> }
> @@ -86,6 +116,28 @@ out_filt:
> return err;
>  }
>
> +static void __vlan_vid_del(struct net_device *dev, struct net_bridge *br,
> +  u16 vid)
> +{
> +   const struct net_device_ops *ops = dev->netdev_ops;
> +   struct switchdev_obj vlan_obj = {
> +   .id = SWITCHDEV_OBJ_PORT_VLAN,
> +   .u.vlan = {
> +   .vid_start = vid,
> +   .vid_end = vid,
> +   },
> +   };
> +
> +   /* If driver uses VLAN ndo ops, use 8021q to delete vid
> +* on device, otherwise try switchdev ops to delete vid.
> +*/
> +
> +   if (ops->ndo_vlan_rx_kill_vid)
> +   vlan_vid_del(dev, br->vlan_proto, vid);
> +   else
> +   switchdev_port_obj_del(dev, &vlan_obj);
> +}
> +
>  static int __vlan_del(struct net_port_vlans *v, u16 vid)
>  {
> if (!test_bit(vid, v->vlan_bitmap))
> @@ -96,7 +148,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
>
> if (v->port_idx) {
> struct net_bridge_port *p = v->parent.port;
> -   vlan_vid_del(p->dev, p->br->vlan_proto, vid);
> +   __vlan_vid_del(p->dev, p->br, vid);
> }
>
> clear_bit(vid, v->vlan_bitmap);
> --
> 1.7.10.4
>
--
To unsubscribe fr

  1   2   >