[dpdk-dev] [PATCH v5 0/5] lib: add Port Representors

Remy Horton remy.horton at intel.com
Wed Jan 10 16:54:01 CET 2018


Port Representors provide a logical presentation in DPDK of VF (virtual 
function) ports for the purposes of control and monitoring. Each port 
representor device represents a single VF and is associated with it's 
parent physical function (PF) PMD which provides the back-end hooks for 
the representor device ops and defines the control domain to which that 
port belongs. This allows to use existing DPDK APIs to monitor and control 
the port without the need to create and maintain VF specific APIs.

+-----------------------------+   +---------------+  +---------------+
|        Control Plane        |   |   Data Plane  |  |   Data Plane  |
|         Application         |   |   Application |  |   Application |
+-----------------------------+   +---------------+  +---------------+
|         eth dev api         |   |  eth dev api  |  |  eth dev api  |
+-----------------------------+   +---------------+  +---------------+
+-------+  +-------+  +-------+   +---------------+  +---------------+
|  PF0  |  | Port  |  | Port  |   |    VF0 PMD    |  |    VF0 PMD    |
|  PMD  <--+ Rep 0 |  | Rep 1 |   +---------------+  +------+--------+
|       |  | PMD   |  | PMD   |                             |
+---+--^+  +-------+  +-+-----+                             |
    |  |                |  |                                |
    |  +----------------+  |                                |
    |                      |                                |
    |                      |                                |
+--------------------------------+                          |
|   |  HW (logical view)   |     |                          |
| --+------+ +-------+ +---+---+ |                          |
| |   PF   | |  VF0  | |  VF1  | |                          |
| |        | |       | |       +----------------------------+
| +--------+ +-------+ +-------+ |
| +----------------------------+ |
| |        VEB                 | |
| +----------------------------+ |
| +--------+                     |
| |  Port  |                     |
| |   0    |                     |
| +--------+                     |
+--------------------------------+

The figure above shows a deployment where the PF is bound to a DPDK control
plane application which uses representor ports to manage the configuration and
monitoring of it's VF ports. Each virtual function is represented in the
application by a representor port PMD which enables control of the corresponding
VF through eth dev APIs on the representor PMD such as:

- void rte_eth_promiscuous_enable(uint8_t port_id);
- void rte_eth_promiscuous_disable(uint8_t port_id);
- void rte_eth_allmulticast_enable(uint8_t port_id);
- void rte_eth_allmulticast_disable(uint8_t port_id);
- int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
	uint32_t pool);
- int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);

as well as monitoring through API's like

- void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
- int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);

The port representor infrastructure is enabled through a single common, device
independent, virtual PMD whos context is initialized and enabled through a
broker instance running within the context of the physical function device
driver.

+-------------------------+       +-------------------------+
|        rte_ethdev       |       |       rte_ethdev        |
+-------------------------+       +-------------------------+
|  Physical Function PMD  |       |  Port Reperesentor PMD  |
|         +-------------+ |       | +---------+ +---------+ |
|         | Representor | |       | | dev_data| | dev_ops | |
|         |    Broker   | |       | +----+----+ +----+----+ |
|         | +---------+ | |       +------|-----------|------+
|         | | VF Port | | |              |           |
|         | | Context +------------------+           |
|         | +---------+ | |                          |
|         | +---------+ | |                          |
|         | | Handler +------------------------------+
|         | |   Ops   | | |
|         | +---------+ | |
|         +-------------+ |
+-------------------------+

As the port representor model is based around the paradigm of using standard
port based APIs, it will allow future expansion of functionality without the
need to add new APIs. For example it should be possible to support configuration
of egress QoS parameters using existing TM APIs by extending the port
representor PMD/broker infrastructure.

Changes in v2:
* Rebased to DPDK 17.11

Changes in v3:
* Removed RTE_ETH_DEV_REPRESENTOR_PORT define
* Removed switch_domain from struct rte_eth_dev_info
  (to be reintroduced seperately when required).
* Port Representor PMD functionality merged into main library
* Removed functions from .map file that are not for use by applications
* Some minor bugfixes (uninitalised variables & NULL terminators)
* Use of SPDX licence headers in new files
* Seperate headers for PMD and application
* SPDX-License-Identifier in new files
* Added test-pmd representor add/del commands

