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