All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20
@ 2019-03-20 23:39 Saeed Mahameed
  2019-03-20 23:39 ` [net-next 01/15] net/mlx5: Simplify sriov enable/disable flow Saeed Mahameed
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

This series includes mlx5 updates.
For more information please see tag log below.

Please pull and let me know if there is any problem.

Thanks,
Saeed.

---
The following changes since commit a534ea30e70fc51c4cef31c0683955dd8a568a11:

  net: isdn: Make isdn_ppp_mp_discard and isdn_ppp_mp_reassembly static (2019-03-20 12:25:59 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2019-03-20

for you to fetch changes up to bdfccd78a39d38149a17feec6f55efc031646485:

  net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify (2019-03-20 16:37:06 -0700)

----------------------------------------------------------------
mlx5-updates-2019-03-20

This series includes updates to mlx5 driver,

1) Compiler warnings cleanup from Saeed Mahameed
2) Parav Pandit simplifies sriov enable/disables
3) Roi Dayan, protection from invalid memory access in offload
   fdb table
4) Gustavo A. R. Silva, Removes a redundant assignment
5) Moshe Shemesh, Adds Geneve tunnel stateless offload support
6) Eli Britstein, Adds the Support for VLAN modify action and
   Replaces TC VLAN pop and push actions with VLAN modify

Note: This series includes two simple non-mlx5 patches,

1) Declare IANA_VXLAN_UDP_PORT definition in include/net/vxlan.h,
and use it in some drivers.
2) Declare GENEVE_UDP_PORT definition in include/net/geneve.h,
and use it in mlx5 and nfp drivers.

----------------------------------------------------------------
Eli Britstein (3):
      net/mlx5e: Add VLAN ID rewrite fields
      net/mlx5e: Support VLAN modify action
      net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify

Gustavo A. R. Silva (1):
      net/mlx5e: Remove redundant assignment

Moshe Shemesh (4):
      net: Move the definition of the default Geneve udp port to public header file
      net/mlx5e: Take SW parser code to a separate function
      net/mlx5e: TX, Add geneve tunnel stateless offload support
      net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file

Parav Pandit (3):
      net/mlx5: Simplify sriov enable/disable flow
      net/mlx5: Rename total_vfs to total_vports
      net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API

Roi Dayan (1):
      net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table

Saeed Mahameed (3):
      net/mlx5: Fix compilation warning in eq.c
      net/mlx5e: Fix port buffer function documentation format
      net/mlx5e: Fix compilation warning in en_tc.c

 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c    |  4 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h       | 47 ++++++++++++++++
 .../ethernet/mellanox/mlx5/core/en/port_buffer.c   | 30 +++++-----
 .../mellanox/mlx5/core/en_accel/en_accel.h         | 51 +++++++++++++++++
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c       | 36 ++++--------
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 18 +++++-
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    | 65 +++++++++++++++++++++-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |  5 ++
 drivers/net/ethernet/mellanox/mlx5/core/eq.c       |  6 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h  |  3 +
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |  7 +--
 .../net/ethernet/mellanox/mlx5/core/lib/port_tun.c |  6 +-
 .../net/ethernet/mellanox/mlx5/core/lib/vxlan.c    |  5 +-
 .../net/ethernet/mellanox/mlx5/core/mlx5_core.h    |  6 +-
 drivers/net/ethernet/mellanox/mlx5/core/sriov.c    | 51 +++--------------
 drivers/net/ethernet/netronome/nfp/flower/main.h   |  4 +-
 drivers/net/geneve.c                               |  2 -
 include/linux/mlx5/mlx5_ifc.h                      |  1 +
 include/net/geneve.h                               |  2 +
 include/net/vxlan.h                                |  2 +
 20 files changed, 242 insertions(+), 109 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [net-next 01/15] net/mlx5: Simplify sriov enable/disable flow
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 02/15] net/mlx5: Rename total_vfs to total_vports Saeed Mahameed
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Bodong Wang, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Simplify sriov enable/disable flow for below two checks.

1. PCI core driver allows sriov configuration only on a PF.
This is done in drivers/pci/pci-sysfs.c sriov_attrs_are_visible().

2. PCI core driver allow sriov enablement if the sriov is currently
disabled for for a PF. This is done in drivers/pci/pci-sysfs.c
sriov_numvfs_store().

Hence there is no need for mlx5 driver to duplicate such checks.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/sriov.c   | 44 ++++---------------
 1 file changed, 8 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
index 7b23fa8d2d60..105e652f991b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
@@ -151,33 +151,10 @@ static void mlx5_device_disable_sriov(struct mlx5_core_dev *dev)
 		mlx5_core_warn(dev, "timeout reclaiming VFs pages\n");
 }
 
-static int mlx5_pci_enable_sriov(struct pci_dev *pdev, int num_vfs)
-{
-	struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
-	int err = 0;
-
-	if (pci_num_vf(pdev)) {
-		mlx5_core_warn(dev, "Unable to enable pci sriov, already enabled\n");
-		return -EBUSY;
-	}
-
-	err = pci_enable_sriov(pdev, num_vfs);
-	if (err)
-		mlx5_core_warn(dev, "pci_enable_sriov failed : %d\n", err);
-
-	return err;
-}
-
-static void mlx5_pci_disable_sriov(struct pci_dev *pdev)
-{
-	pci_disable_sriov(pdev);
-}
-
 static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs)
 {
 	struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
-	struct mlx5_core_sriov *sriov = &dev->priv.sriov;
-	int err = 0;
+	int err;
 
 	err = mlx5_device_enable_sriov(dev, num_vfs);
 	if (err) {
@@ -185,42 +162,37 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs)
 		return err;
 	}
 
-	err = mlx5_pci_enable_sriov(pdev, num_vfs);
+	err = pci_enable_sriov(pdev, num_vfs);
 	if (err) {
-		mlx5_core_warn(dev, "mlx5_pci_enable_sriov failed : %d\n", err);
+		mlx5_core_warn(dev, "pci_enable_sriov failed : %d\n", err);
 		mlx5_device_disable_sriov(dev);
-		return err;
 	}
-
-	sriov->num_vfs = num_vfs;
-
-	return 0;
+	return err;
 }
 
 static void mlx5_sriov_disable(struct pci_dev *pdev)
 {
 	struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
-	struct mlx5_core_sriov *sriov = &dev->priv.sriov;
 
-	mlx5_pci_disable_sriov(pdev);
+	pci_disable_sriov(pdev);
 	mlx5_device_disable_sriov(dev);
-	sriov->num_vfs = 0;
 }
 
 int mlx5_core_sriov_configure(struct pci_dev *pdev, int num_vfs)
 {
 	struct mlx5_core_dev *dev  = pci_get_drvdata(pdev);
+	struct mlx5_core_sriov *sriov = &dev->priv.sriov;
 	int err = 0;
 
 	mlx5_core_dbg(dev, "requested num_vfs %d\n", num_vfs);
-	if (!mlx5_core_is_pf(dev))
-		return -EPERM;
 
 	if (num_vfs)
 		err = mlx5_sriov_enable(pdev, num_vfs);
 	else
 		mlx5_sriov_disable(pdev);
 
+	if (!err)
+		sriov->num_vfs = num_vfs;
 	return err ? err : num_vfs;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 02/15] net/mlx5: Rename total_vfs to total_vports
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
  2019-03-20 23:39 ` [net-next 01/15] net/mlx5: Simplify sriov enable/disable flow Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 03/15] net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API Saeed Mahameed
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Bodong Wang, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

