From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Lama Kayal <lkayal@nvidia.com>
Subject: [net-next 05/15] net/mlx5e: Convert ethtool_steering member of flow_steering struct to pointer
Date: Mon, 22 Aug 2022 22:55:23 -0700 [thread overview]
Message-ID: <20220823055533.334471-6-saeed@kernel.org> (raw)
In-Reply-To: <20220823055533.334471-1-saeed@kernel.org>
From: Lama Kayal <lkayal@nvidia.com>
Convert mlx5e_ethtool_steering member of mlx5e_flow_steering to a
pointer, and allocate dynamically for each profile at flow_steering
init.
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_fs.c | 41 +++++++++++++++----
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
index a84559b2bd92..eef674cf0f1d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
@@ -50,7 +50,7 @@ struct mlx5e_flow_steering {
struct mlx5_flow_namespace *ns;
struct mlx5_flow_namespace *egress_ns;
#ifdef CONFIG_MLX5_EN_RXNFC
- struct mlx5e_ethtool_steering ethtool;
+ struct mlx5e_ethtool_steering *ethtool;
#endif
struct mlx5e_tc_table *tc;
struct mlx5e_promisc_table promisc;
@@ -1407,6 +1407,31 @@ struct mlx5e_tc_table *mlx5e_fs_get_tc(struct mlx5e_flow_steering *fs)
return fs->tc;
}
+#ifdef CONFIG_MLX5_EN_RXNFC
+static int mlx5e_fs_ethtool_alloc(struct mlx5e_flow_steering *fs)
+{
+ fs->ethtool = kvzalloc(sizeof(*fs->ethtool), GFP_KERNEL);
+
+ if (!fs->ethtool)
+ return -ENOMEM;
+ return 0;
+}
+
+static void mlx5e_fs_ethtool_free(struct mlx5e_flow_steering *fs)
+{
+ kvfree(fs->ethtool);
+}
+
+struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs)
+{
+ return fs->ethtool;
+}
+#else
+static int mlx5e_fs_ethtool_alloc(struct mlx5e_flow_steering *fs)
+{ return 0; }
+static void mlx5e_fs_ethtool_free(struct mlx5e_flow_steering *fs) { }
+#endif
+
struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
struct mlx5_core_dev *mdev,
bool state_destroy)
@@ -1432,7 +1457,13 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
goto err_free_vlan;
}
+ err = mlx5e_fs_ethtool_alloc(fs);
+ if (err)
+ goto err_free_tc;
+
return fs;
+err_free_tc:
+ mlx5e_fs_tc_free(fs);
err_free_fs:
kvfree(fs);
err_free_vlan:
@@ -1443,6 +1474,7 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,
void mlx5e_fs_cleanup(struct mlx5e_flow_steering *fs)
{
+ mlx5e_fs_ethtool_free(fs);
mlx5e_fs_tc_free(fs);
mlx5e_fs_vlan_free(fs);
kvfree(fs);
@@ -1466,13 +1498,6 @@ void mlx5e_fs_set_ns(struct mlx5e_flow_steering *fs, struct mlx5_flow_namespace
fs->egress_ns = ns;
}
-#ifdef CONFIG_MLX5_EN_RXNFC
-struct mlx5e_ethtool_steering *mlx5e_fs_get_ethtool(struct mlx5e_flow_steering *fs)
-{
- return &fs->ethtool;
-}
-#endif
-
struct mlx5_ttc_table *mlx5e_fs_get_ttc(struct mlx5e_flow_steering *fs, bool inner)
{
return inner ? fs->inner_ttc : fs->ttc;
--
2.37.1
next prev parent reply other threads:[~2022-08-23 5:56 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 5:55 [pull request][net-next 00/15] mlx5 updates 2022-08-22 Saeed Mahameed
2022-08-23 5:55 ` [net-next 01/15] net/mlx5e: Introduce flow steering API Saeed Mahameed
2022-08-24 12:30 ` patchwork-bot+netdevbpf
2022-08-23 5:55 ` [net-next 02/15] net/mlx5e: Decouple fs_tt_redirect from en.h Saeed Mahameed
2022-08-23 5:55 ` [net-next 03/15] net/mlx5e: Decouple fs_tcp " Saeed Mahameed
2022-08-23 5:55 ` [net-next 04/15] net/mlx5e: Drop priv argument of ptp function in en_fs Saeed Mahameed
2022-08-23 5:55 ` Saeed Mahameed [this message]
2022-08-23 5:55 ` [net-next 06/15] net/mlx5e: Directly get flow_steering struct as input when init/cleanup ethtool steering Saeed Mahameed
2022-08-23 5:55 ` [net-next 07/15] net/mlx5e: Separate ethtool_steering from fs.h and make private Saeed Mahameed
2022-08-23 5:55 ` [net-next 08/15] net/mlx5e: Introduce flow steering debug macros Saeed Mahameed
2022-08-23 5:55 ` [net-next 09/15] net/mlx5e: Make flow steering arfs independent of priv Saeed Mahameed
2022-08-23 5:55 ` [net-next 10/15] net/mlx5e: Make all ttc functions of en_fs get fs struct as argument Saeed Mahameed
2022-08-23 5:55 ` [net-next 11/15] net/mlx5e: Completely eliminate priv from fs.h Saeed Mahameed
2022-08-23 5:55 ` [net-next 12/15] net/mlx5: E-Switch, Add default drop rule for unmatched packets Saeed Mahameed
2022-08-23 5:55 ` [net-next 13/15] net/mlx5: E-Switch, Split creating fdb tables into smaller chunks Saeed Mahameed
2022-08-23 5:55 ` [net-next 14/15] net/mlx5: E-Switch, Move send to vport meta rule creation Saeed Mahameed
2022-08-24 14:43 ` Alexander Lobakin
2022-08-28 6:37 ` Roi Dayan
2022-08-23 5:55 ` [net-next 15/15] net/mlx5: TC, Add support for SF tunnel offload 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=20220823055533.334471-6-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lkayal@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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 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).