Skip to contentSkip to conversation

DPDK support to bifurcated driver

RFC PATCH In review Cunming Liang 7 participants 24 messages Nov 25, 2014 – Apr 20, 2015 11 messages not in the archive Library code

lore
Share & tools
lore
#0 lore raw

cover DPDK support to bifurcated driver

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory bandwidth.

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user space. The bifurcated driver PMD talks to a NIC interface using raw socket APIs and only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated netdev. The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC address, numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the creation of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go through mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and number of queue pairs. Here's a example about how to configure the bifurcated driver and run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn, map_umem. And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd, hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the moment, so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as sample. The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336 +++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303 ++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Signature · 1 line
1.8.1.4
#2 lore raw

RFC PATCH 1/6 eal: common direct ring access API

In reply to a message not in the archive
---
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 +++++++++++++++++++++++++
 2 files changed, 191 insertions(+)
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
lib/librte_eal/common/Makefile +5 -0
index 499ba4d..6b2e231 100644
@@ -52,6 +52,11 @@ GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h
 ARCH_DIR ?= $(RTE_ARCH)
 ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
 
+ifeq ($(CONFIG_RTE_LIBRTE_EAL_LINUXAPP),y)
+INC += rte_pci_bifurc.h
+endif
+
+
 SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
 SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include += \
 	$(addprefix include/arch/$(ARCH_DIR)/,$(ARCH_INC))
lib/librte_eal/common/include/rte_pci_bifurc.h new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#3 lore raw

RFC PATCH 2/6 eal: direct ring access support by linux af_packet

In reply to a message not in the archive
---
 lib/librte_eal/linuxapp/eal/Makefile         |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c | 336 +++++++++++++++++++++++++++
 2 files changed, 337 insertions(+)
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
lib/librte_eal/linuxapp/eal/Makefile +1 -0
index 06c1dc5..f775203 100644
@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_bifurc.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c
lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c new file +336 -0

336 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#4 lore raw

RFC PATCH 3/6 pci: allow VDEV as pci device during device driver probe

In reply to a message not in the archive
---
 lib/librte_eal/common/include/rte_pci.h |  4 ++++
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 42 +++++++++++++++++++++------------
 lib/librte_ether/rte_ethdev.c           |  3 +--
 3 files changed, 32 insertions(+), 17 deletions(-)
lib/librte_eal/common/include/rte_pci.h +4 -0
index 66ed793..e205330 100644
@@ -139,11 +139,13 @@ struct rte_pci_addr {
 
 struct rte_devargs;
 
+#define RTE_PCI_DEV_NAME_SIZE           (32)
 /**
  * A structure describing a PCI device.
  */
 struct rte_pci_device {
 	TAILQ_ENTRY(rte_pci_device) next;       /**< Next probed PCI device. */
+	char name[RTE_PCI_DEV_NAME_SIZE];       /**< PCI device name. */
 	struct rte_pci_addr addr;               /**< PCI location. */
 	struct rte_pci_id id;                   /**< PCI ID. */
 	struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI Memory Resource */
@@ -199,6 +201,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 supports bifurcated queue pair mapping */
+#define RTE_PCI_DRV_BIFURC      0x0010
 
 /**< Internal use only - Macro used by pci addr parsing functions **/
 #define GET_PCIADDR_FIELD(in, fd, lim, dlm)                   \
lib/librte_eal/linuxapp/eal/eal_pci.c +27 -15

56 lines not on this page · raw message

lib/librte_ether/rte_ethdev.c +1 -2
index 3e2b5d8..76be736 100644
@@ -246,8 +246,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 	eth_drv = (struct eth_driver *)pci_drv;
 
 	/* Create unique Ethernet device name using PCI address */
-	snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%d:%d.%d",
-			pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
+	snprintf(ethdev_name, RTE_ETH_NAME_MAX_LEN, "%s", pci_dev->name);
 
 	eth_dev = rte_eth_dev_allocate(ethdev_name);
 	if (eth_dev == NULL)
Signature · 1 line
1.8.1.4
#5 lore raw

RFC PATCH 4/6 bifurc: add driver to scan bifurcated netdev

In reply to a message not in the archive
---
 config/common_linuxapp         |   5 +
 lib/Makefile                   |   1 +
 lib/librte_bifurc/Makefile     |  58 +++++++++
 lib/librte_bifurc/rte_bifurc.c | 284 +++++++++++++++++++++++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h |  90 +++++++++++++
 mk/rte.app.mk                  |   6 +
 6 files changed, 444 insertions(+)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
config/common_linuxapp +5 -0
index 86a0d15..72fe0b1 100644
@@ -163,6 +163,11 @@ CONFIG_RTE_LIBRTE_IEEE1588=n
 CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 
 #
+# Compile bifurcate driver backed by AF_PACKET sockets (Linux only)
+#
+CONFIG_RTE_LIBRTE_BIFURC=y
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
lib/Makefile +1 -0
index 204ef11..c59ae5b 100644
@@ -69,6 +69,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 DIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += librte_ivshmem
+DIRS-$(CONFIG_RTE_LIBRTE_BIFURC) += librte_bifurc
 endif
 
 include $(RTE_SDK)/mk/rte.sharelib.mk
lib/librte_bifurc/Makefile new file +58 -0

58 lines not on this page · raw message

lib/librte_bifurc/rte_bifurc.c new file +284 -0

284 lines not on this page · raw message

lib/librte_bifurc/rte_bifurc.h new file +90 -0

90 lines not on this page · raw message

mk/rte.app.mk +6 -0
index 59468b0..ea074ab 100644
@@ -219,6 +219,12 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
 LDLIBS += -lrte_pmd_af_packet
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+LDLIBS += -lrte_bifurc
+endif
+endif
+
 endif # plugins
 
 LDLIBS += $(EXECENV_LDLIBS)
Signature · 1 line
1.8.1.4
#6 lore raw

RFC PATCH 5/6 ixgbe: rx/tx queue stop bug fix

In reply to a message not in the archive
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +2 -2
index f9b3fe3..e240376 100644
@@ -3805,7 +3805,7 @@ ixgbe_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		do {
 			rte_delay_ms(1);
 			rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx));
-		} while (--poll_ms && (rxdctl | IXGBE_RXDCTL_ENABLE));
+		} while (--poll_ms && (rxdctl & IXGBE_RXDCTL_ENABLE));
 		if (!poll_ms)
 			PMD_INIT_LOG(ERR, "Could not disable Rx Queue %d",
 				     rx_queue_id);
@@ -3906,7 +3906,7 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 				rte_delay_ms(1);
 				txdctl = IXGBE_READ_REG(hw,
 						IXGBE_TXDCTL(txq->reg_idx));
-			} while (--poll_ms && (txdctl | IXGBE_TXDCTL_ENABLE));
+			} while (--poll_ms && (txdctl & IXGBE_TXDCTL_ENABLE));
 			if (!poll_ms)
 				PMD_INIT_LOG(ERR, "Could not disable "
 					     "Tx Queue %d", tx_queue_id);
Signature · 1 line
1.8.1.4
#9 lore raw

RFC PATCH 6/6 ixgbe: PMD for bifurc ixgbe net device

In reply to a message not in the archive
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303 +++++++++++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
lib/librte_pmd_ixgbe/Makefile +12 -1
index 3588047..6867f17 100644
@@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_ixgbe.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -Wno-cast-qual
 
 ifeq ($(CC), icc)
 #
@@ -108,10 +108,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bifurcate.c
+endif
+endif
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net lib/librte_malloc
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_bifurc
+endif
+endif
+
 
 include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +303 -0

303 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +57 -0

57 lines not on this page · raw message

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +33 -7
index e240376..2d32907 100644
@@ -100,6 +100,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
+static inline uint16_t
+ixgbe_dev_queue_offset(struct rte_eth_dev *dev)
+{
+	return (RTE_ETH_DEV_SRIOV(dev).active == 0) ?
+		0 : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx;
+}
 
 #if 1
 #define RTE_PMD_USE_PREFETCH
@@ -1726,6 +1732,17 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			 unsigned int socket_id,
 			 const struct rte_eth_txconf *tx_conf)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+int
+ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_txconf *tx_conf)
+{
 	const struct rte_memzone *tz;
 	struct igb_tx_queue *txq;
 	struct ixgbe_hw     *hw;
@@ -1849,8 +1866,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
 	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
-	txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	txq->reg_idx  = queue_idx + offset;
 	txq->port_id = dev->data->port_id;
 	txq->txq_flags = tx_conf->txq_flags;
 	txq->ops = &def_txq_ops;
@@ -2083,6 +2099,18 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 			 const struct rte_eth_rxconf *rx_conf,
 			 struct rte_mempool *mp)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+int
+ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_rxconf *rx_conf,
+		    struct rte_mempool *mp)
+{
 	const struct rte_memzone *rz;
 	struct igb_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
@@ -2118,8 +2146,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 	rxq->queue_id = queue_idx;
-	rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	rxq->reg_idx  =	queue_idx + offset;
 	rxq->port_id = dev->data->port_id;
 	rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
 							0 : ETHER_CRC_LEN);
@@ -3402,9 +3429,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t fctrl;
 	uint32_t hlreg0;
 	uint32_t maxfrs;
-	uint32_t srrctl;
 	uint32_t rdrxctl;
 	uint32_t rxcsum;
+	uint32_t srrctl;
 	uint16_t buf_size;
 	uint16_t i;
 
@@ -3684,9 +3711,9 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	struct ixgbe_hw     *hw;
 	struct igb_tx_queue *txq;
 	struct igb_rx_queue *rxq;
-	uint32_t txdctl;
 	uint32_t dmatxctl;
 	uint32_t rxctrl;
+	uint32_t txdctl;
 	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
@@ -3731,7 +3758,6 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB &&
 			dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
 		ixgbe_setup_loopback_link_82599(hw);
