Netdev List
 help / color / mirror / Atom feed
* [RFC PATCH net-next v1 13/14] iavf: finish renaming files to iavf
From: Jesse Brandeburg @ 2018-09-13 22:31 UTC (permalink / raw)
  To: netdev, intel-wired-lan; +Cc: jeffrey.t.kirsher
In-Reply-To: <20180913223144.75823-1-jesse.brandeburg@intel.com>

This finishes the process of renaming the files that
make sense to rename (skipping adminq related files that
talk to i40e) and fixes up the build and the #includes
so that everything builds nicely.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/ethernet/intel/iavf/Makefile                          | 2 +-
 drivers/net/ethernet/intel/iavf/i40e_adminq.c                     | 8 ++++----
 drivers/net/ethernet/intel/iavf/i40e_adminq.h                     | 4 ++--
 drivers/net/ethernet/intel/iavf/iavf.h                            | 4 ++--
 drivers/net/ethernet/intel/iavf/{i40e_alloc.h => iavf_alloc.h}    | 0
 drivers/net/ethernet/intel/iavf/iavf_client.c                     | 2 +-
 drivers/net/ethernet/intel/iavf/{i40e_common.c => iavf_common.c}  | 4 ++--
 drivers/net/ethernet/intel/iavf/{i40e_devids.h => iavf_devids.h}  | 0
 drivers/net/ethernet/intel/iavf/iavf_main.c                       | 2 +-
 drivers/net/ethernet/intel/iavf/{i40e_osdep.h => iavf_osdep.h}    | 0
 .../ethernet/intel/iavf/{i40e_prototype.h => iavf_prototype.h}    | 4 ++--
 .../net/ethernet/intel/iavf/{i40e_register.h => iavf_register.h}  | 0
 drivers/net/ethernet/intel/iavf/{i40e_status.h => iavf_status.h}  | 0
 drivers/net/ethernet/intel/iavf/iavf_txrx.c                       | 2 +-
 drivers/net/ethernet/intel/iavf/{i40e_type.h => iavf_type.h}      | 8 ++++----
 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c                   | 2 +-
 16 files changed, 21 insertions(+), 21 deletions(-)
 rename drivers/net/ethernet/intel/iavf/{i40e_alloc.h => iavf_alloc.h} (100%)
 rename drivers/net/ethernet/intel/iavf/{i40e_common.c => iavf_common.c} (99%)
 rename drivers/net/ethernet/intel/iavf/{i40e_devids.h => iavf_devids.h} (100%)
 rename drivers/net/ethernet/intel/iavf/{i40e_osdep.h => iavf_osdep.h} (100%)
 rename drivers/net/ethernet/intel/iavf/{i40e_prototype.h => iavf_prototype.h} (98%)
 rename drivers/net/ethernet/intel/iavf/{i40e_register.h => iavf_register.h} (100%)
 rename drivers/net/ethernet/intel/iavf/{i40e_status.h => iavf_status.h} (100%)
 rename drivers/net/ethernet/intel/iavf/{i40e_type.h => iavf_type.h} (99%)

diff --git a/drivers/net/ethernet/intel/iavf/Makefile b/drivers/net/ethernet/intel/iavf/Makefile
index fa4c43be2266..87ddfbac2f17 100644
--- a/drivers/net/ethernet/intel/iavf/Makefile
+++ b/drivers/net/ethernet/intel/iavf/Makefile
@@ -12,4 +12,4 @@ subdir-ccflags-y += -I$(src)
 obj-$(CONFIG_IAVF) += iavf.o
 
 iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o \
-		 iavf_txrx.o i40e_common.o i40e_adminq.o iavf_client.o
+		 iavf_txrx.o iavf_common.o i40e_adminq.o iavf_client.o
diff --git a/drivers/net/ethernet/intel/iavf/i40e_adminq.c b/drivers/net/ethernet/intel/iavf/i40e_adminq.c
index 8aa817808cd5..d2b165b610fa 100644
--- a/drivers/net/ethernet/intel/iavf/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/iavf/i40e_adminq.c
@@ -1,11 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
-#include "i40e_status.h"
-#include "i40e_type.h"
-#include "i40e_register.h"
+#include "iavf_status.h"
+#include "iavf_type.h"
+#include "iavf_register.h"
 #include "i40e_adminq.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 
 /**
  *  i40e_adminq_init_regs - Initialize AdminQ registers
diff --git a/drivers/net/ethernet/intel/iavf/i40e_adminq.h b/drivers/net/ethernet/intel/iavf/i40e_adminq.h
index e34625e25589..ee983889eab0 100644
--- a/drivers/net/ethernet/intel/iavf/i40e_adminq.h
+++ b/drivers/net/ethernet/intel/iavf/i40e_adminq.h
@@ -4,8 +4,8 @@
 #ifndef _IAVF_ADMINQ_H_
 #define _IAVF_ADMINQ_H_
 
-#include "i40e_osdep.h"
-#include "i40e_status.h"
+#include "iavf_osdep.h"
+#include "iavf_status.h"
 #include "i40e_adminq_cmd.h"
 
 #define IAVF_ADMINQ_DESC(R, i)   \
diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h
index 1d973b4cd973..961c1a71b671 100644
--- a/drivers/net/ethernet/intel/iavf/iavf.h
+++ b/drivers/net/ethernet/intel/iavf/iavf.h
@@ -34,7 +34,7 @@
 #include <net/tc_act/tc_gact.h>
 #include <net/tc_act/tc_mirred.h>
 
-#include "i40e_type.h"
+#include "iavf_type.h"
 #include <linux/avf/virtchnl.h>
 #include "iavf_txrx.h"
 
@@ -298,7 +298,7 @@ struct iavf_adapter {
 	struct net_device *netdev;
 	struct pci_dev *pdev;
 
-	struct iavf_hw hw; /* defined in i40e_type.h */
+	struct iavf_hw hw; /* defined in iavf_type.h */
 
 	enum iavf_state_t state;
 	unsigned long crit_section;
diff --git a/drivers/net/ethernet/intel/iavf/i40e_alloc.h b/drivers/net/ethernet/intel/iavf/iavf_alloc.h
similarity index 100%
rename from drivers/net/ethernet/intel/iavf/i40e_alloc.h
rename to drivers/net/ethernet/intel/iavf/iavf_alloc.h
diff --git a/drivers/net/ethernet/intel/iavf/iavf_client.c b/drivers/net/ethernet/intel/iavf/iavf_client.c
index f4c195a4167a..a0bfa6b9555e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_client.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_client.c
@@ -5,7 +5,7 @@
 #include <linux/errno.h>
 
 #include "iavf.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 #include "iavf_client.h"
 
 static
diff --git a/drivers/net/ethernet/intel/iavf/i40e_common.c b/drivers/net/ethernet/intel/iavf/iavf_common.c
similarity index 99%
rename from drivers/net/ethernet/intel/iavf/i40e_common.c
rename to drivers/net/ethernet/intel/iavf/iavf_common.c
index d9fd2f24b3e7..768369c89e77 100644
--- a/drivers/net/ethernet/intel/iavf/i40e_common.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_common.c
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
-#include "i40e_type.h"
+#include "iavf_type.h"
 #include "i40e_adminq.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 #include <linux/avf/virtchnl.h>
 
 /**
diff --git a/drivers/net/ethernet/intel/iavf/i40e_devids.h b/drivers/net/ethernet/intel/iavf/iavf_devids.h
similarity index 100%
rename from drivers/net/ethernet/intel/iavf/i40e_devids.h
rename to drivers/net/ethernet/intel/iavf/iavf_devids.h
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 74b547634f48..54d8a1ed05ac 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2,7 +2,7 @@
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
 #include "iavf.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 #include "iavf_client.h"
 /* All iavf tracepoints are defined by the include below, which must
  * be included exactly once across the whole kernel with
diff --git a/drivers/net/ethernet/intel/iavf/i40e_osdep.h b/drivers/net/ethernet/intel/iavf/iavf_osdep.h
similarity index 100%
rename from drivers/net/ethernet/intel/iavf/i40e_osdep.h
rename to drivers/net/ethernet/intel/iavf/iavf_osdep.h
diff --git a/drivers/net/ethernet/intel/iavf/i40e_prototype.h b/drivers/net/ethernet/intel/iavf/iavf_prototype.h
similarity index 98%
rename from drivers/net/ethernet/intel/iavf/i40e_prototype.h
rename to drivers/net/ethernet/intel/iavf/iavf_prototype.h
index dca62e3b951f..a0cd43b7a368 100644
--- a/drivers/net/ethernet/intel/iavf/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_prototype.h
@@ -4,8 +4,8 @@
 #ifndef _IAVF_PROTOTYPE_H_
 #define _IAVF_PROTOTYPE_H_
 
-#include "i40e_type.h"
-#include "i40e_alloc.h"
+#include "iavf_type.h"
+#include "iavf_alloc.h"
 #include <linux/avf/virtchnl.h>
 
 /* Prototypes for shared code functions that are not in
diff --git a/drivers/net/ethernet/intel/iavf/i40e_register.h b/drivers/net/ethernet/intel/iavf/iavf_register.h
similarity index 100%
rename from drivers/net/ethernet/intel/iavf/i40e_register.h
rename to drivers/net/ethernet/intel/iavf/iavf_register.h
diff --git a/drivers/net/ethernet/intel/iavf/i40e_status.h b/drivers/net/ethernet/intel/iavf/iavf_status.h
similarity index 100%
rename from drivers/net/ethernet/intel/iavf/i40e_status.h
rename to drivers/net/ethernet/intel/iavf/iavf_status.h
diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index 517c37a44026..add3188ccedf 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -6,7 +6,7 @@
 
 #include "iavf.h"
 #include "iavf_trace.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 
 static inline __le64 build_ctob(u32 td_cmd, u32 td_offset, unsigned int size,
 				u32 td_tag)
diff --git a/drivers/net/ethernet/intel/iavf/i40e_type.h b/drivers/net/ethernet/intel/iavf/iavf_type.h
similarity index 99%
rename from drivers/net/ethernet/intel/iavf/i40e_type.h
rename to drivers/net/ethernet/intel/iavf/iavf_type.h
index 6a917dbfb981..f0c8cf981b92 100644
--- a/drivers/net/ethernet/intel/iavf/i40e_type.h
+++ b/drivers/net/ethernet/intel/iavf/iavf_type.h
@@ -4,11 +4,11 @@
 #ifndef _IAVF_TYPE_H_
 #define _IAVF_TYPE_H_
 
-#include "i40e_status.h"
-#include "i40e_osdep.h"
-#include "i40e_register.h"
+#include "iavf_status.h"
+#include "iavf_osdep.h"
+#include "iavf_register.h"
 #include "i40e_adminq.h"
-#include "i40e_devids.h"
+#include "iavf_devids.h"
 
 #define IAVF_RXQ_CTX_DBUFF_SHIFT 7
 
diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
index 8622d7781fd7..fa5be220a7ec 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
@@ -2,7 +2,7 @@
 /* Copyright(c) 2013 - 2018 Intel Corporation. */
 
 #include "iavf.h"
-#include "i40e_prototype.h"
+#include "iavf_prototype.h"
 #include "iavf_client.h"
 
 /* busy wait delay in msec */
-- 
2.14.4

^ permalink raw reply related

* [RFC PATCH net-next v1 14/14] intel-ethernet: use correct module license
From: Jesse Brandeburg @ 2018-09-13 22:31 UTC (permalink / raw)
  To: netdev, intel-wired-lan; +Cc: jeffrey.t.kirsher
In-Reply-To: <20180913223144.75823-1-jesse.brandeburg@intel.com>

