Skip to contentSkip to conversation

Port Representor for control and monitoring of VF devices

RFC In review Mohammad Abdul Awal 4 participants 15 messages Sep 7, 2017 – Jan 2, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

cover Port Representor for control and monitoring of VF devices

---
This RFC introduces a port representor based model for the control, management and monitoring of SR-IOV virtual function (VF) devices for control plane applications which have bound the devices physical function.

Port Representors are virtual poll mode drivers (PMD) which provide a logical representation in DPDK for VF ports for control and monitoring. Each port representor PMD 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   | | |
|         | +---------+ | |
|         +-------------+ |
+-------------------------+

Creation of representor ports can be achieved either through the --vdev EAL option or through the rte_vdev_init() API. Each port representor requires the BDF of it's parent PF and the Virtual Function ID of the port which the representor will support. During initialization of the representor PMD, it calls the broker API to register itself with the PF PMD and to get it's context configured which includes the setting up of it's context and ops function handlers.

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.

Mohammad Abdul Awal (5):
Implemented port representor broker infrastructure, created BDF to
port function.
added --enable-representor command line argument in EAL to load
representor broker infrastructure.
Implement port representor PMD
Enable port representor PMD and broker for fortville PMD driver Enable port representor PMD and broker for ixgbe PMD driver.

 config/common_base                                 |   5 +
 drivers/net/Makefile                               |   2 +
 drivers/net/i40e/Makefile                          |   1 +
 drivers/net/i40e/i40e_ethdev.c                     |  17 +
 drivers/net/i40e/i40e_prep_ops.c                   | 402 +++++++++
 drivers/net/i40e/i40e_prep_ops.h                   |  41 +
 drivers/net/i40e/rte_pmd_i40e.c                    |  47 +
 drivers/net/i40e/rte_pmd_i40e.h                    |  18 +
 drivers/net/ixgbe/Makefile                         |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                   |  33 +-
 drivers/net/ixgbe/ixgbe_ethdev.h                   |  11 +
 drivers/net/ixgbe/ixgbe_prep_ops.c                 | 279 ++++++
 drivers/net/ixgbe/ixgbe_prep_ops.h                 |  41 +
 drivers/net/representor/Makefile                   |  51 ++
 drivers/net/representor/rte_eth_representor.c      | 973 +++++++++++++++++++++
 .../representor/rte_pmd_representor_version.map    |   4 +
 lib/librte_eal/bsdapp/eal/eal.c                    |   6 +
 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/linuxapp/eal/eal.c                  |   9 +
 lib/librte_ether/Makefile                          |   2 +
 lib/librte_ether/rte_ethdev.c                      |  93 ++
 lib/librte_ether/rte_ethdev.h                      |  26 +
 lib/librte_ether/rte_ethdev_vdev.h                 |  37 +-
 lib/librte_ether/rte_ether_version.map             |   9 +
 lib/librte_ether/rte_port_representor.c            | 160 ++++
 lib/librte_ether/rte_port_representor.h            | 289 ++++++
 mk/rte.app.mk                                      |   1 +
 30 files changed, 2556 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/i40e/i40e_prep_ops.c
 create mode 100644 drivers/net/i40e/i40e_prep_ops.h
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.h
 create mode 100644 drivers/net/representor/Makefile
 create mode 100644 drivers/net/representor/rte_eth_representor.c
 create mode 100644 drivers/net/representor/rte_pmd_representor_version.map
 create mode 100644 lib/librte_ether/rte_port_representor.c
 create mode 100644 lib/librte_ether/rte_port_representor.h
Signature · 1 line
2.7.4
#1 lore raw

RFC 1/5 Implemented port representor broker infrastructure, created BDF to port function.

---
 lib/librte_ether/Makefile               |   2 +
 lib/librte_ether/rte_ethdev.c           |  93 ++++++++++
 lib/librte_ether/rte_ethdev.h           |  26 +++
 lib/librte_ether/rte_ether_version.map  |   9 +
 lib/librte_ether/rte_port_representor.c | 160 ++++++++++++++++++
 lib/librte_ether/rte_port_representor.h | 289 ++++++++++++++++++++++++++++++++
 6 files changed, 579 insertions(+)
 create mode 100644 lib/librte_ether/rte_port_representor.c
 create mode 100644 lib/librte_ether/rte_port_representor.h
lib/librte_ether/Makefile +2 -0
index db692ae..b61a84b 100644
@@ -46,6 +46,7 @@ LIBABIVER := 6
 SRCS-y += rte_ethdev.c
 SRCS-y += rte_flow.c
 SRCS-y += rte_tm.c
+SRCS-y += rte_port_representor.c
 
 #
 # Export include files
@@ -59,5 +60,6 @@ SYMLINK-y-include += rte_flow.h
 SYMLINK-y-include += rte_flow_driver.h
 SYMLINK-y-include += rte_tm.h
 SYMLINK-y-include += rte_tm_driver.h
+SYMLINK-y-include += rte_port_representor.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_ether/rte_ethdev.c +93 -0

105 lines not on this page · raw message

lib/librte_ether/rte_ethdev.h +26 -0
index 0adf327..9342e45 100644
@@ -967,6 +967,7 @@ struct rte_eth_dev_info {
 	/** Configured number of rx/tx queues */
 	uint16_t nb_rx_queues; /**< Number of RX queues. */
 	uint16_t nb_tx_queues; /**< Number of TX queues. */
+	uint16_t switch_domain; /**< Switch domain which port belongs to. */
 };
 
 /**
@@ -1618,6 +1619,8 @@ enum rte_eth_dev_state {
 	RTE_ETH_DEV_DEFERRED,
 };
 
+struct rte_representor_broker;
+
 /**
  * @internal
  * The generic data structure associated with each ethernet device.
@@ -1633,6 +1636,8 @@ struct rte_eth_dev {
 	eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
 	eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
 	struct rte_eth_dev_data *data;  /**< Pointer to device data */