-
 }
 
 /*
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +10 -0
index eb89715..aeffb5f 100644
@@ -243,6 +243,16 @@ struct ixgbe_txq_ops {
 			 IXGBE_ADVTXD_DCMD_DEXT |\
 			 IXGBE_ADVTXD_DCMD_EOP)
 
+int ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_txconf *tx_conf);
+int ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_rxconf *rx_conf,
+			struct rte_mempool *mp);
+
 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
Signature · 1 line
1.8.1.4
#18 lore raw
In reply to a message not in the archive
Quoted 193 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory bandwidth.

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user space. The bifurcated driver PMD talks to a NIC interface using raw socket APIs and only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated netdev. The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC address, numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the creation of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go through mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and number of queue pairs. Here's a example about how to configure the bifurcated driver and run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn, map_umem. And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd, hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the moment, so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as sample. The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336 +++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303 ++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
Quoted 13 lines
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Signature · 1 line
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it? Given that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

#20 lore raw
In reply to a message not in the archive
Quoted 207 lines · Neil Horman
Quoted 193 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory bandwidth.

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user space. The bifurcated driver PMD talks to a NIC interface using raw socket APIs and only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated netdev. The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC address, numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the creation of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go through mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and number of queue pairs. Here's a example about how to configure the bifurcated driver and run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn, map_umem. And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd, hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the moment, so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as sample. The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336 +++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303 ++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
Quoted 13 lines
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Signature · 1 line
1.8.1.4
Quoted 6 lines

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it? Given that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

/Bruce

#11 lore raw

Re: [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

In reply to a message not in the archive
Quoted 11 lines · Cunming Liang
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303 +++++++++++++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

These changes are the ones that I'm not too sure about. I'd prefer if all material for the bifurcated driver be kept within the librte_pmd_bifurc directory. Is it possible to leave ixgbe largely unmodified and simply have the new bifurcated driver pull in the needed ixgbe (and later i40e) functions at compile time i.e. refer from one Makefile to the sources in the other driver's directory?
My thinking is that the bifurcated driver is so significantly different in the way it works, and the limits on it's functionality e.g. no direct filter support or queue management, that it's best kept completely separate and only "borrow" the needed descriptor read/write functions from the other drivers as is needed.

Just my 2c. I'm curious as to what others think.

/Bruce

Quoted 535 lines
lib/librte_pmd_ixgbe/Makefile +12 -1
index 3588047..6867f17 100644
@@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_ixgbe.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -Wno-cast-qual
 
 ifeq ($(CC), icc)
 #
@@ -108,10 +108,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bifurcate.c
+endif
+endif
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net lib/librte_malloc
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_bifurc
+endif
+endif
+
 
 include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +303 -0
new file mode 100644
index 0000000..84c445a
@@ -0,0 +1,303 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_eal.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+#include <rte_ethdev.h>
+#include <rte_kvargs.h>
+#include <rte_bifurc.h>
+
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <poll.h>
+#include <errno.h>
+
+#include "ixgbe_logs.h"
+#include "ixgbe_ethdev.h"
+#include "ixgbe/ixgbe_api.h"
+
+#include <rte_mbuf.h>
+#include <rte_bifurc.h>
+#include "ixgbe_rxtx.h"
+
+static int
+ixgbe_dev_bfc_configure(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+static void
+ixgbe_dev_bfc_info(struct rte_eth_dev *dev,
+		   struct rte_eth_dev_info *dev_info)
+{
+	rte_bifurc_ethdev_get_info(dev, dev_info);
+}
+
+static void
+ixgbe_dev_bfc_stats_get(__rte_unused struct rte_eth_dev *dev,
+			__rte_unused struct rte_eth_stats *igb_stats)
+{
+	return;
+}
+
+static int
+ixgbe_dev_bfc_start(struct rte_eth_dev *dev)
+{
+	int err;
+
+	/* initialize transmission unit */
+	ixgbe_dev_tx_init(dev);
+
+	/* This can fail when allocating mbufs for descriptor rings */
+	err = ixgbe_dev_rx_init(dev);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to initialize RX hardware\n");
+		goto error;
+	}
+
+	ixgbe_dev_rxtx_start(dev);
+
+	return 0;
+
+error:
+	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+	ixgbe_dev_clear_queues(dev);
+	return -EIO;
+}
+
+static void
+ixgbe_dev_bfc_stop(struct rte_eth_dev *dev)
+{
+	unsigned i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++)
+		ixgbe_dev_tx_queue_stop(dev, i);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		ixgbe_dev_rx_queue_stop(dev, i);
+}
+
+static void
+ixgbe_dev_bfc_close(struct rte_eth_dev *dev)
+{
+	ixgbe_dev_bfc_stop(dev);
+
+	rte_bifurc_ethdev_free(dev);
+}
+
+static inline int
+rte_ixgbe_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = &(dev->data->dev_link);
+	struct rte_eth_link *src = link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_link_update(__rte_unused struct rte_eth_dev *dev,
+			  __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link link;
+
+	link.link_status = 1;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_LINK_SPEED_10000;
+
+	rte_ixgbe_dev_atomic_write_link_status(dev, &link);
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_rx_queue_setup(struct rte_eth_dev *dev,
+			 uint16_t queue_idx,
+			 uint16_t nb_desc,
+			 unsigned int socket_id,
+			 const struct rte_eth_rxconf *rx_conf,
+			 struct rte_mempool *mp)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+static int
+ixgbe_dev_bfc_tx_queue_setup(struct rte_eth_dev *dev,
+			     uint16_t queue_idx,
+			     uint16_t nb_desc,
+			     unsigned int socket_id,
+			     const struct rte_eth_txconf *tx_conf)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+static struct eth_dev_ops ixgbe_bifurc_ops = {
+	.dev_start = ixgbe_dev_bfc_start,
+	.dev_stop = ixgbe_dev_bfc_stop,
+	.dev_close = ixgbe_dev_bfc_close,
+	.dev_configure = ixgbe_dev_bfc_configure,
+	.dev_infos_get = ixgbe_dev_bfc_info,
+	.rx_queue_setup = ixgbe_dev_bfc_rx_queue_setup,
+	.tx_queue_setup = ixgbe_dev_bfc_tx_queue_setup,
+	.rx_queue_release = ixgbe_dev_rx_queue_release,
+	.tx_queue_release = ixgbe_dev_tx_queue_release,
+	.link_update = ixgbe_dev_bfc_link_update,
+	.stats_get = ixgbe_dev_bfc_stats_get,
+	.stats_reset = NULL,
+};
+
+static int
+eth_ixgbe_bifurc_dev_init(struct eth_driver *eth_drv __rte_unused,
+			  struct rte_eth_dev *eth_dev)
+{
+	struct rte_pci_device *pci_dev;
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	int diag;
+
+	PMD_INIT_FUNC_TRACE();
+
+	eth_dev->dev_ops = &ixgbe_bifurc_ops;
+	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;
+
+	/* for secondary processes, we don't initialise any further as primary
+	 * has already done this work. Only check we don't need a different
+	 * RX function */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		if (eth_dev->data->scattered_rx)
+			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		return 0;
+	}
+	pci_dev = eth_dev->pci_dev;
+
+	/* Vendor and Device ID need to be set before init of shared code */
+	hw->device_id = pci_dev->id.device_id;
+	hw->vendor_id = pci_dev->id.vendor_id;
+	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+
+#ifdef RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP
+	hw->allow_unsupported_sfp = 1;
+#endif
+
+	/* Initialize the shared code (base driver) */
+#ifdef RTE_NIC_BYPASS
+	diag = ixgbe_bypass_init_shared_code(hw);
+#else
+	diag = ixgbe_init_shared_code(hw);
+#endif /* RTE_NIC_BYPASS */
+
+	if (diag != IXGBE_SUCCESS) {
+		PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+		return -EIO;
+	}
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
+			hw->mac.num_rar_entries, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR,
+			"Failed to allocate %u bytes needed to store "
+			"MAC addresses",
+			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+		return -ENOMEM;
+	}
+	rte_bifurc_mac_addr(eth_dev, &eth_dev->data->mac_addrs[0]);
+
+	return diag;
+}
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_ixgbe_map[] = {
+
+#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
+#define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
+#include "rte_pci_dev_ids.h"
+
+{ .vendor_id = 0, /* sentinel */ },
+};
+
+static struct eth_driver rte_ixgbe_bifurc_pmd = {
+	{
+		.name = "rte_ixgbe_bifurc_pmd",
+		.id_table = pci_id_ixgbe_map,
+		.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+			RTE_PCI_DRV_BIFURC,
+	},
+	.eth_dev_init = eth_ixgbe_bifurc_dev_init,
+	.dev_private_size = sizeof(struct ixgbe_adapter),
+};
+
+/*
+ * Driver initialization routine.
+ * Invoked once at EAL init time.
+ * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
+ */
+static int
+rte_ixgbe_bifurc_pmd_init(const char *name __rte_unused,
+			  const char *params __rte_unused)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	rte_eth_driver_register(&rte_ixgbe_bifurc_pmd);
+	return 0;
+}
+
+static struct rte_driver rte_ixgbe_bifurc_driver = {
+	.type = PMD_PDEV,
+	.init = rte_ixgbe_bifurc_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_bifurc_driver);
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +57 -0
new file mode 100644
index 0000000..d40b21d
@@ -0,0 +1,57 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IXGBE_BIFFURCATE_H_
+#define _IXGBE_BIFFURCATE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IXGBE_82599_MAX_RX_QUEUES 128
+
+#define RTE_PMD_PACKET_RING_SPLITOFF_LOWER_LIMIT 32
+#define RTE_PMD_PACKET_MAX_RING_PAIRS  IXGBE_82599_MAX_RX_QUEUES
+
+
+/**
+ * For use by the EAL only. Called as part of EAL init to set up any dummy NICs
+ * configured on command line.
+ */
+int rte_ixgbe_bfc_pmd_init(const char *name, const char *params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +33 -7
index e240376..2d32907 100644
@@ -100,6 +100,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
+static inline uint16_t
+ixgbe_dev_queue_offset(struct rte_eth_dev *dev)
+{
+	return (RTE_ETH_DEV_SRIOV(dev).active == 0) ?
+		0 : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx;
+}
 
 #if 1
 #define RTE_PMD_USE_PREFETCH
@@ -1726,6 +1732,17 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 			 unsigned int socket_id,
 			 const struct rte_eth_txconf *tx_conf)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+int
+ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_txconf *tx_conf)
+{
 	const struct rte_memzone *tz;
 	struct igb_tx_queue *txq;
 	struct ixgbe_hw     *hw;
@@ -1849,8 +1866,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
 	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
-	txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	txq->reg_idx  = queue_idx + offset;
 	txq->port_id = dev->data->port_id;
 	txq->txq_flags = tx_conf->txq_flags;
 	txq->ops = &def_txq_ops;
@@ -2083,6 +2099,18 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 			 const struct rte_eth_rxconf *rx_conf,
 			 struct rte_mempool *mp)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+int
+ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_rxconf *rx_conf,
+		    struct rte_mempool *mp)
+{
 	const struct rte_memzone *rz;
 	struct igb_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
@@ -2118,8 +2146,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 	rxq->queue_id = queue_idx;
-	rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	rxq->reg_idx  =	queue_idx + offset;
 	rxq->port_id = dev->data->port_id;
 	rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
 							0 : ETHER_CRC_LEN);
@@ -3402,9 +3429,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t fctrl;
 	uint32_t hlreg0;
 	uint32_t maxfrs;
-	uint32_t srrctl;
 	uint32_t rdrxctl;
 	uint32_t rxcsum;
+	uint32_t srrctl;
 	uint16_t buf_size;
 	uint16_t i;
 
@@ -3684,9 +3711,9 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	struct ixgbe_hw     *hw;
 	struct igb_tx_queue *txq;
 	struct igb_rx_queue *rxq;
-	uint32_t txdctl;
 	uint32_t dmatxctl;
 	uint32_t rxctrl;
+	uint32_t txdctl;
 	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
@@ -3731,7 +3758,6 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB &&
 			dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
 		ixgbe_setup_loopback_link_82599(hw);
-
 }
 
 /*
lib/librte_pmd_ixgbe/ixgbe_rxtx.h +10 -0
index eb89715..aeffb5f 100644
@@ -243,6 +243,16 @@ struct ixgbe_txq_ops {
 			 IXGBE_ADVTXD_DCMD_DEXT |\
 			 IXGBE_ADVTXD_DCMD_EOP)
 
+int ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_txconf *tx_conf);
+int ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_rxconf *rx_conf,
+			struct rte_mempool *mp);
+
 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
Signature · 1 line
1.8.1.4
#21 lore raw
In reply to Bruce Richardson
Quoted 237 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:30 PM
To: Neil Horman
Cc: Liang, Cunming; [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 29 lines · Neil Horman
Quoted 28 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

Quoted 5 lines
Quoted 5 lines

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 17 lines
Quoted 17 lines

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

Quoted 5 lines
Quoted 5 lines

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user

space.

Quoted 6 lines
Quoted 6 lines

The bifurcated driver PMD talks to a NIC interface using raw socket APIs and only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 5 lines
Quoted 5 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the

creation

Quoted 5 lines
Quoted 5 lines

of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go

through

Quoted 7 lines
Quoted 7 lines

mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the bifurcated driver

and

Quoted 25 lines
Quoted 25 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 7 lines
Quoted 7 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 23 lines
Quoted 23 lines

And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd, hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Quoted 4 lines
Quoted 4 lines

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as

sample.

Quoted 34 lines
Quoted 34 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines
Quoted 4 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284

+++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 17 lines
Quoted 13 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 4 lines

--
1.8.1.4

Quoted 6 lines

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it? Given that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Quoted 3 lines

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

[Liang, Cunming] Yes, as Bruce said, that's the major purpose. Another one is having this patch, people can run it together with kernel patch. It helps to understand the benefit and raise comments per user experience.

Quoted 2 lines

/Bruce

#23 lore raw
In reply to a message not in the archive
Quoted 245 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Liang, Cunming
Sent: Tuesday, November 25, 2014 10:40 PM
To: Richardson, Bruce; Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 235 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:30 PM
To: Neil Horman
Cc: Liang, Cunming; [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 29 lines · Neil Horman
Quoted 28 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

Quoted 5 lines
Quoted 5 lines

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 17 lines
Quoted 17 lines

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

Quoted 5 lines
Quoted 5 lines

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user

space.

Quoted 6 lines
Quoted 6 lines

The bifurcated driver PMD talks to a NIC interface using raw socket APIs and only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 5 lines
Quoted 5 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the

creation

Quoted 5 lines
Quoted 5 lines

of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go

through

Quoted 7 lines
Quoted 7 lines

mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the bifurcated driver

and

Quoted 25 lines
Quoted 25 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 7 lines
Quoted 7 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 23 lines
Quoted 23 lines

And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd, hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Quoted 4 lines
Quoted 4 lines

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as

sample.

Quoted 34 lines
Quoted 34 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines
Quoted 4 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284

+++++++++++++++++++++

Quoted 7 lines
Quoted 7 lines
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 23 lines
Quoted 13 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 4 lines

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it? Given that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Quoted 8 lines
Quoted 3 lines

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

[Liang, Cunming] Yes, as Bruce said, that's the major purpose. Another one is having this patch, people can run it together with kernel patch. It helps to understand the benefit and raise comments per user experience.

Quoted 2 lines

/Bruce

Echo Bruce. Also the V2 DPDK RFC patchset will be submitted to dpdk.org to support V2 netdev kernel patchset with memory protection accordingly. Then people can play with bifurcated driver and have a global view on how it works and what kinds of perf. can be achieved, instead of keep asking basic questions.

#12 lore raw

Re: [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

In reply to Bruce Richardson
Quoted 23 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:34 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines · Cunming Liang
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303

+++++++++++++++++++++++++++++++++

Quoted 7 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 2 lines

These changes are the ones that I'm not too sure about. I'd prefer if all material for the bifurcated driver be kept within the librte_pmd_bifurc directory.

[Liang, Cunming] I haven't a librte_pmd_bifurc library.
So far the purpose of librte_bifurc is for device scan, not used as a pmd.
During driver probe, depend on device id, it asks for correct pmd from 'librte_pmd_ixgbe, librte_pmd_i40e'.

Quoted 4 lines

Is it possible to leave ixgbe largely unmodified and simply have the new bifurcated driver pull in the needed ixgbe (and later i40e) functions at compile time i.e. refer from one Makefile to the sources in the other driver's directory?

[Liang, Cunming] Nice point. If we have single directory gathering all direct ring access. e.g. We have aka "librte_pmd_bifurc", inside it, we'll have bifurc_ixgbe, bifurc_i40e, ... Each of them still depend on other libraries like librte_pmd_ixgbe/librte_pmd_i40e. We may remove the internal dependence inside one pmd driver, but between libraries we add more.

Quoted 580 lines

My thinking is that the bifurcated driver is so significantly different in the way it works, and the limits on it's functionality e.g. no direct filter support or queue management, that it's best kept completely separate and only "borrow" the needed descriptor read/write functions from the other drivers as is needed.

Just my 2c. I'm curious as to what others think.

/Bruce

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

Quoted 14 lines
lib/librte_pmd_ixgbe/Makefile +1 -1
index 3588047..6867f17 100644
@@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_ixgbe.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -Wno-cast-qual
 
 ifeq ($(CC), icc)
 #
@@ -108,10 +108,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

ixgbe_bypass.c

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c

Quoted 11 lines
lib/librte_pmd_ixgbe/Makefile +5 -0
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bifurcate.c
+endif
+endif
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal

lib/librte_ether

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 119

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool

lib/librte_mbuf

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 120

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net

lib/librte_malloc

Review

Quoted 9 lines
lib/librte_pmd_ixgbe/Makefile +6 -0
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_bifurc
+endif
+endif
+
 
 include $(RTE_SDK)/mk/rte.lib.mk
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 16 lines

new file mode 100644
index 0000000..84c445a

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +11 -0
@@ -0,0 +1,303 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 22

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 26

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 27

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS

OF USE,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 28

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

ON ANY

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 30

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 224 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +224 -0
+ */
+
+#include <rte_eal.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+#include <rte_ethdev.h>
+#include <rte_kvargs.h>
+#include <rte_bifurc.h>
+
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <poll.h>
+#include <errno.h>
+
+#include "ixgbe_logs.h"
+#include "ixgbe_ethdev.h"
+#include "ixgbe/ixgbe_api.h"
+
+#include <rte_mbuf.h>
+#include <rte_bifurc.h>
+#include "ixgbe_rxtx.h"
+
+static int
+ixgbe_dev_bfc_configure(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+static void
+ixgbe_dev_bfc_info(struct rte_eth_dev *dev,
+		   struct rte_eth_dev_info *dev_info)
+{
+	rte_bifurc_ethdev_get_info(dev, dev_info);
+}
+
+static void
+ixgbe_dev_bfc_stats_get(__rte_unused struct rte_eth_dev *dev,
+			__rte_unused struct rte_eth_stats *igb_stats)
+{
+	return;
+}
+
+static int
+ixgbe_dev_bfc_start(struct rte_eth_dev *dev)
+{
+	int err;
+
+	/* initialize transmission unit */
+	ixgbe_dev_tx_init(dev);
+
+	/* This can fail when allocating mbufs for descriptor rings */
+	err = ixgbe_dev_rx_init(dev);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to initialize RX hardware\n");
+		goto error;
+	}
+
+	ixgbe_dev_rxtx_start(dev);
+
+	return 0;
+
+error:
+	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+	ixgbe_dev_clear_queues(dev);
+	return -EIO;
+}
+
+static void
+ixgbe_dev_bfc_stop(struct rte_eth_dev *dev)
+{
+	unsigned i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++)
+		ixgbe_dev_tx_queue_stop(dev, i);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		ixgbe_dev_rx_queue_stop(dev, i);
+}
+
+static void
+ixgbe_dev_bfc_close(struct rte_eth_dev *dev)
+{
+	ixgbe_dev_bfc_stop(dev);
+
+	rte_bifurc_ethdev_free(dev);
+}
+
+static inline int
+rte_ixgbe_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = &(dev->data->dev_link);
+	struct rte_eth_link *src = link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_link_update(__rte_unused struct rte_eth_dev *dev,
+			  __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link link;
+
+	link.link_status = 1;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_LINK_SPEED_10000;
+
+	rte_ixgbe_dev_atomic_write_link_status(dev, &link);
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_rx_queue_setup(struct rte_eth_dev *dev,
+			 uint16_t queue_idx,
+			 uint16_t nb_desc,
+			 unsigned int socket_id,
+			 const struct rte_eth_rxconf *rx_conf,
+			 struct rte_mempool *mp)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+static int
+ixgbe_dev_bfc_tx_queue_setup(struct rte_eth_dev *dev,
+			     uint16_t queue_idx,
+			     uint16_t nb_desc,
+			     unsigned int socket_id,
+			     const struct rte_eth_txconf *tx_conf)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+static struct eth_dev_ops ixgbe_bifurc_ops = {
+	.dev_start = ixgbe_dev_bfc_start,
+	.dev_stop = ixgbe_dev_bfc_stop,
+	.dev_close = ixgbe_dev_bfc_close,
+	.dev_configure = ixgbe_dev_bfc_configure,
+	.dev_infos_get = ixgbe_dev_bfc_info,
+	.rx_queue_setup = ixgbe_dev_bfc_rx_queue_setup,
+	.tx_queue_setup = ixgbe_dev_bfc_tx_queue_setup,
+	.rx_queue_release = ixgbe_dev_rx_queue_release,
+	.tx_queue_release = ixgbe_dev_tx_queue_release,
+	.link_update = ixgbe_dev_bfc_link_update,
+	.stats_get = ixgbe_dev_bfc_stats_get,
+	.stats_reset = NULL,
+};
+
+static int
+eth_ixgbe_bifurc_dev_init(struct eth_driver *eth_drv __rte_unused,
+			  struct rte_eth_dev *eth_dev)
+{
+	struct rte_pci_device *pci_dev;
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	int diag;
+
+	PMD_INIT_FUNC_TRACE();
+
+	eth_dev->dev_ops = &ixgbe_bifurc_ops;
+	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;
+
+	/* for secondary processes, we don't initialise any further as primary
+	 * has already done this work. Only check we don't need a different
+	 * RX function */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		if (eth_dev->data->scattered_rx)
+			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		return 0;
+	}
+	pci_dev = eth_dev->pci_dev;
+
+	/* Vendor and Device ID need to be set before init of shared code */
+	hw->device_id = pci_dev->id.device_id;
+	hw->vendor_id = pci_dev->id.vendor_id;
+	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+
+#ifdef RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP
+	hw->allow_unsupported_sfp = 1;
+#endif
+
+	/* Initialize the shared code (base driver) */
+#ifdef RTE_NIC_BYPASS
+	diag = ixgbe_bypass_init_shared_code(hw);
+#else
+	diag = ixgbe_init_shared_code(hw);
+#endif /* RTE_NIC_BYPASS */
+
+	if (diag != IXGBE_SUCCESS) {
+		PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+		return -EIO;
+	}
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
+			hw->mac.num_rar_entries, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR,
+			"Failed to allocate %u bytes needed to store "
+			"MAC addresses",
+			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+		return -ENOMEM;
+	}
+	rte_bifurc_mac_addr(eth_dev, &eth_dev->data->mac_addrs[0]);

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+
+	return diag;
+}
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_ixgbe_map[] = {
+
+#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {RTE_PCI_DEVICE(vend,

dev)},

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 266

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+#define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {RTE_PCI_DEVICE(vend,

