From: saeed@kernel•org
To: Jakub Kicinski <kuba@kernel•org>
Cc: "David S. Miller" <davem@davemloft•net>,
netdev@vger•kernel.org, Maxim Mikityanskiy <maximmi@mellanox•com>,
Tariq Toukan <tariqt@nvidia•com>,
Saeed Mahameed <saeedm@nvidia•com>
Subject: [net-next V3 15/15] net/mlx5e: Fill mlx5e_create_cq_param in a function
Date: Tue, 8 Dec 2020 11:35:55 -0800 [thread overview]
Message-ID: <20201208193555.674504-16-saeed@kernel.org> (raw)
In-Reply-To: <20201208193555.674504-1-saeed@kernel.org>
From: Maxim Mikityanskiy <maximmi@mellanox•com>
Create a function to fill the fields of struct mlx5e_create_cq_param
based on a channel. The purpose is code reuse between normal CQs, XSK
CQs and the upcoming QoS CQs.
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox•com>
Reviewed-by: Tariq Toukan <tariqt@nvidia•com>
Signed-off-by: Tariq Toukan <tariqt@nvidia•com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia•com>
---
.../net/ethernet/mellanox/mlx5/core/en/params.h | 1 +
.../ethernet/mellanox/mlx5/core/en/xsk/setup.c | 7 ++-----
.../net/ethernet/mellanox/mlx5/core/en_main.c | 17 ++++++++++++-----
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
index 3959254d4181..807147d97a0f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h
@@ -111,6 +111,7 @@ u16 mlx5e_get_rq_headroom(struct mlx5_core_dev *mdev,
/* Build queue parameters */
+void mlx5e_build_create_cq_param(struct mlx5e_create_cq_param *ccp, struct mlx5e_channel *c);
void mlx5e_build_rq_param(struct mlx5e_priv *priv,
struct mlx5e_params *params,
struct mlx5e_xsk_param *xsk,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
index 7703e6553da6..d87c345878d3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
@@ -48,14 +48,11 @@ int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,
struct mlx5e_xsk_param *xsk, struct xsk_buff_pool *pool,
struct mlx5e_channel *c)
{
- struct mlx5e_create_cq_param ccp = {};
struct mlx5e_channel_param *cparam;
+ struct mlx5e_create_cq_param ccp;
int err;
- ccp.napi = &c->napi;
- ccp.ch_stats = c->stats;
- ccp.node = cpu_to_node(c->cpu);
- ccp.ix = c->ix;
+ mlx5e_build_create_cq_param(&ccp, c);
if (!mlx5e_validate_xsk_param(params, xsk, priv->mdev))
return -EINVAL;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 2490d68cbd32..03831650f655 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -1806,18 +1806,25 @@ static int mlx5e_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
return err;
}
+void mlx5e_build_create_cq_param(struct mlx5e_create_cq_param *ccp, struct mlx5e_channel *c)
+{
+ *ccp = (struct mlx5e_create_cq_param) {
+ .napi = &c->napi,
+ .ch_stats = c->stats,
+ .node = cpu_to_node(c->cpu),
+ .ix = c->ix,
+ };
+}
+
static int mlx5e_open_queues(struct mlx5e_channel *c,
struct mlx5e_params *params,
struct mlx5e_channel_param *cparam)
{
struct dim_cq_moder icocq_moder = {0, 0};
- struct mlx5e_create_cq_param ccp = {};
+ struct mlx5e_create_cq_param ccp;
int err;
- ccp.napi = &c->napi;
- ccp.ch_stats = c->stats;
- ccp.node = cpu_to_node(c->cpu);
- ccp.ix = c->ix;
+ mlx5e_build_create_cq_param(&ccp, c);
err = mlx5e_open_cq(c->priv, icocq_moder, &cparam->icosq.cqp, &ccp,
&c->async_icosq.cq);
--
2.26.2
next prev parent reply other threads:[~2020-12-08 20:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 19:35 [pull request][net-next V3 00/15] mlx5 updates 2020-12-01 saeed
2020-12-08 19:35 ` [net-next V3 01/15] net/mlx5e: Free drop RQ in a dedicated function saeed
2020-12-08 19:35 ` [net-next V3 02/15] net/mlx5e: Allow CQ outside of channel context saeed
2020-12-08 19:35 ` [net-next V3 03/15] net/mlx5e: Allow RQ " saeed
2020-12-08 19:35 ` [net-next V3 04/15] net/mlx5e: Allow SQ " saeed
2020-12-08 19:35 ` [net-next V3 05/15] net/mlx5e: Change skb fifo push/pop API to be used without SQ saeed
2020-12-08 19:35 ` [net-next V3 06/15] net/mlx5e: Split SW group counters update function saeed
2020-12-08 19:35 ` [net-next V3 07/15] net/mlx5e: Move MLX5E_RX_ERR_CQE macro saeed
2020-12-08 19:35 ` [net-next V3 08/15] net/mlx5e: Add TX PTP port object support saeed
2020-12-08 19:35 ` [net-next V3 09/15] net/mlx5e: Add TX port timestamp support saeed
2020-12-08 19:35 ` [net-next V3 10/15] net/mlx5e: remove unnecessary memset saeed
2020-12-08 19:35 ` [net-next V3 11/15] net/mlx5e: Remove duplicated include saeed
2020-12-08 19:35 ` [net-next V3 12/15] net/mlx5: Arm only EQs with EQEs saeed
2020-12-08 19:35 ` [net-next V3 13/15] net/mlx5: Fix passing zero to 'PTR_ERR' saeed
2020-12-08 19:35 ` [net-next V3 14/15] net/mlx5e: Split between RX/TX tunnel FW support indication saeed
2020-12-08 19:35 ` saeed [this message]
2020-12-08 23:40 ` [pull request][net-next V3 00/15] mlx5 updates 2020-12-01 David Miller
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=20201208193555.674504-16-saeed@kernel.org \
--to=saeed@kernel$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=kuba@kernel$(echo .)org \
--cc=maximmi@mellanox$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=saeedm@nvidia$(echo .)com \
--cc=tariqt@nvidia$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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