+	struct rte_port_representor_broker *rep_broker;
+	/**< Pointer to representor broker */
 	const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
 	struct rte_device *device; /**< Backing device */
 	struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
@@ -1711,6 +1716,7 @@ struct rte_eth_dev_data {
 	int numa_node;  /**< NUMA node connection */
 	struct rte_vlan_filter_conf vlan_filter_conf;
 	/**< VLAN filter configuration. */
+	uint16_t switch_domain; /**< Switch domain which port belongs to. */
 };
 
 /** Device supports hotplug detach */
@@ -1730,6 +1736,12 @@ struct rte_eth_dev_data {
 extern struct rte_eth_dev rte_eth_devices[];
 
 /**
+ * The pci device list needed to map the PF BDF to port id mapping for
+ * port representor pmd argument parsing.
+ */
+extern struct rte_pci_bus rte_pci_bus;
+
+/**
  * Iterates over valid ethdev ports.
  *
  * @param port_id
@@ -4436,6 +4448,20 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
 				     uint16_t *nb_rx_desc,
 				     uint16_t *nb_tx_desc);
 
+/**
+* Get the port id from (E)BDF PCI address.
+*
+* @param pci_str
+*  Address as string
+* @param port_id
+*   pointer to port identifier of the device
+* @return
+*   - (0) if successful and port_id is filled.
+*   - (-ENODEV or -EINVAL) on failure.
+*/
+int rte_eth_dev_get_port_by_pci_addr_str(const char *pci_str, uint8_t *port_id);
+
+
 #ifdef __cplusplus
 }
 #endif
lib/librte_ether/rte_ether_version.map +9 -0
index 4283728..c08d469 100644
@@ -187,3 +187,12 @@ DPDK_17.08 {
 	rte_tm_wred_profile_delete;
 
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_representor_broker_init;
+	rte_representor_add;
+	rte_representor_broker_fini;
+
+} DPDK_17.08;
lib/librte_ether/rte_port_representor.c new file +160 -0

160 lines not on this page · raw message

lib/librte_ether/rte_port_representor.h new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

RFC 2/5 added --enable-representor command line argument in EAL to load representor broker infrastructure.

In reply to Mohammad Abdul Awal
---
 lib/librte_eal/bsdapp/eal/eal.c            | 6 ++++++
 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/linuxapp/eal/eal.c          | 9 +++++++++
 6 files changed, 28 insertions(+)
lib/librte_eal/bsdapp/eal/eal.c +6 -0
index 5fa5988..d1a3c79 100644
@@ -698,3 +698,9 @@ rte_eal_process_type(void)
 {
 	return rte_config.process_type;
 }
