netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Wei Fang <wei.fang@nxp.com>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH net-next 1/3] net: enetc: change the statistics of ring to unsigned long type
Date: Mon, 23 Jun 2025 17:28:33 +0100	[thread overview]
Message-ID: <20250623162833.GD506049@horms.kernel.org> (raw)
In-Reply-To: <PAXPR04MB851070E3D67D390B7A4114F88879A@PAXPR04MB8510.eurprd04.prod.outlook.com>

On Mon, Jun 23, 2025 at 01:49:59AM +0000, Wei Fang wrote:
> > >  struct enetc_ring_stats {
> > > -	unsigned int packets;
> > > -	unsigned int bytes;
> > > -	unsigned int rx_alloc_errs;
> > > -	unsigned int xdp_drops;
> > > -	unsigned int xdp_tx;
> > > -	unsigned int xdp_tx_drops;
> > > -	unsigned int xdp_redirect;
> > > -	unsigned int xdp_redirect_failures;
> > > -	unsigned int recycles;
> > > -	unsigned int recycle_failures;
> > > -	unsigned int win_drop;
> > > +	unsigned long packets;
> > > +	unsigned long bytes;
> > > +	unsigned long rx_alloc_errs;
> > > +	unsigned long xdp_drops;
> > > +	unsigned long xdp_tx;
> > > +	unsigned long xdp_tx_drops;
> > > +	unsigned long xdp_redirect;
> > > +	unsigned long xdp_redirect_failures;
> > > +	unsigned long recycles;
> > > +	unsigned long recycle_failures;
> > > +	unsigned long win_drop;
> > >  };
> > 
> > Hi Wei fang,
> > 
> > If the desire is for an unsigned 64 bit integer, then I think either u64 or unsigned
> > long long would be good choices.
> > 
> > unsigned long may be 64bit or 32bit depending on the platform.
> 
> The use of unsigned long is to keep it consistent with the statistical
> value type in struct net_device_stats. Because some statistics in
> net_device_stats come from enetc_ring_stats.
> 
> #define NET_DEV_STAT(FIELD)			\
> 	union {					\
> 		unsigned long FIELD;		\
> 		atomic_long_t __##FIELD;	\
> 	}

Thanks, I understand. But in this case I think the patch description could
be reworded - unsigned int and unsigned long are the same thing on some
systems, and on such systems there is no overflow advantage of one over the
other.

  reply	other threads:[~2025-06-23 16:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 10:21 [PATCH net-next 0/3] change some statistics to 64-bit Wei Fang
2025-06-20 10:21 ` [PATCH net-next 1/3] net: enetc: change the statistics of ring to unsigned long type Wei Fang
2025-06-20 12:51   ` Claudiu Manoil
2025-06-21  9:52   ` Simon Horman
2025-06-23  1:49     ` Wei Fang
2025-06-23 16:28       ` Simon Horman [this message]
2025-06-24  1:34         ` Wei Fang
2025-06-20 10:21 ` [PATCH net-next 2/3] net: enetc: separate 64-bit counters from enetc_port_counters Wei Fang
2025-06-20 12:51   ` Claudiu Manoil
2025-06-21 10:36   ` Simon Horman
2025-06-23  3:13     ` Wei Fang
2025-06-23 16:32       ` Simon Horman
2025-06-20 10:21 ` [PATCH net-next 3/3] net: enetc: read 64-bit statistics from port MAC counters Wei Fang
2025-06-20 12:51   ` Claudiu Manoil

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=20250623162833.GD506049@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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).