dev)},

Review

Quoted 38 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +37 -0
+#include "rte_pci_dev_ids.h"
+
+{ .vendor_id = 0, /* sentinel */ },
+};
+
+static struct eth_driver rte_ixgbe_bifurc_pmd = {
+	{
+		.name = "rte_ixgbe_bifurc_pmd",
+		.id_table = pci_id_ixgbe_map,
+		.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+			RTE_PCI_DRV_BIFURC,
+	},
+	.eth_dev_init = eth_ixgbe_bifurc_dev_init,
+	.dev_private_size = sizeof(struct ixgbe_adapter),
+};
+
+/*
+ * Driver initialization routine.
+ * Invoked once at EAL init time.
+ * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
+ */
+static int
+rte_ixgbe_bifurc_pmd_init(const char *name __rte_unused,
+			  const char *params __rte_unused)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	rte_eth_driver_register(&rte_ixgbe_bifurc_pmd);
+	return 0;
+}
+
+static struct rte_driver rte_ixgbe_bifurc_driver = {
+	.type = PMD_PDEV,
+	.init = rte_ixgbe_bifurc_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_bifurc_driver);
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 16 lines

new file mode 100644
index 0000000..d40b21d

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +11 -0
@@ -0,0 +1,57 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 22

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 26

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 27

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS

OF USE,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 28

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

ON ANY

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 30

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 13 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +13 -0
+ */
+
+#ifndef _IXGBE_BIFFURCATE_H_
+#define _IXGBE_BIFFURCATE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IXGBE_82599_MAX_RX_QUEUES 128
+
+#define RTE_PMD_PACKET_RING_SPLITOFF_LOWER_LIMIT 32
+#define RTE_PMD_PACKET_MAX_RING_PAIRS

IXGBE_82599_MAX_RX_QUEUES

Review

Quoted 14 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +13 -0
+
+
+/**
+ * For use by the EAL only. Called as part of EAL init to set up any dummy NICs
+ * configured on command line.
+ */
+int rte_ixgbe_bfc_pmd_init(const char *name, const char *params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 17 lines

index e240376..2d32907 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +6 -0
@@ -100,6 +100,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
+static inline uint16_t
+ixgbe_dev_queue_offset(struct rte_eth_dev *dev)
+{
+	return (RTE_ETH_DEV_SRIOV(dev).active == 0) ?
+		0 : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx;
+}
 
 #if 1
 #define RTE_PMD_USE_PREFETCH
@@ -1726,6 +1732,17 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 18 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -0
 			 unsigned int socket_id,
 			 const struct rte_eth_txconf *tx_conf)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+int
+ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_txconf *tx_conf)
+{
 	const struct rte_memzone *tz;
 	struct igb_tx_queue *txq;
 	struct ixgbe_hw     *hw;
@@ -1849,8 +1866,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
 	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
-	txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	txq->reg_idx  = queue_idx + offset;
 	txq->port_id = dev->data->port_id;
 	txq->txq_flags = tx_conf->txq_flags;
 	txq->ops = &def_txq_ops;
@@ -2083,6 +2099,18 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 19 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +12 -0
 			 const struct rte_eth_rxconf *rx_conf,
 			 struct rte_mempool *mp)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+int
+ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_rxconf *rx_conf,
+		    struct rte_mempool *mp)
+{
 	const struct rte_memzone *rz;
 	struct igb_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
@@ -2118,8 +2146,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

Review

Quoted 40 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -5
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 	rxq->queue_id = queue_idx;
-	rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	rxq->reg_idx  =	queue_idx + offset;
 	rxq->port_id = dev->data->port_id;
 	rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
 							0 : ETHER_CRC_LEN);
@@ -3402,9 +3429,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t fctrl;
 	uint32_t hlreg0;
 	uint32_t maxfrs;
-	uint32_t srrctl;
 	uint32_t rdrxctl;
 	uint32_t rxcsum;
+	uint32_t srrctl;
 	uint16_t buf_size;
 	uint16_t i;
 
@@ -3684,9 +3711,9 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	struct ixgbe_hw     *hw;
 	struct igb_tx_queue *txq;
 	struct igb_rx_queue *rxq;
-	uint32_t txdctl;
 	uint32_t dmatxctl;
 	uint32_t rxctrl;
+	uint32_t txdctl;
 	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
@@ -3731,7 +3758,6 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB &&
 			dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
 		ixgbe_setup_loopback_link_82599(hw);