+
+/* return non-zero if port-representor is enabled. */
+int rte_representor_enabled(void)
+{
+	return internal_config.enable_representor;
+}
lib/librte_eal/common/eal_common_options.c +1 -0
index 1da185e..f9c0b42 100644
@@ -78,6 +78,7 @@ const struct option
 eal_long_options[] = {
 	{OPT_BASE_VIRTADDR,     1, NULL, OPT_BASE_VIRTADDR_NUM    },
 	{OPT_CREATE_UIO_DEV,    0, NULL, OPT_CREATE_UIO_DEV_NUM   },
+	{OPT_ENABLE_REPRESENTOR, 0, NULL, OPT_ENABLE_REPRESENTOR_NUM   },
 	{OPT_FILE_PREFIX,       1, NULL, OPT_FILE_PREFIX_NUM      },
 	{OPT_HELP,              0, NULL, OPT_HELP_NUM             },
 	{OPT_HUGE_DIR,          1, NULL, OPT_HUGE_DIR_NUM         },
lib/librte_eal/common/eal_internal_cfg.h +2 -0
index 7b7e8c8..d0b3080 100644
@@ -72,6 +72,8 @@ struct internal_config {
 										* instead of native TSC */
 	volatile unsigned no_shconf;      /**< true if there is no shared config */
 	volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */
+	volatile unsigned enable_representor;
+	/**< true to enable port representor broker for all PFs */
 	volatile enum rte_proc_type_t process_type; /**< multi-process proc type */
 	/** true to try allocating memory on specific sockets */
 	volatile unsigned force_sockets;
lib/librte_eal/common/eal_options.h +2 -0
index 439a261..a8be6e3 100644
@@ -49,6 +49,8 @@ enum {
 	OPT_BASE_VIRTADDR_NUM,
 #define OPT_CREATE_UIO_DEV    "create-uio-dev"
 	OPT_CREATE_UIO_DEV_NUM,
+#define OPT_ENABLE_REPRESENTOR    "enable-representor"
+	OPT_ENABLE_REPRESENTOR_NUM,
 #define OPT_FILE_PREFIX       "file-prefix"
 	OPT_FILE_PREFIX_NUM,
 #define OPT_HUGE_DIR          "huge-dir"
lib/librte_eal/common/include/rte_eal.h +8 -0
index 0e7363d..4d4a6ce 100644
@@ -287,6 +287,14 @@ static inline int rte_gettid(void)
 	return RTE_PER_LCORE(_thread_id);
 }
 
+/**
+ * Get flag for port representor should be enabled or not.
+ *
+ * @return
+ *   Returns the enable-representor flag.
+ */
+int rte_representor_enabled(void);
+
 #define RTE_INIT(func) \
 static void __attribute__((constructor, used)) func(void)
 
lib/librte_eal/linuxapp/eal/eal.c +9 -0
index 48f12f4..165da30 100644
@@ -610,6 +610,10 @@ eal_parse_args(int argc, char **argv)
 			internal_config.create_uio_dev = 1;
 			break;
 
+		case OPT_ENABLE_REPRESENTOR_NUM:
+			internal_config.enable_representor = 1;
+			break;
+
 		default:
 			if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
 				RTE_LOG(ERR, EAL, "Option %c is not supported "
@@ -1016,3 +1020,8 @@ rte_eal_check_module(const char *module_name)
 	/* Module has been found */
 	return 1;
 }
+
+int rte_representor_enabled(void)
+{
+	return internal_config.enable_representor;
+}
Signature · 1 line
2.7.4
#3 lore raw

RFC 3/5 Implement port representor PMD

In reply to Mohammad Abdul Awal
---
 config/common_base                                 |   5 +
 drivers/net/Makefile                               |   2 +
 drivers/net/representor/Makefile                   |  51 ++
 drivers/net/representor/rte_eth_representor.c      | 973 +++++++++++++++++++++
 .../representor/rte_pmd_representor_version.map    |   4 +
 lib/librte_ether/rte_ethdev_vdev.h                 |  37 +-
 mk/rte.app.mk                                      |   1 +
 7 files changed, 1070 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/representor/Makefile
 create mode 100644 drivers/net/representor/rte_eth_representor.c
 create mode 100644 drivers/net/representor/rte_pmd_representor_version.map
config/common_base +5 -0
index 5e97a08..d7ba871 100644
@@ -750,3 +750,8 @@ CONFIG_RTE_APP_CRYPTO_PERF=y
 # Compile the eventdev application
 #
 CONFIG_RTE_APP_EVENTDEV=y
+
+#
+# Compile representor PMD
+#
+CONFIG_RTE_LIBRTE_PMD_REPRESENTOR=y
drivers/net/Makefile +2 -0
index d33c959..1b76a42 100644
@@ -83,6 +83,8 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
 DEPDIRS-pcap = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede
 DEPDIRS-qede = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_REPRESENTOR) += representor
+DEPDIRS-representor = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
 DEPDIRS-ring = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc
drivers/net/representor/Makefile new file +51 -0

51 lines not on this page · raw message

drivers/net/representor/rte_eth_representor.c new file +973 -0

973 lines not on this page · raw message

drivers/net/representor/rte_pmd_representor_version.map new file +4 -0
new file mode 100644
index 0000000..ef35398
@@ -0,0 +1,4 @@
+DPDK_2.0 {
+
+	local: *;
+};
lib/librte_ether/rte_ethdev_vdev.h +34 -3
index 4d2c3e2..7aaaca3 100644
@@ -49,18 +49,29 @@
  * @param private_data_size
  *	Size of private data structure
  *
+ * @param override_name
+ *	Given name for the vdev instead of default one
+ *
  * @return
  *	A pointer to a rte_eth_dev or NULL if allocation failed.
  */
 static inline struct rte_eth_dev *
-rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
+rte_eth_vdev_allocate_2(struct rte_vdev_device *dev, size_t private_data_size,
+	const char *override_name)
 {
 	struct rte_eth_dev *eth_dev;
-	const char *name = rte_vdev_device_name(dev);
+	const char *name;
+
+	if (override_name)
+		name = override_name;
+	else
+		name = rte_vdev_device_name(dev);
 
 	eth_dev = rte_eth_dev_allocate(name);
-	if (!eth_dev)
+	if (!eth_dev) {
+		printf("FAILED!\n");
 		return NULL;
+	}
 
 	if (private_data_size) {
 		eth_dev->data->dev_private = rte_zmalloc_socket(name,
@@ -80,4 +91,24 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
 	return eth_dev;
 }
 
+/**
+ * @internal
+ * Allocates a new ethdev slot for an ethernet device and returns the pointer
+ * to that slot for the driver to use.
+ *
+ * @param dev
+ *	Pointer to virtual device
+ *
+ * @param private_data_size
+ *	Size of private data structure
+ *
+ * @return
+ *	A pointer to a rte_eth_dev or NULL if allocation failed.
+ */
+static inline struct rte_eth_dev *
+rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
+{
+	return rte_eth_vdev_allocate_2(dev, private_data_size, NULL);
+}
+
 #endif /* _RTE_ETHDEV_VDEV_H_ */
mk/rte.app.mk +1 -0
index c25fdd9..3dbbe3a 100644
@@ -132,6 +132,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -lrte_pmd_mlx4 -libverbs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -lrte_pmd_mlx5 -libverbs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD)        += -lrte_pmd_nfp
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_REPRESENTOR) += -lrte_pmd_representor
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)       += -lrte_pmd_pcap -lpcap
 _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD)       += -lrte_pmd_qede
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)       += -lrte_pmd_ring
Signature · 1 line
2.7.4
#4 lore raw

RFC 4/5 Enable port representor PMD and broker for fortville PMD driver

In reply to Mohammad Abdul Awal
---
 drivers/net/i40e/Makefile        |   1 +
 drivers/net/i40e/i40e_ethdev.c   |  17 ++
 drivers/net/i40e/i40e_prep_ops.c | 402 +++++++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_prep_ops.h |  41 ++++
 drivers/net/i40e/rte_pmd_i40e.c  |  47 +++++
 drivers/net/i40e/rte_pmd_i40e.h  |  18 ++
 6 files changed, 526 insertions(+)
 create mode 100644 drivers/net/i40e/i40e_prep_ops.c
 create mode 100644 drivers/net/i40e/i40e_prep_ops.h
drivers/net/i40e/Makefile +1 -0
index 55c79a6..a299a1e 100644
@@ -110,6 +110,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_fdir.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_flow.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += rte_pmd_i40e.c
 SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_tm.c
+SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_prep_ops.c
 
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
drivers/net/i40e/i40e_ethdev.c +17 -0
index 5f26e24..942a587 100644
@@ -65,6 +65,7 @@
 #include "i40e_rxtx.h"
 #include "i40e_pf.h"
 #include "i40e_regs.h"
