Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH v2 0/3] adding new glue driver dwmac-dwc-qos-eth
From: Joao Pinto @ 2017-01-04 13:46 UTC (permalink / raw)
  To: Niklas Cassel, Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <34837f5b-afb8-92df-f12e-2fa5514558be@axis.com>

Às 1:43 PM de 1/4/2017, Niklas Cassel escreveu:
> Let's see if patchwork is smart enough to add the tag to the whole series.
> 
> Tested-by: Niklas Cassel <niklas.cassel@axis.com>

I got this compile error due to dwmac-socfpga twist:

config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function
'socfpga_dwmac_probe':
>> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:344:28: error: 'struct
stmmac_priv' has no member named 'stmmac_rst'
     dwmac->stmmac_rst = stpriv->stmmac_rst;

I am going to fix socfpga and submit v3 :). Hopefully everything' got ok!

Thanks

> 
> On 01/04/2017 12:48 PM, Joao Pinto wrote:
>> This patch set contains the porting of the synopsys/dwc_eth_qos.c driver
>> to the stmmac structure. This operation resulted in the creation of a new
>> platform glue driver called dwmac-dwc-qos-eth which was based in the
>> dwc_eth_qos as is.
>>
>> dwmac-dwc-qos-eth inherited dwc_eth_qos DT bindings, to assure that current
>> and old users can continue to use it as before. We can see this driver as
>> being deprecated, since all new development will be done in stmmac.
>>
>> Please check each patch for implementation details.
>>
>> Joao Pinto (3):
>>   stmmac: adding DT parameter for LPI tx clock gating
>>   stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform
>>     structure
>>   stmmac: adding new glue driver dwmac-dwc-qos-eth
>>
>>  .../bindings/net/snps,dwc-qos-ethernet.txt         |   3 +
>>  Documentation/devicetree/bindings/net/stmmac.txt   |   2 +
>>  drivers/net/ethernet/stmicro/stmmac/Kconfig        |   9 +
>>  drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
>>  drivers/net/ethernet/stmicro/stmmac/common.h       |   3 +-
>>  .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c    | 200 +++++++++++++++++++++
>>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |   5 +-
>>  drivers/net/ethernet/stmicro/stmmac/dwmac4.h       |   1 +
>>  drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  |   6 +-
>>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |   5 -
>>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |   4 +-
>>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  85 ++-------
>>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  65 ++++++-
>>  include/linux/stmmac.h                             |   6 +
>>  14 files changed, 314 insertions(+), 81 deletions(-)
>>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>>
> 

^ permalink raw reply

* [RESEND net-next PATCH v5] net: dummy: Introduce dummy virtual functions
From: Phil Sutter @ 2017-01-04 13:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Sabrina Dubroca

The idea for this was born when testing VF support in iproute2 which was
impeded by hardware requirements. In fact, not every VF-capable hardware
driver implements all netdev ops, so testing the interface is still hard
to do even with a well-sorted hardware shelf.

To overcome this and allow for testing the user-kernel interface, this
patch allows to turn dummy into a PF with a configurable amount of VFs.

Due to the assumption that all PFs are PCI devices, this implementation
is not completely straightforward: In order to allow for
rtnl_fill_ifinfo() to see the dummy VFs, a fake PCI parent device is
attached to the dummy netdev. This has to happen at the right spot so
register_netdevice() does not get confused. This patch abuses
ndo_fix_features callback for that. In ndo_uninit callback, the fake
parent is removed again for the same purpose.

Joint work with Sabrina Dubroca.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v4:
- Initialize pci_pdev.sriov at runtime - older gcc versions don't allow
  initializing fields of anonymous unions at declaration time.
- Rebased onto current net-next/master.
  
Changes since v3:
- Changed type of vf_mac field from unsigned char to u8.
- Column-aligned structs' field names.

Changes since v2:
- Fixed oops on reboot (need to initialize parent device mutex).
- Got rid of potential mem leak noticed by Eric Dumazet.
- Dropped stray newline insertion.

Changes since v1:
- Fixed issues reported by kbuild test robot:
  - pci_dev->sriov is only present if CONFIG_PCI_ATS is active.
  - pci_bus_type does not exist if CONFIG_PCI is not defined.
---
 drivers/net/dummy.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 203 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 6421835f11b7e..7f8d8598bbbfe 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -34,6 +34,8 @@
 #include <linux/etherdevice.h>
 #include <linux/init.h>
 #include <linux/moduleparam.h>
+#include <linux/pci.h>
+#include "../pci/pci.h"		/* for struct pci_sriov */
 #include <linux/rtnetlink.h>
 #include <net/rtnetlink.h>
 #include <linux/u64_stats_sync.h>
@@ -42,6 +44,34 @@
 #define DRV_VERSION	"1.0"
 
 static int numdummies = 1;
+static int num_vfs;
+
+static struct pci_sriov pdev_sriov;
+
+static struct pci_dev pci_pdev = {
+	.is_physfn = 0,
+#ifdef CONFIG_PCI
+	.dev.bus = &pci_bus_type,
+#endif
+};
+
+struct vf_data_storage {
+	u8	vf_mac[ETH_ALEN];
+	u16	pf_vlan; /* When set, guest VLAN config not allowed. */
+	u16	pf_qos;
+	__be16	vlan_proto;
+	u16	min_tx_rate;
+	u16	max_tx_rate;
+	u8	spoofchk_enabled;
+	bool	rss_query_enabled;
+	u8	trusted;
+	int	link_state;
+};
+
+struct dummy_priv {
+	int			num_vfs;
+	struct vf_data_storage	*vfinfo;
+};
 
 /* fake multicast ability */
 static void set_multicast_list(struct net_device *dev)
@@ -91,15 +121,31 @@ static netdev_tx_t dummy_xmit(struct sk_buff *skb, struct net_device *dev)
 
 static int dummy_dev_init(struct net_device *dev)
 {
+	struct dummy_priv *priv = netdev_priv(dev);
+
 	dev->dstats = netdev_alloc_pcpu_stats(struct pcpu_dstats);
 	if (!dev->dstats)
 		return -ENOMEM;
 
+	priv->num_vfs = num_vfs;
+	priv->vfinfo = NULL;
+
+	if (!num_vfs)
+		return 0;
+
+	priv->vfinfo = kcalloc(num_vfs, sizeof(struct vf_data_storage),
+			       GFP_KERNEL);
+	if (!priv->vfinfo) {
+		free_percpu(dev->dstats);
+		return -ENOMEM;
+	}
+
 	return 0;
 }
 
 static void dummy_dev_uninit(struct net_device *dev)
 {
+	dev->dev.parent = NULL;
 	free_percpu(dev->dstats);
 }
 
@@ -112,6 +158,137 @@ static int dummy_change_carrier(struct net_device *dev, bool new_carrier)
 	return 0;
 }
 
