On Fri, 11 Sep 2020 15:43:43 -0700 Jakub Kicinski wrote:
> > > +       struct bnxt *bp = netdev_priv(dev);
> > > +       struct rx_port_stats *rx_stats;
> > > +       struct tx_port_stats *tx_stats;
> > > +
> > > +       if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS))
> > > +               return;
> > > +
> > > +       rx_stats = (void *)bp->port_stats.sw_stats;
> > > +       tx_stats = (void *)((unsigned long)bp->port_stats.sw_stats +
> > > +                           BNXT_TX_PORT_STATS_BYTE_OFFSET);
> > > +
> > > +       epstat->rx_pause_frames = rx_stats->rx_pause_frames;
> > > +       epstat->tx_pause_frames = tx_stats->tx_pause_frames;    
> > 
> > This will work, but the types on the 2 sides don't match.  On the
> > right hand side, since you are casting to the hardware struct
> > rx_port_stats and tx_port_stats, the types are __le64.
> > 
> > If rx_stats and tx_stats are *u64 and you use these macros:
> > 
> > BNXT_GET_RX_PORT_STATS64(rx_stats, rx_pause_frames)
> > BNXT_GET_TX_PORT_STATS64(tx_stats, tx_pause_frames)
> > 
> > the results will be the same with native CPU u64 types.  
> 
> Thanks! My build bot just poked me about this as well.
> 
> I don't see any byte swaps in bnxt_get_ethtool_stats() - 
> are they not needed there? I'm slightly confused.

Oof those macros don't byte swap either, even more confused now :)

Reply via email to