From: Simon Horman <horms@kernel.org>
To: Roger Quadros <rogerq@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
Julien Panis <jpanis@baylibre.com>, Andrew Lunn <andrew@lunn.ch>,
srk@ti.com, vigneshr@ti.com, danishanwar@ti.com,
pekka Varis <p-varis@ti.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [PATCH net-next v2 5/7] net: ethernet: ti: cpsw_ale: add policer/classifier helpers
Date: Mon, 1 Jul 2024 08:35:50 +0100 [thread overview]
Message-ID: <20240701073550.GK17134@kernel.org> (raw)
In-Reply-To: <20240628-am65-cpsw-multi-rx-v2-5-c399cb77db56@kernel.org>
On Fri, Jun 28, 2024 at 03:01:54PM +0300, Roger Quadros wrote:
> The Policer registers in the ALE register space are just shadow registers
> and use an index field in the policer table control register to read/write
> to the actual Polier registers.
> Add helper functions to Read and Write to Policer registers.
>
> Also add a helper function to set the thread value to classifier/policer
> mapping. Any packet that first matches the classifier will be sent to the
> thread (flow) that is set in the classifer to thread mapping table.
nit: classifier
Flagged by checkpatch.pl --codespell
> If not set then it goes to the default flow.
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
> drivers/net/ethernet/ti/cpsw_ale.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
> index 7bd0dc20f894..75a17184d34c 100644
> --- a/drivers/net/ethernet/ti/cpsw_ale.c
> +++ b/drivers/net/ethernet/ti/cpsw_ale.c
> @@ -1626,3 +1626,27 @@ u32 cpsw_ale_get_num_entries(struct cpsw_ale *ale)
> {
> return ale ? ale->params.ale_entries : 0;
> }
> +
> +/* Reads the specified policer index into ALE POLICER registers */
> +static void cpsw_ale_policer_read_idx(struct cpsw_ale *ale, u32 idx)
> +{
> + idx &= ALE_POLICER_TBL_INDEX_MASK;
> + writel_relaxed(idx, ale->params.ale_regs + ALE_POLICER_TBL_CTL);
> +}
> +
> +/* Writes the ALE POLICER registers into the specified policer index */
> +static void cpsw_ale_policer_write_idx(struct cpsw_ale *ale, u32 idx)
> +{
> + idx &= ALE_POLICER_TBL_INDEX_MASK;
> + idx |= ALE_POLICER_TBL_WRITE_ENABLE;
> + writel_relaxed(idx, ale->params.ale_regs + ALE_POLICER_TBL_CTL);
> +}
> +
> +/* enables/disables the custom thread value for the specified policer index */
> +static void cpsw_ale_policer_thread_idx_enable(struct cpsw_ale *ale, u32 idx,
> + u32 thread_id, bool enable)
> +{
> + regmap_field_write(ale->fields[ALE_THREAD_CLASS_INDEX], idx);
> + regmap_field_write(ale->fields[ALE_THREAD_VALUE], thread_id);
> + regmap_field_write(ale->fields[ALE_THREAD_ENABLE], enable ? 1 : 0);
> +}
>
I like that this patch-set is broken out into nice discrete patches,
including this one. So I'm in two minds about the comment I'm about to
make, but here goes.
As these helpers are unused this raises Warnings with W=1 builds on
gcc-13 and clang-18, which is generally undesirable for networking patches.
I can think of a few options here;
* Ignore the warnings
* Squash this patch into the following one
* Add some annotations, e.g. __maybe_unused or __always_unused.
Likely dropped in the next patch.
I think I lean towards the last option.
But I won't push the point any further regardless.
next prev parent reply other threads:[~2024-07-01 7:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 12:01 [PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: Add multi queue RX support Roger Quadros
2024-06-28 12:01 ` [PATCH net-next v2 1/7] net: ethernet: ti: am65-cpsw: Introduce multi queue Rx Roger Quadros
2024-07-01 7:35 ` Simon Horman
2024-07-01 9:44 ` Roger Quadros
2024-06-28 12:01 ` [PATCH net-next v2 2/7] net: ethernet: ti: cpsw_ale: use regfields for ALE registers Roger Quadros
2024-07-01 7:36 ` Simon Horman
2024-06-28 12:01 ` [PATCH net-next v2 3/7] net: ethernet: ti: cpsw_ale: use regfields for number of Entries and Policers Roger Quadros
2024-07-01 7:36 ` Simon Horman
2024-06-28 12:01 ` [PATCH net-next v2 4/7] net: ethernet: ti: cpsw_ale: add Policer and Thread control register fields Roger Quadros
2024-07-01 7:36 ` Simon Horman
2024-06-28 12:01 ` [PATCH net-next v2 5/7] net: ethernet: ti: cpsw_ale: add policer/classifier helpers Roger Quadros
2024-07-01 7:35 ` Simon Horman [this message]
2024-07-01 9:46 ` Roger Quadros
2024-06-28 12:01 ` [PATCH net-next v2 6/7] net: ethernet: ti: cpsw_ale: add helper to setup classifier defaults Roger Quadros
2024-07-01 7:35 ` Simon Horman
2024-07-01 10:32 ` Roger Quadros
2024-07-02 9:24 ` Simon Horman
2024-06-28 12:01 ` [PATCH net-next v2 7/7] net: ethernet: ti: am65-cpsw: setup priority to flow mapping Roger Quadros
2024-07-01 7:36 ` Simon Horman
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=20240701073550.GK17134@kernel.org \
--to=horms@kernel.org \
--cc=andrew@lunn.ch \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jpanis@baylibre.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=p-varis@ti.com \
--cc=pabeni@redhat.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.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).