We recently updated all our SPDX identifiers to correctly
indicate our net/ethernet/intel/* drivers were always released
and intended to be released under GPL v2, but the MODULE_LICENSE
declaration was never updated.

Fix the MODULE_LICENSE to be GPL v2, for all our drivers.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/ethernet/intel/e100.c                 | 2 +-
 drivers/net/ethernet/intel/e1000/e1000_main.c     | 2 +-
 drivers/net/ethernet/intel/e1000e/netdev.c        | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_main.c     | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c       | 2 +-
 drivers/net/ethernet/intel/iavf/iavf_main.c       | 4 ++--
 drivers/net/ethernet/intel/ice/ice_main.c         | 2 +-
 drivers/net/ethernet/intel/igb/igb_main.c         | 2 +-
 drivers/net/ethernet/intel/igbvf/netdev.c         | 2 +-
 drivers/net/ethernet/intel/ixgb/ixgb_main.c       | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     | 2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +-
 12 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 27d5f27163d2..7c4b55482f72 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -164,7 +164,7 @@
 
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_AUTHOR(DRV_COPYRIGHT);
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 MODULE_FIRMWARE(FIRMWARE_D101M);
 MODULE_FIRMWARE(FIRMWARE_D101S);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 2110d5f2da19..7e0f1f96a8a1 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -195,7 +195,7 @@ static struct pci_driver e1000_driver = {
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 3ba0c90e7055..c0f9faca70c4 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7592,7 +7592,7 @@ module_exit(e1000_exit_module);
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 /* netdev.c */
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index 3f536541f45f..503bbc017792 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -21,7 +21,7 @@ static const char fm10k_copyright[] =
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION(DRV_SUMMARY);
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 /* single workqueue for entire fm10k driver */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 5d209d8fe9b8..c7d2c9010fdf 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -91,7 +91,7 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX
 
 MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
 MODULE_DESCRIPTION("Intel(R) Ethernet Connection XL710 Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 static struct workqueue_struct *i40e_wq;
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index 54d8a1ed05ac..0e2f78175f0e 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -53,8 +53,8 @@ MODULE_DEVICE_TABLE(pci, iavf_pci_tbl);
 
 MODULE_ALIAS("i40evf");
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
-MODULE_DESCRIPTION("Intel(R) XL710 X710 Virtual Function Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Intel(R) Ethernet Adaptive Virtual Function Network Driver");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 static struct workqueue_struct *iavf_wq;
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 1b49a605d094..d54e63785ff0 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -15,7 +15,7 @@ static const char ice_copyright[] = "Copyright (c) 2018, Intel Corporation.";
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION(DRV_SUMMARY);
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 static int debug = -1;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a32c576c1e65..c18e79112cad 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -243,7 +243,7 @@ static struct pci_driver igb_driver = {
 
 MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
 MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c
index e0c989ffb2b3..820d49eb41ab 100644
--- a/drivers/net/ethernet/intel/igbvf/netdev.c
+++ b/drivers/net/ethernet/intel/igbvf/netdev.c
@@ -3011,7 +3011,7 @@ module_exit(igbvf_exit_module);
 
 MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
 MODULE_DESCRIPTION("Intel(R) Gigabit Virtual Function Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 /* netdev.c */
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index d3e72d0f66ef..4bb89587cd6a 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -107,7 +107,7 @@ static struct pci_driver ixgb_driver = {
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 604282f03d23..27a8546c88b2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -159,7 +159,7 @@ MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 static struct workqueue_struct *ixgbe_wq;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 17e23f609d74..ba6562e8cd73 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -79,7 +79,7 @@ MODULE_DEVICE_TABLE(pci, ixgbevf_pci_tbl);
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION("Intel(R) 10 Gigabit Virtual Function Network Driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_VERSION(DRV_VERSION);
 
 #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
-- 
2.14.4

^ permalink raw reply related

* Re: [RFC PATCH net-next v1 00/14] rename and shrink i40evf
From: David Miller @ 2018-09-13 22:43 UTC (permalink / raw)
  To: jesse.brandeburg; +Cc: netdev, intel-wired-lan, jeffrey.t.kirsher
In-Reply-To: <20180913223144.75823-1-jesse.brandeburg@intel.com>

From: Jesse Brandeburg <jesse.brandeburg@intel.com>
Date: Thu, 13 Sep 2018 15:31:30 -0700

> This series contains changes to i40evf so that it becomes a more
> generic virtual function driver for current and future silicon.
> 
> While doing the rename of i40evf to a more generic name of iavf,
> we also put the driver on a severe diet due to how much of the
> code was unneeded or was unused.  The outcome is a lean and mean
> virtual function driver that continues to work on existing 40GbE
> (i40e) virtual devices and prepped for future supported devices,
> like the 100GbE (ice) virtual devices.
> 
> This solves 2 issues we saw coming or were already present, the
> first was constant code duplication happening with i40e/i40evf,
> when much of the duplicate code in the i40evf was not used or was
> not needed.  The second was to remove the future confusion of why
> future VF devices that were not considered "40GbE" only devices
> were supported by i40evf.
> 
> The thought is that iavf will be the virtual function driver for
> all future devices, so it should have a "generic" name to propery
> represent that it is the VF driver for multiple generations of
> devices.

Having a common vf driver for current and future devices is a major
accomplishment and I fully support these changes.

Nice work!

> Known Caveats:
> This may cause some user confusion, especially for Kconfig not
> migrating cleanly to the new CONFIG_IAVF from CONFIG_I40EVF.
> 
> Existing user configurations may have to change, but the module
> alias in patch 1 helps a bit here.

You can deal with this by retaining the existing I40EVF Kconfig
knob and just let it 'select' IAVF.

^ permalink raw reply

* Re: [PATCH] socket: fix struct ifreq size in compat ioctl
From: kbuild test robot @ 2018-09-13 22:48 UTC (permalink / raw)
  To: Johannes Berg
  Cc: kbuild-all, netdev, Robert O'Callahan, Al Viro, Johannes Berg
In-Reply-To: <20180913114909.8331-1-johannes@sipsolutions.net>

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

Hi Johannes,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on v4.19-rc3 next-20180913]
[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/Johannes-Berg/socket-fix-struct-ifreq-size-in-compat-ioctl/20180914-061826
config: x86_64-randconfig-x013-201836 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/socket.c: In function 'sock_do_ioctl':
>> net/socket.c:972:24: error: invalid application of 'sizeof' to incomplete type 'struct compat_ifreq'
           compat ? sizeof(struct compat_ifreq) :
                           ^~~~~~
   net/socket.c:978:23: error: invalid application of 'sizeof' to incomplete type 'struct compat_ifreq'
          compat ? sizeof(struct compat_ifreq) :
                          ^~~~~~

vim +972 net/socket.c

   942	
   943	static long sock_do_ioctl(struct net *net, struct socket *sock,
   944				  unsigned int cmd, unsigned long arg,
   945				  bool compat)
   946	{
   947		int err;
   948		void __user *argp = (void __user *)arg;
   949	
   950		err = sock->ops->ioctl(sock, cmd, arg);
   951	
   952		/*
   953		 * If this ioctl is unknown try to hand it down
   954		 * to the NIC driver.
   955		 */
   956		if (err != -ENOIOCTLCMD)
   957			return err;
   958	
   959		if (cmd == SIOCGIFCONF) {
   960			struct ifconf ifc;
   961			if (copy_from_user(&ifc, argp, sizeof(struct ifconf)))
   962				return -EFAULT;
   963			rtnl_lock();
   964			err = dev_ifconf(net, &ifc, sizeof(struct ifreq));
   965			rtnl_unlock();
   966			if (!err && copy_to_user(argp, &ifc, sizeof(struct ifconf)))
   967				err = -EFAULT;
   968		} else {
   969			struct ifreq ifr;
   970			bool need_copyout;
   971			if (copy_from_user(&ifr, argp,
 > 972					   compat ? sizeof(struct compat_ifreq) :
   973						    sizeof(struct ifreq)))
   974				return -EFAULT;
   975			err = dev_ioctl(net, cmd, &ifr, &need_copyout);
   976			if (!err && need_copyout)
   977				if (copy_to_user(argp, &ifr,
   978						 compat ? sizeof(struct compat_ifreq) :
   979							  sizeof(struct ifreq)))
   980					return -EFAULT;
   981		}
   982		return err;
   983	}
   984	

---
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: 28962 bytes --]

^ permalink raw reply

* Re: mlx5 driver loading failing on v4.19 / net-next / bpf-next
From: Alexei Starovoitov @ 2018-09-13 22:55 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Jesper Dangaard Brouer, Saeed Mahameed, netdev@vger.kernel.org,
	Eran Ben Elisha

On Thu, Aug 30, 2018 at 1:35 AM, Tariq Toukan <tariqt@mellanox.com> wrote:
>
>
> On 29/08/2018 6:05 PM, Jesper Dangaard Brouer wrote:
>>
>> Hi Saeed,
>>
>> I'm having issues loading mlx5 driver on v4.19 kernels (tested both
>> net-next and bpf-next), while kernel v4.18 seems to work.  It happens
>> with a Mellanox ConnectX-5 NIC (and also a CX4-Lx but I removed that
>> from the system now).
>>
>
> Hi Jesper,
>
> Thanks for your report!
>
> We are working to analyze and debug the issue.

looks like serious issue to me... while no news in 2 weeks.
any update?

^ permalink raw reply

* Re: [PATCH 1/2] netlink: add NLA_REJECT policy type
From: David Miller @ 2018-09-13 22:59 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, netdev, mkubecek, johannes.berg
In-Reply-To: <20180913084603.7979-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Thu, 13 Sep 2018 10:46:02 +0200

> +					NL_SET_BAD_ATTR(extack, nla);
> +					if (extack && !extack->_msg)
> +						NL_SET_ERR_MSG(extack,
> +							       "Attribute failed policy validation");

Given the lively discussion that resulted from this conditional I am
pretty sure we want to override existing messages.

If we have an existing message, and we continued to process and
parse anyways, then the existing message was informational or
a warning.

The message should be overridden when the action will be to fail, as
it will be here when we return -EINVAL.

^ permalink raw reply

* Re: [PATCH v2] socket: fix struct ifreq size in compat ioctl
From: David Miller @ 2018-09-13 23:01 UTC (permalink / raw)
  To: johannes; +Cc: netdev, robert, viro, johannes.berg
In-Reply-To: <20180913124055.14082-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Thu, 13 Sep 2018 14:40:55 +0200

> From: Johannes Berg <johannes.berg@intel.com>
> 
> As reported by Reobert O'Callahan, since Viro's commit to kill
> dev_ifsioc() we attempt to copy too much data in compat mode,
> which may lead to EFAULT when the 32-bit version of struct ifreq
> sits at/near the end of a page boundary, and the next page isn't
> mapped.
> 
> Fix this by passing the approprate compat/non-compat size to copy
> and using that, as before the dev_ifsioc() removal. This works
> because only the embedded "struct ifmap" has different size, and
> this is only used in SIOCGIFMAP/SIOCSIFMAP which has a different
> handler. All other parts of the union are naturally compatible.
> 
> This fixes https://bugzilla.kernel.org/show_bug.cgi?id=199469.
> 
> Fixes: bf4405737f9f ("kill dev_ifsioc()")
> Reported-by: Robert O'Callahan <robert@ocallahan.org>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Applied and queued up for -stable, thanks Johannes.

^ permalink raw reply

* Re: [PATCH net v2] bonding: pass link-local packets to bonding master also.
From: Michal Soltys @ 2018-09-13 23:00 UTC (permalink / raw)
  To: Mahesh Bandewar, Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	David Miller
  Cc: Netdev, Mahesh Bandewar
In-Reply-To: <b63a7475-900e-665a-c164-cbac1b8fdde8@ziu.info>

On 2018-07-19 18:20, Michal Soltys wrote:
> On 07/19/2018 01:41 AM, Mahesh Bandewar wrote:
>> From: Mahesh Bandewar <maheshb@google.com>
>>
>> Commit b89f04c61efe ("bonding: deliver link-local packets with
>> skb->dev set to link that packets arrived on") changed the behavior
>> of how link-local-multicast packets are processed. The change in
>> the behavior broke some legacy use cases where these packets are
>> expected to arrive on bonding master device also.
>>
>> This patch passes the packet to the stack with the link it arrived
>> on as well as passes to the bonding-master device to preserve the
>> legacy use case.
>>
>> Fixes: b89f04c61efe ("bonding: deliver link-local packets with
>> skb->dev set to link that packets arrived on")
>> Reported-by: Michal Soltys <soltys@ziu.info>
>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>> ---
>> v2: Added Fixes tag.
>> v1: Initial patch.
>>   drivers/net/bonding/bond_main.c | 17 +++++++++++++++--
>>   1 file changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c
>> b/drivers/net/bonding/bond_main.c
>> index 9a2ea3c1f949..1d3b7d8448f2 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -1177,9 +1177,22 @@ static rx_handler_result_t
>> bond_handle_frame(struct sk_buff **pskb)
>>           }
>>       }
>>   -    /* don't change skb->dev for link-local packets */
>> -    if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
>> +    /* Link-local multicast packets should be passed to the
>> +     * stack on the link they arrive as well as pass them to the
>> +     * bond-master device. These packets are mostly usable when
>> +     * stack receives it with the link on which they arrive
>> +     * (e.g. LLDP) but there may be some legacy behavior that
>> +     * expects these packets to appear on bonding master too.
> 
> I'd really change the comment from:
> 
> "These packets are mostly usable when stack receives it with the link on
> which they arrive (e.g. LLDP) but there may be some legacy behavior that
> expects these packets to appear on bonding master too."
> 
> to something like:
> 
> "These packets are mostly usable when stack receives it with the link on
> which they arrive, but they also must be available on aggregations. Some
> of the use cases include (but are not limited to): LLDP agents that must
> be able to operate both on enslaved interfaces as well as on bonds
> themselves; linux bridges that must be able to process/pass BPDUs from
> attached bonds when any kind of stp version is enabled on the network."
> 
> It's a bit longer, but clarifies the reasons more precisely (without
> going too deep into features like group_fwd_mask).
> 

Anyway, any chance for that patch to get merged ? It would be great to
get the correct functionality back asap. As for the comment, I'll submit
a trivial patch expanding/clarifying it later (or I can resubmit
adjusted v3 if it's ok with Mahesh).

^ permalink raw reply

* [PATCH v3,net-next 1/2] ip_gre: fix parsing gre header in ipgre_err
From: Haishuang Yan @ 2018-09-14  4:26 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov
  Cc: Jiri Benc, netdev, linux-kernel, Haishuang Yan

gre_parse_header stops parsing when csum_err is encountered, which means
tpi->key is undefined and ip_tunnel_lookup will return NULL improperly.

This patch introduce a NULL pointer as csum_err parameter. Even when
csum_err is encountered, it won't return error and continue parsing gre
header as expected.

Fixes: 9f57c67c379d ("gre: Remove support for sharing GRE protocol hook.")
Reported-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

---
Changes since v3:
  * skb_checksum_simple_validate need to be performed in csum_err case.
---
 net/ipv4/gre_demux.c | 7 ++++---
 net/ipv4/ip_gre.c    | 9 +++------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index b798862..7efe740 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -86,13 +86,14 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 
 	options = (__be32 *)(greh + 1);
 	if (greh->flags & GRE_CSUM) {
-		if (skb_checksum_simple_validate(skb)) {
+		if (!skb_checksum_simple_validate(skb)) {
+			skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
+						 null_compute_pseudo);
+		} else if (csum_err) {
 			*csum_err = true;
 			return -EINVAL;
 		}
 
-		skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
-					 null_compute_pseudo);
 		options++;
 	}
 
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 8cce0e9..c3385a8 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -232,13 +232,10 @@ static void gre_err(struct sk_buff *skb, u32 info)
 	const int type = icmp_hdr(skb)->type;
 	const int code = icmp_hdr(skb)->code;
 	struct tnl_ptk_info tpi;
-	bool csum_err = false;
 
-	if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP),
-			     iph->ihl * 4) < 0) {
-		if (!csum_err)		/* ignore csum errors. */
-			return;
-	}
+	if (gre_parse_header(skb, &tpi, NULL, htons(ETH_P_IP),
+			     iph->ihl * 4) < 0)
+		return;
 
 	if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
 		ipv4_update_pmtu(skb, dev_net(skb->dev), info,
-- 
1.8.3.1

^ permalink raw reply related

* Re: [PATCH net v2] bonding: pass link-local packets to bonding master also.
From: Mahesh Bandewar (महेश बंडेवार) @ 2018-09-13 23:24 UTC (permalink / raw)
  To: Michal Soltys
  Cc: Mahesh Bandewar, Jay Vosburgh, Andy Gospodarek, Veaceslav Falico,
	David Miller, Netdev
In-Reply-To: <9da916a6-73c0-75b5-a7cc-dac70d549ddd@ziu.info>

On Thu, Sep 13, 2018 at 4:00 PM, Michal Soltys <soltys@ziu.info> wrote:
> On 2018-07-19 18:20, Michal Soltys wrote:
>> On 07/19/2018 01:41 AM, Mahesh Bandewar wrote:
>>> From: Mahesh Bandewar <maheshb@google.com>
>>>
>>> Commit b89f04c61efe ("bonding: deliver link-local packets with
>>> skb->dev set to link that packets arrived on") changed the behavior
>>> of how link-local-multicast packets are processed. The change in
>>> the behavior broke some legacy use cases where these packets are
>>> expected to arrive on bonding master device also.
>>>
>>> This patch passes the packet to the stack with the link it arrived
>>> on as well as passes to the bonding-master device to preserve the
>>> legacy use case.
>>>
>>> Fixes: b89f04c61efe ("bonding: deliver link-local packets with
>>> skb->dev set to link that packets arrived on")
>>> Reported-by: Michal Soltys <soltys@ziu.info>
>>> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
>>> ---
>>> v2: Added Fixes tag.
>>> v1: Initial patch.
>>>   drivers/net/bonding/bond_main.c | 17 +++++++++++++++--
>>>   1 file changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/bonding/bond_main.c
>>> b/drivers/net/bonding/bond_main.c
>>> index 9a2ea3c1f949..1d3b7d8448f2 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -1177,9 +1177,22 @@ static rx_handler_result_t
>>> bond_handle_frame(struct sk_buff **pskb)
>>>           }
>>>       }
>>>   -    /* don't change skb->dev for link-local packets */
>>> -    if (is_link_local_ether_addr(eth_hdr(skb)->h_dest))
>>> +    /* Link-local multicast packets should be passed to the
>>> +     * stack on the link they arrive as well as pass them to the
>>> +     * bond-master device. These packets are mostly usable when
>>> +     * stack receives it with the link on which they arrive
>>> +     * (e.g. LLDP) but there may be some legacy behavior that
>>> +     * expects these packets to appear on bonding master too.
>>
>> I'd really change the comment from:
>>
>> "These packets are mostly usable when stack receives it with the link on
>> which they arrive (e.g. LLDP) but there may be some legacy behavior that
>> expects these packets to appear on bonding master too."
>>
>> to something like:
>>
>> "These packets are mostly usable when stack receives it with the link on
>> which they arrive, but they also must be available on aggregations. Some
>> of the use cases include (but are not limited to): LLDP agents that must
>> be able to operate both on enslaved interfaces as well as on bonds
>> themselves; linux bridges that must be able to process/pass BPDUs from
>> attached bonds when any kind of stp version is enabled on the network."
>>
>> It's a bit longer, but clarifies the reasons more precisely (without
>> going too deep into features like group_fwd_mask).
>>
>
> Anyway, any chance for that patch to get merged ? It would be great to
> get the correct functionality back asap. As for the comment, I'll submit
> a trivial patch expanding/clarifying it later (or I can resubmit
> adjusted v3 if it's ok with Mahesh).
Hmm, didn't notice that it wasn't merged but somehow it fell through
the cracks as it needed my attention earlier. I'll resubmit.

^ permalink raw reply

* Re: [PATCH] net/mlx4_core: print firmware version during driver loading
From: Leon Romanovsky @ 2018-09-14  4:43 UTC (permalink / raw)
  To: Qing Huang; +Cc: netdev, linux-rdma, linux-kernel, tariqt, davem
In-Reply-To: <20180914002514.27571-1-qing.huang@oracle.com>

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

On Thu, Sep 13, 2018 at 05:25:14PM -0700, Qing Huang wrote:
> When debugging firmware related issues, it's very helpful to have

      ^^^^^^^^^^ exactly, this is why we set this print as mlx4_dbg and
      not mlx4_info.

> the installed FW version info in the kernel log when the driver is
> loaded. It's easier to match error/warning messages with different
> FW versions in the log other than running a separate tool to get
> the information back and forth.
>
> Signed-off-by: Qing Huang <qing.huang@oracle.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/fw.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
> index babcfd9..e1c5218 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/fw.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
> @@ -1686,11 +1686,11 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev)
>  	MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET);
>  	cmd->max_cmds = 1 << lg;
>
> -	mlx4_dbg(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n",
> -		 (int) (dev->caps.fw_ver >> 32),
> -		 (int) (dev->caps.fw_ver >> 16) & 0xffff,
> -		 (int) dev->caps.fw_ver & 0xffff,
> -		 cmd_if_rev, cmd->max_cmds);
> +	mlx4_info(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n",
> +		  (int)(dev->caps.fw_ver >> 32),
> +		  (int)(dev->caps.fw_ver >> 16) & 0xffff,
> +		  (int)dev->caps.fw_ver & 0xffff,
> +		  cmd_if_rev, cmd->max_cmds);
>
>  	MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET);
>  	MLX4_GET(fw->catas_size,   outbox, QUERY_FW_ERR_SIZE_OFFSET);
> --
> 2.9.3
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply

* [PATCH] ieee802154: ca8210: remove redundant condition check before debugfs_remove
From: zhong jiang @ 2018-09-14  5:04 UTC (permalink / raw)
  To: stefan, h.morris, alex.aring, davem; +Cc: linux-wpan, netdev, linux-kernel

debugfs_remove has taken the IS_ERR into account. Just
remove the unnecessary condition.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/net/ieee802154/ca8210.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 58299fb..46b4818 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -3044,8 +3044,7 @@ static void ca8210_test_interface_clear(struct ca8210_priv *priv)
 {
 	struct ca8210_test *test = &priv->test;
 
-	if (!IS_ERR(test->ca8210_dfs_spi_int))
-		debugfs_remove(test->ca8210_dfs_spi_int);
+	debugfs_remove(test->ca8210_dfs_spi_int);
 	kfifo_free(&test->up_fifo);
 	dev_info(&priv->spi->dev, "Test interface removed\n");
 }
-- 
1.7.12.4

^ permalink raw reply related

* Re: Regression: kernel 4.14 an later very slow with many ipsec tunnels
From: Steffen Klassert @ 2018-09-14  5:06 UTC (permalink / raw)
  To: Florian Westphal
  Cc: David Miller, linux, netdev, linux-kernel, torvalds,
	christophe.gouault
In-Reply-To: <20180913210325.5usfj2rorvuvtyc7@breakpoint.cc>

On Thu, Sep 13, 2018 at 11:03:25PM +0200, Florian Westphal wrote:
> David Miller <davem@davemloft.net> wrote:
> > From: Florian Westphal <fw@strlen.de>
> > Date: Thu, 13 Sep 2018 18:38:48 +0200
> > 
> > > Wolfgang Walter <linux@stwm.de> wrote:
> > >> What I can say is that it depends mainly on number of policy rules and SA.
> > > 
> > > Thats already a good hint, I guess we're hitting long hash chains in
> > > xfrm_policy_lookup_bytype().
> > 
> > I don't really see how recent changes can influence that.
> 
> I don't think there is a recent change that did this.
> 
> Walter says < 4.14 is ok, so this is likely related to flow cache removal.
> 
> F.e. it looks like all prefixed policies end up in a linked list
> (net->xfrm.policy_inexact) and are not even in a hash table.
> 
> I am staring at b58555f1767c9f4e330fcf168e4e753d2d9196e0
> but can't figure out how to configure that away from the
> 'no hashing for prefixed policies' default or why we even have
> policy_inexact in first place :/

The hash threshold can be configured like this:

ip x p set hthresh4 0 0

This sets the hash threshold to local /0 and remote /0 netmasks.
With this configuration, all policies should go to the hashtable.
This might help to balance the hash chains better.

Default hash thresholds are local /32 and remote /32 netmasks, so
all prefixed policies go to the inexact list.

To view the configuration:

ip -s -s x p count

^ permalink raw reply

* Re: [PATCHv2] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG
From: zhong jiang @ 2018-09-14  5:13 UTC (permalink / raw)
  To: David Miller; +Cc: edumazet, kuznet, netdev, linux-kernel
In-Reply-To: <20180913.104254.1048729520825977993.davem@davemloft.net>

On 2018/9/14 1:42, David Miller wrote:
> From: zhong jiang <zhongjiang@huawei.com>
> Date: Tue, 11 Sep 2018 21:13:13 +0800
>
>> The if condition can be removed if we use BUG_ON directly.
>> The issule is detected with the help of Coccinelle.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> Taking Simon's feedback into consideration...
>
> I very often see changes like this and have to check the implementation
> of BUG_ON() et al. to make sure it evaluates it's arguments even when
> debugging is disabled.
>
> Even if it is always guaranteed to do so, like me people will be unsure
> forever and have to check.
>
> That makes auditing code and validating things more time consuming and
> hard.
>
> I also think the code as written now looks a lot nicer.
>
> So I'm not applying this, sorry.
>
> .
>
Get it.  Thank you for your explanation.

Sincerely,
zhong jiang

^ permalink raw reply

* Re: Regression: kernel 4.14 an later very slow with many ipsec tunnels
From: Florian Westphal @ 2018-09-14  5:54 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Florian Westphal, David Miller, linux, netdev, linux-kernel,
	torvalds, christophe.gouault
In-Reply-To: <20180914050651.GD23674@gauss3.secunet.de>

Steffen Klassert <steffen.klassert@secunet.com> wrote:
> On Thu, Sep 13, 2018 at 11:03:25PM +0200, Florian Westphal wrote:
> > David Miller <davem@davemloft.net> wrote:
> > > From: Florian Westphal <fw@strlen.de>
> > > Date: Thu, 13 Sep 2018 18:38:48 +0200
> > > 
> > > > Wolfgang Walter <linux@stwm.de> wrote:
> > > >> What I can say is that it depends mainly on number of policy rules and SA.
> > > > 
> > > > Thats already a good hint, I guess we're hitting long hash chains in
> > > > xfrm_policy_lookup_bytype().
> > > 
> > > I don't really see how recent changes can influence that.
> > 
> > I don't think there is a recent change that did this.
> > 
> > Walter says < 4.14 is ok, so this is likely related to flow cache removal.
> > 
> > F.e. it looks like all prefixed policies end up in a linked list
> > (net->xfrm.policy_inexact) and are not even in a hash table.
> > 
> > I am staring at b58555f1767c9f4e330fcf168e4e753d2d9196e0
> > but can't figure out how to configure that away from the
> > 'no hashing for prefixed policies' default or why we even have
> > policy_inexact in first place :/
> 
> The hash threshold can be configured like this:
> 
> ip x p set hthresh4 0 0
> 
> This sets the hash threshold to local /0 and remote /0 netmasks.
> With this configuration, all policies should go to the hashtable.

Yes, but won't they all be hashed to same bucket?

[ jhash(addr & 0, addr & 0) ] ?

> Default hash thresholds are local /32 and remote /32 netmasks, so
> all prefixed policies go to the inexact list.

Yes.

Wolfgang, before having to work on getting perf into your router image
can you perhaps share a bit of info about the policies you're using?

How many are there?  Are they prefixed or not ("10.1.2.1")?

^ permalink raw reply

* Re: Regression: kernel 4.14 an later very slow with many ipsec tunnels
From: Steffen Klassert @ 2018-09-14  6:01 UTC (permalink / raw)
  To: Florian Westphal
  Cc: David Miller, linux, netdev, linux-kernel, torvalds,
	christophe.gouault
In-Reply-To: <20180914055437.77pffp2jrbfnykbp@breakpoint.cc>

On Fri, Sep 14, 2018 at 07:54:37AM +0200, Florian Westphal wrote:
> Steffen Klassert <steffen.klassert@secunet.com> wrote:
> > On Thu, Sep 13, 2018 at 11:03:25PM +0200, Florian Westphal wrote:
> > > David Miller <davem@davemloft.net> wrote:
> > > > From: Florian Westphal <fw@strlen.de>
> > > > Date: Thu, 13 Sep 2018 18:38:48 +0200
> > > > 
> > > > > Wolfgang Walter <linux@stwm.de> wrote:
> > > > >> What I can say is that it depends mainly on number of policy rules and SA.
> > > > > 
> > > > > Thats already a good hint, I guess we're hitting long hash chains in
> > > > > xfrm_policy_lookup_bytype().
> > > > 
> > > > I don't really see how recent changes can influence that.
> > > 
> > > I don't think there is a recent change that did this.
> > > 
> > > Walter says < 4.14 is ok, so this is likely related to flow cache removal.
> > > 
> > > F.e. it looks like all prefixed policies end up in a linked list
> > > (net->xfrm.policy_inexact) and are not even in a hash table.
> > > 
> > > I am staring at b58555f1767c9f4e330fcf168e4e753d2d9196e0
> > > but can't figure out how to configure that away from the
> > > 'no hashing for prefixed policies' default or why we even have
> > > policy_inexact in first place :/
> > 
> > The hash threshold can be configured like this:
> > 
> > ip x p set hthresh4 0 0
> > 
> > This sets the hash threshold to local /0 and remote /0 netmasks.
> > With this configuration, all policies should go to the hashtable.
> 
> Yes, but won't they all be hashed to same bucket?
> 
> [ jhash(addr & 0, addr & 0) ] ?

Hm, yes. Maybe something between /0 and /32 makes more sense.

^ permalink raw reply

* Re: [PATCH] crypto: Adds user space interface for ALG_SET_KEY_TYPE
From: Herbert Xu @ 2018-09-14  6:03 UTC (permalink / raw)
  To: Kalyani Akula
  Cc: davem, kstewart, gregkh, tglx, pombredanne, linux-crypto,
	linux-kernel, netdev, saratcha, kalyani.akula
In-Reply-To: <1536302443-18380-1-git-send-email-kalyani.akula@xilinx.com>

Kalyani Akula <kalyani.akula@xilinx.com> wrote:
> ALG_SET_KEY_TYPE requires caller to pass the key_type to be used
> for AES encryption/decryption.
> 
> Sometimes the cipher key will be stored in the device's
> hardware (eFuse, BBRAM etc).So,there is a need to specify the information
> about the key-type to use it for Encrypt or Decrypt operations.
> 
> This patch implements the above requirement.
> 
> 
> Signed-off-by: Kalyani Akula <kalyani.akula@xilinx.com>

This patch does not make sense by itself.  Please post it together
with the patches that will make use of this.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH net-next v3 02/17] zinc: introduce minimal cryptography library
From: Ard Biesheuvel @ 2018-09-14  6:15 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: Andrew Lutomirski, LKML, Netdev, David Miller, Greg Kroah-Hartman,
	Samuel Neves, Jean-Philippe Aumasson, Linux Crypto Mailing List
In-Reply-To: <CAHmME9qjTyYpm_PsQ5_oZSfZBGa29zME1XHVak9F4Ued-qm67g@mail.gmail.com>

On 13 September 2018 at 17:58, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> On Thu, Sep 13, 2018 at 5:43 PM Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> I'd prefer it if all the accelerated software implementations live in
>> the same place. But I do strongly prefer arch code to live in
>> arch/$arch
>
> Zinc follows the scheme of the raid6 code, as well as of most other
> crypto libraries: code is grouped by cipher, making it easy for people
> to work with and understand differing implementations. It also allows
> us to trivially link these together at compile time rather than at
> link time, which makes cipher selection much more efficient. It's
> really much more maintainable this way.
>
>> I think AES-GCM is a useful example here. I really like the SIMD token
>> abstraction a lot, but I would like to understand how this would work
>> in Zinc if you have
>> a) a generic implementation
>> b) perhaps an arch specific scalar implementation
>> c) a pure NEON implementation
>> d) an implementation using AES instructions but not the PMULL instructions
>> e) an implementation that uses AES and PMULL instructions.
>
> The same way that Zinc currently chooses between the five different
> implementations for, say, x86_64 ChaCha20:
>
> - Generic C scalar
> - SSSE3
> - AVX2
> - AVX512F
> - AVX512VL
>
> We make a decision based on CPU capabilities, SIMD context, and input
> length, and then choose the right function.
>

OK, so given random.c's future dependency on Zinc (for ChaCha20), and
the fact that Zinc is one monolithic piece of code, all versions of
all algorithms will always be statically linked into the kernel
proper. I'm not sure that is acceptable.

>> You know what? If you're up for it, let's not wait until Plumbers, but
>> instead, let's collaborate off list to get this into shape.
>
> Sure, sounds good.
>

BTW you haven't answered my question yet about what happens when the
WireGuard protocol version changes: will we need a flag day and switch
all deployments over at the same time?

^ permalink raw reply

* [net-next, RFC PATCH] net: sched: cls_range: Introduce Range classifier
From: Amritha Nambiar @ 2018-09-13 20:52 UTC (permalink / raw)
  To: netdev, davem
  Cc: alexander.h.duyck, jakub.kicinski, amritha.nambiar,
	sridhar.samudrala, jhs, jesse.brandeburg, jiri, xiyou.wangcong
In-Reply-To: <153687160312.43503.11156697286063840163.stgit@anamhost.jf.intel.com>

This patch introduces a range classifier to support filtering based
on ranges. Only port-range filters are supported currently. This can
be combined with flower classifier to support filters that are a
combination of port-ranges and other parameters based on existing
fields supported by cls_flower.

Example:
1. Match on a port range:
-----------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 range\
ip_proto tcp dst_port 1-15 skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 range chain 0
filter protocol ip pref 2 range chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 34 sec used 2 sec
        Action statistics:
        Sent 1380 bytes 30 pkt (dropped 30, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 flower\
  dst_ip 192.168.1.1 skip_hw action goto chain 11

$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 chain 11\
  range ip_proto tcp dst_port 1-15 action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 flower chain 0
filter protocol ip pref 2 flower chain 0 handle 0x1
  eth_type ipv4
  dst_ip 192.168.1.1
  skip_hw
  not_in_hw
        action order 1: gact action goto chain 11
         random type none pass val 0
         index 1 ref 1 bind 1 installed 1426 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

filter protocol ip pref 2 range chain 11
filter protocol ip pref 2 range chain 11 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 1310 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
 include/uapi/linux/pkt_cls.h |   19 +
 net/sched/Kconfig            |   10 +
 net/sched/Makefile           |    1 
 net/sched/cls_range.c        |  725 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 755 insertions(+)
 create mode 100644 net/sched/cls_range.c

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 401d0c1..b2b68e6 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -379,6 +379,25 @@ enum {
 
 #define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
 
+/* RANGE classifier */
+
+enum {
+	TCA_RANGE_UNSPEC,
+	TCA_RANGE_CLASSID,		/* u32 */
+	TCA_RANGE_INDEV,
+	TCA_RANGE_ACT,
+	TCA_RANGE_KEY_ETH_TYPE,		/* be16 */
+	TCA_RANGE_KEY_IP_PROTO,		/* u8 */
+	TCA_RANGE_KEY_PORT_SRC_MIN,	/* be16 */
+	TCA_RANGE_KEY_PORT_SRC_MAX,	/* be16 */
+	TCA_RANGE_KEY_PORT_DST_MIN,	/* be16 */
+	TCA_RANGE_KEY_PORT_DST_MAX,	/* be16 */
+	TCA_RANGE_FLAGS,		/* u32 */
+	__TCA_RANGE_MAX,
+};
+
+#define TCA_RANGE_MAX (__TCA_RANGE_MAX - 1)
+
 /* Flower classifier */
 
 enum {
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index e957413..f68770d 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -585,6 +585,16 @@ config NET_CLS_FLOWER
 	  To compile this code as a module, choose M here: the module will
 	  be called cls_flower.
 
+config NET_CLS_RANGE
+	tristate "Range classifier"
+	select NET_CLS
+	help
+	  If you say Y here, you will be able to classify packets based on
+	  ranges with minimum and maximum values.
+
+	  To compile this code as a module, choose M here: the module will
+	  be called cls_range.
+
 config NET_CLS_MATCHALL
 	tristate "Match-all classifier"
 	select NET_CLS
diff --git a/net/sched/Makefile b/net/sched/Makefile
index f0403f4..d1f57a8 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_NET_CLS_FLOW)	+= cls_flow.o
 obj-$(CONFIG_NET_CLS_CGROUP)	+= cls_cgroup.o
 obj-$(CONFIG_NET_CLS_BPF)	+= cls_bpf.o
 obj-$(CONFIG_NET_CLS_FLOWER)	+= cls_flower.o
+obj-$(CONFIG_NET_CLS_RANGE)	+= cls_range.o
 obj-$(CONFIG_NET_CLS_MATCHALL)	+= cls_matchall.o
 obj-$(CONFIG_NET_EMATCH)	+= ematch.o
 obj-$(CONFIG_NET_EMATCH_CMP)	+= em_cmp.o
diff --git a/net/sched/cls_range.c b/net/sched/cls_range.c
new file mode 100644
index 0000000..2ed53c7
--- /dev/null
+++ b/net/sched/cls_range.c
@@ -0,0 +1,725 @@
+// SPDX-License-Identifier: GPL-2.0
+/* net/sched/cls_range.c		Range classifier
+ *
+ * Copyright (c) 2018 Amritha Nambiar <amritha.nambiar@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include <net/pkt_cls.h>
+#include <net/flow_dissector.h>
+
+struct range_flow_key {
+	int	indev_ifindex;
+	struct flow_dissector_key_control control;
+	struct flow_dissector_key_basic basic;
+	struct flow_dissector_key_ports tp;
+
+	/* Additional range fields should be added last */
+	struct flow_dissector_key_ports tp_min;
+	struct flow_dissector_key_ports tp_max;
+} __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs */
+
+struct range_flow_mask {
+	struct list_head filters; /* list of filters having this mask */
+	struct list_head list; /* masks list */
+	struct range_flow_key key;
+	struct flow_dissector dissector;
+};
+
+struct cls_range_head {
+	struct list_head filters;
+	struct list_head masks;
+	struct rcu_work rwork;
+	struct idr handle_idr;
+};
+
+struct cls_range_filter {
+	struct range_flow_mask *mask;
+	struct range_flow_key key;
+	struct range_flow_key mkey;
+	struct list_head flist; /* filters list in head */
+	struct list_head list; /* filters list in mask */
+	struct tcf_exts exts;
+	struct tcf_result res;
+	u32 handle;
+	u32 flags;
+	struct rcu_work rwork;
+};
+
+struct range_params {
+	__be16 min_mask;
+	__be16 max_mask;
+	__be16 min_val;
+	__be16 max_val;
+};
+
+enum range_port {
+	RANGE_PORT_DST,
+	RANGE_PORT_SRC
+};
+
+static void range_set_masked_key(struct range_flow_key *key,
+				 struct range_flow_mask *mask,
+				 struct range_flow_key *mkey)
+{
+	unsigned char *ckey, *cmask, *cmkey;
+	int i;
+
+	ckey = (unsigned char *)key;
+	cmask = (unsigned char *)&mask->key;
+	cmkey = (unsigned char *)mkey;
+
+	for (i = 0; i < sizeof(struct range_flow_key);
+	     i += sizeof(unsigned char))
+		*cmkey++ = *ckey++ & *cmask++;
+}
+
+static int range_compare_params(struct range_params *range,
+				struct cls_range_filter *filter,
+				struct range_flow_key *key,
+				enum range_port port)
+{
+	if (port == RANGE_PORT_DST) {
+		range->min_mask = htons(filter->mask->key.tp_min.dst);
+		range->max_mask = htons(filter->mask->key.tp_max.dst);
+		range->min_val = htons(filter->key.tp_min.dst);
+		range->max_val = htons(filter->key.tp_max.dst);
+
+		if (range->min_mask && range->max_mask) {
+			if (htons(key->tp.dst) < range->min_val ||
+			    htons(key->tp.dst) > range->max_val)
+				return -1;
+		}
+	} else {
+		range->min_mask = htons(filter->mask->key.tp_min.src);
+		range->max_mask = htons(filter->mask->key.tp_max.src);
+		range->min_val = htons(filter->key.tp_min.src);
+		range->max_val = htons(filter->key.tp_max.src);
+
+		if (range->min_mask && range->max_mask) {
+			if (htons(key->tp.src) < range->min_val ||
+			    htons(key->tp.src) > range->max_val)
+				return -1;
+		}
+	}
+	return 0;
+}
+
+#define RANGE_KEY_MEMBER_OFFSET(member) offsetof(struct range_flow_key, member)
+
+static struct cls_range_filter *range_lookup(struct cls_range_head *head,
+					     struct range_flow_key *key,
+					     struct range_flow_key *mkey,
+					     bool is_skb)
+{
+	struct cls_range_filter *filter, *next_filter;
+	struct range_params range;
+	int ret;
+	size_t cmp_size;
+
+	list_for_each_entry_safe(filter, next_filter, &head->filters, flist) {
+		if (!is_skb) {
+			/* Existing filter comparison */
+			cmp_size = sizeof(filter->mkey);
+		} else {
+			/* skb classification */
+			ret = range_compare_params(&range, filter, key,
+						   RANGE_PORT_DST);
+			if (ret < 0)
+				continue;
+
+			ret = range_compare_params(&range, filter, key,
+						   RANGE_PORT_SRC);
+			if (ret < 0)
+				continue;
+
+			/* skb does not have min and max values */
+			cmp_size = RANGE_KEY_MEMBER_OFFSET(tp_min);
+		}
+		if (!memcmp(mkey, &filter->mkey, cmp_size))
+			return filter;
+	}
+	return NULL;
+}
+
+static int range_classify(struct sk_buff *skb, const struct tcf_proto *tp,
+			  struct tcf_result *res)
+{
+	struct cls_range_head *head = rcu_dereference_bh(tp->root);
+	struct cls_range_filter *f;
+	struct range_flow_mask *mask;
+	struct range_flow_key skb_key, skb_mkey;
+
+	list_for_each_entry_rcu(mask, &head->masks, list) {
+		skb_key.indev_ifindex = skb->skb_iif;
+		skb_key.basic.n_proto = skb->protocol;
+		skb_flow_dissect(skb, &mask->dissector, &skb_key, 0);
+
+		range_set_masked_key(&skb_key, mask, &skb_mkey);
+		f = range_lookup(head, &skb_key, &skb_mkey, true);
+		if (f && !tc_skip_sw(f->flags)) {
+			*res = f->res;
+			return tcf_exts_exec(skb, &f->exts, res);
+		}
+	}
+	return -1;
+}
+
+static int range_init(struct tcf_proto *tp)
+{
+	struct cls_range_head *head;
+
+	head = kzalloc(sizeof(*head), GFP_KERNEL);
+	if (!head)
+		return -ENOBUFS;
+
+	INIT_LIST_HEAD_RCU(&head->masks);
+	rcu_assign_pointer(tp->root, head);
+	idr_init(&head->handle_idr);
+	INIT_LIST_HEAD_RCU(&head->filters);
+
+	return 0;
+}
+
+static void range_mask_free(struct range_flow_mask *mask)
+{
+	if (!list_empty(&mask->filters))
+		return;
+
+	list_del_rcu(&mask->list);
+	kfree(mask);
+}
+
+static void __range_destroy_filter(struct cls_range_filter *f)
+{
+	tcf_exts_destroy(&f->exts);
+	tcf_exts_put_net(&f->exts);
+	kfree(f);
+}
+
+static void range_destroy_filter_work(struct work_struct *work)
+{
+	struct cls_range_filter *f = container_of(to_rcu_work(work),
+						struct cls_range_filter, rwork);
+
+	rtnl_lock();
+	__range_destroy_filter(f);
+	rtnl_unlock();
+}
+
+static void __range_delete(struct tcf_proto *tp, struct cls_range_filter *f,
+			   struct netlink_ext_ack *extack)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+
+	idr_remove(&head->handle_idr, f->handle);
+	list_del_rcu(&f->list);
+	range_mask_free(f->mask);
+	tcf_unbind_filter(tp, &f->res);
+	if (tcf_exts_get_net(&f->exts))
+		tcf_queue_work(&f->rwork, range_destroy_filter_work);
+	else
+		__range_destroy_filter(f);
+}
+
+static int range_list_remove(struct cls_range_head *head,
+			     struct cls_range_filter *filter)
+{
+	if (!range_lookup(head, &filter->key, &filter->mkey, false))
+		return -EINVAL;
+
+	list_del_rcu(&filter->flist);
+	return 0;
+}
+
+static int range_delete(struct tcf_proto *tp, void *arg, bool *last,
+			struct netlink_ext_ack *extack)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+	struct cls_range_filter *f = arg;
+
+	if (!tc_skip_sw(f->flags))
+		range_list_remove(head, f);
+
+	__range_delete(tp, f, extack);
+	*last = list_empty(&head->masks);
+	return 0;
+}
+
+static void range_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+	struct range_flow_mask *mask, *next_mask;
+	struct cls_range_filter *f, *next;
+
+	list_for_each_entry_safe(mask, next_mask, &head->masks, list) {
+		list_for_each_entry_safe(f, next, &mask->filters, list) {
+			if (!tc_skip_sw(f->flags))
+				range_list_remove(head, f);
+			__range_delete(tp, f, extack);
+		}
+	}
+	idr_destroy(&head->handle_idr);
+
+	kfree(head);
+}
+
+static void *range_get(struct tcf_proto *tp, u32 handle)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+
+	return idr_find(&head->handle_idr, handle);
+}
+
+static const struct nla_policy range_policy[TCA_RANGE_MAX + 1] = {
+	[TCA_RANGE_UNSPEC]		= { .type = NLA_UNSPEC },
+	[TCA_RANGE_CLASSID]		= { .type = NLA_U32 },
+	[TCA_RANGE_INDEV]		= { .type = NLA_STRING,
+					    .len = IFNAMSIZ },
+	[TCA_RANGE_KEY_ETH_TYPE]	= { .type = NLA_U16 },
+	[TCA_RANGE_KEY_IP_PROTO]	= { .type = NLA_U8 },
+	[TCA_RANGE_KEY_PORT_SRC_MIN]	= { .type = NLA_U16 },
+	[TCA_RANGE_KEY_PORT_SRC_MAX]	= { .type = NLA_U16 },
+	[TCA_RANGE_KEY_PORT_DST_MIN]	= { .type = NLA_U16 },
+	[TCA_RANGE_KEY_PORT_DST_MAX]	= { .type = NLA_U16 },
+	[TCA_RANGE_FLAGS]		= { .type = NLA_U32 },
+};
+
+static void range_set_key_val(struct nlattr **tb, void *val, int val_type,
+			      void *mask, int mask_type, int len)
+{
+	if (!tb[val_type])
+		return;
+	memcpy(val, nla_data(tb[val_type]), len);
+	if (mask_type == TCA_RANGE_UNSPEC || !tb[mask_type])
+		memset(mask, 0xff, len);
+	else
+		memcpy(mask, nla_data(tb[mask_type]), len);
+}
+
+static int range_set_key(struct net *net, struct nlattr **tb,
+			 struct cls_range_filter *f,
+			 struct range_flow_mask *f_mask,
+			 struct netlink_ext_ack *extack)
+{
+	__be16 ethertype;
+	struct range_flow_key *key = &f->key;
+	struct range_flow_key *mask = &f_mask->key;
+
+#ifdef CONFIG_NET_CLS_IND
+	if (tb[TCA_RANGE_INDEV]) {
+		int err = tcf_change_indev(net, tb[TCA_RANGE_INDEV], extack);
+
+		if (err < 0)
+			return err;
+		key->indev_ifindex = err;
+		mask->indev_ifindex = 0xffffffff;
+	}
+#endif
+	if (tb[TCA_RANGE_KEY_ETH_TYPE]) {
+		ethertype = nla_get_be16(tb[TCA_RANGE_KEY_ETH_TYPE]);
+
+		if (!eth_type_vlan(ethertype)) {
+			key->basic.n_proto = ethertype;
+			mask->basic.n_proto = cpu_to_be16(~0);
+		}
+	}
+
+	if (key->basic.n_proto != htons(ETH_P_IP) &&
+	    key->basic.n_proto != htons(ETH_P_IPV6))
+		return -EINVAL;
+
+	range_set_key_val(tb, &key->basic.ip_proto,
+			  TCA_RANGE_KEY_IP_PROTO, &mask->basic.ip_proto,
+			  TCA_RANGE_UNSPEC,
+			  sizeof(key->basic.ip_proto));
+
+	if (key->basic.ip_proto != IPPROTO_TCP &&
+	    key->basic.ip_proto != IPPROTO_UDP &&
+	    key->basic.ip_proto != IPPROTO_SCTP)
+		return -EINVAL;
+
+	range_set_key_val(tb, &key->tp_min.dst,
+			  TCA_RANGE_KEY_PORT_DST_MIN, &mask->tp_min.dst,
+			  TCA_RANGE_UNSPEC, sizeof(key->tp_min.dst));
+	range_set_key_val(tb, &key->tp_max.dst,
+			  TCA_RANGE_KEY_PORT_DST_MAX, &mask->tp_max.dst,
+			  TCA_RANGE_UNSPEC, sizeof(key->tp_max.dst));
+	range_set_key_val(tb, &key->tp_min.src,
+			  TCA_RANGE_KEY_PORT_SRC_MIN, &mask->tp_min.src,
+			  TCA_RANGE_UNSPEC, sizeof(key->tp_min.src));
+	range_set_key_val(tb, &key->tp_max.src,
+			  TCA_RANGE_KEY_PORT_SRC_MAX, &mask->tp_max.src,
+			  TCA_RANGE_UNSPEC, sizeof(key->tp_max.src));
+	return 0;
+}
+
+#define RANGE_KEY_SET(keys, cnt, id, member)				\
+	do {								\
+		keys[cnt].key_id = id;					\
+		keys[cnt].offset = RANGE_KEY_MEMBER_OFFSET(member);	\
+		cnt++;							\
+	} while (0)
+
+static void range_init_dissector(struct flow_dissector *dissector)
+{
+	struct flow_dissector_key keys[FLOW_DISSECTOR_KEY_MAX];
+	size_t cnt = 0;
+
+	RANGE_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_CONTROL, control);
+	RANGE_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_BASIC, basic);
+	RANGE_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_PORTS, tp);
+
+	skb_flow_dissector_init(dissector, keys, cnt);
+}
+
+static int range_check_assign_mask(struct cls_range_head *head,
+				   struct cls_range_filter *fnew,
+				   struct cls_range_filter *fold,
+				   struct range_flow_mask *mask)
+{
+	struct range_flow_mask *imask, *next_mask;
+	struct range_flow_mask *newmask;
+
+	list_for_each_entry_safe(imask, next_mask, &head->masks, list) {
+		if (!memcmp(imask, mask, sizeof(struct range_flow_mask))) {
+			/* mask exists */
+			fnew->mask = imask;
+			break;
+		}
+	}
+	if (!fnew->mask) {
+		if (fold)
+			return -EINVAL;
+		newmask = kzalloc(sizeof(*newmask), GFP_KERNEL);
+		if (!newmask)
+			return -ENOMEM;
+		memcpy(newmask, mask, sizeof(struct range_flow_mask));
+
+		range_init_dissector(&newmask->dissector);
+		INIT_LIST_HEAD_RCU(&newmask->filters);
+		list_add_tail_rcu(&newmask->list, &head->masks);
+		fnew->mask = newmask;
+	} else if (fold && fold->mask != fnew->mask) {
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int range_set_parms(struct net *net, struct tcf_proto *tp,
+			   struct cls_range_filter *f,
+			   struct range_flow_mask *mask,
+			   unsigned long base, struct nlattr **tb,
+			   struct nlattr *est, bool ovr,
+			   struct netlink_ext_ack *extack)
+{
+	int err;
+
+	err = tcf_exts_validate(net, tp, tb, est, &f->exts, ovr, extack);
+	if (err < 0)
+		return err;
+
+	if (tb[TCA_RANGE_CLASSID]) {
+		f->res.classid = nla_get_u32(tb[TCA_RANGE_CLASSID]);
+		tcf_bind_filter(tp, &f->res, base);
+	}
+
+	err = range_set_key(net, tb, f, mask, extack);
+	if (err)
+		return err;
+
+	range_set_masked_key(&f->key, mask, &f->mkey);
+	return 0;
+}
+
+static int range_change(struct net *net, struct sk_buff *in_skb,
+			struct tcf_proto *tp, unsigned long base, u32 handle,
+			struct nlattr **tca, void **arg, bool ovr,
+			struct netlink_ext_ack *extack)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+	struct cls_range_filter *fold = *arg;
+	struct cls_range_filter *fnew;
+	struct nlattr **tb;
+	struct range_flow_mask mask = {};
+	int err;
+
+	if (!tca[TCA_OPTIONS])
+		return -EINVAL;
+
+	tb = kcalloc(TCA_RANGE_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL);
+	if (!tb)
+		return -ENOBUFS;
+
+	err = nla_parse_nested(tb, TCA_RANGE_MAX, tca[TCA_OPTIONS],
+			       range_policy, NULL);
+
+	if (err < 0)
+		goto errout_tb;
+
+	if (fold && handle && fold->handle != handle) {
+		err = -EINVAL;
+		goto errout_tb;
+	}
+
+	fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
+	if (!fnew) {
+		err = -ENOBUFS;
+		goto errout_tb;
+	}
+
+	err = tcf_exts_init(&fnew->exts, TCA_RANGE_ACT, 0);
+	if (err < 0)
+		goto errout;
+
+	if (!handle) {
+		handle = 1;
+		err = idr_alloc_u32(&head->handle_idr, fnew, &handle,
+				    INT_MAX, GFP_KERNEL);
+	} else if (!fold) {
+		/* user specifies a handle and it doesn't exist */
+		err = idr_alloc_u32(&head->handle_idr, fnew, &handle,
+				    handle, GFP_KERNEL);
+	}
+	if (err)
+		goto errout;
+	fnew->handle = handle;
+
+	if (tb[TCA_RANGE_FLAGS]) {
+		fnew->flags = nla_get_u32(tb[TCA_RANGE_FLAGS]);
+
+		if (!tc_flags_valid(fnew->flags)) {
+			err = -EINVAL;
+			goto errout_idr;
+		}
+	}
+
+	/* Only SW rules are supported now */
+	if (tc_skip_sw(fnew->flags)) {
+		err = -EINVAL;
+		goto errout_idr;
+	}
+
+	err = range_set_parms(net, tp, fnew, &mask, base, tb, tca[TCA_RATE],
+			      ovr, extack);
+	if (err)
+		goto errout_idr;
+
+	err = range_check_assign_mask(head, fnew, fold, &mask);
+	if (err)
+		goto errout_idr;
+
+	/* Add the rule into list for SW filters */
+	if (!fold && range_lookup(head, &fnew->key, &fnew->mkey, false)) {
+		err = -EEXIST;
+		goto errout_mask;
+	}
+	list_add_tail_rcu(&fnew->flist, &head->filters);
+
+	if (!tc_in_hw(fnew->flags))
+		fnew->flags |= TCA_CLS_FLAGS_NOT_IN_HW;
+
+	*arg = fnew;
+
+	if (fold) {
+		range_list_remove(head, fold);
+
+		idr_replace(&head->handle_idr, fnew, fnew->handle);
+		list_replace_rcu(&fold->list, &fnew->list);
+		tcf_unbind_filter(tp, &fold->res);
+		tcf_exts_get_net(&fold->exts);
+		tcf_queue_work(&fold->rwork, range_destroy_filter_work);
+	} else {
+		list_add_tail_rcu(&fnew->list, &fnew->mask->filters);
+	}
+
+	kfree(tb);
+	return 0;
+
+errout_mask:
+	range_mask_free(fnew->mask);
+errout_idr:
+	if (!fold)
+		idr_remove(&head->handle_idr, fnew->handle);
+errout:
+	tcf_exts_destroy(&fnew->exts);
+	kfree(fnew);
+errout_tb:
+	kfree(tb);
+	return err;
+}
+
+static void range_walk(struct tcf_proto *tp, struct tcf_walker *arg)
+{
+	struct cls_range_head *head = rtnl_dereference(tp->root);
+	struct cls_range_filter *f;
+
+	arg->count = arg->skip;
+
+	while ((f = idr_get_next_ul(&head->handle_idr, &arg->cookie)) != NULL) {
+		if (arg->fn(tp, f, arg) < 0) {
+			arg->stop = 1;
+			break;
+		}
+		arg->cookie = f->handle + 1;
+		arg->count++;
+	}
+}
+
+static int range_dump_key_val(struct sk_buff *skb, void *val, int val_type,
+			      void *mask, int mask_type, int len)
+{
+	int err;
+
+	if (!memchr_inv(mask, 0, len))
+		return 0;
+	err = nla_put(skb, val_type, len, val);
+
+	if (err)
+		return err;
+	if (mask_type != TCA_RANGE_UNSPEC) {
+		err = nla_put(skb, mask_type, len, mask);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
+static int range_dump_key(struct sk_buff *skb, struct net *net,
+			  struct range_flow_key *key,
+			  struct range_flow_key *mask)
+{
+	if (mask->indev_ifindex) {
+		struct net_device *dev;
+
+		dev = __dev_get_by_index(net, key->indev_ifindex);
+		if (dev && nla_put_string(skb, TCA_RANGE_INDEV, dev->name))
+			goto nla_put_failure;
+	}
+
+	if (range_dump_key_val(skb, &key->basic.n_proto, TCA_RANGE_KEY_ETH_TYPE,
+			       &mask->basic.n_proto, TCA_RANGE_UNSPEC,
+			       sizeof(key->basic.n_proto)))
+		goto nla_put_failure;
+
+	if ((key->basic.n_proto != htons(ETH_P_IP) &&
+	     key->basic.n_proto != htons(ETH_P_IPV6)) ||
+	    (key->basic.ip_proto != IPPROTO_TCP &&
+	     key->basic.ip_proto != IPPROTO_UDP &&
+	     key->basic.ip_proto != IPPROTO_SCTP))
+		return -EINVAL;
+
+	if (range_dump_key_val(skb, &key->basic.ip_proto,
+			       TCA_RANGE_KEY_IP_PROTO, &mask->basic.ip_proto,
+			       TCA_RANGE_UNSPEC,
+			       sizeof(key->basic.ip_proto)))
+		goto nla_put_failure;
+
+	if (range_dump_key_val(skb, &key->tp_min.src,
+			       TCA_RANGE_KEY_PORT_SRC_MIN, &mask->tp_min.src,
+			       TCA_RANGE_UNSPEC, sizeof(key->tp_min.src)) ||
+	    range_dump_key_val(skb, &key->tp_max.src,
+			       TCA_RANGE_KEY_PORT_SRC_MAX, &mask->tp_max.src,
+			       TCA_RANGE_UNSPEC, sizeof(key->tp_max.src)) ||
+	    range_dump_key_val(skb, &key->tp_min.dst,
+			       TCA_RANGE_KEY_PORT_DST_MIN, &mask->tp_min.dst,
+			       TCA_RANGE_UNSPEC, sizeof(key->tp_min.dst)) ||
+	    range_dump_key_val(skb, &key->tp_max.dst,
+			       TCA_RANGE_KEY_PORT_DST_MAX, &mask->tp_max.dst,
+			       TCA_RANGE_UNSPEC, sizeof(key->tp_max.dst)))
+		goto nla_put_failure;
+
+	return 0;
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static int range_dump(struct net *net, struct tcf_proto *tp, void *fh,
+		      struct sk_buff *skb, struct tcmsg *t)
+{
+	struct cls_range_filter *f = fh;
+	struct nlattr *nest;
+	struct range_flow_key *key, *mask;
+
+	if (!f)
+		return skb->len;
+
+	t->tcm_handle = f->handle;
+
+	nest = nla_nest_start(skb, TCA_OPTIONS);
+	if (!nest)
+		goto nla_put_failure;
+
+	if (f->res.classid &&
+	    nla_put_u32(skb, TCA_RANGE_CLASSID, f->res.classid))
+		goto nla_put_failure;
+
+	key = &f->key;
+	mask = &f->mask->key;
+
+	if (range_dump_key(skb, net, key, mask))
+		goto nla_put_failure;
+
+	if (f->flags && nla_put_u32(skb, TCA_RANGE_FLAGS, f->flags))
+		goto nla_put_failure;
+
+	if (tcf_exts_dump(skb, &f->exts))
+		goto nla_put_failure;
+
+	nla_nest_end(skb, nest);
+
+	if (tcf_exts_dump_stats(skb, &f->exts) < 0)
+		goto nla_put_failure;
+
+	return skb->len;
+
+nla_put_failure:
+	nla_nest_cancel(skb, nest);
+	return -1;
+}
+
+static void range_bind_class(void *fh, u32 classid, unsigned long cl)
+{
+	struct cls_range_filter *f = fh;
+
+	if (f && f->res.classid == classid)
+		f->res.class = cl;
+}
+
+static struct tcf_proto_ops cls_range_ops __read_mostly = {
+	.kind		= "range",
+	.classify	= range_classify,
+	.init		= range_init,
+	.destroy	= range_destroy,
+	.get		= range_get,
+	.change		= range_change,
+	.delete		= range_delete,
+	.walk		= range_walk,
+	.dump		= range_dump,
+	.bind_class	= range_bind_class,
+	.owner		= THIS_MODULE,
+};
+
+static int __init cls_range_init(void)
+{
+	return register_tcf_proto_ops(&cls_range_ops);
+}
+
+static void __exit cls_range_exit(void)
+{
+	unregister_tcf_proto_ops(&cls_range_ops);
+}
+
+module_init(cls_range_init);
+module_exit(cls_range_exit);
+
+MODULE_AUTHOR("Amritha Nambiar <amritha.nambiar@intel.com>");
+MODULE_DESCRIPTION("Range classifier");
+MODULE_LICENSE("GPL");

^ permalink raw reply related

* [net-next,RFC PATCH] Introduce TC Range classifier
From: Amritha Nambiar @ 2018-09-13 20:52 UTC (permalink / raw)
  To: netdev, davem
  Cc: alexander.h.duyck, jakub.kicinski, amritha.nambiar,
	sridhar.samudrala, jhs, jesse.brandeburg, jiri, xiyou.wangcong

This patch introduces a TC range classifier to support filtering based
on ranges. Only port-range filters are supported currently. This can
be combined with flower classifier to support filters that are a
combination of port-ranges and other parameters based on existing
fields supported by cls_flower. The 'goto chain' action can be used to
combine the flower and range filter.
The filter precedence is decided based on the 'prio' value.

Example:
1. Match on a port range:
-----------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 range\
ip_proto tcp dst_port 1-15 skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 range chain 0
filter protocol ip pref 2 range chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 34 sec used 2 sec
        Action statistics:
        Sent 1380 bytes 30 pkt (dropped 30, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 flower\
  dst_ip 192.168.1.1 skip_hw action goto chain 11

$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 chain 11\
  range ip_proto tcp dst_port 1-15 action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 flower chain 0
filter protocol ip pref 2 flower chain 0 handle 0x1
  eth_type ipv4
  dst_ip 192.168.1.1
  skip_hw
  not_in_hw
        action order 1: gact action goto chain 11
         random type none pass val 0
         index 1 ref 1 bind 1 installed 1426 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

filter protocol ip pref 2 range chain 11
filter protocol ip pref 2 range chain 11 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 1310 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0
---

Amritha Nambiar (1):
      net: sched: cls_range: Introduce Range classifier


 include/uapi/linux/pkt_cls.h |   19 +
 net/sched/Kconfig            |   10 +
 net/sched/Makefile           |    1 
 net/sched/cls_range.c        |  725 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 755 insertions(+)
 create mode 100644 net/sched/cls_range.c

^ permalink raw reply

* [iproute2,RFC PATCH] tc: range: Introduce TC range classifier
From: Amritha Nambiar @ 2018-09-13 20:54 UTC (permalink / raw)
  To: stephen, netdev
  Cc: alexander.h.duyck, jakub.kicinski, amritha.nambiar,
	sridhar.samudrala, jhs, jesse.brandeburg, jiri, xiyou.wangcong

Range classifier is introduced to support filters based
on ranges. Only port-range filters are supported currently.
This can be combined with flower classifier to support a
combination of port-ranges and other parameters based
on existing fields supported by cls_flower.

Example:
1. Match on a port range:
-----------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 range\
ip_proto tcp dst_port 1-15 skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 range chain 0
filter protocol ip pref 2 range chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 34 sec used 2 sec
        Action statistics:
        Sent 1380 bytes 30 pkt (dropped 30, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 flower\
  dst_ip 192.168.1.1 skip_hw action goto chain 11

$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 chain 11\
  range ip_proto tcp dst_port 1-15 action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 flower chain 0
filter protocol ip pref 2 flower chain 0 handle 0x1
  eth_type ipv4
  dst_ip 192.168.1.1
  skip_hw
  not_in_hw
        action order 1: gact action goto chain 11
         random type none pass val 0
         index 1 ref 1 bind 1 installed 1426 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

filter protocol ip pref 2 range chain 11
filter protocol ip pref 2 range chain 11 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 1310 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
 include/uapi/linux/pkt_cls.h |   19 ++
 tc/Makefile                  |    1 
 tc/f_range.c                 |  369 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 389 insertions(+)
 create mode 100644 tc/f_range.c

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index be382fb..8ef3a5a 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -379,6 +379,25 @@ enum {
 
 #define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
 
+/* RANGE classifier */
+
+enum {
+	TCA_RANGE_UNSPEC,
+	TCA_RANGE_CLASSID,		/* u32 */
+	TCA_RANGE_INDEV,
+	TCA_RANGE_ACT,
+	TCA_RANGE_KEY_ETH_TYPE,		/* be16 */
+	TCA_RANGE_KEY_IP_PROTO,		/* u8 */
+	TCA_RANGE_KEY_PORT_SRC_MIN,	/* be16 */
+	TCA_RANGE_KEY_PORT_SRC_MAX,	/* be16 */
+	TCA_RANGE_KEY_PORT_DST_MIN,	/* be16 */
+	TCA_RANGE_KEY_PORT_DST_MAX,	/* be16 */
+	TCA_RANGE_FLAGS,		/* u32 */
+	__TCA_RANGE_MAX,
+};
+
+#define TCA_RANGE_MAX (__TCA_RANGE_MAX - 1)
+
 /* Flower classifier */
 
 enum {
diff --git a/tc/Makefile b/tc/Makefile
index 5a1a7ff..155cabe 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -29,6 +29,7 @@ TCMODULES += f_bpf.o
 TCMODULES += f_flow.o
 TCMODULES += f_cgroup.o
 TCMODULES += f_flower.o
+TCMODULES += f_range.o
 TCMODULES += q_dsmark.o
 TCMODULES += q_gred.o
 TCMODULES += f_tcindex.o
diff --git a/tc/f_range.c b/tc/f_range.c
new file mode 100644
index 0000000..388b275
--- /dev/null
+++ b/tc/f_range.c
@@ -0,0 +1,369 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * f_range.c		Range Classifier
+ *
+ *		This program is free software; you can distribute it and/or
+ *		modify it under the terms of the GNU General Public License
+ *		as published by the Free Software Foundation; either version
+ *		2 of the License, or (at your option) any later version.
+ *
+ * Authors:	Amritha Nambiar <amritha.nambiar@intel.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <linux/if_arp.h>
+
+#include "utils.h"
+#include "tc_util.h"
+
+enum range_type {
+	RANGE_PORT_SRC,
+	RANGE_PORT_DST
+};
+
+struct range_values {
+	__be16 min_port_type;
+	__be16 max_port_type;
+};
+
+static void explain(void)
+{
+	fprintf(stderr, "Usage: ... range [ MATCH-LIST ]\n");
+	fprintf(stderr, "		  [skip_sw | skip_hw]\n");
+	fprintf(stderr, "                 [ action ACTION_SPEC ] [ classid CLASSID ]\n");
+	fprintf(stderr, "\n");
+	fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n");
+	fprintf(stderr, "       FILTERID := X:Y:Z\n");
+	fprintf(stderr, "       ACTION_SPEC := ... look at individual actions\n");
+	fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n");
+}
+
+static int range_parse_ip_proto(char *str, __be16 eth_type, int type,
+				__u8 *p_ip_proto, struct nlmsghdr *n)
+{
+	int ret;
+	__u8 ip_proto;
+
+	if (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6))
+		goto err;
+
+	if (matches(str, "tcp") == 0) {
+		ip_proto = IPPROTO_TCP;
+	} else if (matches(str, "udp") == 0) {
+		ip_proto = IPPROTO_UDP;
+	} else if (matches(str, "sctp") == 0) {
+		ip_proto = IPPROTO_SCTP;
+	} else if (matches(str, "icmp") == 0) {
+		if (eth_type != htons(ETH_P_IP))
+			goto err;
+		ip_proto = IPPROTO_ICMP;
+	} else if (matches(str, "icmpv6") == 0) {
+		if (eth_type != htons(ETH_P_IPV6))
+			goto err;
+		ip_proto = IPPROTO_ICMPV6;
+	} else {
+		ret = get_u8(&ip_proto, str, 16);
+		if (ret)
+			return -1;
+	}
+	addattr8(n, MAX_MSG, type, ip_proto);
+	*p_ip_proto = ip_proto;
+	return 0;
+
+err:
+	fprintf(stderr, "Illegal \"eth_type\" for ip proto\n");
+	return -1;
+}
+
+static int range_port_attr_type(__u8 ip_proto, enum range_type type,
+				struct range_values *range)
+{
+	if (ip_proto == IPPROTO_TCP || ip_proto == IPPROTO_UDP ||
+	    ip_proto == IPPROTO_SCTP) {
+		if (type == RANGE_PORT_SRC) {
+			range->min_port_type = TCA_RANGE_KEY_PORT_SRC_MIN;
+			range->max_port_type = TCA_RANGE_KEY_PORT_SRC_MAX;
+		} else {
+			range->min_port_type = TCA_RANGE_KEY_PORT_DST_MIN;
+			range->max_port_type = TCA_RANGE_KEY_PORT_DST_MAX;
+		}
+	} else {
+		return -1;
+	}
+
+	return 0;
+}
+
+static int range_parse_port_range(__be16 *min, __be16 *max, __u8 ip_proto,
+				  enum range_type type, struct nlmsghdr *n)
+{
+	struct range_values range;
+
+	range_port_attr_type(ip_proto, type, &range);
+
+	addattr16(n, MAX_MSG, range.min_port_type, *min);
+	addattr16(n, MAX_MSG, range.max_port_type, *max);
+
+	return 0;
+}
+
+static int get_range(__be16 *min, __be16 *max, char *argv)
+{
+	char *r;
+
+	r = strchr(argv, '-');
+	if (r) {
+		*r = '\0';
+		if (get_be16(min, argv, 10)) {
+			fprintf(stderr, "invalid min range\n");
+			return -1;
+		}
+		if (get_be16(max, r + 1, 10)) {
+			fprintf(stderr, "invalid max range\n");
+			return -1;
+		}
+	} else {
+		fprintf(stderr, "Illegal range format\n");
+		return -1;
+	}
+	return 0;
+}
+
+static int range_parse_opt(struct filter_util *qu, char *handle,
+			   int argc, char **argv, struct nlmsghdr *n)
+{
+	struct tcmsg *t = NLMSG_DATA(n);
+	struct rtattr *tail;
+	__be16 eth_type = TC_H_MIN(t->tcm_info);
+	__u8 ip_proto = 0xff;
+	__u32 flags = 0;
+	int ret;
+
+	if (handle) {
+		ret = get_u32(&t->tcm_handle, handle, 0);
+		if (ret) {
+			fprintf(stderr, "Illegal \"handle\"\n");
+			return -1;
+		}
+	}
+
+	tail = (struct rtattr *)(((void *)n) + NLMSG_ALIGN(n->nlmsg_len));
+	addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
+
+	if (argc == 0) {
+		/*at minimal we will match all ethertype packets */
+		goto parse_done;
+	}
+
+	while (argc > 0) {
+		if (matches(*argv, "classid") == 0 ||
+		    strcmp(*argv, "flowid") == 0) {
+			unsigned int handle;
+
+			NEXT_ARG();
+			ret = get_tc_classid(&handle, *argv);
+			if (ret) {
+				fprintf(stderr, "Illegal \"classid\"\n");
+				return -1;
+			}
+			addattr_l(n, MAX_MSG, TCA_RANGE_CLASSID, &handle, 4);
+		} else if (matches(*argv, "ip_proto") == 0) {
+			NEXT_ARG();
+			ret = range_parse_ip_proto(*argv, eth_type,
+						   TCA_RANGE_KEY_IP_PROTO,
+						   &ip_proto, n);
+			if (ret < 0) {
+				fprintf(stderr, "Illegal \"ip_proto\"\n");
+				return -1;
+			}
+		} else if (matches(*argv, "dst_port") == 0) {
+			__be16 min, max;
+
+			NEXT_ARG();
+			ret = get_range(&min, &max, *argv);
+			if (ret < 0)
+				return -1;
+			ret = range_parse_port_range(&min, &max, ip_proto,
+						     RANGE_PORT_DST, n);
+			if (ret < 0) {
+				fprintf(stderr, "Illegal \"dst_port range\"\n");
+				return -1;
+			}
+		} else if (matches(*argv, "src_port") == 0) {
+			__be16 min, max;
+
+			NEXT_ARG();
+			ret = get_range(&min, &max, *argv);
+			if (ret < 0)
+				return -1;
+			ret = range_parse_port_range(&min, &max, ip_proto,
+						     RANGE_PORT_SRC, n);
+			if (ret < 0) {
+				fprintf(stderr, "Illegal \"src_port range\"\n");
+				return -1;
+			}
+		} else if (matches(*argv, "skip_hw") == 0) {
+			flags |= TCA_CLS_FLAGS_SKIP_HW;
+		} else if (matches(*argv, "skip_sw") == 0) {
+			flags |= TCA_CLS_FLAGS_SKIP_SW;
+		} else if (matches(*argv, "action") == 0) {
+			NEXT_ARG();
+			if (parse_action(&argc, &argv, TCA_RANGE_ACT, n)) {
+				fprintf(stderr, "Illegal \"action\"\n");
+				return -1;
+			}
+			continue;
+		} else if (strcmp(*argv, "help") == 0) {
+			explain();
+			return -1;
+		} else {
+			fprintf(stderr, "What is \"%s\"?\n", *argv);
+			explain();
+			return -1;
+		}
+		argc--; argv++;
+	}
+parse_done:
+	ret = addattr32(n, MAX_MSG, TCA_RANGE_FLAGS, flags);
+	if (ret)
+		return ret;
+
+	if (eth_type != htons(ETH_P_ALL)) {
+		ret = addattr16(n, MAX_MSG, TCA_RANGE_KEY_ETH_TYPE, eth_type);
+		if (ret)
+			return ret;
+	}
+
+	tail->rta_len = (((void *)n) + n->nlmsg_len) - (void *)tail;
+	return 0;
+}
+
+static void range_print_eth_type(__be16 *p_eth_type,
+				 struct rtattr *eth_type_attr)
+{
+	SPRINT_BUF(out);
+	__be16 eth_type;
+
+	if (!eth_type_attr)
+		return;
+
+	eth_type = rta_getattr_u16(eth_type_attr);
+	if (eth_type == htons(ETH_P_IP))
+		sprintf(out, "ipv4");
+	else if (eth_type == htons(ETH_P_IPV6))
+		sprintf(out, "ipv6");
+	else if (eth_type == htons(ETH_P_ARP))
+		sprintf(out, "arp");
+	else if (eth_type == htons(ETH_P_RARP))
+		sprintf(out, "rarp");
+	else
+		sprintf(out, "%04x", ntohs(eth_type));
+
+	print_string(PRINT_ANY, "eth_type", "\n  eth_type %s", out);
+	*p_eth_type = eth_type;
+}
+
+static void range_print_ip_proto(__u8 *p_ip_proto, struct rtattr *ip_proto_attr)
+{
+	SPRINT_BUF(out);
+	__u8 ip_proto;
+
+	if (!ip_proto_attr)
+		return;
+
+	ip_proto = rta_getattr_u8(ip_proto_attr);
+	if (ip_proto == IPPROTO_TCP)
+		sprintf(out, "tcp");
+	else if (ip_proto == IPPROTO_UDP)
+		sprintf(out, "udp");
+	else if (ip_proto == IPPROTO_SCTP)
+		sprintf(out, "sctp");
+	else if (ip_proto == IPPROTO_ICMP)
+		sprintf(out, "icmp");
+	else if (ip_proto == IPPROTO_ICMPV6)
+		sprintf(out, "icmpv6");
+	else
+		sprintf(out, "%02x", ip_proto);
+
+	print_string(PRINT_ANY, "ip_proto", "\n  ip_proto %s", out);
+	*p_ip_proto = ip_proto;
+}
+
+static void range_print_port_range(char *name, struct rtattr *attr)
+{
+	SPRINT_BUF(namefrm);
+
+	if (!attr)
+		return;
+
+	sprintf(namefrm, "\n  %s %%u", name);
+	print_uint(PRINT_ANY, name, namefrm, rta_getattr_be16(attr));
+}
+
+static int range_print_opt(struct filter_util *qu, FILE *f,
+			   struct rtattr *opt, __u32 handle)
+{
+	struct rtattr *tb[TCA_RANGE_MAX + 1];
+	struct range_values range;
+	__be16 eth_type = 0;
+	__u8 ip_proto = 0xff;
+
+	if (!opt)
+		return 0;
+
+	parse_rtattr_nested(tb, TCA_RANGE_MAX, opt);
+
+	if (handle)
+		print_uint(PRINT_ANY, "handle", "handle 0x%x ", handle);
+
+	if (tb[TCA_RANGE_CLASSID]) {
+		__u32 h = rta_getattr_u32(tb[TCA_RANGE_CLASSID]);
+
+		SPRINT_BUF(b1);
+		print_string(PRINT_ANY, "classid", "classid %s ",
+			     sprint_tc_classid(h, b1));
+	}
+
+	range_print_eth_type(&eth_type, tb[TCA_RANGE_KEY_ETH_TYPE]);
+	range_print_ip_proto(&ip_proto, tb[TCA_RANGE_KEY_IP_PROTO]);
+
+	if (range_port_attr_type(ip_proto, RANGE_PORT_DST, &range) == 0) {
+		range_print_port_range("dst_port_min", tb[range.min_port_type]);
+		range_print_port_range("dst_port_max", tb[range.max_port_type]);
+	}
+
+	if (range_port_attr_type(ip_proto, RANGE_PORT_SRC, &range) == 0) {
+		range_print_port_range("src_port_min", tb[range.min_port_type]);
+		range_print_port_range("src_port_max", tb[range.max_port_type]);
+	}
+
+	if (tb[TCA_RANGE_FLAGS]) {
+		__u32 flags = rta_getattr_u32(tb[TCA_RANGE_FLAGS]);
+
+		if (flags & TCA_CLS_FLAGS_SKIP_HW)
+			print_bool(PRINT_ANY, "skip_hw", "\n  skip_hw", true);
+		if (flags & TCA_CLS_FLAGS_SKIP_SW)
+			print_bool(PRINT_ANY, "skip_sw", "\n  skip_sw", true);
+
+		if (flags & TCA_CLS_FLAGS_IN_HW)
+			print_bool(PRINT_ANY, "in_hw", "\n  in_hw", true);
+		else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
+			print_bool(PRINT_ANY, "not_in_hw", "\n  not_in_hw",
+				   true);
+	}
+
+	if (tb[TCA_RANGE_ACT])
+		tc_print_action(f, tb[TCA_RANGE_ACT], 0);
+
+	return 0;
+}
+
+struct filter_util range_filter_util = {
+	.id = "range",
+	.parse_fopt = range_parse_opt,
+	.print_fopt = range_print_opt,
+};

^ permalink raw reply related

* Re: unexpected GRO/veth behavior
From: Toshiaki Makita @ 2018-09-14  2:51 UTC (permalink / raw)
  To: Eric Dumazet, Paolo Abeni, netdev
In-Reply-To: <3c396829-61b4-f4ca-6b30-1ac8ff99c7b4@lab.ntt.co.jp>

On 2018/09/11 20:07, Toshiaki Makita wrote:
> On 2018/09/11 19:27, Eric Dumazet wrote:
> ...
>> Fix would probably be :
>>
>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>> index 8d679c8b7f25c753d77cfb8821d9d2528c9c9048..96bd94480942b469403abf017f9f9d5be1e23ef5 100644
>> --- a/drivers/net/veth.c
>> +++ b/drivers/net/veth.c
>> @@ -602,9 +602,10 @@ static int veth_xdp_rcv(struct veth_rq *rq, int budget, unsigned int *xdp_xmit)
>>                         skb = veth_xdp_rcv_skb(rq, ptr, xdp_xmit);
>>                 }
>>  
>> -               if (skb)
>> +               if (skb) {
>> +                       skb_orphan(skb);
>>                         napi_gro_receive(&rq->xdp_napi, skb);
>> -
>> +               }
>>                 done++;
>>         }
> 
> Considering commit 9c4c3252 ("skbuff: preserve sock reference when
> scrubbing the skb.") I'm not sure if we should unconditionally orphan
> the skb here.
> I was thinking I should call netif_receive_skb() for such packets
> instead of napi_gro_receive().

I tested TCP throughput within localhost with XDP enabled (with
skb_orphan() fix).

GRO off: 4.7 Gbps
GRO on : 6.7 Gbps

Since there is not-so-small difference, I'm making a patch which orphan
the skb as Eric suggested (but in veth_xdp_rcv_skb() instead).

Thanks!

-- 
Toshiaki Makita

^ permalink raw reply

* [PATCH net-next v3 00/11] mscc: ocelot: add support for SerDes muxing configuration
From: Quentin Schulz @ 2018-09-14  8:15 UTC (permalink / raw)
  To: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, kishon, andrew, f.fainelli
  Cc: allan.nielsen, linux-mips, devicetree, linux-kernel, netdev,
	thomas.petazzoni, Quentin Schulz

The Ocelot switch has currently an hardcoded SerDes muxing that suits only
a particular use case. Any other board setup will fail to work.

To prepare for upcoming boards' support that do not have the same muxing,
create a PHY driver that will handle all possible cases.

A SerDes can work in SGMII, QSGMII or PCIe and is also muxed to use a
given port depending on the selected mode or board design.

The SerDes configuration is in the middle of an address space (HSIO) that
is used to configure some parts in the MAC controller driver, that is why
we need to use a syscon so that we can write to the same address space from
different drivers safely using regmap.

This breaks backward compatibility but it's fine because there's only one
board at the moment that is using what's modified in this patch series.
This will break git bisect.

Even though this patch series is about SerDes __muxing__ configuration, the
DT node is named serdes for the simple reason that I couldn't find any
mention to SerDes anywhere else from the address space handled by this
driver.

Thanks,
Quentin

v3:
  - add Paul Burton's Acked-By on MIPS patches so that the patch series can
  be merged in the net tree in its entirety,

v2:
  - use a switch case for setting the phy_mode in the SerDes driver as
  suggested by Andrew,
  - stop replacing the value of the error pointer in the SerDes driver,
  - use a dev_dbg for the deferring of the probe in the SerDes driver,
  - use constants in the Device Tree to select the SerDes macro in use with
  a port,
  - adapt the SerDes driver to use those constants,
  - add a header file in include/dt-bindings for the constants,
  - fix space/tab issue,

Quentin Schulz (11):
  MIPS: mscc: ocelot: make HSIO registers address range a syscon
  dt-bindings: net: ocelot: remove hsio from the list of register address spaces
  net: mscc: ocelot: get HSIO regmap from syscon
  net: mscc: ocelot: move the HSIO header to include/soc
  net: mscc: ocelot: simplify register access for PLL5 configuration
  phy: add QSGMII and PCIE modes
  dt-bindings: phy: add DT binding for Microsemi Ocelot SerDes muxing
  MIPS: mscc: ocelot: add SerDes mux DT node
  dt-bindings: add constants for Microsemi Ocelot SerDes driver
  phy: add driver for Microsemi Ocelot SerDes muxing
  net: mscc: ocelot: make use of SerDes PHYs for handling their configuration

 Documentation/devicetree/bindings/mips/mscc.txt             |  16 +-
 Documentation/devicetree/bindings/net/mscc-ocelot.txt       |   9 +-
 Documentation/devicetree/bindings/phy/phy-ocelot-serdes.txt |  40 +-
 arch/mips/boot/dts/mscc/ocelot.dtsi                         |  19 +-
 drivers/net/ethernet/mscc/Kconfig                           |   2 +-
 drivers/net/ethernet/mscc/ocelot.c                          |  16 +-
 drivers/net/ethernet/mscc/ocelot.h                          |  79 +-
 drivers/net/ethernet/mscc/ocelot_board.c                    |  61 +-
 drivers/net/ethernet/mscc/ocelot_hsio.h                     | 785 +------
 drivers/net/ethernet/mscc/ocelot_regs.c                     |  93 +-
 drivers/phy/Kconfig                                         |   1 +-
 drivers/phy/Makefile                                        |   1 +-
 drivers/phy/mscc/Kconfig                                    |  11 +-
 drivers/phy/mscc/Makefile                                   |   5 +-
 drivers/phy/mscc/phy-ocelot-serdes.c                        | 288 ++-
 include/dt-bindings/phy/phy-ocelot-serdes.h                 |  19 +-
 include/linux/phy/phy.h                                     |   2 +-
 include/soc/mscc/ocelot_hsio.h                              | 859 +++++++-
 18 files changed, 1341 insertions(+), 965 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-ocelot-serdes.txt
 delete mode 100644 drivers/net/ethernet/mscc/ocelot_hsio.h
 create mode 100644 drivers/phy/mscc/Kconfig
 create mode 100644 drivers/phy/mscc/Makefile
 create mode 100644 drivers/phy/mscc/phy-ocelot-serdes.c
 create mode 100644 include/dt-bindings/phy/phy-ocelot-serdes.h
 create mode 100644 include/soc/mscc/ocelot_hsio.h

base-commit: ee4fccbee7d397c4d937e20d8c76212ffc23a7e3
-- 
git-series 0.9.1

^ permalink raw reply

* [PATCH net-next v3 01/11] MIPS: mscc: ocelot: make HSIO registers address range a syscon
From: Quentin Schulz @ 2018-09-14  8:15 UTC (permalink / raw)
  To: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, kishon, andrew, f.fainelli
  Cc: allan.nielsen, linux-mips, devicetree, linux-kernel, netdev,
	thomas.petazzoni, Quentin Schulz
In-Reply-To: <cover.ff40d591b548a6da31716e6e600f11a303e0e643.1536912834.git-series.quentin.schulz@bootlin.com>

HSIO contains registers for PLL5 configuration, SerDes/switch port
muxing and a thermal sensor, hence we can't keep it in the switch DT
node.

Acked-by: Paul Burton <paul.burton@mips.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 arch/mips/boot/dts/mscc/ocelot.dtsi | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/mips/boot/dts/mscc/ocelot.dtsi b/arch/mips/boot/dts/mscc/ocelot.dtsi
index f7eb612..149b1a7 100644
--- a/arch/mips/boot/dts/mscc/ocelot.dtsi
+++ b/arch/mips/boot/dts/mscc/ocelot.dtsi
@@ -107,7 +107,6 @@
 			reg = <0x1010000 0x10000>,
 			      <0x1030000 0x10000>,
 			      <0x1080000 0x100>,
-			      <0x10d0000 0x10000>,
 			      <0x11e0000 0x100>,
 			      <0x11f0000 0x100>,
 			      <0x1200000 0x100>,
@@ -121,10 +120,10 @@
 			      <0x1280000 0x100>,
 			      <0x1800000 0x80000>,
 			      <0x1880000 0x10000>;
-			reg-names = "sys", "rew", "qs", "hsio", "port0",
-				    "port1", "port2", "port3", "port4", "port5",
-				    "port6", "port7", "port8", "port9", "port10",
-				    "qsys", "ana";
+			reg-names = "sys", "rew", "qs", "port0", "port1",
+				    "port2", "port3", "port4", "port5", "port6",
+				    "port7", "port8", "port9", "port10", "qsys",
+				    "ana";
 			interrupts = <21 22>;
 			interrupt-names = "xtr", "inj";
 
@@ -231,5 +230,10 @@
 			pinctrl-0 = <&miim1>;
 			status = "disabled";
 		};
+
+		hsio: syscon@10d0000 {
+			compatible = "mscc,ocelot-hsio", "syscon", "simple-mfd";
+			reg = <0x10d0000 0x10000>;
+		};
 	};
 };
-- 
git-series 0.9.1

^ permalink raw reply related

* [PATCH net-next v3 02/11] dt-bindings: net: ocelot: remove hsio from the list of register address spaces
From: Quentin Schulz @ 2018-09-14  8:16 UTC (permalink / raw)
  To: alexandre.belloni, ralf, paul.burton, jhogan, robh+dt,
	mark.rutland, davem, kishon, andrew, f.fainelli
  Cc: allan.nielsen, linux-mips, devicetree, linux-kernel, netdev,
	thomas.petazzoni, Quentin Schulz
In-Reply-To: <cover.ff40d591b548a6da31716e6e600f11a303e0e643.1536912834.git-series.quentin.schulz@bootlin.com>

HSIO register address space should be handled outside of the MAC
controller as there are some registers for PLL5 configuring,
SerDes/switch port muxing and a thermal sensor IP, so let's remove it.

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
 Documentation/devicetree/bindings/mips/mscc.txt       | 16 ++++++++++++-
 Documentation/devicetree/bindings/net/mscc-ocelot.txt |  9 ++-----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/mips/mscc.txt b/Documentation/devicetree/bindings/mips/mscc.txt
index ae15ec3..bc817e9 100644
--- a/Documentation/devicetree/bindings/mips/mscc.txt
+++ b/Documentation/devicetree/bindings/mips/mscc.txt
@@ -41,3 +41,19 @@ Example:
 		compatible = "mscc,ocelot-cpu-syscon", "syscon";
 		reg = <0x70000000 0x2c>;
 	};
+
+o HSIO regs:
+
+The SoC has a few registers (HSIO) handling miscellaneous functionalities:
+configuration and status of PLL5, RCOMP, SyncE, SerDes configurations and
+status, SerDes muxing and a thermal sensor.
+
+Required properties:
+- compatible: Should be "mscc,ocelot-hsio", "syscon", "simple-mfd"
+- reg : Should contain registers location and length
+
+Example:
+	syscon@10d0000 {
+		compatible = "mscc,ocelot-hsio", "syscon", "simple-mfd";
+		reg = <0x10d0000 0x10000>;
+	};
diff --git a/Documentation/devicetree/bindings/net/mscc-ocelot.txt b/Documentation/devicetree/bindings/net/mscc-ocelot.txt
index 0a84711..9e5c17d 100644
--- a/Documentation/devicetree/bindings/net/mscc-ocelot.txt
+++ b/Documentation/devicetree/bindings/net/mscc-ocelot.txt
@@ -12,7 +12,6 @@ Required properties:
   - "sys"
   - "rew"
   - "qs"
-  - "hsio"
   - "qsys"
   - "ana"
   - "portX" with X from 0 to the number of last port index available on that
@@ -45,7 +44,6 @@ Example:
 		reg = <0x1010000 0x10000>,
 		      <0x1030000 0x10000>,
 		      <0x1080000 0x100>,
-		      <0x10d0000 0x10000>,
 		      <0x11e0000 0x100>,
 		      <0x11f0000 0x100>,
 		      <0x1200000 0x100>,
@@ -59,10 +57,9 @@ Example:
 		      <0x1280000 0x100>,
 		      <0x1800000 0x80000>,
 		      <0x1880000 0x10000>;
-		reg-names = "sys", "rew", "qs", "hsio", "port0",
-			    "port1", "port2", "port3", "port4", "port5",
-			    "port6", "port7", "port8", "port9", "port10",
-			    "qsys", "ana";
+		reg-names = "sys", "rew", "qs", "port0", "port1", "port2",
+			    "port3", "port4", "port5", "port6", "port7",
+			    "port8", "port9", "port10", "qsys", "ana";
 		interrupts = <21 22>;
 		interrupt-names = "xtr", "inj";
 
-- 
git-series 0.9.1

^ permalink raw reply related


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