Thread (16 messages) 16 messages, 6 authors, 2023-05-03

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

From: Simon Horman <hidden>
Date: 2023-05-03 07:16:15
Also in: dri-devel, linux-media, lkml, netdev

On Tue, May 02, 2023 at 02:26:53PM -0700, Justin Chen wrote:
On Tue, May 2, 2023 at 12:44 PM Simon Horman [off-list ref] wrote:
quoted
On Wed, Apr 26, 2023 at 11:54:29AM -0700, Justin Chen wrote:
...
quoted
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help