On Fri, 29 Jan 2016 15:08:32 +0100
David Marchand <david.marchand@6wind.com> wrote:
> Now that we only have vdev drivers, there is no need for a pmd type in
> rte_driver.
> rte_driver is now purely a vdev thing, and could be renamed later
> (then .init would become .probe, .uninit would become .remove).
>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 2 ++
> drivers/net/af_packet/rte_eth_af_packet.c | 2 ++
> drivers/net/bonding/rte_eth_bond_pmd.c | 2 ++
> drivers/net/mpipe/mpipe_tilegx.c | 4 ++++
> drivers/net/null/rte_eth_null.c | 2 ++
> drivers/net/pcap/rte_eth_pcap.c | 2 ++
> drivers/net/ring/rte_eth_ring.c | 2 ++
> drivers/net/szedata2/rte_eth_szedata2.c | 2 ++
> drivers/net/xenvirt/rte_eth_xenvirt.c | 2 ++
> lib/librte_cryptodev/rte_cryptodev.c | 14 ++++++++++++++
> lib/librte_cryptodev/rte_cryptodev.h | 2 ++
> lib/librte_cryptodev/rte_cryptodev_pmd.h | 4 ++++
> lib/librte_eal/common/eal_common_dev.c | 11 ++++++++---
> lib/librte_eal/common/include/rte_dev.h | 4 ++++
> 14 files changed, 52 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> index d8ccf05..94752de 100644
> --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
> @@ -661,7 +661,9 @@ cryptodev_aesni_mb_uninit(const char *name)
>
> static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
> .name = CRYPTODEV_NAME_AESNI_MB_PMD,
> +#ifndef RTE_NEXT_ABI
> .type = PMD_VDEV,
> +#endif
What about something like:
#ifdef RTE_NEXT_ABI
#define RTE_PMD_SET_TYPE(t)
#else
#define RTE_PMD_SET_TYPE(t) .type = PMD_##t
#endif
and then just:
static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
RTE_PMD_SET_TYPE(VDEV),
> .init = cryptodev_aesni_mb_init,
> .uninit = cryptodev_aesni_mb_uninit
> };
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 767f36b..6603462 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -838,7 +838,9 @@ exit:
> [snip]
>
> struct rte_cryptodev *
> +#ifndef RTE_NEXT_ABI
And maybe...
#ifndef RTE_NEXT_ABI
#define RTE_PMD_HAS_TYPE
#endif
#ifdef RTE_PMD_HAS_TYPE
> rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
> +#else
> +rte_cryptodev_pmd_allocate(const char *name, int socket_id)
> +#endif
> {
> struct rte_cryptodev *cryptodev;
> uint8_t dev_id;
> [snip]
Regards
Jan
@@ -661,7 +661,9 @@ cryptodev_aesni_mb_uninit(const char *name)
static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
.name = CRYPTODEV_NAME_AESNI_MB_PMD,
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = cryptodev_aesni_mb_init,
.uninit = cryptodev_aesni_mb_uninit
};
@@ -838,7 +838,9 @@ exit:
static struct rte_driver pmd_af_packet_drv = {
.name = "eth_af_packet",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_af_packet_devinit,
};
@@ -2493,7 +2493,9 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
static struct rte_driver bond_drv = {
.name = "eth_bond",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = bond_init,
.uninit = bond_uninit,
};
@@ -1608,13 +1608,17 @@ rte_pmd_mpipe_devinit(const char *ifname,
static struct rte_driver pmd_mpipe_xgbe_drv = {
.name = "xgbe",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_mpipe_devinit,
};
static struct rte_driver pmd_mpipe_gbe_drv = {
.name = "gbe",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_mpipe_devinit,
};
@@ -695,7 +695,9 @@ rte_pmd_null_devuninit(const char *name)
static struct rte_driver pmd_null_drv = {
.name = "eth_null",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_null_devinit,
.uninit = rte_pmd_null_devuninit,
};
@@ -1092,7 +1092,9 @@ rte_pmd_pcap_devuninit(const char *name)
static struct rte_driver pmd_pcap_drv = {
.name = "eth_pcap",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_pcap_devinit,
.uninit = rte_pmd_pcap_devuninit,
};
@@ -596,7 +596,9 @@ rte_pmd_ring_devuninit(const char *name)
static struct rte_driver pmd_ring_drv = {
.name = "eth_ring",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_ring_devinit,
.uninit = rte_pmd_ring_devuninit,
};
@@ -1616,7 +1616,9 @@ rte_pmd_szedata2_devuninit(const char *name)
static struct rte_driver pmd_szedata2_drv = {
.name = "eth_szedata2",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_szedata2_devinit,
.uninit = rte_pmd_szedata2_devuninit,
};
@@ -769,7 +769,9 @@ rte_pmd_xenvirt_devuninit(const char *name)
static struct rte_driver pmd_xenvirt_drv = {
.name = "eth_xenvirt",
+#ifndef RTE_NEXT_ABI
.type = PMD_VDEV,
+#endif
.init = rte_pmd_xenvirt_devinit,
.uninit = rte_pmd_xenvirt_devuninit,
};
@@ -202,7 +202,11 @@ rte_cryptodev_find_free_device_index(void)
}
struct rte_cryptodev *
+#ifndef RTE_NEXT_ABI
rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
+#else
+rte_cryptodev_pmd_allocate(const char *name, int socket_id)
+#endif
{
struct rte_cryptodev *cryptodev;
uint8_t dev_id;
@@ -241,7 +245,9 @@ rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id)
cryptodev->data->dev_started = 0;
cryptodev->attached = RTE_CRYPTODEV_ATTACHED;
+#ifndef RTE_NEXT_ABI
cryptodev->pmd_type = type;
+#endif
cryptodev_globals.nb_devs++;
}
@@ -290,7 +296,11 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size,
struct rte_cryptodev *cryptodev;
/* allocate device structure */
+#ifndef RTE_NEXT_ABI
cryptodev = rte_cryptodev_pmd_allocate(name, PMD_VDEV, socket_id);
+#else
+ cryptodev = rte_cryptodev_pmd_allocate(name, socket_id);
+#endif
if (cryptodev == NULL)
return NULL;
@@ -332,8 +342,12 @@ rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv,
rte_cryptodev_create_unique_device_name(cryptodev_name,
sizeof(cryptodev_name), pci_dev);
+#ifndef RTE_NEXT_ABI
cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, PMD_PDEV,
rte_socket_id());
+#else
+ cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
+#endif
if (cryptodev == NULL)
return -ENOMEM;
@@ -471,9 +471,11 @@ struct rte_cryptodev {
/**< PCI info. supplied by probing */
enum rte_cryptodev_type dev_type;
+#ifndef RTE_NEXT_ABI
/**< Crypto device type */
enum pmd_type pmd_type;
/**< PMD type - PDEV / VDEV */
+#endif
struct rte_cryptodev_cb_list link_intr_cbs;
/**< User application callback for interrupts if present */
@@ -466,7 +466,11 @@ struct rte_cryptodev_ops {
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_cryptodev *
+#ifndef RTE_NEXT_ABI
rte_cryptodev_pmd_allocate(const char *name, enum pmd_type type, int socket_id);
+#else
+rte_cryptodev_pmd_allocate(const char *name, int socket_id);
+#endif
/**
* Creates a new virtual crypto device and returns the pointer
@@ -72,9 +72,10 @@ rte_eal_vdev_init(const char *name, const char *args)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
+#ifndef RTE_NEXT_ABI
if (driver->type != PMD_VDEV)
continue;
-
+#endif
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -93,7 +94,9 @@ int
rte_eal_dev_init(void)
{
struct rte_devargs *devargs;
+#ifndef RTE_NEXT_ABI
struct rte_driver *driver;
+#endif
/*
* Note that the dev_driver_list is populated here
@@ -114,7 +117,7 @@ rte_eal_dev_init(void)
return -1;
}
}
-
+#ifndef RTE_NEXT_ABI
/* Once the vdevs are initalized, start calling all the pdev drivers */
TAILQ_FOREACH(driver, &dev_driver_list, next) {
if (driver->type != PMD_PDEV)
@@ -122,6 +125,7 @@ rte_eal_dev_init(void)
/* PDEV drivers don't get passed any parameters */
driver->init(NULL, NULL);
}
+#endif
return 0;
}
@@ -134,9 +138,10 @@ rte_eal_vdev_uninit(const char *name)
return -EINVAL;
TAILQ_FOREACH(driver, &dev_driver_list, next) {
+#ifndef RTE_NEXT_ABI
if (driver->type != PMD_VDEV)
continue;
-
+#endif
/*
* search a driver prefix in virtual device name.
* For example, if the driver is pcap PMD, driver->name
@@ -114,6 +114,7 @@ typedef int (rte_dev_init_t)(const char *name, const char *args);
*/
typedef int (rte_dev_uninit_t)(const char *name);
+#ifndef RTE_NEXT_ABI
/**
* Driver type enumeration
*/
@@ -121,13 +122,16 @@ enum pmd_type {
PMD_VDEV = 0,
PMD_PDEV = 1,
};
+#endif
/**
* A structure describing a device driver.
*/
struct rte_driver {
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
+#ifndef RTE_NEXT_ABI
enum pmd_type type; /**< PMD Driver type */
+#endif
const char *name; /**< Driver name. */
rte_dev_init_t *init; /**< Device init. function. */
rte_dev_uninit_t *uninit; /**< Device uninit. function. */