Macro MLX5_TOTAL_VPORTS() returns total number of vports. Therefore,
rename variable total_vfs to total_vports to improve code readability.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index f2260391be5b..ddee935df65d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1287,13 +1287,13 @@ void esw_offloads_cleanup_reps(struct mlx5_eswitch *esw)
 
 int esw_offloads_init_reps(struct mlx5_eswitch *esw)
 {
-	int total_vfs = MLX5_TOTAL_VPORTS(esw->dev);
+	int total_vports = MLX5_TOTAL_VPORTS(esw->dev);
 	struct mlx5_core_dev *dev = esw->dev;
 	struct mlx5_eswitch_rep *rep;
 	u8 hw_id[ETH_ALEN], rep_type;
 	int vport;
 
-	esw->offloads.vport_reps = kcalloc(total_vfs,
+	esw->offloads.vport_reps = kcalloc(total_vports,
 					   sizeof(struct mlx5_eswitch_rep),
 					   GFP_KERNEL);
 	if (!esw->offloads.vport_reps)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 03/15] net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
  2019-03-20 23:39 ` [net-next 01/15] net/mlx5: Simplify sriov enable/disable flow Saeed Mahameed
  2019-03-20 23:39 ` [net-next 02/15] net/mlx5: Rename total_vfs to total_vports Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 04/15] net/mlx5: Fix compilation warning in eq.c Saeed Mahameed
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Parav Pandit, Bodong Wang, Saeed Mahameed

From: Parav Pandit <parav@mellanox.com>

It is desired to get rid of num_vfs stored inside mlx5_core_sriov to
safely support vports more than vfs.
To reduce dependency on mlx5_core_sriov num_vfs, start using
pci_num_vf() from pci core.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 6 +++++-
 drivers/net/ethernet/mellanox/mlx5/core/sriov.c     | 7 -------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index 7b331674622c..6fb99be60584 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -111,7 +111,6 @@ void mlx5_sriov_cleanup(struct mlx5_core_dev *dev);
 int mlx5_sriov_attach(struct mlx5_core_dev *dev);
 void mlx5_sriov_detach(struct mlx5_core_dev *dev);
 int mlx5_core_sriov_configure(struct pci_dev *dev, int num_vfs);
-bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev);
 int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id);
 int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id);
 int mlx5_create_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy,
@@ -176,6 +175,11 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, const struct firmware *fw);
 void mlx5e_init(void);
 void mlx5e_cleanup(void);
 
+static inline bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
+{
+	return pci_num_vf(dev->pdev) ? true : false;
+}
+
 static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev)
 {
 	/* LACP owner conditions:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
index 105e652f991b..a249b3c3843d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
@@ -36,13 +36,6 @@
 #include "mlx5_core.h"
 #include "eswitch.h"
 
-bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
-{
-	struct mlx5_core_sriov *sriov = &dev->priv.sriov;
-
-	return !!sriov->num_vfs;
-}
-
 static int sriov_restore_guids(struct mlx5_core_dev *dev, int vf)
 {
 	struct mlx5_core_sriov *sriov = &dev->priv.sriov;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 04/15] net/mlx5: Fix compilation warning in eq.c
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 03/15] net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 05/15] net/mlx5e: Fix port buffer function documentation format Saeed Mahameed
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

mlx5_eq_table_get_rmap is being used only when CONFIG_RFS_ACCEL is
enabled, this patch fixes the below warning when CONFIG_RFS_ACCEL is
disabled.

drivers/.../mlx5/core/eq.c:903:18: [-Werror=missing-prototypes]
error: no previous prototype for ‘mlx5_eq_table_get_rmap’

Fixes: f2f3df550139 ("net/mlx5: EQ, Privatize eq_table and friends")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index bb6e5b5d9681..46a747f7c162 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -900,14 +900,12 @@ mlx5_comp_irq_get_affinity_mask(struct mlx5_core_dev *dev, int vector)
 }
 EXPORT_SYMBOL(mlx5_comp_irq_get_affinity_mask);
 
+#ifdef CONFIG_RFS_ACCEL
 struct cpu_rmap *mlx5_eq_table_get_rmap(struct mlx5_core_dev *dev)
 {
-#ifdef CONFIG_RFS_ACCEL
 	return dev->priv.eq_table->rmap;
-#else
-	return NULL;
-#endif
 }
+#endif
 
 struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn)
 {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 05/15] net/mlx5e: Fix port buffer function documentation format
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 04/15] net/mlx5: Fix compilation warning in eq.c Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 06/15] net/mlx5e: Fix compilation warning in en_tc.c Saeed Mahameed
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Eran Ben Elisha

This patch fixes compiler warnings:
In drivers/.../mlx5/core/en/port_buffer.c:190:
warning: Function parameter or member 'pfc_en' not described...
...
warning: Function parameter or member 'change' not described...

Fixes: 0696d60853d5 ("net/mlx5e: Receive buffer configuration")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../mellanox/mlx5/core/en/port_buffer.c       | 30 +++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
index eac245a93f91..b0ce68feb0f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c
@@ -165,23 +165,23 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer,
 }
 
 /**
- * update_buffer_lossy()
- *   mtu: device's MTU
- *   pfc_en: <input> current pfc configuration
- *   buffer: <input> current prio to buffer mapping
- *   xoff:   <input> xoff value
- *   port_buffer: <output> port receive buffer configuration
- *   change: <output>
+ *	update_buffer_lossy	- Update buffer configuration based on pfc
+ *	@mtu: device's MTU
+ *	@pfc_en: <input> current pfc configuration
+ *	@buffer: <input> current prio to buffer mapping
+ *	@xoff:   <input> xoff value
+ *	@port_buffer: <output> port receive buffer configuration
+ *	@change: <output>
  *
- *   Update buffer configuration based on pfc configuraiton and priority
- *   to buffer mapping.
- *   Buffer's lossy bit is changed to:
- *     lossless if there is at least one PFC enabled priority mapped to this buffer
- *     lossy if all priorities mapped to this buffer are PFC disabled
+ *	Update buffer configuration based on pfc configuraiton and
+ *	priority to buffer mapping.
+ *	Buffer's lossy bit is changed to:
+ *		lossless if there is at least one PFC enabled priority
+ *		mapped to this buffer lossy if all priorities mapped to
+ *		this buffer are PFC disabled
  *
- *   Return:
- *     Return 0 if no error.
- *     Set change to true if buffer configuration is modified.
+ *	@return: 0 if no error,
+ *	sets change to true if buffer configuration was modified.
  */
 static int update_buffer_lossy(unsigned int mtu,
 			       u8 pfc_en, u8 *buffer, u32 xoff,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 06/15] net/mlx5e: Fix compilation warning in en_tc.c
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 05/15] net/mlx5e: Fix port buffer function documentation format Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 07/15] net/mlx5e: Remove redundant assignment Saeed Mahameed
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed, Roi Dayan

