mbox series

[net-next,0/3] net: ethernet: ti: Address some warnings

Message ID 20240910-ti-warn-v1-0-afd1e404abbe@kernel.org
Headers show
Series net: ethernet: ti: Address some warnings | expand

Message

Simon Horman Sept. 10, 2024, 7:17 a.m. UTC
Hi,

This patchset addresses some warnings flagged by Sparse, and clang-18 in
TI Ethernet drivers.

Although these changes do not alter the functionality of the code, by
addressing them real problems introduced in future which are flagged by
tooling will stand out more readily.

Compile tested only.

---
Simon Horman (3):
      net: ethernet: ti: am65-cpsw: Address __percpu Sparse warnings
      net: ethernet: ti: am65-cpsw: Use __be64 type for id_temp
      net: ethernet: ti: cpsw_ale: Remove unused accessor functions

 drivers/net/ethernet/ti/am65-cpsw-nuss.c |  8 +++-----
 drivers/net/ethernet/ti/cpsw_ale.c       | 30 +++++++++++++++++++++---------
 2 files changed, 24 insertions(+), 14 deletions(-)

base-commit: a9b1fab3b69f163bbe7a012d0c3f6b5204500c05

Comments

Jakub Kicinski Sept. 12, 2024, 12:06 a.m. UTC | #1
On Tue, 10 Sep 2024 08:17:56 +0100 Simon Horman wrote:
> An alternate, approach would be to create a variant of
> devm_add_action_or_reset() which expects __percpu data.  This would
> avoid discarding the __percpu annotation, and any value it may have
> between the casts added by this patch.  However, doing so appears to
> require a significant amount of plumbing.  And, as far as I can see, the
> code updated by this patch would be the only user of it.  So this patch
> takes a simpler approach.

Sorry if this was already discussed, but struct am65_cpsw_ndev_stats
appears to be identical to struct pcpu_sw_netstats but for ordering.
Can we let the core allocate the stats by setting
netdev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS?
Simon Horman Sept. 12, 2024, 9:58 a.m. UTC | #2
On Wed, Sep 11, 2024 at 05:06:43PM -0700, Jakub Kicinski wrote:
> On Tue, 10 Sep 2024 08:17:56 +0100 Simon Horman wrote:
> > An alternate, approach would be to create a variant of
> > devm_add_action_or_reset() which expects __percpu data.  This would
> > avoid discarding the __percpu annotation, and any value it may have
> > between the casts added by this patch.  However, doing so appears to
> > require a significant amount of plumbing.  And, as far as I can see, the
> > code updated by this patch would be the only user of it.  So this patch
> > takes a simpler approach.
> 
> Sorry if this was already discussed, but struct am65_cpsw_ndev_stats
> appears to be identical to struct pcpu_sw_netstats but for ordering.
> Can we let the core allocate the stats by setting
> netdev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS?

Hi Jakub,

Thanks for pointing that out, and sorry for not thinking of it myself.

Looking over the code, and taking a first pass at implementing this,
I believe the answer is yes :)

I also think that, as a second step, by using dev_core_stats,
the custom ndo_get_stats64() implementation can be removed.
LMKWYT.
Jakub Kicinski Sept. 12, 2024, 3:45 p.m. UTC | #3
On Thu, 12 Sep 2024 10:58:13 +0100 Simon Horman wrote:
> Thanks for pointing that out, and sorry for not thinking of it myself.
> 
> Looking over the code, and taking a first pass at implementing this,
> I believe the answer is yes :)
> 
> I also think that, as a second step, by using dev_core_stats,
> the custom ndo_get_stats64() implementation can be removed.
> LMKWYT.

Second step or one conversion patch, no preference. But AFAICT you're
right, the ndo can be completely removed thanks to the conversion.
Simon Horman Sept. 12, 2024, 7:48 p.m. UTC | #4
On Thu, Sep 12, 2024 at 08:45:15AM -0700, Jakub Kicinski wrote:
> On Thu, 12 Sep 2024 10:58:13 +0100 Simon Horman wrote:
> > Thanks for pointing that out, and sorry for not thinking of it myself.
> > 
> > Looking over the code, and taking a first pass at implementing this,
> > I believe the answer is yes :)
> > 
> > I also think that, as a second step, by using dev_core_stats,
> > the custom ndo_get_stats64() implementation can be removed.
> > LMKWYT.
> 
> Second step or one conversion patch, no preference. But AFAICT you're
> right, the ndo can be completely removed thanks to the conversion.

Thanks, I'll see about making it so.