All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23
@ 2018-03-23 22:05 Saeed Mahameed
  2018-03-23 22:05 ` [net 1/8] net/mlx5e: Don't override vport admin link state in switchdev mode Saeed Mahameed
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

The following series includes fixes for mlx5 netdev and eswitch.

For -stable v4.12
    ('net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path')
    ('net/mlx5e: Fix traffic being dropped on VF representor')

For -stable v4.13
    ('net/mlx5e: Fix memory usage issues in offloading TC flows')
    ('net/mlx5e: Verify coalescing parameters in range')

For -stable v4.14
    ('net/mlx5e: Don't override vport admin link state in switchdev mode')

For -stable v4.15
    ('108b2b6d5c02 net/mlx5e: Sync netdev vxlan ports at open')

Please pull and let me know if there's any problem.

Thanks,
Saeed.

---

The following changes since commit 1bfa26ff8c4b7512f4e4efa6df211239223033d4:

  ipv6: fix possible deadlock in rt6_age_examine_exception() (2018-03-23 13:40:34 -0400)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2018-03-23

for you to fetch changes up to dcbfde231207f7b6e1f5628d59b182198e1cfae2:

  net/mlx5e: Sync netdev vxlan ports at open (2018-03-23 14:23:50 -0700)

----------------------------------------------------------------
mlx5-fixes-2018-03-23

----------------------------------------------------------------
Jianbo Liu (2):
      net/mlx5e: Don't override vport admin link state in switchdev mode
      net/mlx5e: Fix memory usage issues in offloading TC flows

Moshe Shemesh (1):
      net/mlx5e: Verify coalescing parameters in range

Or Gerlitz (3):
      net/mlx5e: Use 32 bits to store VF representor SQ number
      net/mlx5: Make eswitch support to depend on switchdev
      net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path

Roi Dayan (1):
      net/mlx5e: Fix traffic being dropped on VF representor

Shahar Klein (1):
      net/mlx5e: Sync netdev vxlan ports at open

 drivers/net/ethernet/mellanox/mlx5/core/Kconfig    |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 17 +++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 13 ++++-----
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   | 34 ++++++++++++----------
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    | 18 ++++++------
 5 files changed, 51 insertions(+), 33 deletions(-)

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

* [net 1/8] net/mlx5e: Don't override vport admin link state in switchdev mode
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 2/8] net/mlx5e: Use 32 bits to store VF representor SQ number Saeed Mahameed
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Jianbo Liu, Saeed Mahameed

From: Jianbo Liu <jianbol@mellanox.com>

The vport admin original link state will be re-applied after returning
back to legacy mode, it is not right to change the admin link state value
when in switchdev mode.

Use direct vport commands to alter logical vport state in netdev
representor open/close flows rather than the administrative eswitch API.

Fixes: 20a1ea674783 ('net/mlx5e: Support VF vport link state control for SRIOV switchdev mode')
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-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/en_rep.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 363d8dcb7f17..0273c233bc85 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -668,7 +668,6 @@ static int mlx5e_rep_open(struct net_device *dev)
 	struct mlx5e_priv *priv = netdev_priv(dev);
 	struct mlx5e_rep_priv *rpriv = priv->ppriv;
 	struct mlx5_eswitch_rep *rep = rpriv->rep;
-	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 	int err;
 
 	mutex_lock(&priv->state_lock);
@@ -676,8 +675,9 @@ static int mlx5e_rep_open(struct net_device *dev)
 	if (err)
 		goto unlock;
 
-	if (!mlx5_eswitch_set_vport_state(esw, rep->vport,
-					  MLX5_ESW_VPORT_ADMIN_STATE_UP))
+	if (!mlx5_modify_vport_admin_state(priv->mdev,
+			MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
+			rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
 		netif_carrier_on(dev);
 
 unlock:
@@ -690,11 +690,12 @@ static int mlx5e_rep_close(struct net_device *dev)
 	struct mlx5e_priv *priv = netdev_priv(dev);
 	struct mlx5e_rep_priv *rpriv = priv->ppriv;
 	struct mlx5_eswitch_rep *rep = rpriv->rep;
-	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 	int ret;
 
 	mutex_lock(&priv->state_lock);
-	(void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
+	mlx5_modify_vport_admin_state(priv->mdev,
+			MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
+			rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
 	ret = mlx5e_close_locked(dev);
 	mutex_unlock(&priv->state_lock);
 	return ret;
-- 
2.14.3

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

* [net 2/8] net/mlx5e: Use 32 bits to store VF representor SQ number
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
  2018-03-23 22:05 ` [net 1/8] net/mlx5e: Don't override vport admin link state in switchdev mode Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 3/8] net/mlx5: Make eswitch support to depend on switchdev Saeed Mahameed
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