Amazingly a mlx5e_tc function is being called from the eswitch layer,
which is by itself very terrible! The function was declared locally in
eswitch_offloads.c so it could be used there, which caused the following
compilation warning, fix that.

drivers/.../mlx5/core/en_tc.c:3242:6: [-Werror=missing-prototypes]
error: no previous prototype for ‘mlx5e_tc_clean_fdb_peer_flows’

Fixes: 04de7dda7394 ("net/mlx5e: Infrastructure for duplicated offloading of TC flows")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h          | 3 +++
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index 3f3cd32ae60a..e0ba59b5296f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -431,6 +431,9 @@ static inline int mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
 	return index;
 }
 
+/* TODO: This mlx5e_tc function shouldn't be called by eswitch */
+void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw);
+
 #else  /* CONFIG_MLX5_ESWITCH */
 /* eswitch API stubs */
 static inline int  mlx5_eswitch_init(struct mlx5_core_dev *dev) { return 0; }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index ddee935df65d..6c72f33f6d09 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1523,8 +1523,6 @@ static int mlx5_esw_offloads_pair(struct mlx5_eswitch *esw,
 	return 0;
 }
 
-void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw);
-
 static void mlx5_esw_offloads_unpair(struct mlx5_eswitch *esw)
 {
 	mlx5e_tc_clean_fdb_peer_flows(esw);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 07/15] net/mlx5e: Remove redundant assignment
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 06/15] net/mlx5e: Fix compilation warning in en_tc.c Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 08/15] net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table Saeed Mahameed
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Gustavo A. R. Silva, Roi Dayan, Eli Britstein,
	Leon Romanovsky, Saeed Mahameed

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

Remove redundant assignment to tun_entropy->enabled.

Addesses-Coverity-ID: 1477328 ("Unused value")
Fixes: 97417f6182f8 ("net/mlx5e: Fix GRE key by controlling port tunnel entropy calculation")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c
index 40f4a19b1ce1..be69c1d7941a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c
@@ -80,10 +80,8 @@ void mlx5_init_port_tun_entropy(struct mlx5_tun_entropy *tun_entropy,
 	mlx5_query_port_tun_entropy(mdev, &entropy_flags);
 	tun_entropy->num_enabling_entries = 0;
 	tun_entropy->num_disabling_entries = 0;
-	tun_entropy->enabled = entropy_flags.calc_enabled;
-	tun_entropy->enabled =
-		(entropy_flags.calc_supported) ?
-		entropy_flags.calc_enabled : true;
+	tun_entropy->enabled = entropy_flags.calc_supported ?
+			       entropy_flags.calc_enabled : true;
 }
 
 static int mlx5_set_entropy(struct mlx5_tun_entropy *tun_entropy,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 08/15] net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 07/15] net/mlx5e: Remove redundant assignment Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file Saeed Mahameed
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Or Gerlitz, Saeed Mahameed

From: Roi Dayan <roid@mellanox.com>

The esw offloads structures share a union with the legacy mode structs.
Reset the offloads struct to zero in init to protect from null
assumptions made by the legacy mode code.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 6c72f33f6d09..fe770cd2151c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1609,6 +1609,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw, int nvports)
 {
 	int err;
 
+	memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
 	mutex_init(&esw->fdb_table.offloads.fdb_prio_lock);
 
 	err = esw_create_offloads_fdb_tables(esw, nvports);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 08/15] net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:54   ` Jakub Kicinski
  2019-03-20 23:39 ` [net-next 10/15] net/mlx5e: Take SW parser code to a separate function Saeed Mahameed
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Moshe Shemesh, Or Gerlitz, John Hurley, Jakub Kicinski,
	Tariq Toukan, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Move the definition of the default Geneve udp port from the geneve
source to the header file, so we can re-use it from drivers.
Modify existing drivers to use it.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Cc: John Hurley <john.hurley@netronome.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/netronome/nfp/flower/main.h | 2 +-
 drivers/net/geneve.c                             | 2 --
 include/net/geneve.h                             | 2 ++
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
index c0945a5fd1a4..7afe66eff684 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
@@ -35,7 +35,7 @@ struct nfp_app;
 #define NFP_FL_MASK_ID_LOCATION		1
 
 #define NFP_FL_VXLAN_PORT		4789
-#define NFP_FL_GENEVE_PORT		6081
+#define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT
 
 /* Extra features bitmap. */
 #define NFP_FL_FEATS_GENEVE		BIT(0)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 5583d993480d..c05b1207358d 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -22,8 +22,6 @@
 
 #define GENEVE_NETDEV_VER	"0.6"
 
-#define GENEVE_UDP_PORT		6081
-
 #define GENEVE_N_VID		(1u << 24)
 #define GENEVE_VID_MASK		(GENEVE_N_VID - 1)
 
diff --git a/include/net/geneve.h b/include/net/geneve.h
index fc6a7e0a874a..bced0b1d9fe4 100644
--- a/include/net/geneve.h
+++ b/include/net/geneve.h
@@ -4,6 +4,8 @@
 
 #include <net/udp_tunnel.h>
 
