|
|
d8f823 |
From 0fb08035db113fc3f97b196e4191fbc32abf3313 Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Tue, 19 May 2020 07:48:44 -0400
|
|
|
d8f823 |
Subject: [PATCH 222/312] [netdrv] net/mlx5: Verify goto chain offload support
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200519074934.6303-14-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 310515
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1663246 13/63] net/mlx5: Verify goto chain offload support
|
|
|
d8f823 |
Bugzilla: 1663246
|
|
|
d8f823 |
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: John Linville <linville@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1663246
|
|
|
d8f823 |
Upstream: v5.7-rc1
|
|
|
d8f823 |
|
|
|
d8f823 |
commit 2fbbc30da05d9bd32d7fefeef445db3edd28d0bd
|
|
|
d8f823 |
Author: Eli Cohen <eli@mellanox.com>
|
|
|
d8f823 |
Date: Tue Feb 18 11:59:53 2020 +0200
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5: Verify goto chain offload support
|
|
|
d8f823 |
|
|
|
d8f823 |
According to PRM, forward to flow table along with either packet
|
|
|
d8f823 |
reformat or decap is supported only if reformat_and_fwd_to_table
|
|
|
d8f823 |
capability is set for the flow table.
|
|
|
d8f823 |
|
|
|
d8f823 |
Add dependency on the capability and pack all the conditions for "goto
|
|
|
d8f823 |
chain" in a single function.
|
|
|
d8f823 |
|
|
|
d8f823 |
Fix language in error message in case of not supporting forward to a
|
|
|
d8f823 |
lower numbered flow table.
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Eli Cohen <eli@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Roi Dayan <roid@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 65 +++++++++++++++++--------
|
|
|
d8f823 |
1 file changed, 45 insertions(+), 20 deletions(-)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
|
|
|
d8f823 |
index 12773c35d261..9d6ac9a1461b 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
|
|
|
d8f823 |
@@ -3314,6 +3314,45 @@ static bool is_duplicated_output_device(struct net_device *dev,
|
|
|
d8f823 |
return false;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
|
|
|
d8f823 |
+static int mlx5_validate_goto_chain(struct mlx5_eswitch *esw,
|
|
|
d8f823 |
+ struct mlx5e_tc_flow *flow,
|
|
|
d8f823 |
+ const struct flow_action_entry *act,
|
|
|
d8f823 |
+ u32 actions,
|
|
|
d8f823 |
+ struct netlink_ext_ack *extack)
|
|
|
d8f823 |
+{
|
|
|
d8f823 |
+ u32 max_chain = mlx5_esw_chains_get_chain_range(esw);
|
|
|
d8f823 |
+ struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
|
|
d8f823 |
+ bool ft_flow = mlx5e_is_ft_flow(flow);
|
|
|
d8f823 |
+ u32 dest_chain = act->chain_index;
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ if (ft_flow) {
|
|
|
d8f823 |
+ NL_SET_ERR_MSG_MOD(extack, "Goto action is not supported");
|
|
|
d8f823 |
+ return -EOPNOTSUPP;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ if (!mlx5_esw_chains_backwards_supported(esw) &&
|
|
|
d8f823 |
+ dest_chain <= attr->chain) {
|
|
|
d8f823 |
+ NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
+ "Goto lower numbered chain isn't supported");
|
|
|
d8f823 |
+ return -EOPNOTSUPP;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+ if (dest_chain > max_chain) {
|
|
|
d8f823 |
+ NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
+ "Requested destination chain is out of supported range");
|
|
|
d8f823 |
+ return -EOPNOTSUPP;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ if (actions & (MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT |
|
|
|
d8f823 |
+ MLX5_FLOW_CONTEXT_ACTION_DECAP) &&
|
|
|
d8f823 |
+ !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, reformat_and_fwd_to_table)) {
|
|
|
d8f823 |
+ NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
+ "Goto chain is not allowed if action has reformat or decap");
|
|
|
d8f823 |
+ return -EOPNOTSUPP;
|
|
|
d8f823 |
+ }
|
|
|
d8f823 |
+
|
|
|
d8f823 |
+ return 0;
|
|
|
d8f823 |
+}
|
|
|
d8f823 |
+
|
|
|
d8f823 |
static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
|
|
|
d8f823 |
struct flow_action *flow_action,
|
|
|
d8f823 |
struct mlx5e_tc_flow *flow,
|
|
|
d8f823 |
@@ -3534,29 +3573,15 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
|
|
|
d8f823 |
case FLOW_ACTION_TUNNEL_DECAP:
|
|
|
d8f823 |
action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;
|
|
|
d8f823 |
break;
|
|
|
d8f823 |
- case FLOW_ACTION_GOTO: {
|
|
|
d8f823 |
- u32 dest_chain = act->chain_index;
|
|
|
d8f823 |
- u32 max_chain = mlx5_esw_chains_get_chain_range(esw);
|
|
|
d8f823 |
+ case FLOW_ACTION_GOTO:
|
|
|
d8f823 |
+ err = mlx5_validate_goto_chain(esw, flow, act, action,
|
|
|
d8f823 |
+ extack);
|
|
|
d8f823 |
+ if (err)
|
|
|
d8f823 |
+ return err;
|
|
|
d8f823 |
|
|
|
d8f823 |
- if (ft_flow) {
|
|
|
d8f823 |
- NL_SET_ERR_MSG_MOD(extack, "Goto action is not supported");
|
|
|
d8f823 |
- return -EOPNOTSUPP;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
- if (!mlx5_esw_chains_backwards_supported(esw) &&
|
|
|
d8f823 |
- dest_chain <= attr->chain) {
|
|
|
d8f823 |
- NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
- "Goto earlier chain isn't supported");
|
|
|
d8f823 |
- return -EOPNOTSUPP;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
- if (dest_chain > max_chain) {
|
|
|
d8f823 |
- NL_SET_ERR_MSG_MOD(extack,
|
|
|
d8f823 |
- "Requested destination chain is out of supported range");
|
|
|
d8f823 |
- return -EOPNOTSUPP;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
|
|
|
d8f823 |
- attr->dest_chain = dest_chain;
|
|
|
d8f823 |
+ attr->dest_chain = act->chain_index;
|
|
|
d8f823 |
break;
|
|
|
d8f823 |
- }
|
|
|
d8f823 |
default:
|
|
|
d8f823 |
NL_SET_ERR_MSG_MOD(extack, "The offload action is not supported");
|
|
|
d8f823 |
return -EOPNOTSUPP;
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|