SQs are 32 and not 16 bits, hence it's wrong to use only 16 bits to
store the sq number for which are going to set steering rule, fix that.

Fixes: cb67b832921c ('net/mlx5e: Introduce SRIOV VF representors')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 0273c233bc85..738554a6c69f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -209,7 +209,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
 
 static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
 				 struct mlx5_eswitch_rep *rep,
-				 u16 *sqns_array, int sqns_num)
+				 u32 *sqns_array, int sqns_num)
 {
 	struct mlx5_flow_handle *flow_rule;
 	struct mlx5e_rep_priv *rpriv;
@@ -255,9 +255,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
 	struct mlx5e_channel *c;
 	int n, tc, num_sqs = 0;
 	int err = -ENOMEM;
-	u16 *sqs;
+	u32 *sqs;
 
-	sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(u16), GFP_KERNEL);
+	sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
 	if (!sqs)
 		goto out;
 
-- 
2.14.3

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

* [net 3/8] net/mlx5: Make eswitch support to depend on switchdev
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
  2018-03-23 22:05 ` [net 1/8] net/mlx5e: Don't override vport admin link state in switchdev mode Saeed Mahameed
  2018-03-23 22:05 ` [net 2/8] net/mlx5e: Use 32 bits to store VF representor SQ number Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 4/8] net/mlx5e: Verify coalescing parameters in range Saeed Mahameed
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

Add dependancy for switchdev to be congfigured as any user-space control
plane SW is expected to use the HW switchdev ID to locate the representors
related to VFs of a certain PF and apply SW/offloaded switching on them.

Fixes: e80541ecabd5 ('net/mlx5: Add CONFIG_MLX5_ESWITCH Kconfig')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/Kconfig   | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c  | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 25deaa5a534c..c032319f1cb9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -46,7 +46,7 @@ config MLX5_MPFS
 
 config MLX5_ESWITCH
 	bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
-	depends on MLX5_CORE_EN
+	depends on MLX5_CORE_EN && NET_SWITCHDEV
 	default y
 	---help---
 	  Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index da94c8cba5ee..e35859657217 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4069,7 +4069,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
 	}
 }
 
-#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH)
+#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
 static const struct switchdev_ops mlx5e_switchdev_ops = {
 	.switchdev_port_attr_get	= mlx5e_attr_get,
 };
@@ -4175,7 +4175,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 
 	mlx5e_set_netdev_dev_addr(netdev);
 
-#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH)
+#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
 	if (MLX5_VPORT_MANAGER(mdev))
 		netdev->switchdev_ops = &mlx5e_switchdev_ops;
 #endif
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 738554a6c69f..5ece289548ad 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -900,9 +900,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
 
 	netdev->ethtool_ops	  = &mlx5e_rep_ethtool_ops;
 
-#ifdef CONFIG_NET_SWITCHDEV
 	netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
-#endif
 
 	netdev->features	 |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
 	netdev->hw_features      |= NETIF_F_HW_TC;
-- 
2.14.3

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