+#include "i40e_prep_ops.h"
 
 #define ETH_I40E_FLOATING_VEB_ARG	"enable_floating_veb"
 #define ETH_I40E_FLOATING_VEB_LIST_ARG	"floating_veb_list"
@@ -1045,6 +1046,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	int ret;
 	uint32_t len;
 	uint8_t aq_fail = 0;
+	struct rte_port_representor_broker *rb;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1088,6 +1090,17 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
 	hw->bus.func = pci_dev->addr.function;
 	hw->adapter_stopped = 0;
 
+	/* init representor broker */
+	if (rte_representor_enabled()) {
+		rb = rte_representor_broker_init(dev, pci_dev->max_vfs,
+			rte_i40e_prep_ops);
+		if (rb == NULL) {
+			PMD_INIT_LOG(ERR, "Cannot allocate memory for "
+				"representor broker data\n");
+			return errno;
+		}
+	}
+
 	/* Make sure all is clean before doing PF reset */
 	i40e_clear_hw(hw);
 
@@ -2130,6 +2143,10 @@ i40e_dev_close(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
+	/* free port representor pmds */
+	if (rte_representor_enabled())
+		rte_representor_broker_free(dev->data->port_id);
+
 	i40e_dev_stop(dev);
 	i40e_dev_free_queues(dev);
 
drivers/net/i40e/i40e_prep_ops.c new file +402 -0

402 lines not on this page · raw message

drivers/net/i40e/i40e_prep_ops.h new file +41 -0

41 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.c +47 -0

53 lines not on this page · raw message

drivers/net/i40e/rte_pmd_i40e.h +18 -0
index 356fa89..812d4dc 100644
@@ -275,6 +275,24 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
 				 struct ether_addr *mac_addr);
 
 /**
+ * Remove the VF MAC address.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf_id
+ *   VF id.
+ * @param mac_addr
+ *   VF MAC address.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
+ */
+int
+rte_pmd_i40e_remove_vf_mac_addr(uint8_t port, uint16_t vf_id,
+	struct ether_addr *mac_addr);
+
+/**
  * Enable/Disable vf vlan strip for all queues in a pool
  *
  * @param port
Signature · 1 line
2.7.4
#5 lore raw

RFC 5/5 Enable port representor PMD and broker for ixgbe PMD driver.

In reply to Mohammad Abdul Awal
---
 drivers/net/ixgbe/Makefile         |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   |  33 +++--
 drivers/net/ixgbe/ixgbe_ethdev.h   |  11 ++
 drivers/net/ixgbe/ixgbe_prep_ops.c | 279 +++++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_prep_ops.h |  41 ++++++
 5 files changed, 353 insertions(+), 13 deletions(-)
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.h
drivers/net/ixgbe/Makefile +1 -1
index 5e57cb3..f216b97 100644
@@ -1,7 +1,6 @@
 #   BSD LICENSE
 #
 #   Copyright(c) 2010-2016 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
@@ -125,6 +124,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_82599_bypass.c
 endif
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += rte_pmd_ixgbe.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_tm.c
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_prep_ops.c
 
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
drivers/net/ixgbe/ixgbe_ethdev.c +21 -12
index 22171d8..80d5d34 100644
@@ -2,7 +2,6 @@
  *   BSD LICENSE
  *
  *   Copyright(c) 2010-2017 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
@@ -72,6 +71,7 @@
 #include "base/ixgbe_type.h"
 #include "base/ixgbe_phy.h"
 #include "ixgbe_regs.h"
+#include "ixgbe_prep_ops.h"
 
 /*
  * High threshold controlling when to start sending XOFF frames. Must be at
@@ -173,8 +173,6 @@ static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
-static int ixgbe_dev_link_update(struct rte_eth_dev *dev,
-				int wait_to_complete);
 static void ixgbe_dev_stats_get(struct rte_eth_dev *dev,
 				struct rte_eth_stats *stats);
 static int ixgbe_dev_xstats_get(struct rte_eth_dev *dev,
@@ -205,8 +203,6 @@ static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
 			       struct rte_eth_dev_info *dev_info);
 static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
-static void ixgbevf_dev_info_get(struct rte_eth_dev *dev,
-				 struct rte_eth_dev_info *dev_info);
 static int ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
 static int ixgbe_vlan_filter_set(struct rte_eth_dev *dev,
@@ -267,9 +263,6 @@ static void ixgbevf_dev_stop(struct rte_eth_dev *dev);
 static void ixgbevf_dev_close(struct rte_eth_dev *dev);
 static void ixgbevf_intr_disable(struct ixgbe_hw *hw);
 static void ixgbevf_intr_enable(struct ixgbe_hw *hw);
-static void ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
-		struct rte_eth_stats *stats);
-static void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
 static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
 		uint16_t vlan_id, int on);
 static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev,
@@ -1131,6 +1124,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 	uint32_t ctrl_ext;
 	uint16_t csum;
 	int diag, i;
+	struct rte_port_representor_broker *rep_broker;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1248,6 +1242,17 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev)
 		return -EIO;
 	}
 
+	/* Init port representor broker */
+	if (rte_representor_enabled()) {
+		rep_broker = rte_representor_broker_init(eth_dev,
+			pci_dev->max_vfs, rte_ixgbe_prep_ops);
+		if (rep_broker == NULL) {
+			PMD_INIT_LOG(ERR, "Cannot allocate memory for "
+				"representor broker data\n");
+			return errno;
+		}
+	}
+
 	/* Reset the hw statistics */
 	ixgbe_dev_stats_reset(eth_dev);
 
@@ -1362,6 +1367,10 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
 
 	hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
 
+	/* Deinit port representor broker */
+	if (rte_representor_enabled())
+		rte_representor_broker_free(eth_dev->data->port_id);
+
 	if (hw->adapter_stopped == 0)
 		ixgbe_dev_close(eth_dev);
 
