Re: [PATCH iwl-next v3 5/5] iavf: Add VIRTCHNL Opcodes Support for Queue bw Setting

Simon Horman
2023-08-16T09:14:19Z

On Wed, Aug 16, 2023 at 11:33:53AM +0800, Wenjun Wu wrote:
> From: Jun Zhang <xuejun.zhang@intel.com>
>
> iavf rate tree with root node and queue nodes is created and registered
> with devlink rate when iavf adapter is configured.
>
> User can configure the tx_max and tx_share of each queue. If any one of
> the queues have been fully updated by user, i.e. both tx_max and
> tx_share have been updated for that queue, VIRTCHNL opcodes of
> VIRTCHNL_OP_CONFIG_QUEUE_BW and VIRTCHNL_OP_CONFIG_QUANTA will be sent
> to PF to configure queues allocated to VF if PF indicates support of
> VIRTCHNL_VF_OFFLOAD_QOS through VF Resource / Capability Exchange.
>
> Signed-off-by: Jun Zhang <xuejun.zhang@intel.com>

...

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c

...

> @@ -5005,10 +5035,18 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> /* Setup the wait queue for indicating virtchannel events */
> init_waitqueue_head(&adapter->vc_waitqueue);
>
> + len = struct_size(adapter->qos_caps, cap, IAVF_MAX_QOS_TC_NUM);
> + adapter->qos_caps = kzalloc(len, GFP_KERNEL);
> + if (!adapter->qos_caps)

Hi Jun Zhang and Wenjun Wu,

The goto below leads to the function returning err.
Should err be set to an error value here?

As flagged by Smatch and Coccinelle.

> + goto err_ioremap;
> +
> /* Register iavf adapter with devlink */
> err = iavf_devlink_register(adapter);
> - if (err)
> + if (err) {
> dev_err(&pdev->dev, "devlink registration failed: %d\n", err);
> + kfree(adapter->qos_caps);
> + goto err_ioremap;
> + }
>
> /* Keep driver interface even on devlink registration failure */
> return 0;

...