* [net 4/8] net/mlx5e: Verify coalescing parameters in range
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2018-03-23 22:05 ` [net 3/8] net/mlx5: Make eswitch support to depend on switchdev Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 5/8] net/mlx5e: Fix traffic being dropped on VF representor Saeed Mahameed
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Moshe Shemesh, Saeed Mahameed

From: Moshe Shemesh <moshe@mellanox.com>

Add check of coalescing parameters received through ethtool are within
range of values supported by the HW.
Driver gets the coalescing rx/tx-usecs and rx/tx-frames as set by the
users through ethtool. The ethtool support up to 32 bit value for each.
However, mlx5 modify cq limits the coalescing time parameter to 12 bit
and coalescing frames parameters to 16 bits.
Return out of range error if user tries to set these parameters to
higher values.

Fixes: f62b8bb8f2d3 ('net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality')
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc8048f68f11..59ebfdae6695 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
 	return mlx5e_ethtool_get_coalesce(priv, coal);
 }
 
+#define MLX5E_MAX_COAL_TIME		MLX5_MAX_CQ_PERIOD
+#define MLX5E_MAX_COAL_FRAMES		MLX5_MAX_CQ_COUNT
+
 static void
 mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
 {
@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
 	if (!MLX5_CAP_GEN(mdev, cq_moderation))
 		return -EOPNOTSUPP;
 
+	if (coal->tx_coalesce_usecs > MLX5E_MAX_COAL_TIME ||
+	    coal->rx_coalesce_usecs > MLX5E_MAX_COAL_TIME) {
+		netdev_info(priv->netdev, "%s: maximum coalesce time supported is %lu usecs\n",
+			    __func__, MLX5E_MAX_COAL_TIME);
+		return -ERANGE;
+	}
+
+	if (coal->tx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES ||
+	    coal->rx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES) {
+		netdev_info(priv->netdev, "%s: maximum coalesced frames supported is %lu\n",
+			    __func__, MLX5E_MAX_COAL_FRAMES);
+		return -ERANGE;
+	}
+
 	mutex_lock(&priv->state_lock);
 	new_channels.params = priv->channels.params;
 
-- 
2.14.3

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

* [net 5/8] net/mlx5e: Fix traffic being dropped on VF representor
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2018-03-23 22:05 ` [net 4/8] net/mlx5e: Verify coalescing parameters in range Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 6/8] net/mlx5e: Fix memory usage issues in offloading TC flows Saeed Mahameed
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Roi Dayan, Saeed Mahameed

From: Roi Dayan <roid@mellanox.com>

Increase representor netdev RQ size to avoid dropped packets.
The current size (two) is just too small to keep up with
conventional slow path traffic patterns.
Also match the SQ size to the RQ size.

Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5ece289548ad..9a5a2a7eeab3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -44,6 +44,11 @@
 #include "en_tc.h"
 #include "fs_core.h"
 