Changes in v4:
* Added documentation
* Rebased to a12f22678915

Changes in v5:
* Documentation changes & additions
* Config file correctons
* Logging functions use library-specific tag
* Error-path memory leaks fixed
* Port Rep state enum moved out of struct
* Added rte_representor_enabled to .map
* PMD-specific files renamed for clarity
* In testpmd changed command to "port representor add|del <pf> <vf>"
* Added missing testpmd help
* Minor bugfix in handling of removal of i40e VF MAC addresses
* Removed "All rights reserved" from copyright.


Remy Horton (5):
  lib: add Port Representor library
  eal: add Port Representor command-line option
  drivers/net/i40e: add Port Representor functionality
  drivers/net/ixgbe: add Port Representor functionality
  app/test-pmd: add Port Representor commands

 MAINTAINERS                                        |  13 +-
 app/test-pmd/cmdline.c                             |  80 ++++
 config/common_base                                 |   5 +
 doc/api/doxy-api-index.md                          |   1 +
 doc/api/doxy-api.conf                              |   1 +
 doc/guides/prog_guide/index.rst                    |   1 +
 doc/guides/prog_guide/representor_lib.rst          |  62 +++
 doc/guides/rel_notes/release_18_02.rst             |  12 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst        |  26 ++
 drivers/net/i40e/Makefile                          |   2 +
 drivers/net/i40e/i40e_ethdev.c                     |  19 +
 drivers/net/i40e/i40e_ethdev.h                     |   1 +
 drivers/net/i40e/i40e_port_representor_ops.c       | 516 +++++++++++++++++++++
 drivers/net/i40e/i40e_port_representor_ops.h       |  19 +
 drivers/net/i40e/rte_pmd_i40e.c                    |  43 ++
 drivers/net/i40e/rte_pmd_i40e.h                    |  18 +
 drivers/net/i40e/rte_pmd_i40e_version.map          |   7 +
 drivers/net/ixgbe/Makefile                         |   2 +
 drivers/net/ixgbe/ixgbe_ethdev.c                   |  29 +-
 drivers/net/ixgbe/ixgbe_ethdev.h                   |   5 +
 drivers/net/ixgbe/ixgbe_port_representor_ops.c     | 274 +++++++++++
 drivers/net/ixgbe/ixgbe_port_representor_ops.h     |  19 +
 lib/Makefile                                       |   3 +
 lib/librte_eal/bsdapp/eal/eal.c                    |   6 +
 lib/librte_eal/common/eal_common_log.c             |   1 +
 lib/librte_eal/common/eal_common_options.c         |   1 +
 lib/librte_eal/common/eal_internal_cfg.h           |   2 +
 lib/librte_eal/common/eal_options.h                |   2 +
 lib/librte_eal/common/include/rte_eal.h            |   8 +
 lib/librte_eal/common/include/rte_log.h            |   1 +
 lib/librte_eal/linuxapp/eal/eal.c                  |   9 +
 lib/librte_eal/rte_eal_version.map                 |   1 +
 lib/librte_representor/Makefile                    |  26 ++
 lib/librte_representor/rte_port_representor.c      | 345 ++++++++++++++
 lib/librte_representor/rte_port_representor.h      |  60 +++
 .../rte_port_representor_driver.h                  | 140 ++++++
 .../rte_port_representor_version.map               |   8 +
 mk/rte.app.mk                                      |   1 +
 38 files changed, 1767 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/prog_guide/representor_lib.rst
 create mode 100644 drivers/net/i40e/i40e_port_representor_ops.c
 create mode 100644 drivers/net/i40e/i40e_port_representor_ops.h
 create mode 100644 drivers/net/ixgbe/ixgbe_port_representor_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_port_representor_ops.h
 create mode 100644 lib/librte_representor/Makefile
 create mode 100644 lib/librte_representor/rte_port_representor.c
 create mode 100644 lib/librte_representor/rte_port_representor.h
 create mode 100644 lib/librte_representor/rte_port_representor_driver.h
 create mode 100644 lib/librte_representor/rte_port_representor_version.map

-- 
2.9.5



More information about the dev mailing list