Hyper-v driver and infrastructure
cover Hyper-v driver and infrastructure
From: Stephen Hemminger <[email protected]>
This patch series contains the necessary pieces to implement a poll mode driver for the Hyper-V virtual network interface.
This device driver was developed from the FreeBSD code. And is released by Brocade under the same license as the rest of the DPDK. I.e the PMD is BSD and kernel parts are GPL.
The code was developed on previous version of DPDK (1.6) and has been ported to current version. But it has not been tested on the current version yet.
Stephen Hemminger (7):
ether: add function to query for link state interrupt
pmd: change drivers initialization for pci
hv: add basic vmbus support
hv: uio driver
hv: poll mode driver
hv: enable driver in common config
hv: add kernel patch
config/common_linuxapp | 9 + lib/Makefile | 1 + lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_options.c | 5 + lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/common/eal_private.h | 10 + lib/librte_eal/common/include/rte_pci.h | 2 + lib/librte_eal/common/include/rte_vmbus.h | 153 ++ lib/librte_eal/linuxapp/Makefile | 3 + lib/librte_eal/linuxapp/eal/Makefile | 3 + lib/librte_eal/linuxapp/eal/eal.c | 5 + lib/librte_eal/linuxapp/eal/eal_vmbus.c | 658 ++++++++ lib/librte_eal/linuxapp/hv_uio/Makefile | 57 + lib/librte_eal/linuxapp/hv_uio/hv_uio.c | 551 +++++++ lib/librte_eal/linuxapp/hv_uio/hyperv_net.h | 907 +++++++++++ .../linuxapp/hv_uio/vmbus-get-pages.patch | 55 + lib/librte_ether/rte_ethdev.c | 98 +- lib/librte_ether/rte_ethdev.h | 27 +- lib/librte_pmd_e1000/em_ethdev.c | 2 +- lib/librte_pmd_e1000/igb_ethdev.c | 4 +- lib/librte_pmd_enic/enic_ethdev.c | 2 +- lib/librte_pmd_hyperv/Makefile | 28 + lib/librte_pmd_hyperv/hyperv.h | 169 ++ lib/librte_pmd_hyperv/hyperv_drv.c | 1660 ++++++++++++++++++++ lib/librte_pmd_hyperv/hyperv_drv.h | 558 +++++++ lib/librte_pmd_hyperv/hyperv_ethdev.c | 334 ++++ lib/librte_pmd_hyperv/hyperv_logs.h | 68 + lib/librte_pmd_hyperv/hyperv_rxtx.c | 402 +++++ lib/librte_pmd_hyperv/hyperv_rxtx.h | 35 + lib/librte_pmd_i40e/i40e_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev_vf.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 4 +- lib/librte_pmd_virtio/virtio_ethdev.c | 2 +- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 2 +- mk/rte.app.mk | 4 + 36 files changed, 5809 insertions(+), 18 deletions(-) create mode 100644 lib/librte_eal/common/include/rte_vmbus.h create mode 100644 lib/librte_eal/linuxapp/eal/eal_vmbus.c create mode 100644 lib/librte_eal/linuxapp/hv_uio/Makefile create mode 100644 lib/librte_eal/linuxapp/hv_uio/hv_uio.c create mode 100644 lib/librte_eal/linuxapp/hv_uio/hyperv_net.h create mode 100644 lib/librte_eal/linuxapp/hv_uio/vmbus-get-pages.patch create mode 100644 lib/librte_pmd_hyperv/Makefile create mode 100644 lib/librte_pmd_hyperv/hyperv.h create mode 100644 lib/librte_pmd_hyperv/hyperv_drv.c create mode 100644 lib/librte_pmd_hyperv/hyperv_drv.h create mode 100644 lib/librte_pmd_hyperv/hyperv_ethdev.c create mode 100644 lib/librte_pmd_hyperv/hyperv_logs.h create mode 100644 lib/librte_pmd_hyperv/hyperv_rxtx.c create mode 100644 lib/librte_pmd_hyperv/hyperv_rxtx.h
Signature · 1 line
2.1.4
PATCH 1/7 ether: add function to query for link state interrupt
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Allow application to query whether link state will work. This is also part of abstracting dependency on PCI.
--- lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 26 insertions(+)
lib/librte_ether/rte_ethdev.c +14 -0
@@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) } } +int +rte_eth_has_link_state (uint8_t port_id) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return 0 ; + } + dev = &rte_eth_devices[port_id]; + +return (dev->pci_dev->driver->drv_flags &RTE_PCI_DRV_INTR_LSC ) !=0 ; +} +void rte_eth_stats_get (uint8_t port_id,struct rte_eth_stats *stats) {
lib/librte_ether/rte_ethdev.h +12 -0
@@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);/** +* Test whether device supports link state interrupt mode. +* +* @param port_id +* The port identifier of the Ethernet device. +* @return +* - (1) if link state interrupt is supported +* - (0) if link state interrupt is not supported +*/ +extern int +rte_eth_has_link_state (uint8_t port_id); + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id
Signature · 1 line
2.1.4
PATCH 2/7 pmd: change drivers initialization for pci
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
The change to generic ether device structure to support multiple bus types requires a change to all existing PMD but only in the initialization (and the change is backwards compatiable).
--- lib/librte_pmd_e1000/em_ethdev.c | 2 +- lib/librte_pmd_e1000/igb_ethdev.c | 4 ++-- lib/librte_pmd_enic/enic_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev_vf.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 4 ++-- lib/librte_pmd_virtio/virtio_ethdev.c | 2 +- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)
lib/librte_pmd_e1000/em_ethdev.c +1 -1
@@ -283,7 +283,7 @@ eth_em_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, }static struct eth_driver rte_em_pmd = { - { + .pci_drv = { .name ="rte_em_pmd" , .id_table = pci_id_em_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC ,
lib/librte_pmd_e1000/igb_ethdev.c +2 -2
@@ -682,7 +682,7 @@ eth_igbvf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, }static struct eth_driver rte_igb_pmd = { - { + .pci_drv = { .name ="rte_igb_pmd" , .id_table = pci_id_igb_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC ,
@@ -695,7 +695,7 @@ static struct eth_driver rte_igb_pmd = {* virtual function driver struct */ static struct eth_driver rte_igbvf_pmd = { - { + .pci_drv = { .name ="rte_igbvf_pmd" , .id_table = pci_id_igbvf_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
lib/librte_pmd_enic/enic_ethdev.c +1 -1
@@ -581,7 +581,7 @@ static int eth_enicpmd_dev_init( }static struct eth_driver rte_enic_pmd = { - { + .pci_drv = { .name ="rte_enic_pmd" , .id_table = pci_id_enic_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
lib/librte_pmd_i40e/i40e_ethdev.c +1 -1
@@ -266,7 +266,7 @@ static struct eth_dev_ops i40e_eth_dev_ops = { };static struct eth_driver rte_i40e_pmd = { - { + .pci_drv = { .name ="rte_i40e_pmd" , .id_table = pci_id_i40e_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC ,
lib/librte_pmd_i40e/i40e_ethdev_vf.c +1 -1
@@ -1203,7 +1203,7 @@ i40evf_dev_init(__rte_unused struct eth_driver *eth_drv,* virtual function driver struct */ static struct eth_driver rte_i40evf_pmd = { - { + .pci_drv = { .name ="rte_i40evf_pmd" , .id_table = pci_id_i40evf_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -1092,7 +1092,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, }static struct eth_driver rte_ixgbe_pmd = { - { + .pci_drv = { .name ="rte_ixgbe_pmd" , .id_table = pci_id_ixgbe_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC ,
@@ -1105,7 +1105,7 @@ static struct eth_driver rte_ixgbe_pmd = {* virtual function driver struct */ static struct eth_driver rte_ixgbevf_pmd = { - { + .pci_drv = { .name ="rte_ixgbevf_pmd" , .id_table = pci_id_ixgbevf_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
lib/librte_pmd_virtio/virtio_ethdev.c +1 -1
@@ -962,7 +962,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, }static struct eth_driver rte_virtio_pmd = { - { + .pci_drv = { .name ="rte_virtio_pmd" , .id_table = pci_id_virtio_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +1 -1
@@ -264,7 +264,7 @@ eth_vmxnet3_dev_init(__attribute__((unused)) struct eth_driver *eth_drv, }static struct eth_driver rte_vmxnet3_pmd = { - { + .pci_drv = { .name ="rte_vmxnet3_pmd" , .id_table = pci_id_vmxnet3_map, .drv_flags =RTE_PCI_DRV_NEED_MAPPING ,
Signature · 1 line
2.1.4
PATCH 3/7 hv: add basic vmbus support
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
The hyper-v device driver forces the base EAL code to change to support multiple bus types. This is done changing the pci_device in ether driver to a generic union.
As much as possible this is done in a backwards source compatiable way. It will break ABI for device drivers.
--- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_options.c | 5 + lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/common/eal_private.h | 10 + lib/librte_eal/common/include/rte_pci.h | 2 + lib/librte_eal/common/include/rte_vmbus.h | 153 +++++++ lib/librte_eal/linuxapp/eal/Makefile | 3 + lib/librte_eal/linuxapp/eal/eal.c | 5 + lib/librte_eal/linuxapp/eal/eal_vmbus.c | 658 +++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.c | 84 +++- lib/librte_ether/rte_ethdev.h | 15 +- 12 files changed, 932 insertions(+), 8 deletions(-) create mode 100644 lib/librte_eal/common/include/rte_vmbus.h create mode 100644 lib/librte_eal/linuxapp/eal/eal_vmbus.c
lib/librte_eal/common/Makefile +1 -1
@@ -33,7 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk INC := rte_branch_prediction.h rte_common.h INC += rte_debug.h rte_eal.h rte_errno.h rte_launch.h rte_lcore.h -INC += rte_log.h rte_memory.h rte_memzone.h rte_pci.h +INC += rte_log.h rte_memory.h rte_memzone.h rte_pci.h rte_vmbus.h INC += rte_pci_dev_ids.h rte_per_lcore.h rte_random.h INC += rte_rwlock.h rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h rte_tailq_elem.h
lib/librte_eal/common/eal_common_options.c +5 -0
@@ -73,6 +73,7 @@ eal_long_options[] = { {OPT_NO_HPET, 0, 0, OPT_NO_HPET_NUM}, {OPT_VMWARE_TSC_MAP, 0, 0, OPT_VMWARE_TSC_MAP_NUM}, {OPT_NO_PCI, 0, 0, OPT_NO_PCI_NUM}, + {OPT_NO_VMBUS, 0, 0, OPT_NO_VMBUS_NUM}, {OPT_NO_HUGE, 0, 0, OPT_NO_HUGE_NUM}, {OPT_FILE_PREFIX, 1, 0, OPT_FILE_PREFIX_NUM}, {OPT_SOCKET_MEM, 1, 0, OPT_SOCKET_MEM_NUM},
@@ -441,6 +442,10 @@ eal_parse_common_option(int opt, const char *optarg, conf->no_pci =1 ;break ; +case OPT_NO_VMBUS_NUM : + conf->no_vmbus =1 ; +break ; +case OPT_NO_HPET_NUM : conf->no_hpet =1 ;break ;
lib/librte_eal/common/eal_internal_cfg.h +1 -0
@@ -66,6 +66,7 @@ struct internal_config {volatile unsigned no_hugetlbfs;/**< true to disable hugetlbfs */ volatile unsigned xen_dom0_support;/**< support app running on Xen Dom0*/ volatile unsigned no_pci;/**< true to disable PCI */ +volatile unsigned no_vmbus;/**< true to disable VMBUS */ volatile unsigned no_hpet;/**< true to disable HPET */ volatile unsigned vmware_tsc_map;/**< true to use VMware TSC mapping * instead of native TSC */
lib/librte_eal/common/eal_options.h +2 -0
@@ -57,6 +57,8 @@ enum {OPT_VMWARE_TSC_MAP_NUM , #define OPT_NO_PCI "no-pci"OPT_NO_PCI_NUM , +#define OPT_NO_VMBUS "no-vmbus" +OPT_NO_VMBUS_NUM , #define OPT_NO_HUGE "no-huge"OPT_NO_HUGE_NUM , #define OPT_FILE_PREFIX "file-prefix"
lib/librte_eal/common/eal_private.h +10 -0
@@ -165,6 +165,16 @@ int rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev);/** +* VMBUS related functions and structures +*/ +int rte_eal_vmbus_init (void ); + +struct rte_vmbus_driver ; +struct rte_vmbus_device ; + +int rte_eal_vmbus_probe_one_driver (struct rte_vmbus_driver *dr, +struct rte_vmbus_device *dev); +/** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes *
lib/librte_eal/common/include/rte_pci.h +2 -0
@@ -199,6 +199,8 @@ struct rte_pci_driver {#define RTE_PCI_DRV_FORCE_UNBIND 0x0004/** Device driver supports link state interrupt */ #define RTE_PCI_DRV_INTR_LSC 0x0008 +/** Device driver needs VMBUS */ +#define RTE_PCI_DRV_NEED_HV_UIO 0x0010/**< Internal use only - Macro used by pci addr parsing functions **/ #define GET_PCIADDR_FIELD (in, fd, lim, dlm) \
lib/librte_eal/common/include/rte_vmbus.h new file +153 -0
153 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/Makefile +3 -0
@@ -74,6 +74,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_alarm.c ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_ivshmem.c endif +ifeq ($(CONFIG_RTE_LIBRTE_HV_PMD),y) +SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_vmbus.c +endif # from common dir SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_memzone.c
lib/librte_eal/linuxapp/eal/eal.c +5 -0
@@ -755,6 +755,11 @@ rte_eal_init(int argc, char **argv)if (rte_eal_pci_init () <0 )rte_panic ("Cannot init PCI\n" ); +#ifdef RTE_LIBRTE_HV_PMD +if (rte_eal_vmbus_init () <0 ) +RTE_LOG (ERR ,EAL ,"Cannot init VMBUS\n" ); +#endif +#ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_init () <0 )rte_panic ("Cannot init IVSHMEM\n" );
lib/librte_eal/linuxapp/eal/eal_vmbus.c new file +658 -0
658 lines not on this page · raw message
lib/librte_ether/rte_ethdev.c +79 -5
108 lines not on this page · raw message
lib/librte_ether/rte_ethdev.h +13 -2
@@ -175,6 +175,7 @@ extern "C" {#include <rte_log.h> #include <rte_interrupts.h> #include <rte_pci.h> +#include <rte_vmbus.h> #include <rte_mbuf.h> #include "rte_ether.h" #include "rte_eth_ctrl.h"
@@ -1537,7 +1538,10 @@ struct rte_eth_dev {struct rte_eth_dev_data *data;/**< Pointer to device data */ const struct eth_driver *driver;/**< Driver for this device */ struct eth_dev_ops *dev_ops;/**< Functions exported by PMD */ -struct rte_pci_device *pci_dev;/**< PCI info. supplied by probing */ +union { +struct rte_pci_device *pci_dev;/**< PCI info. supplied by probing */ +struct rte_vmbus_device *vmbus_dev;/**< VMBUS info. supplied by probing */ + };struct rte_eth_dev_cb_list callbacks;/**< User application callbacks */ };
@@ -1671,7 +1675,14 @@ typedef int (*eth_dev_init_t)(struct eth_driver *eth_drv,* - The size of the private data to allocate for each matching device. */ struct eth_driver { -struct rte_pci_driver pci_drv;/**< The PMD is also a PCI driver. */ +union { +struct rte_pci_driver pci_drv;/**< The PMD is also a PCI driver. */ +struct rte_vmbus_driver vmbus_drv;/**< The PMD is also a VMBUS drv. */ + }; +enum { +RTE_BUS_PCI =0 , +RTE_BUS_VMBUS + } bus_type;/**< Device bus type. */ eth_dev_init_t eth_dev_init;/**< Device init function. */ unsigned int dev_private_size;/**< Size of device private data. */ };
Signature · 1 line
2.1.4
PATCH 4/7 hv: uio driver
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Add new UIO driver in kernel to support DPDK Poll Mode Driver.
--- lib/librte_eal/linuxapp/Makefile | 3 + lib/librte_eal/linuxapp/hv_uio/Makefile | 57 ++ lib/librte_eal/linuxapp/hv_uio/hv_uio.c | 551 +++++++++++++++++ lib/librte_eal/linuxapp/hv_uio/hyperv_net.h | 907 ++++++++++++++++++++++++++++ 4 files changed, 1518 insertions(+) create mode 100644 lib/librte_eal/linuxapp/hv_uio/Makefile create mode 100644 lib/librte_eal/linuxapp/hv_uio/hv_uio.c create mode 100644 lib/librte_eal/linuxapp/hv_uio/hyperv_net.h
lib/librte_eal/linuxapp/Makefile +3 -0
@@ -41,5 +41,8 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y) DIRS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += xen_dom0 endif +ifeq ($(CONFIG_RTE_LIBRTE_HV_PMD),y) +DIRS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += hv_uio +endif include $(RTE_SDK)/mk/rte.subdir.mk
lib/librte_eal/linuxapp/hv_uio/Makefile new file +57 -0
57 lines not on this page · raw message
lib/librte_eal/linuxapp/hv_uio/hv_uio.c new file +551 -0
551 lines not on this page · raw message
lib/librte_eal/linuxapp/hv_uio/hyperv_net.h new file +907 -0
907 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 5/7 hv: poll mode driver
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
This is new Poll Mode driver for using hyper-v virtual network interface.
--- lib/Makefile | 1 + lib/librte_pmd_hyperv/Makefile | 28 + lib/librte_pmd_hyperv/hyperv.h | 169 ++++ lib/librte_pmd_hyperv/hyperv_drv.c | 1660 +++++++++++++++++++++++++++++++++ lib/librte_pmd_hyperv/hyperv_drv.h | 558 +++++++++++ lib/librte_pmd_hyperv/hyperv_ethdev.c | 334 +++++++ lib/librte_pmd_hyperv/hyperv_logs.h | 68 ++ lib/librte_pmd_hyperv/hyperv_rxtx.c | 402 ++++++++ lib/librte_pmd_hyperv/hyperv_rxtx.h | 35 + mk/rte.app.mk | 4 + 10 files changed, 3259 insertions(+) create mode 100644 lib/librte_pmd_hyperv/Makefile create mode 100644 lib/librte_pmd_hyperv/hyperv.h create mode 100644 lib/librte_pmd_hyperv/hyperv_drv.c create mode 100644 lib/librte_pmd_hyperv/hyperv_drv.h create mode 100644 lib/librte_pmd_hyperv/hyperv_ethdev.c create mode 100644 lib/librte_pmd_hyperv/hyperv_logs.h create mode 100644 lib/librte_pmd_hyperv/hyperv_rxtx.c create mode 100644 lib/librte_pmd_hyperv/hyperv_rxtx.h
lib/Makefile +1 -0
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += librte_pmd_e1000 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += librte_pmd_ixgbe DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += librte_pmd_enic +DIRS-$(CONFIG_RTE_LIBRTE_HV_PMD) += librte_pmd_hyperv DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap
lib/librte_pmd_hyperv/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +# BSD LICENSE +# +# Copyright(c) 2013-2015 Brocade Communications Systems, Inc. +# All rights reserved. + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_hyperv.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_HV_PMD) += hyperv_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_HV_PMD) += hyperv_rxtx.c +SRCS-$(CONFIG_RTE_LIBRTE_HV_PMD) += hyperv_drv.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_HV_PMD) += lib/librte_eal lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_HV_PMD) += lib/librte_mempool lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_HV_PMD) += lib/librte_malloc + +include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_hyperv/hyperv.h new file +169 -0
169 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_drv.c new file +1660 -0
1,660 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_drv.h new file +558 -0
558 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_ethdev.c new file +334 -0
334 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_logs.h new file +68 -0
68 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_rxtx.c new file +402 -0
176 lines not on this page · raw message
lib/librte_pmd_hyperv/hyperv_rxtx.h new file +35 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
Part of the diff is not shown here. View the raw message.
PATCH 6/7 hv: enable driver in common config
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Add hyperv driver config to enable it.
--- config/common_linuxapp | 9 +++++++++ 1 file changed, 9 insertions(+)
config/common_linuxapp +9 -0
@@ -205,6 +205,15 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n # +# Compile burst-mode Hyperv PMD driver +# +CONFIG_RTE_LIBRTE_HV_PMD=y +CONFIG_RTE_LIBRTE_HV_DEBUG=n +CONFIG_RTE_LIBRTE_HV_DEBUG_INIT=n +CONFIG_RTE_LIBRTE_HV_DEBUG_RX=n +CONFIG_RTE_LIBRTE_HV_DEBUG_TX=n + +# # Compile example software rings based PMD # CONFIG_RTE_LIBRTE_PMD_RING=y
Signature · 1 line
2.1.4
PATCH 7/7 hv: add kernel patch
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
For users using non latest kernels, put kernel patch in for them to use.
--- .../linuxapp/hv_uio/vmbus-get-pages.patch | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/librte_eal/linuxapp/hv_uio/vmbus-get-pages.patch
lib/librte_eal/linuxapp/hv_uio/vmbus-get-pages.patch new file +55 -0
@@ -0,0 +1,55 @@ +hyper-v: allow access to vmbus from userspace driver + +This is patch from to allow access to hyper-v vmbus from UIO driver. + +Signed-off-by: Stas Egorov <segorov-nYU0QVwCCFFWk0Htik3J/[email protected]> +Signed-off-by: Stephen Hemminger <[email protected]> + +--- +v2 - simplify and rename to vmbus_get_monitor_pages + + drivers/hv/connection.c | 20 +++++++++++++++++--- + include/linux/hyperv.h | 3 +++ + 2 files changed, 20 insertions(+), 3 deletions(-) + +--- a/drivers/hv/connection.c 2015-02-03 10:58:51.751752450 -0800 ++++ b/drivers/hv/connection.c 2015-02-04 14:59:51.636194383 -0800 +@@ -64,6 +64,15 @@ static __u32 vmbus_get_next_version(__u3 + } + } + ++void vmbus_get_monitor_pages(unsigned long *int_page, ++ unsigned long monitor_pages[2]) ++{ ++ *int_page = (unsigned long)vmbus_connection.int_page; ++ monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0]; ++ monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1]; ++} ++EXPORT_SYMBOL_GPL(vmbus_get_monitor_pages); ++ + static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, + __u32 version) + { +@@ -347,10 +356,7 @@ static void process_chn_event(u32 relid) + else + bytes_to_read = 0; + } while (read_state && (bytes_to_read != 0)); +- } else { +- pr_err("no channel callback for relid - %u\n", relid); + } +- + } + + /* +--- a/include/linux/hyperv.h 2015-02-03 10:58:51.751752450 -0800 ++++ b/include/linux/hyperv.h 2015-02-04 15:00:26.388355012 -0800 +@@ -868,6 +868,9 @@ extern int vmbus_recvpacket_raw(struct v + + extern void vmbus_ontimer(unsigned long data); + ++extern void vmbus_get_monitor_pages(unsigned long *int_page, ++ unsigned long monitor_pages[2]); ++ + /* Base driver object */ + struct hv_driver { + const char *name;
Signature · 1 line
2.1.4
Re: [PATCH 1/7] ether: add function to query for link state interrupt
In reply to a message not in the archiveQuoted 63 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Allow application to query whether link state will work. This is also part of abstracting dependency on PCI.
Signed-off-by Stephen Hemminger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 26 insertions(+)lib/librte_ether/rte_ethdev.c +14
-0@@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) } } +int +rte_eth_has_link_state (uint8_t port_id) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return 0 ; + } + dev = &rte_eth_devices[port_id]; + +return (dev->pci_dev->driver->drv_flags &RTE_PCI_DRV_INTR_LSC ) !=0 ; +} +void rte_eth_stats_get (uint8_t port_id,struct rte_eth_stats *stats) {lib/librte_ether/rte_ethdev.h +12
-0@@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);/** +* Test whether device supports link state interrupt mode. +* +* @param port_id +* The port identifier of the Ethernet device. +* @return +* - (1) if link state interrupt is supported +* - (0) if link state interrupt is not supported +*/ +extern int +rte_eth_has_link_state (uint8_t port_id); + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id Signature · 1 line
2.1.4
I think if your intention is to expose this as an application (or other library visible api), you'll need to add it to the appropriate version map file for the link now. Should just be a single line addition
Regards
Neil
Re: [PATCH 3/7] hv: add basic vmbus support
In reply to a message not in the archiveQuoted 10 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
The hyper-v device driver forces the base EAL code to change to support multiple bus types. This is done changing the
pci_devicein ether driver to a generic union.As much as possible this is done in a backwards source compatiable way. It will break ABI for device drivers.
Signed-off-by Stephen Hemminger <[email protected]>
Quoted 17 lines
--- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_options.c | 5 + lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/common/eal_private.h | 10 + lib/librte_eal/common/include/rte_pci.h | 2 + lib/librte_eal/common/include/rte_vmbus.h | 153 +++++++ lib/librte_eal/linuxapp/eal/Makefile | 3 + lib/librte_eal/linuxapp/eal/eal.c | 5 + lib/librte_eal/linuxapp/eal/eal_vmbus.c | 658 +++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.c | 84 +++- lib/librte_ether/rte_ethdev.h | 15 +- 12 files changed, 932 insertions(+), 8 deletions(-) create mode 100644 lib/librte_eal/common/include/rte_vmbus.h create mode 100644 lib/librte_eal/linuxapp/eal/eal_vmbus.c
It seems like the vmbus functions need to be versioned here.
Re: [PATCH 1/7] ether: add function to query for link state interrupt
In reply to a message not in the archiveQuoted 68 lines · On Thu, 5 Feb 2015 01:47:37 +0000 Neil Horman…
Quoted 63 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Allow application to query whether link state will work. This is also part of abstracting dependency on PCI.
Signed-off-by Stephen Hemminger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 26 insertions(+)lib/librte_ether/rte_ethdev.c +14
-0@@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) } } +int +rte_eth_has_link_state (uint8_t port_id) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return 0 ; + } + dev = &rte_eth_devices[port_id]; + +return (dev->pci_dev->driver->drv_flags &RTE_PCI_DRV_INTR_LSC ) !=0 ; +} +void rte_eth_stats_get (uint8_t port_id,struct rte_eth_stats *stats) {lib/librte_ether/rte_ethdev.h +12
-0@@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);/** +* Test whether device supports link state interrupt mode. +* +* @param port_id +* The port identifier of the Ethernet device. +* @return +* - (1) if link state interrupt is supported +* - (0) if link state interrupt is not supported +*/ +extern int +rte_eth_has_link_state (uint8_t port_id); + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id Signature · 1 line
2.1.4I think if your intention is to expose this as an application (or other library visible api), you'll need to add it to the appropriate version map file for the link now. Should just be a single line addition
Quoted 3 lines
Regards
Neil
Will add that after other changes are approved.
Also looking at the map files they seem to have been auto generated because some symbols are exposed which are unnecessary (example pci_driver_list)
Re: [PATCH 1/7] ether: add function to query for link state interrupt
Quoted 71 lines · Stephen Hemminger
Quoted 68 lines · On Thu, 5 Feb 2015 01:47:37 +0000 Neil Horman…
Quoted 63 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Allow application to query whether link state will work. This is also part of abstracting dependency on PCI.
Signed-off-by Stephen Hemminger <[email protected]>--- lib/librte_ether/rte_ethdev.c | 14 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 12 ++++++++++++ 2 files changed, 26 insertions(+)lib/librte_ether/rte_ethdev.c +14
-0@@ -1264,6 +1264,20 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link) } } +int +rte_eth_has_link_state (uint8_t port_id) +{ +struct rte_eth_dev *dev; + +if (port_id >= nb_ports) { +PMD_DEBUG_TRACE ("Invalid port_id=%d\n" , port_id); +return 0 ; + } + dev = &rte_eth_devices[port_id]; + +return (dev->pci_dev->driver->drv_flags &RTE_PCI_DRV_INTR_LSC ) !=0 ; +} +void rte_eth_stats_get (uint8_t port_id,struct rte_eth_stats *stats) {lib/librte_ether/rte_ethdev.h +12
-0@@ -2038,6 +2038,18 @@ extern void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);/** +* Test whether device supports link state interrupt mode. +* +* @param port_id +* The port identifier of the Ethernet device. +* @return +* - (1) if link state interrupt is supported +* - (0) if link state interrupt is not supported +*/ +extern int +rte_eth_has_link_state (uint8_t port_id); + +/** * Retrieve the general I/O statistics of an Ethernet device. * * @param port_id Signature · 1 line
2.1.4I think if your intention is to expose this as an application (or other library visible api), you'll need to add it to the appropriate version map file for the link now. Should just be a single line addition
Quoted 7 lines
Quoted 3 lines
Regards
NeilWill add that after other changes are approved.
Also looking at the map files they seem to have been auto generated because some symbols are exposed which are unnecessary (examplepci_driver_list)
It wasn't quite auto generated. It was generated based on what the requisite header files for a library exposed to the various applications that used them. In your example above pci_driver_list is a global public variable, that is referenced by applications that the DPDK ships (in this case the test_pci application). I completely agree that it shouldn't need to be versioned, as it shouldn't be exposed at all, relying instead on accessor functions to reach it, but as such, it is what it is. By versioning it, we at least allow ourselves the option to maintain backwards compatibility if the list type changes or we wish to start hiding the symbol in future versions.
Neil