Current API expects that VMDq and DCB configuration are interconnected, which may be true for some HW, but isn't universal. For one, we have a VMDq+DCB configuration structure, but it is not needed because we already have separate VMDq and DCB structures, so remove it.
Additionally, tx_adv_conf is currently a union, which makes the above structure necessary, but again, it is not needed if we make tx_adv_conf a structure and use separate VMDQ and DCB configurations. Signed-off-by: Vladimir Medvedkin <vladimir.medved...@intel.com> --- app/test-pmd/testpmd.c | 31 +++++++++++++++++++++++++------ lib/ethdev/rte_ethdev.h | 35 +---------------------------------- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b551140165..b5a7e7b3ee 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -4103,10 +4103,14 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, enum dcb_mode_enable dcb_mode, * given above, and the number of traffic classes available for use. */ if (dcb_mode == DCB_VT_ENABLED) { - struct rte_eth_vmdq_dcb_conf *vmdq_rx_conf = - ð_conf->rx_adv_conf.vmdq_dcb_conf; - struct rte_eth_vmdq_dcb_tx_conf *vmdq_tx_conf = - ð_conf->tx_adv_conf.vmdq_dcb_tx_conf; + struct rte_eth_vmdq_rx_conf *vmdq_rx_conf = + ð_conf->rx_adv_conf.vmdq_rx_conf; + struct rte_eth_vmdq_tx_conf *vmdq_tx_conf = + ð_conf->tx_adv_conf.vmdq_tx_conf; + struct rte_eth_dcb_conf *dcb_rx_conf = + ð_conf->rx_adv_conf.dcb_rx_conf; + struct rte_eth_dcb_conf *dcb_tx_conf = + ð_conf->tx_adv_conf.dcb_tx_conf; /* VMDQ+DCB RX and TX configurations */ vmdq_rx_conf->enable_default_pool = 0; @@ -4124,8 +4128,23 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, enum dcb_mode_enable dcb_mode, } for (i = 0; i < RTE_ETH_DCB_NUM_USER_PRIORITIES; i++) { dcb_tc_val = prio_tc_en ? prio_tc[i] : i % num_tcs; - vmdq_rx_conf->dcb_tc[i] = dcb_tc_val; - vmdq_tx_conf->dcb_tc[i] = dcb_tc_val; + dcb_rx_conf->dcb_tc[i] = dcb_tc_val; + dcb_tx_conf->dcb_tc[i] = dcb_tc_val; + } + + const int bw_share_percent = 100 / num_tcs; + const int bw_share_left = 100 - bw_share_percent * num_tcs; + for (i = 0; i < num_tcs; i++) { + dcb_rx_conf->dcb_tc_bw[i] = bw_share_percent; + dcb_tx_conf->dcb_tc_bw[i] = bw_share_percent; + + dcb_rx_conf->dcb_tsa[i] = RTE_ETH_DCB_TSA_ETS; + dcb_tx_conf->dcb_tsa[i] = RTE_ETH_DCB_TSA_ETS; + } + + for (i = 0; i < bw_share_left; i++) { + dcb_rx_conf->dcb_tc_bw[i]++; + dcb_tx_conf->dcb_tc_bw[i]++; } /* set DCB mode of RX and TX of multiple queues */ diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 1579be5a95..c220760043 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -937,39 +937,10 @@ struct rte_eth_dcb_conf { uint8_t dcb_tc_bw[RTE_ETH_DCB_NUM_TCS]; }; -struct rte_eth_vmdq_dcb_tx_conf { - enum rte_eth_nb_pools nb_queue_pools; /**< With DCB, 16 or 32 pools. */ - /** Traffic class each UP mapped to. */ - uint8_t dcb_tc[RTE_ETH_DCB_NUM_USER_PRIORITIES]; -}; - struct rte_eth_vmdq_tx_conf { enum rte_eth_nb_pools nb_queue_pools; /**< VMDq mode, 64 pools. */ }; -/** - * A structure used to configure the VMDq+DCB feature - * of an Ethernet port. - * - * Using this feature, packets are routed to a pool of queues, based - * on the VLAN ID in the VLAN tag, and then to a specific queue within - * that pool, using the user priority VLAN tag field. - * - * A default pool may be used, if desired, to route all traffic which - * does not match the VLAN filter rules. - */ -struct rte_eth_vmdq_dcb_conf { - enum rte_eth_nb_pools nb_queue_pools; /**< With DCB, 16 or 32 pools */ - uint8_t enable_default_pool; /**< If non-zero, use a default pool */ - uint8_t default_pool; /**< The default pool, if applicable */ - uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */ - struct { - uint16_t vlan_id; /**< The VLAN ID of the received frame */ - uint64_t pools; /**< Bitmask of pools for packet Rx */ - } pool_map[RTE_ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq VLAN pool maps. */ - /** Selects a queue in a pool */ - uint8_t dcb_tc[RTE_ETH_DCB_NUM_USER_PRIORITIES]; -}; /** * A structure used to configure the VMDq feature of an Ethernet port when @@ -1523,16 +1494,12 @@ struct rte_eth_conf { are defined in implementation of each driver. */ struct { struct rte_eth_rss_conf rss_conf; /**< Port RSS configuration */ - /** Port VMDq+DCB configuration. */ - struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf; /** Port DCB Rx configuration. */ struct rte_eth_dcb_conf dcb_rx_conf; /** Port VMDq Rx configuration. */ struct rte_eth_vmdq_rx_conf vmdq_rx_conf; } rx_adv_conf; /**< Port Rx filtering configuration. */ - union { - /** Port VMDq+DCB Tx configuration. */ - struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf; + struct { /** Port DCB Tx configuration. */ struct rte_eth_dcb_conf dcb_tx_conf; /** Port VMDq Tx configuration. */ -- 2.43.0