forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5e: Introduce post action infrastructure
Some tc actions are modeled in hardware using multiple tables causing a tc action list split. For example, CT action is modeled by jumping to a ct table which is controlled by nf flowtable. sFlow jumps in hardware to a sample table, which continues to a "default table" where it should continue processing the action list. Multi table actions are modeled in hardware using a unique fte_id. The fte_id is set before jumping to a table. Split actions continue to a post-action table where the matched fte_id value continues the execution the tc action list. Currently the post-action design is implemented only by the ct action. Introduce post action infrastructure as a pre-step for reusing it with the sFlow offload feature. Init and destroy the common post action table. Refactor the ct offload to use the common post table infrastructure in the next patch. Signed-off-by: Chris Mi <[email protected]> Reviewed-by: Oz Shlomo <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
- Loading branch information
Chris Mi
authored and
Saeed Mahameed
committed
Aug 20, 2021
1 parent
2799797
commit 6f0b692
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB | ||
// Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
|
||
#include "post_act.h" | ||
#include "mlx5_core.h" | ||
|
||
struct mlx5e_post_act { | ||
enum mlx5_flow_namespace_type ns_type; | ||
struct mlx5_fs_chains *chains; | ||
struct mlx5_flow_table *ft; | ||
struct mlx5e_priv *priv; | ||
}; | ||
|
||
struct mlx5e_post_act * | ||
mlx5e_tc_post_act_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, | ||
enum mlx5_flow_namespace_type ns_type) | ||
{ | ||
struct mlx5e_post_act *post_act; | ||
int err; | ||
|
||
if (ns_type == MLX5_FLOW_NAMESPACE_FDB && | ||
!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev, ignore_flow_level)) { | ||
mlx5_core_warn(priv->mdev, "firmware level support is missing\n"); | ||
err = -EOPNOTSUPP; | ||
goto err_check; | ||
} else if (!MLX5_CAP_FLOWTABLE_NIC_RX(priv->mdev, ignore_flow_level)) { | ||
mlx5_core_warn(priv->mdev, "firmware level support is missing\n"); | ||
err = -EOPNOTSUPP; | ||
goto err_check; | ||
} | ||
|
||
post_act = kzalloc(sizeof(*post_act), GFP_KERNEL); | ||
if (!post_act) { | ||
err = -ENOMEM; | ||
goto err_check; | ||
} | ||
post_act->ft = mlx5_chains_create_global_table(chains); | ||
if (IS_ERR(post_act->ft)) { | ||
err = PTR_ERR(post_act->ft); | ||
mlx5_core_warn(priv->mdev, "failed to create post action table, err: %d\n", err); | ||
goto err_ft; | ||
} | ||
post_act->chains = chains; | ||
post_act->ns_type = ns_type; | ||
post_act->priv = priv; | ||
return post_act; | ||
|
||
err_ft: | ||
kfree(post_act); | ||
err_check: | ||
return ERR_PTR(err); | ||
} | ||
|
||
void | ||
mlx5e_tc_post_act_destroy(struct mlx5e_post_act *post_act) | ||
{ | ||
if (IS_ERR_OR_NULL(post_act)) | ||
return; | ||
|
||
mlx5_chains_destroy_global_table(post_act->chains, post_act->ft); | ||
kfree(post_act); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ | ||
|
||
#ifndef __MLX5_POST_ACTION_H__ | ||
#define __MLX5_POST_ACTION_H__ | ||
|
||
#include "en.h" | ||
#include "lib/fs_chains.h" | ||
|
||
struct mlx5e_post_act * | ||
mlx5e_tc_post_act_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, | ||
enum mlx5_flow_namespace_type ns_type); | ||
|
||
void | ||
mlx5e_tc_post_act_destroy(struct mlx5e_post_act *post_act); | ||
|
||
#endif /* __MLX5_POST_ACTION_H__ */ |