Subject: Re: [PATCH v2 net-next 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller

From: Simon Horman <[email-masked]>
Date: Wed, 3 May 2023 09:15:57 +0200

On Tue, May 02, 2023 at 02:26:53PM -0700, Justin Chen wrote:
> On Tue, May 2, 2023 at 12:44 PM Simon Horman <[email-masked]> wrote:
> >
> > On Wed, Apr 26, 2023 at 11:54:29AM -0700, Justin Chen wrote:

...

> > > +static void bcmasp_update_mib_counters(struct bcmasp_intf *priv)
> > > +{
> > > +     int i, j = 0;
> > > +
> > > +     for (i = 0; i < BCMASP_STATS_LEN; i++) {
> > > +             const struct bcmasp_stats *s;
> > > +             u16 offset = 0;
> > > +             u32 val = 0;
> > > +             char *p;
> > > +
> > > +             s = &bcmasp_gstrings_stats[i];
> > > +             switch (s->type) {
> > > +             case BCMASP_STAT_NETDEV:
> > > +             case BCMASP_STAT_SOFT:
> > > +                     continue;
> > > +             case BCMASP_STAT_RUNT:
> > > +                     offset += BCMASP_STAT_OFFSET;
> > > +                     fallthrough;
> > > +             case BCMASP_STAT_MIB_TX:
> > > +                     offset += BCMASP_STAT_OFFSET;
> > > +                     fallthrough;
> > > +             case BCMASP_STAT_MIB_RX:
> > > +                     val = umac_rl(priv, UMC_MIB_START + j + offset);
> > > +                     offset = 0;     /* Reset Offset */
> > > +                     break;
> > > +             case BCMASP_STAT_RX_EDPKT:
> > > +                     val = rx_edpkt_core_rl(priv->parent, s->reg_offset);
> > > +                     break;
> > > +             case BCMASP_STAT_RX_CTRL:
> > > +                     offset = bcmasp_stat_fixup_offset(priv, s);
> > > +                     if (offset != ASP_RX_CTRL_FB_FILT_OUT_FRAME_COUNT)
> > > +                             offset += sizeof(u32) * priv->port;
> > > +                     val = rx_ctrl_core_rl(priv->parent, offset);
> > > +                     break;
> > > +             }
> > > +
> > > +             j += s->stat_sizeof;
> > > +             p = (char *)priv + s->stat_offset;
> > > +             *(u32 *)p = val;
> >
> > Is p always 32bit aligned?
> >
> 
> Nope. I can make sure it is 32 bit aligned.

I'm not sure if it helps, but you could also consider put_unaligned().

> Acked, the other comments. Will submit v3 when net-next window is
> open. Thank you for the review.

Likewise, thanks.