netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [pull request][net-next V2 00/11] mlx5 updates 2021-01-07
@ 2021-01-12  7:05 Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 01/11] net/mlx5: Add HW definition of reg_c_preserve Saeed Mahameed
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski; +Cc: netdev, Saeed Mahameed

From: Saeed Mahameed <saeedm@nvidia.com>

Hi Dave, Jakub

This series provides misc updates for mlx5 driver. 
v1->v2:
  - Drop the +trk+new TC feature for now until we handle the module
    dependency issue.

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 c73a45965dd54a10c368191804b9de661eee1007:

  net: mvpp2: prs: improve ipv4 parse flow (2021-01-11 17:46:21 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-01-07

for you to fetch changes up to 85d1f989d2ed1462a21364e3b8f685e513dab645:

  net/mlx5e: IPsec, Remove unnecessary config flag usage (2021-01-11 23:02:28 -0800)

----------------------------------------------------------------
mlx5-updates-2021-01-07

Misc updates series for mlx5 driver:

1) From Eli and Jianbo, E-Switch cleanups and usage of new
   FW capability for mpls over udp

2) Paul Blakey, Adds support for mirroring with Connection tracking
by splitting rules to pre and post Connection tracking to perform the
mirroring.

3) Roi Dayan, cleanups for connection tracking

4) From Tariq, Cleanups and improvements to IPSec

----------------------------------------------------------------
Eli Cohen (2):
      net/mlx5e: Simplify condition on esw_vport_enable_qos()
      net/mlx5: E-Switch, use new cap as condition for mpls over udp

Jianbo Liu (1):
      net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported

Paul Blakey (1):
      net/mlx5: Add HW definition of reg_c_preserve

Roi Dayan (3):
      net/mlx5e: CT: Pass null instead of zero spec
      net/mlx5e: Remove redundant initialization to null
      net/mlx5e: CT: Remove redundant usage of zone mask

Tariq Toukan (4):
      net/mlx5e: IPsec, Enclose csum logic under ipsec config
      net/mlx5e: IPsec, Avoid unreachable return
      net/mlx5e: IPsec, Inline feature_check fast-path function
      net/mlx5e: IPsec, Remove unnecessary config flag usage

 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c |  7 ++----
 .../mellanox/mlx5/core/en/tc_tun_mplsoudp.c        |  4 +--
 .../mellanox/mlx5/core/en_accel/en_accel.h         |  4 +--
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c       | 14 -----------
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h       | 29 ++++++++++++++++++++--
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  4 ---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |  2 --
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  6 -----
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |  3 +--
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c  |  3 +--
 .../ethernet/mellanox/mlx5/core/lib/fs_chains.c    |  7 ++----
 include/linux/mlx5/mlx5_ifc.h                      |  4 ++-
 12 files changed, 40 insertions(+), 47 deletions(-)

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

* [net-next V2 01/11] net/mlx5: Add HW definition of reg_c_preserve
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 02/11] net/mlx5e: Simplify condition on esw_vport_enable_qos() Saeed Mahameed
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Paul Blakey, Maor Dickman, Roi Dayan, Saeed Mahameed

From: Paul Blakey <paulb@mellanox.com>

Add capability bit to test whether reg_c value is preserved on
recirculation.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 include/linux/mlx5/mlx5_ifc.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 442c0160caab..823411e288c0 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1278,7 +1278,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 
 	u8         reserved_at_a0[0x3];
 	u8	   ece_support[0x1];
-	u8	   reserved_at_a4[0x7];
+	u8	   reserved_at_a4[0x5];
+	u8         reg_c_preserve[0x1];
+	u8         reserved_at_aa[0x1];
 	u8         log_max_srq[0x5];
 	u8         reserved_at_b0[0x1];
 	u8         uplink_follow[0x1];
-- 
2.26.2


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