+/* fake, just to set fake PCI parent after netdev_register_kobject() */
+static netdev_features_t dummy_fix_features(struct net_device *dev,
+					    netdev_features_t features)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (priv->num_vfs) {
+#ifdef CONFIG_PCI_ATS
+		pci_pdev.sriov = &pdev_sriov;
+#endif
+		dev->dev.parent = &pci_pdev.dev;
+		if (!pci_pdev.is_physfn) {
+			mutex_init(&pci_pdev.dev.mutex);
+			pci_pdev.is_physfn = 1;
+		}
+	}
+
+	return features;
+}
+
+static int dummy_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (!is_valid_ether_addr(mac) || (vf >= priv->num_vfs))
+		return -EINVAL;
+
+	memcpy(priv->vfinfo[vf].vf_mac, mac, ETH_ALEN);
+
+	return 0;
+}
+
+static int dummy_set_vf_vlan(struct net_device *dev, int vf,
+			     u16 vlan, u8 qos, __be16 vlan_proto)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if ((vf >= priv->num_vfs) || (vlan > 4095) || (qos > 7))
+		return -EINVAL;
+
+	priv->vfinfo[vf].pf_vlan = vlan;
+	priv->vfinfo[vf].pf_qos = qos;
+	priv->vfinfo[vf].vlan_proto = vlan_proto;
+
+	return 0;
+}
+
+static int dummy_set_vf_rate(struct net_device *dev, int vf, int min, int max)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	priv->vfinfo[vf].min_tx_rate = min;
+	priv->vfinfo[vf].max_tx_rate = max;
+
+	return 0;
+}
+
+static int dummy_set_vf_spoofchk(struct net_device *dev, int vf, bool val)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	priv->vfinfo[vf].spoofchk_enabled = val;
+
+	return 0;
+}
+
+static int dummy_set_vf_rss_query_en(struct net_device *dev, int vf, bool val)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	priv->vfinfo[vf].rss_query_enabled = val;
+
+	return 0;
+}
+
+static int dummy_set_vf_trust(struct net_device *dev, int vf, bool val)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	priv->vfinfo[vf].trusted = val;
+
+	return 0;
+}
+
+static int dummy_get_vf_config(struct net_device *dev,
+			       int vf, struct ifla_vf_info *ivi)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	ivi->vf = vf;
+	memcpy(&ivi->mac, priv->vfinfo[vf].vf_mac, ETH_ALEN);
+	ivi->vlan = priv->vfinfo[vf].pf_vlan;
+	ivi->qos = priv->vfinfo[vf].pf_qos;
+	ivi->spoofchk = priv->vfinfo[vf].spoofchk_enabled;
+	ivi->linkstate = priv->vfinfo[vf].link_state;
+	ivi->min_tx_rate = priv->vfinfo[vf].min_tx_rate;
+	ivi->max_tx_rate = priv->vfinfo[vf].max_tx_rate;
+	ivi->rss_query_en = priv->vfinfo[vf].rss_query_enabled;
+	ivi->trusted = priv->vfinfo[vf].trusted;
+	ivi->vlan_proto = priv->vfinfo[vf].vlan_proto;
+
+	return 0;
+}
+
+static int dummy_set_vf_link_state(struct net_device *dev, int vf, int state)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	if (vf >= priv->num_vfs)
+		return -EINVAL;
+
+	priv->vfinfo[vf].link_state = state;
+
+	return 0;
+}
+
 static const struct net_device_ops dummy_netdev_ops = {
 	.ndo_init		= dummy_dev_init,
 	.ndo_uninit		= dummy_dev_uninit,
@@ -121,6 +298,15 @@ static const struct net_device_ops dummy_netdev_ops = {
 	.ndo_set_mac_address	= eth_mac_addr,
 	.ndo_get_stats64	= dummy_get_stats64,
 	.ndo_change_carrier	= dummy_change_carrier,
+	.ndo_fix_features	= dummy_fix_features,
+	.ndo_set_vf_mac		= dummy_set_vf_mac,
+	.ndo_set_vf_vlan	= dummy_set_vf_vlan,
+	.ndo_set_vf_rate	= dummy_set_vf_rate,
+	.ndo_set_vf_spoofchk	= dummy_set_vf_spoofchk,
+	.ndo_set_vf_trust	= dummy_set_vf_trust,
+	.ndo_get_vf_config	= dummy_get_vf_config,
+	.ndo_set_vf_link_state	= dummy_set_vf_link_state,
+	.ndo_set_vf_rss_query_en = dummy_set_vf_rss_query_en,
 };
 
 static void dummy_get_drvinfo(struct net_device *dev,
@@ -134,6 +320,14 @@ static const struct ethtool_ops dummy_ethtool_ops = {
 	.get_drvinfo            = dummy_get_drvinfo,
 };
 
+static void dummy_free_netdev(struct net_device *dev)
+{
+	struct dummy_priv *priv = netdev_priv(dev);
+
+	kfree(priv->vfinfo);
+	free_netdev(dev);
+}
+
 static void dummy_setup(struct net_device *dev)
 {
 	ether_setup(dev);
@@ -141,7 +335,7 @@ static void dummy_setup(struct net_device *dev)
 	/* Initialize the device structure. */
 	dev->netdev_ops = &dummy_netdev_ops;
 	dev->ethtool_ops = &dummy_ethtool_ops;
-	dev->destructor = free_netdev;
+	dev->destructor = dummy_free_netdev;
 
 	/* Fill in device structure with ethernet-generic values. */
 	dev->flags |= IFF_NOARP;
@@ -172,6 +366,7 @@ static int dummy_validate(struct nlattr *tb[], struct nlattr *data[])
 
 static struct rtnl_link_ops dummy_link_ops __read_mostly = {
 	.kind		= DRV_NAME,
+	.priv_size	= sizeof(struct dummy_priv),
 	.setup		= dummy_setup,
 	.validate	= dummy_validate,
 };
@@ -180,12 +375,16 @@ static struct rtnl_link_ops dummy_link_ops __read_mostly = {
 module_param(numdummies, int, 0);
 MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices");
 
+module_param(num_vfs, int, 0);
+MODULE_PARM_DESC(num_vfs, "Number of dummy VFs per dummy device");
+
 static int __init dummy_init_one(void)
 {
 	struct net_device *dev_dummy;
 	int err;
 
-	dev_dummy = alloc_netdev(0, "dummy%d", NET_NAME_UNKNOWN, dummy_setup);
+	dev_dummy = alloc_netdev(sizeof(struct dummy_priv),
+				 "dummy%d", NET_NAME_UNKNOWN, dummy_setup);
 	if (!dev_dummy)
 		return -ENOMEM;
 
@@ -204,6 +403,8 @@ static int __init dummy_init_module(void)
 {
 	int i, err = 0;
 
+	pdev_sriov.num_VFs = num_vfs;
+
 	rtnl_lock();
 	err = __rtnl_link_register(&dummy_link_ops);
 	if (err < 0)
-- 
2.11.0

^ permalink raw reply related

* Re: [PATCH v2 0/3] adding new glue driver dwmac-dwc-qos-eth
From: Niklas Cassel @ 2017-01-04 13:43 UTC (permalink / raw)
  To: Joao Pinto, davem; +Cc: larper, swarren, treding, netdev
In-Reply-To: <cover.1483530191.git.jpinto@synopsys.com>

Let's see if patchwork is smart enough to add the tag to the whole series.

Tested-by: Niklas Cassel <niklas.cassel@axis.com>

On 01/04/2017 12:48 PM, Joao Pinto wrote:
> This patch set contains the porting of the synopsys/dwc_eth_qos.c driver
> to the stmmac structure. This operation resulted in the creation of a new
> platform glue driver called dwmac-dwc-qos-eth which was based in the
> dwc_eth_qos as is.
>
> dwmac-dwc-qos-eth inherited dwc_eth_qos DT bindings, to assure that current
> and old users can continue to use it as before. We can see this driver as
> being deprecated, since all new development will be done in stmmac.
>
> Please check each patch for implementation details.
>
> Joao Pinto (3):
>   stmmac: adding DT parameter for LPI tx clock gating
>   stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform
>     structure
>   stmmac: adding new glue driver dwmac-dwc-qos-eth
>
>  .../bindings/net/snps,dwc-qos-ethernet.txt         |   3 +
>  Documentation/devicetree/bindings/net/stmmac.txt   |   2 +
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        |   9 +
>  drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
>  drivers/net/ethernet/stmicro/stmmac/common.h       |   3 +-
>  .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c    | 200 +++++++++++++++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |   5 +-
>  drivers/net/ethernet/stmicro/stmmac/dwmac4.h       |   1 +
>  drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c  |   6 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac.h       |   5 -
>  .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |   4 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  85 ++-------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  65 ++++++-
>  include/linux/stmmac.h                             |   6 +
>  14 files changed, 314 insertions(+), 81 deletions(-)
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
>

^ permalink raw reply

* Re: [RFC 1/4] Documentation: devicetree: add multiple cpu port DSA binding
From: Andrew Lunn @ 2017-01-04 12:58 UTC (permalink / raw)
  To: John Crispin
  Cc: David S. Miller, Florian Fainelli, Vivien Didelot, netdev,
	Rob Herring, devicetree
In-Reply-To: <1483515484-21793-2-git-send-email-john@phrozen.org>

On Wed, Jan 04, 2017 at 08:38:01AM +0100, John Crispin wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> Extend the DSA binding documentation, adding the new properties required
> when there is more than one CPU port attached to the switch.

Hi John

Thanks for picking up my old patches.

> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  Documentation/devicetree/bindings/net/dsa/dsa.txt |   67 ++++++++++++++++++++-
>  1 file changed, 66 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.txt b/Documentation/devicetree/bindings/net/dsa/dsa.txt
> index a4a570f..fc901cf 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.txt
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.txt
> @@ -337,13 +337,25 @@ Optional property:
>  			  This mii-bus will be used in preference to the
>  			  global dsa,mii-bus defined above, for this switch.
>  
> +- ethernet		: Optional for "cpu" ports. A phandle to an ethernet
> +                          device which will be used by this CPU port for
> +			  passing packets to/from the host. If not present,
> +			  the port will use the "dsa,ethernet" property
> +			  defined above.

This appears to be for the old binding. The new binding has this
already.  I only want to support multiple CPU ports with the new
binding, since Florian is in the process of removing the old one.

> +
> +- cpu			: Option for non "cpu"/"dsa" ports. A phandle to a
> +			  "cpu" port, which will be used for passing packets
> +			  from this port to the host. If not present, the first
> +			  "cpu" port will be used.
> +
> +
>  Optional subnodes:
>  - fixed-link		: Fixed-link subnode describing a link to a non-MDIO
>  			  managed entity. See
>  			  Documentation/devicetree/bindings/net/fixed-link.txt
>  			  for details.
>  
> -Example:
> +Examples:
>  
>  	dsa@0 {
>  		compatible = "marvell,dsa";
> @@ -416,3 +428,56 @@ Example:
>  			};
>  		};
>  	};
> +
> +	dsa@1 {
> +		compatible = "marvell,dsa";
> +		#address-cells = <2>;
> +		#size-cells = <0>;
> +
> +		dsa,ethernet = <&eth0port>;
> +		dsa,mii-bus = <&mdio>;
> +
> +		switch@0 {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			reg = <0 0>;	/* MDIO address 0, switch 0 in tree */
> +
> +			port@0 {
> +				reg = <0>;
> +				label = "lan4";
> +			};
> +
> +			port@1 {
> +				reg = <1>;
> +				label = "lan3";
> +				cpu = <&cpu1>;
> +			};

Again, this is the old binding. The example should use the new
binding.

Thanks
	Andrew

^ permalink raw reply

* Re: [PATCHv2 net-next 1/3] sctp: add stream arrays in asoc
From: Marcelo Ricardo Leitner @ 2017-01-04 13:39 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, Neil Horman, Vlad Yasevich, davem
In-Reply-To: <684ad8ddd79f23844883dede4c34360ce744dfc3.1483422833.git.lucien.xin@gmail.com>

On Tue, Jan 03, 2017 at 01:59:46PM +0800, Xin Long wrote:
> This patch is to add streamout and streamin arrays in asoc, initialize
> them in sctp_process_init and free them in sctp_association_free.
> 
> Stream arrays are used to replace ssnmap to save more stream things in
> the next patch.
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  include/net/sctp/structs.h | 18 ++++++++++++++++++
>  net/sctp/associola.c       | 19 +++++++++++++++++++
>  net/sctp/sm_make_chunk.c   | 17 ++++++++++++++++-
>  3 files changed, 53 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 87d56cc..549f17d 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -1331,6 +1331,18 @@ struct sctp_inithdr_host {
>  	__u32 initial_tsn;
>  };
>  
> +struct sctp_stream_out {
> +	__u16	ssn;
> +	__u8	state;
> +};
> +
> +struct sctp_stream_in {
> +	__u16	ssn;
> +};
> +
> +#define SCTP_STREAM_CLOSED		0x00
> +#define SCTP_STREAM_OPEN		0x01
> +
>  /* SCTP_GET_ASSOC_STATS counters */
>  struct sctp_priv_assoc_stats {
>  	/* Maximum observed rto in the association during subsequent
> @@ -1879,6 +1891,12 @@ struct sctp_association {
>  	     temp:1,		/* Is it a temporary association? */
>  	     prsctp_enable:1;
>  
> +	/* stream arrays */
> +	struct sctp_stream_out *streamout;
> +	struct sctp_stream_in *streamin;
> +	__u16 streamoutcnt;
> +	__u16 streamincnt;
> +
>  	struct sctp_priv_assoc_stats stats;
>  
>  	int sent_cnt_removable;
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index d3cc30c..290ec4d 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -361,6 +361,10 @@ void sctp_association_free(struct sctp_association *asoc)
>  	/* Free ssnmap storage. */
>  	sctp_ssnmap_free(asoc->ssnmap);
>  
> +	/* Free stream information. */
> +	kfree(asoc->streamout);
> +	kfree(asoc->streamin);
> +
>  	/* Clean up the bound address list. */
>  	sctp_bind_addr_free(&asoc->base.bind_addr);
>  
> @@ -1130,6 +1134,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
>  	 * has been discarded and needs retransmission.
>  	 */
>  	if (asoc->state >= SCTP_STATE_ESTABLISHED) {
> +		int i;
> +
>  		asoc->next_tsn = new->next_tsn;
>  		asoc->ctsn_ack_point = new->ctsn_ack_point;
>  		asoc->adv_peer_ack_point = new->adv_peer_ack_point;
> @@ -1139,6 +1145,12 @@ void sctp_assoc_update(struct sctp_association *asoc,
>  		 */
>  		sctp_ssnmap_clear(asoc->ssnmap);
>  
> +		for (i = 0; i < asoc->streamoutcnt; i++)
> +			asoc->streamout[i].ssn = 0;
> +
> +		for (i = 0; i < asoc->streamincnt; i++)
> +			asoc->streamin[i].ssn = 0;
> +
>  		/* Flush the ULP reassembly and ordered queue.
>  		 * Any data there will now be stale and will
>  		 * cause problems.
> @@ -1168,6 +1180,13 @@ void sctp_assoc_update(struct sctp_association *asoc,
>  			new->ssnmap = NULL;
>  		}
>  
> +		if (!asoc->streamin && !asoc->streamout) {
> +			asoc->streamout = new->streamout;
> +			asoc->streamin = new->streamin;
> +			new->streamout = NULL;
> +			new->streamin = NULL;
> +		}
> +
>  		if (!asoc->assoc_id) {
>  			/* get a new association id since we don't have one
>  			 * yet.
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 9e9690b..eeadeef 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -2442,13 +2442,28 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
>  	 * association.
>  	 */
>  	if (!asoc->temp) {
> -		int error;
> +		int error, i;
> +
> +		asoc->streamoutcnt = asoc->c.sinit_num_ostreams;
> +		asoc->streamincnt = asoc->c.sinit_max_instreams;
>  
>  		asoc->ssnmap = sctp_ssnmap_new(asoc->c.sinit_max_instreams,
>  					       asoc->c.sinit_num_ostreams, gfp);
>  		if (!asoc->ssnmap)
>  			goto clean_up;
>  
> +		asoc->streamout = kcalloc(asoc->streamoutcnt,
> +					  sizeof(*asoc->streamout), gfp);
> +		if (!asoc->streamout)
> +			goto clean_up;
> +		for (i = 0; i < asoc->streamoutcnt; i++)
> +			asoc->streamout[i].state = SCTP_STREAM_OPEN;
> +
> +		asoc->streamin = kcalloc(asoc->streamincnt,
> +					 sizeof(*asoc->streamin), gfp);
> +		if (!asoc->streamin)
> +			goto clean_up;
> +

Xin, I understand the need to remove the 'ssnmap' term from the charts
here as it will be, but lets try to put all the inner details of stream
handling in a dedicated file.

On the original patchset you were creating stream.c for RFC 6525 stuff.
We probably can create it earlier and concentrate everything
stream-related in there, so we keep it more contained. Thanks


>  		error = sctp_assoc_set_id(asoc, gfp);
>  		if (error)
>  			goto clean_up;
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [Intel-wired-lan] [PATCH 1/2] PCI: introduce locked pci_add/remove_virtfn
From: kbuild test robot @ 2017-01-04 13:37 UTC (permalink / raw)
  To: Emil Tantilov
  Cc: kbuild-all, linux-pci, intel-wired-lan, netdev, linux-kernel
In-Reply-To: <20170104004826.17866.77074.stgit@localhost6.localdomain6>

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

Hi Emil,

[auto build test ERROR on pci/next]
[also build test ERROR on v4.10-rc2 next-20170104]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emil-Tantilov/PCI-introduce-locked-pci_add-remove_virtfn/20170104-193518
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/eeh_driver.c: In function 'eeh_add_virt_device':
>> arch/powerpc/kernel/eeh_driver.c:444:2: error: implicit declaration of function 'pci_iov_add_virtfn_locked' [-Werror=implicit-function-declaration]
     pci_iov_add_virtfn_locked(edev->physfn, pdn->vf_index, 0);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/kernel/eeh_driver.c: In function 'eeh_rmv_device':
>> arch/powerpc/kernel/eeh_driver.c:502:3: error: implicit declaration of function 'pci_iov_remove_virtfn_locked' [-Werror=implicit-function-declaration]
      pci_iov_remove_virtfn_locked(edev->physfn, pdn->vf_index, 0);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/pci_iov_add_virtfn_locked +444 arch/powerpc/kernel/eeh_driver.c

   438			eeh_pcid_put(dev);
   439			if (driver->err_handler)
   440				return NULL;
   441		}
   442	
   443	#ifdef CONFIG_PPC_POWERNV
 > 444		pci_iov_add_virtfn_locked(edev->physfn, pdn->vf_index, 0);
   445	#endif
   446		return NULL;
   447	}
   448	
   449	static void *eeh_rmv_device(void *data, void *userdata)
   450	{
   451		struct pci_driver *driver;
   452		struct eeh_dev *edev = (struct eeh_dev *)data;
   453		struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
   454		struct eeh_rmv_data *rmv_data = (struct eeh_rmv_data *)userdata;
   455		int *removed = rmv_data ? &rmv_data->removed : NULL;
   456	
   457		/*
   458		 * Actually, we should remove the PCI bridges as well.
   459		 * However, that's lots of complexity to do that,
   460		 * particularly some of devices under the bridge might
   461		 * support EEH. So we just care about PCI devices for
   462		 * simplicity here.
   463		 */
   464		if (!dev || (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE))
   465			return NULL;
   466	
   467		/*
   468		 * We rely on count-based pcibios_release_device() to
   469		 * detach permanently offlined PEs. Unfortunately, that's
   470		 * not reliable enough. We might have the permanently
   471		 * offlined PEs attached, but we needn't take care of
   472		 * them and their child devices.
   473		 */
   474		if (eeh_dev_removed(edev))
   475			return NULL;
   476	
   477		driver = eeh_pcid_get(dev);
   478		if (driver) {
   479			eeh_pcid_put(dev);
   480			if (removed &&
   481			    eeh_pe_passed(edev->pe))
   482				return NULL;
   483			if (removed &&
   484			    driver->err_handler &&
   485			    driver->err_handler->error_detected &&
   486			    driver->err_handler->slot_reset)
   487				return NULL;
   488		}
   489	
   490		/* Remove it from PCI subsystem */
   491		pr_debug("EEH: Removing %s without EEH sensitive driver\n",
   492			 pci_name(dev));
   493		edev->bus = dev->bus;
   494		edev->mode |= EEH_DEV_DISCONNECTED;
   495		if (removed)
   496			(*removed)++;
   497	
   498		if (edev->physfn) {
   499	#ifdef CONFIG_PPC_POWERNV
   500			struct pci_dn *pdn = eeh_dev_to_pdn(edev);
   501	
 > 502			pci_iov_remove_virtfn_locked(edev->physfn, pdn->vf_index, 0);
   503			edev->pdev = NULL;
   504	
   505			/*

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22266 bytes --]

^ permalink raw reply

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

From: Arjun V <arjun@chelsio.com>

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

Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
Signed-off-by: Arjun V <arjun@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
---
v2: Fixed kbuild errors
---

 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h   |  5 +++++
 drivers/net/ethernet/chelsio/cxgb4/sge.c     | 16 ++++++++++++++--
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c   |  7 +++++++
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h  | 15 +++++++++++++++
 drivers/net/ethernet/chelsio/cxgb4/t4_regs.h |  4 ++++
 5 files changed, 45 insertions(+), 2 deletions(-)

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

^ permalink raw reply related

* Re: [RFC 2/4] net-next: dsa: Refactor DT probing of a switch port
From: Andrew Lunn @ 2017-01-04 13:30 UTC (permalink / raw)
  To: John Crispin; +Cc: David S. Miller, Florian Fainelli, Vivien Didelot, netdev
In-Reply-To: <1483515484-21793-3-git-send-email-john@phrozen.org>

On Wed, Jan 04, 2017 at 08:38:02AM +0100, John Crispin wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> Move the DT probing of a switch port into a function of its own, since
> it is about to get more complex. Add better error handling as well.

Hi John

I would prefer to drop the majority of this. Just keep enough that it
does not break, but don't implement multiple CPU ports.

     Andrew

^ permalink raw reply

* Re: [PATCH RFC ipsec-next 4/5] net: Prepare for IPsec GRO
From: Steffen Klassert @ 2017-01-04 13:26 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Sowmini Varadhan, Ilan Tayari
In-Reply-To: <1483533255.4337.16.camel@edumazet-glaptop3.roam.corp.google.com>

On Wed, Jan 04, 2017 at 04:34:15AM -0800, Eric Dumazet wrote:
> On Wed, 2017-01-04 at 09:23 +0100, Steffen Klassert wrote:
> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index b53c0cf..a78cd90 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -749,7 +749,10 @@ struct sk_buff {
> >  #ifdef CONFIG_NET_SWITCHDEV
> >  	__u8			offload_fwd_mark:1;
> >  #endif
> > -	/* 2, 4 or 5 bit hole */
> > +#ifdef CONFIG_XFRM_OFFLOAD
> > +	__u8			xfrm_gro:1;
> 
> 
> 
> Arg, yet another skb bit.

I'm not particularly proud of this, but
I've seen no other options to keep this
information across the layers. This is
probably the reason for all these skb bits.

> 
> > +#endif
> > +	/* 1 to 5 bits hole */
> >  
> >  #ifdef CONFIG_NET_SCHED
> >  	__u16			tc_index;	/* traffic control index */
> > @@ -3698,6 +3701,15 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
> >  #endif
> >  }
> >  
> 
> >  
> > @@ -4843,7 +4853,12 @@ static int process_backlog(struct napi_struct *napi, int quota)
> >  
> >  		while ((skb = __skb_dequeue(&sd->process_queue))) {
> >  			rcu_read_lock();
> > -			__netif_receive_skb(skb);
> > +
> > +			if (skb_xfrm_gro(skb))
> > +				napi_gro_receive(napi, skb);
> > +			else
> > +				__netif_receive_skb(skb);
> > +
> 
> 
> But napi here is device independent. It is a fake NAPI, per cpu.
> 
> I am not sure of the various implications of using it at this point,
> this looks quite dangerous/invasive to me, compared to the gro_cells
> infra which was designed to have no impact on core code paths.
> 
> To me, the caller should call napi_gro_receive() skb, instead of letting
> core networking stack add this extra skb bit and extra conditional.

I had a quick look at the gro_cells, it looks like I could avoid
at least the extra codition with this.

I'll see if I get it to work with gro_cells, thanks for pointing
to it!

^ permalink raw reply

* Re: [RFC 3/4] net-next: dsa: Add support for multiple cpu ports.
From: Andrew Lunn @ 2017-01-04 13:22 UTC (permalink / raw)
  To: John Crispin; +Cc: David S. Miller, Florian Fainelli, Vivien Didelot, netdev
In-Reply-To: <1483515484-21793-4-git-send-email-john@phrozen.org>

On Wed, Jan 04, 2017 at 08:38:03AM +0100, John Crispin wrote:
>  static int dsa_user_port_apply(struct device_node *port, u32 index,
> @@ -475,6 +475,28 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
>  
>  	dst->rcv = dst->tag_ops->rcv;
>  
> +	dev_hold(ethernet_dev);
> +	ds->cd->port_ethernet[index] = ethernet_dev;
> +
> +	return 0;
> +}
> +
> +static int dsa_user_parse(struct device_node *port, u32 index,
> +			  struct dsa_switch *ds)
> +{

Please put this function next to dsa_cpu_parse(). All the
apply/unapply functions are together, and all the _parse functions
should be together.

> +	struct device_node *cpu_port;
> +	const unsigned int *cpu_port_reg;
> +	int cpu_port_index;
> +
> +	cpu_port = of_parse_phandle(port, "cpu", 0);
> +	if (cpu_port) {
> +		cpu_port_reg = of_get_property(cpu_port, "reg", NULL);
> +		if (!cpu_port_reg)
> +			return -EINVAL;
> +		cpu_port_index = be32_to_cpup(cpu_port_reg);
> +		ds->cd->port_cpu[index] = cpu_port_index;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -482,18 +504,20 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
>  {
>  	struct device_node *port;
>  	u32 index;
> -	int err;
> +	int err = 0;
>  
>  	for (index = 0; index < DSA_MAX_PORTS; index++) {
>  		port = ds->ports[index].dn;
>  		if (!port)
>  			continue;
>  
> -		if (dsa_port_is_cpu(port)) {
> +		if (dsa_port_is_cpu(port))
>  			err = dsa_cpu_parse(port, index, dst, ds);
> -			if (err)
> -				return err;
> -		}
> +		else if (!dsa_port_is_dsa(port))
> +			err = dsa_user_parse(port, index,  ds);
> +
> +		if (err)
> +			return err;

Having this if (err) here is correct, but it goes against the general
pattern we have in the code. Please indent it so it is under the
err =, and remove the initialisation of err.

Also, if one branch of an if/else has {}, the coding style says the
other branch should also use {}.

Just to make this code look nicer, i would be tempted to add a helper,
dsa_port_is_user().

>  	}
>  
>  	pr_info("DSA: switch %d %d parsed\n", dst->tree, ds->index);

Thanks
	Andrew

^ permalink raw reply

* Re: [PATCH v3] net: ethernet: faraday: To support device tree usage.
From: Arnd Bergmann @ 2017-01-04 13:23 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Florian Fainelli, netdev, devicetree, Andrew Lunn, linux-kernel,
	Jiri Pirko, jonas.jensen, davem
In-Reply-To: <CAEbi=3f7pf59YjNha-bpK+GZw4BSdevngi=fekd9uNLMVXDVnQ@mail.gmail.com>

On Wednesday, January 4, 2017 9:49:51 AM CET Greentime Hu wrote:
> On Tue, Jan 3, 2017 at 9:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> > On Tuesday, January 3, 2017 2:05:47 PM CET Greentime Hu wrote:
> > > ​I am not sure if atmac and moxa-art are exactly hardware compatible
> > though
> > > they are based on faraday ftmac.
> > > It may be better if we use 2 different device tree binding documents to
> > > describe for these 2 different drivers to use.
> >
> > They are probably slightly different, but close enough to have the same
> > binding document, as there is no technical reason to have two separate
> > drivers for them. The binding should be about the hardware type, not the
> > way that Linux currently implements the drivers.
> >
> >         Arnd
> >
> >
> OK.
> 
> How about this?
> 
> rename
> Documentation/devicetree/bindings/net/moxa,moxart-mac.txt
> to
> Documentation/devicetree/bindings/net/faraday,ftmac.txt
> 
> and the content to
> Faraday Ethernet Controller

Sounds good. Note that you can use 'git patch -M' to produce
this as a renaming patch.

> 
> Required properties:
> 
> - compatible : Must be "moxa,moxart-mac" or "andestech,atmac" or
> "faraday,ftmac"

I'd write this as

	compatible: Must contain "faraday,ftmac", as well as one of
	            the SoC specific identifiers:
			"andestec,atmac"
			"moxa,moxart-mac"

This makes it easier to extend, plus it makes the generic string
mandatory.

	Arnd

^ permalink raw reply

* Re: [PATCH 2/3] stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure
From: kbuild test robot @ 2017-01-04 13:01 UTC (permalink / raw)
  To: Joao Pinto
  Cc: kbuild-all, davem, lars.persson, niklass, swarren, treding,
	netdev, Joao Pinto
In-Reply-To: <54ae15f7be4b1b476f10556742d2534b071f89b1.1483372523.git.jpinto@synopsys.com>

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

Hi Joao,

[auto build test ERROR on net-next/master]
[also build test ERROR on next-20170104]
[cannot apply to v4.10-rc2]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Joao-Pinto/adding-new-glue-driver-dwmac-dwc-qos-eth/20170104-200013
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c: In function 'socfpga_dwmac_probe':
>> drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:344:28: error: 'struct stmmac_priv' has no member named 'stmmac_rst'
     dwmac->stmmac_rst = stpriv->stmmac_rst;
                               ^~

vim +344 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c

50ac64cf Johan Hovold     2016-11-30  338  	stpriv = netdev_priv(ndev);
70cb136f Joachim Eastwood 2016-05-01  339  
50ac64cf Johan Hovold     2016-11-30  340  	/* The socfpga driver needs to control the stmmac reset to set the phy
50ac64cf Johan Hovold     2016-11-30  341  	 * mode. Create a copy of the core reset handle so it can be used by
50ac64cf Johan Hovold     2016-11-30  342  	 * the driver later.
70cb136f Joachim Eastwood 2016-05-01  343  	 */
70cb136f Joachim Eastwood 2016-05-01 @344  	dwmac->stmmac_rst = stpriv->stmmac_rst;
70cb136f Joachim Eastwood 2016-05-01  345  
0f400a87 Joachim Eastwood 2016-05-01  346  	ret = socfpga_dwmac_set_phy_mode(dwmac);
50ac64cf Johan Hovold     2016-11-30  347  	if (ret)

:::::: The code at line 344 was first introduced by commit
:::::: 70cb136f7730830aa1134925a941e3ad96e3a846 stmmac: dwmac-socfpga: keep a copy of stmmac_rst in driver priv data

:::::: TO: Joachim Eastwood <manabian@gmail.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 54048 bytes --]

^ permalink raw reply

* Re: [PATCH net-next 5/6] net/bpf_jit: SPARC: split VLAN_PRESENT bit handling from VLAN_TCI
From: kbuild test robot @ 2017-01-04 12:59 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: kbuild-all, netdev, David S. Miller, sparclinux
In-Reply-To: <b4e1dcbeed867f958e90551263865d4eb046ae25.1483492355.git.mirq-linux@rere.qmqm.pl>

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

Hi Michał,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/Prepare-BPF-for-VLAN_TAG_PRESENT-cleanup/20170104-190258
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/compiler.h:58:0,
                    from include/uapi/linux/stddef.h:1,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/sparc/net/bpf_jit_comp.c:1:
   arch/sparc/net/bpf_jit_comp.c: In function 'bpf_jit_compile':
>> include/linux/compiler-gcc.h:159:2: error: 'struct sk_buff' has no member named '__pkt_vlan_present_offset'; did you mean '__pkt_type_offset'?
     __builtin_offsetof(a, b)
     ^
   include/linux/stddef.h:16:32: note: in expansion of macro '__compiler_offsetof'
    #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                   ^~~~~~~~~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:228:26: note: in expansion of macro 'offsetof'
    do { unsigned int _off = offsetof(STRUCT, FIELD);   \
                             ^~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:270:2: note: in expansion of macro '__emit_load8'
     __emit_load8(r_SKB, struct sk_buff, FIELD, DEST)
     ^~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:611:5: note: in expansion of macro '__emit_skb_load8'
        __emit_skb_load8(__pkt_vlan_present_offset, r_A);
        ^~~~~~~~~~~~~~~~

vim +159 include/linux/compiler-gcc.h

cb984d10 Joe Perches    2015-06-25  153  #  error Your version of gcc miscompiles the __weak directive
cb984d10 Joe Perches    2015-06-25  154  # endif
cb984d10 Joe Perches    2015-06-25  155  #endif
cb984d10 Joe Perches    2015-06-25  156  
cb984d10 Joe Perches    2015-06-25  157  #define __used			__attribute__((__used__))
cb984d10 Joe Perches    2015-06-25  158  #define __compiler_offsetof(a, b)					\
cb984d10 Joe Perches    2015-06-25 @159  	__builtin_offsetof(a, b)
cb984d10 Joe Perches    2015-06-25  160  
0d025d27 Josh Poimboeuf 2016-08-30  161  #if GCC_VERSION >= 40100
cb984d10 Joe Perches    2015-06-25  162  # define __compiletime_object_size(obj) __builtin_object_size(obj, 0)

:::::: The code at line 159 was first introduced by commit
:::::: cb984d101b30eb7478d32df56a0023e4603cba7f compiler-gcc: integrate the various compiler-gcc[345].h files

:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48625 bytes --]

^ permalink raw reply

* Re: [PATCH] tcp: provide tx timestamps for partial writes
From: Eric Dumazet @ 2017-01-04 12:55 UTC (permalink / raw)
  To: Soheil Hassas Yeganeh
  Cc: David Miller, netdev, Willem de Bruijn, Yuchung Cheng,
	Eric Dumazet, Neal Cardwell, Martin KaFai Lau
In-Reply-To: <CACSApvYN48nRSdV5OQmrS+6BqJBMRocZ1LypziOj9jk4aTc7Pg@mail.gmail.com>

On Tue, 2017-01-03 at 10:22 -0500, Soheil Hassas Yeganeh wrote:
> On Mon, Jan 2, 2017 at 3:23 PM, Soheil Hassas Yeganeh <soheil@google.com> wrote:
> > On Mon, Jan 2, 2017 at 3:20 PM, Soheil Hassas Yeganeh
> > <soheil.kdev@gmail.com> wrote:
> >> From: Soheil Hassas Yeganeh <soheil@google.com>
> >>
> >> For TCP sockets, tx timestamps are only captured when the user data
> >> is successfully and fully written to the socket. In many cases,
> >> however, TCP writes can be partial for which no timestamp is
> >> collected.
> >>
> >> Collect timestamps when the user data is partially copied into
> >> the socket.
> >>
> >> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> >> Cc: Willem de Bruijn <willemb@google.com>
> >> Cc: Yuchung Cheng <ycheng@google.com>
> >> Cc: Eric Dumazet <edumazet@google.com>
> >> Cc: Neal Cardwell <ncardwell@google.com>
> >> Cc: Martin KaFai Lau <kafai@fb.com>
> >> ---
> >>  net/ipv4/tcp.c | 8 ++++++--
> >>  1 file changed, 6 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> >> index 2e3807d..c207b16 100644
> >> --- a/net/ipv4/tcp.c
> >> +++ b/net/ipv4/tcp.c
> >> @@ -992,8 +992,10 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
> >>         return copied;
> >>
> >>  do_error:
> >> -       if (copied)
> >> +       if (copied) {
> >> +               tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
> >>                 goto out;
> >> +       }
> >>  out_err:
> >>         /* make sure we wake any epoll edge trigger waiter */
> >>         if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 &&
> >> @@ -1329,8 +1331,10 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> >>         }
> >>
> >>  do_error:
> >> -       if (copied + copied_syn)
> >> +       if (copied + copied_syn) {
> >> +               tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
> 
> Thanks to Willem for noting that this should be sockc.tsflags and not
> sk->sk_tsflags. I'll send V2 to fix.

Also, why not factorizing a bit and have a single point calling
tcp_tx_timestamp() ?

This would ease code review quite a bit.

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4a044964da6670829e5c47fef52d2cd76360b59f..11357f3bd1f82fa29129dd3ecf4d270feb4a6b1d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -958,10 +958,8 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
 		copied += copy;
 		offset += copy;
 		size -= copy;
-		if (!size) {
-			tcp_tx_timestamp(sk, sk->sk_tsflags, skb);
+		if (!size)
 			goto out;
-		}
 
 		if (skb->len < size_goal || (flags & MSG_OOB))
 			continue;
@@ -987,8 +985,11 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
 	}
 
 out:
-	if (copied && !(flags & MSG_SENDPAGE_NOTLAST))
-		tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+	if (copied) {
+		tcp_tx_timestamp(sk, sk->sk_tsflags, tcp_write_queue_tail(sk));
+		if (!(flags & MSG_SENDPAGE_NOTLAST))
+			tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+	}
 	return copied;
 
 do_error:
@@ -1281,7 +1282,6 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 
 		copied += copy;
 		if (!msg_data_left(msg)) {
-			tcp_tx_timestamp(sk, sockc.tsflags, skb);
 			if (unlikely(flags & MSG_EOR))
 				TCP_SKB_CB(skb)->eor = 1;
 			goto out;
@@ -1312,8 +1312,10 @@ int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 	}
 
 out:
-	if (copied)
+	if (copied) {
+		tcp_tx_timestamp(sk, sockc.tsflags, tcp_write_queue_tail(sk));
 		tcp_push(sk, flags, mss_now, tp->nonagle, size_goal);
+	}
 out_nopush:
 	release_sock(sk);
 	return copied + copied_syn;

^ permalink raw reply related

* Re: [PATCH net-next] net/hyperv: remove use of VLAN_TAG_PRESENT
From: Vitaly Kuznetsov @ 2017-01-04 12:48 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: netdev, Haiyang Zhang, devel
In-Reply-To: <85c211f16e696607c9f61f96b8234684a2a2385b.1483487888.git.mirq-linux@rere.qmqm.pl>

Michał Mirosław <mirq-linux@rere.qmqm.pl> writes:

> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

Can we have a non-empty description please?

> ---
>  drivers/net/hyperv/hyperv_net.h   |  2 +-
>  drivers/net/hyperv/netvsc_drv.c   | 13 ++++++-------
>  drivers/net/hyperv/rndis_filter.c |  4 ++--
>  3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 3958adade7eb..b53729e85a79 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -186,7 +186,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>  			void **data,
>  			struct ndis_tcp_ip_checksum_info *csum_info,
>  			struct vmbus_channel *channel,
> -			u16 vlan_tci);
> +			u16 vlan_tci, bool vlan_present);
>  void netvsc_channel_cb(void *context);
>  int rndis_filter_open(struct netvsc_device *nvdev);
>  int rndis_filter_close(struct netvsc_device *nvdev);
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index c9414c054852..6597d7901929 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -595,7 +595,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
>  static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
>  				struct hv_netvsc_packet *packet,
>  				struct ndis_tcp_ip_checksum_info *csum_info,
> -				void *data, u16 vlan_tci)
> +				void *data)
>  {
>  	struct sk_buff *skb;
>
> @@ -625,10 +625,6 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
>  			skb->ip_summed = CHECKSUM_UNNECESSARY;
>  	}
>
> -	if (vlan_tci & VLAN_TAG_PRESENT)
> -		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
> -				       vlan_tci);
> -
>  	return skb;
>  }
>
> @@ -641,7 +637,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>  				void **data,
>  				struct ndis_tcp_ip_checksum_info *csum_info,
>  				struct vmbus_channel *channel,
> -				u16 vlan_tci)
> +				u16 vlan_tci, bool vlan_present)
>  {
>  	struct net_device *net = hv_get_drvdata(device_obj);
>  	struct net_device_context *net_device_ctx = netdev_priv(net);
> @@ -664,12 +660,15 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>  		net = vf_netdev;
>
>  	/* Allocate a skb - TODO direct I/O to pages? */
> -	skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data, vlan_tci);
> +	skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data);
>  	if (unlikely(!skb)) {
>  		++net->stats.rx_dropped;
>  		return NVSP_STAT_FAIL;
>  	}
>
> +	if (vlan_present)
> +		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
> +
>  	if (net != vf_netdev)
>  		skb_record_rx_queue(skb,
>  				    channel->offermsg.offer.sub_channel_index);
> diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
> index 8d90904e0e49..7f7b410a41c2 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -381,13 +381,13 @@ static int rndis_filter_receive_data(struct rndis_device *dev,
>
>  	vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
>  	if (vlan) {
> -		vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
> +		vlan_tci = vlan->vlanid |
>  			(vlan->pri << VLAN_PRIO_SHIFT);
>  	}
>
>  	csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO);
>  	return netvsc_recv_callback(net_device_ctx->device_ctx, pkt, data,
> -				    csum_info, channel, vlan_tci);
> +				    csum_info, channel, vlan_tci, vlan);
>  }
>
>  int rndis_filter_receive(struct hv_device *dev,

-- 
  Vitaly
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply

* Re: [PATCH RFC ipsec-next 4/5] net: Prepare for IPsec GRO
From: Eric Dumazet @ 2017-01-04 12:34 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: David Miller, netdev, Sowmini Varadhan, Ilan Tayari
In-Reply-To: <1483518230-6777-5-git-send-email-steffen.klassert@secunet.com>

On Wed, 2017-01-04 at 09:23 +0100, Steffen Klassert wrote:
> This patch prepares the generic codepath for IPsec GRO.
> We introduce a new GRO_CONSUMED notifier to reflect that
> IPsec can return asynchronous. On IPsec GRO we grab the
> packet and reinject it back to layer 2 after IPsec
> processing. We also use one xfrm_gro bit on the sk_buff
> that will be set from IPsec to notify about GRO. If this
> bit is set, we call napi_gro_receive for the backlog device
> instead of __netif_receive_skb.
> 
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
>  include/linux/netdevice.h |  1 +
>  include/linux/skbuff.h    | 14 +++++++++++++-
>  net/core/dev.c            | 17 ++++++++++++++++-
>  net/xfrm/Kconfig          |  4 ++++
>  4 files changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index ecd78b3..89bad76 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -352,6 +352,7 @@ enum gro_result {
>  	GRO_HELD,
>  	GRO_NORMAL,
>  	GRO_DROP,
> +	GRO_CONSUMED,
>  };
>  typedef enum gro_result gro_result_t;
>  
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index b53c0cf..a78cd90 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -749,7 +749,10 @@ struct sk_buff {
>  #ifdef CONFIG_NET_SWITCHDEV
>  	__u8			offload_fwd_mark:1;
>  #endif
> -	/* 2, 4 or 5 bit hole */
> +#ifdef CONFIG_XFRM_OFFLOAD
> +	__u8			xfrm_gro:1;



Arg, yet another skb bit.

> +#endif
> +	/* 1 to 5 bits hole */
>  
>  #ifdef CONFIG_NET_SCHED
>  	__u16			tc_index;	/* traffic control index */
> @@ -3698,6 +3701,15 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
>  #endif
>  }
>  

>  
> @@ -4843,7 +4853,12 @@ static int process_backlog(struct napi_struct *napi, int quota)
>  
>  		while ((skb = __skb_dequeue(&sd->process_queue))) {
>  			rcu_read_lock();
> -			__netif_receive_skb(skb);
> +
> +			if (skb_xfrm_gro(skb))
> +				napi_gro_receive(napi, skb);
> +			else
> +				__netif_receive_skb(skb);
> +


But napi here is device independent. It is a fake NAPI, per cpu.

I am not sure of the various implications of using it at this point,
this looks quite dangerous/invasive to me, compared to the gro_cells
infra which was designed to have no impact on core code paths.

To me, the caller should call napi_gro_receive() skb, instead of letting
core networking stack add this extra skb bit and extra conditional.

( Also I am not sure device dismantle will be properly managed by your
changes. It is really tricky to get it right. )

Thanks.

^ permalink raw reply

* Re: [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:20 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <cab4c624-2225-beed-25f5-7bcf25b16e9b@cogentembedded.com>

On 01/04/2017 03:13 PM, Sergei Shtylyov wrote:

>> The E-MAC interrupt (EESR.ECI) is not always caused  by an error condition,
>> so  it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
>> interrupt handler, sh_eth_emac_interrupt(),  removing the ECI bit from the
>> EESR's values throughout the driver...
>>
>> Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
>> copyright, while at it...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
>    Scrap it, I've just realized I never enable EESR.ECI...

    Heh, hat was false alarm -- I didn't change the .eesipr_value in the 
patch, so everything's OK, you can merge this series.
    I'll look into avoiding bare numbers in the .eesipr_value initializers.

MBR, Sergei

^ permalink raw reply

* Re: [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:13 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <2316251.zKWDf5AMHG@wasted.cogentembedded.com>

On 01/04/2017 03:11 PM, Sergei Shtylyov wrote:

> The E-MAC interrupt (EESR.ECI) is not always caused  by an error condition,
> so  it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
> interrupt handler, sh_eth_emac_interrupt(),  removing the ECI bit from the
> EESR's values throughout the driver...
>
> Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
> copyright, while at it...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

    Scrap it, I've just realized I never enable EESR.ECI...

MBR, Sergei

^ permalink raw reply

* [PATCH 3/3] sh_eth: factor out sh_eth_emac_interrupt()
From: Sergei Shtylyov @ 2017-01-04 12:11 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>

The E-MAC interrupt (EESR.ECI) is not always caused  by an error condition,
so  it really shouldn't be handled by sh_eth_error(). Factor out the E-MAC
interrupt handler, sh_eth_emac_interrupt(),  removing the ECI bit from the
EESR's values throughout the driver...

Update Cogent Embedded's copyright and clean up the whitespace in Renesas'
copyright, while at it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |  102 +++++++++++++++++-----------------
 drivers/net/ethernet/renesas/sh_eth.h |    2 
 2 files changed, 53 insertions(+), 51 deletions(-)

Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1,9 +1,9 @@
 /*  SuperH Ethernet device driver
  *
- *  Copyright (C) 2014  Renesas Electronics Corporation
+ *  Copyright (C) 2014 Renesas Electronics Corporation
  *  Copyright (C) 2006-2012 Nobuhiro Iwamatsu
  *  Copyright (C) 2008-2014 Renesas Solutions Corp.
- *  Copyright (C) 2013-2016 Cogent Embedded, Inc.
+ *  Copyright (C) 2013-2017 Cogent Embedded, Inc.
  *  Copyright (C) 2014 Codethink Limited
  *
  *  This program is free software; you can redistribute it and/or modify it
@@ -523,7 +523,7 @@ static struct sh_eth_cpu_data r7s72100_d
 	.tx_check	= EESR_TC1 | EESR_FTC,
 	.eesr_err_check	= EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
 			  EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-			  EESR_TDE | EESR_ECI,
+			  EESR_TDE,
 	.fdr_value	= 0x0000070f,
 
 	.no_psr		= 1,
@@ -562,7 +562,7 @@ static struct sh_eth_cpu_data r8a7740_da
 	.tx_check	= EESR_TC1 | EESR_FTC,
 	.eesr_err_check	= EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
 			  EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-			  EESR_TDE | EESR_ECI,
+			  EESR_TDE,
 	.fdr_value	= 0x0000070f,
 
 	.apr		= 1,
@@ -607,8 +607,7 @@ static struct sh_eth_cpu_data r8a777x_da
 
 	.tx_check	= EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
 	.eesr_err_check	= EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
-			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-			  EESR_ECI,
+			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
 	.fdr_value	= 0x00000f0f,
 
 	.apr		= 1,
@@ -630,8 +629,7 @@ static struct sh_eth_cpu_data r8a779x_da
 
 	.tx_check	= EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
 	.eesr_err_check	= EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
-			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-			  EESR_ECI,
+			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
 	.fdr_value	= 0x00000f0f,
 
 	.trscer_err_mask = DESC_I_RINT8,
@@ -671,8 +669,7 @@ static struct sh_eth_cpu_data sh7724_dat
 
 	.tx_check	= EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
 	.eesr_err_check	= EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
-			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-			  EESR_ECI,
+			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
 
 	.apr		= 1,
 	.mpr		= 1,
@@ -707,8 +704,7 @@ static struct sh_eth_cpu_data sh7757_dat
 
 	.tx_check	= EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
 	.eesr_err_check	= EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
-			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-			  EESR_ECI,
+			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
 
 	.irq_flags	= IRQF_SHARED,
 	.apr		= 1,
@@ -776,7 +772,7 @@ static struct sh_eth_cpu_data sh7757_dat
 	.tx_check	= EESR_TC1 | EESR_FTC,
 	.eesr_err_check	= EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
 			  EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-			  EESR_TDE | EESR_ECI,
+			  EESR_TDE,
 	.fdr_value	= 0x0000072f,
 
 	.irq_flags	= IRQF_SHARED,
@@ -807,7 +803,7 @@ static struct sh_eth_cpu_data sh7734_dat
 	.tx_check	= EESR_TC1 | EESR_FTC,
 	.eesr_err_check	= EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
 			  EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-			  EESR_TDE | EESR_ECI,
+			  EESR_TDE,
 
 	.apr		= 1,
 	.mpr		= 1,
@@ -835,8 +831,7 @@ static struct sh_eth_cpu_data sh7763_dat
 
 	.tx_check	= EESR_TC1 | EESR_FTC,
 	.eesr_err_check	= EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
-			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-			  EESR_ECI,
+			  EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE,
 
 	.apr		= 1,
 	.mpr		= 1,
@@ -1526,43 +1521,44 @@ static void sh_eth_rcv_snd_enable(struct
 	sh_eth_modify(ndev, ECMR, ECMR_RE | ECMR_TE, ECMR_RE | ECMR_TE);
 }
 
-/* error control function */
-static void sh_eth_error(struct net_device *ndev, u32 intr_status)
+/* E-MAC interrupt handler */
+static void sh_eth_emac_interrupt(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
 	u32 felic_stat;
 	u32 link_stat;
-	u32 mask;
 
-	if (intr_status & EESR_ECI) {
-		felic_stat = sh_eth_read(ndev, ECSR) &
-			     sh_eth_read(ndev, ECSIPR);
-		sh_eth_write(ndev, felic_stat, ECSR);	/* clear int */
-		if (felic_stat & ECSR_ICD)
-			ndev->stats.tx_carrier_errors++;
-		if (felic_stat & ECSR_LCHNG) {
-			/* Link Changed */
-			if (mdp->cd->no_psr || mdp->no_ether_link)
-				goto ignore_link;
-			link_stat = sh_eth_read(ndev, PSR);
-			if (mdp->ether_link_active_low)
-				link_stat = ~link_stat;
-			if (!(link_stat & PHY_ST_LINK)) {
-				sh_eth_rcv_snd_disable(ndev);
-			} else {
-				/* Link Up */
-				sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, 0);
-				/* clear int */
-				sh_eth_modify(ndev, ECSR, 0, 0);
-				sh_eth_modify(ndev, EESIPR, DMAC_M_ECI,
-					      DMAC_M_ECI);
-				/* enable tx and rx */
-				sh_eth_rcv_snd_enable(ndev);
-			}
+	felic_stat = sh_eth_read(ndev, ECSR) & sh_eth_read(ndev, ECSIPR);
+	sh_eth_write(ndev, felic_stat, ECSR);	/* clear int */
+	if (felic_stat & ECSR_ICD)
+		ndev->stats.tx_carrier_errors++;
+	if (felic_stat & ECSR_LCHNG) {
+		/* Link Changed */
+		if (mdp->cd->no_psr || mdp->no_ether_link)
+			return;
+		link_stat = sh_eth_read(ndev, PSR);
+		if (mdp->ether_link_active_low)
+			link_stat = ~link_stat;
+		if (!(link_stat & PHY_ST_LINK)) {
+			sh_eth_rcv_snd_disable(ndev);
+		} else {
+			/* Link Up */
+			sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, 0);
+			/* clear int */
+			sh_eth_modify(ndev, ECSR, 0, 0);
+			sh_eth_modify(ndev, EESIPR, DMAC_M_ECI, DMAC_M_ECI);
+			/* enable tx and rx */
+			sh_eth_rcv_snd_enable(ndev);
 		}
 	}
+}
+
+/* error control function */
+static void sh_eth_error(struct net_device *ndev, u32 intr_status)
+{
+	struct sh_eth_private *mdp = netdev_priv(ndev);
+	u32 mask;
 
-ignore_link:
 	if (intr_status & EESR_TWB) {
 		/* Unused write back interrupt */
 		if (intr_status & EESR_TABT) {	/* Transmit Abort int */
@@ -1643,14 +1639,16 @@ static irqreturn_t sh_eth_interrupt(int
 
 	/* Get interrupt status */
 	intr_status = sh_eth_read(ndev, EESR);
-	/* Mask it with the interrupt mask, forcing ECI interrupt to be always
-	 * enabled since it's the one that  comes thru regardless of the mask,
-	 * and we need to fully handle it in sh_eth_error() in order to quench
-	 * it as it doesn't get cleared by just writing 1 to the ECI bit...
+	/* Mask it with the interrupt mask, forcing ECI interrupt  to be always
+	 * enabled since it's the one that  comes  thru regardless of the mask,
+	 * and  we need to fully handle it  in sh_eth_emac_interrupt() in order
+	 * to quench it as it doesn't get cleared by just writing 1 to the  ECI
+	 * bit...
 	 */
 	intr_enable = sh_eth_read(ndev, EESIPR);
 	intr_status &= intr_enable | DMAC_M_ECI;
-	if (intr_status & (EESR_RX_CHECK | cd->tx_check | cd->eesr_err_check))
+	if (intr_status & (EESR_RX_CHECK | cd->tx_check | EESR_ECI |
+			   cd->eesr_err_check))
 		ret = IRQ_HANDLED;
 	else
 		goto out;
@@ -1682,6 +1680,10 @@ static irqreturn_t sh_eth_interrupt(int
 		netif_wake_queue(ndev);
 	}
 
+	/* E-MAC interrupt */
+	if (intr_status & EESR_ECI)
+		sh_eth_emac_interrupt(ndev);
+
 	if (intr_status & cd->eesr_err_check) {
 		/* Clear error interrupts */
 		sh_eth_write(ndev, intr_status & cd->eesr_err_check, EESR);
Index: renesas/drivers/net/ethernet/renesas/sh_eth.h
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ renesas/drivers/net/ethernet/renesas/sh_eth.h
@@ -265,7 +265,7 @@ enum EESR_BIT {
 				 EESR_RTO)
 #define DEFAULT_EESR_ERR_CHECK	(EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | \
 				 EESR_RDE | EESR_RFRMER | EESR_ADE | \
-				 EESR_TFE | EESR_TDE | EESR_ECI)
+				 EESR_TFE | EESR_TDE)
 
 /* EESIPR */
 enum DMAC_IM_BIT {

^ permalink raw reply

* [PATCH 2/3] sh_eth: no need for *else* after *goto*
From: Sergei Shtylyov @ 2017-01-04 12:10 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>

Well, checkpatch.pl complains about *else* after *return* and *break* but
not after *goto*... and it probably should have complained about the code
in sh_eth_error().  Win couple LoCs by removing that *else*. :-)

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1542,13 +1542,11 @@ static void sh_eth_error(struct net_devi
 			ndev->stats.tx_carrier_errors++;
 		if (felic_stat & ECSR_LCHNG) {
 			/* Link Changed */
-			if (mdp->cd->no_psr || mdp->no_ether_link) {
+			if (mdp->cd->no_psr || mdp->no_ether_link)
 				goto ignore_link;
-			} else {
-				link_stat = (sh_eth_read(ndev, PSR));
-				if (mdp->ether_link_active_low)
-					link_stat = ~link_stat;
-			}
+			link_stat = sh_eth_read(ndev, PSR);
+			if (mdp->ether_link_active_low)
+				link_stat = ~link_stat;
 			if (!(link_stat & PHY_ST_LINK)) {
 				sh_eth_rcv_snd_disable(ndev);
 			} else {

^ permalink raw reply

* [PATCH 1/3] sh_eth: handle only enabled E-MAC interrupts
From: Sergei Shtylyov @ 2017-01-04 12:10 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc
In-Reply-To: <64514012.uUvlhX0YRQ@wasted.cogentembedded.com>

The driver should only handle the enabled E-MAC interrupts, like it does
for the E-DMAC interrupts since commit 3893b27345ac ("sh_eth: workaround
for spurious ECI interrupt"),  so mask ECSR with  ECSIPR when reading it
in sh_eth_error().

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -1535,7 +1535,8 @@ static void sh_eth_error(struct net_devi
 	u32 mask;
 
 	if (intr_status & EESR_ECI) {
-		felic_stat = sh_eth_read(ndev, ECSR);
+		felic_stat = sh_eth_read(ndev, ECSR) &
+			     sh_eth_read(ndev, ECSIPR);
 		sh_eth_write(ndev, felic_stat, ECSR);	/* clear int */
 		if (felic_stat & ECSR_ICD)
 			ndev->stats.tx_carrier_errors++;

^ permalink raw reply

* [PATCH 0/2] sh_eth: E-MAC interrupt handler cleanups
From: Sergei Shtylyov @ 2017-01-04 12:09 UTC (permalink / raw)
  To: netdev; +Cc: linux-renesas-soc

Hello.

   Here's a set of 3 patches against DaveM's 'net-next.git' repo. I'm cleaning
up the E-MAC interrupt handling with the main goal of factoring out the E-MAC
interrupt handler into a separate function.

[1/3] sh_eth: handle only enabled E-MAC interrupts
[2/3] sh_eth: no need for *else* after *goto*
[3/3] sh_eth: factor out sh_eth_emac_interrupt()

MBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next] net/sched: cls_flower: Add user specified data
From: Paul Blakey @ 2017-01-04 11:45 UTC (permalink / raw)
  To: Simon Horman
  Cc: paulb, Jamal Hadi Salim, John Fastabend, David S. Miller, netdev,
	Jiri Pirko, Hadar Hen Zion, Or Gerlitz, Roi Dayan, Roman Mashak
In-Reply-To: <20170104101437.GB24762@penelope.horms.nl>



On 04/01/2017 12:14, Simon Horman wrote:
> On Tue, Jan 03, 2017 at 02:22:05PM +0200, Paul Blakey wrote:
>>
>> On 03/01/2017 13:44, Jamal Hadi Salim wrote:
>>> On 17-01-02 11:33 PM, John Fastabend wrote:
>>>> On 17-01-02 05:22 PM, Jamal Hadi Salim wrote:
>>> [..]
>>>>> Like all cookie semantics it is for storing state. The receiver
>>>>> (kernel)
>>>>> is not just store it and not intepret it. The user when reading it back
>>>>> simplifies what they have to do for their processing.
>>>>>
>>>>>> The tuple <ifindex:qdisc:prio:handle> really should be unique why
>>>>>> not use this for system wide mappings?
>>>>>>
>>>>> I think on a single machine should be enough, however:
>>>>> typically the user wants to define the value in a manner that
>>>>> in a distributed system it is unique. It would be trickier to
>>>>> do so with well defined values such as above.
>>>>>
>>>> Just extend the tuple <hostname:ifindex:qdisc:prio:handle> that
>>>> should be unique in the domain of hostname's, or use some other domain
>>>> wide machine identifier.
>>>>
>>> May work for the case of filter identification. The nice thing for
>>> allowing cookies is you can let the user define it define their
>>> own scheme.
>>>
>>>> Although actions can be shared so the cookie can be shared across
>>>> filters. Maybe its useful but it doesn't uniquely identify a filter
>>>> in the shared case but the user would have to specify that case
>>>> so maybe its not important.
>>>>
>>> Note: the action cookies and filter cookies are unrelated/orthogonal.
>>> Their basic concept of stashing something in the cookie to help improve
>>> what user space does (in our case millions of actions of which some are
>>> used for accounting) is similar.
>>> I have no objections to the flow cookies; my main concern was it should
>>> be applicable to all classifiers not just flower. And the arbitrary size
>>> of the cookie that you pointed out is questionable.
>>>
>>> cheers,
>>> jamal
>>
>> Hi all,
>> Our use case is replacing OVS rules with TC filters for HW offload, and
>> you're are right the cookie would
>> have saved us the mapping from OVS rule ufid to the tc filter handle/prio...
>> that was generated for it.
>> It also was going to be used to store other info like which OVS output port
>> corresponds to the ifindex,
> Possibly off-topic but I am curious to know why you need to store the port.
> My possibly naïve assumption is that a filter is attached to the netdev
> corresponding to the input port and mirred or other actions are used to output
> to netdevs corresponding to output ports.

Right, its for the output ports, OVS uses ovs port numbers and mirred 
action uses the device ifindex, so there is need
to translate it back to OVS port on dump.

>
>> so we need 128+32 for now. It helps us with dumping the the flows back, when
>> we lose data on crash
>> or restarting the user space daemon.
>> HW hints is another thing that might be helpful.
>> Its binary blob because user/app specifc and its usage might change in the
>> future and its and that's why there
>> is some headroom with size as well.

^ permalink raw reply

* Re: [PATCH iproute2 net-next] tc: flower: support matching flags
From: Jiri Benc @ 2017-01-04 11:55 UTC (permalink / raw)
  To: Paul Blakey
  Cc: Simon Horman, netdev, Stephen Hemminger, David S. Miller,
	Hadar Hen Zion, Or Gerlitz, Roi Dayan
In-Reply-To: <82df989f-09a7-a89a-a675-c45d190b049e@mellanox.com>

On Wed, 4 Jan 2017 13:51:13 +0200, Paul Blakey wrote:
> It mimics the kernel packing of flags, I have no problem either way 
> (flags, or ip_flags/tcp_flags pairs), what do you think jiri?

What Simon says makes sense to me. ip_flags and tcp_flags sounds like
the best solution so far (even better than my original suggestion).

Thanks,

 Jiri

^ permalink raw reply

* Re: [PATCH iproute2 net-next] tc: flower: support matching flags
From: Paul Blakey @ 2017-01-04 11:51 UTC (permalink / raw)
  To: Simon Horman
  Cc: paulb, Jiri Benc, netdev, Stephen Hemminger, David S. Miller,
	Hadar Hen Zion, Or Gerlitz, Roi Dayan
In-Reply-To: <20170104103301.GA30008@penelope.horms.nl>



On 04/01/2017 12:33, Simon Horman wrote:
> On Tue, Jan 03, 2017 at 01:54:34PM +0200, Paul Blakey wrote:
>
> ...
>
> Hi Paul,
>
>> Matching name was from the idea that we are doing is matching.
>> And regarding documentation/flag names I didn't want tc tool to be need of a
>> update each time a new flag is introduced,
>> But I guess I can add two options like with ip_proto where you can specify
>> known flags by name but can also give a value.
>> What do you think about that?
>>
>> flags <FLAGS> / <HEX'/'HEX>
>> FLAGS => frag/no_frag/tcp_syn/no_tcp_syn ['|'<FLAGS>]*
>> e.g: flags frag|no_tcp_syn or flags 0x01/0x15
>> and the mask will have a on bits corresponds only to those flags specified.
> I suppose a flag is a flag and bitwise masking allows arbitrary matching
> on one or more flags. But I wonder if, as per your example above,
> it makes sense to mix IP (frag) and TCP flags in the same field of the
> classifier.
It mimics the kernel packing of flags, I have no problem either way 
(flags, or ip_flags/tcp_flags pairs), what do you think jiri?

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox