Skip to contentSkip to conversation

extend vmdq_dcb sample for X710 supporting

RFC PATCH In review Jingjing Wu 3 participants 23 messages Jan 11, 2016 – Mar 8, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

cover extend vmdq_dcb sample for X710 supporting

Currently, the example vmdq_dcb only works on Intel® 82599 NICs. This patch set extended this sample to make it works both on Intel® 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode in i40e driver and added unsupported mode checking in ixgbe driver.

Jingjing Wu (3):
i40e: enable DCB in VMDQ vsis
ixgbe: add more multi queue mode checking examples/vmdq_dcb: extend sample for X710 supporting

 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 169 ++++++----
 drivers/net/i40e/i40e_ethdev.c                   | 153 +++++++--
 drivers/net/i40e/i40e_ethdev.h                   |  28 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                 |   5 +
 examples/vmdq_dcb/main.c                         | 388 ++++++++++++++++++-----
 5 files changed, 582 insertions(+), 161 deletions(-)
Signature · 1 line
2.4.0
#1 lore raw

RFC PATCH 1/3 i40e: enable DCB in VMDQ vsis

Currently, DCB is only enabled on PF, queue mapping and BW configuration is only done on PF vsi. This patch enabled DCB for VMDQ vsis by following steps:
1. Take BW and ETS configuration on VEB.
2. Take BW and ETS configuration on VMDQ vsis.
3. Update TC and queues mapping on VMDQ vsis.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

---
 drivers/net/i40e/i40e_ethdev.c | 153 ++++++++++++++++++++++++++++++++++++-----
 drivers/net/i40e/i40e_ethdev.h |  28 ++++----
 2 files changed, 149 insertions(+), 32 deletions(-)
drivers/net/i40e/i40e_ethdev.c +134 -19
index bf6220d..fbafcc6 100644
@@ -8087,6 +8087,8 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi,
 	int i, total_tc = 0;
 	uint16_t qpnum_per_tc, bsf, qp_idx;
 	struct rte_eth_dev_data *dev_data = I40E_VSI_TO_DEV_DATA(vsi);
+	struct i40e_pf *pf = I40E_VSI_TO_PF(vsi);
+	uint16_t used_queues;
 
 	ret = validate_tcmap_parameter(vsi, enabled_tcmap);
 	if (ret != I40E_SUCCESS)
@@ -8100,7 +8102,18 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi,
 		total_tc = 1;
 	vsi->enabled_tc = enabled_tcmap;
 
-	qpnum_per_tc = dev_data->nb_rx_queues / total_tc;
+	/* different VSI has different queues assigned */
+	if (vsi->type == I40E_VSI_MAIN)
+		used_queues = dev_data->nb_rx_queues -
+			pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
+	else if (vsi->type == I40E_VSI_VMDQ2)
+		used_queues = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
+	else {
+		PMD_INIT_LOG(ERR, "unsupported VSI type.");
+		return I40E_ERR_NO_AVAILABLE_VSI;
+	}
+
+	qpnum_per_tc = used_queues / total_tc;
 	/* Number of queues per enabled TC */
 	if (qpnum_per_tc == 0) {
 		PMD_INIT_LOG(ERR, " number of queues is less that tcs.");
@@ -8145,6 +8158,93 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi,
 }
 
 /*
+ * i40e_config_switch_comp_tc - Configure VEB tc setting for given TC map
+ * @veb: VEB to be configured
+ * @tc_map: enabled TC bitmap
+ *
+ * Returns 0 on success, negative value on failure
+ */
+static enum i40e_status_code
+i40e_config_switch_comp_tc(struct i40e_veb *veb, uint8_t tc_map)
+{
+	struct i40e_aqc_configure_switching_comp_bw_config_data veb_bw;
+	struct i40e_aqc_query_switching_comp_bw_config_resp bw_query;
+	struct i40e_aqc_query_switching_comp_ets_config_resp ets_query;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(veb->associate_vsi);
+	enum i40e_status_code ret = I40E_SUCCESS;
+	int i;
+	uint32_t bw_max;
+
+	/* Check if enabled_tc is same as existing or new TCs */
+	if (veb->enabled_tc == tc_map)
+		return ret;
+
+	/* configure tc bandwidth */
+	memset(&veb_bw, 0, sizeof(veb_bw));
+	veb_bw.tc_valid_bits = tc_map;
+	/* Enable ETS TCs with equal BW Share for now across all VSIs */
+	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+		if (tc_map & BIT_ULL(i))
+			veb_bw.tc_bw_share_credits[i] = 1;
+	}
+	ret = i40e_aq_config_switch_comp_bw_config(hw, veb->seid,
+						   &veb_bw, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "AQ command Config switch_comp BW allocation"
+				  " per TC failed = %d",
+				  hw->aq.asq_last_status);
+		return ret;
+	}
+
+	memset(&ets_query, 0, sizeof(ets_query));
+	ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid,
+						   &ets_query, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to get switch_comp ETS"
+				 " configuration %u", hw->aq.asq_last_status);
+		return ret;
+	}
+	memset(&bw_query, 0, sizeof(bw_query));
+	ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid,
+						  &bw_query, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to get switch_comp bandwidth"
+				 " configuration %u", hw->aq.asq_last_status);
+		return ret;
+	}
+
+	/* store and print out BW info */
+	veb->bw_info.bw_limit = rte_le_to_cpu_16(ets_query.port_bw_limit);
+	veb->bw_info.bw_max = ets_query.tc_bw_max;
+	PMD_DRV_LOG(DEBUG, "switch_comp bw limit:%u", veb->bw_info.bw_limit);
+	PMD_DRV_LOG(DEBUG, "switch_comp max_bw:%u", veb->bw_info.bw_max);
+	bw_max = rte_le_to_cpu_16(bw_query.tc_bw_max[0]) |
+		    (rte_le_to_cpu_16(bw_query.tc_bw_max[1]) <<
+		     I40E_16_BIT_WIDTH);
+	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+		veb->bw_info.bw_ets_share_credits[i] =
+				bw_query.tc_bw_share_credits[i];
+		veb->bw_info.bw_ets_credits[i] =
+				rte_le_to_cpu_16(bw_query.tc_bw_limits[i]);
+		/* 4 bits per TC, 4th bit is reserved */
+		veb->bw_info.bw_ets_max[i] =
+			(uint8_t)((bw_max >> (i * I40E_4_BIT_WIDTH)) &
+				  I40E_3_BIT_MASK);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:share credits %u", i,
+			    veb->bw_info.bw_ets_share_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:credits %u", i,
+			    veb->bw_info.bw_ets_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u: max credits: %u", i,
+			    veb->bw_info.bw_ets_max[i]);
+	}
+
+	veb->enabled_tc = tc_map;
+
+	return ret;
+}
+
+
+/*
  * i40e_vsi_config_tc - Configure VSI tc setting for given TC map
  * @vsi: VSI to be configured
  * @tc_map: enabled TC bitmap
@@ -8152,7 +8252,7 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi,
  * Returns 0 on success, negative value on failure
  */
 static enum i40e_status_code
-i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 tc_map)
+i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)
 {
 	struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
 	struct i40e_vsi_context ctxt;
@@ -8294,15 +8394,27 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
 	i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0,
 				     &hw->local_dcbx_config);
 
+	/* if Veb is created, need to update TC of it at first */
+	if (main_vsi->veb) {
+		ret = i40e_config_switch_comp_tc(main_vsi->veb, tc_map);
+		if (ret)
+			PMD_INIT_LOG(WARNING,
+				 "Failed configuring TC for VEB seid=%d\n",
+				 main_vsi->veb->seid);
+	}
 	/* Update each VSI */
 	i40e_vsi_config_tc(main_vsi, tc_map);
 	if (main_vsi->veb) {
 		TAILQ_FOREACH(vsi_list, &main_vsi->veb->head, list) {
-			/* Beside main VSI, only enable default
+			/* Beside main VSI and VMDQ VSIs, only enable default
 			 * TC for other VSIs
 			 */
-			ret = i40e_vsi_config_tc(vsi_list->vsi,
-						I40E_DEFAULT_TCMAP);
+			if (vsi_list->vsi->type == I40E_VSI_VMDQ2)
+				ret = i40e_vsi_config_tc(vsi_list->vsi,
+							 tc_map);
+			else
+				ret = i40e_vsi_config_tc(vsi_list->vsi,
+							 I40E_DEFAULT_TCMAP);
 			if (ret)
 				PMD_INIT_LOG(WARNING,
 					 "Failed configuring TC for VSI seid=%d\n",
@@ -8422,9 +8534,8 @@ i40e_dcb_setup(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
-	if (pf->vf_num != 0 ||
-	    (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG))
-		PMD_INIT_LOG(DEBUG, " DCB only works on main vsi.");
+	if (pf->vf_num != 0)
+		PMD_INIT_LOG(DEBUG, " DCB only works on pf and vmdq vsis.");
 
 	ret = i40e_parse_dcb_configure(dev, &dcb_cfg, &tc_map);
 	if (ret) {
@@ -8449,7 +8560,7 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
 	struct i40e_vsi *vsi = pf->main_vsi;
 	struct i40e_dcbx_config *dcb_cfg = &hw->local_dcbx_config;
 	uint16_t bsf, tc_mapping;
-	int i;
+	int i, j;
 
 	if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_DCB_FLAG)
 		dcb_info->nb_tcs = rte_bsf32(vsi->enabled_tc + 1);
@@ -8460,23 +8571,27 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
 	for (i = 0; i < dcb_info->nb_tcs; i++)
 		dcb_info->tc_bws[i] = dcb_cfg->etscfg.tcbwtable[i];
 
-	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
-		if (vsi->enabled_tc & (1 << i)) {
+	j = 0;
+	do {
+		for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+			if (!(vsi->enabled_tc & (1 << i)))
+				continue;
 			tc_mapping = rte_le_to_cpu_16(vsi->info.tc_mapping[i]);
 			/* only main vsi support multi TCs */
-			dcb_info->tc_queue.tc_rxq[0][i].base =
+			dcb_info->tc_queue.tc_rxq[j][i].base =
 				(tc_mapping & I40E_AQ_VSI_TC_QUE_OFFSET_MASK) >>
 				I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT;
-			dcb_info->tc_queue.tc_txq[0][i].base =
-				dcb_info->tc_queue.tc_rxq[0][i].base;
+			dcb_info->tc_queue.tc_txq[j][i].base =
+				dcb_info->tc_queue.tc_rxq[j][i].base;
 			bsf = (tc_mapping & I40E_AQ_VSI_TC_QUE_NUMBER_MASK) >>
 				I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT;
-			dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 1 << bsf;
-			dcb_info->tc_queue.tc_txq[0][i].nb_queue =
-				dcb_info->tc_queue.tc_rxq[0][i].nb_queue;
+			dcb_info->tc_queue.tc_rxq[j][i].nb_queue = 1 << bsf;
+			dcb_info->tc_queue.tc_txq[j][i].nb_queue =
+				dcb_info->tc_queue.tc_rxq[j][i].nb_queue;
 		}
-	}
-
+		vsi = pf->vmdq[j].vsi;
+		j++;
+	} while (j < RTE_MIN(pf->nb_cfg_vmdq_vsi, ETH_MAX_VMDQ_POOL));
 	return 0;
 }
 
drivers/net/i40e/i40e_ethdev.h +15 -13
index 1f9792b..d426784 100644
@@ -199,6 +199,19 @@ struct i40e_vsi_list {
 struct i40e_rx_queue;
 struct i40e_tx_queue;
 
+/* Bandwidth limit information */
+struct i40e_bw_info {
+	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
+	uint8_t  bw_max;        /* Max BW limit if enabled */
+
+	/* Relative credits within same TC with respect to other VSIs or Comps */
+	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Bandwidth limit per TC */
+	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Max bandwidth limit per TC */
+	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
+};
+
 /* Structure that defines a VEB */
 struct i40e_veb {
 	struct i40e_vsi_list_head head;
@@ -207,6 +220,8 @@ struct i40e_veb {
 	uint16_t uplink_seid; /* The uplink seid of this VEB */
 	uint16_t stats_idx;
 	struct i40e_eth_stats stats;
+	uint8_t enabled_tc;   /* The traffic class enabled */
+	struct i40e_bw_info bw_info; /* VEB bandwidth information */
 };
 
 /* i40e MACVLAN filter structure */
@@ -216,19 +231,6 @@ struct i40e_macvlan_filter {
 	uint16_t vlan_id;
 };
 
-/* Bandwidth limit information */
-struct i40e_bw_info {
-	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
-	uint8_t  bw_max;        /* Max BW limit if enabled */
-
-	/* Relative VSI credits within same TC with respect to other VSIs */
-	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Max bandwidth limit per TC */
-	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
-};
-
 /*
  * Structure that defines a VSI, associated with a adapter.
  */
Signature · 1 line
2.4.0
#2 lore raw

RFC PATCH 2/3 ixgbe: add more multi queue mode checking

In reply to Jingjing Wu

The multi queue mode ETH_MQ_RX_VMDQ_DCB_RSS is not supported in ixgbe driver. This patch added the checking.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +5 -0
index 4c4c6df..24cd30b 100644
@@ -1853,6 +1853,11 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 			return -EINVAL;
 		}
 	} else {
+		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB_RSS) {
+			PMD_INIT_LOG(ERR, "VMDQ+DCB+RSS mq_mode is"
+					  " not supported.");
+			return -EINVAL;
+		}
 		/* check configuration for vmdb+dcb mode */
 		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {
 			const struct rte_eth_vmdq_dcb_conf *conf;
Signature · 1 line
2.4.0
#3 lore raw

RFC PATCH 3/3 examples/vmdq_dcb: extend sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel® 82599 NICs. This patch extended this sample to make it work both on Intel® 82599 and X710/XL710 NICs by following changes:
1. add VMDQ base queue checking to avoid forwarding on PF queues.
2. assign each VMDQ pools with MAC address.
3. add more arguments (nb-tcs, enable-rss) to change the default setting
4. extend the max number of queues from 128 to 1024.
This patch also reworked the user guide for the vmdq_dcb sample.

---
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 169 ++++++----
 examples/vmdq_dcb/main.c                         | 388 ++++++++++++++++++-----
 2 files changed, 428 insertions(+), 129 deletions(-)
doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +116 -53
index 9140a22..fe717fa 100644
@@ -32,8 +32,8 @@ VMDQ and DCB Forwarding Sample Application
 ==========================================
 
 The VMDQ and DCB Forwarding sample application is a simple example of packet processing using the DPDK.
-The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into 128 queues.
-The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 10 Gigabit Ethernet Controller.
+The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into queues.
+The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 and X710/XL710  Ethernet Controller.
 
 Overview
 --------
@@ -41,28 +41,27 @@ Overview
 This sample application can be used as a starting point for developing a new application that is based on the DPDK and
 uses VMDQ and DCB for traffic partitioning.
 
-The VMDQ and DCB filters work on VLAN traffic to divide the traffic into 128 input queues on the basis of the VLAN ID field and
-VLAN user priority field.
-VMDQ filters split the traffic into 16 or 32 groups based on the VLAN ID.
-Then, DCB places each packet into one of either 4 or 8 queues within that group, based upon the VLAN user priority field.
-
-In either case, 16 groups of 8 queues, or 32 groups of 4 queues, the traffic can be split into 128 hardware queues on the NIC,
-each of which can be polled individually by a DPDK application.
+The VMDQ and DCB filters work on MAC and VLAN traffic to divide the traffic into input queues on the basis of the Destination MAC
+address, VLAN ID and VLAN user priority fields.
+VMDQ filters split the traffic into 16 or 32 groups based on the Destination MAC and VLAN ID.
+Then, DCB places each packet into one of queues within that group, based upon the VLAN user priority field.
 
 All traffic is read from a single incoming port (port 0) and output on port 1, without any processing being performed.
-The traffic is split into 128 queues on input, where each thread of the application reads from multiple queues.
-For example, when run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
+Take Intel® 82599 NIC for example, the traffic is split into 128 queues on input, where each thread of the application reads from
+multiple queues. When run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
 
-As supplied, the sample application configures the VMDQ feature to have 16 pools with 8 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
-The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 32 pools of 4 queues each and
-this can be used by changing the NUM_POOLS parameter in the supplied code.
-The NUM_POOLS parameter can be passed on the command line, after the EAL parameters:
+As supplied, the sample application configures the VMDQ feature to have 32 pools with 4 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
+The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 16 pools of 8 queues. While the
+Intel® X710 or XL710 Ethernet Controller NICs support any specified VMDQ pools of 4 or 8 queues each. For simplicity, only 16
+or 32 pools is supported in this sample. And queues numbers for each VMDQ pool can be changed by setting CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM
+in config/common_* file.
+The nb-pools, nb-tcs and enable-rss parameters can be passed on the command line, after the EAL parameters:
 
 .. code-block:: console
 
-    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP
+    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP --nb-tcs TC --enable-rss
 
-where, NP can be 16 or 32.
+where, NP can be 16 or 32, TC can be 4 or 8, rss is disabled by default.
 
 .. _figure_vmdq_dcb_example:
 
@@ -72,9 +71,7 @@ where, NP can be 16 or 32.
 
 
 In Linux* user space, the application can display statistics with the number of packets received on each queue.
-To have the application display the statistics, send a SIGHUP signal to the running application process, as follows:
-
-where, <pid> is the process id of the application process.
+To have the application display the statistics, send a SIGHUP signal to the running application process.
 
 The VMDQ and DCB Forwarding sample application is in many ways simpler than the L2 Forwarding application
 (see Chapter 9 , "L2 Forwarding Sample Application (in Real and Virtualized Environments)")
@@ -117,7 +114,7 @@ To run the example in a linuxapp environment:
 
 .. code-block:: console
 
-    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 16
+    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 32 --nb-tcs 4
 
 Refer to the *DPDK Getting Started Guide* for general information on running applications and
 the Environment Abstraction Layer (EAL) options.
@@ -143,34 +140,48 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 .. code-block:: c
 
     /* empty vmdq+dcb configuration structure. Filled in programmatically */
-
     static const struct rte_eth_conf vmdq_dcb_conf_default = {
         .rxmode = {
-            .mq_mode = ETH_VMDQ_DCB,
+            .mq_mode        = ETH_MQ_RX_VMDQ_DCB,
             .split_hdr_size = 0,
-            .header_split = 0,   /**< Header Split disabled */
+            .header_split   = 0, /**< Header Split disabled */
             .hw_ip_checksum = 0, /**< IP checksum offload disabled */
             .hw_vlan_filter = 0, /**< VLAN filtering disabled */
-           .jumbo_frame = 0,     /**< Jumbo Frame Support disabled */
+            .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
         },
-
         .txmode = {
-            .mq_mode = ETH_DCB_NONE,
+            .mq_mode = ETH_MQ_TX_VMDQ_DCB,
         },
-
+        /*
+         * should be overridden separately in code with
+         * appropriate values
+         */
         .rx_adv_conf = {
-            /*
-             *    should be overridden separately in code with
-             *    appropriate values
-             */
-
             .vmdq_dcb_conf = {
-                .nb_queue_pools = ETH_16_POOLS,
+                .nb_queue_pools = ETH_32_POOLS,
+                .enable_default_pool = 0,
+                .default_pool = 0,
+                .nb_pool_maps = 0,
+                .pool_map = {{0, 0},},
+                .dcb_tc = {0},
+            },
+            .dcb_rx_conf = {
+                .nb_tcs = ETH_4_TCS,
+                /** Traffic class each UP mapped to. */
+                .dcb_tc = {0},
+            },
+            .vmdq_rx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
                 .enable_default_pool = 0,
                 .default_pool = 0,
                 .nb_pool_maps = 0,
                 .pool_map = {{0, 0},},
-                .dcb_queue = {0},
+            },
+        },
+        .tx_adv_conf = {
+            .vmdq_dcb_tx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
+                .dcb_tc = {0},
             },
         },
     };
@@ -178,11 +189,17 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 The get_eth_conf() function fills in an rte_eth_conf structure with the appropriate values,
 based on the global vlan_tags array,
 and dividing up the possible user priority values equally among the individual queues
-(also referred to as traffic classes) within each pool, that is,
+(also referred to as traffic classes) within each pool. Take Intel® 82599 NIC for example, that is,
 if the number of pools is 32, then the user priority fields are allocated two to a queue.
 If 16 pools are used, then each of the 8 user priority fields is allocated to its own queue within the pool.
+Take Intel® X710/XL710 NIC for example, that is, if number of tcs is 4, and number of queues in pool is 8,
+then the user priority fields are allocated two to one tc, and a tc has two queues mapping to it, then
+RSS will determine the destination queue in two.
 For the VLAN IDs, each one can be allocated to possibly multiple pools of queues,
 so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a bitmask value.
+For destination MAC, each VMDQ pool will be assigned with a MAC address. In this sample, each VMDQ pool
+is assigned to the MAC like 52:54:00:12:<port_id>:<pool_id>, that is,
+the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02.
 
 .. code-block:: c
 
@@ -193,38 +210,84 @@ so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a
         24, 25, 26, 27, 28, 29, 30, 31
     };
 
+    /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */
+    static struct ether_addr pool_addr_template = {
+        .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00}
+    };
 
     /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array
      * given above, and the number of traffic classes available for use. */
-
     static inline int
-    get_eth_conf(struct rte_eth_conf *eth_conf, enum rte_eth_nb_pools num_pools)
+    get_eth_conf(struct rte_eth_conf *eth_conf)
     {
         struct rte_eth_vmdq_dcb_conf conf;
-        unsigned i;
-
-        if (num_pools != ETH_16_POOLS && num_pools != ETH_32_POOLS ) return -1;
-
-        conf.nb_queue_pools = num_pools;
+        struct rte_eth_vmdq_rx_conf  vmdq_conf;
+        struct rte_eth_dcb_rx_conf   dcb_conf;
+        struct rte_eth_vmdq_dcb_tx_conf tx_conf;
+        uint8_t i;
+
+        conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        vmdq_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        tx_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        conf.nb_pool_maps = num_pools;
+        vmdq_conf.nb_pool_maps = num_pools;
         conf.enable_default_pool = 0;
+        vmdq_conf.enable_default_pool = 0;
         conf.default_pool = 0; /* set explicit value, even if not used */
-        conf.nb_pool_maps = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
+        vmdq_conf.default_pool = 0;
 
-        for (i = 0; i < conf.nb_pool_maps; i++){
-            conf.pool_map[i].vlan_id = vlan_tags[ i ];
-            conf.pool_map[i].pools = 1 << (i % num_pools);
+        for (i = 0; i < conf.nb_pool_maps; i++) {
+            conf.pool_map[i].vlan_id = vlan_tags[i];
+            vmdq_conf.pool_map[i].vlan_id = vlan_tags[i];
+            conf.pool_map[i].pools = 1UL << i ;
+            vmdq_conf.pool_map[i].pools = 1UL << i;
         }
-
         for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++){
-            conf.dcb_queue[i] = (uint8_t)(i % (NUM_QUEUES/num_pools));
+            conf.dcb_tc[i] = i % num_tcs;
+            dcb_conf.dcb_tc[i] = i % num_tcs;
+            tx_conf.dcb_tc[i] = i % num_tcs;
+        }
+        dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs;
+        (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf,
+                  sizeof(conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf,
+                  sizeof(dcb_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf,
+                  sizeof(vmdq_conf)));
+        (void)(rte_memcpy(&eth_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf,
+                  sizeof(tx_conf)));
+        if (rss_enable) {
+            eth_conf->rxmode.mq_mode= ETH_MQ_RX_VMDQ_DCB_RSS;
+            eth_conf->rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP |
+                                ETH_RSS_UDP |
+                                ETH_RSS_TCP |
+                                ETH_RSS_SCTP;
         }
-
-        (void) rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(\*eth_conf));
-        (void) rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_dcb_conf));
-
         return 0;
     }
 
+    ......
+
+    /* Set mac for each pool.*/
+    for (q = 0; q < num_pools; q++) {
+        struct ether_addr mac;
+        mac = pool_addr_template;
+        mac.addr_bytes[4] = port;
+        mac.addr_bytes[5] = q;
+        printf("Port %u vmdq pool %u set mac %02x:%02x:%02x:%02x:%02x:%02x\n",
+            port, q,
+            mac.addr_bytes[0], mac.addr_bytes[1],
+            mac.addr_bytes[2], mac.addr_bytes[3],
+            mac.addr_bytes[4], mac.addr_bytes[5]);
+        retval = rte_eth_dev_mac_addr_add(port, &mac,
+                q + vmdq_pool_base);
+        if (retval) {
+            printf("mac addr add failed at pool %d\n", q);
+            return retval;
+        }
+    }
+
 Once the network port has been initialized using the correct VMDQ and DCB values,
 the initialization of the port's RX and TX hardware rings is performed similarly to that
 in the L2 Forwarding sample application.
examples/vmdq_dcb/main.c +312 -76

575 lines not on this page · raw message

Signature · 1 line
2.4.0
#4 lore raw

cover extend vmdq_dcb sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel® 82599 NICs. This patch set extended this sample to make it works both on Intel® 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode in i40e driver and added unsupported mode checking in ixgbe driver.

Jingjing Wu (3):
i40e: enable DCB in VMDQ vsis
ixgbe: add more multi queue mode checking examples/vmdq_dcb: extend sample for X710 supporting

 doc/guides/rel_notes/release_2_3.rst             |   4 +
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 169 ++++++----
 drivers/net/i40e/i40e_ethdev.c                   | 153 +++++++--
 drivers/net/i40e/i40e_ethdev.h                   |  28 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                 |   5 +
 examples/vmdq_dcb/main.c                         | 388 ++++++++++++++++++-----
 6 files changed, 586 insertions(+), 161 deletions(-)
Signature · 1 line
2.4.0
#5 lore raw

PATCH 1/3 i40e: enable DCB in VMDQ vsis

Previously, DCB is only enabled on PF, queue mapping and BW configuration is only done on PF vsi. This patch enabled DCB for VMDQ vsis by following steps:
1. Take BW and ETS configuration on VEB.
2. Take BW and ETS configuration on VMDQ vsis.
3. Update TC and queues mapping on VMDQ vsis.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

---
 doc/guides/rel_notes/release_2_3.rst |   2 +
 drivers/net/i40e/i40e_ethdev.c       | 153 ++++++++++++++++++++++++++++++-----
 drivers/net/i40e/i40e_ethdev.h       |  28 ++++---
 3 files changed, 151 insertions(+), 32 deletions(-)
doc/guides/rel_notes/release_2_3.rst +2 -0
index 99de186..cd3d391 100644
@@ -4,6 +4,8 @@ DPDK Release 2.3
 New Features
 ------------
 
+* **Added i40e DCB support in VMDQ mode.**
+
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +134 -19

214 lines not on this page · raw message

drivers/net/i40e/i40e_ethdev.h +15 -13
index 1f9792b..d426784 100644
@@ -199,6 +199,19 @@ struct i40e_vsi_list {
 struct i40e_rx_queue;
 struct i40e_tx_queue;
 
+/* Bandwidth limit information */
+struct i40e_bw_info {
+	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
+	uint8_t  bw_max;        /* Max BW limit if enabled */
+
+	/* Relative credits within same TC with respect to other VSIs or Comps */
+	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Bandwidth limit per TC */
+	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Max bandwidth limit per TC */
+	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
+};
+
 /* Structure that defines a VEB */
 struct i40e_veb {
 	struct i40e_vsi_list_head head;
@@ -207,6 +220,8 @@ struct i40e_veb {
 	uint16_t uplink_seid; /* The uplink seid of this VEB */
 	uint16_t stats_idx;
 	struct i40e_eth_stats stats;
+	uint8_t enabled_tc;   /* The traffic class enabled */
+	struct i40e_bw_info bw_info; /* VEB bandwidth information */
 };
 
 /* i40e MACVLAN filter structure */
@@ -216,19 +231,6 @@ struct i40e_macvlan_filter {
 	uint16_t vlan_id;
 };
 
-/* Bandwidth limit information */
-struct i40e_bw_info {
-	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
-	uint8_t  bw_max;        /* Max BW limit if enabled */
-
-	/* Relative VSI credits within same TC with respect to other VSIs */
-	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Max bandwidth limit per TC */
-	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
-};
-
 /*
  * Structure that defines a VSI, associated with a adapter.
  */
Signature · 1 line
2.4.0
#6 lore raw

Re: [PATCH 1/3] i40e: enable DCB in VMDQ vsis

Quoted 7 lines · Jingjing Wu

Previously, DCB is only enabled on PF, queue mapping and BW configuration is only done on PF vsi. This patch enabled DCB for VMDQ vsis by following steps:
1. Take BW and ETS configuration on VEB.
2. Take BW and ETS configuration on VMDQ vsis.
3. Update TC and queues mapping on VMDQ vsis.
To enable DCB on VMDQ, the number of TCs should not be lager than

typo: s/lager/larger/

Quoted 5 lines

the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

In the title and commit log, can you please capitalize the abbreviation VSI, so that VSIs is recognisable as a plural of the acronym, and not as the word "vsis", which confused me for a while. :-)

Can you also explain what ETS stands for. [Not sure if VSI also needs to be expanded out the first time it is used in the message]

Quoted 11 lines
---
 doc/guides/rel_notes/release_2_3.rst |   2 +
 drivers/net/i40e/i40e_ethdev.c       | 153 ++++++++++++++++++++++++++++++-----
 drivers/net/i40e/i40e_ethdev.h       |  28 ++++---
 3 files changed, 151 insertions(+), 32 deletions(-)
doc/guides/rel_notes/release_2_3.rst +0 -0
index 99de186..cd3d391 100644

doc/guides/rel_notes/release_2_3.rst DPDK Release 2.3 · line 7

Quoted 4 lines
doc/guides/rel_notes/release_2_3.rst +1 -0
@@ -4,6 +4,8 @@ DPDK Release 2.3
 New Features
 ------------
 
+* **Added i40e DCB support in VMDQ mode.**

Suggest to reword this as: "Added support for DCB in VMDQ mode to i40e driver"

drivers/net/i40e/i40e_ethdev.c

Quoted 6 lines
doc/guides/rel_notes/release_2_3.rst +1 -0
+
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +0 -0
index bf6220d..fbafcc6 100644

<snip>

Thanks,
/Bruce

#7 lore raw

PATCH 2/3 ixgbe: add more multi queue mode checking

In reply to Jingjing Wu

The multi queue mode ETH_MQ_RX_VMDQ_DCB_RSS is not supported in ixgbe driver. This patch added the checking.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +5 -0
index 4c4c6df..24cd30b 100644
@@ -1853,6 +1853,11 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 			return -EINVAL;
 		}
 	} else {
+		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB_RSS) {
+			PMD_INIT_LOG(ERR, "VMDQ+DCB+RSS mq_mode is"
+					  " not supported.");
+			return -EINVAL;
+		}
 		/* check configuration for vmdb+dcb mode */
 		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {
 			const struct rte_eth_vmdq_dcb_conf *conf;
Signature · 1 line
2.4.0
#8 lore raw

PATCH 3/3 examples/vmdq_dcb: extend sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel® 82599 NICs. This patch extended this sample to make it work both on Intel® 82599 and X710/XL710 NICs by following changes:
1. add VMDQ base queue checking to avoid forwarding on PF queues.
2. assign each VMDQ pools with MAC address.
3. add more arguments (nb-tcs, enable-rss) to change the default setting
4. extend the max number of queues from 128 to 1024.
This patch also reworked the user guide for the vmdq_dcb sample.

---
 doc/guides/rel_notes/release_2_3.rst             |   2 +
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 169 ++++++----
 examples/vmdq_dcb/main.c                         | 388 ++++++++++++++++++-----
 3 files changed, 430 insertions(+), 129 deletions(-)
doc/guides/rel_notes/release_2_3.rst +2 -0
index cd3d391..9637bf1 100644
@@ -25,6 +25,8 @@ Libraries
 Examples
 ~~~~~~~~
 
+* **vmdq_dcb: extended to support Intel XL710 series NICs.**
+
 
 Other
 ~~~~~
doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +116 -53

251 lines not on this page · raw message

examples/vmdq_dcb/main.c +312 -76

575 lines not on this page · raw message

Signature · 1 line
2.4.0
#9 lore raw

v2 cover extend vmdq_dcb sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patchset extended this sample to make it works both on Intel(R) 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode in i40e driver and added unsupported mode checking in ixgbe driver.

v2 changes:
- commit log doc rewording.
- rebase on latest dpdk-next-net/rel_16_04 branch.
- code style fix

Jingjing Wu (3):
i40e: enable DCB in VMDQ VSIs
ixgbe: disallow unsupported RX mode examples/vmdq_dcb: extend sample for X710 supporting

 doc/guides/rel_notes/release_16_04.rst           |   3 +
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++++++----
 drivers/net/i40e/i40e_ethdev.c                   | 153 +++++++--
 drivers/net/i40e/i40e_ethdev.h                   |  28 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                 |   5 +
 examples/vmdq_dcb/main.c                         | 390 ++++++++++++++++++-----
 6 files changed, 587 insertions(+), 163 deletions(-)
Signature · 1 line
2.4.0
#10 lore raw

PATCH v2 1/3 i40e: enable DCB in VMDQ VSIs

Previously, DCB(Data Center Bridging) is only enabled on PF, queue mapping and BW configuration is only done on PF. This patch enabled DCB for VMDQ VSIs(Virtual Station Interfaces) by following steps:
1. Take BW and ETS(Enhanced Transmission Selection) configuration on VEB(Virtual Ethernet Bridge).
2. Take BW and ETS configuration on VMDQ VSIs.
3. Update TC(Traffic Class) and queues mapping on VMDQ VSIs.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

---
 doc/guides/rel_notes/release_16_04.rst |   3 +
 drivers/net/i40e/i40e_ethdev.c         | 153 +++++++++++++++++++++++++++++----
 drivers/net/i40e/i40e_ethdev.h         |  28 +++---
 3 files changed, 152 insertions(+), 32 deletions(-)
doc/guides/rel_notes/release_16_04.rst +3 -0
index 81f62f1..d3b035c 100644
@@ -56,6 +56,9 @@ This section should contain new features added in this release. Sample format:
   Added support for sw-firmware sync for resource sharing.
   Use the PHY token, shared between sw-fw for PHY access on X550EM_a.
 
+* **VMDQ DCB mode in i40e.**
+
+  Added support for DCB in VMDQ mode to i40e driver.
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +134 -19

214 lines not on this page · raw message

drivers/net/i40e/i40e_ethdev.h +15 -13
index 6edd7dd..c9c440c 100644
@@ -199,6 +199,19 @@ struct i40e_vsi_list {
 struct i40e_rx_queue;
 struct i40e_tx_queue;
 
+/* Bandwidth limit information */
+struct i40e_bw_info {
+	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
+	uint8_t  bw_max;        /* Max BW limit if enabled */
+
+	/* Relative credits within same TC with respect to other VSIs or Comps */
+	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Bandwidth limit per TC */
+	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Max bandwidth limit per TC */
+	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
+};
+
 /* Structure that defines a VEB */
 struct i40e_veb {
 	struct i40e_vsi_list_head head;
@@ -207,6 +220,8 @@ struct i40e_veb {
 	uint16_t uplink_seid; /* The uplink seid of this VEB */
 	uint16_t stats_idx;
 	struct i40e_eth_stats stats;
+	uint8_t enabled_tc;   /* The traffic class enabled */
+	struct i40e_bw_info bw_info; /* VEB bandwidth information */
 };
 
 /* i40e MACVLAN filter structure */
@@ -216,19 +231,6 @@ struct i40e_macvlan_filter {
 	uint16_t vlan_id;
 };
 
-/* Bandwidth limit information */
-struct i40e_bw_info {
-	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
-	uint8_t  bw_max;        /* Max BW limit if enabled */
-
-	/* Relative VSI credits within same TC with respect to other VSIs */
-	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Max bandwidth limit per TC */
-	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
-};
-
 /*
  * Structure that defines a VSI, associated with a adapter.
  */
Signature · 1 line
2.4.0
#11 lore raw

Re: [PATCH v2 1/3] i40e: enable DCB in VMDQ VSIs

Quoted 154 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Wednesday, February 17, 2016 2:58 PM
To: Richardson, Bruce
Cc: [email protected]; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v2 1/3] i40e: enable DCB in VMDQ VSIs

Previously, DCB(Data Center Bridging) is only enabled on PF, queue mapping and BW configuration is only done on PF.
This patch enabled DCB for VMDQ VSIs(Virtual Station Interfaces) by following steps:
1. Take BW and ETS(Enhanced Transmission Selection) configuration on VEB(Virtual Ethernet Bridge).
2. Take BW and ETS configuration on VMDQ VSIs.
3. Update TC(Traffic Class) and queues mapping on VMDQ VSIs.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

---
 doc/guides/rel_notes/release_16_04.rst |   3 +
 drivers/net/i40e/i40e_ethdev.c         | 153
+++++++++++++++++++++++++++++----
 drivers/net/i40e/i40e_ethdev.h         |  28 +++---
 3 files changed, 152 insertions(+), 32 deletions(-)
doc/guides/rel_notes/release_16_04.rst +0 -0
index 81f62f1..d3b035c 100644
@@ -56,6 +56,9 @@ This section should contain new features added in this

release. Sample format:
Added support for sw-firmware sync for resource sharing. Use the PHY token, shared between sw-fw for PHY access on X550EM_a.

doc/guides/rel_notes/release_16_04.rst +3 -0
+* **VMDQ DCB mode in i40e.**
+
+  Added support for DCB in VMDQ mode to i40e driver.
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +2 -0
index ef24122..fc06612 100644
@@ -8087,6 +8087,8 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi
 *vsi,
 	int i, total_tc = 0;
 	uint16_t qpnum_per_tc, bsf, qp_idx;
 	struct rte_eth_dev_data *dev_data = I40E_VSI_TO_DEV_DATA(vsi);
+	struct i40e_pf *pf = I40E_VSI_TO_PF(vsi);
+	uint16_t used_queues;
 
 	ret = validate_tcmap_parameter(vsi, enabled_tcmap);
drivers/net/i40e/i40e_ethdev.c +12 -1
 	if (ret != I40E_SUCCESS)
@@ -8100,7 +8102,18 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi
 *vsi,
 		total_tc = 1;
 	vsi->enabled_tc = enabled_tcmap;
 
-	qpnum_per_tc = dev_data->nb_rx_queues / total_tc;
+	/* different VSI has different queues assigned */
+	if (vsi->type == I40E_VSI_MAIN)
+		used_queues = dev_data->nb_rx_queues -
+			pf->nb_cfg_vmdq_vsi *
 RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
+	else if (vsi->type == I40E_VSI_VMDQ2)
+		used_queues = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
+	else {
+		PMD_INIT_LOG(ERR, "unsupported VSI type.");
+		return I40E_ERR_NO_AVAILABLE_VSI;
+	}
+
+	qpnum_per_tc = used_queues / total_tc;
 	/* Number of queues per enabled TC */
drivers/net/i40e/i40e_ethdev.c +32 -0
 	if (qpnum_per_tc == 0) {
 		PMD_INIT_LOG(ERR, " number of queues is less that tcs.");
@@ -8145,6 +8158,93 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi
 *vsi,  }
 
 /*
+ * i40e_config_switch_comp_tc - Configure VEB tc setting for given TC
+map
+ * @veb: VEB to be configured
+ * @tc_map: enabled TC bitmap
+ *
+ * Returns 0 on success, negative value on failure  */ static enum
+i40e_status_code i40e_config_switch_comp_tc(struct i40e_veb *veb,
+uint8_t tc_map) {
+	struct i40e_aqc_configure_switching_comp_bw_config_data
 veb_bw;
+	struct i40e_aqc_query_switching_comp_bw_config_resp bw_query;
+	struct i40e_aqc_query_switching_comp_ets_config_resp ets_query;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(veb->associate_vsi);
+	enum i40e_status_code ret = I40E_SUCCESS;
+	int i;
+	uint32_t bw_max;
+
+	/* Check if enabled_tc is same as existing or new TCs */
+	if (veb->enabled_tc == tc_map)
+		return ret;
+
+	/* configure tc bandwidth */
+	memset(&veb_bw, 0, sizeof(veb_bw));
+	veb_bw.tc_valid_bits = tc_map;
+	/* Enable ETS TCs with equal BW Share for now across all VSIs */
+	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+		if (tc_map & BIT_ULL(i))
+			veb_bw.tc_bw_share_credits[i] = 1;
+	}
+	ret = i40e_aq_config_switch_comp_bw_config(hw, veb->seid,
+						   &veb_bw, NULL);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "AQ command Config switch_comp BW

allocation"

drivers/net/i40e/i40e_ethdev.c +11 -0
+				  " per TC failed = %d",
+				  hw->aq.asq_last_status);
+		return ret;
+	}
+
+	memset(&ets_query, 0, sizeof(ets_query));
+	ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid,
+						   &ets_query, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to get switch_comp ETS"
+				 " configuration %u", hw-
Quoted 1 line

aq.asq_last_status);

drivers/net/i40e/i40e_ethdev.c +8 -0
+		return ret;
+	}
+	memset(&bw_query, 0, sizeof(bw_query));
+	ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid,
+						  &bw_query, NULL);
+	if (ret != I40E_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to get switch_comp bandwidth"
+				 " configuration %u", hw-
Quoted 1 line

aq.asq_last_status);

drivers/net/i40e/i40e_ethdev.c +5 -0
+		return ret;
+	}
+
+	/* store and print out BW info */
+	veb->bw_info.bw_limit =

rte_le_to_cpu_16(ets_query.port_bw_limit);

drivers/net/i40e/i40e_ethdev.c +2 -0
+	veb->bw_info.bw_max = ets_query.tc_bw_max;
+	PMD_DRV_LOG(DEBUG, "switch_comp bw limit:%u", veb-
Quoted 1 line

bw_info.bw_limit);

drivers/net/i40e/i40e_ethdev.c +1 -0
+	PMD_DRV_LOG(DEBUG, "switch_comp max_bw:%u", veb-
Quoted 1 line

bw_info.bw_max);

drivers/net/i40e/i40e_ethdev.c +2 -0
+	bw_max = rte_le_to_cpu_16(bw_query.tc_bw_max[0]) |
+		    (rte_le_to_cpu_16(bw_query.tc_bw_max[1]) <<

drivers/net/i40e/i40e_ethdev.c i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi, · line 8232

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +10 -0
+		     I40E_16_BIT_WIDTH);
+	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+		veb->bw_info.bw_ets_share_credits[i] =
+				bw_query.tc_bw_share_credits[i];
+		veb->bw_info.bw_ets_credits[i] =
+				rte_le_to_cpu_16(bw_query.tc_bw_limits[i]);
+		/* 4 bits per TC, 4th bit is reserved */
+		veb->bw_info.bw_ets_max[i] =
+			(uint8_t)((bw_max >> (i * I40E_4_BIT_WIDTH)) &
+				  I40E_3_BIT_MASK);

Use RTE_LEN2MASK() to replace I40E_3_BIT_MASK.

Quoted 30 lines
drivers/net/i40e/i40e_ethdev.c +16 -1
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:share credits %u", i,
+			    veb->bw_info.bw_ets_share_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:credits %u", i,
+			    veb->bw_info.bw_ets_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u: max credits: %u", i,
+			    veb->bw_info.bw_ets_max[i]);
+	}
+
+	veb->enabled_tc = tc_map;
+
+	return ret;
+}
+
+
+/*
  * i40e_vsi_config_tc - Configure VSI tc setting for given TC map
  * @vsi: VSI to be configured
  * @tc_map: enabled TC bitmap
@@ -8152,7 +8252,7 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi
 *vsi,
  * Returns 0 on success, negative value on failure
  */
 static enum i40e_status_code
-i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 tc_map)
+i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)
 {
 	struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
drivers/net/i40e/i40e_ethdev.c +0 -0
 	struct i40e_vsi_context ctxt;
@@ -8294,15 +8394,27 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
 	i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0,

drivers/net/i40e/i40e_ethdev.c i40e_dcb_hw_configure(struct i40e_pf *pf, · line 8404

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +8 -0
 				     &hw->local_dcbx_config);
 
+	/* if Veb is created, need to update TC of it at first */
+	if (main_vsi->veb) {
+		ret = i40e_config_switch_comp_tc(main_vsi->veb, tc_map);
+		if (ret)
+			PMD_INIT_LOG(WARNING,
+				 "Failed configuring TC for VEB seid=%d\n",
+				 main_vsi->veb->seid);
+	}

How about if VEB hasn't been created?

Quoted 144 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
 	/* Update each VSI */
 	i40e_vsi_config_tc(main_vsi, tc_map);
 	if (main_vsi->veb) {
 		TAILQ_FOREACH(vsi_list, &main_vsi->veb->head, list) {
-			/* Beside main VSI, only enable default
+			/* Beside main VSI and VMDQ VSIs, only enable

default

drivers/net/i40e/i40e_ethdev.c +6 -2
 			 * TC for other VSIs
 			 */
-			ret = i40e_vsi_config_tc(vsi_list->vsi,
-						I40E_DEFAULT_TCMAP);
+			if (vsi_list->vsi->type == I40E_VSI_VMDQ2)
+				ret = i40e_vsi_config_tc(vsi_list->vsi,
+							 tc_map);
+			else
+				ret = i40e_vsi_config_tc(vsi_list->vsi,
+

I40E_DEFAULT_TCMAP);

drivers/net/i40e/i40e_ethdev.c +0 -0
 			if (ret)
 				PMD_INIT_LOG(WARNING,
 					 "Failed configuring TC for VSI

seid=%d\n", @@ -8422,9 +8534,8 @@ i40e_dcb_setup(struct rte_eth_dev *dev)

drivers/net/i40e/i40e_ethdev.c +0 -2
 		return -ENOTSUP;
 	}
 
-	if (pf->vf_num != 0 ||
-	    (dev->data->dev_conf.rxmode.mq_mode &

ETH_MQ_RX_VMDQ_FLAG))

drivers/net/i40e/i40e_ethdev.c +2 -1
-		PMD_INIT_LOG(DEBUG, " DCB only works on main vsi.");
+	if (pf->vf_num != 0)
+		PMD_INIT_LOG(DEBUG, " DCB only works on pf and vmdq

vsis.");

drivers/net/i40e/i40e_ethdev.c +1 -1
 	ret = i40e_parse_dcb_configure(dev, &dcb_cfg, &tc_map);
 	if (ret) {
@@ -8449,7 +8560,7 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,
 	struct i40e_vsi *vsi = pf->main_vsi;
 	struct i40e_dcbx_config *dcb_cfg = &hw->local_dcbx_config;
 	uint16_t bsf, tc_mapping;
-	int i;
+	int i, j;
 
 	if (dev->data->dev_conf.rxmode.mq_mode &
 ETH_MQ_RX_DCB_FLAG)

dcb_info->nb_tcs = rte_bsf32(vsi->enabled_tc + 1); @@ -
8460,23 +8571,27 @@ i40e_dev_get_dcb_info(struct rte_eth_dev *dev,

drivers/net/i40e/i40e_ethdev.c +5 -2
 	for (i = 0; i < dcb_info->nb_tcs; i++)
 		dcb_info->tc_bws[i] = dcb_cfg->etscfg.tcbwtable[i];
 
-	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
-		if (vsi->enabled_tc & (1 << i)) {
+	j = 0;
+	do {
+		for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
+			if (!(vsi->enabled_tc & (1 << i)))
+				continue;
 			tc_mapping = rte_le_to_cpu_16(vsi-
Quoted 1 line

info.tc_mapping[i]);

drivers/net/i40e/i40e_ethdev.c +1 -1
 			/* only main vsi support multi TCs */
-			dcb_info->tc_queue.tc_rxq[0][i].base =
+			dcb_info->tc_queue.tc_rxq[j][i].base =
 				(tc_mapping &

I40E_AQ_VSI_TC_QUE_OFFSET_MASK) >>

drivers/net/i40e/i40e_ethdev.c +2 -2
 				I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT;
-			dcb_info->tc_queue.tc_txq[0][i].base =
-				dcb_info->tc_queue.tc_rxq[0][i].base;
+			dcb_info->tc_queue.tc_txq[j][i].base =
+				dcb_info->tc_queue.tc_rxq[j][i].base;
 			bsf = (tc_mapping &

I40E_AQ_VSI_TC_QUE_NUMBER_MASK) >>

drivers/net/i40e/i40e_ethdev.c +0 -1
 				I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT;
-			dcb_info->tc_queue.tc_rxq[0][i].nb_queue = 1 <<

bsf;

drivers/net/i40e/i40e_ethdev.c +6 -4
-			dcb_info->tc_queue.tc_txq[0][i].nb_queue =
-				dcb_info->tc_queue.tc_rxq[0][i].nb_queue;
+			dcb_info->tc_queue.tc_rxq[j][i].nb_queue = 1 << bsf;
+			dcb_info->tc_queue.tc_txq[j][i].nb_queue =
+				dcb_info->tc_queue.tc_rxq[j][i].nb_queue;
 		}
-	}
-
+		vsi = pf->vmdq[j].vsi;
+		j++;
+	} while (j < RTE_MIN(pf->nb_cfg_vmdq_vsi,

ETH_MAX_VMDQ_POOL));

drivers/net/i40e/i40e_ethdev.c +0 -0
 	return 0;
 }
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.h index 6edd7dd..c9c440c 100644

drivers/net/i40e/i40e_ethdev.h +6 -0
@@ -199,6 +199,19 @@ struct i40e_vsi_list {  struct i40e_rx_queue;  struct
 i40e_tx_queue;
 
+/* Bandwidth limit information */
+struct i40e_bw_info {
+	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
+	uint8_t  bw_max;        /* Max BW limit if enabled */
+
+	/* Relative credits within same TC with respect to other VSIs or

Comps */

drivers/net/i40e/i40e_ethdev.h +9 -14
+	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Bandwidth limit per TC */
+	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Max bandwidth limit per TC */
+	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
+};
+
 /* Structure that defines a VEB */
 struct i40e_veb {
 	struct i40e_vsi_list_head head;
@@ -207,6 +220,8 @@ struct i40e_veb {
 	uint16_t uplink_seid; /* The uplink seid of this VEB */
 	uint16_t stats_idx;
 	struct i40e_eth_stats stats;
+	uint8_t enabled_tc;   /* The traffic class enabled */
+	struct i40e_bw_info bw_info; /* VEB bandwidth information */
 };
 
 /* i40e MACVLAN filter structure */
@@ -216,19 +231,6 @@ struct i40e_macvlan_filter {
 	uint16_t vlan_id;
 };
 
-/* Bandwidth limit information */
-struct i40e_bw_info {
-	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
-	uint8_t  bw_max;        /* Max BW limit if enabled */
-
-	/* Relative VSI credits within same TC with respect to other VSIs */
-	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Max bandwidth limit per TC */
-	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
-};
-
 /*
  * Structure that defines a VSI, associated with a adapter.
  */
--

2.4.0

#12 lore raw

Re: [PATCH v2 1/3] i40e: enable DCB in VMDQ VSIs

Quoted 5 lines

drivers/net/i40e/i40e_ethdev.c i40e_vsi_update_queue_mapping(struct i40e_vsi *vsi, · line 8232

Quoted 4 lines
drivers/net/i40e/i40e_ethdev.c +4 -0
+		/* 4 bits per TC, 4th bit is reserved */
+		veb->bw_info.bw_ets_max[i] =
+			(uint8_t)((bw_max >> (i * I40E_4_BIT_WIDTH)) &
+				  I40E_3_BIT_MASK);

Use RTE_LEN2MASK() to replace I40E_3_BIT_MASK.

OK.

Quoted 33 lines
Quoted 33 lines
drivers/net/i40e/i40e_ethdev.c +16 -1
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:share credits %u", i,
+			    veb->bw_info.bw_ets_share_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u:credits %u", i,
+			    veb->bw_info.bw_ets_credits[i]);
+		PMD_DRV_LOG(DEBUG, "\tVEB TC%u: max credits: %u", i,
+			    veb->bw_info.bw_ets_max[i]);
+	}
+
+	veb->enabled_tc = tc_map;
+
+	return ret;
+}
+
+
+/*
  * i40e_vsi_config_tc - Configure VSI tc setting for given TC map
  * @vsi: VSI to be configured
  * @tc_map: enabled TC bitmap
@@ -8152,7 +8252,7 @@ i40e_vsi_update_queue_mapping(struct i40e_vsi
 *vsi,
  * Returns 0 on success, negative value on failure
  */
 static enum i40e_status_code
-i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 tc_map)
+i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)
 {
 	struct i40e_aqc_configure_vsi_tc_bw_data bw_data;
drivers/net/i40e/i40e_ethdev.c +0 -0
 	struct i40e_vsi_context ctxt;
@@ -8294,15 +8394,27 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
 	i40e_aq_get_dcb_config(hw, I40E_AQ_LLDP_MIB_LOCAL, 0,
 				     &hw->local_dcbx_config);
 
Quoted 9 lines

drivers/net/i40e/i40e_ethdev.c i40e_dcb_hw_configure(struct i40e_pf *pf, · line 8404

Quoted 8 lines
drivers/net/i40e/i40e_ethdev.c +8 -0
+	/* if Veb is created, need to update TC of it at first */
+	if (main_vsi->veb) {
+		ret = i40e_config_switch_comp_tc(main_vsi->veb, tc_map);
+		if (ret)
+			PMD_INIT_LOG(WARNING,
+				 "Failed configuring TC for VEB seid=%d\n",
+				 main_vsi->veb->seid);
+	}

How about if VEB hasn't been created?

If VEB is not created, no need to update tc on switch comp.

Thanks
Jingjing

Quoted 2 lines
Quoted 2 lines

2.4.0

#13 lore raw

PATCH v2 2/3 ixgbe: disallow unsupported RX mode

In reply to Jingjing Wu

The multi queue mode ETH_MQ_RX_VMDQ_DCB_RSS is not supported in ixgbe driver. This patch added the checking.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +5 -0
index a1596b3..ce32cbc 100644
@@ -1855,6 +1855,11 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 			return -EINVAL;
 		}
 	} else {
+		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB_RSS) {
+			PMD_INIT_LOG(ERR, "VMDQ+DCB+RSS mq_mode is"
+					  " not supported.");
+			return -EINVAL;
+		}
 		/* check configuration for vmdb+dcb mode */
 		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {
 			const struct rte_eth_vmdq_dcb_conf *conf;
Signature · 1 line
2.4.0
#14 lore raw

PATCH v2 3/3 examples/vmdq_dcb: extend sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patch extended this sample to make it work both on Intel(R) 82599 and X710/XL710 NICs by following changes:
1. add VMDQ base queue checking to avoid forwarding on PF queues.
2. assign each VMDQ pools with MAC address.
3. add more arguments (nb-tcs, enable-rss) to change the default setting
4. extend the max number of queues from 128 to 1024.
This patch also reworked the user guide for the vmdq_dcb sample.

---
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++++++----
 examples/vmdq_dcb/main.c                         | 390 ++++++++++++++++++-----
 2 files changed, 430 insertions(+), 131 deletions(-)
doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +117 -54
index 9140a22..305636b 100644
@@ -32,8 +32,8 @@ VMDQ and DCB Forwarding Sample Application
 ==========================================
 
 The VMDQ and DCB Forwarding sample application is a simple example of packet processing using the DPDK.
-The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into 128 queues.
-The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 10 Gigabit Ethernet Controller.
+The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into queues.
+The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 and X710/XL710 Ethernet Controllers.
 
 Overview
 --------
@@ -41,28 +41,27 @@ Overview
 This sample application can be used as a starting point for developing a new application that is based on the DPDK and
 uses VMDQ and DCB for traffic partitioning.
 
-The VMDQ and DCB filters work on VLAN traffic to divide the traffic into 128 input queues on the basis of the VLAN ID field and
-VLAN user priority field.
-VMDQ filters split the traffic into 16 or 32 groups based on the VLAN ID.
-Then, DCB places each packet into one of either 4 or 8 queues within that group, based upon the VLAN user priority field.
-
-In either case, 16 groups of 8 queues, or 32 groups of 4 queues, the traffic can be split into 128 hardware queues on the NIC,
-each of which can be polled individually by a DPDK application.
+The VMDQ and DCB filters work on MAC and VLAN traffic to divide the traffic into input queues on the basis of the Destination MAC
+address, VLAN ID and VLAN user priority fields.
+VMDQ filters split the traffic into 16 or 32 groups based on the Destination MAC and VLAN ID.
+Then, DCB places each packet into one of queues within that group, based upon the VLAN user priority field.
 
 All traffic is read from a single incoming port (port 0) and output on port 1, without any processing being performed.
-The traffic is split into 128 queues on input, where each thread of the application reads from multiple queues.
-For example, when run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
+With Intel® 82599 NIC, for example, the traffic is split into 128 queues on input, where each thread of the application reads from
+multiple queues. When run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
 
-As supplied, the sample application configures the VMDQ feature to have 16 pools with 8 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
-The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 32 pools of 4 queues each and
-this can be used by changing the NUM_POOLS parameter in the supplied code.
-The NUM_POOLS parameter can be passed on the command line, after the EAL parameters:
+As supplied, the sample application configures the VMDQ feature to have 32 pools with 4 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
+The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 16 pools of 8 queues. While the
+Intel® X710 or XL710 Ethernet Controller NICs support many configurations of VMDQ pools of 4 or 8 queues each. For simplicity, only 16
+or 32 pools is supported in this sample. And queues numbers for each VMDQ pool can be changed by setting CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM
+in config/common_* file.
+The nb-pools, nb-tcs and enable-rss parameters can be passed on the command line, after the EAL parameters:
 
 .. code-block:: console
 
-    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP
+    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP --nb-tcs TC --enable-rss
 
-where, NP can be 16 or 32.
+where, NP can be 16 or 32, TC can be 4 or 8, rss is disabled by default.
 
 .. _figure_vmdq_dcb_example:
 
@@ -72,9 +71,7 @@ where, NP can be 16 or 32.
 
 
 In Linux* user space, the application can display statistics with the number of packets received on each queue.
-To have the application display the statistics, send a SIGHUP signal to the running application process, as follows:
-
-where, <pid> is the process id of the application process.
+To have the application display the statistics, send a SIGHUP signal to the running application process.
 
 The VMDQ and DCB Forwarding sample application is in many ways simpler than the L2 Forwarding application
 (see Chapter 9 , "L2 Forwarding Sample Application (in Real and Virtualized Environments)")
@@ -117,7 +114,7 @@ To run the example in a linuxapp environment:
 
 .. code-block:: console
 
-    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 16
+    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 32 --nb-tcs 4
 
 Refer to the *DPDK Getting Started Guide* for general information on running applications and
 the Environment Abstraction Layer (EAL) options.
@@ -143,34 +140,48 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 .. code-block:: c
 
     /* empty vmdq+dcb configuration structure. Filled in programmatically */
-
     static const struct rte_eth_conf vmdq_dcb_conf_default = {
         .rxmode = {
-            .mq_mode = ETH_VMDQ_DCB,
+            .mq_mode        = ETH_MQ_RX_VMDQ_DCB,
             .split_hdr_size = 0,
-            .header_split = 0,   /**< Header Split disabled */
+            .header_split   = 0, /**< Header Split disabled */
             .hw_ip_checksum = 0, /**< IP checksum offload disabled */
             .hw_vlan_filter = 0, /**< VLAN filtering disabled */
-           .jumbo_frame = 0,     /**< Jumbo Frame Support disabled */
+            .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
         },
-
         .txmode = {
-            .mq_mode = ETH_DCB_NONE,
+            .mq_mode = ETH_MQ_TX_VMDQ_DCB,
         },
-
+        /*
+         * should be overridden separately in code with
+         * appropriate values
+         */
         .rx_adv_conf = {
-            /*
-             *    should be overridden separately in code with
-             *    appropriate values
-             */
-
             .vmdq_dcb_conf = {
-                .nb_queue_pools = ETH_16_POOLS,
+                .nb_queue_pools = ETH_32_POOLS,
+                .enable_default_pool = 0,
+                .default_pool = 0,
+                .nb_pool_maps = 0,
+                .pool_map = {{0, 0},},
+                .dcb_tc = {0},
+            },
+            .dcb_rx_conf = {
+                .nb_tcs = ETH_4_TCS,
+                /** Traffic class each UP mapped to. */
+                .dcb_tc = {0},
+            },
+            .vmdq_rx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
                 .enable_default_pool = 0,
                 .default_pool = 0,
                 .nb_pool_maps = 0,
                 .pool_map = {{0, 0},},
-                .dcb_queue = {0},
+            },
+        },
+        .tx_adv_conf = {
+            .vmdq_dcb_tx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
+                .dcb_tc = {0},
             },
         },
     };
@@ -178,11 +189,17 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 The get_eth_conf() function fills in an rte_eth_conf structure with the appropriate values,
 based on the global vlan_tags array,
 and dividing up the possible user priority values equally among the individual queues
-(also referred to as traffic classes) within each pool, that is,
-if the number of pools is 32, then the user priority fields are allocated two to a queue.
+(also referred to as traffic classes) within each pool. With Intel® 82599 NIC,
+if the number of pools is 32, then the user priority fields are allocated 2 to a queue.
 If 16 pools are used, then each of the 8 user priority fields is allocated to its own queue within the pool.
+With Intel® X710/XL710 NICs, if number of tcs is 4, and number of queues in pool is 8,
+then the user priority fields are allocated 2 to one tc, and a tc has 2 queues mapping to it, then
+RSS will determine the destination queue in 2.
 For the VLAN IDs, each one can be allocated to possibly multiple pools of queues,
 so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a bitmask value.
+For destination MAC, each VMDQ pool will be assigned with a MAC address. In this sample, each VMDQ pool
+is assigned to the MAC like 52:54:00:12:<port_id>:<pool_id>, that is,
+the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02.
 
 .. code-block:: c
 
@@ -193,38 +210,84 @@ so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a
         24, 25, 26, 27, 28, 29, 30, 31
     };
 
+    /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */
+    static struct ether_addr pool_addr_template = {
+        .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00}
+    };
 
     /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array
      * given above, and the number of traffic classes available for use. */
-
     static inline int
-    get_eth_conf(struct rte_eth_conf *eth_conf, enum rte_eth_nb_pools num_pools)
+    get_eth_conf(struct rte_eth_conf *eth_conf)
     {
         struct rte_eth_vmdq_dcb_conf conf;
-        unsigned i;
-
-        if (num_pools != ETH_16_POOLS && num_pools != ETH_32_POOLS ) return -1;
-
-        conf.nb_queue_pools = num_pools;
+        struct rte_eth_vmdq_rx_conf  vmdq_conf;
+        struct rte_eth_dcb_rx_conf   dcb_conf;
+        struct rte_eth_vmdq_dcb_tx_conf tx_conf;
+        uint8_t i;
+
+        conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        vmdq_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        tx_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        conf.nb_pool_maps = num_pools;
+        vmdq_conf.nb_pool_maps = num_pools;
         conf.enable_default_pool = 0;
+        vmdq_conf.enable_default_pool = 0;
         conf.default_pool = 0; /* set explicit value, even if not used */
-        conf.nb_pool_maps = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
+        vmdq_conf.default_pool = 0;
 
-        for (i = 0; i < conf.nb_pool_maps; i++){
-            conf.pool_map[i].vlan_id = vlan_tags[ i ];
-            conf.pool_map[i].pools = 1 << (i % num_pools);
+        for (i = 0; i < conf.nb_pool_maps; i++) {
+            conf.pool_map[i].vlan_id = vlan_tags[i];
+            vmdq_conf.pool_map[i].vlan_id = vlan_tags[i];
+            conf.pool_map[i].pools = 1UL << i ;
+            vmdq_conf.pool_map[i].pools = 1UL << i;
         }
-
         for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++){
-            conf.dcb_queue[i] = (uint8_t)(i % (NUM_QUEUES/num_pools));
+            conf.dcb_tc[i] = i % num_tcs;
+            dcb_conf.dcb_tc[i] = i % num_tcs;
+            tx_conf.dcb_tc[i] = i % num_tcs;
+        }
+        dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs;
+        (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf,
+                  sizeof(conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf,
+                  sizeof(dcb_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf,
+                  sizeof(vmdq_conf)));
+        (void)(rte_memcpy(&eth_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf,
+                  sizeof(tx_conf)));
+        if (rss_enable) {
+            eth_conf->rxmode.mq_mode= ETH_MQ_RX_VMDQ_DCB_RSS;
+            eth_conf->rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP |
+                                ETH_RSS_UDP |
+                                ETH_RSS_TCP |
+                                ETH_RSS_SCTP;
         }
-
-        (void) rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(\*eth_conf));
-        (void) rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_dcb_conf));
-
         return 0;
     }
 
+    ......
+
+    /* Set mac for each pool.*/
+    for (q = 0; q < num_pools; q++) {
+        struct ether_addr mac;
+        mac = pool_addr_template;
+        mac.addr_bytes[4] = port;
+        mac.addr_bytes[5] = q;
+        printf("Port %u vmdq pool %u set mac %02x:%02x:%02x:%02x:%02x:%02x\n",
+            port, q,
+            mac.addr_bytes[0], mac.addr_bytes[1],
+            mac.addr_bytes[2], mac.addr_bytes[3],
+            mac.addr_bytes[4], mac.addr_bytes[5]);
+        retval = rte_eth_dev_mac_addr_add(port, &mac,
+                q + vmdq_pool_base);
+        if (retval) {
+            printf("mac addr add failed at pool %d\n", q);
+            return retval;
+        }
+    }
+
 Once the network port has been initialized using the correct VMDQ and DCB values,
 the initialization of the port's RX and TX hardware rings is performed similarly to that
 in the L2 Forwarding sample application.
examples/vmdq_dcb/main.c +313 -77

576 lines not on this page · raw message

Signature · 1 line
2.4.0
#15 lore raw

v3 cover extend vmdq_dcb sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patchset extended this sample to make it works both on Intel(R) 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode in i40e driver and added unsupported mode checking in ixgbe driver.

v2 changes:
- commit log doc rewording.
- rebase on latest dpdk-next-net/rel_16_04 branch.
- code style fix

v3 changes:
- replace I40E_3_BIT_MASK with RTE_LEN2MASK()

Jingjing Wu (3):
i40e: enable DCB in VMDQ VSIs
ixgbe: disallow unsupported RX mode examples/vmdq_dcb: extend sample for X710 supporting

 doc/guides/rel_notes/release_16_04.rst           |   3 +
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++++++----
 drivers/net/i40e/i40e_ethdev.c                   | 156 +++++++--
 drivers/net/i40e/i40e_ethdev.h                   |  28 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                 |   5 +
 examples/vmdq_dcb/main.c                         | 391 ++++++++++++++++++-----
 6 files changed, 589 insertions(+), 165 deletions(-)
Signature · 1 line
2.4.0
#16 lore raw

PATCH v3 1/3 i40e: enable DCB in VMDQ VSIs

Previously, DCB(Data Center Bridging) is only enabled on PF, queue mapping and BW configuration is only done on PF. This patch enabled DCB for VMDQ VSIs(Virtual Station Interfaces) by following steps:
1. Take BW and ETS(Enhanced Transmission Selection) configuration on VEB(Virtual Ethernet Bridge).
2. Take BW and ETS configuration on VMDQ VSIs.
3. Update TC(Traffic Class) and queues mapping on VMDQ VSIs.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file.

---
 doc/guides/rel_notes/release_16_04.rst |   3 +
 drivers/net/i40e/i40e_ethdev.c         | 156 ++++++++++++++++++++++++++++-----
 drivers/net/i40e/i40e_ethdev.h         |  28 +++---
 3 files changed, 153 insertions(+), 34 deletions(-)
doc/guides/rel_notes/release_16_04.rst +3 -0
index 81f62f1..d3b035c 100644
@@ -56,6 +56,9 @@ This section should contain new features added in this release. Sample format:
   Added support for sw-firmware sync for resource sharing.
   Use the PHY token, shared between sw-fw for PHY access on X550EM_a.
 
+* **VMDQ DCB mode in i40e.**
+
+  Added support for DCB in VMDQ mode to i40e driver.
 
 Resolved Issues
 ---------------
drivers/net/i40e/i40e_ethdev.c +135 -21

229 lines not on this page · raw message

drivers/net/i40e/i40e_ethdev.h +15 -13
index 6edd7dd..c9c440c 100644
@@ -199,6 +199,19 @@ struct i40e_vsi_list {
 struct i40e_rx_queue;
 struct i40e_tx_queue;
 
+/* Bandwidth limit information */
+struct i40e_bw_info {
+	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
+	uint8_t  bw_max;        /* Max BW limit if enabled */
+
+	/* Relative credits within same TC with respect to other VSIs or Comps */
+	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Bandwidth limit per TC */
+	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
+	/* Max bandwidth limit per TC */
+	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
+};
+
 /* Structure that defines a VEB */
 struct i40e_veb {
 	struct i40e_vsi_list_head head;
@@ -207,6 +220,8 @@ struct i40e_veb {
 	uint16_t uplink_seid; /* The uplink seid of this VEB */
 	uint16_t stats_idx;
 	struct i40e_eth_stats stats;
+	uint8_t enabled_tc;   /* The traffic class enabled */
+	struct i40e_bw_info bw_info; /* VEB bandwidth information */
 };
 
 /* i40e MACVLAN filter structure */
@@ -216,19 +231,6 @@ struct i40e_macvlan_filter {
 	uint16_t vlan_id;
 };
 
-/* Bandwidth limit information */
-struct i40e_bw_info {
-	uint16_t bw_limit;      /* BW Limit (0 = disabled) */
-	uint8_t  bw_max;        /* Max BW limit if enabled */
-
-	/* Relative VSI credits within same TC with respect to other VSIs */
-	uint8_t  bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Bandwidth limit per TC */
-	uint8_t  bw_ets_credits[I40E_MAX_TRAFFIC_CLASS];
-	/* Max bandwidth limit per TC */
-	uint8_t  bw_ets_max[I40E_MAX_TRAFFIC_CLASS];
-};
-
 /*
  * Structure that defines a VSI, associated with a adapter.
  */
Signature · 1 line
2.4.0
Acked-by on v3 1/3
#17 lore raw

Re: [PATCH v3 1/3] i40e: enable DCB in VMDQ VSIs

Quoted 22 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Thursday, February 25, 2016 3:34 PM
To: Richardson, Bruce
Cc: [email protected]; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v3 1/3] i40e: enable DCB in VMDQ VSIs

Previously, DCB(Data Center Bridging) is only enabled on PF, queue mapping and BW configuration is only done on PF.
This patch enabled DCB for VMDQ VSIs(Virtual Station Interfaces) by following steps:
1. Take BW and ETS(Enhanced Transmission Selection) configuration on VEB(Virtual Ethernet Bridge).
2. Take BW and ETS configuration on VMDQ VSIs.
3. Update TC(Traffic Class) and queues mapping on VMDQ VSIs.
To enable DCB on VMDQ, the number of TCs should not be lager than the number of queues in VMDQ pools, and the number of queues per VMDQ pool is specified by CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM
in config/common_* file.

Quoted 1 line
#18 lore raw

PATCH v3 2/3 ixgbe: disallow unsupported RX mode

In reply to Jingjing Wu

The multi queue mode ETH_MQ_RX_VMDQ_DCB_RSS is not supported in ixgbe driver. This patch added the checking.

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ixgbe/ixgbe_ethdev.c +5 -0
index a1596b3..ce32cbc 100644
@@ -1855,6 +1855,11 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 			return -EINVAL;
 		}
 	} else {
+		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB_RSS) {
+			PMD_INIT_LOG(ERR, "VMDQ+DCB+RSS mq_mode is"
+					  " not supported.");
+			return -EINVAL;
+		}
 		/* check configuration for vmdb+dcb mode */
 		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {
 			const struct rte_eth_vmdq_dcb_conf *conf;
Signature · 1 line
2.4.0
Acked-by on v3 2/3
#19 lore raw

Re: [PATCH v3 2/3] ixgbe: disallow unsupported RX mode

Quoted 9 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Thursday, February 25, 2016 3:34 PM
To: Richardson, Bruce
Cc: [email protected]; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v3 2/3] ixgbe: disallow unsupported RX mode

Quoted 4 lines

The multi queue mode ETH_MQ_RX_VMDQ_DCB_RSS is not supported in ixgbe driver. This patch added the checking.

#20 lore raw

PATCH v3 3/3 examples/vmdq_dcb: extend sample for X710 supporting

In reply to Jingjing Wu

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patch extended this sample to make it work both on Intel(R) 82599 and X710/XL710 NICs by following changes:
1. add VMDQ base queue checking to avoid forwarding on PF queues.
2. assign each VMDQ pools with MAC address.
3. add more arguments (nb-tcs, enable-rss) to change the default setting
4. extend the max number of queues from 128 to 1024.
This patch also reworked the user guide for the vmdq_dcb sample.

---
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++++++----
 examples/vmdq_dcb/main.c                         | 391 ++++++++++++++++++-----
 2 files changed, 431 insertions(+), 131 deletions(-)
doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +117 -54
index 9140a22..305636b 100644
@@ -32,8 +32,8 @@ VMDQ and DCB Forwarding Sample Application
 ==========================================
 
 The VMDQ and DCB Forwarding sample application is a simple example of packet processing using the DPDK.
-The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into 128 queues.
-The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 10 Gigabit Ethernet Controller.
+The application performs L2 forwarding using VMDQ and DCB to divide the incoming traffic into queues.
+The traffic splitting is performed in hardware by the VMDQ and DCB features of the Intel® 82599 and X710/XL710 Ethernet Controllers.
 
 Overview
 --------
@@ -41,28 +41,27 @@ Overview
 This sample application can be used as a starting point for developing a new application that is based on the DPDK and
 uses VMDQ and DCB for traffic partitioning.
 
-The VMDQ and DCB filters work on VLAN traffic to divide the traffic into 128 input queues on the basis of the VLAN ID field and
-VLAN user priority field.
-VMDQ filters split the traffic into 16 or 32 groups based on the VLAN ID.
-Then, DCB places each packet into one of either 4 or 8 queues within that group, based upon the VLAN user priority field.
-
-In either case, 16 groups of 8 queues, or 32 groups of 4 queues, the traffic can be split into 128 hardware queues on the NIC,
-each of which can be polled individually by a DPDK application.
+The VMDQ and DCB filters work on MAC and VLAN traffic to divide the traffic into input queues on the basis of the Destination MAC
+address, VLAN ID and VLAN user priority fields.
+VMDQ filters split the traffic into 16 or 32 groups based on the Destination MAC and VLAN ID.
+Then, DCB places each packet into one of queues within that group, based upon the VLAN user priority field.
 
 All traffic is read from a single incoming port (port 0) and output on port 1, without any processing being performed.
-The traffic is split into 128 queues on input, where each thread of the application reads from multiple queues.
-For example, when run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
+With Intel® 82599 NIC, for example, the traffic is split into 128 queues on input, where each thread of the application reads from
+multiple queues. When run with 8 threads, that is, with the -c FF option, each thread receives and forwards packets from 16 queues.
 
-As supplied, the sample application configures the VMDQ feature to have 16 pools with 8 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
-The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 32 pools of 4 queues each and
-this can be used by changing the NUM_POOLS parameter in the supplied code.
-The NUM_POOLS parameter can be passed on the command line, after the EAL parameters:
+As supplied, the sample application configures the VMDQ feature to have 32 pools with 4 queues each as indicated in :numref:`figure_vmdq_dcb_example`.
+The Intel® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting of traffic into 16 pools of 8 queues. While the
+Intel® X710 or XL710 Ethernet Controller NICs support many configurations of VMDQ pools of 4 or 8 queues each. For simplicity, only 16
+or 32 pools is supported in this sample. And queues numbers for each VMDQ pool can be changed by setting CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM
+in config/common_* file.
+The nb-pools, nb-tcs and enable-rss parameters can be passed on the command line, after the EAL parameters:
 
 .. code-block:: console
 
-    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP
+    ./build/vmdq_dcb [EAL options] -- -p PORTMASK --nb-pools NP --nb-tcs TC --enable-rss
 
-where, NP can be 16 or 32.
+where, NP can be 16 or 32, TC can be 4 or 8, rss is disabled by default.
 
 .. _figure_vmdq_dcb_example:
 
@@ -72,9 +71,7 @@ where, NP can be 16 or 32.
 
 
 In Linux* user space, the application can display statistics with the number of packets received on each queue.
-To have the application display the statistics, send a SIGHUP signal to the running application process, as follows:
-
-where, <pid> is the process id of the application process.
+To have the application display the statistics, send a SIGHUP signal to the running application process.
 
 The VMDQ and DCB Forwarding sample application is in many ways simpler than the L2 Forwarding application
 (see Chapter 9 , "L2 Forwarding Sample Application (in Real and Virtualized Environments)")
@@ -117,7 +114,7 @@ To run the example in a linuxapp environment:
 
 .. code-block:: console
 
-    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 16
+    user@target:~$ ./build/vmdq_dcb -c f -n 4 -- -p 0x3 --nb-pools 32 --nb-tcs 4
 
 Refer to the *DPDK Getting Started Guide* for general information on running applications and
 the Environment Abstraction Layer (EAL) options.
@@ -143,34 +140,48 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 .. code-block:: c
 
     /* empty vmdq+dcb configuration structure. Filled in programmatically */
-
     static const struct rte_eth_conf vmdq_dcb_conf_default = {
         .rxmode = {
-            .mq_mode = ETH_VMDQ_DCB,
+            .mq_mode        = ETH_MQ_RX_VMDQ_DCB,
             .split_hdr_size = 0,
-            .header_split = 0,   /**< Header Split disabled */
+            .header_split   = 0, /**< Header Split disabled */
             .hw_ip_checksum = 0, /**< IP checksum offload disabled */
             .hw_vlan_filter = 0, /**< VLAN filtering disabled */
-           .jumbo_frame = 0,     /**< Jumbo Frame Support disabled */
+            .jumbo_frame    = 0, /**< Jumbo Frame Support disabled */
         },
-
         .txmode = {
-            .mq_mode = ETH_DCB_NONE,
+            .mq_mode = ETH_MQ_TX_VMDQ_DCB,
         },
-
+        /*
+         * should be overridden separately in code with
+         * appropriate values
+         */
         .rx_adv_conf = {
-            /*
-             *    should be overridden separately in code with
-             *    appropriate values
-             */
-
             .vmdq_dcb_conf = {
-                .nb_queue_pools = ETH_16_POOLS,
+                .nb_queue_pools = ETH_32_POOLS,
+                .enable_default_pool = 0,
+                .default_pool = 0,
+                .nb_pool_maps = 0,
+                .pool_map = {{0, 0},},
+                .dcb_tc = {0},
+            },
+            .dcb_rx_conf = {
+                .nb_tcs = ETH_4_TCS,
+                /** Traffic class each UP mapped to. */
+                .dcb_tc = {0},
+            },
+            .vmdq_rx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
                 .enable_default_pool = 0,
                 .default_pool = 0,
                 .nb_pool_maps = 0,
                 .pool_map = {{0, 0},},
-                .dcb_queue = {0},
+            },
+        },
+        .tx_adv_conf = {
+            .vmdq_dcb_tx_conf = {
+                .nb_queue_pools = ETH_32_POOLS,
+                .dcb_tc = {0},
             },
         },
     };
@@ -178,11 +189,17 @@ a default structure is provided for VMDQ and DCB configuration to be filled in l
 The get_eth_conf() function fills in an rte_eth_conf structure with the appropriate values,
 based on the global vlan_tags array,
 and dividing up the possible user priority values equally among the individual queues
-(also referred to as traffic classes) within each pool, that is,
-if the number of pools is 32, then the user priority fields are allocated two to a queue.
+(also referred to as traffic classes) within each pool. With Intel® 82599 NIC,
+if the number of pools is 32, then the user priority fields are allocated 2 to a queue.
 If 16 pools are used, then each of the 8 user priority fields is allocated to its own queue within the pool.
+With Intel® X710/XL710 NICs, if number of tcs is 4, and number of queues in pool is 8,
+then the user priority fields are allocated 2 to one tc, and a tc has 2 queues mapping to it, then
+RSS will determine the destination queue in 2.
 For the VLAN IDs, each one can be allocated to possibly multiple pools of queues,
 so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a bitmask value.
+For destination MAC, each VMDQ pool will be assigned with a MAC address. In this sample, each VMDQ pool
+is assigned to the MAC like 52:54:00:12:<port_id>:<pool_id>, that is,
+the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02.
 
 .. code-block:: c
 
@@ -193,38 +210,84 @@ so the pools parameter in the rte_eth_vmdq_dcb_conf structure is specified as a
         24, 25, 26, 27, 28, 29, 30, 31
     };
 
+    /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */
+    static struct ether_addr pool_addr_template = {
+        .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00}
+    };
 
     /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array
      * given above, and the number of traffic classes available for use. */
-
     static inline int
-    get_eth_conf(struct rte_eth_conf *eth_conf, enum rte_eth_nb_pools num_pools)
+    get_eth_conf(struct rte_eth_conf *eth_conf)
     {
         struct rte_eth_vmdq_dcb_conf conf;
-        unsigned i;
-
-        if (num_pools != ETH_16_POOLS && num_pools != ETH_32_POOLS ) return -1;
-
-        conf.nb_queue_pools = num_pools;
+        struct rte_eth_vmdq_rx_conf  vmdq_conf;
+        struct rte_eth_dcb_rx_conf   dcb_conf;
+        struct rte_eth_vmdq_dcb_tx_conf tx_conf;
+        uint8_t i;
+
+        conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        vmdq_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        tx_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
+        conf.nb_pool_maps = num_pools;
+        vmdq_conf.nb_pool_maps = num_pools;
         conf.enable_default_pool = 0;
+        vmdq_conf.enable_default_pool = 0;
         conf.default_pool = 0; /* set explicit value, even if not used */
-        conf.nb_pool_maps = sizeof( vlan_tags )/sizeof( vlan_tags[ 0 ]);
+        vmdq_conf.default_pool = 0;
 
-        for (i = 0; i < conf.nb_pool_maps; i++){
-            conf.pool_map[i].vlan_id = vlan_tags[ i ];
-            conf.pool_map[i].pools = 1 << (i % num_pools);
+        for (i = 0; i < conf.nb_pool_maps; i++) {
+            conf.pool_map[i].vlan_id = vlan_tags[i];
+            vmdq_conf.pool_map[i].vlan_id = vlan_tags[i];
+            conf.pool_map[i].pools = 1UL << i ;
+            vmdq_conf.pool_map[i].pools = 1UL << i;
         }
-
         for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++){
-            conf.dcb_queue[i] = (uint8_t)(i % (NUM_QUEUES/num_pools));
+            conf.dcb_tc[i] = i % num_tcs;
+            dcb_conf.dcb_tc[i] = i % num_tcs;
+            tx_conf.dcb_tc[i] = i % num_tcs;
+        }
+        dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs;
+        (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf,
+                  sizeof(conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf,
+                  sizeof(dcb_conf)));
+        (void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf,
+                  sizeof(vmdq_conf)));
+        (void)(rte_memcpy(&eth_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf,
+                  sizeof(tx_conf)));
+        if (rss_enable) {
+            eth_conf->rxmode.mq_mode= ETH_MQ_RX_VMDQ_DCB_RSS;
+            eth_conf->rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP |
+                                ETH_RSS_UDP |
+                                ETH_RSS_TCP |
+                                ETH_RSS_SCTP;
         }
-
-        (void) rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(\*eth_conf));
-        (void) rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_dcb_conf));
-
         return 0;
     }
 
+    ......
+
+    /* Set mac for each pool.*/
+    for (q = 0; q < num_pools; q++) {
+        struct ether_addr mac;
+        mac = pool_addr_template;
+        mac.addr_bytes[4] = port;
+        mac.addr_bytes[5] = q;
+        printf("Port %u vmdq pool %u set mac %02x:%02x:%02x:%02x:%02x:%02x\n",
+            port, q,
+            mac.addr_bytes[0], mac.addr_bytes[1],
+            mac.addr_bytes[2], mac.addr_bytes[3],
+            mac.addr_bytes[4], mac.addr_bytes[5]);
+        retval = rte_eth_dev_mac_addr_add(port, &mac,
+                q + vmdq_pool_base);
+        if (retval) {
+            printf("mac addr add failed at pool %d\n", q);
+            return retval;
+        }
+    }
+
 Once the network port has been initialized using the correct VMDQ and DCB values,
 the initialization of the port's RX and TX hardware rings is performed similarly to that
 in the L2 Forwarding sample application.
examples/vmdq_dcb/main.c +314 -77

577 lines not on this page · raw message

Signature · 1 line
2.4.0
Acked-by on v3 3/3
#21 lore raw

Re: [PATCH v3 3/3] examples/vmdq_dcb: extend sample for X710 supporting

Quoted 20 lines

-----Original Message-----
From: Wu, Jingjing
Sent: Thursday, February 25, 2016 3:34 PM
To: Richardson, Bruce
Cc: [email protected]; Wu, Jingjing; Zhang, Helin
Subject: [PATCH v3 3/3] examples/vmdq_dcb: extend sample for X710 supporting

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patch extended this sample to make it work both on Intel(R) 82599 and X710/XL710 NICs by following changes:
1. add VMDQ base queue checking to avoid forwarding on PF queues.
2. assign each VMDQ pools with MAC address.
3. add more arguments (nb-tcs, enable-rss) to change the default setting
4. extend the max number of queues from 128 to 1024.
This patch also reworked the user guide for the vmdq_dcb sample.

Quoted 1 line
#22 lore raw
In reply to Jingjing Wu
Quoted 18 lines · Jingjing Wu

Currently, the example vmdq_dcb only works on Intel(R) 82599 NICs. This patchset extended this sample to make it works both on Intel(R) 82599 and X710/XL710 NICs. This patch set also enabled DCB VMDQ mode in i40e driver and added unsupported mode checking in ixgbe driver.

v2 changes:
- commit log doc rewording.
- rebase on latest dpdk-next-net/rel_16_04 branch.
- code style fix

v3 changes:
- replace I40E_3_BIT_MASK with RTE_LEN2MASK()

Jingjing Wu (3):
i40e: enable DCB in VMDQ VSIs
ixgbe: disallow unsupported RX mode examples/vmdq_dcb: extend sample for X710 supporting

Quoted 11 lines
 doc/guides/rel_notes/release_16_04.rst           |   3 +
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 171 ++++++----
 drivers/net/i40e/i40e_ethdev.c                   | 156 +++++++--
 drivers/net/i40e/i40e_ethdev.h                   |  28 +-
 drivers/net/ixgbe/ixgbe_ethdev.c                 |   5 +
 examples/vmdq_dcb/main.c                         | 391 ++++++++++++++++++-----
 6 files changed, 589 insertions(+), 165 deletions(-)
Signature · 1 line
2.4.0

Applied to dpdk-next-net/rel_16_04

/Bruce