* [net-next V2 02/11] net/mlx5e: Simplify condition on esw_vport_enable_qos()
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 01/11] net/mlx5: Add HW definition of reg_c_preserve Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 03/11] net/mlx5: E-Switch, use new cap as condition for mpls over udp Saeed Mahameed
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Eli Cohen, Roi Dayan, Saeed Mahameed

From: Eli Cohen <elic@nvidia.com>

esw->qos.enabled will only be true if both MLX5_CAP_GEN(dev, qos) and
MLX5_CAP_QOS(dev, esw_scheduling) are true. Therefore, remove them from
the condition in and rely only on esw->qos.enabled.

Fixes: 1bd27b11c1df ("net/mlx5: Introduce E-switch QoS management")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index da901e364656..876e6449edb3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1042,8 +1042,7 @@ static int esw_vport_enable_qos(struct mlx5_eswitch *esw,
 	void *vport_elem;
 	int err = 0;
 
-	if (!esw->qos.enabled || !MLX5_CAP_GEN(dev, qos) ||
-	    !MLX5_CAP_QOS(dev, esw_scheduling))
+	if (!esw->qos.enabled)
 		return 0;
 
 	if (vport->qos.enabled)
-- 
2.26.2


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

* [net-next V2 03/11] net/mlx5: E-Switch, use new cap as condition for mpls over udp
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 01/11] net/mlx5: Add HW definition of reg_c_preserve Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 02/11] net/mlx5e: Simplify condition on esw_vport_enable_qos() Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 04/11] net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported Saeed Mahameed
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Eli Cohen, Roi Dayan, Mark Bloch, Saeed Mahameed

From: Eli Cohen <elic@nvidia.com>

Use tunnel_stateless_mpls_over_udp instead of
MLX5_FLEX_PROTO_CW_MPLS_UDP since new devices have native support for
mpls over udp and do not rely on flex parser.

Signed-off-by: Eli Cohen <elic@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c
index 1f9526244222..3479672e84cf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c
@@ -81,8 +81,8 @@ static int parse_tunnel(struct mlx5e_priv *priv,
 	if (!enc_keyid.mask->keyid)
 		return 0;
 
-	if (!(MLX5_CAP_GEN(priv->mdev, flex_parser_protocols) &
-	      MLX5_FLEX_PROTO_CW_MPLS_UDP))
+	if (!MLX5_CAP_ETH(priv->mdev, tunnel_stateless_mpls_over_udp) &&
+	    !(MLX5_CAP_GEN(priv->mdev, flex_parser_protocols) & MLX5_FLEX_PROTO_CW_MPLS_UDP))
 		return -EOPNOTSUPP;
 
 	flow_rule_match_mpls(rule, &match);
-- 
2.26.2


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

* [net-next V2 04/11] net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 03/11] net/mlx5: E-Switch, use new cap as condition for mpls over udp Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 05/11] net/mlx5e: CT: Pass null instead of zero spec Saeed Mahameed
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Jianbo Liu, Oz Shlomo, Roi Dayan, Saeed Mahameed

From: Jianbo Liu <jianbol@mellanox.com>

Miss path handling of tc multi chain filters (i.e. filters that are
defined on chain > 0) requires the hardware to communicate to the
driver the last chain that was processed. This is possible only when
the hardware is capable of performing the combination of modify header
and forward to table actions. Currently, if the hardware is missing
this capability then the driver only offloads rules that are defined
on tc chain 0 prio 1. However, this restriction can be relaxed because
packets that miss from chain 0 are processed through all the
priorities by tc software.

Allow the offload of all the supported priorities for chain 0 even
when the hardware is not capable to perform modify header and goto
table actions.

Fixes: 0b3a8b6b5340 ("net/mlx5: E-Switch: Fix using fwd and modify when firmware doesn't support it")
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c         | 6 ------
 drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 3 ---
 2 files changed, 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 4cdf834fa74a..56aa39ac1a1c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1317,12 +1317,6 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
 	int err = 0;
 	int out_index;
 
