All of lore.kernel.org
 help / color / mirror / Atom feed
* [pull request][net 0/8] mlx5 fixes 2021-06-01
@ 2021-06-02  1:37 Saeed Mahameed
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski; +Cc: netdev, Tariq Toukan, Saeed Mahameed

From: Saeed Mahameed <saeedm@nvidia.com>

Hi Dave, Jakub,

This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.

Thanks,
Saeed.

---
The following changes since commit b000372627ce9dbbe641dafbf40db0718276ab77:

  MAINTAINERS: nfc mailing lists are subscribers-only (2021-06-01 17:09:28 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-06-01

for you to fetch changes up to 216214c64a8c1cb9078c2c0aec7bb4a2f8e75397:

  net/mlx5: DR, Create multi-destination flow table with level less than 64 (2021-06-01 18:30:21 -0700)

----------------------------------------------------------------
mlx5-fixes-2021-06-01

----------------------------------------------------------------
Aya Levin (3):
      net/mlx5e: Fix incompatible casting
      net/mlx5e: Fix HW TS with CQE compression according to profile
      net/mlx5e: Fix conflict with HW TS and CQE compression

Moshe Shemesh (1):
      net/mlx5: Check firmware sync reset requested is set before trying to abort it

Roi Dayan (3):
      net/mlx5e: Disable TLS offload for uplink representor
      net/mlx5e: Check for needed capability for cvlan matching
      net/mlx5e: Fix adding encap rules to slow path

Yevgeny Kliteynik (1):
      net/mlx5: DR, Create multi-destination flow table with level less than 64

 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   | 12 +++-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 77 +++++++++++++++++-----
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  9 +++
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |  3 +-
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c |  3 +
 .../ethernet/mellanox/mlx5/core/lib/fs_chains.c    |  2 +-
 .../ethernet/mellanox/mlx5/core/lib/fs_chains.h    |  5 ++
 .../ethernet/mellanox/mlx5/core/steering/dr_fw.c   |  3 +-
 include/linux/mlx5/mlx5_ifc.h                      |  2 +
 9 files changed, 96 insertions(+), 20 deletions(-)

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

* [net 1/8] net/mlx5e: Fix incompatible casting
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02 17:10   ` Jakub Kicinski
                     ` (2 more replies)
  2021-06-02  1:37 ` [net 2/8] net/mlx5e: Disable TLS offload for uplink representor Saeed Mahameed
                   ` (6 subsequent siblings)
  7 siblings, 3 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Aya Levin, Saeed Mahameed

From: Aya Levin <ayal@nvidia.com>

Device supports setting of a single fec mode at a time, enforce this
by bitmap_weight == 1. Input from fec command is in u32, avoid cast to
unsigned long and use bitmap_from_arr32 to populate bitmap safely.

Fixes: 4bd9d5070b92 ("net/mlx5e: Enforce setting of a single FEC mode")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 8360289813f0..c4724742eef1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev,
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
 	struct mlx5_core_dev *mdev = priv->mdev;
+	unsigned long fec_bitmap;
 	u16 fec_policy = 0;
 	int mode;
 	int err;
 
-	if (bitmap_weight((unsigned long *)&fecparam->fec,
-			  ETHTOOL_FEC_LLRS_BIT + 1) > 1)
+	bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE);
+	if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1)
 		return -EOPNOTSUPP;
 
 	for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {
-- 
2.31.1


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

* [net 2/8] net/mlx5e: Disable TLS offload for uplink representor
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it Saeed Mahameed
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Roi Dayan, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

TLS offload is not supported in switchdev mode.

Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index ad0f69480b9c..8eed2dcc8898 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3858,6 +3858,16 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
 			netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n");
 	}
 
+	if (mlx5e_is_uplink_rep(priv)) {
+		features &= ~NETIF_F_HW_TLS_RX;
+		if (netdev->features & NETIF_F_HW_TLS_RX)
+			netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n");
+
+		features &= ~NETIF_F_HW_TLS_TX;
+		if (netdev->features & NETIF_F_HW_TLS_TX)
+			netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n");
+	}
+
 	mutex_unlock(&priv->state_lock);
 
 	return features;
