Thread (209 messages) 209 messages, 11 authors, 2021-04-12

Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info

From: Xueming(Steven) Li <hidden>
Date: 2021-03-09 06:00:48

-----Original Message-----
From: Ferruh Yigit <redacted>
Sent: Tuesday, March 9, 2021 12:19 AM
To: Xueming(Steven) Li <redacted>; Andrew Rybchenko <redacted>
Cc: dev@dpdk.org; Slava Ovsiienko <redacted>; Asaf Penso <redacted>; NBU-Contact-Thomas Monjalon
[off-list ref]; Ray Kinsella [off-list ref]; Neil Horman [off-list ref]
Subject: Re: [PATCH v8 8/9] ethdev: representor iterator compare complete info

On 3/4/2021 2:30 PM, Xueming Li wrote:
quoted
The NIC can have multiple PCIe links and can be attached to multiple
hosts, for example the same single NIC can be shared for multiple
server units in the rack. On each PCIe link NIC can provide multiple
PFs and VFs/SFs based on these ones. The full representor identifier
consists of three indices - controller index, PF index, and VF or SF index (if any).

SR-IOV and SubFunction are created on top of PF. PF index is
introduced because there might be multiple PFs in the bonding
configuration and only bonding device is probed.

In eth representor comparator callback, ethdev representor ID was
compared with devarg. Since controller index and PF index not
compared, callback returned representor from other PF or controller.

This patch adds new API to get representor ID from controller, pf and
vf/sf index. Representor comparer callback get representor ID then
compare with device representor ID.

Signed-off-by: Xueming Li <redacted>
<...>
quoted
+int
+rte_eth_representor_id_get(const struct rte_eth_dev *ethdev,
+			   enum rte_eth_representor_type type,
+			   int controller, int pf, int representor_port,
+			   uint16_t *repr_id)
+{
+	int ret, n, i, count;
+	struct rte_eth_representor_info *info = NULL;
+	size_t size;
+
+	if (type == RTE_ETH_REPRESENTOR_NONE)
+		return 0;
+	if (repr_id == NULL)
+		return -EINVAL;
+
+	/* Get PMD representor range info. */
+	ret = rte_eth_representor_info_get(ethdev->data->port_id, NULL);
+	if (ret < 0) {
This seems to support the legacy format, should the return value checked explicitly against the '-ENOTSUP', instead of any error?
Good suggestion, thanks
quoted
+		if (type == RTE_ETH_REPRESENTOR_VF && controller == -1 &&
+		    pf == -1) {
+			/* Direct mapping for legacy VF representor. */
+			*repr_id = representor_port;
+			return 0;
+		} else {
+			return ret;
+		}
+	}

<...>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help