+#define MLX5E_REP_PARAMS_LOG_SQ_SIZE \
+	max(0x6, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
+#define MLX5E_REP_PARAMS_LOG_RQ_SIZE \
+	max(0x6, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)
+
 static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
 
 static void mlx5e_rep_get_drvinfo(struct net_device *dev,
@@ -878,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
 					 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
 					 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
 
-	params->log_sq_size = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE;
+	params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
 	params->rq_wq_type  = MLX5_WQ_TYPE_LINKED_LIST;
-	params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE;
+	params->log_rq_size = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
 
 	params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
 	mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
-- 
2.14.3

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

* [net 6/8] net/mlx5e: Fix memory usage issues in offloading TC flows
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2018-03-23 22:05 ` [net 5/8] net/mlx5e: Fix traffic being dropped on VF representor Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-23 22:05 ` [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path Saeed Mahameed
  2018-03-23 22:05 ` [net 8/8] net/mlx5e: Sync netdev vxlan ports at open Saeed Mahameed
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Jianbo Liu, Saeed Mahameed

From: Jianbo Liu <jianbol@mellanox.com>

For NIC flows, the parsed attributes are not freed when we exit
successfully from mlx5e_configure_flower().

There is possible double free for eswitch flows. If error is returned
from rhashtable_insert_fast(), the parse attrs will be freed in
mlx5e_tc_del_flow(), but they will be freed again before exiting
mlx5e_configure_flower().

To fix both issues we do the following:
(1) change the condition that determines if to issue the free call to
    check if this flow is NIC flow, or it does not have encap action.
(2) reorder the code such that that the check and free calls are done
    before we attempt to add into the hash table.

Fixes: 232c001398ae ('net/mlx5e: Add support to neighbour update flow')
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index fa86a1466718..ae11678a31e8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
 	if (err != -EAGAIN)
 		flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
 
+	if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
+	    !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
+		kvfree(parse_attr);
+
 	err = rhashtable_insert_fast(&tc->ht, &flow->node,
 				     tc->ht_params);
-	if (err)
-		goto err_del_rule;
+	if (err) {
+		mlx5e_tc_del_flow(priv, flow);
+		kfree(flow);
+	}
 
-	if (flow->flags & MLX5E_TC_FLOW_ESWITCH &&
-	    !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
-		kvfree(parse_attr);
 	return err;
 
-err_del_rule:
-	mlx5e_tc_del_flow(priv, flow);
-
 err_free:
 	kvfree(parse_attr);
 	kfree(flow);
-- 
2.14.3

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

* [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2018-03-23 22:05 ` [net 6/8] net/mlx5e: Fix memory usage issues in offloading TC flows Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  2018-03-24  9:52   ` Sergei Shtylyov
  2018-03-23 22:05 ` [net 8/8] net/mlx5e: Sync netdev vxlan ports at open Saeed Mahameed
  7 siblings, 1 reply; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz, Saeed Mahameed

From: Or Gerlitz <ogerlitz@mellanox.com>

Currently we use the global ipv6_stub var to access the ipv6 global
nd table. This practice gets us to troubles when the stub is only partially
set e.g when ipv6 is loaded under the disabled policy. In this case, as of commit
343d60aada5a "ipv6: change ipv6_stub_impl.ipv6_dst_lookup to take net argument"
the stub is not null, but stub->nd_tbl is and we crash.

As we can access directly the ipv6 nd_tbl, the fix is just avoid the
reference through the stub. There is one place in the code were we
issue ipv6 route lookup and keep doing it through the stub, but that
mentioned commit makes sure we get -EAFNOSUPPORT from the stack.

Fixes: 232c001398ae ('net/mlx5e: Add support to neighbour update flow')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 9a5a2a7eeab3..500d817d2b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -293,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
 static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
 {
 #if IS_ENABLED(CONFIG_IPV6)
-	unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms,
+	unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
 						DELAY_PROBE_TIME);
 #else
 	unsigned long ipv6_interval = ~0UL;
@@ -429,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
 	case NETEVENT_NEIGH_UPDATE:
 		n = ptr;
 #if IS_ENABLED(CONFIG_IPV6)
-		if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl)
+		if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
 #else
 		if (n->tbl != &arp_tbl)
 #endif
@@ -477,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
 		 * done per device delay prob time parameter.
 		 */
 #if IS_ENABLED(CONFIG_IPV6)
-		if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl))
+		if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
 #else
 		if (!p->dev || p->tbl != &arp_tbl)
 #endif
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index ae11678a31e8..43234cabf444 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
 		tbl = &arp_tbl;
 #if IS_ENABLED(CONFIG_IPV6)
 	else if (m_neigh->family == AF_INET6)
-		tbl = ipv6_stub->nd_tbl;
+		tbl = &nd_tbl;
 #endif
 	else
 		return;
-- 
2.14.3

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

* [net 8/8] net/mlx5e: Sync netdev vxlan ports at open
  2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2018-03-23 22:05 ` [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path Saeed Mahameed
@ 2018-03-23 22:05 ` Saeed Mahameed
  7 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2018-03-23 22:05 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Shahar Klein, Saeed Mahameed

From: Shahar Klein <shahark@mellanox.com>

When mlx5_core is loaded it is expected to sync ports
with all vxlan devices so it can support vxlan encap/decap.
This is done via udp_tunnel_get_rx_info(). Currently this
call is set in mlx5e_nic_enable() and if the netdev is not in
NETREG_REGISTERED state it will not be called.