-- 
2.31.1


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

* [net 3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
  2021-06-02  1:37 ` [net 2/8] net/mlx5e: Disable TLS offload for uplink representor Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 4/8] net/mlx5e: Check for needed capability for cvlan matching Saeed Mahameed
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Moshe Shemesh, Saeed Mahameed

From: Moshe Shemesh <moshe@nvidia.com>

In case driver sent NACK to firmware on sync reset request, it will get
sync reset abort event while it didn't set sync reset requested mode.
Thus, on abort sync reset event handler, driver should check reset
requested is set before trying to stop sync reset poll.

Fixes: 7dd6df329d4c ("net/mlx5: Handle sync reset abort event")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
index d5d57630015f..106b50e42b46 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
@@ -349,6 +349,9 @@ static void mlx5_sync_reset_abort_event(struct work_struct *work)
 						      reset_abort_work);
 	struct mlx5_core_dev *dev = fw_reset->dev;
 
+	if (!test_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags))
+		return;
+
 	mlx5_sync_reset_clear_reset_requested(dev, true);
 	mlx5_core_warn(dev, "PCI Sync FW Update Reset Aborted.\n");
 }
-- 
2.31.1


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

* [net 4/8] net/mlx5e: Check for needed capability for cvlan matching
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2021-06-02  1:37 ` [net 3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 5/8] net/mlx5e: Fix adding encap rules to slow path Saeed Mahameed
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Roi Dayan, Pablo Neira Ayuso, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

If not supported show an error and return instead of trying to offload
to the hardware and fail.

Fixes: 699e96ddf47f ("net/mlx5e: Support offloading tc double vlan headers match")
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 2c776e7a7692..dd64878e5b38 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2015,11 +2015,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 				    misc_parameters_3);
 	struct flow_rule *rule = flow_cls_offload_flow_rule(f);
 	struct flow_dissector *dissector = rule->match.dissector;
+	enum fs_flow_table_type fs_type;
 	u16 addr_type = 0;
 	u8 ip_proto = 0;
 	u8 *match_level;
 	int err;
 
