Re: [net-next PATCH v2] octeontx2-pf: Reset MAC stats during probe

From: Jakub Kicinski
Date: Thu Mar 07 2024 - 23:47:36 EST


On Tue, 5 Mar 2024 13:57:07 +0530 Sai Krishna wrote:
> +int otx2_reset_mac_stats(struct otx2_nic *pfvf);
>
> /* RVU block related APIs */
> int otx2_attach_npa_nix(struct otx2_nic *pfvf);
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> index e5fe67e73865..a91f5b7e84c6 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> @@ -1124,6 +1124,24 @@ static int otx2_cgx_config_linkevents(struct otx2_nic *pf, bool enable)
> return err;
> }
>
> +int otx2_reset_mac_stats(struct otx2_nic *pfvf)
> +{
> + struct msg_req *req;
> + int err;
> +
> + mutex_lock(&pfvf->mbox.lock);
> + req = otx2_mbox_alloc_msg_cgx_stats_rst(&pfvf->mbox);
> + if (!req) {
> + mutex_unlock(&pfvf->mbox.lock);
> + return -ENOMEM;
> + }
> +
> + err = otx2_sync_mbox_msg(&pfvf->mbox);
> + mutex_unlock(&pfvf->mbox.lock);
> + return err;
> +}
> +EXPORT_SYMBOL(otx2_reset_mac_stats);

Why the export? I see only one call to this function and it's right
below..

> static int otx2_cgx_config_loopback(struct otx2_nic *pf, bool enable)
> {
> struct msg_req *msg;
> @@ -3048,6 +3066,9 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> otx2_qos_init(pf, qos_txqs);
>
> + /* reset CGX/RPM MAC stats */
> + otx2_reset_mac_stats(pf);
> +