-
 }
 
 /*
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h

Quoted 23 lines

index eb89715..aeffb5f 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +10 -1
@@ -243,6 +243,16 @@ struct ixgbe_txq_ops {
 			 IXGBE_ADVTXD_DCMD_DEXT |\
 			 IXGBE_ADVTXD_DCMD_EOP)
 
+int ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_txconf *tx_conf);
+int ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_rxconf *rx_conf,
+			struct rte_mempool *mp);
+
 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
--

1.8.1.4

#24 lore raw
In reply to Bruce Richardson

Thank you Bruce for explanation of the idea.

I have question regarding TCP SYN packets? Do you have any idea how to share the TCP SYN requests between kernel and user-space application?

Regards,

Mirek

Quoted 259 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 3:30 PM
To: Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 21 lines · Neil Horman
Quoted 20 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Quoted 5 lines
Quoted 5 lines

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow

path

Quoted 8 lines
Quoted 8 lines

control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 5 lines
Quoted 5 lines

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only

offloads

Quoted 1 line
Quoted 1 line

flow classification and distribution to NIC but also support packets

zero_copy.

Quoted 8 lines
Quoted 8 lines

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA

operation

Quoted 7 lines
Quoted 7 lines

for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space

driver

Quoted 1 line
Quoted 1 line

mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user

space.

Quoted 1 line
Quoted 1 line

The bifurcated driver PMD talks to a NIC interface using raw socket APIs

and

Quoted 1 line
Quoted 1 line

only mmap() limited I/O space (e.g. certain 4K pages) for accessing

involved

Quoted 4 lines
Quoted 4 lines

rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 5 lines
Quoted 5 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the

creation

Quoted 5 lines
Quoted 5 lines

of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go

through

Quoted 7 lines
Quoted 7 lines

mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the bifurcated

driver and

Quoted 12 lines
Quoted 12 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

Quoted 6 lines
Quoted 6 lines
  4. Run testpmd on netdev 'eth0' with 1 queue pair.
  > ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
  >  --vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
  >  -i --rxfreet=32 --txfreet=32 --txrst=32
  Note:
    iface and qpairs arguments above specify the netdev interface name

and

Quoted 7 lines
Quoted 7 lines

number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 5 lines
Quoted 5 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux

version

Quoted 2 lines
Quoted 2 lines

definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 4 lines
Quoted 4 lines

And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created

from

Quoted 7 lines
Quoted 7 lines

a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for

further

Quoted 1 line
Quoted 1 line

driver probe. It maintains the bifurcated device information include

sockfd,

Quoted 1 line
Quoted 1 line

hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access

PMD

Quoted 5 lines
Quoted 5 lines

to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the

normal

Quoted 2 lines
Quoted 2 lines

PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing

everything

Quoted 7 lines
Quoted 7 lines

from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as

sample.

Quoted 3 lines
Quoted 3 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director

capability

Quoted 7 lines
Quoted 7 lines

to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA

operation.

Quoted 4 lines
Quoted 4 lines

For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by

ethtool.

Quoted 20 lines
Quoted 20 lines

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 11 lines
Quoted 11 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 13 lines
Quoted 13 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 5 lines
Quoted 4 lines

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it?

Given

Quoted 5 lines

that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the
main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

/Bruce

#14 lore raw

Re: [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

In reply to a message not in the archive
Quoted 29 lines · Cunming
Quoted 23 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:34 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines · Cunming Liang
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303

+++++++++++++++++++++++++++++++++

Quoted 7 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 2 lines

These changes are the ones that I'm not too sure about. I'd prefer if all material for the bifurcated driver be kept within the librte_pmd_bifurc directory.

[Liang, Cunming] I haven't a librte_pmd_bifurc library.
So far the purpose of librte_bifurc is for device scan, not used as a pmd.
During driver probe, depend on device id, it asks for correct pmd from 'librte_pmd_ixgbe, librte_pmd_i40e'.

Quoted 8 lines
Quoted 4 lines

Is it possible to leave ixgbe largely unmodified and simply have the new bifurcated driver pull in the needed ixgbe (and later i40e) functions at compile time i.e. refer from one Makefile to the sources in the other driver's directory?

[Liang, Cunming] Nice point. If we have single directory gathering all direct ring access. e.g. We have aka "librte_pmd_bifurc", inside it, we'll have bifurc_ixgbe, bifurc_i40e, ... Each of them still depend on other libraries like librte_pmd_ixgbe/librte_pmd_i40e. We may remove the internal dependence inside one pmd driver, but between libraries we add more.

I'm not sure about all that. Two points:

* Why would we need separate subdirectories within the bifurcated driver directory? The *only* thing that is different between an implementation of ixgbe and i40e to use the bifurcated driver infrastructure is the code to map between NIC descriptors and rte_mbufs. All the other code would be identical as far as I can work out. So the only two routines that differ are going to be the rx_burst and tx_burst functions. So why not just pull in those two specific functions (or sets of functions) from their respective drivers, and keep the rest of the codebase common? It's surely simpler than having the ixgbe driver having to be aware of whether it's operating in bifurcated mode or uio/vfio/nic_uio mode, to check what operations are supported or not.

* It's not really an inter-library dependency - or at least not a hugely problematic one to my mind. With my proposal there is no need for the ixgbe or i40e drivers to be compiled up for the bifurcated driver to work with them. It simply makes use of the rx and tx code functions to do the mapping from descriptors to mbufs. While there will be a dependency on those functions, the nice thing is that those functions are already standardized by the ethdev API, so we don't need to worry about internal changes inside the drivers changing the APIs of those functions.

/Bruce

Quoted 581 lines
Quoted 581 lines

My thinking is that the bifurcated driver is so significantly different in the way it works, and the limits on it's functionality e.g. no direct filter support or queue management, that it's best kept completely separate and only "borrow" the needed descriptor read/write functions from the other drivers as is needed.

Just my 2c. I'm curious as to what others think.

/Bruce

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

Quoted 14 lines
lib/librte_pmd_ixgbe/Makefile +1 -1
index 3588047..6867f17 100644
@@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_ixgbe.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -Wno-cast-qual
 
 ifeq ($(CC), icc)
 #
@@ -108,10 +108,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

ixgbe_bypass.c

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c

Quoted 11 lines
lib/librte_pmd_ixgbe/Makefile +5 -0
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bifurcate.c
+endif
+endif
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal

lib/librte_ether

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 119

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool

lib/librte_mbuf

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 120

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net

lib/librte_malloc

Review

Quoted 9 lines
lib/librte_pmd_ixgbe/Makefile +6 -0
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_bifurc
+endif
+endif
+
 
 include $(RTE_SDK)/mk/rte.lib.mk
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 16 lines

new file mode 100644
index 0000000..84c445a

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +11 -0
@@ -0,0 +1,303 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 22

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 26

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 27

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS

OF USE,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 28

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

ON ANY

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 30

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 224 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +224 -0
+ */
+
+#include <rte_eal.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+#include <rte_ethdev.h>
+#include <rte_kvargs.h>
+#include <rte_bifurc.h>
+
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <poll.h>
+#include <errno.h>
+
+#include "ixgbe_logs.h"
+#include "ixgbe_ethdev.h"
+#include "ixgbe/ixgbe_api.h"
+
+#include <rte_mbuf.h>
+#include <rte_bifurc.h>
+#include "ixgbe_rxtx.h"
+
+static int
+ixgbe_dev_bfc_configure(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+static void
+ixgbe_dev_bfc_info(struct rte_eth_dev *dev,
+		   struct rte_eth_dev_info *dev_info)
+{
+	rte_bifurc_ethdev_get_info(dev, dev_info);
+}
+
+static void
+ixgbe_dev_bfc_stats_get(__rte_unused struct rte_eth_dev *dev,
+			__rte_unused struct rte_eth_stats *igb_stats)
+{
+	return;
+}
+
+static int
+ixgbe_dev_bfc_start(struct rte_eth_dev *dev)
+{
+	int err;
+
+	/* initialize transmission unit */
+	ixgbe_dev_tx_init(dev);
+
+	/* This can fail when allocating mbufs for descriptor rings */
+	err = ixgbe_dev_rx_init(dev);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to initialize RX hardware\n");
+		goto error;
+	}
+
+	ixgbe_dev_rxtx_start(dev);
+
+	return 0;
+
+error:
+	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+	ixgbe_dev_clear_queues(dev);
+	return -EIO;
+}
+
+static void
+ixgbe_dev_bfc_stop(struct rte_eth_dev *dev)
+{
+	unsigned i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++)
+		ixgbe_dev_tx_queue_stop(dev, i);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		ixgbe_dev_rx_queue_stop(dev, i);
+}
+
+static void
+ixgbe_dev_bfc_close(struct rte_eth_dev *dev)
+{
+	ixgbe_dev_bfc_stop(dev);
+
+	rte_bifurc_ethdev_free(dev);
+}
+
+static inline int
+rte_ixgbe_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = &(dev->data->dev_link);
+	struct rte_eth_link *src = link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_link_update(__rte_unused struct rte_eth_dev *dev,
+			  __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link link;
+
+	link.link_status = 1;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_LINK_SPEED_10000;
+
+	rte_ixgbe_dev_atomic_write_link_status(dev, &link);
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_rx_queue_setup(struct rte_eth_dev *dev,
+			 uint16_t queue_idx,
+			 uint16_t nb_desc,
+			 unsigned int socket_id,
+			 const struct rte_eth_rxconf *rx_conf,
+			 struct rte_mempool *mp)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+static int
+ixgbe_dev_bfc_tx_queue_setup(struct rte_eth_dev *dev,
+			     uint16_t queue_idx,
+			     uint16_t nb_desc,
+			     unsigned int socket_id,
+			     const struct rte_eth_txconf *tx_conf)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+static struct eth_dev_ops ixgbe_bifurc_ops = {
+	.dev_start = ixgbe_dev_bfc_start,
+	.dev_stop = ixgbe_dev_bfc_stop,
+	.dev_close = ixgbe_dev_bfc_close,
+	.dev_configure = ixgbe_dev_bfc_configure,
+	.dev_infos_get = ixgbe_dev_bfc_info,
+	.rx_queue_setup = ixgbe_dev_bfc_rx_queue_setup,
+	.tx_queue_setup = ixgbe_dev_bfc_tx_queue_setup,
+	.rx_queue_release = ixgbe_dev_rx_queue_release,
+	.tx_queue_release = ixgbe_dev_tx_queue_release,
+	.link_update = ixgbe_dev_bfc_link_update,
+	.stats_get = ixgbe_dev_bfc_stats_get,
+	.stats_reset = NULL,
+};
+
+static int
+eth_ixgbe_bifurc_dev_init(struct eth_driver *eth_drv __rte_unused,
+			  struct rte_eth_dev *eth_dev)
+{
+	struct rte_pci_device *pci_dev;
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	int diag;
+
+	PMD_INIT_FUNC_TRACE();
+
+	eth_dev->dev_ops = &ixgbe_bifurc_ops;
+	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;
+
+	/* for secondary processes, we don't initialise any further as primary
+	 * has already done this work. Only check we don't need a different
+	 * RX function */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		if (eth_dev->data->scattered_rx)
+			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		return 0;
+	}
+	pci_dev = eth_dev->pci_dev;
+
+	/* Vendor and Device ID need to be set before init of shared code */
+	hw->device_id = pci_dev->id.device_id;
+	hw->vendor_id = pci_dev->id.vendor_id;
+	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+
+#ifdef RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP
+	hw->allow_unsupported_sfp = 1;
+#endif
+
+	/* Initialize the shared code (base driver) */
+#ifdef RTE_NIC_BYPASS
+	diag = ixgbe_bypass_init_shared_code(hw);
+#else
+	diag = ixgbe_init_shared_code(hw);
+#endif /* RTE_NIC_BYPASS */
+
+	if (diag != IXGBE_SUCCESS) {
+		PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+		return -EIO;
+	}
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
+			hw->mac.num_rar_entries, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR,
+			"Failed to allocate %u bytes needed to store "
+			"MAC addresses",
+			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+		return -ENOMEM;
+	}
+	rte_bifurc_mac_addr(eth_dev, &eth_dev->data->mac_addrs[0]);

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+
+	return diag;
+}
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_ixgbe_map[] = {
+
+#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {RTE_PCI_DEVICE(vend,

dev)},

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 266

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+#define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {RTE_PCI_DEVICE(vend,

dev)},

Review

Quoted 38 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +37 -0
+#include "rte_pci_dev_ids.h"
+
+{ .vendor_id = 0, /* sentinel */ },
+};
+
+static struct eth_driver rte_ixgbe_bifurc_pmd = {
+	{
+		.name = "rte_ixgbe_bifurc_pmd",
+		.id_table = pci_id_ixgbe_map,
+		.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+			RTE_PCI_DRV_BIFURC,
+	},
+	.eth_dev_init = eth_ixgbe_bifurc_dev_init,
+	.dev_private_size = sizeof(struct ixgbe_adapter),
+};
+
+/*
+ * Driver initialization routine.
+ * Invoked once at EAL init time.
+ * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
+ */
+static int
+rte_ixgbe_bifurc_pmd_init(const char *name __rte_unused,
+			  const char *params __rte_unused)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	rte_eth_driver_register(&rte_ixgbe_bifurc_pmd);
+	return 0;
+}
+
+static struct rte_driver rte_ixgbe_bifurc_driver = {
+	.type = PMD_PDEV,
+	.init = rte_ixgbe_bifurc_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_bifurc_driver);
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 16 lines

new file mode 100644
index 0000000..d40b21d

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +11 -0
@@ -0,0 +1,57 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 22

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 26

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 27

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS

OF USE,

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 28

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND

ON ANY

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 30

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 13 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +13 -0
+ */
+
+#ifndef _IXGBE_BIFFURCATE_H_
+#define _IXGBE_BIFFURCATE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IXGBE_82599_MAX_RX_QUEUES 128
+
+#define RTE_PMD_PACKET_RING_SPLITOFF_LOWER_LIMIT 32
+#define RTE_PMD_PACKET_MAX_RING_PAIRS

IXGBE_82599_MAX_RX_QUEUES

Review

Quoted 14 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +13 -0
+
+
+/**
+ * For use by the EAL only. Called as part of EAL init to set up any dummy NICs
+ * configured on command line.
+ */
+int rte_ixgbe_bfc_pmd_init(const char *name, const char *params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 17 lines

index e240376..2d32907 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +6 -0
@@ -100,6 +100,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
+static inline uint16_t
+ixgbe_dev_queue_offset(struct rte_eth_dev *dev)
+{
+	return (RTE_ETH_DEV_SRIOV(dev).active == 0) ?
+		0 : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx;
+}
 
 #if 1
 #define RTE_PMD_USE_PREFETCH
@@ -1726,6 +1732,17 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 18 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -0
 			 unsigned int socket_id,
 			 const struct rte_eth_txconf *tx_conf)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+int
+ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_txconf *tx_conf)
+{
 	const struct rte_memzone *tz;
 	struct igb_tx_queue *txq;
 	struct ixgbe_hw     *hw;
@@ -1849,8 +1866,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -2
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
 	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
-	txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	txq->reg_idx  = queue_idx + offset;
 	txq->port_id = dev->data->port_id;
 	txq->txq_flags = tx_conf->txq_flags;
 	txq->ops = &def_txq_ops;
@@ -2083,6 +2099,18 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 19 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +12 -0
 			 const struct rte_eth_rxconf *rx_conf,
 			 struct rte_mempool *mp)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+int
+ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_rxconf *rx_conf,
+		    struct rte_mempool *mp)
+{
 	const struct rte_memzone *rz;
 	struct igb_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
@@ -2118,8 +2146,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

Review

Quoted 40 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -5
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 	rxq->queue_id = queue_idx;
-	rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
+	rxq->reg_idx  =	queue_idx + offset;
 	rxq->port_id = dev->data->port_id;
 	rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
 							0 : ETHER_CRC_LEN);
@@ -3402,9 +3429,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t fctrl;
 	uint32_t hlreg0;
 	uint32_t maxfrs;
-	uint32_t srrctl;
 	uint32_t rdrxctl;
 	uint32_t rxcsum;
+	uint32_t srrctl;
 	uint16_t buf_size;
 	uint16_t i;
 
@@ -3684,9 +3711,9 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	struct ixgbe_hw     *hw;
 	struct igb_tx_queue *txq;
 	struct igb_rx_queue *rxq;
-	uint32_t txdctl;
 	uint32_t dmatxctl;
 	uint32_t rxctrl;
+	uint32_t txdctl;
 	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
@@ -3731,7 +3758,6 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB &&
 			dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
 		ixgbe_setup_loopback_link_82599(hw);
-
 }
 
 /*
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h

Quoted 23 lines

index eb89715..aeffb5f 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +10 -1
@@ -243,6 +243,16 @@ struct ixgbe_txq_ops {
 			 IXGBE_ADVTXD_DCMD_DEXT |\
 			 IXGBE_ADVTXD_DCMD_EOP)
 
+int ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_txconf *tx_conf);
+int ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_rxconf *rx_conf,
+			struct rte_mempool *mp);
+
 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
--

1.8.1.4

#26 lore raw
In reply to a message not in the archive
Quoted 1 line · Miroslaw

Thank you Bruce for explanation of the idea.

Actually, credit goes to Steve Liang, not me, for the explanation. :-)

Quoted 2 lines

I have question regarding TCP SYN packets? Do you have any idea how to share the TCP SYN requests between kernel and user-space application?

As I'm giving the credit to Steve, I'll also pass the buck for answering that question to him too! :-)

/Bruce

Quoted 264 lines

Regards,

Mirek

Quoted 259 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 3:30 PM
To: Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 21 lines · Neil Horman
Quoted 20 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Quoted 5 lines
Quoted 5 lines

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow

path

Quoted 8 lines
Quoted 8 lines

control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 5 lines
Quoted 5 lines

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only

offloads

Quoted 1 line
Quoted 1 line

flow classification and distribution to NIC but also support packets

zero_copy.

Quoted 8 lines
Quoted 8 lines

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA

operation

Quoted 7 lines
Quoted 7 lines

for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space

driver

Quoted 1 line
Quoted 1 line

mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user

space.

Quoted 1 line
Quoted 1 line

The bifurcated driver PMD talks to a NIC interface using raw socket APIs

and

Quoted 1 line
Quoted 1 line

only mmap() limited I/O space (e.g. certain 4K pages) for accessing

involved

Quoted 4 lines
Quoted 4 lines

rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 5 lines
Quoted 5 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the

creation

Quoted 5 lines
Quoted 5 lines

of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go

through

Quoted 7 lines
Quoted 7 lines

mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the bifurcated

driver and

Quoted 12 lines
Quoted 12 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

Quoted 6 lines
Quoted 6 lines
  4. Run testpmd on netdev 'eth0' with 1 queue pair.
  > ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
  >  --vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
  >  -i --rxfreet=32 --txfreet=32 --txrst=32
  Note:
    iface and qpairs arguments above specify the netdev interface name

and

Quoted 7 lines
Quoted 7 lines

number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 5 lines
Quoted 5 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux

version

Quoted 2 lines
Quoted 2 lines

definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 4 lines
Quoted 4 lines

And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created

from

Quoted 7 lines
Quoted 7 lines

a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for

further

Quoted 1 line
Quoted 1 line

driver probe. It maintains the bifurcated device information include

sockfd,

Quoted 1 line
Quoted 1 line

hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access

PMD

Quoted 5 lines
Quoted 5 lines

to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the

normal

Quoted 2 lines
Quoted 2 lines

PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing

everything

Quoted 7 lines
Quoted 7 lines

from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as

sample.

Quoted 3 lines
Quoted 3 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director

capability

Quoted 7 lines
Quoted 7 lines

to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA

operation.

Quoted 4 lines
Quoted 4 lines

For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by

ethtool.

Quoted 20 lines
Quoted 20 lines

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 11 lines
Quoted 11 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 13 lines
Quoted 13 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 5 lines
Quoted 4 lines

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it?

Given

Quoted 5 lines

that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the
main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

/Bruce

#27 lore raw
Quoted 15 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 11:03 PM
To: Walukiewicz, Miroslaw
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 1 line · Miroslaw

Thank you Bruce for explanation of the idea.

Actually, credit goes to Steve Liang, not me, for the explanation. :-)

Quoted 1 line
Quoted 7 lines
Quoted 1 line

I have question regarding TCP SYN packets? Do you have any idea how to share the TCP SYN requests between kernel and

user-space application?

As I'm giving the credit to Steve, I'll also pass the buck for answering that question to him too! :-)

/Bruce

On ixgbe' Rx queuing flow, match SYN filter stage is prior to Flow Director filter stage. When working at bifurcated driver support mode, DPDK cannot access those NIC registers except for the ones that are used to rx/tx packets for assigned rx/tx queue pairs. So basically it really depends on user to use ethtool or other interface to setup SYN filter via ixgbe bifurcated driver. User can distribute TCP SYN packets to kernel bifurcated driver owned rx queues or DPDK owned rx queues, for the latter case, DPDK can still push them back to kernel via KNI if DPDK does not want to use them. If you have a user space TCP/IP stacks on top of DPDK, you can push them to the upper level stack rather instead.

Quoted 264 lines
Quoted 264 lines

Regards,

Mirek

Quoted 259 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 3:30 PM
To: Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 21 lines · Neil Horman
Quoted 20 lines · Cunming Liang

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Quoted 5 lines
Quoted 5 lines

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow

path

Quoted 8 lines
Quoted 8 lines

control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 5 lines
Quoted 5 lines

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only

offloads

Quoted 1 line
Quoted 1 line

flow classification and distribution to NIC but also support packets

zero_copy.

Quoted 8 lines
Quoted 8 lines

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA

operation

Quoted 7 lines
Quoted 7 lines

for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space

driver

Quoted 1 line
Quoted 1 line

mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user

space.

Quoted 1 line
Quoted 1 line

The bifurcated driver PMD talks to a NIC interface using raw socket APIs

and

Quoted 1 line
Quoted 1 line

only mmap() limited I/O space (e.g. certain 4K pages) for accessing

involved

Quoted 4 lines
Quoted 4 lines

rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 5 lines
Quoted 5 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the

creation

Quoted 5 lines
Quoted 5 lines

of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go

through

Quoted 7 lines
Quoted 7 lines

mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the bifurcated

driver and

Quoted 12 lines
Quoted 12 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

Quoted 6 lines
Quoted 6 lines
  4. Run testpmd on netdev 'eth0' with 1 queue pair.
  > ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
  >  --vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
  >  -i --rxfreet=32 --txfreet=32 --txrst=32
  Note:
    iface and qpairs arguments above specify the netdev interface name

and

Quoted 7 lines
Quoted 7 lines

number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 5 lines
Quoted 5 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux

version

Quoted 2 lines
Quoted 2 lines

definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 4 lines
Quoted 4 lines

And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created

from

Quoted 7 lines
Quoted 7 lines

a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for

further

Quoted 1 line
Quoted 1 line

driver probe. It maintains the bifurcated device information include

sockfd,

Quoted 1 line
Quoted 1 line

hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access

PMD

Quoted 5 lines
Quoted 5 lines

to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the

normal

Quoted 2 lines
Quoted 2 lines

PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing

everything

Quoted 7 lines
Quoted 7 lines

from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as

sample.

Quoted 3 lines
Quoted 3 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director

capability

Quoted 7 lines
Quoted 7 lines

to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA

operation.

Quoted 4 lines
Quoted 4 lines

For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by

ethtool.

Quoted 20 lines
Quoted 20 lines

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 11 lines
Quoted 11 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 13 lines
Quoted 13 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 5 lines
Quoted 4 lines

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it?

Given

Quoted 5 lines

that, I don't think its wise to pull this in yet ahead of the kernel work, as there may still be kernel side changes that the user space pmd will have to adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part hits the
main kernel tree we can at least discuss the overall direction to be taken for this driver because it's significantly different that any other HW driver.

/Bruce

#15 lore raw

Re: [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

In reply to Bruce Richardson

Thanks Bruce's valuable comments.

Quoted 55 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 11:01 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

Quoted 8 lines · Cunming
Quoted 8 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:34 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net

device

Quoted 15 lines
Quoted 15 lines · Cunming Liang
Quoted 4 lines
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303

+++++++++++++++++++++++++++++++++

Quoted 7 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 2 lines
Quoted 2 lines

These changes are the ones that I'm not too sure about. I'd prefer if all material for the bifurcated driver be kept within the librte_pmd_bifurc

directory.

Quoted 3 lines

[Liang, Cunming] I haven't a librte_pmd_bifurc library.
So far the purpose of librte_bifurc is for device scan, not used as a pmd. During driver probe, depend on device id, it asks for correct pmd from

'librte_pmd_ixgbe, librte_pmd_i40e'.

Quoted 6 lines
Quoted 5 lines

Is it possible to leave ixgbe largely unmodified and simply have the new bifurcated driver pull in the needed ixgbe (and later i40e) functions at compile time i.e. refer from one Makefile to the sources in the other driver's directory?

[Liang, Cunming] Nice point. If we have single directory gathering all direct ring

access.

Quoted 1 line

e.g. We have aka "librte_pmd_bifurc", inside it, we'll have bifurc_ixgbe,

bifurc_i40e, ...

Quoted 1 line

Each of them still depend on other libraries like

librte_pmd_ixgbe/librte_pmd_i40e.

Quoted 1 line

We may remove the internal dependence inside one pmd driver, but between

libraries we add more.

I'm not sure about all that. Two points:

Quoted 9 lines

* Why would we need separate subdirectories within the bifurcated driver directory?
The *only* thing that is different between an implementation of ixgbe and i40e to
use the bifurcated driver infrastructure is the code to map between NIC descriptors
and rte_mbufs. All the other code would be identical as far as I can work out. So the
only two routines that differ are going to be the rx_burst and tx_burst functions.

[Liang, Cunming] Not really. If not using the fake page, we need to provide init/start/stop case by case.

Quoted 2 lines

So why not just pull in those two specific functions (or sets of functions) from their respective drivers, and keep the rest of the codebase common?

[Liang, Cunming] I'm not sure all the rest of codebase can be common.
For rx/tx or queue_setup, we know it can, we already do it in xxx_rxtx.c. For other ops, may not. Even for the part we can, if we provide such common method template, it looks like we still need to register 'ops'. (e.g. xxx_init_shared_code, xxx_dev_tx/rx_init, xxx_dev_rxtx_start) They're not part of eth_dev_ops. If we consider more like enable all other DPDK ethdev API (by using ioctl like ethtools does). These message wrap and translation are definitely the case to put into such common codes.

So I agree with the idea to put more common method into librte_bifurc. But don't think it's good to make it as a common PMD driver.
I still prefer ixgbe_bifurc.c in librte_pmd_ixgbe as an independent driver. Per codebase common, rxtx common stuffs already done in xxx_rxtx.c. Other common method provides by librte_bifurc, be used by each specific PMD.

Quoted 4 lines

simpler than having the ixgbe driver having to be aware of whether it's operating in bifurcated mode or uio/vfio/nic_uio mode, to check what operations are supported
or not.

[Liang, Cunming] If you go through the codes. You'll find it's not ixgbe driver to aware of these modes. We already have ixgbe driver and ixgbevf driver, now have ixgbe_bifurc driver, that's it. BTW ideally, it's better for ixgbe and ixgbevf in self-contain .c files, now all are in ixgbe_ethdev.c Ixgbe_bifurc has weaker NIC control than ixgbevf, both are mainly focus on rx and tx. Ixgbe has full HW control, ixgbevf has limited HW control, ixgbe_bifurc no HW control. All of them has the same capability to do rx and tx.
On this point of view, it makes sense to have such standalone driver.

Quoted 11 lines

* It's not really an inter-library dependency - or at least not a hugely problematic one to my mind. With my proposal there is no need for the ixgbe or i40e drivers to
be compiled up for the bifurcated driver to work with them. It simply makes use of the rx and tx code functions to do the mapping from descriptors to mbufs. While
there will be a dependency on those functions, the nice thing is that those functions
are already standardized by the ethdev API, so we don't need to worry about internal changes inside the drivers changing the APIs of those functions.

[Liang, Cunming] I think I haven't fully got your point.
Do you propose we don't need the specific PMD bifurc, instead to provide a driver directly on top of all other PMD ? We expose more low level function to ethdev API as needed.
In this way, there's a risk that we assume kernel always guarantee the illegal register access only goes into the fake pages. If not, such register access by normal PMD is un-expectable.

Quoted 602 lines

/Bruce

Quoted 4 lines
Quoted 4 lines

My thinking is that the bifurcated driver is so significantly different in the way it works, and the limits on it's functionality e.g. no direct filter support or queue management, that it's best kept completely separate and

only

Quoted 1 line
Quoted 1 line

"borrow" the needed descriptor read/write functions from the other drivers

as is

Quoted 75 lines
Quoted 75 lines

needed.

Just my 2c. I'm curious as to what others think.

/Bruce

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

Quoted 14 lines
lib/librte_pmd_ixgbe/Makefile +1 -1
index 3588047..6867f17 100644
@@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_ixgbe.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -Wno-cast-qual
 
 ifeq ($(CC), icc)
 #
@@ -108,10 +108,21 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) +=

ixgbe_bypass.c

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bypass.c

Quoted 11 lines
lib/librte_pmd_ixgbe/Makefile +5 -0
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_bifurcate.c
+endif
+endif
 
 # this lib depends upon:
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal

lib/librte_ether

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 119

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool

lib/librte_mbuf

lib/librte_pmd_ixgbe/Makefile SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += · line 120

Quoted 1 line
lib/librte_pmd_ixgbe/Makefile +0 -0
 DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net

lib/librte_malloc

Review

Quoted 9 lines
lib/librte_pmd_ixgbe/Makefile +6 -0
+ifeq ($(CONFIG_RTE_LIBRTE_BIFURC),y)
+ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
+DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_bifurc
+endif
+endif
+
 
 include $(RTE_SDK)/mk/rte.lib.mk
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 16 lines

new file mode 100644
index 0000000..84c445a

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +11 -0
@@ -0,0 +1,303 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
Quoted 8 lines
Quoted 8 lines

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,

BUT

Quoted 2 lines
Quoted 2 lines

NOT

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;

LOSS

Quoted 2 lines
Quoted 2 lines

OF USE,

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED

AND

Quoted 2 lines
Quoted 2 lines

ON ANY

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR

TORT

Quoted 1 line
Quoted 1 line

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 30

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

OF

Quoted 238 lines
Quoted 238 lines

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 224 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +224 -0
+ */
+
+#include <rte_eal.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+#include <rte_dev.h>
+#include <rte_pci.h>
+#include <rte_ethdev.h>
+#include <rte_kvargs.h>
+#include <rte_bifurc.h>
+
+#include <linux/if_ether.h>
+#include <linux/if_packet.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <poll.h>
+#include <errno.h>
+
+#include "ixgbe_logs.h"
+#include "ixgbe_ethdev.h"
+#include "ixgbe/ixgbe_api.h"
+
+#include <rte_mbuf.h>
+#include <rte_bifurc.h>
+#include "ixgbe_rxtx.h"
+
+static int
+ixgbe_dev_bfc_configure(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+static void
+ixgbe_dev_bfc_info(struct rte_eth_dev *dev,
+		   struct rte_eth_dev_info *dev_info)
+{
+	rte_bifurc_ethdev_get_info(dev, dev_info);
+}
+
+static void
+ixgbe_dev_bfc_stats_get(__rte_unused struct rte_eth_dev *dev,
+			__rte_unused struct rte_eth_stats *igb_stats)
+{
+	return;
+}
+
+static int
+ixgbe_dev_bfc_start(struct rte_eth_dev *dev)
+{
+	int err;
+
+	/* initialize transmission unit */
+	ixgbe_dev_tx_init(dev);
+
+	/* This can fail when allocating mbufs for descriptor rings */
+	err = ixgbe_dev_rx_init(dev);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to initialize RX hardware\n");
+		goto error;
+	}
+
+	ixgbe_dev_rxtx_start(dev);
+
+	return 0;
+
+error:
+	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+	ixgbe_dev_clear_queues(dev);
+	return -EIO;
+}
+
+static void
+ixgbe_dev_bfc_stop(struct rte_eth_dev *dev)
+{
+	unsigned i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++)
+		ixgbe_dev_tx_queue_stop(dev, i);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		ixgbe_dev_rx_queue_stop(dev, i);
+}
+
+static void
+ixgbe_dev_bfc_close(struct rte_eth_dev *dev)
+{
+	ixgbe_dev_bfc_stop(dev);
+
+	rte_bifurc_ethdev_free(dev);
+}
+
+static inline int
+rte_ixgbe_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = &(dev->data->dev_link);
+	struct rte_eth_link *src = link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_link_update(__rte_unused struct rte_eth_dev *dev,
+			  __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link link;
+
+	link.link_status = 1;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = ETH_LINK_SPEED_10000;
+
+	rte_ixgbe_dev_atomic_write_link_status(dev, &link);
+
+	return 0;
+}
+
+static int
+ixgbe_dev_bfc_rx_queue_setup(struct rte_eth_dev *dev,
+			 uint16_t queue_idx,
+			 uint16_t nb_desc,
+			 unsigned int socket_id,
+			 const struct rte_eth_rxconf *rx_conf,
+			 struct rte_mempool *mp)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+static int
+ixgbe_dev_bfc_tx_queue_setup(struct rte_eth_dev *dev,
+			     uint16_t queue_idx,
+			     uint16_t nb_desc,
+			     unsigned int socket_id,
+			     const struct rte_eth_txconf *tx_conf)
+{
+	uint16_t offset = rte_bifurc_qp_base(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+static struct eth_dev_ops ixgbe_bifurc_ops = {
+	.dev_start = ixgbe_dev_bfc_start,
+	.dev_stop = ixgbe_dev_bfc_stop,
+	.dev_close = ixgbe_dev_bfc_close,
+	.dev_configure = ixgbe_dev_bfc_configure,
+	.dev_infos_get = ixgbe_dev_bfc_info,
+	.rx_queue_setup = ixgbe_dev_bfc_rx_queue_setup,
+	.tx_queue_setup = ixgbe_dev_bfc_tx_queue_setup,
+	.rx_queue_release = ixgbe_dev_rx_queue_release,
+	.tx_queue_release = ixgbe_dev_tx_queue_release,
+	.link_update = ixgbe_dev_bfc_link_update,
+	.stats_get = ixgbe_dev_bfc_stats_get,
+	.stats_reset = NULL,
+};
+
+static int
+eth_ixgbe_bifurc_dev_init(struct eth_driver *eth_drv __rte_unused,
+			  struct rte_eth_dev *eth_dev)
+{
+	struct rte_pci_device *pci_dev;
+	struct ixgbe_hw *hw =
+		IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	int diag;
+
+	PMD_INIT_FUNC_TRACE();
+
+	eth_dev->dev_ops = &ixgbe_bifurc_ops;
+	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
+	eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts;
+
+	/* for secondary processes, we don't initialise any further as primary
+	 * has already done this work. Only check we don't need a different
+	 * RX function */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		if (eth_dev->data->scattered_rx)
+			eth_dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
+		return 0;
+	}
+	pci_dev = eth_dev->pci_dev;
+
+	/* Vendor and Device ID need to be set before init of shared code */
+	hw->device_id = pci_dev->id.device_id;
+	hw->vendor_id = pci_dev->id.vendor_id;
+	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+
+#ifdef RTE_LIBRTE_IXGBE_ALLOW_UNSUPPORTED_SFP
+	hw->allow_unsupported_sfp = 1;
+#endif
+
+	/* Initialize the shared code (base driver) */
+#ifdef RTE_NIC_BYPASS
+	diag = ixgbe_bypass_init_shared_code(hw);
+#else
+	diag = ixgbe_init_shared_code(hw);
+#endif /* RTE_NIC_BYPASS */
+
+	if (diag != IXGBE_SUCCESS) {
+		PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+		return -EIO;
+	}
+
+	/* Allocate memory for storing MAC addresses */
+	eth_dev->data->mac_addrs = rte_zmalloc("ixgbe", ETHER_ADDR_LEN *
+			hw->mac.num_rar_entries, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR,
+			"Failed to allocate %u bytes needed to store "
+			"MAC addresses",
+			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
+		return -ENOMEM;
+	}
+	rte_bifurc_mac_addr(eth_dev, &eth_dev->data->mac_addrs[0]);

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +10 -0
+
+	return diag;
+}
+
+/*
+ * The set of PCI devices this driver supports
+ */
+static struct rte_pci_id pci_id_ixgbe_map[] = {
+
+#define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {RTE_PCI_DEVICE(vend,

dev)},