-	if (!mlx5_chains_prios_supported(esw_chains(esw)) && attr->prio != 1) {
-		NL_SET_ERR_MSG_MOD(extack,
-				   "E-switch priorities unsupported, upgrade FW");
-		return -EOPNOTSUPP;
-	}
-
 	/* We check chain range only for tc flows.
 	 * For ft flows, we checked attr->chain was originally 0 and set it to
 	 * FDB_FT_CHAIN which is outside tc range.
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 947f346bdc2d..fa61d305990c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
@@ -141,9 +141,6 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains)
 
 u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains)
 {
-	if (!mlx5_chains_prios_supported(chains))
-		return 1;
-
 	if (mlx5_chains_ignore_flow_level_supported(chains))
 		return UINT_MAX;
 
-- 
2.26.2


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

* [net-next V2 05/11] net/mlx5e: CT: Pass null instead of zero spec
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 04/11] net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 06/11] net/mlx5e: Remove redundant initialization to null Saeed Mahameed
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Roi Dayan, Oz Shlomo, Paul Blakey, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

No need to pass zero spec to mlx5_add_flow_rules() as the
function can handle null spec.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 072363e73f1c..97bfc42e3913 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -1241,9 +1241,8 @@ static int tc_ct_pre_ct_add_rules(struct mlx5_ct_ft *ct_ft,
 	pre_ct->flow_rule = rule;
 
 	/* add miss rule */
-	memset(spec, 0, sizeof(*spec));
 	dest.ft = nat ? ct_priv->ct_nat : ct_priv->ct;
-	rule = mlx5_add_flow_rules(ft, spec, &flow_act, &dest, 1);
+	rule = mlx5_add_flow_rules(ft, NULL, &flow_act, &dest, 1);
 	if (IS_ERR(rule)) {
 		err = PTR_ERR(rule);
 		ct_dbg("Failed to add pre ct miss rule zone %d", zone);
-- 
2.26.2


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

* [net-next V2 06/11] net/mlx5e: Remove redundant initialization to null
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 05/11] net/mlx5e: CT: Pass null instead of zero spec Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 07/11] net/mlx5e: CT: Remove redundant usage of zone mask Saeed Mahameed
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Roi Dayan, Oz Shlomo, Paul Blakey, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

miss_rule and prio_s args are not being referenced before assigned
so there is no need to init them.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 fa61d305990c..381325b4a863 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
@@ -538,13 +538,13 @@ mlx5_chains_create_prio(struct mlx5_fs_chains *chains,
 			u32 chain, u32 prio, u32 level)
 {
 	int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
-	struct mlx5_flow_handle *miss_rule = NULL;
+	struct mlx5_flow_handle *miss_rule;
 	struct mlx5_flow_group *miss_group;
 	struct mlx5_flow_table *next_ft;
 	struct mlx5_flow_table *ft;
-	struct prio *prio_s = NULL;
 	struct fs_chain *chain_s;
 	struct list_head *pos;
+	struct prio *prio_s;
 	u32 *flow_group_in;
 	int err;
 
-- 
2.26.2


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

* [net-next V2 07/11] net/mlx5e: CT: Remove redundant usage of zone mask
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 06/11] net/mlx5e: Remove redundant initialization to null Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 08/11] net/mlx5e: IPsec, Enclose csum logic under ipsec config Saeed Mahameed
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Roi Dayan, Paul Blakey, Saeed Mahameed

From: Roi Dayan <roid@nvidia.com>

The zone member is of type u16 so there is no reason to apply
the zone mask on it. This is also matching the call to set a
match in other places which don't need and don't apply the mask.

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/en/tc_ct.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 97bfc42e3913..e20c1da95a33 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -705,9 +705,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
 	attr->flags |= MLX5_ESW_ATTR_FLAG_NO_IN_PORT;
 
 	mlx5_tc_ct_set_tuple_match(netdev_priv(ct_priv->netdev), spec, flow_rule);
