introduce iavf backend driver
Subsystems (2)
cover introduce iavf backend driver
This series introduces a net device driver called iavfbe which is working as datapath driver for emulated iavf type device. It provides basic function following Intel® Ethernet Adaptive Virtual Function specification, including recevice/transmit packets and virtchnl control messages handling. The driver enabling work is based on the framework mentioned in:
[RFC 0/2] Add device emulation support in DPDK
http://patchwork.dpdk.org/cover/75549/
+------------------------------------------------------+
| +---------------+ +---------------+ |
| | iavf_emudev | | iavfbe_ethdev | |
| | driver | | driver | |
| +---------------+ +---------------+ |
| | | |
| ------------------------------------------- VDEV BUS |
| | | |
| +---------------+ +--------------+ |
+--------------+ | | vdev: | | vdev: | |
| +----------+ | | | /path/to/vfio | |iavf_emudev_# | |
| | Generic | | | +---------------+ +--------------+ |
| | vfio-dev | | | | |
| +----------+ | | | |
| +----------+ | | +----------+ |
| | vfio-user| | | | vfio-user| |
| | client | |<---|----->| server | |
| +----------+ | | +----------+ |
| QEMU/DPDK | | DPDK |
+--------------+ +------------------------------------------------------+This series depends on patch serieses:
[0/9] Introduce vfio-user library:
http://patchwork.dpdk.org/cover/85389/
[0/8]Introduce emudev library and iavf emudev driver
http://patchwork.dpdk.org/cover/85488/
Jingjing Wu (5):
net/iavf_be: introduce iavf backend driver
net/iavf_be: control queue enabling
net/iavf_be: virtchnl messages process
net/iavf_be: add Rx Tx burst support
doc: new net PMD iavf_be
MAINTAINERS | 6 + doc/guides/nics/features/iavf_be.ini | 11 + doc/guides/nics/iavf_be.rst | 53 ++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 6 + drivers/net/iavf_be/iavf_be.h | 123 +++ drivers/net/iavf_be/iavf_be_ethdev.c | 961 +++++++++++++++++++++ drivers/net/iavf_be/iavf_be_rxtx.c | 491 +++++++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 163 ++++ drivers/net/iavf_be/iavf_be_vchnl.c | 1084 ++++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 14 + drivers/net/iavf_be/version.map | 3 + drivers/net/meson.build | 1 + 13 files changed, 2917 insertions(+) create mode 100644 doc/guides/nics/features/iavf_be.ini create mode 100644 doc/guides/nics/iavf_be.rst create mode 100644 drivers/net/iavf_be/iavf_be.h create mode 100644 drivers/net/iavf_be/iavf_be_ethdev.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.h create mode 100644 drivers/net/iavf_be/iavf_be_vchnl.c create mode 100644 drivers/net/iavf_be/meson.build create mode 100644 drivers/net/iavf_be/version.map
Signature · 1 line
2.21.1
PATCH 1/5 net/iavf_be: introduce iavf backend driver
Introduce driver for iavf backend vdev which is based on vfio-user protocol and emudev libs.
--- drivers/net/iavf_be/iavf_be.h | 40 ++++ drivers/net/iavf_be/iavf_be_ethdev.c | 330 +++++++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 12 + drivers/net/iavf_be/version.map | 3 + drivers/net/meson.build | 1 + 5 files changed, 386 insertions(+) create mode 100644 drivers/net/iavf_be/iavf_be.h create mode 100644 drivers/net/iavf_be/iavf_be_ethdev.c create mode 100644 drivers/net/iavf_be/meson.build create mode 100644 drivers/net/iavf_be/version.map
drivers/net/iavf_be/iavf_be.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#ifndef _IAVF_BE_H_ +#define _IAVF_BE_H_ + +/* Structure to store private data for backend instance*/ +struct iavfbe_adapter { +struct rte_eth_dev *eth_dev; +struct rte_emudev *emu_dev; +uint16_t edev_id;/* Emulated Device ID */ +struct rte_emudev_info dev_info; + +uint16_t nb_qps; +bool link_up; +int cq_irqfd; +rte_atomic32_t irq_enable; + +uint8_t unicast_promisc:1 , + multicast_promisc:1 , + vlan_filter:1 , + vlan_strip:1 ; + +int adapter_stopped; +uint8_t *reset;/* Reset status */ +volatile int started; +}; + +/* IAVFBE_DEV_PRIVATE_TO */ +#define IAVFBE_DEV_PRIVATE_TO_ADAPTER (adapter) \ + ((struct iavfbe_adapter *)adapter) + +int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); + +extern int iavfbe_logtype; +#define IAVF_BE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, iavfbe_logtype, "%s(): " fmt "\n", \ + __func__, ## args) +#endif /* _IAVF_BE_H_ */
drivers/net/iavf_be/iavf_be_ethdev.c new file +330 -0
330 lines not on this page · raw message
drivers/net/iavf_be/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +cflags += ['-Wno-strict-aliasing'] + +includes += include_directories('../../common/iavf') + +deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] + +sources = files( + 'iavf_be_ethdev.c', +)
drivers/net/iavf_be/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/net/meson.build +1 -0
@@ -24,6 +24,7 @@ drivers = ['af_packet', 'hinic', 'hns3', 'iavf', + 'iavf_be', 'ice', 'igc', 'ipn3ke',
Signature · 1 line
2.21.1
PATCH 2/5 net/iavf_be: control queue enabling
In reply to Jingjing Wu1. Set up control rx/tx queues.
2. Emu device callback functions implemention.
3. Enabling recv/send msg through control queue.
--- drivers/net/iavf_be/iavf_be.h | 39 ++++ drivers/net/iavf_be/iavf_be_ethdev.c | 321 ++++++++++++++++++++++++++- drivers/net/iavf_be/iavf_be_vchnl.c | 273 +++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 1 + 4 files changed, 632 insertions(+), 2 deletions(-) create mode 100644 drivers/net/iavf_be/iavf_be_vchnl.c
drivers/net/iavf_be/iavf_be.h +39 -0
@@ -5,13 +5,49 @@ #ifndef _IAVF_BE_H_ #define _IAVF_BE_H_ +#define IAVF_BE_AQ_LEN 32 +#define IAVF_BE_AQ_BUF_SZ 4096 +#define IAVF_BE_32_TO_64(hi, lo) ((((uint64_t)(hi)) << 32) + (lo)) + +#define IAVFBE_READ_32(addr) \ + rte_le_to_cpu_32(*(volatile uint32_t *)(addr)) +#define IAVFBE_WRITE_32(addr, val) \ + *(volatile uint32_t *)(addr) = rte_cpu_to_le_32(val); + +struct iavfbe_control_q { + rte_spinlock_t access_lock; + struct rte_emudev_q_info q_info; + struct iavf_aq_desc *ring; + uint64_t p_ring_addr; /* Guest physical address of the ring */ + uint16_t len; + volatile uint8_t *tail; + volatile uint8_t *head; + + uint16_t next_to_use; + uint16_t next_to_clean; + + uint32_t cmd_retval; /* return value of the cmd response from PF */ + uint8_t *aq_req; /* buffer to store the adminq request from VF, NULL if arq */ +}; + +/* Control queue structure of iavf */ +struct iavfbe_controlq_info { + struct iavfbe_control_q asq; + struct iavfbe_control_q arq; +}; + /* Structure to store private data for backend instance*/ struct iavfbe_adapter { struct rte_eth_dev *eth_dev; struct rte_emudev *emu_dev; uint16_t edev_id; /* Emulated Device ID */ struct rte_emudev_info dev_info; + struct rte_iavf_emu_mem *mem_table; + struct iavfbe_controlq_info cq_info; /* Control/Admin Queue info*/ + /* Adminq handle thread info */ + volatile int thread_status; + pthread_t thread_id; uint16_t nb_qps; bool link_up; int cq_irqfd;
@@ -32,6 +68,9 @@ struct iavfbe_adapter { ((struct iavfbe_adapter *)adapter)int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); +void iavfbe_handle_virtchnl_msg (void *arg); +void iavfbe_reset_asq (struct iavfbe_adapter *adapter,bool lock); +void iavfbe_reset_arq (struct iavfbe_adapter *adapter,bool lock);extern int iavfbe_logtype; #define IAVF_BE_LOG(level, fmt, args...) \
drivers/net/iavf_be/iavf_be_ethdev.c +319 -2
377 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_vchnl.c new file +273 -0
273 lines not on this page · raw message
drivers/net/iavf_be/meson.build +1 -0
@@ -9,4 +9,5 @@ deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] sources = files( 'iavf_be_ethdev.c', + 'iavf_be_vchnl.c', )
Signature · 1 line
2.21.1
PATCH 3/5 net/iavf_be: virtchnl messages process
In reply to Jingjing Wu1. Process virtchnl messages from Front End.
2. Ethdev ops implemention for queues setup.
--- drivers/net/iavf_be/iavf_be.h | 44 ++ drivers/net/iavf_be/iavf_be_ethdev.c | 335 ++++++++++- drivers/net/iavf_be/iavf_be_rxtx.c | 162 ++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 103 ++++ drivers/net/iavf_be/iavf_be_vchnl.c | 815 ++++++++++++++++++++++++++- drivers/net/iavf_be/meson.build | 1 + 6 files changed, 1446 insertions(+), 14 deletions(-) create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.h
drivers/net/iavf_be/iavf_be.h +44 -0
@@ -9,6 +9,30 @@#define IAVF_BE_AQ_BUF_SZ 4096#define IAVF_BE_32_TO_64 (hi, lo) ((((uint64_t)(hi)) << 32) + (lo)) +/* Default setting on number of VSIs that VF can contain */ +#define IAVF_BE_DEFAULT_VSI_NUM 1 +#define AVF_DEFAULT_MAX_MTU 1500 +/* Set the MAX vectors and queus to 16, +* as base mode virtchnl support 16 queue pairs mapping in max. +*/ +#define IAVF_BE_MAX_NUM_QUEUES 16 +#define IAVF_BE_MAX_VECTORS 16 +#define IAVF_BE_BUF_SIZE_MIN 1024 +#define IAVF_BE_FRAME_SIZE_MAX 9728 +#define IAVF_BE_NUM_MACADDR_MAX 64 + +/* The overhead from MTU to max frame size. +* Considering QinQ packet, the VLAN tag needs to be counted twice. +*/ +#define AVF_VLAN_TAG_SIZE 4 +#define AVF_ETH_OVERHEAD \ + (ETHER_HDR_LEN + ETHER_CRC_LEN + AVF_VLAN_TAG_SIZE * 2) + +/* Structure that defines a VSI, associated with a adapter. */ + +/* Assume the max number be 16 right now */ +#define AVF_MAX_MSIX_VECTORS 16 +#define IAVFBE_READ_32 (addr) \ rte_le_to_cpu_32(*(volatile uint32_t *)(addr))#define IAVFBE_WRITE_32 (addr, val) \
@@ -48,8 +72,15 @@ struct iavfbe_adapter {/* Adminq handle thread info */ volatile int thread_status;pthread_t thread_id; + +struct virtchnl_version_info virtchnl_version; +struct virtchnl_vf_resource *vf_res;/* Resource to VF */ +/* Pointer to array of queue pairs info. */ +struct virtchnl_queue_pair_info *qps;uint16_t nb_qps; +uint16_t nb_used_qps;bool link_up; +struct virtchnl_eth_stats eth_stats;/* Stats to VF */ int cq_irqfd;rte_atomic32_t irq_enable;
@@ -67,11 +98,24 @@ struct iavfbe_adapter {#define IAVFBE_DEV_PRIVATE_TO_ADAPTER (adapter) \ ((struct iavfbe_adapter *)adapter) +void iavfbe_reset_all_queues (struct iavfbe_adapter *adapter);int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); +int iavfbe_lock_lanq (struct iavfbe_adapter *adapter); +int iavfbe_unlock_lanq (struct iavfbe_adapter *adapter); +void iavfbe_notify_vf_reset (struct iavfbe_adapter *adapter); +void iavfbe_notify (struct iavfbe_adapter *adapter);void iavfbe_handle_virtchnl_msg (void *arg);void iavfbe_reset_asq (struct iavfbe_adapter *adapter,bool lock);void iavfbe_reset_arq (struct iavfbe_adapter *adapter,bool lock); +static inline uint64_t stats_update (uint64_t offset,uint64_t stat) +{ +if (stat >= offset) +return (stat - offset); +else +return (uint64_t )(((uint64_t )-1 ) - offset + stat +1 ); +} +extern int iavfbe_logtype; #define IAVF_BE_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, iavfbe_logtype, "%s(): " fmt "\n", \
drivers/net/iavf_be/iavf_be_ethdev.c +323 -12
450 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.c new file +162 -0
162 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.h new file +103 -0
103 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_vchnl.c +813 -2
840 lines not on this page · raw message
drivers/net/iavf_be/meson.build +1 -0
@@ -10,4 +10,5 @@ deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] sources = files( 'iavf_be_ethdev.c', 'iavf_be_vchnl.c', + 'iavf_be_rxtx.c', )
Signature · 1 line
2.21.1
PATCH 4/5 net/iavf_be: add Rx Tx burst support
In reply to Jingjing WuEnable packets revcieve and transmit functions.
--- drivers/net/iavf_be/iavf_be_ethdev.c | 3 + drivers/net/iavf_be/iavf_be_rxtx.c | 329 +++++++++++++++++++++++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 60 +++++ 3 files changed, 392 insertions(+)
drivers/net/iavf_be/iavf_be_ethdev.c +3 -0
@@ -862,6 +862,9 @@ eth_dev_iavfbe_create(struct rte_vdev_device *dev,rte_ether_addr_copy (addr, ð_dev->data->mac_addrs[0 ]); eth_dev->dev_ops = &iavfbe_eth_dev_ops; + eth_dev->rx_pkt_burst = &iavfbe_recv_pkts; + eth_dev->tx_pkt_burst = &iavfbe_xmit_pkts; + eth_dev->tx_pkt_prepare = &iavfbe_prep_pkts; eth_dev->data->dev_link = iavfbe_link; eth_dev->data->numa_node = dev->device.numa_node;
drivers/net/iavf_be/iavf_be_rxtx.c +329 -0
332 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.h +60 -0
65 lines not on this page · raw message
Signature · 1 line
2.21.1
PATCH 5/5 doc: new net PMD iavf_be
In reply to Jingjing Wu--- MAINTAINERS | 6 +++ doc/guides/nics/features/iavf_be.ini | 11 ++++++ doc/guides/nics/iavf_be.rst | 53 ++++++++++++++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 6 +++ 5 files changed, 77 insertions(+) create mode 100644 doc/guides/nics/features/iavf_be.ini create mode 100644 doc/guides/nics/iavf_be.rst
MAINTAINERS +6 -0
@@ -707,6 +707,12 @@ F: drivers/net/iavf/ F: drivers/common/iavf/ F: doc/guides/nics/features/iavf*.ini +Intel iavf_be +M: Jingjing Wu <[email protected]> +T: git://dpdk.org/next/dpdk-next-net-intel +F: drivers/net/iavf_be/ +F: doc/guides/nics/features/iavf_be*.ini + Intel ice M: Qiming Yang <[email protected]> M: Qi Zhang <[email protected]>
doc/guides/nics/features/iavf_be.ini new file +11 -0
@@ -0,0 +1,11 @@ +; +; Supported features of the 'iavf_be' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Promiscuous mode = Y +Allmulticast mode = Y +Basic stats = Y +Scattered Rx = Y +x86-64 = Y
doc/guides/nics/iavf_be.rst new file +53 -0
53 lines not on this page · raw message
doc/guides/nics/index.rst +1 -0
@@ -30,6 +30,7 @@ Network Interface Controller Drivers hinic hns3 i40e + iavf_be ice igb igc
doc/guides/rel_notes/release_21_02.rst +6 -0
@@ -83,6 +83,12 @@ New Features See :doc:`../prog_guide/emudev` for more information. +* **Added iavf_be net driver.** + + Added a Polling Mode Driver iavf_be as software backend for Intel® AVF Ethernet device. + + See :doc:`../nics/iavf_be.rst` for more information. + Removed Items -------------
Signature · 1 line
2.21.1
v2 cover introduce iavf backend driver
In reply to Jingjing WuThis series introduces a net device driver called iavfbe which is working as datapath driver for emulated iavf type device. It provides basic function following Intel® Ethernet Adaptive Virtual Function specification, including recevice/transmit packets and virtchnl control messages handling. The driver enabling work is based on the framework mentioned in:
[RFC 0/2] Add device emulation support in DPDK
http://patchwork.dpdk.org/cover/75549/
+------------------------------------------------------+
| +---------------+ +---------------+ |
| | iavf_emudev | | iavfbe_ethdev | |
| | driver | | driver | |
| +---------------+ +---------------+ |
| | | |
| ------------------------------------------- VDEV BUS |
| | | |
| +---------------+ +--------------+ |
+--------------+ | | vdev: | | vdev: | |
| +----------+ | | | /path/to/vfio | |iavf_emudev_# | |
| | Generic | | | +---------------+ +--------------+ |
| | vfio-dev | | | | |
| +----------+ | | | |
| +----------+ | | +----------+ |
| | vfio-user| | | | vfio-user| |
| | client | |<---|----->| server | |
| +----------+ | | +----------+ |
| QEMU/DPDK | | DPDK |
+--------------+ +------------------------------------------------------+This series depends on patch serieses:
[0/9] Introduce vfio-user library:
http://patchwork.dpdk.org/cover/85389/
[0/8]Introduce emudev library and iavf emudev driver
http://patchwork.dpdk.org/cover/85488/
v2:
- extend to support iavf rx interrupt
- extend to support control queue interrupt
- rename some Macros of header file
- fix lock and init in virchnl about queues
- fix some typo
Jingjing Wu (6):
net/iavf_be: introduce iavf backend driver net/iavf_be: control queue enabling net/iavf_be: virtchnl messages process net/iavf_be: add Rx Tx burst support net/iavf_be: extend backend to support iavf rxq_irq
doc: new net PMD iavf_be
MAINTAINERS | 6 + doc/guides/nics/features/iavf_be.ini | 11 + doc/guides/nics/iavf_be.rst | 53 ++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 6 + drivers/net/iavf_be/iavf_be.h | 109 +++ drivers/net/iavf_be/iavf_be_ethdev.c | 964 ++++++++++++++++++++ drivers/net/iavf_be/iavf_be_rxtx.c | 511 +++++++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 165 ++++ drivers/net/iavf_be/iavf_be_vchnl.c | 1113 ++++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 14 + drivers/net/iavf_be/version.map | 3 + drivers/net/meson.build | 1 + 13 files changed, 2957 insertions(+) create mode 100644 doc/guides/nics/features/iavf_be.ini create mode 100644 doc/guides/nics/iavf_be.rst create mode 100644 drivers/net/iavf_be/iavf_be.h create mode 100644 drivers/net/iavf_be/iavf_be_ethdev.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.h create mode 100644 drivers/net/iavf_be/iavf_be_vchnl.c create mode 100644 drivers/net/iavf_be/meson.build create mode 100644 drivers/net/iavf_be/version.map
Signature · 1 line
2.21.1
PATCH v2 1/6 net/iavf_be: introduce iavf backend driver
Introduce driver for iavf backend vdev which is based on vfio-user protocol and emudev libs.
--- drivers/net/iavf_be/iavf_be.h | 39 ++++ drivers/net/iavf_be/iavf_be_ethdev.c | 330 +++++++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 12 + drivers/net/iavf_be/version.map | 3 + drivers/net/meson.build | 1 + 5 files changed, 385 insertions(+) create mode 100644 drivers/net/iavf_be/iavf_be.h create mode 100644 drivers/net/iavf_be/iavf_be_ethdev.c create mode 100644 drivers/net/iavf_be/meson.build create mode 100644 drivers/net/iavf_be/version.map
drivers/net/iavf_be/iavf_be.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#ifndef _IAVF_BE_H_ +#define _IAVF_BE_H_ + +/* Structure to store private data for backend instance*/ +struct iavfbe_adapter { +struct rte_eth_dev *eth_dev; +struct rte_emudev *emu_dev; +uint16_t edev_id;/* Emulated Device ID */ +struct rte_emudev_info dev_info; + +uint16_t nb_qps; +bool link_up; +int cq_irqfd; +rte_atomic32_t irq_enable; + +uint8_t unicast_promisc:1 , + multicast_promisc:1 , + vlan_filter:1 , + vlan_strip:1 ; + +int adapter_stopped; +uint8_t *reset;/* Reset status */ +volatile int started; +}; + +#define IAVFBE_DEV_PRIVATE_TO_ADAPTER (adapter) \ + ((struct iavfbe_adapter *)adapter) + +int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); + +extern int iavfbe_logtype; +#define IAVF_BE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, iavfbe_logtype, "%s(): " fmt "\n", \ + __func__, ## args) +#endif /* _IAVF_BE_H_ */
drivers/net/iavf_be/iavf_be_ethdev.c new file +330 -0
330 lines not on this page · raw message
drivers/net/iavf_be/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +cflags += ['-Wno-strict-aliasing'] + +includes += include_directories('../../common/iavf') + +deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] + +sources = files( + 'iavf_be_ethdev.c', +)
drivers/net/iavf_be/version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_21 { + local: *; +};
drivers/net/meson.build +1 -0
@@ -24,6 +24,7 @@ drivers = ['af_packet', 'hinic', 'hns3', 'iavf', + 'iavf_be', 'ice', 'igc', 'ipn3ke',
Signature · 1 line
2.21.1
PATCH v2 2/6 net/iavf_be: control queue enabling
In reply to Jingjing Wu1. Set up control rx/tx queues.
2. Emu device callback functions implemention.
3. Enabling recv/send msg through control queue.
--- drivers/net/iavf_be/iavf_be.h | 38 ++++ drivers/net/iavf_be/iavf_be_ethdev.c | 321 ++++++++++++++++++++++++++- drivers/net/iavf_be/iavf_be_vchnl.c | 287 ++++++++++++++++++++++++ drivers/net/iavf_be/meson.build | 1 + 4 files changed, 645 insertions(+), 2 deletions(-) create mode 100644 drivers/net/iavf_be/iavf_be_vchnl.c
drivers/net/iavf_be/iavf_be.h +38 -0
@@ -5,13 +5,48 @@ #ifndef _IAVF_BE_H_ #define _IAVF_BE_H_ +#define IAVF_BE_AQ_BUF_SZ 4096 +#define IAVF_BE_32_TO_64(hi, lo) ((((uint64_t)(hi)) << 32) + (lo)) + +#define IAVFBE_READ_32(addr) \ + rte_le_to_cpu_32(*(volatile uint32_t *)(addr)) +#define IAVFBE_WRITE_32(addr, val) \ + *(volatile uint32_t *)(addr) = rte_cpu_to_le_32(val); + +struct iavfbe_control_q { + rte_spinlock_t access_lock; + struct rte_emudev_q_info q_info; + struct iavf_aq_desc *ring; + uint64_t p_ring_addr; /* Guest physical address of the ring */ + uint16_t len; + volatile uint8_t *tail; + volatile uint8_t *head; + + uint16_t next_to_use; + uint16_t next_to_clean; + + uint32_t cmd_retval; /* return value of the cmd response from PF */ + uint8_t *aq_req; /* buffer to store the adminq request from VF, NULL if arq */ +}; + +/* Control queue structure of iavf */ +struct iavfbe_controlq_info { + struct iavfbe_control_q asq; + struct iavfbe_control_q arq; +}; + /* Structure to store private data for backend instance*/ struct iavfbe_adapter { struct rte_eth_dev *eth_dev; struct rte_emudev *emu_dev; uint16_t edev_id; /* Emulated Device ID */ struct rte_emudev_info dev_info; + struct rte_iavf_emu_mem *mem_table; + struct iavfbe_controlq_info cq_info; /* Control/Admin Queue info*/ + /* Adminq handle thread info */ + volatile int thread_status; + pthread_t thread_id; uint16_t nb_qps; bool link_up; int cq_irqfd;
@@ -31,6 +66,9 @@ struct iavfbe_adapter { ((struct iavfbe_adapter *)adapter)int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); +void iavfbe_handle_virtchnl_msg (void *arg); +void iavfbe_reset_asq (struct iavfbe_adapter *adapter,bool lock); +void iavfbe_reset_arq (struct iavfbe_adapter *adapter,bool lock);extern int iavfbe_logtype; #define IAVF_BE_LOG(level, fmt, args...) \
drivers/net/iavf_be/iavf_be_ethdev.c +319 -2
377 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_vchnl.c new file +287 -0
287 lines not on this page · raw message
drivers/net/iavf_be/meson.build +1 -0
@@ -9,4 +9,5 @@ deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] sources = files( 'iavf_be_ethdev.c', + 'iavf_be_vchnl.c', )
Signature · 1 line
2.21.1
PATCH v2 3/6 net/iavf_be: virtchnl messages process
In reply to Jingjing Wu1. Process virtchnl messages from Front End.
2. Ethdev ops implemention for queues setup.
--- drivers/net/iavf_be/iavf_be.h | 32 ++ drivers/net/iavf_be/iavf_be_ethdev.c | 339 ++++++++++- drivers/net/iavf_be/iavf_be_rxtx.c | 164 ++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 105 ++++ drivers/net/iavf_be/iavf_be_vchnl.c | 826 ++++++++++++++++++++++++++- drivers/net/iavf_be/meson.build | 1 + 6 files changed, 1452 insertions(+), 15 deletions(-) create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.c create mode 100644 drivers/net/iavf_be/iavf_be_rxtx.h
drivers/net/iavf_be/iavf_be.h +32 -0
@@ -8,6 +8,19 @@#define IAVF_BE_AQ_BUF_SZ 4096#define IAVF_BE_32_TO_64 (hi, lo) ((((uint64_t)(hi)) << 32) + (lo)) +/* Default setting on number of VSIs that VF can contain */ +#define IAVF_BE_DEFAULT_VSI_NUM 1 +#define AVF_DEFAULT_MAX_MTU 1500 + +/* Set the MAX queues to 16 and MAX vectors to 17 +* as base mode virtchnl support 16 queue pairs mapping in max. +*/ +#define IAVF_BE_MAX_NUM_QUEUES 16 +#define IAVF_BE_MAX_VECTORS 17 +#define IAVF_BE_BUF_SIZE_MIN 1024 +#define IAVF_BE_FRAME_SIZE_MAX 9728 +#define IAVF_BE_NUM_MACADDR_MAX 64 +#define IAVFBE_READ_32 (addr) \ rte_le_to_cpu_32(*(volatile uint32_t *)(addr))#define IAVFBE_WRITE_32 (addr, val) \
@@ -47,8 +60,15 @@ struct iavfbe_adapter {/* Adminq handle thread info */ volatile int thread_status;pthread_t thread_id; + +struct virtchnl_version_info virtchnl_version; +struct virtchnl_vf_resource *vf_res;/* Resource to VF */ +/* Pointer to array of queue pairs info. */ +struct virtchnl_queue_pair_info *qps;uint16_t nb_qps; +uint16_t nb_used_qps;bool link_up; +struct virtchnl_eth_stats eth_stats;/* Stats to VF */ int cq_irqfd;rte_atomic32_t irq_enable;
@@ -65,11 +85,23 @@ struct iavfbe_adapter {#define IAVFBE_DEV_PRIVATE_TO_ADAPTER (adapter) \ ((struct iavfbe_adapter *)adapter) +void iavfbe_reset_all_queues (struct iavfbe_adapter *adapter);int iavfbe_dev_link_update (struct rte_eth_dev *dev,int wait_to_complete); +int iavfbe_lock_lanq (struct iavfbe_adapter *adapter); +int iavfbe_unlock_lanq (struct iavfbe_adapter *adapter); +void iavfbe_notify_vf_reset (struct iavfbe_adapter *adapter);void iavfbe_handle_virtchnl_msg (void *arg);void iavfbe_reset_asq (struct iavfbe_adapter *adapter,bool lock);void iavfbe_reset_arq (struct iavfbe_adapter *adapter,bool lock); +static inline uint64_t stats_update (uint64_t offset,uint64_t stat) +{ +if (stat >= offset) +return (stat - offset); +else +return (uint64_t )(((uint64_t )-1 ) - offset + stat +1 ); +} +extern int iavfbe_logtype; #define IAVF_BE_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, iavfbe_logtype, "%s(): " fmt "\n", \
drivers/net/iavf_be/iavf_be_ethdev.c +326 -13
466 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.c new file +164 -0
164 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.h new file +105 -0
105 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_vchnl.c +824 -2
856 lines not on this page · raw message
drivers/net/iavf_be/meson.build +1 -0
@@ -10,4 +10,5 @@ deps += ['bus_vdev', 'common_iavf', 'vfio_user', 'emu_iavf'] sources = files( 'iavf_be_ethdev.c', 'iavf_be_vchnl.c', + 'iavf_be_rxtx.c', )
Signature · 1 line
2.21.1
PATCH v2 4/6 net/iavf_be: add Rx Tx burst support
In reply to Jingjing WuEnable packets revcieve and transmit functions.
--- drivers/net/iavf_be/iavf_be_ethdev.c | 3 + drivers/net/iavf_be/iavf_be_rxtx.c | 342 +++++++++++++++++++++++++++ drivers/net/iavf_be/iavf_be_rxtx.h | 60 +++++ 3 files changed, 405 insertions(+)
drivers/net/iavf_be/iavf_be_ethdev.c +3 -0
@@ -864,6 +864,9 @@ eth_dev_iavfbe_create(struct rte_vdev_device *dev,rte_ether_addr_copy (addr, ð_dev->data->mac_addrs[0 ]); eth_dev->dev_ops = &iavfbe_eth_dev_ops; + eth_dev->rx_pkt_burst = &iavfbe_recv_pkts; + eth_dev->tx_pkt_burst = &iavfbe_xmit_pkts; + eth_dev->tx_pkt_prepare = &iavfbe_prep_pkts; eth_dev->data->dev_link = iavfbe_link; eth_dev->data->numa_node = dev->device.numa_node;
drivers/net/iavf_be/iavf_be_rxtx.c +342 -0
345 lines not on this page · raw message
drivers/net/iavf_be/iavf_be_rxtx.h +60 -0
65 lines not on this page · raw message
Signature · 1 line
2.21.1
PATCH v2 5/6 net/iavf_be: extend backend to support iavf rxq_irq
In reply to Jingjing Wu--- drivers/net/iavf_be/iavf_be_ethdev.c | 3 ++- drivers/net/iavf_be/iavf_be_rxtx.c | 5 +++++ drivers/net/iavf_be/iavf_be_vchnl.c | 8 ++++++-- 3 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/iavf_be/iavf_be_ethdev.c +2 -1
@@ -382,7 +382,6 @@ iavfbe_new_device(struct rte_emudev *dev) adapter->reset = (uint8_t *)(uintptr_t )addr;IAVFBE_WRITE_32 (adapter->reset,RTE_IAVF_EMU_RESET_COMPLETED ); adapter->started =1 ; -printf ("NEW DEVICE: memtable, %p\n" , adapter->mem_table);return 0 ; }
@@ -465,6 +464,7 @@ iavfbe_update_device(struct rte_emudev *dev) "Can not get irq info of rxq %d\n", i);return -1 ; } + rxq->kickfd = irq_info.eventfd;rte_atomic32_set (&rxq->irq_enable, irq_info.enable); }
@@ -479,6 +479,7 @@ iavfbe_update_device(struct rte_emudev *dev) "Can not get irq info of txq %d\n", i);return -1 ; } + txq->callfd = irq_info.eventfd;rte_atomic32_set (&txq->irq_enable, irq_info.enable); }
drivers/net/iavf_be/iavf_be_rxtx.c +5 -0
@@ -5,6 +5,7 @@#include <unistd.h> #include <inttypes.h> #include <sys/queue.h> +#include <sys/eventfd.h> #include <rte_string_fns.h> #include <rte_mbuf.h>
@@ -461,6 +462,10 @@ iavfbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) end_of_xmit: txq->rx_head = head; txq->stats.sent_miss_num += nb_pkts - nb_tx; + +if (rte_atomic32_read (&txq->irq_enable) == true) +eventfd_write (txq->callfd, (eventfd_t )1 ); + end_unlock:rte_spinlock_unlock (&txq->access_lock);
drivers/net/iavf_be/iavf_be_vchnl.c +6 -2
@@ -95,12 +95,15 @@ apply_tx_irq(struct iavfbe_tx_queue *txq, uint16_t vector) {struct rte_emudev_irq_info info; +rte_spinlock_lock (&txq->access_lock); txq->vector = vector;if (rte_emudev_get_irq_info (txq->adapter->edev_id, vector, &info)) {IAVF_BE_LOG (ERR ,"Can not get irq info\n" );return IAVF_ERR_DEVICE_NOT_SUPPORTED ; } txq->callfd = info.eventfd; +rte_atomic32_set (&txq->irq_enable, info.enable); +rte_spinlock_unlock (&txq->access_lock);return 0 ; }
@@ -110,12 +113,15 @@ apply_rx_irq(struct iavfbe_rx_queue *rxq, uint16_t vector) {struct rte_emudev_irq_info info; +rte_spinlock_lock (&rxq->access_lock); rxq->vector = vector;if (rte_emudev_get_irq_info (rxq->adapter->edev_id, vector, &info)) {IAVF_BE_LOG (ERR ,"Can not get irq info\n" );return IAVF_ERR_DEVICE_NOT_SUPPORTED ; } rxq->kickfd = info.eventfd; +rte_atomic32_set (&rxq->irq_enable, info.enable); +rte_spinlock_unlock (&rxq->access_lock);return 0 ; }
@@ -557,13 +563,11 @@ iavfbe_process_cmd_config_irq_map(struct iavfbe_adapter *adapter, txq = dev->data->tx_queues[j];if ((1 << j) & map->rxq_map) { - txq->vector = vector_id; ret =apply_tx_irq (txq, vector_id);if (ret) goto send_msg; }if ((1 << j) & map->txq_map) { - rxq->vector = vector_id; ret =apply_rx_irq (rxq, vector_id);if (ret) goto send_msg;
Signature · 1 line
2.21.1
PATCH v2 6/6 doc: new net PMD iavf_be
In reply to Jingjing Wu--- MAINTAINERS | 6 +++ doc/guides/nics/features/iavf_be.ini | 11 ++++++ doc/guides/nics/iavf_be.rst | 53 ++++++++++++++++++++++++++ doc/guides/nics/index.rst | 1 + doc/guides/rel_notes/release_21_02.rst | 6 +++ 5 files changed, 77 insertions(+) create mode 100644 doc/guides/nics/features/iavf_be.ini create mode 100644 doc/guides/nics/iavf_be.rst
MAINTAINERS +6 -0
@@ -707,6 +707,12 @@ F: drivers/net/iavf/ F: drivers/common/iavf/ F: doc/guides/nics/features/iavf*.ini +Intel iavf_be +M: Jingjing Wu <[email protected]> +T: git://dpdk.org/next/dpdk-next-net-intel +F: drivers/net/iavf_be/ +F: doc/guides/nics/features/iavf_be*.ini + Intel ice M: Qiming Yang <[email protected]> M: Qi Zhang <[email protected]>
doc/guides/nics/features/iavf_be.ini new file +11 -0
@@ -0,0 +1,11 @@ +; +; Supported features of the 'iavf_be' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Promiscuous mode = Y +Allmulticast mode = Y +Basic stats = Y +Scattered Rx = Y +x86-64 = Y
doc/guides/nics/iavf_be.rst new file +53 -0
53 lines not on this page · raw message
doc/guides/nics/index.rst +1 -0
@@ -30,6 +30,7 @@ Network Interface Controller Drivers hinic hns3 i40e + iavf_be ice igb igc
doc/guides/rel_notes/release_21_02.rst +6 -0
@@ -83,6 +83,12 @@ New Features See :doc:`../prog_guide/emudev` for more information. +* **Added iavf_be net driver.** + + Added a Polling Mode Driver iavf_be as software backend for Intel® AVF Ethernet device. + + See :doc:`../nics/iavf_be.rst` for more information. + Removed Items -------------
Signature · 1 line
2.21.1