Re: [PATCH v20 net-next 05/10] net/nebula-matrix: add common resource implementation
From: Paolo Abeni
Date: Thu Jul 02 2026 - 06:35:00 EST
From: AI Reviewer <ai@xxxxxxxxxxx>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev/
---
net/nebula-matrix: add common resource implementation
The patch adds the common part of the resource layer for the Nebula Matrix
driver, including conversion relationships among vsi_id, func_id, eth_id,
and pf_id.
> diff --git a/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c
> new file mode 100644
> index 0000000000000..6742da7c66376
> --- /dev/null
> +++ b/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c
[ ... ]
> +int nbl_res_func_id_to_vsi_id(struct nbl_resource_mgt *res_mgt, u16 func_id,
> + u16 type, u16 *vsi_id)
> +{
[ ... ]
> + nbl_res_pf_dev_vsi_type_to_hw_vsi_type(type, &dst_type);
> + *vsi_id = vsi_info->serv_info[diff][dst_type].base_id;
> + return 0;
> +}
[ ... ]
> +void nbl_res_pf_dev_vsi_type_to_hw_vsi_type(u16 src_type,
> + enum nbl_vsi_serv_type *dst_type)
> +{
> + switch (src_type) {
> + case NBL_VSI_DATA:
> + *dst_type = NBL_VSI_SERV_PF_DATA_TYPE;
> + break;
> + default:
> + WARN_ON_ONCE(1);
[Severity: High]
Can a malicious or buggy Virtual Function (VF) trigger this warning by
passing an invalid type?
Because nbl_res_pf_dev_vsi_type_to_hw_vsi_type() returns void, it cannot
propagate an error back to the caller. When an invalid type is processed,
nbl_res_func_id_to_vsi_id() silently defaults to NBL_VSI_SERV_PF_DATA_TYPE
and returns 0 for success.
Should this function return an error code so that nbl_res_func_id_to_vsi_id()
can properly reject the invalid type instead of reporting a false success?
> + break;
> + }
> +}
--
This is an AI-generated review.