Re: [PATCH v4 net-next 2/2] net: dsa: qca: ar9331: export stats64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +struct ar9331_sw_stats {
> > +       u64 rxbroad;
> > +       u64 rxpause;
> > +       u64 rxmulti;
> > +};

7> > +struct ar9331_sw_port {
> > +       int idx;
> > +       struct ar9331_sw_priv *priv;
> > +       struct delayed_work mib_read;
> > +       struct ar9331_sw_stats stats;


> > +static void ar9331_stats_update(struct ar9331_sw_port *port,
> > +                               struct rtnl_link_stats64 *stats)
> > +{
> > +       struct ar9331_sw_stats *s = &port->stats;
> > +
> > +       stats->rx_packets = s->rxbroad + s->rxmulti + s->rx64byte +
> > +               s->rx128byte + s->rx256byte + s->rx512byte + s->rx1024byte +
> > +               s->rx1518byte + s->rxmaxbyte;
> 
> Are all of these port->stats accesses always atomic? I'll need to do
> something similar in my xrs700x driver and want to make sure there
> doesn't need to be a lock between here and where they're updated in
> the delayed work.

Since these are u64, they are not atomic on 32 bit systems.

Take a look at

include/linux/u64_stats_sync.h

	Andrewu



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux