mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Roger Quadros <rogerq@kernel.org>,
	Siddharth Vadapalli <s-vadapalli@ti.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	danishanwar@ti.com
Cc: srk@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 7/9] net: ethernet: ti: cpsw_ale: add policer save restore for PM sleep
Date: Thu, 8 May 2025 15:49:27 +0200	[thread overview]
Message-ID: <23278f6d-f111-46f7-a844-2cd7fbf8b623@redhat.com> (raw)
In-Reply-To: <20250505-am65-cpsw-rx-class-v2-7-5359ea025144@kernel.org>

On 5/5/25 6:26 PM, Roger Quadros wrote:
> diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
> index ce216606d915..4e29702b86ea 100644
> --- a/drivers/net/ethernet/ti/cpsw_ale.c
> +++ b/drivers/net/ethernet/ti/cpsw_ale.c
> @@ -1823,3 +1823,45 @@ int cpsw_ale_policer_set_entry(struct cpsw_ale *ale, u32 policer_idx,
>  
>  	return 0;
>  }
> +
> +void cpsw_ale_policer_save(struct cpsw_ale *ale, u32 *data)
> +{
> +	int i, idx;
> +
> +	for (idx = 0; idx < ale->params.num_policers; idx++) {
> +		cpsw_ale_policer_read_idx(ale, idx);
> +
> +		for (i = 0; i < CPSW_ALE_POLICER_ENTRY_WORDS; i++)
> +			data[i] = readl_relaxed(ale->params.ale_regs +
> +						ALE_POLICER_PORT_OUI + 4 * i);
> +
> +		regmap_field_write(ale->fields[ALE_THREAD_CLASS_INDEX], idx);
> +		data[i++] = readl_relaxed(ale->params.ale_regs +
> +					ALE_THREAD_VAL);
> +		data += i * 4;

I'm confused by the '* 4' part. I think that you just need:
		data += i

to move to the next policer context. I *think* the current code causes
OoB?!?

/P


  reply	other threads:[~2025-05-08 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 16:26 [PATCH net-next v2 0/9] net: ethernet: ti: am65-cpsw: add network flow classification support Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 1/9] net: ethernet: ti: cpsw_ale: Update Policer fields for more ALE size/ports Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 2/9] net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_add_vlan() Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 3/9] net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_vlan_add_modify() Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 4/9] net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_add_ucast() Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 5/9] net: ethernet: ti: cpsw_ale: add cpsw_ale_policer_reset_entry() Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 6/9] net: ethernet: ti: cpsw_ale: add cpsw_ale_policer_set/clr_entry() Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 7/9] net: ethernet: ti: cpsw_ale: add policer save restore for PM sleep Roger Quadros
2025-05-08 13:49   ` Paolo Abeni [this message]
2025-05-13 11:23     ` Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 8/9] net: ethernet: ti: am65-cpsw: add network flow classification support Roger Quadros
2025-05-08 14:00   ` Paolo Abeni
2025-05-13 11:41     ` Roger Quadros
2025-05-05 16:26 ` [PATCH net-next v2 9/9] net: ethernet: ti: am65-cpsw: remove cpsw_ale_classifier_setup_default() Roger Quadros

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=23278f6d-f111-46f7-a844-2cd7fbf8b623@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=rogerq@kernel.org \
    --cc=s-vadapalli@ti.com \
    --cc=srk@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

all inboxes | Powered by JetHome®