[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <da2050d1-660c-48ee-8635-0f359880f713@ijzerbout.nl>
Date: Wed, 23 Jul 2025 21:10:51 +0200
From: Kees Bakker <kees@...erbout.nl>
To: Hariprasad Kelam <hkelam@...vell.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: kuba@...nel.org, davem@...emloft.net, sgoutham@...vell.com,
gakula@...vell.com, jerinj@...vell.com, lcherian@...vell.com,
sbhatta@...vell.com, naveenm@...vell.com, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, bbhushan2@...vell.com
Subject: Re: [net-next PatchV2 4/4] Octeontx2-af: Debugfs support for firmware
data
Op 20-07-2025 om 18:36 schreef Hariprasad Kelam:
> MAC address, Link modes (supported and advertised) and eeprom data
> for the Netdev interface are read from the shared firmware data.
> This patch adds debugfs support for the same.
>
> Signed-off-by: Hariprasad Kelam <hkelam@...vell.com>
> ---
> V2 *
> fix max line length warnings and typo
>
> .../net/ethernet/marvell/octeontx2/af/mbox.h | 7 +-
> .../marvell/octeontx2/af/rvu_debugfs.c | 162 ++++++++++++++++++
> 2 files changed, 168 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> index 0bc0dc79868b..933073cd2280 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
> @@ -664,7 +664,12 @@ struct cgx_lmac_fwdata_s {
> /* Only applicable if SFP/QSFP slot is present */
> struct sfp_eeprom_s sfp_eeprom;
> struct phy_s phy;
> -#define LMAC_FWDATA_RESERVED_MEM 1021
> + u32 lmac_type;
> + u32 portm_idx;
> + u64 mgmt_port:1;
> + u64 advertised_an:1;
> + u64 port;
> +#define LMAC_FWDATA_RESERVED_MEM 1018
> u64 reserved[LMAC_FWDATA_RESERVED_MEM];
> };
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> index 0c20642f81b9..8375f18c8e07 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
> ...
> @@ -2923,6 +2988,97 @@ static int rvu_dbg_cgx_dmac_flt_display(struct seq_file *s, void *unused)
>
> RVU_DEBUG_SEQ_FOPS(cgx_dmac_flt, cgx_dmac_flt_display, NULL);
>
> +static int cgx_print_fwdata(struct seq_file *s, int lmac_id)
> +{
> + struct cgx_lmac_fwdata_s *fwdata;
> + void *cgxd = s->private;
> + struct phy_s *phy;
> + struct rvu *rvu;
> + int cgx_id, i;
> +
> + rvu = pci_get_drvdata(pci_get_device(PCI_VENDOR_ID_CAVIUM,
> + PCI_DEVID_OCTEONTX2_RVU_AF, NULL));
> + if (!rvu)
> + return -ENODEV;
> +
> + if (!rvu->fwdata)
> + return -EAGAIN;
> +
> + cgx_id = cgx_get_cgxid(cgxd);
You need to check the return value. It can be -EINVAL which you don't
want to use for the array index.
> +
> + if (rvu->hw->lmac_per_cgx == CGX_LMACS_USX)
> + fwdata = &rvu->fwdata->cgx_fw_data_usx[cgx_id][lmac_id];
> + else
> + fwdata = &rvu->fwdata->cgx_fw_data[cgx_id][lmac_id];
> +
>
Powered by blists - more mailing lists