+#define GENEVE_UDP_PORT		6081
+
 /* Geneve Header:
  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *  |Ver|  Opt Len  |O|C|    Rsvd.  |          Protocol Type        |
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 10/15] net/mlx5e: Take SW parser code to a separate function
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (8 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 11/15] net/mlx5e: TX, Add geneve tunnel stateless offload support Saeed Mahameed
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Refactor mlx5e_ipsec_set_swp() code, split the part which sets the eseg
software parser (SWP) offsets and flags, so it can be used in a
downstream patch by other mlx5e functionality which needs to set eseg
SWP.
The new function mlx5e_set_eseg_swp() is useful for setting swp for both
outer and inner headers. It also handles the special ipsec case of xfrm
mode transfer.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  | 41 +++++++++++++++++++
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c  | 36 ++++++----------
 2 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 5c2e3276d9cc..16a64485a13b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -884,6 +884,47 @@ static inline bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev)
 		MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ft_field_support.inner_ip_version));
 }
 
+struct mlx5e_swp_spec {
+	__be16 l3_proto;
+	u8 l4_proto;
+	u8 is_tun;
+	__be16 tun_l3_proto;
+	u8 tun_l4_proto;
+};
+
+static inline void
+mlx5e_set_eseg_swp(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg,
+		   struct mlx5e_swp_spec *swp_spec)
+{
+	/* SWP offsets are in 2-bytes words */
+	eseg->swp_outer_l3_offset = skb_network_offset(skb) / 2;
+	if (swp_spec->l3_proto == htons(ETH_P_IPV6))
+		eseg->swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L3_IPV6;
+	if (swp_spec->l4_proto) {
+		eseg->swp_outer_l4_offset = skb_transport_offset(skb) / 2;
+		if (swp_spec->l4_proto == IPPROTO_UDP)
+			eseg->swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L4_UDP;
+	}
+
+	if (swp_spec->is_tun) {
+		eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
+		if (swp_spec->tun_l3_proto == htons(ETH_P_IPV6))
+			eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
+	} else { /* typically for ipsec when xfrm mode != XFRM_MODE_TUNNEL */
+		eseg->swp_inner_l3_offset = skb_network_offset(skb) / 2;
+		if (swp_spec->l3_proto == htons(ETH_P_IPV6))
+			eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
+	}
+	switch (swp_spec->tun_l4_proto) {
+	case IPPROTO_UDP:
+		eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;
+		/* fall through */
+	case IPPROTO_TCP:
+		eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
+		break;
+	}
+}
+
 static inline void mlx5e_sq_fetch_wqe(struct mlx5e_txqsq *sq,
 				      struct mlx5e_tx_wqe **wqe,
 				      u16 *pi)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
index 53608afd39b6..0dd17514caae 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c
@@ -136,7 +136,7 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb,
 				struct mlx5_wqe_eth_seg *eseg, u8 mode,
 				struct xfrm_offload *xo)
 {
-	u8 proto;
+	struct mlx5e_swp_spec swp_spec = {};
 
 	/* Tunnel Mode:
 	 * SWP:      OutL3       InL3  InL4
@@ -146,35 +146,23 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb,
 	 * SWP:      OutL3       InL4
 	 *           InL3
 	 * Pkt: MAC  IP     ESP  L4
-	 *
-	 * Offsets are in 2-byte words, counting from start of frame
 	 */
-	eseg->swp_outer_l3_offset = skb_network_offset(skb) / 2;
-	if (skb->protocol == htons(ETH_P_IPV6))
-		eseg->swp_flags |= MLX5_ETH_WQE_SWP_OUTER_L3_IPV6;
-
-	if (mode == XFRM_MODE_TUNNEL) {
-		eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
+	swp_spec.l3_proto = skb->protocol;
+	swp_spec.is_tun = mode == XFRM_MODE_TUNNEL;
+	if (swp_spec.is_tun) {
 		if (xo->proto == IPPROTO_IPV6) {
-			eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
-			proto = inner_ipv6_hdr(skb)->nexthdr;
+			swp_spec.tun_l3_proto = htons(ETH_P_IPV6);
+			swp_spec.tun_l4_proto = inner_ipv6_hdr(skb)->nexthdr;
 		} else {
-			proto = inner_ip_hdr(skb)->protocol;
+			swp_spec.tun_l3_proto = htons(ETH_P_IP);
+			swp_spec.tun_l4_proto = inner_ip_hdr(skb)->protocol;
 		}
 	} else {
-		eseg->swp_inner_l3_offset = skb_network_offset(skb) / 2;
-		if (skb->protocol == htons(ETH_P_IPV6))
-			eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
-		proto = xo->proto;
-	}
-	switch (proto) {
-	case IPPROTO_UDP:
-		eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;
-		/* Fall through */
-	case IPPROTO_TCP:
-		eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
-		break;
+		swp_spec.tun_l3_proto = skb->protocol;
+		swp_spec.tun_l4_proto = xo->proto;
 	}
+
+	mlx5e_set_eseg_swp(skb, eseg, &swp_spec);
 }
 
 void mlx5e_ipsec_set_iv_esn(struct sk_buff *skb, struct xfrm_state *x,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 11/15] net/mlx5e: TX, Add geneve tunnel stateless offload support
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (9 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 10/15] net/mlx5e: Take SW parser code to a separate function Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file Saeed Mahameed
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Or Gerlitz, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Currently support only default geneve udp port (6081).
For the tx side, the HW is assisted by SW parsing, which sets the
headers offset to offload tunneled LSO and csum. Note that for udp
tunnels, we don't use special rx offloads, as rss on the outer headers
is enough, we support checksum complete and GRO takes care of
aggregation.

Geneve TSO BW and CPU load results (tested using iperf single tcp
stream).
In this patch we add TSO support over Geneve, so the "before" result
doesn't actually get to using the TSO HW offload even when turned on.
Tested on ConnectX-5, Intel(R) Xeon(R) CPU E5-2660 v2 @2.20GHz.

 __________________________________
| Before         | After           |
|________________|_________________|
| 12.6 Gbits/sec | 21.7 Gbits/sec  |
| 100% CPU load  | 61.5% CPU load  |
|________________|_________________|

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  6 +++
 .../mellanox/mlx5/core/en_accel/en_accel.h    | 51 +++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 18 +++++--
 .../net/ethernet/mellanox/mlx5/core/en_tx.c   |  5 ++
 4 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 16a64485a13b..9e71cf03369c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -884,6 +884,12 @@ static inline bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev)
 		MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ft_field_support.inner_ip_version));
 }
 
