drivers: use vdev registration
All PMD_VDEV drivers can now use rte_vdev_driver instead of the rte_driver (which is embedded in the rte_vdev_driver). Signed-off-by: Jan Viktorin <viktorin@rehivetech.com> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
parent
7d299777ec
commit
fe363dd425
@ -37,7 +37,7 @@
|
||||
#include <rte_hexdump.h>
|
||||
#include <rte_cryptodev.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_cpuflags.h>
|
||||
|
||||
@ -514,13 +514,15 @@ aesni_gcm_uninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver aesni_gcm_pmd_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver aesni_gcm_pmd_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = aesni_gcm_init,
|
||||
.uninit = aesni_gcm_uninit
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(aesni_gcm_pmd_drv, CRYPTODEV_NAME_AESNI_GCM_PMD);
|
||||
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, aesni_gcm_pmd_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_GCM_PMD,
|
||||
"max_nb_queue_pairs=<int> "
|
||||
"max_nb_sessions=<int> "
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <rte_hexdump.h>
|
||||
#include <rte_cryptodev.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_cpuflags.h>
|
||||
|
||||
@ -714,13 +714,15 @@ cryptodev_aesni_mb_uninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver cryptodev_aesni_mb_pmd_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = cryptodev_aesni_mb_init,
|
||||
.uninit = cryptodev_aesni_mb_uninit
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(cryptodev_aesni_mb_pmd_drv, CRYPTODEV_NAME_AESNI_MB_PMD);
|
||||
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_AESNI_MB_PMD,
|
||||
"max_nb_queue_pairs=<int> "
|
||||
"max_nb_sessions=<int> "
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <rte_hexdump.h>
|
||||
#include <rte_cryptodev.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_cpuflags.h>
|
||||
|
||||
@ -650,13 +650,15 @@ cryptodev_kasumi_uninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver cryptodev_kasumi_pmd_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = cryptodev_kasumi_init,
|
||||
.uninit = cryptodev_kasumi_uninit
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(cryptodev_kasumi_pmd_drv, CRYPTODEV_NAME_KASUMI_PMD);
|
||||
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_KASUMI_PMD,
|
||||
"max_nb_queue_pairs=<int> "
|
||||
"max_nb_sessions=<int> "
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <rte_common.h>
|
||||
#include <rte_config.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_malloc.h>
|
||||
|
||||
#include "null_crypto_pmd_private.h"
|
||||
@ -268,13 +268,15 @@ cryptodev_null_uninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver cryptodev_null_pmd_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver cryptodev_null_pmd_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = cryptodev_null_init,
|
||||
.uninit = cryptodev_null_uninit
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(cryptodev_null_pmd_drv, CRYPTODEV_NAME_NULL_PMD);
|
||||
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_NULL_PMD,
|
||||
"max_nb_queue_pairs=<int> "
|
||||
"max_nb_sessions=<int> "
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <rte_hexdump.h>
|
||||
#include <rte_cryptodev.h>
|
||||
#include <rte_cryptodev_pmd.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_cpuflags.h>
|
||||
|
||||
@ -638,13 +638,15 @@ cryptodev_snow3g_uninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver cryptodev_snow3g_pmd_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = cryptodev_snow3g_init,
|
||||
.uninit = cryptodev_snow3g_uninit
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(cryptodev_snow3g_pmd_drv, CRYPTODEV_NAME_SNOW3G_PMD);
|
||||
DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, cryptodev_snow3g_pmd_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(CRYPTODEV_NAME_SNOW3G_PMD,
|
||||
"max_nb_queue_pairs=<int> "
|
||||
"max_nb_sessions=<int> "
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_packet.h>
|
||||
@ -889,13 +889,15 @@ rte_pmd_af_packet_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_af_packet_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_af_packet_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_af_packet_devinit,
|
||||
.uninit = rte_pmd_af_packet_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_af_packet_drv, net_af_packet);
|
||||
DRIVER_REGISTER_VDEV(net_af_packet, pmd_af_packet_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_af_packet,
|
||||
"iface=<string> "
|
||||
"qpairs=<int> "
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <rte_ip_frag.h>
|
||||
#include <rte_devargs.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_alarm.h>
|
||||
#include <rte_cycles.h>
|
||||
|
||||
@ -2508,13 +2508,15 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver bond_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver bond_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = bond_init,
|
||||
.uninit = bond_uninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(bond_drv, net_bonding);
|
||||
DRIVER_REGISTER_VDEV(net_bonding, bond_drv);
|
||||
|
||||
DRIVER_REGISTER_PARAM_STRING(net_bonding,
|
||||
"slave=<ifc> "
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rte_eal.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_eal_memconfig.h>
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_malloc.h>
|
||||
@ -1623,18 +1623,22 @@ rte_pmd_mpipe_devinit(const char *ifname,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_mpipe_xgbe_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_mpipe_devinit,
|
||||
};
|
||||
|
||||
static struct rte_driver pmd_mpipe_gbe_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_mpipe_devinit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv, net_mpipe_xgbe);
|
||||
PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv, net_mpipe_gbe);
|
||||
DRIVER_REGISTER_VDEV(net_mpipe_xgbe, pmd_mpipe_xgbe_drv);
|
||||
DRIVER_REGISTER_VDEV(net_mpipe_gbe, pmd_mpipe_gbe_drv);
|
||||
|
||||
static void __attribute__((constructor, used))
|
||||
mpipe_init_contexts(void)
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_memcpy.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_spinlock.h>
|
||||
|
||||
@ -686,13 +686,15 @@ rte_pmd_null_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_null_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_null_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_null_devinit,
|
||||
.uninit = rte_pmd_null_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_null_drv, net_null);
|
||||
DRIVER_REGISTER_VDEV(net_null, pmd_null_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_null,
|
||||
"size=<int> "
|
||||
"copy=<int>");
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <rte_string_fns.h>
|
||||
#include <rte_cycles.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
@ -1083,13 +1083,15 @@ rte_pmd_pcap_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_pcap_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_pcap_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_pcap_devinit,
|
||||
.uninit = rte_pmd_pcap_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_pcap_drv, net_pcap);
|
||||
DRIVER_REGISTER_VDEV(net_pcap, pmd_pcap_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_pcap,
|
||||
"rx_pcap=<string> "
|
||||
"tx_pcap=<string> "
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <rte_memcpy.h>
|
||||
#include <rte_memzone.h>
|
||||
#include <rte_string_fns.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_errno.h>
|
||||
|
||||
@ -623,12 +623,14 @@ rte_pmd_ring_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_ring_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_ring_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_ring_devinit,
|
||||
.uninit = rte_pmd_ring_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_ring_drv, net_ring);
|
||||
DRIVER_REGISTER_VDEV(net_ring, pmd_ring_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_ring,
|
||||
"nodeaction=[attach|detach]");
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_memcpy.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_virtio_net.h>
|
||||
#include <rte_spinlock.h>
|
||||
@ -924,13 +924,15 @@ rte_pmd_vhost_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_vhost_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_vhost_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_vhost_devinit,
|
||||
.uninit = rte_pmd_vhost_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_vhost_drv, net_vhost);
|
||||
DRIVER_REGISTER_VDEV(net_vhost, pmd_vhost_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_vhost,
|
||||
"iface=<ifc> "
|
||||
"queues=<int>");
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_kvargs.h>
|
||||
#include <rte_vdev.h>
|
||||
|
||||
#include "virtio_ethdev.h"
|
||||
#include "virtio_logs.h"
|
||||
@ -461,13 +462,15 @@ virtio_user_pmd_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver virtio_user_driver = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver virtio_user_driver = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = virtio_user_pmd_devinit,
|
||||
.uninit = virtio_user_pmd_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(virtio_user_driver, net_virtio_user);
|
||||
DRIVER_REGISTER_VDEV(net_virtio_user, virtio_user_driver);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_virtio_user,
|
||||
"path=<path> "
|
||||
"mac=<mac addr> "
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_memcpy.h>
|
||||
#include <rte_string_fns.h>
|
||||
#include <rte_dev.h>
|
||||
#include <rte_vdev.h>
|
||||
#include <cmdline_parse.h>
|
||||
#include <cmdline_parse_etheraddr.h>
|
||||
|
||||
@ -759,12 +759,14 @@ rte_pmd_xenvirt_devuninit(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rte_driver pmd_xenvirt_drv = {
|
||||
.type = PMD_VDEV,
|
||||
static struct rte_vdev_driver pmd_xenvirt_drv = {
|
||||
.driver = {
|
||||
.type = PMD_VDEV,
|
||||
},
|
||||
.init = rte_pmd_xenvirt_devinit,
|
||||
.uninit = rte_pmd_xenvirt_devuninit,
|
||||
};
|
||||
|
||||
PMD_REGISTER_DRIVER(pmd_xenvirt_drv, net_xenvirt);
|
||||
DRIVER_REGISTER_VDEV(net_xenvirt, pmd_xenvirt_drv);
|
||||
DRIVER_REGISTER_PARAM_STRING(net_xenvirt,
|
||||
"mac=<mac addr>");
|
||||
|
@ -74,7 +74,7 @@ rte_eal_vdev_init(const char *name, const char *args)
|
||||
*/
|
||||
if (!strncmp(driver->driver.name, name,
|
||||
strlen(driver->driver.name)))
|
||||
return driver->driver.init(name, args);
|
||||
return driver->init(name, args);
|
||||
}
|
||||
|
||||
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
|
||||
@ -98,7 +98,7 @@ rte_eal_vdev_uninit(const char *name)
|
||||
*/
|
||||
if (!strncmp(driver->driver.name, name,
|
||||
strlen(driver->driver.name)))
|
||||
return driver->driver.uninit(name);
|
||||
return driver->uninit(name);
|
||||
}
|
||||
|
||||
RTE_LOG(ERR, EAL, "no driver found for %s\n", name);
|
||||
|
@ -104,16 +104,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
|
||||
/** Double linked list of device drivers. */
|
||||
TAILQ_HEAD(rte_driver_list, rte_driver);
|
||||
|
||||
/**
|
||||
* Initialization function called for each device driver once.
|
||||
*/
|
||||
typedef int (rte_dev_init_t)(const char *name, const char *args);
|
||||
|
||||
/**
|
||||
* Uninitilization function called for each device driver once.
|
||||
*/
|
||||
typedef int (rte_dev_uninit_t)(const char *name);
|
||||
|
||||
/**
|
||||
* Driver type enumeration
|
||||
*/
|
||||
@ -129,8 +119,6 @@ struct rte_driver {
|
||||
TAILQ_ENTRY(rte_driver) next; /**< Next in list. */
|
||||
enum pmd_type type; /**< PMD Driver type */
|
||||
const char *name; /**< Driver name. */
|
||||
rte_dev_init_t *init; /**< Device init. function. */
|
||||
rte_dev_uninit_t *uninit; /**< Device uninit. function. */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -43,12 +43,24 @@ extern "C" {
|
||||
/** Double linked list of virtual device drivers. */
|
||||
TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
|
||||
|
||||
/**
|
||||
* Initialization function called for each virtual device driver once.
|
||||
*/
|
||||
typedef int (rte_vdev_init_t)(const char *name, const char *args);
|
||||
|
||||
/**
|
||||
* Uninitilization function called for each virtual device driver once.
|
||||
*/
|
||||
typedef int (rte_vdev_uninit_t)(const char *name);
|
||||
|
||||
/**
|
||||
* A virtual device driver abstraction.
|
||||
*/
|
||||
struct rte_vdev_driver {
|
||||
TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */
|
||||
struct rte_driver driver; /**< Inherited general driver. */
|
||||
rte_vdev_init_t *init; /**< Virtual device init. function. */
|
||||
rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user