> -----Original Message-----
> From: Xueming Li <xuemingl@nvidia.com>
> Sent: Sunday, February 14, 2021 12:22 PM
> Cc: dev@dpdk.org; Viacheslav Ovsiienko <viacheslavo@nvidia.com>;
> xuemingl@nvidia.com; Asaf Penso <asafp@nvidia.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; John Daley (johndale)
> <johndale@cisco.com>; Hyong Youb Kim (hyonkim) <hyonkim@cisco.com>;
> Beilei Xing <beilei.xing@intel.com>; Jeff Guo <jia.guo@intel.com>; Haiyue
> Wang <haiyue.wang@intel.com>; Matan Azrad <matan@nvidia.com>;
> Shahaf Shuler <shahafs@nvidia.com>; Thomas Monjalon
> <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>; Andrew
> Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Subject: [PATCH v6 1/9] ethdev: introduce representor type
>
> To support more representor type, this patch introduces representor type
> enum. The enum is subject to be extended to support new representor in
> patches upcoming.
>
> For each devarg structure, only one type supported.
>
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
[...]
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index b3f441c8f7..def669f411 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -1312,6 +1312,12 @@ static int eth_enic_pci_probe(struct rte_pci_driver
> *pci_drv __rte_unused,
> if (retval)
> return retval;
> }
> + if (eth_da.nb_representor_ports > 0 &&
> + eth_da.type != RTE_ETH_REPRESENTOR_VF) {
> + ENICPMD_LOG(ERR, "unsupported representor type: %s\n",
> + pci_dev->device.devargs->args);
> + return -ENOTSUP;
> + }
> retval = rte_eth_dev_create(&pci_dev->device, pci_dev-
> >device.name,
> sizeof(struct enic),
> eth_dev_pci_specific_init, pci_dev,
For enic,
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Thanks.
-Hyong
@@ -5618,6 +5618,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,
int i, ret = 0;
struct rte_kvargs *kvlist = NULL;
+ if (eth_da->type == RTE_ETH_REPRESENTOR_NONE)
+ return 0;
+ if (eth_da->type != RTE_ETH_REPRESENTOR_VF) {
+ PMD_DRV_LOG(ERR, "unsupported representor type %d\n",
+ eth_da->type);
+ return -ENOTSUP;
+ }
num_rep = eth_da->nb_representor_ports;
if (num_rep > BNXT_MAX_VF_REPS) {
PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
@@ -1312,6 +1312,12 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
if (retval)
return retval;
}
+ if (eth_da.nb_representor_ports > 0 &&
+ eth_da.type != RTE_ETH_REPRESENTOR_VF) {
+ ENICPMD_LOG(ERR, "unsupported representor type: %s\n",
+ pci_dev->device.devargs->args);
+ return -ENOTSUP;
+ }
retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,
sizeof(struct enic),
eth_dev_pci_specific_init, pci_dev,
@@ -639,6 +639,13 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
return retval;
}
+ if (eth_da.nb_representor_ports > 0 &&
+ eth_da.type != RTE_ETH_REPRESENTOR_VF) {
+ PMD_DRV_LOG(ERR, "unsupported representor type: %s\n",
+ pci_dev->device.devargs->args);
+ return -ENOTSUP;
+ }
+
retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,
sizeof(struct i40e_adapter),
eth_dev_pci_specific_init, pci_dev,
@@ -1718,6 +1718,13 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
} else
memset(ð_da, 0, sizeof(eth_da));
+ if (eth_da.nb_representor_ports > 0 &&
+ eth_da.type != RTE_ETH_REPRESENTOR_VF) {
+ PMD_DRV_LOG(ERR, "unsupported representor type: %s\n",
+ pci_dev->device.devargs->args);
+ return -ENOTSUP;
+ }
+
retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name,
sizeof(struct ixgbe_adapter),
eth_dev_pci_specific_init, pci_dev,
@@ -704,6 +704,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
strerror(rte_errno));
return NULL;
}
+ if (eth_da.type == RTE_ETH_REPRESENTOR_NONE) {
+ /* Representor not specified. */
+ rte_errno = EBUSY;
+ return NULL;
+ }
+ if (eth_da.type != RTE_ETH_REPRESENTOR_VF) {
+ rte_errno = ENOTSUP;
+ DRV_LOG(ERR, "unsupported representor type: %s",
+ dpdk_dev->devargs->args);
+ return NULL;
+ }
for (i = 0; i < eth_da.nb_representor_ports; ++i)
if (eth_da.representor_ports[i] ==
(uint16_t)switch_info->port_name)
@@ -1216,7 +1216,11 @@ __rte_internal
int
rte_eth_switch_domain_free(uint16_t domain_id);
-/** Generic Ethernet device arguments */
+/**
+ * Generic Ethernet device arguments
+ *
+ * One type of representor each structure.
+ */
struct rte_eth_devargs {
uint16_t ports[RTE_MAX_ETHPORTS];
/** port/s number to enable on a multi-port single function */
@@ -1226,6 +1230,7 @@ struct rte_eth_devargs {
/** representor port/s identifier to enable on device */
uint16_t nb_representor_ports;
/** number of ports in representor port field */
+ enum rte_eth_representor_type type; /* type of representor */
};
/**
@@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,
return 0;
}
+/*
+ * representor format:
+ * #: range or single number of VF representor
+ */
int
rte_eth_devargs_parse_representor_ports(char *str, void *data)
{
struct rte_eth_devargs *eth_da = data;
+ eth_da->type = RTE_ETH_REPRESENTOR_VF;
return rte_eth_devargs_process_range(str, eth_da->representor_ports,
ð_da->nb_representor_ports, RTE_MAX_ETHPORTS);
}
@@ -1506,6 +1506,14 @@ struct rte_eth_rxseg_capa {
* Ethernet device information
*/
+/**
+ * Ethernet device representor port type.
+ */
+enum rte_eth_representor_type {
+ RTE_ETH_REPRESENTOR_NONE, /**< not a representor. */
+ RTE_ETH_REPRESENTOR_VF, /**< representor of Virtual Function. */
+};
+
/**
* A structure used to retrieve the contextual information of
* an Ethernet device, such as the controlling driver of the