-	mlx5e_tc_match_to_reg_match(spec, ZONE_TO_REG,
-				    entry->tuple.zone & MLX5_CT_ZONE_MASK,
-				    MLX5_CT_ZONE_MASK);
+	mlx5e_tc_match_to_reg_match(spec, ZONE_TO_REG, entry->tuple.zone, MLX5_CT_ZONE_MASK);
 
 	zone_rule->rule = mlx5_tc_rule_insert(priv, spec, attr);
 	if (IS_ERR(zone_rule->rule)) {
-- 
2.26.2


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

* [net-next V2 08/11] net/mlx5e: IPsec, Enclose csum logic under ipsec config
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (6 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 07/11] net/mlx5e: CT: Remove redundant usage of zone mask Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 09/11] net/mlx5e: IPsec, Avoid unreachable return Saeed Mahameed
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Raed Salem, Huy Nguyen, Saeed Mahameed

From: Tariq Toukan <tariqt@nvidia.com>

All IPsec logic should be wrapped under the compile flag,
including its checksum logic.
Introduce an inline function in ipsec datapath header,
with a corresponding stub.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Huy Nguyen <huyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h  | 10 ++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c        |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
index 9df9b9a8e09b..fabf4b6b2b84 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
@@ -87,6 +87,11 @@ static inline bool mlx5e_ipsec_is_tx_flow(struct mlx5e_accel_tx_ipsec_state *ips
 	return ipsec_st->x;
 }
 
+static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
+{
+	return eseg->flow_table_metadata & cpu_to_be32(MLX5_ETH_WQE_FT_META_IPSEC);
+}
+
 void mlx5e_ipsec_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb,
 			       struct mlx5_wqe_eth_seg *eseg);
 #else
@@ -96,6 +101,11 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
 				       struct mlx5_cqe64 *cqe)
 {}
 
+static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
+{
+	return false;
+}
+
 static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; }
 #endif /* CONFIG_MLX5_EN_IPSEC */
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 61ed671fe741..74f233eece54 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -241,9 +241,8 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 		eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM;
 		sq->stats->csum_partial++;
 #endif
-	} else if (unlikely(eseg->flow_table_metadata & cpu_to_be32(MLX5_ETH_WQE_FT_META_IPSEC))) {
+	} else if (unlikely(mlx5e_ipsec_eseg_meta(eseg))) {
 		ipsec_txwqe_build_eseg_csum(sq, skb, eseg);
-
 	} else
 		sq->stats->csum_none++;
 }
-- 
2.26.2


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

* [net-next V2 09/11] net/mlx5e: IPsec, Avoid unreachable return
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (7 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 08/11] net/mlx5e: IPsec, Enclose csum logic under ipsec config Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 10/11] net/mlx5e: IPsec, Inline feature_check fast-path function Saeed Mahameed
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Huy Nguyen, Saeed Mahameed

From: Tariq Toukan <tariqt@nvidia.com>

