v2: - Address Gaetan's comment in patch 2. - Add RTE_LOGTYPE_BUS suggested by Gaetan. - Don't moving crypto vdev into drivers/bus/vdev, instead we use a new way (details in patch 3) which may break the ABI (the validate_abi.sh report a low warning of "Problems with Symbols"). - Rename CONFIG_RTE_LIBRTE_VDEV to CONFIG_RTE_LIBRTE_VDEV_BUS. - Return error if there's an existing action for an action name. - Redefine rte_eal_primary_secondary_t as func pointer, and change the first parameter type to avoid explicit type casting. - Handle the case for vhost "primary - VM - secondary" sequence. - Fix a bug in recv multiple messages as one message. - Fix a bug of get vid of -1 in secondary process. - Remove the modification on helloworld example, instead we use symmetric_mp as the test case. - Address yuanhan's comment on code refactor on mp channel.
Patch 1~6: move vdev bus into drivers/bus. Patch 7: add unix socket channel for primary/secondary communication. Patch 8~9: make use of the channel to discover and probe virtual devices the primary process. Patch 10~12: support to run vhost-pmd in the secondary process. How to test: Step 1: run symmetric_mp as the primary process. $ ./symmetric_mp -c 2 --proc-type=auto ... \ --vdev 'net_vhost0,iface=/tmp/sock1,queues=2' \ --vdev 'net_vhost1,iface=/tmp/sock2,queues=2' \ -- -p 3 --num-procs=2 --proc-id=0 Step 2: run testpmd as the secondary process. $ ./symmetric_mp -c 4 --proc-type=auto -- -p 3 --num-procs=2 --proc-id=1 Step 3: start VM1. $ ./qemu-system-x86_64 ... -chardev socket,id=chr1,path=/tmp/sock1 \ -netdev type=vhost-user,id=net1,chardev=chr1,vhostforce,queues=2 \ -device virtio-net-pci,netdev=net1,mq=on,vectors=6 ... Step 4: start VM2. $ ./qemu-system-x86_64 ... -chardev socket,id=chr1,path=/tmp/sock2 \ -netdev type=vhost-user,id=net1,chardev=chr1,vhostforce,queues=2 \ -device virtio-net-pci,netdev=net1,mq=on,vectors=6 ... Step 5: enable multi queue in VM1 and VM2. $ ethtool -L ethX combined 2 Note in this test case, only queue 1, i.e., secondary process can process packets. To use queue 1, basically, we can run command like: $ taskset -c 1 <commands> Jianfeng Tan (12): cryptodev: remove crypto vdev init API eal: avoid calling rte_vdev_init() cryptodev: avoid dependency on rte_vdev.h bus/fslmc: introduce RTE_LOGTYPE_BUS for bus drivers bus/vdev: move to vdev bus to drivers/bus bus/vdev: normalize log type eal: add channel for primary/secondary communication bus/vdev: scan and probe vdev in secondary processes ethdev: support attach vdev in secondary process vhost: allocate virtio_net in memzone vhost: support to kick in secondary process net/vhost: support to run in the secondary process config/common_base | 5 + doc/guides/rel_notes/deprecation.rst | 5 - drivers/bus/Makefile | 2 + drivers/bus/fslmc/fslmc_bus.c | 5 +- drivers/bus/fslmc/fslmc_logs.h | 42 +- drivers/bus/fslmc/fslmc_vfio.c | 4 +- drivers/bus/vdev/Makefile | 55 +++ drivers/bus/vdev/rte_bus_vdev_version.map | 10 + drivers/bus/vdev/rte_vdev.h | 153 ++++++++ drivers/bus/vdev/vdev.c | 440 +++++++++++++++++++++ drivers/bus/vdev/vdev_logs.h | 40 ++ drivers/net/vhost/rte_eth_vhost.c | 200 +++++++++- lib/librte_cryptodev/rte_cryptodev.c | 6 - lib/librte_cryptodev/rte_cryptodev.h | 18 - lib/librte_cryptodev/rte_cryptodev_pmd.c | 9 +- lib/librte_cryptodev/rte_cryptodev_vdev.c | 161 ++++++++ lib/librte_cryptodev/rte_cryptodev_vdev.h | 3 +- lib/librte_cryptodev/rte_cryptodev_version.map | 1 - lib/librte_eal/bsdapp/eal/Makefile | 1 - lib/librte_eal/bsdapp/eal/rte_eal_version.map | 8 + lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_dev.c | 21 +- lib/librte_eal/common/eal_common_log.c | 1 + lib/librte_eal/common/eal_common_proc.c | 498 ++++++++++++++++++++++++ lib/librte_eal/common/eal_common_vdev.c | 342 ---------------- lib/librte_eal/common/eal_filesystem.h | 18 + lib/librte_eal/common/eal_private.h | 10 + lib/librte_eal/common/include/rte_dev.h | 24 +- lib/librte_eal/common/include/rte_eal.h | 68 ++++ lib/librte_eal/common/include/rte_log.h | 1 + lib/librte_eal/common/include/rte_vdev.h | 131 ------- lib/librte_eal/linuxapp/eal/Makefile | 1 - lib/librte_eal/linuxapp/eal/eal.c | 6 + lib/librte_eal/linuxapp/eal/rte_eal_version.map | 8 + lib/librte_ether/rte_ethdev_vdev.h | 26 +- lib/librte_vhost/rte_vhost.h | 3 + lib/librte_vhost/rte_vhost_version.map | 7 + lib/librte_vhost/socket.c | 2 + lib/librte_vhost/vhost.c | 71 +++- lib/librte_vhost/vhost.h | 7 +- lib/librte_vhost/vhost_user.c | 17 +- mk/rte.app.mk | 1 + 42 files changed, 1799 insertions(+), 634 deletions(-) create mode 100644 drivers/bus/vdev/Makefile create mode 100644 drivers/bus/vdev/rte_bus_vdev_version.map create mode 100644 drivers/bus/vdev/rte_vdev.h create mode 100644 drivers/bus/vdev/vdev.c create mode 100644 drivers/bus/vdev/vdev_logs.h create mode 100644 lib/librte_cryptodev/rte_cryptodev_vdev.c delete mode 100644 lib/librte_eal/common/eal_common_vdev.c delete mode 100644 lib/librte_eal/common/include/rte_vdev.h -- 2.7.4