From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Maor Gottlieb <maorg@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 06/16] net/mlx5e: Rename some related TTC args and functions
Date: Mon, 2 Aug 2021 19:28:43 -0700 [thread overview]
Message-ID: <20210803022853.106973-7-saeed@kernel.org> (raw)
In-Reply-To: <20210803022853.106973-1-saeed@kernel.org>
From: Maor Gottlieb <maorg@nvidia.com>
Since TTC logic is going to be moved to a separate file, make the
relevant functions and arguments that used by TTC to be mlx5 generic.
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en/fs.h | 4 +-
.../net/ethernet/mellanox/mlx5/core/en_fs.c | 41 ++++++++++---------
.../net/ethernet/mellanox/mlx5/core/en_main.c | 4 +-
3 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
index 77fe98c42ec4..6b01a28e1d93 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
@@ -104,7 +104,7 @@ enum mlx5_tunnel_types {
MLX5_NUM_TUNNEL_TT,
};
-bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
+bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
struct mlx5e_ttc_rule {
struct mlx5_flow_handle *rule;
@@ -266,7 +266,7 @@ void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
-u8 mlx5e_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
+u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
int mlx5e_add_vlan_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);
void mlx5e_remove_vlan_trap(struct mlx5e_priv *priv);
int mlx5e_add_mac_trap(struct mlx5e_priv *priv, int trap_id, int tir_num);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
index 65bc1b745bb8..14a9011ea1a1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -873,12 +873,12 @@ static void mlx5e_cleanup_ttc_rules(struct mlx5e_ttc_table *ttc)
}
}
-struct mlx5e_etype_proto {
+struct mlx5_etype_proto {
u16 etype;
u8 proto;
};
-static struct mlx5e_etype_proto ttc_rules[] = {
+static struct mlx5_etype_proto ttc_rules[] = {
[MLX5_TT_IPV4_TCP] = {
.etype = ETH_P_IP,
.proto = IPPROTO_TCP,
@@ -925,7 +925,7 @@ static struct mlx5e_etype_proto ttc_rules[] = {
},
};
-static struct mlx5e_etype_proto ttc_tunnel_rules[] = {
+static struct mlx5_etype_proto ttc_tunnel_rules[] = {
[MLX5_TT_IPV4_GRE] = {
.etype = ETH_P_IP,
.proto = IPPROTO_GRE,
@@ -953,12 +953,13 @@ static struct mlx5e_etype_proto ttc_tunnel_rules[] = {
};
-u8 mlx5e_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt)
+u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt)
{
return ttc_tunnel_rules[tt].proto;
}
-static bool mlx5e_tunnel_proto_supported_rx(struct mlx5_core_dev *mdev, u8 proto_type)
+static bool mlx5_tunnel_proto_supported_rx(struct mlx5_core_dev *mdev,
+ u8 proto_type)
{
switch (proto_type) {
case IPPROTO_GRE:
@@ -972,24 +973,26 @@ static bool mlx5e_tunnel_proto_supported_rx(struct mlx5_core_dev *mdev, u8 proto
}
}
-static bool mlx5e_tunnel_any_rx_proto_supported(struct mlx5_core_dev *mdev)
+static bool mlx5_tunnel_any_rx_proto_supported(struct mlx5_core_dev *mdev)
{
int tt;
for (tt = 0; tt < MLX5_NUM_TUNNEL_TT; tt++) {
- if (mlx5e_tunnel_proto_supported_rx(mdev, ttc_tunnel_rules[tt].proto))
+ if (mlx5_tunnel_proto_supported_rx(mdev,
+ ttc_tunnel_rules[tt].proto))
return true;
}
return false;
}
-bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev)
+bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev)
{
- return (mlx5e_tunnel_any_rx_proto_supported(mdev) &&
- MLX5_CAP_FLOWTABLE_NIC_RX(mdev, ft_field_support.inner_ip_version));
+ return (mlx5_tunnel_any_rx_proto_supported(mdev) &&
+ MLX5_CAP_FLOWTABLE_NIC_RX(mdev,
+ ft_field_support.inner_ip_version));
}
-static u8 mlx5e_etype_to_ipv(u16 ethertype)
+static u8 mlx5_etype_to_ipv(u16 ethertype)
{
if (ethertype == ETH_P_IP)
return 4;
@@ -1024,7 +1027,7 @@ mlx5e_generate_ttc_rule(struct mlx5e_priv *priv,
MLX5_SET(fte_match_param, spec->match_value, outer_headers.ip_protocol, proto);
}
- ipv = mlx5e_etype_to_ipv(etype);
+ ipv = mlx5_etype_to_ipv(etype);
if (match_ipv_outer && ipv) {
spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, outer_headers.ip_version);
@@ -1079,15 +1082,15 @@ static int mlx5e_generate_ttc_table_rules(struct mlx5e_priv *priv,
rule->default_dest = dest;
}
- if (!params->inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev))
+ if (!params->inner_ttc || !mlx5_tunnel_inner_ft_supported(priv->mdev))
return 0;
trules = ttc->tunnel_rules;
dest.type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
dest.ft = params->inner_ttc->ft.t;
for (tt = 0; tt < MLX5_NUM_TUNNEL_TT; tt++) {
- if (!mlx5e_tunnel_proto_supported_rx(priv->mdev,
- ttc_tunnel_rules[tt].proto))
+ if (!mlx5_tunnel_proto_supported_rx(priv->mdev,
+ ttc_tunnel_rules[tt].proto))
continue;
trules[tt] = mlx5e_generate_ttc_rule(priv, ft, &dest,
ttc_tunnel_rules[tt].etype,
@@ -1190,7 +1193,7 @@ mlx5e_generate_inner_ttc_rule(struct mlx5e_priv *priv,
if (!spec)
return ERR_PTR(-ENOMEM);
- ipv = mlx5e_etype_to_ipv(etype);
+ ipv = mlx5_etype_to_ipv(etype);
if (etype && ipv) {
spec->match_criteria_enable = MLX5_MATCH_INNER_HEADERS;
MLX5_SET_TO_ONES(fte_match_param, spec->match_criteria, inner_headers.ip_version);
@@ -1783,7 +1786,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
mlx5e_set_ttc_basic_params(priv, &ttc_params);
- if (mlx5e_tunnel_inner_ft_supported(priv->mdev)) {
+ if (mlx5_tunnel_inner_ft_supported(priv->mdev)) {
mlx5e_set_inner_ttc_ft_params(&ttc_params);
for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++)
ttc_params.indir_tirn[tt] =
@@ -1837,7 +1840,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)
err_destroy_ttc_table:
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
err_destroy_inner_ttc_table:
- if (mlx5e_tunnel_inner_ft_supported(priv->mdev))
+ if (mlx5_tunnel_inner_ft_supported(priv->mdev))
mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
err_destroy_arfs_tables:
mlx5e_arfs_destroy_tables(priv);
@@ -1851,7 +1854,7 @@ void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv)
mlx5e_destroy_vlan_table(priv);
mlx5e_destroy_l2_table(priv);
mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
- if (mlx5e_tunnel_inner_ft_supported(priv->mdev))
+ if (mlx5_tunnel_inner_ft_supported(priv->mdev))
mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc);
mlx5e_arfs_destroy_tables(priv);
mlx5e_ethtool_cleanup_steering(priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index c1469f5755b5..25a0b5f0984a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4151,7 +4151,7 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
/* TX inline */
mlx5_query_min_inline(mdev, ¶ms->tx_min_inline_mode);
- params->tunneled_offload_en = mlx5e_tunnel_inner_ft_supported(mdev);
+ params->tunneled_offload_en = mlx5_tunnel_inner_ft_supported(mdev);
/* AF_XDP */
params->xsk = xsk;
@@ -4212,7 +4212,7 @@ static bool mlx5e_tunnel_any_tx_proto_supported(struct mlx5_core_dev *mdev)
int tt;
for (tt = 0; tt < MLX5_NUM_TUNNEL_TT; tt++) {
- if (mlx5e_tunnel_proto_supported_tx(mdev, mlx5e_get_proto_by_tunnel_type(tt)))
+ if (mlx5e_tunnel_proto_supported_tx(mdev, mlx5_get_proto_by_tunnel_type(tt)))
return true;
}
return (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev));
--
2.31.1
next prev parent reply other threads:[~2021-08-03 2:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-03 2:28 [pull request][net-next 00/16] mlx5 updates 2021-08-02 Saeed Mahameed
2021-08-03 2:28 ` [net-next 01/16] net/mlx5e: Use a new initializer to build uniform indir table Saeed Mahameed
2021-08-03 10:30 ` patchwork-bot+netdevbpf
2021-08-03 2:28 ` [net-next 02/16] net/mlx5e: Introduce mlx5e_channels API to get RQNs Saeed Mahameed
2021-08-03 2:28 ` [net-next 03/16] net/mlx5e: Hide all implementation details of mlx5e_rx_res Saeed Mahameed
2021-08-03 2:28 ` [net-next 04/16] net/mlx5e: Allocate the array of channels according to the real max_nch Saeed Mahameed
2021-08-03 2:28 ` [net-next 05/16] net/mlx5e: Rename traffic type enums Saeed Mahameed
2021-08-03 2:28 ` Saeed Mahameed [this message]
2021-08-03 2:28 ` [net-next 07/16] net/mlx5e: Decouple TTC logic from mlx5e Saeed Mahameed
2021-08-03 2:28 ` [net-next 08/16] net/mlx5: Move TTC logic to fs_ttc Saeed Mahameed
2021-08-03 2:28 ` [net-next 09/16] net/mlx5: Embed mlx5_ttc_table Saeed Mahameed
2021-08-03 2:28 ` [net-next 10/16] net/mlx5e: Remove redundant tc act includes Saeed Mahameed
2021-08-03 2:28 ` [net-next 11/16] net/mlx5e: Remove redundant filter_dev arg from parse_tc_fdb_actions() Saeed Mahameed
2021-08-03 2:28 ` [net-next 12/16] net/mlx5e: Remove redundant cap check for flow counter Saeed Mahameed
2021-08-03 2:28 ` [net-next 13/16] net/mlx5e: Remove redundant parse_attr arg Saeed Mahameed
2021-08-03 2:28 ` [net-next 14/16] net/mlx5e: Remove redundant assignment of counter to null Saeed Mahameed
2021-08-03 2:28 ` [net-next 15/16] net/mlx5e: Return -EOPNOTSUPP if more relevant when parsing tc actions Saeed Mahameed
2021-08-03 2:28 ` [net-next 16/16] net/mlx5: Fix missing return value in mlx5_devlink_eswitch_inline_mode_set() Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210803022853.106973-7-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=maorg@nvidia.com \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.