enic: extend resource discovery for SR-IOV admin channel

VIC firmware exposes admin channel resources (WQ, RQ, CQ) for PF-VF
communication when SR-IOV is active. Add the corresponding resource
type definitions and teach the discovery and access functions to
handle them.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Link: https://patch.msgid.link/20260401-enic-sriov-v2-prep-v4-1-d5834b2ef1b9@cisco.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Satish Kharat
2026-04-01 08:31:11 -07:00
committed by Jakub Kicinski
parent 0ea7e61f65
commit 74fb32ed73
3 changed files with 16 additions and 0 deletions

View File

@@ -297,6 +297,8 @@ static inline struct net_device *vnic_get_netdev(struct vnic_dev *vdev)
dev_warn(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__)
#define vdev_info(vdev, fmt, ...) \
dev_info(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__)
#define vdev_dbg(vdev, fmt, ...) \
dev_dbg(&(vdev)->pdev->dev, fmt, ##__VA_ARGS__)
#define vdev_neterr(vdev, fmt, ...) \
netdev_err(vnic_get_netdev(vdev), fmt, ##__VA_ARGS__)

View File

@@ -77,6 +77,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
u32 count = ioread32(&r->count);
u32 len;
vdev_dbg(vdev, "res type %u bar %u offset 0x%x count %u\n",
type, bar_num, bar_offset, count);
r++;
if (bar_num >= num_bars)
@@ -90,6 +93,9 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
case RES_TYPE_RQ:
case RES_TYPE_CQ:
case RES_TYPE_INTR_CTRL:
case RES_TYPE_ADMIN_WQ:
case RES_TYPE_ADMIN_RQ:
case RES_TYPE_ADMIN_CQ:
/* each count is stride bytes long */
len = count * VNIC_RES_STRIDE;
if (len + bar_offset > bar[bar_num].len) {
@@ -102,6 +108,7 @@ static int vnic_dev_discover_res(struct vnic_dev *vdev,
case RES_TYPE_INTR_PBA_LEGACY:
case RES_TYPE_DEVCMD:
case RES_TYPE_DEVCMD2:
case RES_TYPE_SRIOV_INTR:
len = count;
break;
default:
@@ -135,6 +142,9 @@ void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,
case RES_TYPE_RQ:
case RES_TYPE_CQ:
case RES_TYPE_INTR_CTRL:
case RES_TYPE_ADMIN_WQ:
case RES_TYPE_ADMIN_RQ:
case RES_TYPE_ADMIN_CQ:
return (char __iomem *)vdev->res[type].vaddr +
index * VNIC_RES_STRIDE;
default:

View File

@@ -42,6 +42,10 @@ enum vnic_res_type {
RES_TYPE_DEPRECATED1, /* Old version of devcmd 2 */
RES_TYPE_DEPRECATED2, /* Old version of devcmd 2 */
RES_TYPE_DEVCMD2, /* Device control region */
RES_TYPE_SRIOV_INTR = 45, /* SR-IOV VF interrupt */
RES_TYPE_ADMIN_WQ = 49, /* Admin channel WQ */
RES_TYPE_ADMIN_RQ, /* Admin channel RQ */
RES_TYPE_ADMIN_CQ, /* Admin channel CQ */
RES_TYPE_MAX, /* Count of resource types */
};