@@ -3541,7 +3550,7 @@ ixgbevf_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	return IXGBEVF_NB_XSTATS;
 }
 
-static void
+void
 ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
@@ -3558,7 +3567,7 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	stats->obytes = hw_stats->vfgotc;
 }
 
-static void
+void
 ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
@@ -3746,7 +3755,7 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return NULL;
 }
 
-static void
+void
 ixgbevf_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
@@ -4004,7 +4013,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static int
+int
 ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 {
 	return ixgbe_dev_link_update_share(dev, wait_to_complete, 0);
drivers/net/ixgbe/ixgbe_ethdev.h +11 -0
index caa50c8..1534ab7 100644
@@ -589,6 +589,17 @@ struct ixgbe_adapter {
 /*
  * RX/TX function prototypes
  */
+
+int ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
+
+void ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
+	struct rte_eth_stats *stats);
+
+void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
+
+void ixgbevf_dev_info_get(struct rte_eth_dev *dev,
+	struct rte_eth_dev_info *dev_info);
+
 void ixgbe_dev_clear_queues(struct rte_eth_dev *dev);
 
 void ixgbe_dev_free_queues(struct rte_eth_dev *dev);
drivers/net/ixgbe/ixgbe_prep_ops.c new file +279 -0

279 lines not on this page · raw message

drivers/net/ixgbe/ixgbe_prep_ops.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw
In reply to Mohammad Abdul Awal

I understand this is the representor idea suiting Intel cards but it does not cover other possibilities.

At least, Netronome and Mellanox require a representor not just for controlling a VF, but also for sending and receiving packets through the representor PMD.

I sent an abstract for a presentation in next Dublin Users meeting, and discussing the representor idea was in the agenda.

By the way, I remember there was reticence about adding control plane to DPDK. What is the current official DPDK position in this regard?

Quoted 172 lines · Mohammad Abdul Awal

---
This RFC introduces a port representor based model for the control, management
and monitoring of SR-IOV virtual function (VF) devices for control plane applications which have bound the devices physical function.

Port Representors are virtual poll mode drivers (PMD) which provide a logical
representation in DPDK for VF ports for control and monitoring. Each port representor PMD 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   | | |
|         | +---------+ | |
|         +-------------+ |
+-------------------------+

Creation of representor ports can be achieved either through the --vdev EAL option or through the rte_vdev_init() API. Each port representor requires the
BDF of it's parent PF and the Virtual Function ID of the port which the representor will support. During initialization of the representor PMD, it calls
the broker API to register itself with the PF PMD and to get it's context configured which includes the setting up of it's context and ops function handlers.

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.

Mohammad Abdul Awal (5):
Implemented port representor broker infrastructure, created BDF to
port function.
added --enable-representor command line argument in EAL to load
representor broker infrastructure.
Implement port representor PMD
Enable port representor PMD and broker for fortville PMD driver Enable port representor PMD and broker for ixgbe PMD driver.

 config/common_base                                 |   5 +
 drivers/net/Makefile                               |   2 +
 drivers/net/i40e/Makefile                          |   1 +
 drivers/net/i40e/i40e_ethdev.c                     |  17 +
 drivers/net/i40e/i40e_prep_ops.c                   | 402 +++++++++
 drivers/net/i40e/i40e_prep_ops.h                   |  41 +
 drivers/net/i40e/rte_pmd_i40e.c                    |  47 +
 drivers/net/i40e/rte_pmd_i40e.h                    |  18 +
 drivers/net/ixgbe/Makefile                         |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                   |  33 +-
 drivers/net/ixgbe/ixgbe_ethdev.h                   |  11 +
 drivers/net/ixgbe/ixgbe_prep_ops.c                 | 279 ++++++
 drivers/net/ixgbe/ixgbe_prep_ops.h                 |  41 +
 drivers/net/representor/Makefile                   |  51 ++
 drivers/net/representor/rte_eth_representor.c      | 973
+++++++++++++++++++++
 .../representor/rte_pmd_representor_version.map    |   4 +
 lib/librte_eal/bsdapp/eal/eal.c                    |   6 +
 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/linuxapp/eal/eal.c                  |   9 +
 lib/librte_ether/Makefile                          |   2 +
 lib/librte_ether/rte_ethdev.c                      |  93 ++
 lib/librte_ether/rte_ethdev.h                      |  26 +
 lib/librte_ether/rte_ethdev_vdev.h                 |  37 +-
 lib/librte_ether/rte_ether_version.map             |   9 +
 lib/librte_ether/rte_port_representor.c            | 160 ++++
 lib/librte_ether/rte_port_representor.h            | 289 ++++++
 mk/rte.app.mk                                      |   1 +
 30 files changed, 2556 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/i40e/i40e_prep_ops.c
 create mode 100644 drivers/net/i40e/i40e_prep_ops.h
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.h
 create mode 100644 drivers/net/representor/Makefile
 create mode 100644 drivers/net/representor/rte_eth_representor.c
 create mode 100644 drivers/net/representor/rte_
pmd_representor_version.map
 create mode 100644 lib/librte_ether/rte_port_representor.c
 create mode 100644 lib/librte_ether/rte_port_representor.h

--
2.7.4

#7 lore raw
Quoted 7 lines · Alejandro Lucero

I understand this is the representor idea suiting Intel cards but it does not cover other possibilities.

At least, Netronome and Mellanox require a representor not just for controlling a VF, but also for sending and receiving packets through the representor PMD.

Hey Alejandro,

What we've proposed here doesn't preclude the support of a data path on the representor pmd as the functionality which the PMD supports is dependent on how the parent device running the representor broker configures each representor instance. As you note in the case of our current generation of IO devices supporting a data path doesn't make sense, but I think this framework could support that functionality if required.

Quoted 3 lines

I sent an abstract for a presentation in next Dublin Users meeting, and discussing the representor idea was in the agenda.

I've also submitted an presentation which I got notification was accepted this morning which is based on the RFC, so maybe we should collaborate on a presentation if there is a large overlap?

Quoted 3 lines

By the way, I remember there was reticence about adding control plane to DPDK. What is the current official DPDK position in this regard?

I also remember there was concerns about adding control plane APIs to DPDK, hence the RFC, but I think the advantage of the representor port approach is that there are no new public API being introduced, with only back-end support in the PMDs which wish to support this functionality.

Quoted 178 lines
Quoted 172 lines · Mohammad Abdul Awal

---
This RFC introduces a port representor based model for the control, management
and monitoring of SR-IOV virtual function (VF) devices for control plane applications which have bound the devices physical function.

Port Representors are virtual poll mode drivers (PMD) which provide a logical
representation in DPDK for VF ports for control and monitoring. Each port representor PMD 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   | | |
|         | +---------+ | |
|         +-------------+ |
+-------------------------+

Creation of representor ports can be achieved either through the --vdev EAL option or through the rte_vdev_init() API. Each port representor requires the
BDF of it's parent PF and the Virtual Function ID of the port which the representor will support. During initialization of the representor PMD, it calls
the broker API to register itself with the PF PMD and to get it's context configured which includes the setting up of it's context and ops function handlers.

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.

Mohammad Abdul Awal (5):
Implemented port representor broker infrastructure, created BDF to
port function.
added --enable-representor command line argument in EAL to load
representor broker infrastructure.
Implement port representor PMD
Enable port representor PMD and broker for fortville PMD driver Enable port representor PMD and broker for ixgbe PMD driver.

 config/common_base                                 |   5 +
 drivers/net/Makefile                               |   2 +
 drivers/net/i40e/Makefile                          |   1 +
 drivers/net/i40e/i40e_ethdev.c                     |  17 +
 drivers/net/i40e/i40e_prep_ops.c                   | 402 +++++++++
 drivers/net/i40e/i40e_prep_ops.h                   |  41 +
 drivers/net/i40e/rte_pmd_i40e.c                    |  47 +
 drivers/net/i40e/rte_pmd_i40e.h                    |  18 +
 drivers/net/ixgbe/Makefile                         |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                   |  33 +-
 drivers/net/ixgbe/ixgbe_ethdev.h                   |  11 +
 drivers/net/ixgbe/ixgbe_prep_ops.c                 | 279 ++++++
 drivers/net/ixgbe/ixgbe_prep_ops.h                 |  41 +
 drivers/net/representor/Makefile                   |  51 ++
 drivers/net/representor/rte_eth_representor.c      | 973
+++++++++++++++++++++
 .../representor/rte_pmd_representor_version.map    |   4 +
 lib/librte_eal/bsdapp/eal/eal.c                    |   6 +
 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/linuxapp/eal/eal.c                  |   9 +
 lib/librte_ether/Makefile                          |   2 +
 lib/librte_ether/rte_ethdev.c                      |  93 ++
 lib/librte_ether/rte_ethdev.h                      |  26 +
 lib/librte_ether/rte_ethdev_vdev.h                 |  37 +-
 lib/librte_ether/rte_ether_version.map             |   9 +
 lib/librte_ether/rte_port_representor.c            | 160 ++++
 lib/librte_ether/rte_port_representor.h            | 289 ++++++
 mk/rte.app.mk                                      |   1 +
 30 files changed, 2556 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/i40e/i40e_prep_ops.c
 create mode 100644 drivers/net/i40e/i40e_prep_ops.h
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.h
 create mode 100644 drivers/net/representor/Makefile
 create mode 100644 drivers/net/representor/rte_eth_representor.c
 create mode 100644 drivers/net/representor/rte_
pmd_representor_version.map
 create mode 100644 lib/librte_ether/rte_port_representor.c
 create mode 100644 lib/librte_ether/rte_port_representor.h

--
2.7.4

#8 lore raw
Quoted 10 lines · Declan Doherty
Quoted 8 lines · Alejandro Lucero

I understand this is the representor idea suiting Intel cards but it does not cover other possibilities.

At least, Netronome and Mellanox require a representor not just for controlling a VF, but also for sending and receiving packets through the representor PMD.

Quoted 10 lines

Hey Alejandro,

What we've proposed here doesn't preclude the support of a data path on the representor pmd as the functionality which the PMD supports is dependent on how the parent device running the representor broker configures each representor instance. As you note in the case of our current generation of IO devices supporting a data path doesn't make sense, but I think this framework could support that functionality if required.

Hi Declan,

Tell me if I'm wrong, but this looks to me like kernel netdev ndo_set_vf_* functions, maybe with the idea of having more possibilities than those currently available with the kernel. The representor idea I refer to is completely different, and it is related to using SRIOV with OVS offload. It has other possibilities but this is the current main reason. Some references:

https://www.slideshare.net/Netronome/using-agilio-smartnics-for-openstack-networking-acceleration

https://netdevconf.org/1.2/slides/oct6/04_gerlitz_efraim_introduction_to_switchdev_sriov_offloads.pdf

I sent an abstract for a presentation in next Dublin Users meeting, and

Quoted 6 lines
Quoted 3 lines

discussing the representor idea was in the agenda.

I've also submitted an presentation which I got notification was accepted this morning which is based on the RFC, so maybe we should collaborate on a presentation if there is a large overlap?

Unfortunately, I did not get my abstract approved. Maybe you could add some slide about this other view for the shake of discussion.

Quoted 12 lines

By the way, I remember there was reticence about adding control plane to

Quoted 3 lines

DPDK. What is the current official DPDK position in this regard?

I also remember there was concerns about adding control plane APIs to DPDK, hence the RFC, but I think the advantage of the representor port approach is that there are no new public API being introduced, with only back-end support in the PMDs which wish to support this functionality.

I'd like to know what is the opinion of the DPDK community regarding the control path.

Quoted 188 lines
Quoted 187 lines

On Thu, Sep 7, 2017 at 9:35 AM, Mohammad Abdul Awal < [email protected]> wrote:

Quoted 179 lines

---
This RFC introduces a port representor based model for the control, management
and monitoring of SR-IOV virtual function (VF) devices for control plane applications which have bound the devices physical function.

Port Representors are virtual poll mode drivers (PMD) which provide a logical
representation in DPDK for VF ports for control and monitoring. Each port representor PMD 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   | | |
|         | +---------+ | |
|         +-------------+ |
+-------------------------+

Creation of representor ports can be achieved either through the --vdev EAL
option or through the rte_vdev_init() API. Each port representor requires the
BDF of it's parent PF and the Virtual Function ID of the port which the representor will support. During initialization of the representor PMD, it
calls
the broker API to register itself with the PF PMD and to get it's context configured which includes the setting up of it's context and ops function handlers.

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.

Mohammad Abdul Awal (5):
Implemented port representor broker infrastructure, created BDF to
port function.
added --enable-representor command line argument in EAL to load
representor broker infrastructure.
Implement port representor PMD
Enable port representor PMD and broker for fortville PMD driver Enable port representor PMD and broker for ixgbe PMD driver.

 config/common_base                                 |   5 +
 drivers/net/Makefile                               |   2 +
 drivers/net/i40e/Makefile                          |   1 +
 drivers/net/i40e/i40e_ethdev.c                     |  17 +
 drivers/net/i40e/i40e_prep_ops.c                   | 402 +++++++++
 drivers/net/i40e/i40e_prep_ops.h                   |  41 +
 drivers/net/i40e/rte_pmd_i40e.c                    |  47 +
 drivers/net/i40e/rte_pmd_i40e.h                    |  18 +
 drivers/net/ixgbe/Makefile                         |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                   |  33 +-
 drivers/net/ixgbe/ixgbe_ethdev.h                   |  11 +
 drivers/net/ixgbe/ixgbe_prep_ops.c                 | 279 ++++++
 drivers/net/ixgbe/ixgbe_prep_ops.h                 |  41 +
 drivers/net/representor/Makefile                   |  51 ++
 drivers/net/representor/rte_eth_representor.c      | 973
+++++++++++++++++++++
 .../representor/rte_pmd_representor_version.map    |   4 +
 lib/librte_eal/bsdapp/eal/eal.c                    |   6 +
 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/linuxapp/eal/eal.c                  |   9 +
 lib/librte_ether/Makefile                          |   2 +
 lib/librte_ether/rte_ethdev.c                      |  93 ++
 lib/librte_ether/rte_ethdev.h                      |  26 +
 lib/librte_ether/rte_ethdev_vdev.h                 |  37 +-
 lib/librte_ether/rte_ether_version.map             |   9 +
 lib/librte_ether/rte_port_representor.c            | 160 ++++
 lib/librte_ether/rte_port_representor.h            | 289 ++++++
 mk/rte.app.mk                                      |   1 +
 30 files changed, 2556 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/i40e/i40e_prep_ops.c
 create mode 100644 drivers/net/i40e/i40e_prep_ops.h
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.c
 create mode 100644 drivers/net/ixgbe/ixgbe_prep_ops.h
 create mode 100644 drivers/net/representor/Makefile
 create mode 100644 drivers/net/representor/rte_eth_representor.c
 create mode 100644 drivers/net/representor/rte_
pmd_representor_version.map
 create mode 100644 lib/librte_ether/rte_port_representor.c
 create mode 100644 lib/librte_ether/rte_port_representor.h

--
2.7.4

#9 lore raw

Declan, Mohammad,

The submission [1] of steering action between switch ports clearly requires a switch model in DPDK.
The Port Representor based on a virtual PMD broker on NIC ops (rte_dev_ops) does not provide the required functionality. Using NIC terminology and not Switch API's will lead to a dead-end. Moreover, it does not fit the Kernel design. We need to be careful from this ending up as two different deployment models for users, which is very bad. There was a long discussion about this in netdev ML [2], including the VEPA mode support.

As described in the links Alejandro referenced earlier, each of the switch ports should be a real PMD, and switch operations should be applied on these PMD ports.
This includes the steering redirection of traffic between switch ports [1], port ACL's to block/allow traffic, VST/VGT modes and anti spoofing, link trust mode [3] for promiscuous configuration, mirroring of switch port traffic, and Tx and Rx of switch port traffic to/from VF's port.

More over, building this as real PMD ports of a switch device removes the need to add a new broker framework all together.
Each vendor just needs to map additional PMD ports during the probing stage. By adding a switchdev_id we can define these are ports associated to the same switching device, and can allow new port and inter-port actions.

[1] http://dpdk.org/dev/patchwork/patch/32550/
[2] https://www.spinics.net/lists/netdev/msg467375.html
[2] https://www.systutorials.com/docs/linux/man/8-ip-link/

Alex

#10 lore raw

Hi ALex,

Quoted 12 lines · Alex Rosenbaum

Declan, Mohammad,

The submission [1] of steering action between switch ports clearly requires a switch model in DPDK.
The Port Representor based on a virtual PMD broker on NIC ops (rte_dev_ops) does not provide the required functionality. Using NIC terminology and not Switch API's will lead to a dead-end. Moreover, it does not fit the Kernel design. We need to be careful from this ending up as two different deployment models for users, which is very bad. There was a long discussion about this in netdev ML [2], including the VEPA mode support.

Quoted 8 lines

As described in the links Alejandro referenced earlier, each of the switch ports should be a real PMD, and switch operations should be applied on these PMD ports.
This includes the steering redirection of traffic between switch ports [1], port ACL's to block/allow traffic, VST/VGT modes and anti spoofing, link trust mode [3] for promiscuous configuration, mirroring of switch port traffic, and Tx and Rx of switch port traffic to/from VF's port.

I agree that we need a switch_domain parameter. At the moment we do not have APIs implemented for all the switch operations you have mentioned above. So, we are planning separate RFC with switch _domain and related APIs.

Quoted 5 lines

More over, building this as real PMD ports of a switch device removes the need to add a new broker framework all together.
Each vendor just needs to map additional PMD ports during the probing stage.

That is very much possible as well. If we agree to probe all the ports during the initialization phase, we can have all the representors ready without any interaction from application and broker. On the other hand, we may require a broker structure to enable hotplug support.

Quoted 9 lines

By adding a switchdev_id we can define these are ports associated to the same switching device, and can allow new port and inter-port actions.

[1] http://dpdk.org/dev/patchwork/patch/32550/
[2] https://www.spinics.net/lists/netdev/msg467375.html
[2] https://www.systutorials.com/docs/linux/man/8-ip-link/

Alex

Regards,
Awal.

#11 lore raw
Quoted 10 lines · Mohammad Abdul Awal
Quoted 8 lines · Alex Rosenbaum

As described in the links Alejandro referenced earlier, each of the switch ports should be a real PMD, and switch operations should be applied on these PMD ports.
This includes the steering redirection of traffic between switch ports [1], port ACL's to block/allow traffic, VST/VGT modes and anti spoofing, link trust mode [3] for promiscuous configuration, mirroring of switch port traffic, and Tx and Rx of switch port traffic to/from VF's port.

Quoted 3 lines

I agree that we need a switch_domain parameter. At the moment we do not have APIs implemented for all the switch operations you have mentioned above. So, we are planning separate RFC with switch _domain and related APIs.

Sure, we can extend these switch ops in a separate step.

Quoted 9 lines
Quoted 4 lines

More over, building this as real PMD ports of a switch device removes the need to add a new broker framework all together.
Each vendor just needs to map additional PMD ports during the probing stage.

That is very much possible as well. If we agree to probe all the ports during the initialization phase, we can have all the representors ready without any interaction from application and broker. On the other hand, we may require a broker structure to enable hotplug support.

hotplug should be supported for any PMD ports, and any BDF type. I don't understand why do you need the broker framework in order to support hotplug?

Alex

#12 lore raw
Quoted 21 lines · Alex Rosenbaum
Quoted 9 lines · Mohammad Abdul Awal
Quoted 8 lines · Alex Rosenbaum

As described in the links Alejandro referenced earlier, each of the switch ports should be a real PMD, and switch operations should be applied on these PMD ports.
This includes the steering redirection of traffic between switch ports [1], port ACL's to block/allow traffic, VST/VGT modes and anti spoofing, link trust mode [3] for promiscuous configuration, mirroring of switch port traffic, and Tx and Rx of switch port traffic to/from VF's port.

Quoted 3 lines

I agree that we need a switch_domain parameter. At the moment we do not have APIs implemented for all the switch operations you have mentioned above. So, we are planning separate RFC with switch _domain and related APIs.

Sure, we can extend these switch ops in a separate step.

Quoted 4 lines
Quoted 4 lines

More over, building this as real PMD ports of a switch device removes the need to add a new broker framework all together.
Each vendor just needs to map additional PMD ports during the probing stage.

Quoted 7 lines
Quoted 4 lines

That is very much possible as well. If we agree to probe all the ports during the initialization phase, we can have all the representors ready without any interaction from application and broker. On the other hand, we may require a broker structure to enable hotplug support.

hotplug should be supported for any PMD ports, and any BDF type. I don't understand why do you need the broker framework in order to support hotplug?

By hotplug I did not mean HW hotplug, rather I meant the software hotplug of port representor so that an application can add/delete representor at run time.

Regards,
Awal.

Quoted 2 lines

Alex

#13 lore raw
Quoted 6 lines · Mohammad Abdul Awal
Quoted 2 lines · Alex Rosenbaum

On Fri, Dec 22, 2017 at 4:31 PM, Mohammad Abdul Awal

Quoted 1 line · Alex Rosenbaum

By hotplug I did not mean HW hotplug, rather I meant the software hotplug of port representor so that an application can add/delete representor at run time.

What is the expect results if application adds/deletes a representor at run time?

I would expect the VF hotplug to be depended on the PF configuration. So that new/removed VF's would trigger a representor state or existance.

Alex

#14 lore raw
Quoted 10 lines · Alex Rosenbaum
Quoted 6 lines · Mohammad Abdul Awal
Quoted 2 lines · Alex Rosenbaum

On Fri, Dec 22, 2017 at 4:31 PM, Mohammad Abdul Awal

Quoted 1 line · Alex Rosenbaum

By hotplug I did not mean HW hotplug, rather I meant the software hotplug of port representor so that an application can add/delete representor at run time.

What is the expect results if application adds/deletes a representor at run time?

From my understanding, for OVS, it would make much sense to enumerate the representors during the startup time and only 'state' active/inactive would enough to imply the state of a VF.

On the other hand, for a system with varieties of NICs/FPGAs/SmartNics having capacities of hundreds (if not thousands) of max VFs and different capabilities, we may not want to allocate them if not being using, and we may not be able to control this way if no broker.

This is definitely a matter of design discussion for now where ultimate outcome is same, i.e. having a representor to control a VF.

Quoted 3 lines

I would expect the VF hotplug to be depended on the PF configuration. So that new/removed VF's would trigger a representor state or existance.

I agree and as I have just said above that it is different ways of doing same thing with limited/flexible ability.

Quoted 1 line

Alex

Regards,
Awal