+static inline bool mlx5_tx_swp_supported(struct mlx5_core_dev *mdev)
+{
+	return MLX5_CAP_ETH(mdev, swp) &&
+		MLX5_CAP_ETH(mdev, swp_csum) && MLX5_CAP_ETH(mdev, swp_lso);
+}
+
 struct mlx5e_swp_spec {
 	__be16 l3_proto;
 	u8 l4_proto;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
index 1dd225380a66..6da7c88742dc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
@@ -40,6 +40,57 @@
 #include "en_accel/tls_rxtx.h"
 #include "en.h"
 
+#if IS_ENABLED(CONFIG_GENEVE)
+static inline bool mlx5_geneve_tx_allowed(struct mlx5_core_dev *mdev)
+{
+	return mlx5_tx_swp_supported(mdev);
+}
+
+static inline void
+mlx5e_tx_tunnel_accel(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
+{
+	struct mlx5e_swp_spec swp_spec = {};
+	unsigned int offset = 0;
+	__be16 l3_proto;
+	u8 l4_proto;
+
+	l3_proto = vlan_get_protocol(skb);
+	switch (l3_proto) {
+	case htons(ETH_P_IP):
+		l4_proto = ip_hdr(skb)->protocol;
+		break;
+	case htons(ETH_P_IPV6):
+		l4_proto = ipv6_find_hdr(skb, &offset, -1, NULL, NULL);
+		break;
+	default:
+		return;
+	}
+
+	if (l4_proto != IPPROTO_UDP ||
+	    udp_hdr(skb)->dest != cpu_to_be16(GENEVE_UDP_PORT))
+		return;
+	swp_spec.l3_proto = l3_proto;
+	swp_spec.l4_proto = l4_proto;
+	swp_spec.is_tun = true;
+	if (inner_ip_hdr(skb)->version == 6) {
+		swp_spec.tun_l3_proto = htons(ETH_P_IPV6);
+		swp_spec.tun_l4_proto = inner_ipv6_hdr(skb)->nexthdr;
+	} else {
+		swp_spec.tun_l3_proto = htons(ETH_P_IP);
+		swp_spec.tun_l4_proto = inner_ip_hdr(skb)->protocol;
+	}
+
+	mlx5e_set_eseg_swp(skb, eseg, &swp_spec);
+}
+
+#else
+static inline bool mlx5_geneve_tx_allowed(struct mlx5_core_dev *mdev)
+{
+	return false;
+}
+
+#endif /* CONFIG_GENEVE */
+
 static inline void
 mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb)
 {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b5fdbd3190d9..e08a1eb04e22 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -34,6 +34,7 @@
 #include <net/pkt_cls.h>
 #include <linux/mlx5/fs.h>
 #include <net/vxlan.h>
+#include <net/geneve.h>
 #include <linux/bpf.h>
 #include <linux/if_bridge.h>
 #include <net/page_pool.h>
@@ -43,6 +44,7 @@
 #include "en_rep.h"
 #include "en_accel/ipsec.h"
 #include "en_accel/ipsec_rxtx.h"
+#include "en_accel/en_accel.h"
 #include "en_accel/tls.h"
 #include "accel/ipsec.h"
 #include "accel/tls.h"
@@ -2173,10 +2175,13 @@ static void mlx5e_build_sq_param(struct mlx5e_priv *priv,
 {
 	void *sqc = param->sqc;
 	void *wq = MLX5_ADDR_OF(sqc, sqc, wq);
+	bool allow_swp;
 
+	allow_swp = mlx5_geneve_tx_allowed(priv->mdev) ||
+		    !!MLX5_IPSEC_DEV(priv->mdev);
 	mlx5e_build_sq_param_common(priv, param);
 	MLX5_SET(wq, wq, log_wq_sz, params->log_sq_size);
-	MLX5_SET(sqc, sqc, allow_swp, !!MLX5_IPSEC_DEV(priv->mdev));
+	MLX5_SET(sqc, sqc, allow_swp, allow_swp);
 }
 
 static void mlx5e_build_common_cq_param(struct mlx5e_priv *priv,
@@ -4103,6 +4108,12 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
 		/* Verify if UDP port is being offloaded by HW */
 		if (mlx5_vxlan_lookup_port(priv->mdev->vxlan, port))
 			return features;
+
+#if IS_ENABLED(CONFIG_GENEVE)
+		/* Support Geneve offload for default UDP port */
+		if (port == GENEVE_UDP_PORT && mlx5_geneve_tx_allowed(priv->mdev))
+			return features;
+#endif
 	}
 
 out:
@@ -4674,7 +4685,8 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_FILTER;
 	netdev->hw_features      |= NETIF_F_HW_VLAN_STAG_TX;
 
-	if (mlx5_vxlan_allowed(mdev->vxlan) || MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
+	if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev) ||
+	    MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
 		netdev->hw_enc_features |= NETIF_F_IP_CSUM;
 		netdev->hw_enc_features |= NETIF_F_IPV6_CSUM;
 		netdev->hw_enc_features |= NETIF_F_TSO;
@@ -4682,7 +4694,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 		netdev->hw_enc_features |= NETIF_F_GSO_PARTIAL;
 	}
 
-	if (mlx5_vxlan_allowed(mdev->vxlan)) {
+	if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) {
 		netdev->hw_features     |= NETIF_F_GSO_UDP_TUNNEL |
 					   NETIF_F_GSO_UDP_TUNNEL_CSUM;
 		netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index ce1406bb1512..41e2a01d3713 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -32,6 +32,7 @@
 
 #include <linux/tcp.h>
 #include <linux/if_vlan.h>
+#include <net/geneve.h>
 #include <net/dsfield.h>
 #include "en.h"
 #include "ipoib/ipoib.h"
@@ -391,6 +392,10 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 	eseg = &wqe->eth;
 	dseg =  wqe->data;
 
+#if IS_ENABLED(CONFIG_GENEVE)
+	if (skb->encapsulation)
+		mlx5e_tx_tunnel_accel(skb, eseg);
+#endif
 	mlx5e_txwqe_build_eseg_csum(sq, skb, eseg);
 
 	eseg->mss = mss;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (10 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 11/15] net/mlx5e: TX, Add geneve tunnel stateless offload support Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:55   ` Jakub Kicinski
  2019-03-20 23:39 ` [net-next 13/15] net/mlx5e: Add VLAN ID rewrite fields Saeed Mahameed
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Moshe Shemesh, Or Gerlitz, John Hurley, Jakub Kicinski,
	Yunsheng Lin, Peng Li, Tariq Toukan, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Added IANA_VXLAN_UDP_PORT (4789) definition to vxlan header file so it
can be used by drivers instead of local definition.
Updated drivers which locally defined it as 4789 to use it.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Cc: John Hurley <john.hurley@netronome.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Cc: Peng Li <lipeng321@huawei.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c     | 4 ++--
 drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c | 5 +++--
 drivers/net/ethernet/netronome/nfp/flower/main.h    | 2 +-
 include/net/vxlan.h                                 | 2 ++
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 1c1f17ec6be2..1f4d181f169f 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -826,12 +826,12 @@ static void hns3_set_l2l3l4_len(struct sk_buff *skb, u8 ol4_proto,
  */
 static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
 {
-#define IANA_VXLAN_PORT	4789
 	union l4_hdr_info l4;
 
 	l4.hdr = skb_transport_header(skb);
 
-	if (!(!skb->encapsulation && l4.udp->dest == htons(IANA_VXLAN_PORT)))
+	if (!(!skb->encapsulation &&
+	      l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
 		return false;
 
 	skb_checksum_help(skb);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c
index 9a8fd762167b..b9d4f4e19ff9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/vxlan.c
@@ -33,6 +33,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mlx5/driver.h>
+#include <net/vxlan.h>
 #include "mlx5_core.h"
 #include "vxlan.h"
 
@@ -204,8 +205,8 @@ struct mlx5_vxlan *mlx5_vxlan_create(struct mlx5_core_dev *mdev)
 	spin_lock_init(&vxlan->lock);
 	hash_init(vxlan->htable);
 
-	/* Hardware adds 4789 by default */
-	mlx5_vxlan_add_port(vxlan, 4789);
+	/* Hardware adds 4789 (IANA_VXLAN_UDP_PORT) by default */
+	mlx5_vxlan_add_port(vxlan, IANA_VXLAN_UDP_PORT);
 
 	return vxlan;
 }
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
index 7afe66eff684..f214759d485b 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
@@ -34,7 +34,7 @@ struct nfp_app;
 #define NFP_FL_MASK_REUSE_TIME_NS	40000
 #define NFP_FL_MASK_ID_LOCATION		1
 
-#define NFP_FL_VXLAN_PORT		4789
+#define NFP_FL_VXLAN_PORT		IANA_VXLAN_UDP_PORT
 #define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT
 
 /* Extra features bitmap. */
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 00254a58824b..83b5999a2587 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -8,6 +8,8 @@
 #include <net/rtnetlink.h>
 #include <net/switchdev.h>
 
+#define IANA_VXLAN_UDP_PORT     4789
+
 /* VXLAN protocol (RFC 7348) header:
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  * |R|R|R|R|I|R|R|R|               Reserved                        |
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 13/15] net/mlx5e: Add VLAN ID rewrite fields
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (11 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 14/15] net/mlx5e: Support VLAN modify action Saeed Mahameed
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eli Britstein, Roi Dayan, Saeed Mahameed

From: Eli Britstein <elibr@mellanox.com>

Add VLAN ID rewrite fields as a pre-step to support this rewrite.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++
 include/linux/mlx5/mlx5_ifc.h                   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index b4967a0ff8c7..1b446307f448 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1827,6 +1827,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv,
 
 struct pedit_headers {
 	struct ethhdr  eth;
+	struct vlan_hdr vlan;
 	struct iphdr   ip4;
 	struct ipv6hdr ip6;
 	struct tcphdr  tcp;
@@ -1884,6 +1885,7 @@ static struct mlx5_fields fields[] = {
 	OFFLOAD(SMAC_47_16, 4, eth.h_source[0], 0),
 	OFFLOAD(SMAC_15_0,  2, eth.h_source[4], 0),
 	OFFLOAD(ETHERTYPE,  2, eth.h_proto, 0),
+	OFFLOAD(FIRST_VID,  2, vlan.h_vlan_TCI, 0),
 
 	OFFLOAD(IP_TTL, 1, ip4.ttl,   0),
 	OFFLOAD(SIPV4,  4, ip4.saddr, 0),
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 3b83288749c6..b0e17c94566c 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -5110,6 +5110,7 @@ enum {
 	MLX5_ACTION_IN_FIELD_OUT_DIPV6_31_0    = 0x14,
 	MLX5_ACTION_IN_FIELD_OUT_SIPV4         = 0x15,
 	MLX5_ACTION_IN_FIELD_OUT_DIPV4         = 0x16,
+	MLX5_ACTION_IN_FIELD_OUT_FIRST_VID     = 0x17,
 	MLX5_ACTION_IN_FIELD_OUT_IPV6_HOPLIMIT = 0x47,
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 14/15] net/mlx5e: Support VLAN modify action
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (12 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 13/15] net/mlx5e: Add VLAN ID rewrite fields Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-20 23:39 ` [net-next 15/15] net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify Saeed Mahameed
  2019-03-21 20:47 ` [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 David Miller
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eli Britstein, Roi Dayan, Saeed Mahameed

From: Eli Britstein <elibr@mellanox.com>

Support VLAN modify action by emulating a rewrite action for the VLAN
fields. Currently, the only supported field is the vid. The prio in the
action must be set to 0 to indicate no change.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   | 51 ++++++++++++++++++-
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 1b446307f448..0f4e9615f666 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2249,6 +2249,35 @@ static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
 	return (fsystem_guid == psystem_guid);
 }
 
+static int add_vlan_rewrite_action(struct mlx5e_priv *priv, int namespace,
+				   const struct flow_action_entry *act,
+				   struct mlx5e_tc_flow_parse_attr *parse_attr,
+				   struct pedit_headers_action *hdrs,
+				   u32 *action, struct netlink_ext_ack *extack)
+{
+	u16 mask16 = VLAN_VID_MASK;
+	u16 val16 = act->vlan.vid & VLAN_VID_MASK;
+	const struct flow_action_entry pedit_act = {
+		.id = FLOW_ACTION_MANGLE,
+		.mangle.htype = FLOW_ACT_MANGLE_HDR_TYPE_ETH,
+		.mangle.offset = offsetof(struct vlan_ethhdr, h_vlan_TCI),
+		.mangle.mask = ~(u32)be16_to_cpu(*(__be16 *)&mask16),
+		.mangle.val = (u32)be16_to_cpu(*(__be16 *)&val16),
+	};
+	int err;
+
+	if (act->vlan.prio) {
+		NL_SET_ERR_MSG_MOD(extack, "Setting VLAN prio is not supported");
+		return -EOPNOTSUPP;
+	}
+
+	err = parse_tc_pedit_action(priv, &pedit_act, namespace, parse_attr,
+				    hdrs, NULL);
+	*action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
+
+	return err;
+}
+
 static int parse_tc_nic_actions(struct mlx5e_priv *priv,
 				struct flow_action *flow_action,
 				struct mlx5e_tc_flow_parse_attr *parse_attr,
@@ -2284,6 +2313,15 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv,
 			action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
 				  MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 			break;
+		case FLOW_ACTION_VLAN_MANGLE:
+			err = add_vlan_rewrite_action(priv,
+						      MLX5_FLOW_NAMESPACE_KERNEL,
+						      act, parse_attr, hdrs,
+						      &action, extack);
+			if (err)
+				return err;
+
+			break;
 		case FLOW_ACTION_CSUM:
 			if (csum_offload_supported(priv, action,
 						   act->csum_flags,
@@ -2492,8 +2530,7 @@ static int parse_tc_vlan_action(struct mlx5e_priv *priv,
 		}
 		break;
 	default:
-		/* action is FLOW_ACT_VLAN_MANGLE */
-		return -EOPNOTSUPP;
+		return -EINVAL;
 	}
 
 	attr->total_vlan = vlan_idx + 1;
@@ -2631,6 +2668,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 			if (err)
 				return err;
 
+			attr->split_count = attr->out_count;
+			break;
+		case FLOW_ACTION_VLAN_MANGLE:
+			err = add_vlan_rewrite_action(priv,
+						      MLX5_FLOW_NAMESPACE_FDB,
+						      act, parse_attr, hdrs,
+						      &action, extack);
+			if (err)
+				return err;
+
 			attr->split_count = attr->out_count;
 			break;
 		case FLOW_ACTION_TUNNEL_DECAP:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [net-next 15/15] net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (13 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 14/15] net/mlx5e: Support VLAN modify action Saeed Mahameed
@ 2019-03-20 23:39 ` Saeed Mahameed
  2019-03-21 20:47 ` [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 David Miller
  15 siblings, 0 replies; 21+ messages in thread
From: Saeed Mahameed @ 2019-03-20 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Eli Britstein, Roi Dayan, Saeed Mahameed

From: Eli Britstein <elibr@mellanox.com>

Changing the VLAN header may be implemented by pop the existing header
and push a new one. Translate those operations as VLAN modify.
Applicable for use cases such as OVS where the controller translates a
vlan modify meta (OF) rule to DP pop+push actions rule.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 0f4e9615f666..c68edcc84af8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2664,7 +2664,17 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
 			break;
 		case FLOW_ACTION_VLAN_PUSH:
 		case FLOW_ACTION_VLAN_POP:
-			err = parse_tc_vlan_action(priv, act, attr, &action);
+			if (act->id == FLOW_ACTION_VLAN_PUSH &&
+			    (action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP)) {
+				/* Replace vlan pop+push with vlan modify */
+				action &= ~MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
+				err = add_vlan_rewrite_action(priv,
+							      MLX5_FLOW_NAMESPACE_FDB,
+							      act, parse_attr, hdrs,
+							      &action, extack);
+			} else {
+				err = parse_tc_vlan_action(priv, act, attr, &action);
+			}
 			if (err)
 				return err;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file
  2019-03-20 23:39 ` [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file Saeed Mahameed
@ 2019-03-20 23:54   ` Jakub Kicinski
  2019-03-21 11:47     ` Moshe Shemesh
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2019-03-20 23:54 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: David S. Miller, netdev, Moshe Shemesh, Or Gerlitz, John Hurley,
	Tariq Toukan

On Wed, 20 Mar 2019 16:39:53 -0700, Saeed Mahameed wrote:
> From: Moshe Shemesh <moshe@mellanox.com>
> 
> Move the definition of the default Geneve udp port from the geneve
> source to the header file, so we can re-use it from drivers.
> Modify existing drivers to use it.
> 
> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
> Cc: John Hurley <john.hurley@netronome.com>
> Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
> ---
>  drivers/net/ethernet/netronome/nfp/flower/main.h | 2 +-
>  drivers/net/geneve.c                             | 2 --
>  include/net/geneve.h                             | 2 ++
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
> index c0945a5fd1a4..7afe66eff684 100644
> --- a/drivers/net/ethernet/netronome/nfp/flower/main.h
> +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
> @@ -35,7 +35,7 @@ struct nfp_app;
>  #define NFP_FL_MASK_ID_LOCATION		1
>  
>  #define NFP_FL_VXLAN_PORT		4789
> -#define NFP_FL_GENEVE_PORT		6081
> +#define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT

Why not remove the now duplicated define and

s/NFP_FL_GENEVE_PORT/GENEVE_UDP_PORT/

throughout the code?

>  /* Extra features bitmap. */
>  #define NFP_FL_FEATS_GENEVE		BIT(0)
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index 5583d993480d..c05b1207358d 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -22,8 +22,6 @@
>  
>  #define GENEVE_NETDEV_VER	"0.6"
>  
> -#define GENEVE_UDP_PORT		6081
> -
>  #define GENEVE_N_VID		(1u << 24)
>  #define GENEVE_VID_MASK		(GENEVE_N_VID - 1)
>  
> diff --git a/include/net/geneve.h b/include/net/geneve.h
> index fc6a7e0a874a..bced0b1d9fe4 100644
> --- a/include/net/geneve.h
> +++ b/include/net/geneve.h
> @@ -4,6 +4,8 @@
>  
>  #include <net/udp_tunnel.h>
>  
> +#define GENEVE_UDP_PORT		6081
> +
>  /* Geneve Header:
>   *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>   *  |Ver|  Opt Len  |O|C|    Rsvd.  |          Protocol Type        |


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file
  2019-03-20 23:39 ` [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file Saeed Mahameed
@ 2019-03-20 23:55   ` Jakub Kicinski
  2019-03-21 11:51     ` Moshe Shemesh
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2019-03-20 23:55 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: David S. Miller, netdev, Moshe Shemesh, Or Gerlitz, John Hurley,
	Yunsheng Lin, Peng Li, Tariq Toukan

On Wed, 20 Mar 2019 16:39:56 -0700, Saeed Mahameed wrote:
> diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
> index 7afe66eff684..f214759d485b 100644
> --- a/drivers/net/ethernet/netronome/nfp/flower/main.h
> +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
> @@ -34,7 +34,7 @@ struct nfp_app;
>  #define NFP_FL_MASK_REUSE_TIME_NS	40000
>  #define NFP_FL_MASK_ID_LOCATION		1
>  
> -#define NFP_FL_VXLAN_PORT		4789
> +#define NFP_FL_VXLAN_PORT		IANA_VXLAN_UDP_PORT
>  #define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT
>  
>  /* Extra features bitmap. */

Same comment, thanks for fixing up the other drivers BTW!!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file
  2019-03-20 23:54   ` Jakub Kicinski
@ 2019-03-21 11:47     ` Moshe Shemesh
  0 siblings, 0 replies; 21+ messages in thread
From: Moshe Shemesh @ 2019-03-21 11:47 UTC (permalink / raw)
  To: Jakub Kicinski, Saeed Mahameed
  Cc: David S. Miller, netdev, Or Gerlitz, John Hurley, Tariq Toukan



On 3/21/2019 1:54 AM, Jakub Kicinski wrote:
> On Wed, 20 Mar 2019 16:39:53 -0700, Saeed Mahameed wrote:
>> From: Moshe Shemesh <moshe@mellanox.com>
>>
>> Move the definition of the default Geneve udp port from the geneve
>> source to the header file, so we can re-use it from drivers.
>> Modify existing drivers to use it.
>>
>> Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
>> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
>> Cc: John Hurley <john.hurley@netronome.com>
>> Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
>> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
>> ---
>>   drivers/net/ethernet/netronome/nfp/flower/main.h | 2 +-
>>   drivers/net/geneve.c                             | 2 --
>>   include/net/geneve.h                             | 2 ++
>>   3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
>> index c0945a5fd1a4..7afe66eff684 100644
>> --- a/drivers/net/ethernet/netronome/nfp/flower/main.h
>> +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
>> @@ -35,7 +35,7 @@ struct nfp_app;
>>   #define NFP_FL_MASK_ID_LOCATION		1
>>   
>>   #define NFP_FL_VXLAN_PORT		4789
>> -#define NFP_FL_GENEVE_PORT		6081
>> +#define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT
> 
> Why not remove the now duplicated define and
> 
> s/NFP_FL_GENEVE_PORT/GENEVE_UDP_PORT/
> 
> throughout the code?

Just thought you would prefer it this way ...
Anyway, sure, I will change it.

> 
>>   /* Extra features bitmap. */
>>   #define NFP_FL_FEATS_GENEVE		BIT(0)
>> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
>> index 5583d993480d..c05b1207358d 100644
>> --- a/drivers/net/geneve.c
>> +++ b/drivers/net/geneve.c
>> @@ -22,8 +22,6 @@
>>   
>>   #define GENEVE_NETDEV_VER	"0.6"
>>   
>> -#define GENEVE_UDP_PORT		6081
>> -
>>   #define GENEVE_N_VID		(1u << 24)
>>   #define GENEVE_VID_MASK		(GENEVE_N_VID - 1)
>>   
>> diff --git a/include/net/geneve.h b/include/net/geneve.h
>> index fc6a7e0a874a..bced0b1d9fe4 100644
>> --- a/include/net/geneve.h
>> +++ b/include/net/geneve.h
>> @@ -4,6 +4,8 @@
>>   
>>   #include <net/udp_tunnel.h>
>>   
>> +#define GENEVE_UDP_PORT		6081
>> +
>>   /* Geneve Header:
>>    *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>>    *  |Ver|  Opt Len  |O|C|    Rsvd.  |          Protocol Type        |
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file
  2019-03-20 23:55   ` Jakub Kicinski
@ 2019-03-21 11:51     ` Moshe Shemesh
  0 siblings, 0 replies; 21+ messages in thread
From: Moshe Shemesh @ 2019-03-21 11:51 UTC (permalink / raw)
  To: Jakub Kicinski, Saeed Mahameed
  Cc: David S. Miller, netdev, Or Gerlitz, John Hurley, Yunsheng Lin,
	Peng Li, Tariq Toukan



On 3/21/2019 1:55 AM, Jakub Kicinski wrote:
> On Wed, 20 Mar 2019 16:39:56 -0700, Saeed Mahameed wrote:
>> diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
>> index 7afe66eff684..f214759d485b 100644
>> --- a/drivers/net/ethernet/netronome/nfp/flower/main.h
>> +++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
>> @@ -34,7 +34,7 @@ struct nfp_app;
>>   #define NFP_FL_MASK_REUSE_TIME_NS	40000
>>   #define NFP_FL_MASK_ID_LOCATION		1
>>   
>> -#define NFP_FL_VXLAN_PORT		4789
>> +#define NFP_FL_VXLAN_PORT		IANA_VXLAN_UDP_PORT
>>   #define NFP_FL_GENEVE_PORT		GENEVE_UDP_PORT
>>   
>>   /* Extra features bitmap. */
> 
> Same comment, thanks for fixing up the other drivers BTW!!
Sure
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20
  2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
                   ` (14 preceding siblings ...)
  2019-03-20 23:39 ` [net-next 15/15] net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify Saeed Mahameed
@ 2019-03-21 20:47 ` David Miller
  15 siblings, 0 replies; 21+ messages in thread
From: David Miller @ 2019-03-21 20:47 UTC (permalink / raw)
  To: saeedm; +Cc: netdev


I'm expecting a new revision of this pull with updates to patches #9 and #13
based upon Jakub's feedback.

Thanks.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-03-21 20:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 23:39 [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 Saeed Mahameed
2019-03-20 23:39 ` [net-next 01/15] net/mlx5: Simplify sriov enable/disable flow Saeed Mahameed
2019-03-20 23:39 ` [net-next 02/15] net/mlx5: Rename total_vfs to total_vports Saeed Mahameed
2019-03-20 23:39 ` [net-next 03/15] net/mlx5: Simplify mlx5_sriov_is_enabled() by using pci core API Saeed Mahameed
2019-03-20 23:39 ` [net-next 04/15] net/mlx5: Fix compilation warning in eq.c Saeed Mahameed
2019-03-20 23:39 ` [net-next 05/15] net/mlx5e: Fix port buffer function documentation format Saeed Mahameed
2019-03-20 23:39 ` [net-next 06/15] net/mlx5e: Fix compilation warning in en_tc.c Saeed Mahameed
2019-03-20 23:39 ` [net-next 07/15] net/mlx5e: Remove redundant assignment Saeed Mahameed
2019-03-20 23:39 ` [net-next 08/15] net/mlx5: E-Switch, Protect from invalid memory access in offload fdb table Saeed Mahameed
2019-03-20 23:39 ` [net-next 09/15] net: Move the definition of the default Geneve udp port to public header file Saeed Mahameed
2019-03-20 23:54   ` Jakub Kicinski
2019-03-21 11:47     ` Moshe Shemesh
2019-03-20 23:39 ` [net-next 10/15] net/mlx5e: Take SW parser code to a separate function Saeed Mahameed
2019-03-20 23:39 ` [net-next 11/15] net/mlx5e: TX, Add geneve tunnel stateless offload support Saeed Mahameed
2019-03-20 23:39 ` [net-next 12/15] net: Add IANA_VXLAN_UDP_PORT definition to vxlan header file Saeed Mahameed
2019-03-20 23:55   ` Jakub Kicinski
2019-03-21 11:51     ` Moshe Shemesh
2019-03-20 23:39 ` [net-next 13/15] net/mlx5e: Add VLAN ID rewrite fields Saeed Mahameed
2019-03-20 23:39 ` [net-next 14/15] net/mlx5e: Support VLAN modify action Saeed Mahameed
2019-03-20 23:39 ` [net-next 15/15] net/mlx5e: Replace TC VLAN pop and push actions with VLAN modify Saeed Mahameed
2019-03-21 20:47 ` [pull request][net-next 00/15] Mellanox, mlx5 updates 2019-03-20 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.