All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Justin Chen <justinpopo6@gmail.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	bcm-kernel-feedback-list@broadcom.com, justin.chen@broadcom.com,
	f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, opendmb@gmail.com,
	andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	richardcochran@gmail.com, sumit.semwal@linaro.org,
	christian.koenig@amd.com
Subject: Re: [PATCH v2 net-next 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Date: Wed, 3 May 2023 09:15:57 +0200	[thread overview]
Message-ID: <ZFIKLRqFaJSHEIwp@corigine.com> (raw)
In-Reply-To: <CAJx26kV9E7M5ULoPqT8eJ5byaUEZDtW6v25f3DT04xs4NGcd6g@mail.gmail.com>

On Tue, May 02, 2023 at 02:26:53PM -0700, Justin Chen wrote:
> On Tue, May 2, 2023 at 12:44 PM Simon Horman <simon.horman@corigine.com> 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.

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <simon.horman@corigine.com>
To: Justin Chen <justinpopo6@gmail.com>
Cc: devicetree@vger.kernel.org, f.fainelli@gmail.com,
	opendmb@gmail.com, andrew@lunn.ch, linux@armlinux.org.uk,
	netdev@vger.kernel.org, richardcochran@gmail.com,
	hkallweit1@gmail.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, justin.chen@broadcom.com,
	edumazet@google.com, robh+dt@kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	krzysztof.kozlowski+dt@linaro.org, kuba@kernel.org,
	christian.koenig@amd.com, pabeni@redhat.com,
	sumit.semwal@linaro.org, davem@davemloft.net,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 net-next 3/6] net: bcmasp: Add support for ASP2.0 Ethernet controller
Date: Wed, 3 May 2023 09:15:57 +0200	[thread overview]
Message-ID: <ZFIKLRqFaJSHEIwp@corigine.com> (raw)
In-Reply-To: <CAJx26kV9E7M5ULoPqT8eJ5byaUEZDtW6v25f3DT04xs4NGcd6g@mail.gmail.com>

On Tue, May 02, 2023 at 02:26:53PM -0700, Justin Chen wrote:
> On Tue, May 2, 2023 at 12:44 PM Simon Horman <simon.horman@corigine.com> 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.

  reply	other threads:[~2023-05-03  7:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 18:54 [PATCH v2 net-next 0/6] Brcm ASP 2.0 Ethernet controller Justin Chen
2023-04-26 18:54 ` Justin Chen
2023-04-26 18:54 ` [PATCH v2 net-next 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.0 Justin Chen
2023-04-26 18:54   ` [PATCH v2 net-next 1/6] dt-bindings: net: brcm, unimac-mdio: " Justin Chen
2023-04-27 17:03   ` [PATCH v2 net-next 1/6] dt-bindings: net: brcm,unimac-mdio: " Rob Herring
2023-04-27 17:03     ` Rob Herring
2023-04-27 17:05     ` Florian Fainelli
2023-04-27 17:05       ` Florian Fainelli
2023-04-26 18:54 ` [PATCH v2 net-next 2/6] dt-bindings: net: Brcm ASP 2.0 Ethernet controller Justin Chen
2023-04-26 18:54   ` Justin Chen
2023-04-27 17:16   ` Rob Herring
2023-04-27 17:16     ` Rob Herring
2023-04-27 18:36     ` Justin Chen
2023-04-27 18:36       ` Justin Chen
2023-04-26 18:54 ` [PATCH v2 net-next 3/6] net: bcmasp: Add support for ASP2.0 " Justin Chen
2023-04-26 18:54   ` Justin Chen
2023-05-02 19:43   ` Simon Horman
2023-05-02 19:43     ` Simon Horman
2023-05-02 21:26     ` Justin Chen
2023-05-02 21:26       ` Justin Chen
2023-05-03  7:15       ` Simon Horman [this message]
2023-05-03  7:15         ` Simon Horman
2023-05-02 20:24   ` Christophe JAILLET
2023-05-02 20:24     ` Christophe JAILLET
2023-04-26 18:54 ` [PATCH v2 net-next 4/6] net: phy: mdio-bcm-unimac: Add asp v2.0 support Justin Chen
2023-04-26 18:54   ` Justin Chen
2023-04-26 18:54 ` [PATCH v2 net-next 5/6] net: phy: bcm7xxx: Add EPHY entry for 74165 Justin Chen
2023-04-26 18:54   ` Justin Chen
2023-04-26 18:54 ` [PATCH v2 net-next 6/6] MAINTAINERS: ASP 2.0 Ethernet driver maintainers Justin Chen
2023-04-26 18:54   ` Justin Chen
2023-04-27  6:39 ` [PATCH v2 net-next 0/6] Brcm ASP 2.0 Ethernet controller Paolo Abeni
2023-04-27  6:39   ` Paolo Abeni

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=ZFIKLRqFaJSHEIwp@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=christian.koenig@amd.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=justin.chen@broadcom.com \
    --cc=justinpopo6@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=sumit.semwal@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.