Quoted 1 line
Quoted 1 line

lib/librte_pmd_ixgbe/ixgbe_bifurcate.c line 266

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +1 -0
+#define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev)

{RTE_PCI_DEVICE(vend,

Quoted 68 lines
Quoted 68 lines

dev)},

Review

Quoted 38 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.c new file +37 -0
+#include "rte_pci_dev_ids.h"
+
+{ .vendor_id = 0, /* sentinel */ },
+};
+
+static struct eth_driver rte_ixgbe_bifurc_pmd = {
+	{
+		.name = "rte_ixgbe_bifurc_pmd",
+		.id_table = pci_id_ixgbe_map,
+		.drv_flags = RTE_PCI_DRV_NEED_MAPPING |
+			RTE_PCI_DRV_BIFURC,
+	},
+	.eth_dev_init = eth_ixgbe_bifurc_dev_init,
+	.dev_private_size = sizeof(struct ixgbe_adapter),
+};
+
+/*
+ * Driver initialization routine.
+ * Invoked once at EAL init time.
+ * Register itself as the [Poll Mode] Driver of PCI IXGBE devices.
+ */
+static int
+rte_ixgbe_bifurc_pmd_init(const char *name __rte_unused,
+			  const char *params __rte_unused)
+{
+	PMD_INIT_FUNC_TRACE();
+
+	rte_eth_driver_register(&rte_ixgbe_bifurc_pmd);
+	return 0;
+}
+
+static struct rte_driver rte_ixgbe_bifurc_driver = {
+	.type = PMD_PDEV,
+	.init = rte_ixgbe_bifurc_pmd_init,
+};
+
+PMD_REGISTER_DRIVER(rte_ixgbe_bifurc_driver);
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 16 lines

new file mode 100644
index 0000000..d40b21d

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +11 -0
@@ -0,0 +1,57 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 21

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +10 -0
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND

CONTRIBUTORS

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
Quoted 8 lines
Quoted 8 lines

NOT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 23

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND

FITNESS FOR

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 24

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 25

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,

BUT

Quoted 2 lines
Quoted 2 lines

NOT

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;

LOSS

Quoted 2 lines
Quoted 2 lines

OF USE,

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED

AND

Quoted 2 lines
Quoted 2 lines

ON ANY

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR

TORT

Quoted 1 line
Quoted 1 line

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 30

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT

OF

Quoted 17 lines
Quoted 17 lines

THE USE

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h line 31

Quoted 1 line
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 13 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +13 -0
+ */
+
+#ifndef _IXGBE_BIFFURCATE_H_
+#define _IXGBE_BIFFURCATE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define IXGBE_82599_MAX_RX_QUEUES 128
+
+#define RTE_PMD_PACKET_RING_SPLITOFF_LOWER_LIMIT 32
+#define RTE_PMD_PACKET_MAX_RING_PAIRS

IXGBE_82599_MAX_RX_QUEUES

Quoted 4 lines
Quoted 4 lines

lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +4 -0
+
+
+/**
+ * For use by the EAL only. Called as part of EAL init to set up any dummy

NICs

Quoted 48 lines
Quoted 48 lines

Review

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_bifurcate.h new file +9 -0
+ * configured on command line.
+ */
+int rte_ixgbe_bfc_pmd_init(const char *name, const char *params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 17 lines

index e240376..2d32907 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +6 -0
@@ -100,6 +100,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
 	return (m);
 }
 
+static inline uint16_t
+ixgbe_dev_queue_offset(struct rte_eth_dev *dev)
+{
+	return (RTE_ETH_DEV_SRIOV(dev).active == 0) ?
+		0 : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx;
+}
 
 #if 1
 #define RTE_PMD_USE_PREFETCH
@@ -1726,6 +1732,17 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev

Quoted 18 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +11 -0
 			 unsigned int socket_id,
 			 const struct rte_eth_txconf *tx_conf)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_txq_setup(dev, queue_idx, offset,
+				   nb_desc, socket_id, tx_conf);
+}
+
+int
+ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_txconf *tx_conf)
+{
 	const struct rte_memzone *tz;
 	struct igb_tx_queue *txq;
 	struct ixgbe_hw     *hw;
@@ -1849,8 +1866,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev

*dev,

Quoted 5 lines
Quoted 5 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,

Quoted 5 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -2
 	txq->hthresh = tx_conf->tx_thresh.hthresh;
 	txq->wthresh = tx_conf->tx_thresh.wthresh;
 	txq->queue_id = queue_idx;
-	txq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx +

queue_idx);

Quoted 26 lines
Quoted 26 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 5 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -0
+	txq->reg_idx  = queue_idx + offset;
 	txq->port_id = dev->data->port_id;
 	txq->txq_flags = tx_conf->txq_flags;
 	txq->ops = &def_txq_ops;
@@ -2083,6 +2099,18 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev

Quoted 19 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +12 -0
 			 const struct rte_eth_rxconf *rx_conf,
 			 struct rte_mempool *mp)
 {
+	uint16_t offset = ixgbe_dev_queue_offset(dev);
+	return ixgbe_dev_rxq_setup(dev, queue_idx, offset, nb_desc,
+				   socket_id, rx_conf, mp);
+}
+
+int
+ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+		    uint16_t queue_idx, uint16_t offset,
+		    uint16_t nb_desc, unsigned int socket_id,
+		    const struct rte_eth_rxconf *rx_conf,
+		    struct rte_mempool *mp)
+{
 	const struct rte_memzone *rz;
 	struct igb_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
@@ -2118,8 +2146,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev

*dev,

Quoted 5 lines
Quoted 5 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,

Quoted 5 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -2
 	rxq->nb_rx_desc = nb_desc;
 	rxq->rx_free_thresh = rx_conf->rx_free_thresh;
 	rxq->queue_id = queue_idx;
-	rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
-		queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx +

queue_idx);

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -2
+	rxq->reg_idx  =	queue_idx + offset;
 	rxq->port_id = dev->data->port_id;
 	rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ?
 							0 : ETHER_CRC_LEN);
@@ -3402,9 +3429,9 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 	uint32_t fctrl;
 	uint32_t hlreg0;
 	uint32_t maxfrs;
-	uint32_t srrctl;
 	uint32_t rdrxctl;
 	uint32_t rxcsum;
+	uint32_t srrctl;
 	uint16_t buf_size;
 	uint16_t i;
 
@@ -3684,9 +3711,9 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	struct ixgbe_hw     *hw;
 	struct igb_tx_queue *txq;
 	struct igb_rx_queue *rxq;
-	uint32_t txdctl;
 	uint32_t dmatxctl;
 	uint32_t rxctrl;
+	uint32_t txdctl;
 	uint16_t i;
 
Quoted 4 lines
Quoted 4 lines

lib/librte_pmd_ixgbe/ixgbe_rxtx.c ixgbe_dev_rxtx_start(struct rte_eth_dev *dev) · line 3759

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0
 	PMD_INIT_FUNC_TRACE();
@@ -3731,7 +3758,6 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
 	if (hw->mac.type == ixgbe_mac_82599EB &&
 			dev->data->dev_conf.lpbk_mode ==

IXGBE_LPBK_82599_TX_RX)

Quoted 30 lines
Quoted 30 lines

Review

Quoted 6 lines
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -1
 		ixgbe_setup_loopback_link_82599(hw);
