Octeontx2-af: Fix an issue in firmware shared data reserved space
authorHariprasad Kelam <hkelam@marvell.com>
Fri, 1 Mar 2024 11:03:14 +0000 (16:33 +0530)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Mar 2024 10:15:26 +0000 (10:15 +0000)
The last patch which added support to extend the firmware shared
data to add channel data information has introduced a bug due to
the reserved space not adjusted accordingly.

This patch fixes the issue and also adds BUILD_BUG to avoid this
regression error.

Fixes: 997814491cee ("Octeontx2-af: Fetch MAC channel info from firmware")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/rvu.c
drivers/net/ethernet/marvell/octeontx2/af/rvu.h

index edd12d09dc89a300a8fca35b7d9ba0b61f460fee..07d4859de53ade0a68ff5fedaed22ec9640e8f96 100644 (file)
@@ -817,6 +817,8 @@ static int rvu_fwdata_init(struct rvu *rvu)
        err = cgx_get_fwdata_base(&fwdbase);
        if (err)
                goto fail;
+
+       BUILD_BUG_ON(offsetof(struct rvu_fwdata, cgx_fw_data) > FWDATA_CGX_LMAC_OFFSET);
        rvu->fwdata = ioremap_wc(fwdbase, sizeof(struct rvu_fwdata));
        if (!rvu->fwdata)
                goto fail;
index de8eba902276446d2bd2fc1544f3eadf19a937f1..f390525a621772924a83460802840f442cc553d7 100644 (file)
@@ -469,11 +469,12 @@ struct rvu_fwdata {
        u32 ptp_ext_clk_rate;
        u32 ptp_ext_tstamp;
        struct channel_fwdata channel_data;
-#define FWDATA_RESERVED_MEM 1014
+#define FWDATA_RESERVED_MEM 958
        u64 reserved[FWDATA_RESERVED_MEM];
 #define CGX_MAX         9
 #define CGX_LMACS_MAX   4
 #define CGX_LMACS_USX   8
+#define FWDATA_CGX_LMAC_OFFSET 10536
        union {
                struct cgx_lmac_fwdata_s
                        cgx_fw_data[CGX_MAX][CGX_LMACS_MAX];