Simple code improvement, move default return operation under
the #else block.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Huy Nguyen <huyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 1fae7fab8297..6488098d2700 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
@@ -144,9 +144,9 @@ static inline bool mlx5e_accel_tx_is_ipsec_flow(struct mlx5e_accel_tx_state *sta
 {
 #ifdef CONFIG_MLX5_EN_IPSEC
 	return mlx5e_ipsec_is_tx_flow(&state->ipsec);
-#endif
-
+#else
 	return false;
+#endif
 }
 
 static inline unsigned int mlx5e_accel_tx_ids_len(struct mlx5e_txqsq *sq,
-- 
2.26.2


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

* [net-next V2 10/11] net/mlx5e: IPsec, Inline feature_check fast-path function
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (8 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 09/11] net/mlx5e: IPsec, Avoid unreachable return Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-12  7:05 ` [net-next V2 11/11] net/mlx5e: IPsec, Remove unnecessary config flag usage Saeed Mahameed
  2021-01-13 23:41 ` [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Jakub Kicinski
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Raed Salem, Huy Nguyen, Saeed Mahameed

From: Tariq Toukan <tariqt@nvidia.com>

Feature check functions are in the TX fast-path of all SKBs, not only
IPsec traffic.
Move the IPsec feature check function into a header and turn it inline.
Use a stub and clean the config flag condition in Eth main driver file.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Huy Nguyen <huyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.c  | 14 --------------
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h  | 19 +++++++++++++++++--
 .../net/ethernet/mellanox/mlx5/core/en_main.c |  2 --
 3 files changed, 17 insertions(+), 18 deletions(-)

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 a9b45606dbdb..a97e8d205094 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
@@ -497,20 +497,6 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
 	}
 }
 
-bool mlx5e_ipsec_feature_check(struct sk_buff *skb, struct net_device *netdev,
-			       netdev_features_t features)
-{
-	struct sec_path *sp = skb_sec_path(skb);
-	struct xfrm_state *x;
-
-	if (sp && sp->len) {
-		x = sp->xvec[0];
-		if (x && x->xso.offload_handle)
-			return true;
-	}
-	return false;
-}
-
 void mlx5e_ipsec_build_inverse_table(void)
 {
 	u16 mss_inv;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
index fabf4b6b2b84..3e80742a3caf 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
@@ -57,8 +57,6 @@ struct sk_buff *mlx5e_ipsec_handle_rx_skb(struct net_device *netdev,
 					  struct sk_buff *skb, u32 *cqe_bcnt);
 
 void mlx5e_ipsec_inverse_table_init(void);
-bool mlx5e_ipsec_feature_check(struct sk_buff *skb, struct net_device *netdev,
-			       netdev_features_t features);
 void mlx5e_ipsec_set_iv_esn(struct sk_buff *skb, struct xfrm_state *x,
 			    struct xfrm_offload *xo);
 void mlx5e_ipsec_set_iv(struct sk_buff *skb, struct xfrm_state *x,
@@ -94,6 +92,21 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
 
 void mlx5e_ipsec_tx_build_eseg(struct mlx5e_priv *priv, struct sk_buff *skb,
 			       struct mlx5_wqe_eth_seg *eseg);
+
+static inline bool mlx5e_ipsec_feature_check(struct sk_buff *skb, struct net_device *netdev,
+					     netdev_features_t features)
+{
+	struct sec_path *sp = skb_sec_path(skb);
+
+	if (sp && sp->len) {
+		struct xfrm_state *x = sp->xvec[0];
+
+		if (x && x->xso.offload_handle)
+			return true;
+	}
+	return false;
+}
+
 #else
 static inline
 void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
@@ -107,6 +120,8 @@ static inline bool mlx5e_ipsec_eseg_meta(struct mlx5_wqe_eth_seg *eseg)
 }
 
 static inline bool mlx5_ipsec_is_rx_flow(struct mlx5_cqe64 *cqe) { return false; }
+static inline bool mlx5e_ipsec_feature_check(struct sk_buff *skb, struct net_device *netdev,
+					     netdev_features_t features) { return false; }
 #endif /* CONFIG_MLX5_EN_IPSEC */
 
 #endif /* __MLX5E_IPSEC_RXTX_H__ */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 1f66756f66f9..ee86b2b57f4d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4376,10 +4376,8 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb,
 	features = vlan_features_check(skb, features);
 	features = vxlan_features_check(skb, features);
 
-#ifdef CONFIG_MLX5_EN_IPSEC
 	if (mlx5e_ipsec_feature_check(skb, netdev, features))
 		return features;
-#endif
 
 	/* Validate if the tunneled packet is being offloaded by HW */
 	if (skb->encapsulation &&
-- 
2.26.2


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

* [net-next V2 11/11] net/mlx5e: IPsec, Remove unnecessary config flag usage
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (9 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 10/11] net/mlx5e: IPsec, Inline feature_check fast-path function Saeed Mahameed
@ 2021-01-12  7:05 ` Saeed Mahameed
  2021-01-13 23:41 ` [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Jakub Kicinski
  11 siblings, 0 replies; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-12  7:05 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Tariq Toukan, Raed Salem, Huy Nguyen, Saeed Mahameed

From: Tariq Toukan <tariqt@nvidia.com>

MLX5_IPSEC_DEV() is always defined, no need to protect it under config
flag CONFIG_MLX5_EN_IPSEC, especially in slow path.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Huy Nguyen <huyn@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 --
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c   | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index ee86b2b57f4d..f33c38629886 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2068,10 +2068,8 @@ static void mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev,
 	u32 buf_size = 0;
 	int i;
 
-#ifdef CONFIG_MLX5_EN_IPSEC
 	if (MLX5_IPSEC_DEV(mdev))
 		byte_count += MLX5E_METADATA_ETHER_LEN;
-#endif
 
 	if (mlx5e_rx_is_linear_skb(params, xsk)) {
 		int frag_stride;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 7f5851c61218..cb8e3d2b4750 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -1786,12 +1786,10 @@ int mlx5e_rq_set_handlers(struct mlx5e_rq *rq, struct mlx5e_params *params, bool
 		rq->dealloc_wqe = mlx5e_dealloc_rx_mpwqe;
 
 		rq->handle_rx_cqe = priv->profile->rx_handlers->handle_rx_cqe_mpwqe;
-#ifdef CONFIG_MLX5_EN_IPSEC
 		if (MLX5_IPSEC_DEV(mdev)) {
 			netdev_err(netdev, "MPWQE RQ with IPSec offload not supported\n");
 			return -EINVAL;
 		}
-#endif
 		if (!rq->handle_rx_cqe) {
 			netdev_err(netdev, "RX handler of MPWQE RQ is not set\n");
 			return -EINVAL;
-- 
2.26.2


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

* Re: [pull request][net-next V2 00/11] mlx5 updates 2021-01-07
  2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
                   ` (10 preceding siblings ...)
  2021-01-12  7:05 ` [net-next V2 11/11] net/mlx5e: IPsec, Remove unnecessary config flag usage Saeed Mahameed
@ 2021-01-13 23:41 ` Jakub Kicinski
  2021-01-14  0:01   ` Saeed Mahameed
  11 siblings, 1 reply; 15+ messages in thread
From: Jakub Kicinski @ 2021-01-13 23:41 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: David S. Miller, netdev, Saeed Mahameed

On Mon, 11 Jan 2021 23:05:23 -0800 Saeed Mahameed wrote:
> From: Saeed Mahameed <saeedm@nvidia.com>
> 
> Hi Dave, Jakub
> 
> This series provides misc updates for mlx5 driver. 
> v1->v2:
>   - Drop the +trk+new TC feature for now until we handle the module
>     dependency issue.
> 
> For more information please see tag log below.
> 
> Please pull and let me know if there is any problem.

The PR lacks sign-offs, I can apply from the list but what's the story
with the fixes tags on the patches for -next?

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

* Re: [pull request][net-next V2 00/11] mlx5 updates 2021-01-07
  2021-01-13 23:41 ` [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Jakub Kicinski
@ 2021-01-14  0:01   ` Saeed Mahameed
  2021-01-14  1:28     ` Jakub Kicinski
  0 siblings, 1 reply; 15+ messages in thread
From: Saeed Mahameed @ 2021-01-14  0:01 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David S. Miller, netdev

On Wed, 2021-01-13 at 15:41 -0800, Jakub Kicinski wrote:
> On Mon, 11 Jan 2021 23:05:23 -0800 Saeed Mahameed wrote:
> > From: Saeed Mahameed <saeedm@nvidia.com>
> > 
> > Hi Dave, Jakub
> > 
> > This series provides misc updates for mlx5 driver. 
> > v1->v2:
> >   - Drop the +trk+new TC feature for now until we handle the module
> >     dependency issue.
> > 
> > For more information please see tag log below.
> > 
> > Please pull and let me know if there is any problem.
> 
> The PR lacks sign-offs, I can apply from the list but what's the
> story

Sing-off where ? the tag ?

> with the fixes tags on the patches for -next?

the patch got migrated from net to net-next as it wasn't deemed to be a
critical bug fix but it is a bug fix .. 
do you want me to remove it ? 

thanks.


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

* Re: [pull request][net-next V2 00/11] mlx5 updates 2021-01-07
  2021-01-14  0:01   ` Saeed Mahameed
@ 2021-01-14  1:28     ` Jakub Kicinski
  0 siblings, 0 replies; 15+ messages in thread
From: Jakub Kicinski @ 2021-01-14  1:28 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: David S. Miller, netdev

On Wed, 13 Jan 2021 16:01:57 -0800 Saeed Mahameed wrote:
> On Wed, 2021-01-13 at 15:41 -0800, Jakub Kicinski wrote:
> > On Mon, 11 Jan 2021 23:05:23 -0800 Saeed Mahameed wrote:  
> > > From: Saeed Mahameed <saeedm@nvidia.com>
> > > 
> > > Hi Dave, Jakub
> > > 
> > > This series provides misc updates for mlx5 driver. 
> > > v1->v2:
> > >   - Drop the +trk+new TC feature for now until we handle the module
> > >     dependency issue.
> > > 
> > > For more information please see tag log below.
> > > 
> > > Please pull and let me know if there is any problem.  
> > 
> > The PR lacks sign-offs, I can apply from the list but what's the
> > story  
> 
> Sing-off where ? the tag ?

This is what I got when I pulled:

Commit 85d1f989d2ed ("net/mlx5e: IPsec, Remove unnecessary config flag usage")
	committer Signed-off-by missing
	author email:    tariqt@nvidia.com
	committer email: saeedm@nvidia.com
	Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Commit 509c603a3527 ("net/mlx5e: IPsec, Inline feature_check fast-path function")
	committer Signed-off-by missing
	author email:    tariqt@nvidia.com
	committer email: saeedm@nvidia.com
	Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Commit 1ba296c667ac ("net/mlx5e: IPsec, Avoid unreachable return")
	committer Signed-off-by missing
	author email:    tariqt@nvidia.com
	committer email: saeedm@nvidia.com
	Signed-off-by: Tariq Toukan <tariqt@nvidia.com>

Commit b4385e7db7ee ("net/mlx5e: IPsec, Enclose csum logic under ipsec config")
	committer Signed-off-by missing
	author email:    tariqt@nvidia.com
	committer email: saeedm@nvidia.com
	Signed-off-by: Tariq Toukan <tariqt@nvidia.com>


> > with the fixes tags on the patches for -next?  
> 
> the patch got migrated from net to net-next as it wasn't deemed to be a
> critical bug fix but it is a bug fix .. 
> do you want me to remove it ? 

I dropped the fixes tags and applied from the list, thanks!

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

end of thread, other threads:[~2021-01-14  1:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12  7:05 [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 01/11] net/mlx5: Add HW definition of reg_c_preserve Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 02/11] net/mlx5e: Simplify condition on esw_vport_enable_qos() Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 03/11] net/mlx5: E-Switch, use new cap as condition for mpls over udp Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 04/11] net/mlx5e: E-Switch, Offload all chain 0 priorities when modify header and forward action is not supported Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 05/11] net/mlx5e: CT: Pass null instead of zero spec Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 06/11] net/mlx5e: Remove redundant initialization to null Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 07/11] net/mlx5e: CT: Remove redundant usage of zone mask Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 08/11] net/mlx5e: IPsec, Enclose csum logic under ipsec config Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 09/11] net/mlx5e: IPsec, Avoid unreachable return Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 10/11] net/mlx5e: IPsec, Inline feature_check fast-path function Saeed Mahameed
2021-01-12  7:05 ` [net-next V2 11/11] net/mlx5e: IPsec, Remove unnecessary config flag usage Saeed Mahameed
2021-01-13 23:41 ` [pull request][net-next V2 00/11] mlx5 updates 2021-01-07 Jakub Kicinski
2021-01-14  0:01   ` Saeed Mahameed
2021-01-14  1:28     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).