-
 }
 
 /*
(quoted diff) +0 -0

b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h

Quoted 23 lines

index eb89715..aeffb5f 100644

lib/librte_pmd_ixgbe/ixgbe_rxtx.h +10 -1
@@ -243,6 +243,16 @@ struct ixgbe_txq_ops {
 			 IXGBE_ADVTXD_DCMD_DEXT |\
 			 IXGBE_ADVTXD_DCMD_EOP)
 
+int ixgbe_dev_txq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_txconf *tx_conf);
+int ixgbe_dev_rxq_setup(struct rte_eth_dev *dev,
+			uint16_t queue_idx, uint16_t offset,
+			uint16_t nb_desc, unsigned int socket_id,
+			const struct rte_eth_rxconf *rx_conf,
+			struct rte_mempool *mp);
+
 #ifdef RTE_IXGBE_INC_VECTOR
 uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
--

1.8.1.4

#17 lore raw

Re: [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

In reply to a message not in the archive
Quoted 105 lines · Cunming

Thanks Bruce's valuable comments.

Quoted 55 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 11:01 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net device

Quoted 8 lines · Cunming
Quoted 8 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, November 25, 2014 10:34 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] ixgbe: PMD for bifurc ixgbe net

device

Quoted 15 lines
Quoted 15 lines · Cunming Liang
Quoted 4 lines
---
 lib/librte_pmd_ixgbe/Makefile          |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c | 303

+++++++++++++++++++++++++++++++++

Quoted 7 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h |  57 +++++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c      |  40 ++++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h      |  10 ++
 5 files changed, 415 insertions(+), 8 deletions(-)
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h
Quoted 2 lines
Quoted 2 lines

These changes are the ones that I'm not too sure about. I'd prefer if all material for the bifurcated driver be kept within the librte_pmd_bifurc

directory.

Quoted 3 lines

[Liang, Cunming] I haven't a librte_pmd_bifurc library.
So far the purpose of librte_bifurc is for device scan, not used as a pmd. During driver probe, depend on device id, it asks for correct pmd from

'librte_pmd_ixgbe, librte_pmd_i40e'.

Quoted 6 lines
Quoted 5 lines

Is it possible to leave ixgbe largely unmodified and simply have the new bifurcated driver pull in the needed ixgbe (and later i40e) functions at compile time i.e. refer from one Makefile to the sources in the other driver's directory?

[Liang, Cunming] Nice point. If we have single directory gathering all direct ring

access.

Quoted 1 line

e.g. We have aka "librte_pmd_bifurc", inside it, we'll have bifurc_ixgbe,

bifurc_i40e, ...

Quoted 1 line

Each of them still depend on other libraries like

librte_pmd_ixgbe/librte_pmd_i40e.

Quoted 1 line

We may remove the internal dependence inside one pmd driver, but between

libraries we add more.

I'm not sure about all that. Two points:

Quoted 9 lines

* Why would we need separate subdirectories within the bifurcated driver directory?
The *only* thing that is different between an implementation of ixgbe and i40e to
use the bifurcated driver infrastructure is the code to map between NIC descriptors
and rte_mbufs. All the other code would be identical as far as I can work out. So the
only two routines that differ are going to be the rx_burst and tx_burst functions.

[Liang, Cunming] Not really. If not using the fake page, we need to provide init/start/stop case by case.

Quoted 2 lines

So why not just pull in those two specific functions (or sets of functions) from their respective drivers, and keep the rest of the codebase common?

[Liang, Cunming] I'm not sure all the rest of codebase can be common.
For rx/tx or queue_setup, we know it can, we already do it in xxx_rxtx.c. For other ops, may not. Even for the part we can, if we provide such common method template, it looks like we still need to register 'ops'. (e.g. xxx_init_shared_code, xxx_dev_tx/rx_init, xxx_dev_rxtx_start) They're not part of eth_dev_ops. If we consider more like enable all other DPDK ethdev API (by using ioctl like ethtools does). These message wrap and translation are definitely the case to put into such common codes.

So I agree with the idea to put more common method into librte_bifurc. But don't think it's good to make it as a common PMD driver.
I still prefer ixgbe_bifurc.c in librte_pmd_ixgbe as an independent driver. Per codebase common, rxtx common stuffs already done in xxx_rxtx.c. Other common method provides by librte_bifurc, be used by each specific PMD.

Quoted 4 lines

simpler than having the ixgbe driver having to be aware of whether it's operating in bifurcated mode or uio/vfio/nic_uio mode, to check what operations are supported
or not.

[Liang, Cunming] If you go through the codes. You'll find it's not ixgbe driver to aware of these modes. We already have ixgbe driver and ixgbevf driver, now have ixgbe_bifurc driver, that's it. BTW ideally, it's better for ixgbe and ixgbevf in self-contain .c files, now all are in ixgbe_ethdev.c Ixgbe_bifurc has weaker NIC control than ixgbevf, both are mainly focus on rx and tx. Ixgbe has full HW control, ixgbevf has limited HW control, ixgbe_bifurc no HW control. All of them has the same capability to do rx and tx.
On this point of view, it makes sense to have such standalone driver.

Quoted 11 lines

* It's not really an inter-library dependency - or at least not a hugely problematic one to my mind. With my proposal there is no need for the ixgbe or i40e drivers to
be compiled up for the bifurcated driver to work with them. It simply makes use of the rx and tx code functions to do the mapping from descriptors to mbufs. While
there will be a dependency on those functions, the nice thing is that those functions
are already standardized by the ethdev API, so we don't need to worry about internal changes inside the drivers changing the APIs of those functions.

Quoted 6 lines

[Liang, Cunming] I think I haven't fully got your point.
Do you propose we don't need the specific PMD bifurc, instead to provide a driver directly on top of all other PMD ? We expose more low level function to ethdev API as needed.
In this way, there's a risk that we assume kernel always guarantee the illegal register access only goes into the fake pages. If not, such register access by normal PMD is un-expectable.

My main thinking is that the ethdev HW APIs applicable to the bifurcated driver are going to be very, very limited. Even the we can set up RX and TX queues and perform RX and TX on them, but everything else, as far as I can see, is going to be controlled externally via ethtool access to the kernel. Therefore, it seems to me that an i40e device in bifurcated mode has much more in common with an ixgbe device in bifurcated mode that with an i40e device being directly controlled by DPDK. For these reasons I think a single driver for all bifurcated drivers makes more sense.

However, without having prototyped such a scheme one cannot be sure if it will really work, so I'm curious what other people think is the best approach to producing such a driver.

/Bruce

Quoted 17 lines
Quoted 17 lines

/Bruce

Quoted 4 lines
Quoted 4 lines

My thinking is that the bifurcated driver is so significantly different in the way it works, and the limits on it's functionality e.g. no direct filter support or queue management, that it's best kept completely separate and

only

Quoted 1 line
Quoted 1 line

"borrow" the needed descriptor read/write functions from the other drivers

as is

Quoted 6 lines
Quoted 6 lines

needed.

Just my 2c. I'm curious as to what others think.

/Bruce

#29 lore raw
In reply to a message not in the archive

Thank you for explanation.

I have a few questions regarding the setup flow yet:

1. Why we need this step:

Quoted 3 lines

3. Setup a flow director rule to distribute packets with source ip

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

2. You presented the filter setup for receiving all udp4 packets on specific queue

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

How to configure flow director to receive all packets with dst-ip = 1.1.1.1 on qpair=32? Will TCP SYN packets caught by such filter setup?

3. Do we have a possibility to setup a rule like:
Forward all TCPv4 rx packets with dst-ip =1.1.1.1 and TCP port 2222 to qpair=32 including SYN packets?

3. In your application example you present that qpair number (32) is known before start of application

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Is there a possibility to dynamic queue allocation? I ask about API.
I mean dynamic attaching and detaching queue from application level and not specifying the numbers in the command line.

4. Is there a possibility to create a rule with perfect match and directing the packets to the specific queue. I mean here a rule like:
Forward all TCPv4 rx packets with dst-ip=1.1.1.1 src-ip=2.2.2.2 dst-port=2222 src-port=1234 to queue 33

Regards,

Mirek

Quoted 358 lines

-----Original Message-----
From: Zhou, Danny
Sent: Tuesday, November 25, 2014 4:23 PM
To: Richardson, Bruce; Walukiewicz, Miroslaw
Cc: [email protected]
Subject: RE: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 11:03 PM
To: Walukiewicz, Miroslaw
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 7 lines
Quoted 1 line · Miroslaw

Thank you Bruce for explanation of the idea.

Actually, credit goes to Steve Liang, not me, for the explanation. :-)

Quoted 2 lines

I have question regarding TCP SYN packets? Do you have any idea how to

share the TCP SYN requests between kernel and

Quoted 6 lines

user-space application?

As I'm giving the credit to Steve, I'll also pass the buck for answering that question to him too! :-)

/Bruce

On ixgbe' Rx queuing flow, match SYN filter stage is prior to Flow Director filter stage. When working at bifurcated driver support mode, DPDK cannot access those NIC registers except for the ones that are used to rx/tx packets for assigned rx/tx queue pairs. So basically it really depends on user to use ethtool or other interface to setup SYN filter via ixgbe bifurcated driver. User can distribute TCP SYN packets to kernel bifurcated driver owned rx queues or DPDK owned rx queues, for the latter case, DPDK can still push them back to kernel via KNI if DPDK does not want to use them. If you have a user space TCP/IP stacks on top of DPDK, you can push them to the upper level stack rather instead.

Quoted 7 lines
Quoted 7 lines

Regards,

Mirek

Quoted 2 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce

Richardson

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Sent: Tuesday, November 25, 2014 3:30 PM
To: Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated

driver

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines · Neil Horman
Quoted 9 lines · Cunming Liang
Quoted 8 lines

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that

supports:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

1. on-demand rx/tx queue pairs split-off and assignment to user

space

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

2. direct NIC resource(e.g. rx/tx queue registers) access from user

space

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path

packets in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

user space in a high performance fashion, meanwhile processing

slow

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

path

Quoted 1 line
Quoted 1 line

control packets in kernel space is still needed as those packets

usually

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

rely on in_kernel TCP/IP stacks and/or socket programming

interface.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet

this

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via

DPDK

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 2 lines
Quoted 2 lines

2) Memory copy packets between kernel' socket buffer and mbuf

brings

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only

offloads

Quoted 1 line
Quoted 1 line

flow classification and distribution to NIC but also support packets

zero_copy.

Quoted 2 lines
Quoted 2 lines

User can use standard ethtool to add filter rules to the NIC in order

to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

distribute specific flows to the queues only accessed by kernel

driver and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

stack, and add other rules to distribute packets to the queues

assigned to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

operation

Quoted 7 lines
Quoted 7 lines

for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user

space

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

driver

Quoted 1 line
Quoted 1 line

mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to

user

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

space.

Quoted 1 line
Quoted 1 line

The bifurcated driver PMD talks to a NIC interface using raw socket

APIs

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

and

Quoted 1 line
Quoted 1 line

only mmap() limited I/O space (e.g. certain 4K pages) for accessing

involved

Quoted 1 line
Quoted 1 line

rx/tx queue pairs. So the impact and changes mainly comes with

below:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- netdev
DPDK needs to create a af_packet socket and bind it to a

bifurcated

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 4 lines
Quoted 4 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the

device ID,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the correct driver should be used. And for such netdev device,

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

creation

Quoted 1 line
Quoted 1 line

of PCIe device is no longer from scan but the on-demand

assignment.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping

go

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

through

Quoted 1 line
Quoted 1 line

mmap on sockfd. Which is a little different from what UIO/VFIO

does.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and

tx_burst.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The patch uses eal '--vdev' parameter to assign netdev iface name

and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the

bifurcated

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

driver and

Quoted 12 lines
Quoted 12 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
  4. Run testpmd on netdev 'eth0' with 1 queue pair.
  > ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
  >  --vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
  >  -i --rxfreet=32 --txfreet=32 --txrst=32
  Note:
    iface and qpairs arguments above specify the netdev interface

name

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and

Quoted 1 line
Quoted 1 line

number of qpairs that user space request from the "bifurcated

driver"

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux

version

Quoted 1 line
Quoted 1 line

definition to support af_packet socket and verbs of bifurcated

netdev.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 1 line
Quoted 1 line

And other APIs like set_pci, get_ifinfo and get/put_devargs which

help to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

generate pci device from bifurcated netdev and get basic netdev

info.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The third patch is used to allow probing driver on the PCIe VDEV

created

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

from

Quoted 6 lines
Quoted 6 lines

a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc'

VDEV

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

from eal command-line. It generates the PCIe VDEV device ready

for

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

further

Quoted 1 line
Quoted 1 line

driver probe. It maintains the bifurcated device information include

sockfd,

Quoted 1 line
Quoted 1 line

hwaddr, mtu, qpairs, iface_name. It's used for other direct ring

access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

PMD

Quoted 5 lines
Quoted 5 lines

to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

normal

Quoted 1 line
Quoted 1 line

PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self

registration.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

It mostly reuses the existing PMD ops to avoid re-implementing

everything

Quoted 1 line
Quoted 1 line

from scratch. And it also modifies the rx/tx_queue_setup to allow

queue

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings

as

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

sample.

Quoted 3 lines
Quoted 3 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director

capability

Quoted 1 line
Quoted 1 line

to do perform packet classification and distribution, there's no

special

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA

operation.

Quoted 1 line
Quoted 1 line

For those NIC configure setting, it's out of control from user space

PMD.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported

by

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

ethtool.

Quoted 20 lines
Quoted 20 lines

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284

+++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186

++++++++++++++

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644

lib/librte_eal/common/include/rte_pci_bifurc.h

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it?

Given

Quoted 1 line

that, I don't think its wise to pull this in yet ahead of the kernel work,

as

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

there may still be kernel side changes that the user space pmd will

have to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part

hits

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

the
main kernel tree we can at least discuss the overall direction to be

taken for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

this driver because it's significantly different that any other HW driver.

/Bruce

#31 lore raw
In reply to a message not in the archive
Quoted 8 lines

-----Original Message-----
From: Walukiewicz, Miroslaw
Sent: Wednesday, November 26, 2014 6:45 PM
To: Zhou, Danny; Richardson, Bruce
Cc: [email protected]
Subject: RE: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 9 lines

Thank you for explanation.

I have a few questions regarding the setup flow yet:

1. Why we need this step:

Quoted 3 lines

3. Setup a flow director rule to distribute packets with source ip

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

DZ: By default, ixgbe kernel driver uses 32 (0-31) rx/tx queue pairs. Above example setup a filter to route a UDP flow with src_ip 0.0.0.0 to queue No.0 which is used by kernel driver' rx/tx routine.

Quoted 7 lines

2. You presented the filter setup for receiving all udp4 packets on specific queue

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

How to configure flow director to receive all packets with dst-ip = 1.1.1.1 on qpair=32?

DZ: You can certainly do it using ethtool command-line like "ethtool -N eth0 flow-type udp4 dst-ip 1.1.1.1 action 32" to do it.

Quoted 1 line

Will TCP SYN packets caught by such filter setup?

DZ: Unfortunately, unlike DPDK that provides ixgbe_add_syn_filter() API to allows program SYN Packet Queue Filter register, the in_kernel ixgbe kernel driver does not touch that register. While I had seen ixgbe 3.18.7 driver hard-code a value in that register. For all cases, there is no easy way to use ixgbe bifurcated driver to config it. Under bifurcated mode, DPDK cannot access that register.

Quoted 2 lines

3. Do we have a possibility to setup a rule like:
Forward all TCPv4 rx packets with dst-ip =1.1.1.1 and TCP port 2222 to qpair=32 including SYN packets?

DZ: Yes, ethtool and flow director supports that. Will send you a separated email regarding ethtool usage regarding flow director configuration.

Quoted 8 lines

3. In your application example you present that qpair number (32) is known before start of application

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Is there a possibility to dynamic queue allocation? I ask about API.
I mean dynamic attaching and detaching queue from application level and not specifying the numbers in the command line.

DZ: The example is just for experiment. When DPDK request queue pairs from ixgbe bifurcated driver, it only specify number of qpairs, the kernel driver actually returns the absolute qpair index of assigned qpairs to application. Application can hence use it to invoke ethtool command-line to do it or directly invoke IOCTL to bifurcated driver to setup FD.

Quoted 4 lines

4. Is there a possibility to create a rule with perfect match and directing the packets to the specific queue. I mean here a rule like:
Forward all TCPv4 rx packets with dst-ip=1.1.1.1 src-ip=2.2.2.2 dst-port=2222 src-port=1234 to queue 33

DZ: Yes, of course you can.

Quoted 362 lines

Regards,

Mirek

Quoted 358 lines

-----Original Message-----
From: Zhou, Danny
Sent: Tuesday, November 25, 2014 4:23 PM
To: Richardson, Bruce; Walukiewicz, Miroslaw
Cc: [email protected]
Subject: RE: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, November 25, 2014 11:03 PM
To: Walukiewicz, Miroslaw
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated driver

Quoted 7 lines
Quoted 1 line · Miroslaw

Thank you Bruce for explanation of the idea.

Actually, credit goes to Steve Liang, not me, for the explanation. :-)

Quoted 2 lines

I have question regarding TCP SYN packets? Do you have any idea how to

share the TCP SYN requests between kernel and

Quoted 6 lines

user-space application?

As I'm giving the credit to Steve, I'll also pass the buck for answering that question to him too! :-)

/Bruce

On ixgbe' Rx queuing flow, match SYN filter stage is prior to Flow Director filter stage. When working at bifurcated driver support mode, DPDK cannot access those NIC registers except for the ones that are used to rx/tx packets for assigned rx/tx queue pairs. So basically it really depends on user to use ethtool or other interface to setup SYN filter via ixgbe bifurcated driver. User can distribute TCP SYN packets to kernel bifurcated driver owned rx queues or DPDK owned rx queues, for the latter case, DPDK can still push them back to kernel via KNI if DPDK does not want to use them. If you have a user space TCP/IP stacks on top of DPDK, you can push them to the upper level stack rather instead.

Quoted 7 lines
Quoted 7 lines

Regards,

Mirek

Quoted 2 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce

Richardson

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Sent: Tuesday, November 25, 2014 3:30 PM
To: Neil Horman
Cc: [email protected]
Subject: Re: [dpdk-dev] [RFC PATCH 0/6] DPDK support to bifurcated

driver

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines · Neil Horman
Quoted 9 lines · Cunming Liang
Quoted 8 lines

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that

supports:

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

1. on-demand rx/tx queue pairs split-off and assignment to user

space

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

2. direct NIC resource(e.g. rx/tx queue registers) access from user

space

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path

packets in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

user space in a high performance fashion, meanwhile processing

slow

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

path

Quoted 1 line
Quoted 1 line

control packets in kernel space is still needed as those packets

usually

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

rely on in_kernel TCP/IP stacks and/or socket programming

interface.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet

this

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via

DPDK

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

software rings, at the cost of significant CPU cycles and memory

bandwidth.

Quoted 2 lines
Quoted 2 lines

2) Memory copy packets between kernel' socket buffer and mbuf

brings

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only

offloads

Quoted 1 line
Quoted 1 line

flow classification and distribution to NIC but also support packets

zero_copy.

Quoted 2 lines
Quoted 2 lines

User can use standard ethtool to add filter rules to the NIC in order

to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

distribute specific flows to the queues only accessed by kernel

driver and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

stack, and add other rules to distribute packets to the queues

assigned to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

operation

Quoted 7 lines
Quoted 7 lines

for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user

space

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

driver

Quoted 1 line
Quoted 1 line

mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to

user

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

space.

Quoted 1 line
Quoted 1 line

The bifurcated driver PMD talks to a NIC interface using raw socket

APIs

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

and

Quoted 1 line
Quoted 1 line

only mmap() limited I/O space (e.g. certain 4K pages) for accessing

involved

Quoted 1 line
Quoted 1 line

rx/tx queue pairs. So the impact and changes mainly comes with

below:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

- netdev
DPDK needs to create a af_packet socket and bind it to a

bifurcated

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

netdev.

Quoted 2 lines
Quoted 2 lines

The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC

address,

Quoted 4 lines
Quoted 4 lines

numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the

device ID,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the correct driver should be used. And for such netdev device,

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

creation

Quoted 1 line
Quoted 1 line

of PCIe device is no longer from scan but the on-demand

assignment.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping

go

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

through

Quoted 1 line
Quoted 1 line

mmap on sockfd. Which is a little different from what UIO/VFIO

does.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and

tx_burst.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The patch uses eal '--vdev' parameter to assign netdev iface name

and

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

number of

Quoted 1 line
Quoted 1 line

queue pairs. Here's a example about how to configure the

bifurcated

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

driver and

Quoted 12 lines
Quoted 12 lines

run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
  4. Run testpmd on netdev 'eth0' with 1 queue pair.
  > ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
  >  --vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
  >  -i --rxfreet=32 --txfreet=32 --txrst=32
  Note:
    iface and qpairs arguments above specify the netdev interface

name

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and

Quoted 1 line
Quoted 1 line

number of qpairs that user space request from the "bifurcated

driver"

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux

version

Quoted 1 line
Quoted 1 line

definition to support af_packet socket and verbs of bifurcated

netdev.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Those APIs include the verbs like open, bind, (un)map, split/retturn,

map_umem.

Quoted 1 line
Quoted 1 line

And other APIs like set_pci, get_ifinfo and get/put_devargs which

help to

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

generate pci device from bifurcated netdev and get basic netdev

info.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The third patch is used to allow probing driver on the PCIe VDEV

created

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

from

Quoted 6 lines
Quoted 6 lines

a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc'

VDEV

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

from eal command-line. It generates the PCIe VDEV device ready

for

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

further

Quoted 1 line
Quoted 1 line

driver probe. It maintains the bifurcated device information include

sockfd,

Quoted 1 line
Quoted 1 line

hwaddr, mtu, qpairs, iface_name. It's used for other direct ring

access

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

PMD

Quoted 5 lines
Quoted 5 lines

to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

normal

Quoted 1 line
Quoted 1 line

PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self

registration.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

It mostly reuses the existing PMD ops to avoid re-implementing

everything

Quoted 1 line
Quoted 1 line

from scratch. And it also modifies the rx/tx_queue_setup to allow

queue

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

moment,

Quoted 1 line
Quoted 1 line

so this RFC patch also provides "ixgbe" PMD via direct-mapped rings

as

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

sample.

Quoted 3 lines
Quoted 3 lines

The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director

capability

Quoted 1 line
Quoted 1 line

to do perform packet classification and distribution, there's no

special

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA

operation.

Quoted 1 line
Quoted 1 line

For those NIC configure setting, it's out of control from user space

PMD.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported

by

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

ethtool.

Quoted 20 lines
Quoted 20 lines

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284

+++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186

++++++++++++++

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336

+++++++++++++++++++++++++

Quoted 3 lines
Quoted 3 lines
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303

++++++++++++++++++++++

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644

lib/librte_eal/common/include/rte_pci_bifurc.h

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

--
1.8.1.4

AIUI, the bifurcated driver hasn't yet been accepted upstream, has it?

Given

Quoted 1 line

that, I don't think its wise to pull this in yet ahead of the kernel work,

as

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

there may still be kernel side changes that the user space pmd will

have to

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

adapt to.
Neil

Hence the RFC nature of the patch, I believe. :-) Before the kernel part

hits

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

the
main kernel tree we can at least discuss the overall direction to be

taken for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

this driver because it's significantly different that any other HW driver.

/Bruce

#32 lore raw
In reply to a message not in the archive

Hi Cunming,
I applyed bifurc dirver patches and tested it follow your example. But
I can't received packets with testpmd and l2fwd.
Kernel stack can receive packets from 10.0.0.2 before "ethtool -N
XGE4.1 flow-type ip4 src-ip 10.0.0.2 action 12". After "thtool -N XGE4.1 flow-type ip4 src-ip 10.0.0.2 action 12", kernel stack can't receive packets from 10.0.0.2, but testpmd and l2fwd cannot receive any packets too.
queue 0-11 used by kernel and queue 12 used by bifurc dirver. How can I make it work?

2014-11-25 22:11 GMT+08:00 Cunming Liang <[email protected]>:

Quoted 229 lines

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory
bandwidth.

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads
flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user space.
The bifurcated driver PMD talks to a NIC interface using raw socket APIs and
only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved
rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated
netdev.
The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC
address,
numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device ID, the correct driver should be used. And for such netdev device, the
creation
of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go
through
mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and
tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and number of
queue pairs. Here's a example about how to configure the bifurcated driver and
run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version
definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn, map_umem.
And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from
a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd,
hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal
PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the moment,
so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as sample.
The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability
to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation. For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284 +++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336
+++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303
++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

--
1.8.1.4

#34 lore raw
In reply to a message not in the archive

Hi,
I can receive packets when I mmaped all pci memory not only rx and tx
desc.

2015-04-09 11:43 GMT+08:00 贾学涛 <jiaxt-ZrUwlr9QczFWk0Htik3J/[email protected]>:

Quoted 248 lines

Hi Cunming,
I applyed bifurc dirver patches and tested it follow your example.
But I can't received packets with testpmd and l2fwd.
Kernel stack can receive packets from 10.0.0.2 before "ethtool -N
XGE4.1 flow-type ip4 src-ip 10.0.0.2 action 12". After "thtool -N XGE4.1 flow-type ip4 src-ip 10.0.0.2 action 12", kernel stack can't receive packets from 10.0.0.2, but testpmd and l2fwd cannot receive any packets too.
queue 0-11 used by kernel and queue 12 used by bifurc dirver. How can I make it work?

2014-11-25 22:11 GMT+08:00 Cunming Liang <[email protected]>:

Quoted 234 lines

This is a RFC patch set to support "bifurcated driver" in DPDK.

What is "bifurcated driver"?
===========================

The "bifurcated driver" stands for the kernel NIC driver that supports:

1. on-demand rx/tx queue pairs split-off and assignment to user space

2. direct NIC resource(e.g. rx/tx queue registers) access from user space

3. distributing packets to kernel or user space rx queues by NIC's flow director according to the filter rules

Here's the kernel patch set to support.
http://comments.gmane.org/gmane.linux.network/333615

Usage scenario
=================

It's well accepted by industry to use DPDK to process fast path packets in user space in a high performance fashion, meanwhile processing slow path control packets in kernel space is still needed as those packets usually rely on in_kernel TCP/IP stacks and/or socket programming interface.

KNI(Kernel NIC Interface) mechanism in DPDK is designed to meet this requirement, with below limitation:

1) Software classifies packets and distributes them to kernel via DPDK software rings, at the cost of significant CPU cycles and memory
bandwidth.

2) Memory copy packets between kernel' socket buffer and mbuf brings significant negative performance impact to KNI performance.

The bifurcated driver provides a alternative approach that not only offloads
flow classification and distribution to NIC but also support packets zero_copy.

User can use standard ethtool to add filter rules to the NIC in order to distribute specific flows to the queues only accessed by kernel driver and stack, and add other rules to distribute packets to the queues assigned to user-space.

For those rx/tx queue pairs that directly accessed from user space, DPDK takes over the packets rx/tx as well as corresponding DMA operation for high performance packet I/O.

What's the impact and change to DPDK
======================================

DPDK usually binds PCIe NIC devices by leveraging kernel' user space driver
mechanism UIO or VFIO to map entire NIC' PCIe I/O space of NIC to user space.
The bifurcated driver PMD talks to a NIC interface using raw socket APIs and
only mmap() limited I/O space (e.g. certain 4K pages) for accessing involved
rx/tx queue pairs. So the impact and changes mainly comes with below:

- netdev
DPDK needs to create a af_packet socket and bind it to a bifurcated
netdev.
The socket fd will be used to request 'queue pairs info', 'split/return queue pairs' and etc. The PCIe device ID, netdev MAC
address,
numa info are also from the netdev response.

- PCIe device scan and driver probe
netdev provides the PCIe device ID information. Refer to the device
ID,
the correct driver should be used. And for such netdev device, the
creation
of PCIe device is no longer from scan but the on-demand assignment.

- PCIe BAR mapping
"bifurcated driver" maps several pages for the queue pairs. Others BAR register space maps to a fake page. The BAR mapping go
through
mmap on sockfd. Which is a little different from what UIO/VFIO does.

- PMD
The PMD will no longer really initialize and configure NIC. Instead, it only takes care the queue pair setup, rx_burst and
tx_burst.

The patch uses eal '--vdev' parameter to assign netdev iface name and number of
queue pairs. Here's a example about how to configure the bifurcated driver and
run DPDK testpmd with bifurcated PMD.

1. Set promisc mode

Quoted 1 line

ifconfig eth0 promisc

2. Turn on fdir

Quoted 1 line

ethtool -K eth0 ntuple on

3. Setup a flow director rule to distribute packets with source ip

     0.0.0.0 to rxq No.0
Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 0.0.0.0 action 0

4. Run testpmd on netdev 'eth0' with 1 queue pair.

Quoted 3 lines

./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 4 \
--vdev=rte_bifurc,iface=eth0,qpairs=1 -- \
-i --rxfreet=32 --txfreet=32 --txrst=32

Note:
iface and qpairs arguments above specify the netdev interface name and number of qpairs that user space request from the "bifurcated driver" respectively.

5. Setup a flow director rule to distribute packets with source ip 1.1.1.1 to rxq No.32. This needs to be done after testpmd starts.

Quoted 1 line

ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 action 32

Below illustrates the detailed changes in this patch set.

eal
--------
The first two patches are all about the eal API declaration and Linux version
definition to support af_packet socket and verbs of bifurcated netdev. Those APIs include the verbs like open, bind, (un)map, split/retturn, map_umem.
And other APIs like set_pci, get_ifinfo and get/put_devargs which help to generate pci device from bifurcated netdev and get basic netdev info.

The third patch is used to allow probing driver on the PCIe VDEV created from
a NIC interface driven by "bifurcated driver". It defines a new flag 'RTE_PCI_DRV_BIFURC' used for direct ring access PMD.

librte_bifurc
---------------
The library is used as a VDEV bus driver to scan '--vdev=rte_bifurc' VDEV from eal command-line. It generates the PCIe VDEV device ready for further driver probe. It maintains the bifurcated device information include sockfd,
hwaddr, mtu, qpairs, iface_name. It's used for other direct ring access PMD
to apply for bifurcated device info.

direct ring access PMD
-------------------------
The patch provides direct ring access PMD for ixgbe. Comparing to the normal
PMD ixgbe, it uses 'RTE_PCI_DRV_BIFURC' flag during self registration. It mostly reuses the existing PMD ops to avoid re-implementing everything from scratch. And it also modifies the rx/tx_queue_setup to allow queue setup from any queue offset.

Supported NIC driver
========================

The "bifurcated driver" kernel patch only supports "ixgbe" driver at the moment,
so this RFC patch also provides "ixgbe" PMD via direct-mapped rings as sample.
The support for 40GE(i40e) will be added in the future.

In addition, for those multi-queues enabled NIC with flow director capability
to do perform packet classification and distribution, there's no special technical gap to provide bifurcated driver approach support.

Limitation
============

By using "bifurcated driver", user space only takes over the DMA operation.
For those NIC configure setting, it's out of control from user space PMD. All the NIC setting including add/del filter rules need to be done by standard Linux network tools(e.g. ethtool).
So the feature support really depend on how much are supported by ethtool.

Any questions, comments and feedback are welcome.

-END-

*** BLURB HERE ***

Cunming Liang (6):
eal: common direct ring access API
eal: direct ring access support by linux af_packet
pci: allow VDEV as pci device during device driver probe
bifurc: add driver to scan bifurcated netdev
ixgbe: rx/tx queue stop bug fix
ixgbe: PMD for bifurc ixgbe net device

 config/common_linuxapp                         |   5 +
 lib/Makefile                                   |   1 +
 lib/librte_bifurc/Makefile                     |  58 +++++
 lib/librte_bifurc/rte_bifurc.c                 | 284
+++++++++++++++++++++
 lib/librte_bifurc/rte_bifurc.h                 |  90 +++++++
 lib/librte_eal/common/Makefile                 |   5 +
 lib/librte_eal/common/include/rte_pci.h        |   4 +
 lib/librte_eal/common/include/rte_pci_bifurc.h | 186 ++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile           |   1 +
 lib/librte_eal/linuxapp/eal/eal_pci.c          |  42 ++--
 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c   | 336
+++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c                  |   3 +-
 lib/librte_pmd_ixgbe/Makefile                  |  13 +-
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c         | 303
++++++++++++++++++++++
 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h         |  57 +++++
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c              |  44 +++-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h              |  10 +
 mk/rte.app.mk                                  |   6 +
 18 files changed, 1421 insertions(+), 27 deletions(-)
 create mode 100644 lib/librte_bifurc/Makefile
 create mode 100644 lib/librte_bifurc/rte_bifurc.c
 create mode 100644 lib/librte_bifurc/rte_bifurc.h
 create mode 100644 lib/librte_eal/common/include/rte_pci_bifurc.h
 create mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_bifurc.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.c
 create mode 100644 lib/librte_pmd_ixgbe/ixgbe_bifurcate.h

--
1.8.1.4