Normally on load the netdev state is not NETREG_REGISTERED
so udp_tunnel_get_rx_info() will not be called.

Moving udp_tunnel_get_rx_info() to mlx5e_open() so
it will be called on netdev UP event and allow encap/decap.

Fixes: 610e89e05c3f ("net/mlx5e: Don't sync netdev state when not registered")
Signed-off-by: Shahar Klein <shahark@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index e35859657217..9b4827d36e3e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev)
 		mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
 	mutex_unlock(&priv->state_lock);
 
+	if (mlx5e_vxlan_allowed(priv->mdev))
+		udp_tunnel_get_rx_info(netdev);
+
 	return err;
 }
 
@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 #ifdef CONFIG_MLX5_CORE_EN_DCB
 	mlx5e_dcbnl_init_app(priv);
 #endif
-	/* Device already registered: sync netdev system state */
-	if (mlx5e_vxlan_allowed(mdev)) {
-		rtnl_lock();
-		udp_tunnel_get_rx_info(netdev);
-		rtnl_unlock();
-	}
 
 	queue_work(priv->wq, &priv->set_rx_mode_work);
 
-- 
2.14.3

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

* Re: [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path
  2018-03-23 22:05 ` [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path Saeed Mahameed
@ 2018-03-24  9:52   ` Sergei Shtylyov
  0 siblings, 0 replies; 10+ messages in thread
From: Sergei Shtylyov @ 2018-03-24  9:52 UTC (permalink / raw)
  To: Saeed Mahameed, David S. Miller; +Cc: netdev, Or Gerlitz

Hello!

On 3/24/2018 1:05 AM, Saeed Mahameed wrote:

> From: Or Gerlitz <ogerlitz@mellanox.com>
> 
> Currently we use the global ipv6_stub var to access the ipv6 global
> nd table. This practice gets us to troubles when the stub is only partially
> set e.g when ipv6 is loaded under the disabled policy. In this case, as of commit
> 343d60aada5a "ipv6: change ipv6_stub_impl.ipv6_dst_lookup to take net argument"

    The summary line must be enclosed in (""), not just "".

> the stub is not null, but stub->nd_tbl is and we crash.
> 
> As we can access directly the ipv6 nd_tbl, the fix is just avoid the

As we can access the ipv6 nd_tbl directly, the fix is just to avoid the

> reference through the stub. There is one place in the code were we
                                                              ^^^^
     Where?

> issue ipv6 route lookup and keep doing it through the stub, but that
> mentioned commit makes sure we get -EAFNOSUPPORT from the stack.
> 
> Fixes: 232c001398ae ('net/mlx5e: Add support to neighbour update flow')

    ("") here as well.

> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reviewed-by: Aviv Heller <avivh@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
[...]

MBR, Sergei

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

end of thread, other threads:[~2018-03-24  9:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 22:05 [pull request][net 0/8] Mellanox, mlx5 fixes 2018-03-23 Saeed Mahameed
2018-03-23 22:05 ` [net 1/8] net/mlx5e: Don't override vport admin link state in switchdev mode Saeed Mahameed
2018-03-23 22:05 ` [net 2/8] net/mlx5e: Use 32 bits to store VF representor SQ number Saeed Mahameed
2018-03-23 22:05 ` [net 3/8] net/mlx5: Make eswitch support to depend on switchdev Saeed Mahameed
2018-03-23 22:05 ` [net 4/8] net/mlx5e: Verify coalescing parameters in range Saeed Mahameed
2018-03-23 22:05 ` [net 5/8] net/mlx5e: Fix traffic being dropped on VF representor Saeed Mahameed
2018-03-23 22:05 ` [net 6/8] net/mlx5e: Fix memory usage issues in offloading TC flows Saeed Mahameed
2018-03-23 22:05 ` [net 7/8] net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path Saeed Mahameed
2018-03-24  9:52   ` Sergei Shtylyov
2018-03-23 22:05 ` [net 8/8] net/mlx5e: Sync netdev vxlan ports at open Saeed Mahameed

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.