Commit 74fb32ed authored by Satish Kharat's avatar Satish Kharat Committed by Jakub Kicinski
Browse files

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: default avatarSatish Kharat <satishkh@cisco.com>
Link: https://patch.msgid.link/20260401-enic-sriov-v2-prep-v4-1-d5834b2ef1b9@cisco.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0ea7e61f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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__)
+10 −0
Original line number Diff line number Diff line
@@ -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:
+4 −0
Original line number Diff line number Diff line
@@ -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 */
};