+	fs_type = mlx5e_is_eswitch_flow(flow) ? FS_FT_FDB : FS_FT_NIC_RX;
 	match_level = outer_match_level;
 
 	if (dissector->used_keys &
@@ -2145,6 +2147,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 		if (match.mask->vlan_id ||
 		    match.mask->vlan_priority ||
 		    match.mask->vlan_tpid) {
+			if (!MLX5_CAP_FLOWTABLE_TYPE(priv->mdev, ft_field_support.outer_second_vid,
+						     fs_type)) {
+				NL_SET_ERR_MSG_MOD(extack,
+						   "Matching on CVLAN is not supported");
+				return -EOPNOTSUPP;
+			}
+
 			if (match.key->vlan_tpid == htons(ETH_P_8021AD)) {
 				MLX5_SET(fte_match_set_misc, misc_c,
 					 outer_second_svlan_tag, 1);
-- 
2.31.1


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

* [net 5/8] net/mlx5e: Fix adding encap rules to slow path
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2021-06-02  1:37 ` [net 4/8] net/mlx5e: Check for needed capability for cvlan matching Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 6/8] net/mlx5e: Fix HW TS with CQE compression according to profile Saeed Mahameed
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Roi Dayan, Paul Blakey, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

On some devices the ignore flow level cap is not supported and we
shouldn't use it. Setting the dest ft with mlx5_chains_get_tc_end_ft()
already gives the correct end ft if ignore flow level cap is supported
or not.

Fixes: 39ac237ce009 ("net/mlx5: E-Switch, Refactor chains and priorities")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 3 ++-
 drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c    | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h    | 5 +++++
 3 files changed, 8 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 db1e74280e57..d18a28a6e9a6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -219,7 +219,8 @@ esw_setup_slow_path_dest(struct mlx5_flow_destination *dest,
 			 struct mlx5_fs_chains *chains,
 			 int i)
 {
-	flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL;
+	if (mlx5_chains_ignore_flow_level_supported(chains))
+		flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL;
 	dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
 	dest[i].ft = mlx5_chains_get_tc_end_ft(chains);
 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
index 00ef10a1a9f8..20a4047f2737 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
@@ -107,7 +107,7 @@ bool mlx5_chains_prios_supported(struct mlx5_fs_chains *chains)
 	return chains->flags & MLX5_CHAINS_AND_PRIOS_SUPPORTED;
 }
 
-static bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
+bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
 {
 	return chains->flags & MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED;
 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h
index e96f345e7dae..d50bdb226cef 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h
@@ -28,6 +28,7 @@ struct mlx5_chains_attr {
 
 bool
 mlx5_chains_prios_supported(struct mlx5_fs_chains *chains);
+bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains);
 bool
 mlx5_chains_backwards_supported(struct mlx5_fs_chains *chains);
 u32
@@ -70,6 +71,10 @@ mlx5_chains_set_end_ft(struct mlx5_fs_chains *chains,
 
 #else /* CONFIG_MLX5_CLS_ACT */
 
+static inline bool
+mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
+{ return false; }
+
 static inline struct mlx5_flow_table *
 mlx5_chains_get_table(struct mlx5_fs_chains *chains, u32 chain, u32 prio,
 		      u32 level) { return ERR_PTR(-EOPNOTSUPP); }
-- 
2.31.1


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

* [net 6/8] net/mlx5e: Fix HW TS with CQE compression according to profile
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2021-06-02  1:37 ` [net 5/8] net/mlx5e: Fix adding encap rules to slow path Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 7/8] net/mlx5e: Fix conflict with HW TS and CQE compression Saeed Mahameed
  2021-06-02  1:37 ` [net 8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64 Saeed Mahameed
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Aya Levin, Moshe Shemesh, Saeed Mahameed

From: Aya Levin <ayal@nvidia.com>

When the driver's profile doesn't support a dedicated PTP-RQ, the PTP
accuracy of HW TS is affected by the CQE compression. In this case,
turn off CQE compression. Otherwise, the driver crashes:

BUG: kernel NULL pointer dereference, address:0000000000000018
...
...
RIP: 0010:mlx5e_ptp_rx_set_fs+0x25/0x1a0 [mlx5_core]
...
...
Call Trace:
 mlx5e_ptp_activate_channel+0xb2/0xf0 [mlx5_core]
 mlx5e_activate_priv_channels+0x3b9/0x8c0 [mlx5_core]
 ? __mutex_unlock_slowpath+0x45/0x2a0
 ? mlx5e_refresh_tirs+0x151/0x1e0 [mlx5_core]
 mlx5e_switch_priv_channels+0x1cd/0x2d0 [mlx5_core]
 ? mlx5e_xdp_allowed+0x150/0x150 [mlx5_core]
 mlx5e_safe_switch_params+0x118/0x3c0 [mlx5_core]
 ? __mutex_lock+0x6e/0x8e0
 ? mlx5e_hwstamp_set+0xa9/0x300 [mlx5_core]
 mlx5e_hwstamp_set+0x194/0x300 [mlx5_core]
 ? dev_ioctl+0x9b/0x3d0
 mlx5i_ioctl+0x37/0x60 [mlx5_core]
 mlx5i_pkey_ioctl+0x12/0x20 [mlx5_core]
 dev_ioctl+0xa9/0x3d0
 sock_ioctl+0x268/0x420
 __x64_sys_ioctl+0x3d8/0x790
 ? lockdep_hardirqs_on_prepare+0xe4/0x190
 do_syscall_64+0x2d/0x40
entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: 960fbfe222a4 ("net/mlx5e: Allow coexistence of CQE compression and HW TS PTP")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 67 ++++++++++++++-----
 1 file changed, 52 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8eed2dcc8898..ec6bafe7a2e5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3984,11 +3984,45 @@ int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx)
 	return mlx5e_ptp_rx_manage_fs(priv, set);
 }
 
-int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
+static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filter)
+{
+	bool rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
+	int err;
+
+	if (!rx_filter)
+		/* Reset CQE compression to Admin default */
+		return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def);
+
+	if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS))
+		return 0;
+
+	/* Disable CQE compression */
+	netdev_warn(priv->netdev, "Disabling RX cqe compression\n");
+	err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
+	if (err)
+		netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err);
+
+	return err;
+}
+
+static int mlx5e_hwstamp_config_ptp_rx(struct mlx5e_priv *priv, bool ptp_rx)
 {
 	struct mlx5e_params new_params;
+
+	if (ptp_rx == priv->channels.params.ptp_rx)
+		return 0;
+
+	new_params = priv->channels.params;
+	new_params.ptp_rx = ptp_rx;
+	return mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
+					&new_params.ptp_rx, true);
+}
+
+int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
+{
 	struct hwtstamp_config config;
 	bool rx_cqe_compress_def;
+	bool ptp_rx;
 	int err;
 
 	if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) ||
@@ -4008,13 +4042,12 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
 	}
 
 	mutex_lock(&priv->state_lock);
-	new_params = priv->channels.params;
 	rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
 
 	/* RX HW timestamp */
 	switch (config.rx_filter) {
 	case HWTSTAMP_FILTER_NONE:
-		new_params.ptp_rx = false;
+		ptp_rx = false;
 		break;
 	case HWTSTAMP_FILTER_ALL:
 	case HWTSTAMP_FILTER_SOME:
@@ -4031,24 +4064,25 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
 	case HWTSTAMP_FILTER_PTP_V2_SYNC:
 	case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
 	case HWTSTAMP_FILTER_NTP_ALL:
-		new_params.ptp_rx = rx_cqe_compress_def;
 		config.rx_filter = HWTSTAMP_FILTER_ALL;
+		/* ptp_rx is set if both HW TS is set and CQE
+		 * compression is set
+		 */
+		ptp_rx = rx_cqe_compress_def;
 		break;
 	default:
-		mutex_unlock(&priv->state_lock);
-		return -ERANGE;
+		err = -ERANGE;
+		goto err_unlock;
 	}
 
-	if (new_params.ptp_rx == priv->channels.params.ptp_rx)
-		goto out;
+	if (!priv->profile->rx_ptp_support)
+		err = mlx5e_hwstamp_config_no_ptp_rx(priv,
+						     config.rx_filter != HWTSTAMP_FILTER_NONE);
+	else
+		err = mlx5e_hwstamp_config_ptp_rx(priv, ptp_rx);
+	if (err)
+		goto err_unlock;
 
-	err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
-				       &new_params.ptp_rx, true);
-	if (err) {
-		mutex_unlock(&priv->state_lock);
-		return err;
-	}
-out:
 	memcpy(&priv->tstamp, &config, sizeof(config));
 	mutex_unlock(&priv->state_lock);
 
@@ -4057,6 +4091,9 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
 
 	return copy_to_user(ifr->ifr_data, &config,
 			    sizeof(config)) ? -EFAULT : 0;
+err_unlock:
+	mutex_unlock(&priv->state_lock);
+	return err;
 }
 
 int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr)
-- 
2.31.1


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

* [net 7/8] net/mlx5e: Fix conflict with HW TS and CQE compression
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2021-06-02  1:37 ` [net 6/8] net/mlx5e: Fix HW TS with CQE compression according to profile Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  2021-06-02  1:37 ` [net 8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64 Saeed Mahameed
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Aya Levin, Moshe Shemesh, Saeed Mahameed

From: Aya Levin <ayal@nvidia.com>

When a driver's profile doesn't support a dedicated PTP-RQ,
configuration of CQE compression while HW TS is configured should fail.

Fixes: 885b8cfb161e ("net/mlx5e: Update ethtool setting of CQE compression")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index c4724742eef1..d6513aef5cd4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1894,6 +1894,13 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val
 	if (curr_val == new_val)
 		return 0;
 
+	if (new_val && !priv->profile->rx_ptp_support &&
+	    priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) {
+		netdev_err(priv->netdev,
+			   "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n");
+		return -EINVAL;
+	}
+
 	new_params = priv->channels.params;
 	MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val);
 	if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE)
-- 
2.31.1


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

* [net 8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64
  2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2021-06-02  1:37 ` [net 7/8] net/mlx5e: Fix conflict with HW TS and CQE compression Saeed Mahameed
@ 2021-06-02  1:37 ` Saeed Mahameed
  7 siblings, 0 replies; 12+ messages in thread
From: Saeed Mahameed @ 2021-06-02  1:37 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Yevgeny Kliteynik, Alex Vesker, Saeed Mahameed

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Flow table that contains flow pointing to multiple flow tables or multiple
TIRs must have a level lower than 64. In our case it applies to muli-
destination flow table.
Fix the level of the created table to comply with HW Spec definitions, and
still make sure that its level lower than SW-owned tables, so that it
would be possible to point from the multi-destination FW table to SW
tables.

Fixes: 34583beea4b7 ("net/mlx5: DR, Create multi-destination table for SW-steering use")
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c | 3 ++-
 include/linux/mlx5/mlx5_ifc.h                            | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c
index 1fbcd012bb85..7ccfd40586ce 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c
@@ -112,7 +112,8 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
 	int ret;
 
 	ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB;
-	ft_attr.level = dmn->info.caps.max_ft_level - 2;
+	ft_attr.level = min_t(int, dmn->info.caps.max_ft_level - 2,
+			      MLX5_FT_MAX_MULTIPATH_LEVEL);
 	ft_attr.reformat_en = reformat_req;
 	ft_attr.decap_en = reformat_req;
 
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 6d16eed6850e..eb86e80e4643 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1289,6 +1289,8 @@ enum mlx5_fc_bulk_alloc_bitmask {
 
 #define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum))
 
+#define MLX5_FT_MAX_MULTIPATH_LEVEL 63
+
 enum {
 	MLX5_STEERING_FORMAT_CONNECTX_5   = 0,
 	MLX5_STEERING_FORMAT_CONNECTX_6DX = 1,
-- 
2.31.1


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

* Re: [net 1/8] net/mlx5e: Fix incompatible casting
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
@ 2021-06-02 17:10   ` Jakub Kicinski
  2021-06-02 20:30   ` patchwork-bot+netdevbpf
  2021-06-03 21:02   ` David Laight
  2 siblings, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2021-06-02 17:10 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: David S. Miller, netdev, Tariq Toukan, Aya Levin, Saeed Mahameed

On Tue,  1 Jun 2021 18:37:16 -0700 Saeed Mahameed wrote:
> From: Aya Levin <ayal@nvidia.com>
> 
> Device supports setting of a single fec mode at a time, enforce this
> by bitmap_weight == 1. Input from fec command is in u32, avoid cast to
> unsigned long and use bitmap_from_arr32 to populate bitmap safely.
> 
> Fixes: 4bd9d5070b92 ("net/mlx5e: Enforce setting of a single FEC mode")
> Signed-off-by: Aya Levin <ayal@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> index 8360289813f0..c4724742eef1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev,
>  {
>  	struct mlx5e_priv *priv = netdev_priv(netdev);
>  	struct mlx5_core_dev *mdev = priv->mdev;
> +	unsigned long fec_bitmap;
>  	u16 fec_policy = 0;
>  	int mode;
>  	int err;
>  
> -	if (bitmap_weight((unsigned long *)&fecparam->fec,
> -			  ETHTOOL_FEC_LLRS_BIT + 1) > 1)
> +	bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE);
> +	if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1)
>  		return -EOPNOTSUPP;
>  
>  	for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {

hweight32()? Not that'd be worth a respin

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

* Re: [net 1/8] net/mlx5e: Fix incompatible casting
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
  2021-06-02 17:10   ` Jakub Kicinski
@ 2021-06-02 20:30   ` patchwork-bot+netdevbpf
  2021-06-03 21:02   ` David Laight
  2 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-02 20:30 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: davem, kuba, netdev, tariqt, ayal, saeedm

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Tue,  1 Jun 2021 18:37:16 -0700 you wrote:
> From: Aya Levin <ayal@nvidia.com>
> 
> Device supports setting of a single fec mode at a time, enforce this
> by bitmap_weight == 1. Input from fec command is in u32, avoid cast to
> unsigned long and use bitmap_from_arr32 to populate bitmap safely.
> 
> Fixes: 4bd9d5070b92 ("net/mlx5e: Enforce setting of a single FEC mode")
> Signed-off-by: Aya Levin <ayal@nvidia.com>
> Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [net,1/8] net/mlx5e: Fix incompatible casting
    https://git.kernel.org/netdev/net/c/d8ec92005f80
  - [net,2/8] net/mlx5e: Disable TLS offload for uplink representor
    https://git.kernel.org/netdev/net/c/b38742e41177
  - [net,3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it
    https://git.kernel.org/netdev/net/c/5940e64281c0
  - [net,4/8] net/mlx5e: Check for needed capability for cvlan matching
    https://git.kernel.org/netdev/net/c/afe93f71b5d3
  - [net,5/8] net/mlx5e: Fix adding encap rules to slow path
    https://git.kernel.org/netdev/net/c/2a2c84facd4a
  - [net,6/8] net/mlx5e: Fix HW TS with CQE compression according to profile
    https://git.kernel.org/netdev/net/c/256f79d13c1d
  - [net,7/8] net/mlx5e: Fix conflict with HW TS and CQE compression
    https://git.kernel.org/netdev/net/c/5349cbba754e
  - [net,8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64
    https://git.kernel.org/netdev/net/c/216214c64a8c

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* RE: [net 1/8] net/mlx5e: Fix incompatible casting
  2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
  2021-06-02 17:10   ` Jakub Kicinski
  2021-06-02 20:30   ` patchwork-bot+netdevbpf
@ 2021-06-03 21:02   ` David Laight
  2 siblings, 0 replies; 12+ messages in thread
From: David Laight @ 2021-06-03 21:02 UTC (permalink / raw)
  To: 'Saeed Mahameed', David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Aya Levin, Saeed Mahameed

From: Saeed Mahameed
> Sent: 02 June 2021 02:37
> 
> Device supports setting of a single fec mode at a time, enforce this
> by bitmap_weight == 1. Input from fec command is in u32, avoid cast to
> unsigned long and use bitmap_from_arr32 to populate bitmap safely.
> 
...
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> index 8360289813f0..c4724742eef1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
> @@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev,
>  {
>  	struct mlx5e_priv *priv = netdev_priv(netdev);
>  	struct mlx5_core_dev *mdev = priv->mdev;
> +	unsigned long fec_bitmap;
>  	u16 fec_policy = 0;
>  	int mode;
>  	int err;
> 
> -	if (bitmap_weight((unsigned long *)&fecparam->fec,
> -			  ETHTOOL_FEC_LLRS_BIT + 1) > 1)
> +	bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE);
> +	if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1)
>  		return -EOPNOTSUPP;

What is wrong with:
	if (fecparam->fec & (fecparam->fec - 1))
		return -EOPNOTSUPP;

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

end of thread, other threads:[~2021-06-03 21:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  1:37 [pull request][net 0/8] mlx5 fixes 2021-06-01 Saeed Mahameed
2021-06-02  1:37 ` [net 1/8] net/mlx5e: Fix incompatible casting Saeed Mahameed
2021-06-02 17:10   ` Jakub Kicinski
2021-06-02 20:30   ` patchwork-bot+netdevbpf
2021-06-03 21:02   ` David Laight
2021-06-02  1:37 ` [net 2/8] net/mlx5e: Disable TLS offload for uplink representor Saeed Mahameed
2021-06-02  1:37 ` [net 3/8] net/mlx5: Check firmware sync reset requested is set before trying to abort it Saeed Mahameed
2021-06-02  1:37 ` [net 4/8] net/mlx5e: Check for needed capability for cvlan matching Saeed Mahameed
2021-06-02  1:37 ` [net 5/8] net/mlx5e: Fix adding encap rules to slow path Saeed Mahameed
2021-06-02  1:37 ` [net 6/8] net/mlx5e: Fix HW TS with CQE compression according to profile Saeed Mahameed
2021-06-02  1:37 ` [net 7/8] net/mlx5e: Fix conflict with HW TS and CQE compression Saeed Mahameed
2021-06-02  1:37 ` [net 8/8] net/mlx5: DR, Create multi-destination flow table with level less than 64 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.