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>, Petr Machata <petrm@nvidia.com>,
"Amit Cohen" <amcohen@nvidia.com>, <mlxsw@nvidia.com>
Subject: [PATCH net-next 03/17] mlxsw: spectrum_fid: Split a helper out of mlxsw_sp_fid_flood_table_mid()
Date: Tue, 28 Nov 2023 16:50:36 +0100 [thread overview]
Message-ID: <fd41c66a1df4df6499d3da34f40e7b9efa15bc3e.1701183892.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1701183891.git.petrm@nvidia.com>
In future patches, for CFF flood mode support, we will need a way to
determine a PGT base dynamically, as an op. Therefore, for symmetry,
split out a helper, mlxsw_sp_fid_pgt_base_ctl(), that determines a PGT base
in the controlled mode as well.
Now that the helper is available, use it in mlxsw_sp_fid_flood_table_init()
which currently invokes the FID->MID helper to that end.
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
.../net/ethernet/mellanox/mlxsw/spectrum_fid.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
index d92c44c6ffbf..96cedc241bf2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
@@ -328,15 +328,22 @@ mlxsw_sp_fid_family_pgt_size(const struct mlxsw_sp_fid_family *fid_family)
return num_fids * fid_family->nr_flood_tables;
}
+static u16
+mlxsw_sp_fid_pgt_base_ctl(const struct mlxsw_sp_fid_family *fid_family,
+ const struct mlxsw_sp_flood_table *flood_table)
+{
+ u16 num_fids;
+
+ num_fids = mlxsw_sp_fid_family_num_fids(fid_family);
+ return fid_family->pgt_base + num_fids * flood_table->table_index;
+}
+
static u16
mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
const struct mlxsw_sp_flood_table *flood_table,
u16 fid_offset)
{
- u16 num_fids;
-
- num_fids = mlxsw_sp_fid_family_num_fids(fid_family);
- return fid_family->pgt_base + num_fids * flood_table->table_index +
+ return mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table) +
fid_offset;
}
@@ -1671,7 +1678,7 @@ mlxsw_sp_fid_flood_table_init(struct mlxsw_sp_fid_family *fid_family,
u16 mid_base;
int err, i;
- mid_base = mlxsw_sp_fid_flood_table_mid(fid_family, flood_table, 0);
+ mid_base = mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table);
sfgc_packet_types = mlxsw_sp_packet_type_sfgc_types[packet_type];
for (i = 0; i < MLXSW_REG_SFGC_TYPE_MAX; i++) {
--
2.41.0
next prev parent reply other threads:[~2023-11-28 15:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 15:50 [PATCH net-next 00/17] mlxsw: Support CFF flood mode Petr Machata
2023-11-28 15:50 ` [PATCH net-next 01/17] mlxsw: spectrum_fid: Privatize FID families Petr Machata
2023-11-28 15:50 ` [PATCH net-next 02/17] mlxsw: spectrum_fid: Rename FID ops, families, arrays Petr Machata
2023-11-28 15:50 ` Petr Machata [this message]
2023-11-28 15:50 ` [PATCH net-next 04/17] mlxsw: spectrum_fid: Make mlxsw_sp_fid_ops.setup return an int Petr Machata
2023-11-28 15:50 ` [PATCH net-next 05/17] mlxsw: spectrum_fid: Move mlxsw_sp_fid_flood_table_init() up Petr Machata
2023-11-28 15:50 ` [PATCH net-next 06/17] mlxsw: spectrum_fid: Add an op for flood table initialization Petr Machata
2023-11-28 15:50 ` [PATCH net-next 07/17] mlxsw: spectrum_fid: Add an op to get PGT allocation size Petr Machata
2023-11-28 15:50 ` [PATCH net-next 08/17] mlxsw: spectrum_fid: Add an op to get PGT address of a FID Petr Machata
2023-11-28 15:50 ` [PATCH net-next 09/17] mlxsw: spectrum_fid: Add an op for packing SFMR Petr Machata
2023-11-28 15:50 ` [PATCH net-next 10/17] mlxsw: spectrum_fid: Add a not-UC packet type Petr Machata
2023-11-28 15:50 ` [PATCH net-next 11/17] mlxsw: spectrum_fid: Add hooks for RSP table maintenance Petr Machata
2023-11-28 15:50 ` [PATCH net-next 12/17] mlxsw: spectrum_fid: Add an object to keep flood profiles Petr Machata
2023-11-28 15:50 ` [PATCH net-next 13/17] mlxsw: spectrum_fid: Add profile_id to flood profile Petr Machata
2023-11-28 15:50 ` [PATCH net-next 14/17] mlxsw: spectrum_fid: Initialize flood profiles in CFF mode Petr Machata
2023-11-28 15:50 ` [PATCH net-next 15/17] mlxsw: spectrum_fid: Add a family for bridge FIDs in CFF flood mode Petr Machata
2023-11-28 15:50 ` [PATCH net-next 16/17] mlxsw: spectrum_fid: Add support for rFID family " Petr Machata
2023-11-28 15:50 ` [PATCH net-next 17/17] mlxsw: spectrum: Use CFF mode where available Petr Machata
2023-11-29 4:02 ` [PATCH net-next 00/17] mlxsw: Support CFF flood mode Jakub Kicinski
2023-11-29 10:30 ` Petr Machata
2023-11-29 14:30 ` Jakub Kicinski
2023-11-30 10:43 ` Petr Machata
2023-11-30 4:10 ` 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=fd41c66a1df4df6499d3da34f40e7b9efa15bc3e.1701183892.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 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).