All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Cc: Ido Schimmel <idosch@nvidia.com>, Amit Cohen <amcohen@nvidia.com>,
	"Petr Machata" <petrm@nvidia.com>, <mlxsw@nvidia.com>
Subject: [PATCH net-next 13/15] mlxsw: pci: Remove mlxsw_pci_sdq_count()
Date: Tue, 2 Apr 2024 15:54:26 +0200	[thread overview]
Message-ID: <0c8788506d9af35d589dbf64be35a508fd63d681.1712062203.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1712062203.git.petrm@nvidia.com>

From: Amit Cohen <amcohen@nvidia.com>

The number of SDQs is stored as part of 'mlxsw_pci' structure. In some
cases, the driver uses this value and in some cases it calls
mlxsw_pci_sdq_count() to get the value. Align the code to use the
stored value. This simplifies the code and makes it clearer that the
value is always the same. Rename 'mlxsw_pci->num_sdq_cqs' to
'mlxsw_pci->num_sdqs' as now it is used not only in CQ context.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxsw/pci.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c
index 1839ab840b35..a7ede97a3bcc 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/pci.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c
@@ -123,7 +123,7 @@ struct mlxsw_pci {
 	struct mlxsw_bus_info bus_info;
 	const struct pci_device_id *id;
 	enum mlxsw_pci_cqe_v max_cqe_ver; /* Maximal supported CQE version */
-	u8 num_sdq_cqs; /* Number of CQs used for SDQs */
+	u8 num_sdqs; /* Number of SDQs */
 	bool skip_reset;
 };
 
@@ -188,11 +188,6 @@ static u8 __mlxsw_pci_queue_count(struct mlxsw_pci *mlxsw_pci,
 	return queue_group->count;
 }
 
-static u8 mlxsw_pci_sdq_count(struct mlxsw_pci *mlxsw_pci)
-{
-	return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_SDQ);
-}
-
 static u8 mlxsw_pci_cq_count(struct mlxsw_pci *mlxsw_pci)
 {
 	return __mlxsw_pci_queue_count(mlxsw_pci, MLXSW_PCI_QUEUE_TYPE_CQ);
@@ -391,7 +386,7 @@ static int mlxsw_pci_rdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
 			      struct mlxsw_pci_queue *q)
 {
 	struct mlxsw_pci_queue_elem_info *elem_info;
-	u8 sdq_count = mlxsw_pci_sdq_count(mlxsw_pci);
+	u8 sdq_count = mlxsw_pci->num_sdqs;
 	int i;
 	int err;
 
@@ -457,7 +452,7 @@ static void mlxsw_pci_cq_pre_init(struct mlxsw_pci *mlxsw_pci,
 	q->cq.v = mlxsw_pci->max_cqe_ver;
 
 	if (q->cq.v == MLXSW_PCI_CQE_V2 &&
-	    q->num < mlxsw_pci->num_sdq_cqs &&
+	    q->num < mlxsw_pci->num_sdqs &&
 	    !mlxsw_core_sdq_supports_cqe_v2(mlxsw_pci->core))
 		q->cq.v = MLXSW_PCI_CQE_V1;
 }
@@ -735,10 +730,10 @@ static enum mlxsw_pci_cq_type
 mlxsw_pci_cq_type(const struct mlxsw_pci *mlxsw_pci,
 		  const struct mlxsw_pci_queue *q)
 {
-	/* Each CQ is mapped to one DQ. The first 'num_sdq_cqs' queues are used
+	/* Each CQ is mapped to one DQ. The first 'num_sdqs' queues are used
 	 * for SDQs and the rest are used for RDQs.
 	 */
-	if (q->num < mlxsw_pci->num_sdq_cqs)
+	if (q->num < mlxsw_pci->num_sdqs)
 		return MLXSW_PCI_CQ_SDQ;
 
 	return MLXSW_PCI_CQ_RDQ;
@@ -1112,7 +1107,7 @@ static int mlxsw_pci_aqs_init(struct mlxsw_pci *mlxsw_pci, char *mbox)
 		return -EINVAL;
 	}
 
-	mlxsw_pci->num_sdq_cqs = num_sdqs;
+	mlxsw_pci->num_sdqs = num_sdqs;
 
 	err = mlxsw_pci_queue_group_init(mlxsw_pci, mbox, &mlxsw_pci_eq_ops,
 					 MLXSW_PCI_EQS_COUNT);
@@ -1778,7 +1773,7 @@ static struct mlxsw_pci_queue *
 mlxsw_pci_sdq_pick(struct mlxsw_pci *mlxsw_pci,
 		   const struct mlxsw_tx_info *tx_info)
 {
-	u8 ctl_sdq_count = mlxsw_pci_sdq_count(mlxsw_pci) - 1;
+	u8 ctl_sdq_count = mlxsw_pci->num_sdqs - 1;
 	u8 sdqn;
 
 	if (tx_info->is_emad) {
-- 
2.43.0


  parent reply	other threads:[~2024-04-02 13:58 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 13:54 [PATCH net-next 00/15] mlxsw: Preparations for improving performance Petr Machata
2024-04-02 13:54 ` [PATCH net-next 01/15] mlxsw: pci: Move mlxsw_pci_eq_{init, fini}() Petr Machata
2024-04-03 12:36   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 02/15] mlxsw: pci: Move mlxsw_pci_cq_{init, fini}() Petr Machata
2024-04-03 12:37   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 03/15] mlxsw: pci: Do not setup tasklet from operation Petr Machata
2024-04-03 12:37   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 04/15] mlxsw: pci: Arm CQ doorbell regardless of number of completions Petr Machata
2024-04-03 12:37   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 05/15] mlxsw: pci: Remove unused counters Petr Machata
2024-04-03 12:38   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 06/15] mlxsw: pci: Make style changes in mlxsw_pci_eq_tasklet() Petr Machata
2024-04-03 12:38   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 07/15] mlxsw: pci: Poll command interface for each cmd_exec() Petr Machata
2024-04-03 12:38   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 08/15] mlxsw: pci: Rename MLXSW_PCI_EQS_COUNT Petr Machata
2024-04-03 12:39   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 09/15] mlxsw: pci: Use only one event queue Petr Machata
2024-04-03 12:39   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 10/15] mlxsw: pci: Remove unused wait queue Petr Machata
2024-04-03 12:39   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 11/15] mlxsw: pci: Make style change in mlxsw_pci_cq_tasklet() Petr Machata
2024-04-03 12:39   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 12/15] mlxsw: pci: Break mlxsw_pci_cq_tasklet() into tasklets per queue type Petr Machata
2024-04-03 12:40   ` Simon Horman
2024-04-02 13:54 ` Petr Machata [this message]
2024-04-03 12:40   ` [PATCH net-next 13/15] mlxsw: pci: Remove mlxsw_pci_sdq_count() Simon Horman
2024-04-02 13:54 ` [PATCH net-next 14/15] mlxsw: pci: Remove mlxsw_pci_cq_count() Petr Machata
2024-04-03 12:40   ` Simon Horman
2024-04-02 13:54 ` [PATCH net-next 15/15] mlxsw: pci: Store DQ pointer as part of CQ structure Petr Machata
2024-04-03 12:40   ` Simon Horman
2024-04-04  3:50 ` [PATCH net-next 00/15] mlxsw: Preparations for improving performance patchwork-bot+netdevbpf

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=0c8788506d9af35d589dbf64be35a508fd63d681.1712062203.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=amcohen@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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.