* [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration @ 2014-09-26 14:19 Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 1/2] pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions Pablo de Lara ` (3 more replies) 0 siblings, 4 replies; 24+ messages in thread From: Pablo de Lara @ 2014-09-26 14:19 UTC (permalink / raw) To: dev These patches add two new API functions to get an optimal values for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), so users can get these configurations and modify or use them directly, to set up RX/TX queues. Besides, most of the apps that were modifying little or none of the default values of the structures, have been modified to use these functions to simplify the code and avoid duplication. Pablo de Lara (2): pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps examples/dpdk_qat/main.c | 44 ++----------- examples/exception_path/main.c | 30 +-------- examples/ip_fragmentation/main.c | 42 ++----------- examples/ip_reassembly/main.c | 44 ++----------- examples/ipv4_multicast/main.c | 44 ++----------- examples/kni/main.c | 34 +--------- examples/l2fwd-ivshmem/host/host.c | 43 +----------- examples/l2fwd/main.c | 48 +------------- examples/l3fwd-acl/main.c | 46 ++------------ examples/l3fwd-power/main.c | 46 ++----------- examples/l3fwd-vf/main.c | 31 ++------- examples/l3fwd/main.c | 54 +++------------- examples/link_status_interrupt/main.c | 43 +----------- examples/load_balancer/init.c | 24 +------ .../client_server_mp/mp_server/init.c | 41 +----------- examples/multi_process/l2fwd_fork/main.c | 44 +------------ examples/multi_process/symmetric_mp/main.c | 36 +--------- examples/netmap_compat/bridge/bridge.c | 25 ------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++------- examples/quota_watermark/qw/init.c | 26 ++------ examples/vhost_xen/main.c | 31 ++------- examples/vmdq/main.c | 60 ++--------------- examples/vmdq_dcb/main.c | 36 +--------- lib/librte_ether/rte_ethdev.c | 68 ++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 29 ++++++++ lib/librte_pmd_e1000/igb_ethdev.c | 56 ++++++++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 56 ++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 59 +++++++++++++++++ 30 files changed, 385 insertions(+), 799 deletions(-) -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH 1/2] pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions 2014-09-26 14:19 [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration Pablo de Lara @ 2014-09-26 14:19 ` Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 2/2] app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps Pablo de Lara ` (2 subsequent siblings) 3 siblings, 0 replies; 24+ messages in thread From: Pablo de Lara @ 2014-09-26 14:19 UTC (permalink / raw) To: dev Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf structures. This patch allows the user to get a default optimal RX/TX configuration through these two functions, and still any parameters may be tweaked as wished, before setting up queues. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- lib/librte_ether/rte_ethdev.c | 68 +++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 29 +++++++++++++++ lib/librte_pmd_e1000/igb_ethdev.c | 56 ++++++++++++++++++++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 56 ++++++++++++++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 59 ++++++++++++++++++++++++++++++ 5 files changed, 267 insertions(+), 1 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fd1010a..3c24040 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, struct rte_eth_dev *dev; struct rte_pktmbuf_pool_private *mbp_priv; struct rte_eth_dev_info dev_info; + const struct rte_eth_rxconf *conf; /* This function is only safe when called from the primary process * in a multi-process setup*/ @@ -937,6 +938,16 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); return (-EINVAL); } + + conf = rx_conf; + if (conf == NULL) { + conf = rte_eth_rxconf_defaults(port_id, NULL); + if (conf == NULL) { + PMD_DEBUG_TRACE("Invalid RX port configuration\n"); + return (-EINVAL); + } + } + dev = &rte_eth_devices[port_id]; if (rx_queue_id >= dev->data->nb_rx_queues) { PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); @@ -997,6 +1008,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, const struct rte_eth_txconf *tx_conf) { struct rte_eth_dev *dev; + const struct rte_eth_txconf *conf; /* This function is only safe when called from the primary process * in a multi-process setup*/ @@ -1006,6 +1018,16 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); return (-EINVAL); } + + conf = tx_conf; + if (conf == NULL) { + conf = rte_eth_txconf_defaults(port_id, NULL); + if (conf == NULL) { + PMD_DEBUG_TRACE("Invalid TX port configuration\n"); + return (-EINVAL); + } + } + dev = &rte_eth_devices[port_id]; if (tx_queue_id >= dev->data->nb_tx_queues) { PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); @@ -3002,3 +3024,49 @@ rte_eth_dev_get_flex_filter(uint8_t port_id, uint16_t index, return (*dev->dev_ops->get_flex_filter)(dev, index, filter, rx_queue); } + +const struct rte_eth_rxconf * +rte_eth_rxconf_defaults(uint8_t port_id, struct rte_eth_rxconf *conf) +{ + struct rte_eth_dev *dev; + static const struct rte_eth_rxconf defaults; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return NULL; + } + + dev = &rte_eth_devices[port_id]; + + if (dev->dev_ops->rxconf_defaults) { + return (*dev->dev_ops->rxconf_defaults)(conf); + } else { + if (conf == NULL) + return &defaults; + *conf = defaults; + } + return conf; +} + +const struct rte_eth_txconf * +rte_eth_txconf_defaults(uint8_t port_id, struct rte_eth_txconf *conf) +{ + struct rte_eth_dev *dev; + static const struct rte_eth_txconf defaults; + + if (port_id >= nb_ports) { + PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); + return NULL; + } + + dev = &rte_eth_devices[port_id]; + + if (dev->dev_ops->txconf_defaults) { + return (*dev->dev_ops->txconf_defaults)(conf); + } else { + if (conf == NULL) + return &defaults; + *conf = defaults; + } + return conf; +} diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 50df654..70026fd 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1361,6 +1361,12 @@ typedef int (*eth_get_flex_filter_t)(struct rte_eth_dev *dev, uint16_t *rx_queue); /**< @internal Get a flex filter rule on an Ethernet device */ +typedef const struct rte_eth_rxconf * (*eth_rxconf_defaults_t) (struct rte_eth_rxconf *conf); +/**< @internal Get the default RX port configuration on an Ethernet device */ + +typedef const struct rte_eth_txconf * (*eth_txconf_defaults_t) (struct rte_eth_txconf *conf); +/**< @internal Get the default TX port configuration on an Ethernet device */ + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1467,6 +1473,8 @@ struct eth_dev_ops { eth_add_flex_filter_t add_flex_filter; /**< add flex filter. */ eth_remove_flex_filter_t remove_flex_filter; /**< remove flex filter. */ eth_get_flex_filter_t get_flex_filter; /**< get flex filter. */ + eth_rxconf_defaults_t rxconf_defaults; /**< get default RX configuration. */ + eth_txconf_defaults_t txconf_defaults; /**< get default TX configuration. */ }; /** @@ -3557,6 +3565,27 @@ int rte_eth_dev_remove_flex_filter(uint8_t port_id, uint16_t index); int rte_eth_dev_get_flex_filter(uint8_t port_id, uint16_t index, struct rte_flex_filter *filter, uint16_t *rx_queue); +/** + * Get default port configuration. + * @param port_id + * The port identifier of the Ethernet device. + * @param port_conf_default + * Pointer to get the struct rte_eth_conf + * @param rx_conf_default + * Pointer to get the struct rte_eth_rxconf + * @param tx_conf_default: + * Pointer to get the struct rte_eth_txconf + * @param burst_size + * Pointer to get the default burst size + * @return + * - (0) if successful. + * - (-ENODEV) if *port_id* invalid. + */ +const struct rte_eth_rxconf *rte_eth_rxconf_defaults(uint8_t port_id, + struct rte_eth_rxconf *conf); + +const struct rte_eth_txconf *rte_eth_txconf_defaults(uint8_t port_id, + struct rte_eth_txconf *conf); #ifdef __cplusplus } #endif diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c index 3187d92..30f1ee3 100644 --- a/lib/librte_pmd_e1000/igb_ethdev.c +++ b/lib/librte_pmd_e1000/igb_ethdev.c @@ -57,6 +57,18 @@ #include "e1000/e1000_api.h" #include "e1000_ethdev.h" +/** + * Default values for port configuration + */ +#define IGB_DEFAULT_RX_FREE_THRESH 32 +#define IGB_DEFAULT_RX_PTHRESH 8 +#define IGB_DEFAULT_RX_HTHRESH 8 +#define IGB_DEFAULT_RX_WTHRESH 0 + +#define IGB_DEFAULT_TX_PTHRESH 32 +#define IGB_DEFAULT_TX_HTHRESH 0 +#define IGB_DEFAULT_TX_WTHRESH 0 + static int eth_igb_configure(struct rte_eth_dev *dev); static int eth_igb_start(struct rte_eth_dev *dev); static void eth_igb_stop(struct rte_eth_dev *dev); @@ -165,7 +177,8 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev *dev, static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, struct rte_5tuple_filter *filter, uint16_t *rx_queue); - +static const struct rte_eth_rxconf *eth_igb_rxconf_defaults(struct rte_eth_rxconf *conf); +static const struct rte_eth_txconf *eth_igb_txconf_defaults(struct rte_eth_txconf *conf); /* * Define VF Stats MACRO for Non "cleared on read" register */ @@ -255,6 +268,8 @@ static struct eth_dev_ops eth_igb_ops = { .add_5tuple_filter = eth_igb_add_5tuple_filter, .remove_5tuple_filter = eth_igb_remove_5tuple_filter, .get_5tuple_filter = eth_igb_get_5tuple_filter, + .rxconf_defaults = eth_igb_rxconf_defaults, + .txconf_defaults = eth_igb_txconf_defaults, }; /* @@ -3008,6 +3023,45 @@ eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, return -ENOENT; } +static const struct rte_eth_rxconf * +eth_igb_rxconf_defaults(struct rte_eth_rxconf *conf) +{ + static const struct rte_eth_rxconf defaults = { + .rx_thresh = { + .pthresh = IGB_DEFAULT_RX_PTHRESH, + .hthresh = IGB_DEFAULT_RX_HTHRESH, + .wthresh = IGB_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IGB_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} + +static const struct rte_eth_txconf * +eth_igb_txconf_defaults(struct rte_eth_txconf *conf) +{ + static const struct rte_eth_txconf defaults = { + .tx_thresh = { + .pthresh = IGB_DEFAULT_TX_PTHRESH, + .hthresh = IGB_DEFAULT_TX_HTHRESH, + .wthresh = IGB_DEFAULT_TX_WTHRESH, + }, + .txq_flags = 0, + }; + + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} + static int eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 9ed31b5..b89b896 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -58,6 +58,17 @@ #include "i40e_rxtx.h" #include "i40e_pf.h" +#define I40E_DEFAULT_RX_FREE_THRESH 32 +#define I40E_DEFAULT_RX_PTHRESH 8 +#define I40E_DEFAULT_RX_HTHRESH 8 +#define I40E_DEFAULT_RX_WTHRESH 0 + +#define I40E_DEFAULT_TX_FREE_THRESH 32 +#define I40E_DEFAULT_TX_PTHRESH 32 +#define I40E_DEFAULT_TX_HTHRESH 0 +#define I40E_DEFAULT_TX_WTHRESH 0 +#define I40E_DEFAULT_TX_RSBIT_THRESH 32 + /* Maximun number of MAC addresses */ #define I40E_NUM_MACADDR_MAX 64 #define I40E_CLEAR_PXE_WAIT_MS 200 @@ -203,6 +214,8 @@ static int i40e_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40e_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); +static const struct rte_eth_rxconf *i40e_rxconf_defaults(struct rte_eth_rxconf *conf); +static const struct rte_eth_txconf *i40e_txconf_defaults(struct rte_eth_txconf *conf); /* Default hash key buffer for RSS */ static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ -248,6 +261,8 @@ static struct eth_dev_ops i40e_eth_dev_ops = { .reta_query = i40e_dev_rss_reta_query, .rss_hash_update = i40e_dev_rss_hash_update, .rss_hash_conf_get = i40e_dev_rss_hash_conf_get, + .rxconf_defaults = i40e_rxconf_defaults, + .txconf_defaults = i40e_txconf_defaults, }; static struct eth_driver rte_i40e_pmd = { @@ -3956,3 +3971,44 @@ i40e_pf_config_mq_rx(struct i40e_pf *pf) return 0; } + +static const struct rte_eth_rxconf * +i40e_rxconf_defaults(struct rte_eth_rxconf *conf) +{ + static const struct rte_eth_rxconf defaults = { + .rx_thresh = { + .pthresh = I40E_DEFAULT_RX_PTHRESH, + .hthresh = I40E_DEFAULT_RX_HTHRESH, + .wthresh = I40E_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} + +static const struct rte_eth_txconf * +i40e_txconf_defaults(struct rte_eth_txconf *conf) +{ + static const struct rte_eth_txconf defaults = { + .tx_thresh = { + .pthresh = I40E_DEFAULT_TX_PTHRESH, + .hthresh = I40E_DEFAULT_TX_HTHRESH, + .wthresh = I40E_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; + + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 59122a1..7f61d00 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -92,6 +92,20 @@ #define IXGBE_MMW_SIZE_DEFAULT 0x4 #define IXGBE_MMW_SIZE_JUMBO_FRAME 0x14 +/** + * Default values for RX/TX configuration + */ +#define IXGBE_DEFAULT_RX_FREE_THRESH 32 +#define IXGBE_DEFAULT_RX_PTHRESH 8 +#define IXGBE_DEFAULT_RX_HTHRESH 8 +#define IXGBE_DEFAULT_RX_WTHRESH 0 + +#define IXGBE_DEFAULT_TX_FREE_THRESH 32 +#define IXGBE_DEFAULT_TX_PTHRESH 32 +#define IXGBE_DEFAULT_TX_HTHRESH 0 +#define IXGBE_DEFAULT_TX_WTHRESH 0 +#define IXGBE_DEFAULT_TX_RSBIT_THRESH 32 + #define IXGBEVF_PMD_NAME "rte_ixgbevf_pmd" /* PMD name */ #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0])) @@ -219,6 +233,8 @@ static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev, uint16_t index); static int ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, struct rte_5tuple_filter *filter, uint16_t *rx_queue); +static const struct rte_eth_rxconf *ixgbe_rxconf_defaults(struct rte_eth_rxconf *conf); +static const struct rte_eth_txconf *ixgbe_txconf_defaults(struct rte_eth_txconf *conf); static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); @@ -362,6 +378,8 @@ static struct eth_dev_ops ixgbe_eth_dev_ops = { .add_5tuple_filter = ixgbe_add_5tuple_filter, .remove_5tuple_filter = ixgbe_remove_5tuple_filter, .get_5tuple_filter = ixgbe_get_5tuple_filter, + .rxconf_defaults = ixgbe_rxconf_defaults, + .txconf_defaults = ixgbe_txconf_defaults, }; /* @@ -388,6 +406,8 @@ static struct eth_dev_ops ixgbevf_eth_dev_ops = { .tx_queue_release = ixgbe_dev_tx_queue_release, .mac_addr_add = ixgbevf_add_mac_addr, .mac_addr_remove = ixgbevf_remove_mac_addr, + .rxconf_defaults = ixgbe_rxconf_defaults, + .txconf_defaults = ixgbe_txconf_defaults, }; /** @@ -3940,6 +3960,45 @@ ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, return -ENOENT; } +const struct rte_eth_rxconf * +ixgbe_rxconf_defaults(struct rte_eth_rxconf *conf) +{ + static const struct rte_eth_rxconf defaults = { + .rx_thresh = { + .pthresh = IXGBE_DEFAULT_RX_PTHRESH, + .hthresh = IXGBE_DEFAULT_RX_HTHRESH, + .wthresh = IXGBE_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} + +const struct rte_eth_txconf * +ixgbe_txconf_defaults(struct rte_eth_txconf *conf) +{ + static const struct rte_eth_txconf defaults = { + .tx_thresh = { + .pthresh = IXGBE_DEFAULT_TX_PTHRESH, + .hthresh = IXGBE_DEFAULT_TX_HTHRESH, + .wthresh = IXGBE_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; + if (conf == NULL) + return &defaults; + *conf = defaults; + + return conf; +} + static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH 2/2] app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps 2014-09-26 14:19 [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 1/2] pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions Pablo de Lara @ 2014-09-26 14:19 ` Pablo de Lara 2014-09-27 18:45 ` [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration David Marchand 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara 3 siblings, 0 replies; 24+ messages in thread From: Pablo de Lara @ 2014-09-26 14:19 UTC (permalink / raw) To: dev For apps that were using default rte_eth_rxconf and rte_eth_txconf structures, these have been removed and now they are obtained by calling rte_eth_rxconf_defaults and rte_eth_txconf_defaults, just before setting up RX/TX queues. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- examples/dpdk_qat/main.c | 44 ++------------- examples/exception_path/main.c | 30 +--------- examples/ip_fragmentation/main.c | 42 ++------------ examples/ip_reassembly/main.c | 44 ++------------- examples/ipv4_multicast/main.c | 44 ++------------ examples/kni/main.c | 34 +---------- examples/l2fwd-ivshmem/host/host.c | 43 +------------- examples/l2fwd/main.c | 48 +-------------- examples/l3fwd-acl/main.c | 46 ++------------- examples/l3fwd-power/main.c | 46 ++------------- examples/l3fwd-vf/main.c | 31 ++-------- examples/l3fwd/main.c | 54 +++--------------- examples/link_status_interrupt/main.c | 43 +------------- examples/load_balancer/init.c | 24 +------- .../client_server_mp/mp_server/init.c | 41 +------------ examples/multi_process/l2fwd_fork/main.c | 44 +------------- examples/multi_process/symmetric_mp/main.c | 36 +---------- examples/netmap_compat/bridge/bridge.c | 25 -------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++-------- examples/quota_watermark/qw/init.c | 26 ++------- examples/vhost_xen/main.c | 31 ++-------- examples/vmdq/main.c | 60 +++----------------- examples/vmdq_dcb/main.c | 36 +---------- 25 files changed, 118 insertions(+), 798 deletions(-) diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index d61db4c..69b8e6a 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -75,25 +75,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF (32 * 1024) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -178,24 +159,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - static struct rte_mempool * pktmbuf_pool[RTE_MAX_NUMA_NODES]; struct lcore_conf { @@ -785,7 +748,8 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcoreid, queueid, socketid); fflush(stdout); ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, + NULL); if (ret < 0) rte_panic("rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -810,7 +774,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_panic("rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 0204116..8f89dc6 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -109,31 +109,6 @@ * controller's datasheet and supporting DPDK documentation for guidance * on how these parameters should be set. */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static const struct rte_eth_conf port_conf = { @@ -460,13 +435,14 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, rte_eth_dev_socket_id(port), - &rx_conf, pktmbuf_pool); + NULL, + pktmbuf_pool); if (ret < 0) FATAL_ERROR("Could not setup up RX queue for port%u (%d)", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, rte_eth_dev_socket_id(port), - &tx_conf); + NULL); if (ret < 0) FATAL_ERROR("Could not setup up TX queue for port%u (%d)", (unsigned)port, ret); diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 72cd2b2..964c513 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -106,25 +106,6 @@ #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -208,23 +189,7 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; +static struct rte_eth_txconf tx_conf; /* * IPv4 forwarding table @@ -942,7 +907,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, socket_direct_pool[socket]); if (ret < 0) { printf("\n"); @@ -964,6 +929,9 @@ MAIN(int argc, char **argv) socket = (int) rte_lcore_to_socket_id(lcore_id); printf("txq=%u,%d ", lcore_id, queueid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socket, &tx_conf); if (ret < 0) { diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 3bb6afd..a8c659d 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -114,25 +114,6 @@ static uint32_t max_flow_num = DEF_FLOW_NUM; static uint32_t max_flow_ttl = DEF_FLOW_TTL; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -236,25 +217,7 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; +static struct rte_eth_txconf tx_conf; /* * IPv4 forwarding table @@ -1149,7 +1112,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, rxq->pool); if (ret < 0) { printf("\n"); @@ -1172,6 +1135,9 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socket); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socket, &tx_conf); if (ret < 0) diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index dfa0075..d136b87 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -92,25 +92,6 @@ /* allow max jumbo frame 9.5 KB */ #define JUMBO_FRAME_MAX_SIZE 0x2600 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -175,24 +156,7 @@ static const struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_TX_NONE, }, }; - -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; +static struct rte_eth_txconf tx_conf; static struct rte_mempool *packet_pool, *header_pool, *clone_pool; @@ -810,7 +774,8 @@ MAIN(int argc, char **argv) printf("rxq=%hu ", queueid); fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, packet_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%d\n", @@ -824,6 +789,9 @@ MAIN(int argc, char **argv) continue; printf("txq=%u,%hu ", lcore_id, queueid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, rte_lcore_to_socket_id(lcore_id), &tx_conf); if (ret < 0) diff --git a/examples/kni/main.c b/examples/kni/main.c index 7df1b36..6cfd8fe 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -125,36 +125,6 @@ struct kni_port_params { static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS]; -/* RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static struct rte_eth_conf port_conf = { @@ -631,13 +601,13 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, - rte_eth_dev_socket_id(port), &rx_conf, pktmbuf_pool); + rte_eth_dev_socket_id(port), NULL, pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up RX queue for " "port%u (%d)\n", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, - rte_eth_dev_socket_id(port), &tx_conf); + rte_eth_dev_socket_id(port), NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up TX queue for " "port%u (%d)\n", (unsigned)port, ret); diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 02e65b9..706a7b3 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -63,25 +63,6 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ /* mask of enabled ports */ @@ -117,24 +98,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - #define METADATA_NAME "l2fwd_ivshmem" #define CMDLINE_OPT_FWD_CONF "fwd-conf" @@ -792,7 +755,8 @@ int main(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_ivshmem_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -801,7 +765,8 @@ int main(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 4069d7c..c6131a7 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -77,25 +77,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -147,29 +128,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - /* - * As the example won't handle mult-segments and offload cases, - * set the flag by default. - */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - struct rte_mempool * l2fwd_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -704,7 +662,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -713,7 +672,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 9b2c21b..99d7cd9 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -100,25 +100,6 @@ nb_lcores * MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -206,26 +187,7 @@ static struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_TX_NONE, }, }; - -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; +static struct rte_eth_txconf tx_conf; static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; @@ -2063,6 +2025,10 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + if (port_conf.rxmode.jumbo_frame) + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socketid, &tx_conf); if (ret < 0) @@ -2098,7 +2064,7 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, + socketid, NULL, pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 57fc371..2eedf1b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -140,25 +140,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -255,25 +236,7 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; +static struct rte_eth_txconf tx_conf; static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -1606,6 +1569,10 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + if (port_conf.rxmode.jumbo_frame) + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socketid, &tx_conf); if (ret < 0) @@ -1655,7 +1622,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, " diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 2ca5c21..ca1cf4e 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -215,29 +215,7 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; +static struct rte_eth_txconf tx_conf; static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -1055,6 +1033,10 @@ MAIN(int argc, char **argv) printf("txq=%d,%d,%d ", portid, 0, socketid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + if (port_conf.rxmode.jumbo_frame) + tx_conf.txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, socketid, &tx_conf); if (ret < 0) @@ -1086,7 +1068,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index bef409a..a84f9fb 100755 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -137,25 +137,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -259,30 +240,7 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) - -}; +static struct rte_eth_txconf tx_conf; static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -1974,7 +1932,6 @@ parse_args(int argc, char **argv) printf("jumbo frame is enabled - disabling simple TX path\n"); port_conf.rxmode.jumbo_frame = 1; - tx_conf.txq_flags = 0; /* if no max-pkt-len set, use the default value ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -2541,6 +2498,11 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_txconf_defaults(portid, &tx_conf); + if (port_conf.rxmode.jumbo_frame) + tx_conf.txq_flags = 0; + ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socketid, &tx_conf); if (ret < 0) @@ -2574,7 +2536,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 1a87551..9dc0df8 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -78,25 +78,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -153,24 +134,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - struct rte_mempool * lsi_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -754,7 +717,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, lsi_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, port=%u\n", @@ -763,7 +727,8 @@ MAIN(int argc, char **argv) /* init one TX queue logical core on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d,port=%u\n", ret, (unsigned) portid); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 2f00a70..448425b 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -95,26 +95,6 @@ static struct rte_eth_conf port_conf = { }, }; -static struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = APP_DEFAULT_NIC_RX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_RX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_RX_WTHRESH, - }, - .rx_free_thresh = APP_DEFAULT_NIC_RX_FREE_THRESH, - .rx_drop_en = APP_DEFAULT_NIC_RX_DROP_EN, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = APP_DEFAULT_NIC_TX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_TX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_TX_WTHRESH, - }, - .tx_free_thresh = APP_DEFAULT_NIC_TX_FREE_THRESH, - .tx_rs_thresh = APP_DEFAULT_NIC_TX_RS_THRESH, -}; - static void app_assign_worker_ids(void) { @@ -495,7 +475,7 @@ app_init_nics(void) queue, (uint16_t) app.nic_rx_ring_size, socket, - &rx_conf, + NULL, pool); if (ret < 0) { rte_panic("Cannot init RX queue %u for port %u (%d)\n", @@ -516,7 +496,7 @@ app_init_nics(void) 0, (uint16_t) app.nic_tx_ring_size, socket, - &tx_conf); + NULL); if (ret < 0) { rte_panic("Cannot init TX queue 0 for port %d (%d)\n", port, diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index a84d1ee..5b3f06e 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -84,41 +84,6 @@ #define NO_FLAGS 0 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define MP_DEFAULT_PTHRESH 36 -#define MP_DEFAULT_RX_HTHRESH 8 -#define MP_DEFAULT_TX_HTHRESH 0 -#define MP_DEFAULT_WTHRESH 0 - -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_RX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_TX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* The mbuf pool for packet rx */ struct rte_mempool *pktmbuf_pool; @@ -184,13 +149,15 @@ init_port(uint8_t port_num) for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size, - rte_eth_dev_socket_id(port_num), &rx_conf_default, pktmbuf_pool); + rte_eth_dev_socket_id(port_num), + NULL, pktmbuf_pool); if (retval < 0) return retval; } for ( q = 0; q < tx_rings; q ++ ) { retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size, - rte_eth_dev_socket_id(port_num), &tx_conf_default); + rte_eth_dev_socket_id(port_num), + NULL); if (retval < 0) return retval; } diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 03fba55..5899875 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -96,25 +96,6 @@ enum l2fwd_cmd{ CMD_STOP, }; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -190,25 +171,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - static struct rte_mempool * l2fwd_pktmbuf_pool[RTE_MAX_ETHPORTS]; /* Per-port statistics struct */ @@ -1170,7 +1132,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool[portid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -1179,7 +1142,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index b8f31b3..638d167 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -89,36 +89,6 @@ #define PARAM_PROC_ID "proc-id" #define PARAM_NUM_PROCS "num-procs" -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* for each lcore, record the elements of the ports array to use */ struct lcore_ports{ unsigned start_port; @@ -277,7 +247,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -285,7 +256,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 898277e..f935b3b 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -67,29 +67,6 @@ struct rte_eth_conf eth_conf = { }, }; -struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; - -struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - #define MAX_QUEUE_NUM 1 #define RX_QUEUE_NUM 1 #define TX_QUEUE_NUM 1 @@ -103,8 +80,6 @@ struct rte_eth_rxconf rx_conf = { struct rte_netmap_port_conf port_conf = { .eth_conf = ð_conf, - .tx_conf = &tx_conf, - .rx_conf = &rx_conf, .socket_id = SOCKET_ID_ANY, .nr_tx_rings = TX_QUEUE_NUM, .nr_rx_rings = RX_QUEUE_NUM, diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c index 44b3f8e..2348366 100644 --- a/examples/netmap_compat/lib/compat_netmap.c +++ b/examples/netmap_compat/lib/compat_netmap.c @@ -713,7 +713,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) for (i = 0; i < conf->nr_tx_rings; i++) { ret = rte_eth_tx_queue_setup(portid, i, tx_slots, - conf->socket_id, conf->tx_conf); + conf->socket_id, NULL); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -724,7 +724,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) } ret = rte_eth_rx_queue_setup(portid, i, rx_slots, - conf->socket_id, conf->rx_conf, conf->pool); + conf->socket_id, NULL, conf->pool); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -737,8 +737,6 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) /* copy config to the private storage. */ ports[portid].eth_conf = conf->eth_conf[0]; - ports[portid].rx_conf = conf->rx_conf[0]; - ports[portid].tx_conf = conf->tx_conf[0]; ports[portid].pool = conf->pool; ports[portid].socket_id = conf->socket_id; ports[portid].nr_tx_rings = conf->nr_tx_rings; diff --git a/examples/netmap_compat/lib/compat_netmap.h b/examples/netmap_compat/lib/compat_netmap.h index f7f2276..f8a7812 100644 --- a/examples/netmap_compat/lib/compat_netmap.h +++ b/examples/netmap_compat/lib/compat_netmap.h @@ -56,8 +56,6 @@ struct rte_netmap_conf { struct rte_netmap_port_conf { struct rte_eth_conf *eth_conf; - struct rte_eth_txconf *tx_conf; - struct rte_eth_rxconf *rx_conf; struct rte_mempool *pool; int32_t socket_id; uint16_t nr_tx_rings; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b4b8c4f..a942249 100755 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -102,26 +102,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* RX prefetch threshold reg */ - .hthresh = 8, /* RX host threshold reg */ - .wthresh = 4, /* RX write-back threshold reg */ - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* TX prefetch threshold reg */ - .hthresh = 0, /* TX host threshold reg */ - .wthresh = 0, /* TX write-back threshold reg */ - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = 0x0, -}; - #define NIC_RX_QUEUE_DESC 128 #define NIC_TX_QUEUE_DESC 512 @@ -394,11 +374,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_rx, ret); - ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret); - ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret); @@ -406,11 +390,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_tx, ret); - ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret); - ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + rte_eth_txconf_defaults(port_tx, NULL)); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_tx, ret); diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c index a7f8c85..5adb906 100644 --- a/examples/quota_watermark/qw/init.c +++ b/examples/quota_watermark/qw/init.c @@ -64,24 +64,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, -}; - static struct rte_eth_fc_conf fc_conf = { .mode = RTE_FC_TX_PAUSE, .high_water = 80 * 510 / 100, @@ -104,15 +86,17 @@ void configure_eth_port(uint8_t port_id) /* Initialize the port's RX queue */ ret = rte_eth_rx_queue_setup(port_id, 0, RX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &rx_conf, - mbuf_pool); + rte_eth_dev_socket_id(port_id), + NULL, + mbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup RX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); /* Initialize the port's TX queue */ ret = rte_eth_tx_queue_setup(port_id, 0, TX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &tx_conf); + rte_eth_dev_socket_id(port_id), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup TX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index b275747..f5c801c 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -136,29 +136,7 @@ static uint32_t enable_vm2vm = 1; static uint32_t enable_stats = 0; /* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; +static struct rte_eth_rxconf rx_conf; /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { @@ -331,17 +309,20 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_rxconf_defaults(port, &rx_conf); + rx_conf.rx_drop_en = 1; /* Setup the queues. */ for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rx_ring_size, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), &rx_conf, mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 35df234..8353e89 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -81,25 +81,6 @@ #define MBUF_CACHE_SIZE 64 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 /* @@ -117,36 +98,7 @@ static uint32_t enabled_port_mask = 0; static uint32_t num_queues = 8; static uint32_t num_pools = 8; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; +static struct rte_eth_rxconf rx_conf; /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { @@ -308,17 +260,21 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_rxconf_defaults(port, &rx_conf); + rx_conf.rx_drop_en = 1; for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, - mbuf_pool); + rte_eth_dev_socket_id(port), + &rx_conf, + mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 2f708a1..20726e5 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -87,36 +87,6 @@ static uint32_t enabled_port_mask = 0; /* number of pools (if user does not specify any, 16 by default */ static enum rte_eth_nb_pools num_pools = ETH_16_POOLS; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq+dcb configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_dcb_conf_default = { .rxmode = { @@ -212,7 +182,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -220,7 +191,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration 2014-09-26 14:19 [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 1/2] pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 2/2] app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps Pablo de Lara @ 2014-09-27 18:45 ` David Marchand [not found] ` <E115CCD9D858EF4F90C690B0DCB4D89722628264@IRSMSX108.ger.corp.intel.com> 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara 3 siblings, 1 reply; 24+ messages in thread From: David Marchand @ 2014-09-27 18:45 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev Hello Pablo, - All I can see in this patchset is stuff that should remain in the PMD (since this is really specific to them). - Anyway, if you want to let application get this information, why the new API ? >From my point of view, this should go in rte_eth_dev_info_get(). -- David Marchand On Fri, Sep 26, 2014 at 4:19 PM, Pablo de Lara < pablo.de.lara.guarch@intel.com> wrote: > These patches add two new API functions to get an optimal values > for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), > so users can get these configurations and modify or use them directly, > to set up RX/TX queues. Besides, most of the apps that were modifying > little > or none of the default values of the structures, have been modified to use > these functions to simplify the code and avoid duplication. > > Pablo de Lara (2): > pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults > functions > app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps > > examples/dpdk_qat/main.c | 44 ++----------- > examples/exception_path/main.c | 30 +-------- > examples/ip_fragmentation/main.c | 42 ++----------- > examples/ip_reassembly/main.c | 44 ++----------- > examples/ipv4_multicast/main.c | 44 ++----------- > examples/kni/main.c | 34 +--------- > examples/l2fwd-ivshmem/host/host.c | 43 +----------- > examples/l2fwd/main.c | 48 +------------- > examples/l3fwd-acl/main.c | 46 ++------------ > examples/l3fwd-power/main.c | 46 ++----------- > examples/l3fwd-vf/main.c | 31 ++------- > examples/l3fwd/main.c | 54 +++------------- > examples/link_status_interrupt/main.c | 43 +----------- > examples/load_balancer/init.c | 24 +------ > .../client_server_mp/mp_server/init.c | 41 +----------- > examples/multi_process/l2fwd_fork/main.c | 44 +------------ > examples/multi_process/symmetric_mp/main.c | 36 +--------- > examples/netmap_compat/bridge/bridge.c | 25 ------- > examples/netmap_compat/lib/compat_netmap.c | 6 +- > examples/netmap_compat/lib/compat_netmap.h | 2 - > examples/qos_meter/main.c | 36 ++++------- > examples/quota_watermark/qw/init.c | 26 ++------ > examples/vhost_xen/main.c | 31 ++------- > examples/vmdq/main.c | 60 > ++--------------- > examples/vmdq_dcb/main.c | 36 +--------- > lib/librte_ether/rte_ethdev.c | 68 > ++++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 29 ++++++++ > lib/librte_pmd_e1000/igb_ethdev.c | 56 > ++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 56 ++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 59 > +++++++++++++++++ > 30 files changed, 385 insertions(+), 799 deletions(-) > > -- > 1.7.7.6 > > ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <E115CCD9D858EF4F90C690B0DCB4D89722628264@IRSMSX108.ger.corp.intel.com>]
* Re: [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration [not found] ` <E115CCD9D858EF4F90C690B0DCB4D89722628264@IRSMSX108.ger.corp.intel.com> @ 2014-09-29 14:02 ` De Lara Guarch, Pablo 2014-09-29 14:40 ` David Marchand 0 siblings, 1 reply; 24+ messages in thread From: De Lara Guarch, Pablo @ 2014-09-29 14:02 UTC (permalink / raw) To: David Marchand, dev Hi David, > From: David Marchand [mailto:david.marchand@6wind.com] > Sent: Saturday, September 27, 2014 7:45 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default > configuration > > Hello Pablo, > - All I can see in this patchset is stuff that should remain in the PMD (since > this is really specific to them). > > - Anyway, if you want to let application get this information, why the new API > ? > From my point of view, this should go in rte_eth_dev_info_get(). Thanks for the comments. Main changes are in the PMDs, and I only added two functions in rte_ethdev.c, which basically calls the functions in the PMDs. Anyway, so you suggest to modify the rte_eth_dev_info structure, so it also contains these two structures populated with the default values? Thanks, Pablo > > > -- > David Marchand > > On Fri, Sep 26, 2014 at 4:19 PM, Pablo de Lara > <pablo.de.lara.guarch@intel.com> wrote: > These patches add two new API functions to get an optimal values > for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), > so users can get these configurations and modify or use them directly, > to set up RX/TX queues. Besides, most of the apps that were modifying little > or none of the default values of the structures, have been modified to use > these functions to simplify the code and avoid duplication. > > Pablo de Lara (2): > pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults > functions > app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps > > examples/dpdk_qat/main.c | 44 ++----------- > examples/exception_path/main.c | 30 +-------- > examples/ip_fragmentation/main.c | 42 ++----------- > examples/ip_reassembly/main.c | 44 ++----------- > examples/ipv4_multicast/main.c | 44 ++----------- > examples/kni/main.c | 34 +--------- > examples/l2fwd-ivshmem/host/host.c | 43 +----------- > examples/l2fwd/main.c | 48 +------------- > examples/l3fwd-acl/main.c | 46 ++------------ > examples/l3fwd-power/main.c | 46 ++----------- > examples/l3fwd-vf/main.c | 31 ++------- > examples/l3fwd/main.c | 54 +++------------- > examples/link_status_interrupt/main.c | 43 +----------- > examples/load_balancer/init.c | 24 +------ > .../client_server_mp/mp_server/init.c | 41 +----------- > examples/multi_process/l2fwd_fork/main.c | 44 +------------ > examples/multi_process/symmetric_mp/main.c | 36 +--------- > examples/netmap_compat/bridge/bridge.c | 25 ------- > examples/netmap_compat/lib/compat_netmap.c | 6 +- > examples/netmap_compat/lib/compat_netmap.h | 2 - > examples/qos_meter/main.c | 36 ++++------- > examples/quota_watermark/qw/init.c | 26 ++------ > examples/vhost_xen/main.c | 31 ++------- > examples/vmdq/main.c | 60 ++--------------- > examples/vmdq_dcb/main.c | 36 +--------- > lib/librte_ether/rte_ethdev.c | 68 ++++++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 29 ++++++++ > lib/librte_pmd_e1000/igb_ethdev.c | 56 ++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 56 ++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 59 +++++++++++++++++ > 30 files changed, 385 insertions(+), 799 deletions(-) > > -- > 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration 2014-09-29 14:02 ` De Lara Guarch, Pablo @ 2014-09-29 14:40 ` David Marchand 0 siblings, 0 replies; 24+ messages in thread From: David Marchand @ 2014-09-29 14:40 UTC (permalink / raw) To: De Lara Guarch, Pablo; +Cc: dev Hello Pablo, On Mon, Sep 29, 2014 at 4:02 PM, De Lara Guarch, Pablo < pablo.de.lara.guarch@intel.com> wrote: > Hi David, > > > - All I can see in this patchset is stuff that should remain in the PMD > (since > > this is really specific to them). > > > > - Anyway, if you want to let application get this information, why the > new API > > ? > > From my point of view, this should go in rte_eth_dev_info_get(). > > Thanks for the comments. Main changes are in the PMDs, and I only added > two functions in rte_ethdev.c, which basically calls the functions in the > PMDs. > Anyway, so you suggest to modify the rte_eth_dev_info structure, so it > also contains these two structures populated with the default values? > - Yep, that would be the idea. This way applications can reuse these structures "as is" or change some values before calling rx / tx _queue_setup. - By the way, I noticed that rte_eth_dev_info_get() is only resetting part of the dev_info structure given by the user. We might want to reset the dev_info structure to 0 before filling it ? >From my point of view, rte_eth_dev_info_get() is not in the datapath. I would prefer it to be safe. -- David Marchand ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration 2014-09-26 14:19 [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration Pablo de Lara ` (2 preceding siblings ...) 2014-09-27 18:45 ` [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration David Marchand @ 2014-10-01 8:00 ` Pablo de Lara 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara ` (2 more replies) 3 siblings, 3 replies; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 8:00 UTC (permalink / raw) To: dev These patches modified the dev info structure to include optimal values for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), so users can get these configurations and modify or use them directly, to set up RX/TX queues. Besides, most of the apps that were modifying little or none of the default values of the structures, have been modified to get these values to simplify the code and avoid duplication. Pablo de Lara (2): pmd: Modified dev_info structure to include default RX/TX configuration app: Used default RX/TX configuration got from dev info in apps examples/dpdk_qat/main.c | 44 ++------------ examples/exception_path/main.c | 30 +--------- examples/ip_fragmentation/main.c | 47 +++------------ examples/ip_reassembly/main.c | 50 +++------------- examples/ipv4_multicast/main.c | 48 +++------------ examples/kni/main.c | 34 +---------- examples/l2fwd-ivshmem/host/host.c | 43 +------------ examples/l2fwd/main.c | 48 +-------------- examples/l3fwd-acl/main.c | 50 +++------------- examples/l3fwd-power/main.c | 51 +++------------- examples/l3fwd-vf/main.c | 36 +++-------- examples/l3fwd/main.c | 58 ++++--------------- examples/link_status_interrupt/main.c | 43 +------------ examples/load_balancer/init.c | 24 +------- .../client_server_mp/mp_server/init.c | 41 +------------ examples/multi_process/l2fwd_fork/main.c | 44 +------------- examples/multi_process/symmetric_mp/main.c | 36 +---------- examples/netmap_compat/bridge/bridge.c | 25 -------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++-------- examples/quota_watermark/qw/init.c | 26 ++------- examples/vhost_xen/main.c | 34 ++--------- examples/vmdq/main.c | 62 +++----------------- examples/vmdq_dcb/main.c | 36 +---------- lib/librte_ether/rte_ethdev.c | 28 +++++++-- lib/librte_ether/rte_ethdev.h | 2 + lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++ 30 files changed, 265 insertions(+), 820 deletions(-) -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara @ 2014-10-01 8:00 ` Pablo de Lara 2014-10-01 8:38 ` Bruce Richardson ` (2 more replies) 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 2/2] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara 2 siblings, 3 replies; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 8:00 UTC (permalink / raw) To: dev Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf structures. This patch allows the user to get a default optimal RX/TX configuration through rte_eth_dev_info get, and still any parameters may be tweaked as wished, before setting up queues. Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or rte_eth_tx_queue_setup, these functions get internally the default RX/TX configuration for the user. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- lib/librte_ether/rte_ethdev.c | 28 +++++++++++++++++++++----- lib/librte_ether/rte_ethdev.h | 2 + lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 7 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fd1010a..2f9eea2 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, struct rte_eth_dev *dev; struct rte_pktmbuf_pool_private *mbp_priv; struct rte_eth_dev_info dev_info; + const struct rte_eth_rxconf *conf; /* This function is only safe when called from the primary process * in a multi-process setup*/ @@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); return (-EINVAL); } + dev = &rte_eth_devices[port_id]; if (rx_queue_id >= dev->data->nb_rx_queues) { PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); @@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, return (-EINVAL); } + conf = rx_conf; + if (conf == NULL) + conf = &dev_info.default_rxconf; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, - socket_id, rx_conf, mp); + socket_id, conf, mp); if (!ret) { if (!dev->data->min_rx_buf_size || dev->data->min_rx_buf_size > mbp_buf_size) @@ -997,6 +1003,8 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, const struct rte_eth_txconf *tx_conf) { struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info; + const struct rte_eth_txconf *conf; /* This function is only safe when called from the primary process * in a multi-process setup*/ @@ -1006,6 +1014,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); return (-EINVAL); } + dev = &rte_eth_devices[port_id]; if (tx_queue_id >= dev->data->nb_tx_queues) { PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); @@ -1018,9 +1027,17 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, return -EBUSY; } + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP); + + (*dev->dev_ops->dev_infos_get)(dev, &dev_info); + + conf = tx_conf; + if (conf == NULL) + conf = &dev_info.default_txconf; + return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc, - socket_id, tx_conf); + socket_id, conf); } void @@ -1249,10 +1266,9 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) } dev = &rte_eth_devices[port_id]; - /* Default device offload capabilities to zero */ - dev_info->rx_offload_capa = 0; - dev_info->tx_offload_capa = 0; - dev_info->if_index = 0; + /* Reset dev info structure */ + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); + FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 50df654..f63d38a 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -906,6 +906,8 @@ struct rte_eth_dev_info { uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ uint32_t rx_offload_capa; /**< Device RX offload capabilities. */ uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ + struct rte_eth_rxconf default_rxconf; /**< Default RX configuration */ + struct rte_eth_txconf default_txconf; /**< Default TX configuration */ }; struct rte_eth_dev; diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c index 3187d92..4bf75f5 100644 --- a/lib/librte_pmd_e1000/igb_ethdev.c +++ b/lib/librte_pmd_e1000/igb_ethdev.c @@ -57,6 +57,18 @@ #include "e1000/e1000_api.h" #include "e1000_ethdev.h" +/** + * Default values for port configuration + */ +#define IGB_DEFAULT_RX_FREE_THRESH 32 +#define IGB_DEFAULT_RX_PTHRESH 8 +#define IGB_DEFAULT_RX_HTHRESH 8 +#define IGB_DEFAULT_RX_WTHRESH 0 + +#define IGB_DEFAULT_TX_PTHRESH 32 +#define IGB_DEFAULT_TX_HTHRESH 0 +#define IGB_DEFAULT_TX_WTHRESH 0 + static int eth_igb_configure(struct rte_eth_dev *dev); static int eth_igb_start(struct rte_eth_dev *dev); static void eth_igb_stop(struct rte_eth_dev *dev); @@ -165,7 +177,6 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev *dev, static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, struct rte_5tuple_filter *filter, uint16_t *rx_queue); - /* * Define VF Stats MACRO for Non "cleared on read" register */ @@ -1331,6 +1342,25 @@ eth_igb_infos_get(struct rte_eth_dev *dev, dev_info->max_tx_queues = 0; dev_info->max_vmdq_pools = 0; } + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = IGB_DEFAULT_RX_PTHRESH, + .hthresh = IGB_DEFAULT_RX_HTHRESH, + .wthresh = IGB_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IGB_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = IGB_DEFAULT_TX_PTHRESH, + .hthresh = IGB_DEFAULT_TX_HTHRESH, + .wthresh = IGB_DEFAULT_TX_WTHRESH, + }, + .txq_flags = 0, + }; } /* return 0 means link status changed, -1 means not changed */ diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 9ed31b5..72faf95 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -58,6 +58,17 @@ #include "i40e_rxtx.h" #include "i40e_pf.h" +#define I40E_DEFAULT_RX_FREE_THRESH 32 +#define I40E_DEFAULT_RX_PTHRESH 8 +#define I40E_DEFAULT_RX_HTHRESH 8 +#define I40E_DEFAULT_RX_WTHRESH 0 + +#define I40E_DEFAULT_TX_FREE_THRESH 32 +#define I40E_DEFAULT_TX_PTHRESH 32 +#define I40E_DEFAULT_TX_HTHRESH 0 +#define I40E_DEFAULT_TX_WTHRESH 0 +#define I40E_DEFAULT_TX_RSBIT_THRESH 32 + /* Maximun number of MAC addresses */ #define I40E_NUM_MACADDR_MAX 64 #define I40E_CLEAR_PXE_WAIT_MS 200 @@ -1231,6 +1242,28 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM; + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = I40E_DEFAULT_RX_PTHRESH, + .hthresh = I40E_DEFAULT_RX_HTHRESH, + .wthresh = I40E_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = I40E_DEFAULT_TX_PTHRESH, + .hthresh = I40E_DEFAULT_TX_HTHRESH, + .wthresh = I40E_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; + } static int diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 59122a1..3b1c156 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -92,6 +92,20 @@ #define IXGBE_MMW_SIZE_DEFAULT 0x4 #define IXGBE_MMW_SIZE_JUMBO_FRAME 0x14 +/** + * Default values for RX/TX configuration + */ +#define IXGBE_DEFAULT_RX_FREE_THRESH 32 +#define IXGBE_DEFAULT_RX_PTHRESH 8 +#define IXGBE_DEFAULT_RX_HTHRESH 8 +#define IXGBE_DEFAULT_RX_WTHRESH 0 + +#define IXGBE_DEFAULT_TX_FREE_THRESH 32 +#define IXGBE_DEFAULT_TX_PTHRESH 32 +#define IXGBE_DEFAULT_TX_HTHRESH 0 +#define IXGBE_DEFAULT_TX_WTHRESH 0 +#define IXGBE_DEFAULT_TX_RSBIT_THRESH 32 + #define IXGBEVF_PMD_NAME "rte_ixgbevf_pmd" /* PMD name */ #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0])) @@ -1948,6 +1962,28 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM; + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = IXGBE_DEFAULT_RX_PTHRESH, + .hthresh = IXGBE_DEFAULT_RX_HTHRESH, + .wthresh = IXGBE_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = IXGBE_DEFAULT_TX_PTHRESH, + .hthresh = IXGBE_DEFAULT_TX_HTHRESH, + .wthresh = IXGBE_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; } /* return 0 means link status changed, -1 means not changed */ -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara @ 2014-10-01 8:38 ` Bruce Richardson 2014-10-01 8:42 ` Bruce Richardson 2014-10-01 8:45 ` David Marchand 2 siblings, 0 replies; 24+ messages in thread From: Bruce Richardson @ 2014-10-01 8:38 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev On Wed, Oct 01, 2014 at 09:00:57AM +0100, Pablo de Lara wrote: > Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf > structures. This patch allows the user to get a default optimal RX/TX configuration > through rte_eth_dev_info get, and still any parameters may be tweaked as wished, > before setting up queues. > > Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or > rte_eth_tx_queue_setup, these functions get internally the default RX/TX > configuration for the user. > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 28 +++++++++++++++++++++----- > lib/librte_ether/rte_ethdev.h | 2 + > lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++++++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index fd1010a..2f9eea2 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > struct rte_eth_dev *dev; > struct rte_pktmbuf_pool_private *mbp_priv; > struct rte_eth_dev_info dev_info; > + const struct rte_eth_rxconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); > @@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > return (-EINVAL); > } > > + conf = rx_conf; > + if (conf == NULL) > + conf = &dev_info.default_rxconf; > + > ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, > - socket_id, rx_conf, mp); > + socket_id, conf, mp); > if (!ret) { > if (!dev->data->min_rx_buf_size || > dev->data->min_rx_buf_size > mbp_buf_size) One very minor nit - I don't think you need the new local variable conf. You can just check "if (rx_conf == NULL) rx_conf = &dev...". The same for the tx_conf too. /Bruce ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara 2014-10-01 8:38 ` Bruce Richardson @ 2014-10-01 8:42 ` Bruce Richardson 2014-10-01 8:45 ` David Marchand 2 siblings, 0 replies; 24+ messages in thread From: Bruce Richardson @ 2014-10-01 8:42 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev On Wed, Oct 01, 2014 at 09:00:57AM +0100, Pablo de Lara wrote: > Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf > structures. This patch allows the user to get a default optimal RX/TX configuration > through rte_eth_dev_info get, and still any parameters may be tweaked as wished, > before setting up queues. > > Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or > rte_eth_tx_queue_setup, these functions get internally the default RX/TX > configuration for the user. > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 28 +++++++++++++++++++++----- > lib/librte_ether/rte_ethdev.h | 2 + > lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++++++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index fd1010a..2f9eea2 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > struct rte_eth_dev *dev; > struct rte_pktmbuf_pool_private *mbp_priv; > struct rte_eth_dev_info dev_info; > + const struct rte_eth_rxconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); > @@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, > return (-EINVAL); > } > > + conf = rx_conf; > + if (conf == NULL) > + conf = &dev_info.default_rxconf; > + > ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, > - socket_id, rx_conf, mp); > + socket_id, conf, mp); > if (!ret) { > if (!dev->data->min_rx_buf_size || > dev->data->min_rx_buf_size > mbp_buf_size) > @@ -997,6 +1003,8 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, > const struct rte_eth_txconf *tx_conf) > { > struct rte_eth_dev *dev; > + struct rte_eth_dev_info dev_info; > + const struct rte_eth_txconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -1006,6 +1014,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (tx_queue_id >= dev->data->nb_tx_queues) { > PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); > @@ -1018,9 +1027,17 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, > return -EBUSY; > } > > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP); > + > + (*dev->dev_ops->dev_infos_get)(dev, &dev_info); > + > + conf = tx_conf; > + if (conf == NULL) > + conf = &dev_info.default_txconf; > + > return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc, > - socket_id, tx_conf); > + socket_id, conf); > } > > void > @@ -1249,10 +1266,9 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) > } > dev = &rte_eth_devices[port_id]; > > - /* Default device offload capabilities to zero */ > - dev_info->rx_offload_capa = 0; > - dev_info->tx_offload_capa = 0; > - dev_info->if_index = 0; > + /* Reset dev info structure */ > + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); > + > FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); > dev_info->pci_dev = dev->pci_dev; > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 50df654..f63d38a 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -906,6 +906,8 @@ struct rte_eth_dev_info { > uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ > uint32_t rx_offload_capa; /**< Device RX offload capabilities. */ > uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ > + struct rte_eth_rxconf default_rxconf; /**< Default RX configuration */ > + struct rte_eth_txconf default_txconf; /**< Default TX configuration */ > }; > > struct rte_eth_dev; In this file (rte_ethdev.h), you also need to update the API documentation for the rte_eth_rx_queue_setup and rte_eth_tx_queue_setup functions to state that passing in a NULL value for the conf parameter is allowed, and that it just means to use the defaults. /Bruce ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara 2014-10-01 8:38 ` Bruce Richardson 2014-10-01 8:42 ` Bruce Richardson @ 2014-10-01 8:45 ` David Marchand 2 siblings, 0 replies; 24+ messages in thread From: David Marchand @ 2014-10-01 8:45 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev Hello Pablo, I agree with Bruce comments. I have a single comment: I would have preferred to have a separate patch for the memset() on dev_info (could be the first patch of this patchset). All the more so as it is not detailed in the commit log. Thanks. -- David Marchand On Wed, Oct 1, 2014 at 10:00 AM, Pablo de Lara < pablo.de.lara.guarch@intel.com> wrote: > Many sample apps use duplicated code to set rte_eth_txconf and > rte_eth_rxconf > structures. This patch allows the user to get a default optimal RX/TX > configuration > through rte_eth_dev_info get, and still any parameters may be tweaked as > wished, > before setting up queues. > > Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or > rte_eth_tx_queue_setup, these functions get internally the default RX/TX > configuration for the user. > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> > --- > lib/librte_ether/rte_ethdev.c | 28 +++++++++++++++++++++----- > lib/librte_ether/rte_ethdev.h | 2 + > lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 33 > ++++++++++++++++++++++++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 > +++++++++++++++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index fd1010a..2f9eea2 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -928,6 +928,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t > rx_queue_id, > struct rte_eth_dev *dev; > struct rte_pktmbuf_pool_private *mbp_priv; > struct rte_eth_dev_info dev_info; > + const struct rte_eth_rxconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -937,6 +938,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t > rx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (rx_queue_id >= dev->data->nb_rx_queues) { > PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id); > @@ -980,8 +982,12 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t > rx_queue_id, > return (-EINVAL); > } > > + conf = rx_conf; > + if (conf == NULL) > + conf = &dev_info.default_rxconf; > + > ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, > - socket_id, rx_conf, mp); > + socket_id, conf, mp); > if (!ret) { > if (!dev->data->min_rx_buf_size || > dev->data->min_rx_buf_size > mbp_buf_size) > @@ -997,6 +1003,8 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t > tx_queue_id, > const struct rte_eth_txconf *tx_conf) > { > struct rte_eth_dev *dev; > + struct rte_eth_dev_info dev_info; > + const struct rte_eth_txconf *conf; > > /* This function is only safe when called from the primary process > * in a multi-process setup*/ > @@ -1006,6 +1014,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t > tx_queue_id, > PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); > return (-EINVAL); > } > + > dev = &rte_eth_devices[port_id]; > if (tx_queue_id >= dev->data->nb_tx_queues) { > PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id); > @@ -1018,9 +1027,17 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t > tx_queue_id, > return -EBUSY; > } > > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); > FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP); > + > + (*dev->dev_ops->dev_infos_get)(dev, &dev_info); > + > + conf = tx_conf; > + if (conf == NULL) > + conf = &dev_info.default_txconf; > + > return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, > nb_tx_desc, > - socket_id, tx_conf); > + socket_id, conf); > } > > void > @@ -1249,10 +1266,9 @@ rte_eth_dev_info_get(uint8_t port_id, struct > rte_eth_dev_info *dev_info) > } > dev = &rte_eth_devices[port_id]; > > - /* Default device offload capabilities to zero */ > - dev_info->rx_offload_capa = 0; > - dev_info->tx_offload_capa = 0; > - dev_info->if_index = 0; > + /* Reset dev info structure */ > + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); > + > FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); > dev_info->pci_dev = dev->pci_dev; > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 50df654..f63d38a 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -906,6 +906,8 @@ struct rte_eth_dev_info { > uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ > uint32_t rx_offload_capa; /**< Device RX offload capabilities. */ > uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ > + struct rte_eth_rxconf default_rxconf; /**< Default RX > configuration */ > + struct rte_eth_txconf default_txconf; /**< Default TX > configuration */ > }; > > struct rte_eth_dev; > diff --git a/lib/librte_pmd_e1000/igb_ethdev.c > b/lib/librte_pmd_e1000/igb_ethdev.c > index 3187d92..4bf75f5 100644 > --- a/lib/librte_pmd_e1000/igb_ethdev.c > +++ b/lib/librte_pmd_e1000/igb_ethdev.c > @@ -57,6 +57,18 @@ > #include "e1000/e1000_api.h" > #include "e1000_ethdev.h" > > +/** > + * Default values for port configuration > + */ > +#define IGB_DEFAULT_RX_FREE_THRESH 32 > +#define IGB_DEFAULT_RX_PTHRESH 8 > +#define IGB_DEFAULT_RX_HTHRESH 8 > +#define IGB_DEFAULT_RX_WTHRESH 0 > + > +#define IGB_DEFAULT_TX_PTHRESH 32 > +#define IGB_DEFAULT_TX_HTHRESH 0 > +#define IGB_DEFAULT_TX_WTHRESH 0 > + > static int eth_igb_configure(struct rte_eth_dev *dev); > static int eth_igb_start(struct rte_eth_dev *dev); > static void eth_igb_stop(struct rte_eth_dev *dev); > @@ -165,7 +177,6 @@ static int eth_igb_remove_5tuple_filter(struct > rte_eth_dev *dev, > static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, > uint16_t index, > struct rte_5tuple_filter *filter, uint16_t > *rx_queue); > - > /* > * Define VF Stats MACRO for Non "cleared on read" register > */ > @@ -1331,6 +1342,25 @@ eth_igb_infos_get(struct rte_eth_dev *dev, > dev_info->max_tx_queues = 0; > dev_info->max_vmdq_pools = 0; > } > + > + dev_info->default_rxconf = (struct rte_eth_rxconf) { > + .rx_thresh = { > + .pthresh = IGB_DEFAULT_RX_PTHRESH, > + .hthresh = IGB_DEFAULT_RX_HTHRESH, > + .wthresh = IGB_DEFAULT_RX_WTHRESH, > + }, > + .rx_free_thresh = IGB_DEFAULT_RX_FREE_THRESH, > + .rx_drop_en = 0, > + }; > + > + dev_info->default_txconf = (struct rte_eth_txconf) { > + .tx_thresh = { > + .pthresh = IGB_DEFAULT_TX_PTHRESH, > + .hthresh = IGB_DEFAULT_TX_HTHRESH, > + .wthresh = IGB_DEFAULT_TX_WTHRESH, > + }, > + .txq_flags = 0, > + }; > } > > /* return 0 means link status changed, -1 means not changed */ > diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c > b/lib/librte_pmd_i40e/i40e_ethdev.c > index 9ed31b5..72faf95 100644 > --- a/lib/librte_pmd_i40e/i40e_ethdev.c > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c > @@ -58,6 +58,17 @@ > #include "i40e_rxtx.h" > #include "i40e_pf.h" > > +#define I40E_DEFAULT_RX_FREE_THRESH 32 > +#define I40E_DEFAULT_RX_PTHRESH 8 > +#define I40E_DEFAULT_RX_HTHRESH 8 > +#define I40E_DEFAULT_RX_WTHRESH 0 > + > +#define I40E_DEFAULT_TX_FREE_THRESH 32 > +#define I40E_DEFAULT_TX_PTHRESH 32 > +#define I40E_DEFAULT_TX_HTHRESH 0 > +#define I40E_DEFAULT_TX_WTHRESH 0 > +#define I40E_DEFAULT_TX_RSBIT_THRESH 32 > + > /* Maximun number of MAC addresses */ > #define I40E_NUM_MACADDR_MAX 64 > #define I40E_CLEAR_PXE_WAIT_MS 200 > @@ -1231,6 +1242,28 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *dev_info) > DEV_TX_OFFLOAD_UDP_CKSUM | > DEV_TX_OFFLOAD_TCP_CKSUM | > DEV_TX_OFFLOAD_SCTP_CKSUM; > + > + dev_info->default_rxconf = (struct rte_eth_rxconf) { > + .rx_thresh = { > + .pthresh = I40E_DEFAULT_RX_PTHRESH, > + .hthresh = I40E_DEFAULT_RX_HTHRESH, > + .wthresh = I40E_DEFAULT_RX_WTHRESH, > + }, > + .rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH, > + .rx_drop_en = 0, > + }; > + > + dev_info->default_txconf = (struct rte_eth_txconf) { > + .tx_thresh = { > + .pthresh = I40E_DEFAULT_TX_PTHRESH, > + .hthresh = I40E_DEFAULT_TX_HTHRESH, > + .wthresh = I40E_DEFAULT_TX_WTHRESH, > + }, > + .tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH, > + .tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH, > + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | > ETH_TXQ_FLAGS_NOOFFLOADS, > + }; > + > } > > static int > diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > index 59122a1..3b1c156 100644 > --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c > @@ -92,6 +92,20 @@ > #define IXGBE_MMW_SIZE_DEFAULT 0x4 > #define IXGBE_MMW_SIZE_JUMBO_FRAME 0x14 > > +/** > + * Default values for RX/TX configuration > + */ > +#define IXGBE_DEFAULT_RX_FREE_THRESH 32 > +#define IXGBE_DEFAULT_RX_PTHRESH 8 > +#define IXGBE_DEFAULT_RX_HTHRESH 8 > +#define IXGBE_DEFAULT_RX_WTHRESH 0 > + > +#define IXGBE_DEFAULT_TX_FREE_THRESH 32 > +#define IXGBE_DEFAULT_TX_PTHRESH 32 > +#define IXGBE_DEFAULT_TX_HTHRESH 0 > +#define IXGBE_DEFAULT_TX_WTHRESH 0 > +#define IXGBE_DEFAULT_TX_RSBIT_THRESH 32 > + > #define IXGBEVF_PMD_NAME "rte_ixgbevf_pmd" /* PMD name */ > > #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / > sizeof(hw_stats->qprc[0])) > @@ -1948,6 +1962,28 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct > rte_eth_dev_info *dev_info) > DEV_TX_OFFLOAD_UDP_CKSUM | > DEV_TX_OFFLOAD_TCP_CKSUM | > DEV_TX_OFFLOAD_SCTP_CKSUM; > + > + dev_info->default_rxconf = (struct rte_eth_rxconf) { > + .rx_thresh = { > + .pthresh = IXGBE_DEFAULT_RX_PTHRESH, > + .hthresh = IXGBE_DEFAULT_RX_HTHRESH, > + .wthresh = IXGBE_DEFAULT_RX_WTHRESH, > + }, > + .rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH, > + .rx_drop_en = 0, > + }; > + > + > + dev_info->default_txconf = (struct rte_eth_txconf) { > + .tx_thresh = { > + .pthresh = IXGBE_DEFAULT_TX_PTHRESH, > + .hthresh = IXGBE_DEFAULT_TX_HTHRESH, > + .wthresh = IXGBE_DEFAULT_TX_WTHRESH, > + }, > + .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, > + .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, > + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | > ETH_TXQ_FLAGS_NOOFFLOADS, > + }; > } > > /* return 0 means link status changed, -1 means not changed */ > -- > 1.7.7.6 > > ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] app: Used default RX/TX configuration got from dev info in apps 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara @ 2014-10-01 8:00 ` Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara 2 siblings, 0 replies; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 8:00 UTC (permalink / raw) To: dev For apps that were using default rte_eth_rxconf and rte_eth_txconf structures, these have been removed and now they are obtained by calling rte_eth_dev_info_get, just before setting up RX/TX queues. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- examples/dpdk_qat/main.c | 44 ++------------ examples/exception_path/main.c | 30 +--------- examples/ip_fragmentation/main.c | 47 +++------------ examples/ip_reassembly/main.c | 50 +++------------- examples/ipv4_multicast/main.c | 48 +++------------ examples/kni/main.c | 34 +---------- examples/l2fwd-ivshmem/host/host.c | 43 +------------ examples/l2fwd/main.c | 48 +-------------- examples/l3fwd-acl/main.c | 50 +++------------- examples/l3fwd-power/main.c | 51 +++------------- examples/l3fwd-vf/main.c | 36 +++-------- examples/l3fwd/main.c | 58 ++++--------------- examples/link_status_interrupt/main.c | 43 +------------ examples/load_balancer/init.c | 24 +------- .../client_server_mp/mp_server/init.c | 41 +------------ examples/multi_process/l2fwd_fork/main.c | 44 +------------- examples/multi_process/symmetric_mp/main.c | 36 +---------- examples/netmap_compat/bridge/bridge.c | 25 -------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++-------- examples/quota_watermark/qw/init.c | 26 ++------- examples/vhost_xen/main.c | 34 ++--------- examples/vmdq/main.c | 62 +++----------------- examples/vmdq_dcb/main.c | 36 +---------- 25 files changed, 141 insertions(+), 813 deletions(-) diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index d61db4c..69b8e6a 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -75,25 +75,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF (32 * 1024) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -178,24 +159,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - static struct rte_mempool * pktmbuf_pool[RTE_MAX_NUMA_NODES]; struct lcore_conf { @@ -785,7 +748,8 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcoreid, queueid, socketid); fflush(stdout); ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, + NULL); if (ret < 0) rte_panic("rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -810,7 +774,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_panic("rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 0204116..8f89dc6 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -109,31 +109,6 @@ * controller's datasheet and supporting DPDK documentation for guidance * on how these parameters should be set. */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static const struct rte_eth_conf port_conf = { @@ -460,13 +435,14 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, rte_eth_dev_socket_id(port), - &rx_conf, pktmbuf_pool); + NULL, + pktmbuf_pool); if (ret < 0) FATAL_ERROR("Could not setup up RX queue for port%u (%d)", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, rte_eth_dev_socket_id(port), - &tx_conf); + NULL); if (ret < 0) FATAL_ERROR("Could not setup up TX queue for port%u (%d)", (unsigned)port, ret); diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 72cd2b2..4181125 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -106,25 +106,6 @@ #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -208,24 +189,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* * IPv4 forwarding table */ @@ -851,6 +814,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; struct rx_queue *rxq; int socket, ret; unsigned nb_ports; @@ -942,7 +907,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, socket_direct_pool[socket]); if (ret < 0) { printf("\n"); @@ -964,8 +929,12 @@ MAIN(int argc, char **argv) socket = (int) rte_lcore_to_socket_id(lcore_id); printf("txq=%u,%d ", lcore_id, queueid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socket, &tx_conf); + socket, txconf); if (ret < 0) { printf("\n"); rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: " diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 3bb6afd..9e3aa52 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -114,25 +114,6 @@ static uint32_t max_flow_num = DEF_FLOW_NUM; static uint32_t max_flow_ttl = DEF_FLOW_TTL; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -236,26 +217,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - /* * IPv4 forwarding table */ @@ -1058,6 +1019,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; struct rx_queue *rxq; int ret, socket; unsigned nb_ports; @@ -1149,7 +1112,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, rxq->pool); if (ret < 0) { printf("\n"); @@ -1172,8 +1135,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socket); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; + ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socket, &tx_conf); + socket, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index dfa0075..0f40d6c 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -92,25 +92,6 @@ /* allow max jumbo frame 9.5 KB */ #define JUMBO_FRAME_MAX_SIZE 0x2600 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -176,24 +157,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - static struct rte_mempool *packet_pool, *header_pool, *clone_pool; @@ -712,6 +675,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; uint16_t queueid; unsigned lcore_id = 0, rx_lcore_id = 0; @@ -810,7 +775,8 @@ MAIN(int argc, char **argv) printf("rxq=%hu ", queueid); fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, packet_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%d\n", @@ -824,8 +790,12 @@ MAIN(int argc, char **argv) continue; printf("txq=%u,%hu ", lcore_id, queueid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - rte_lcore_to_socket_id(lcore_id), &tx_conf); + rte_lcore_to_socket_id(lcore_id), txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); diff --git a/examples/kni/main.c b/examples/kni/main.c index 7df1b36..6cfd8fe 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -125,36 +125,6 @@ struct kni_port_params { static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS]; -/* RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static struct rte_eth_conf port_conf = { @@ -631,13 +601,13 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, - rte_eth_dev_socket_id(port), &rx_conf, pktmbuf_pool); + rte_eth_dev_socket_id(port), NULL, pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up RX queue for " "port%u (%d)\n", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, - rte_eth_dev_socket_id(port), &tx_conf); + rte_eth_dev_socket_id(port), NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up TX queue for " "port%u (%d)\n", (unsigned)port, ret); diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 02e65b9..706a7b3 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -63,25 +63,6 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ /* mask of enabled ports */ @@ -117,24 +98,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - #define METADATA_NAME "l2fwd_ivshmem" #define CMDLINE_OPT_FWD_CONF "fwd-conf" @@ -792,7 +755,8 @@ int main(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_ivshmem_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -801,7 +765,8 @@ int main(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 4069d7c..c6131a7 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -77,25 +77,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -147,29 +128,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - /* - * As the example won't handle mult-segments and offload cases, - * set the flag by default. - */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - struct rte_mempool * l2fwd_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -704,7 +662,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -713,7 +672,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 9b2c21b..b979379 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -100,25 +100,6 @@ nb_lcores * MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -207,26 +188,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ @@ -1973,6 +1934,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -2063,8 +2026,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " @@ -2098,7 +2066,7 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, + socketid, NULL, pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 57fc371..cbe9868 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -140,25 +140,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -255,26 +236,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -1513,6 +1474,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -1606,8 +1569,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " @@ -1655,7 +1623,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, " diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 2ca5c21..d1049ed 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -215,30 +215,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -979,6 +955,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -1055,8 +1033,13 @@ MAIN(int argc, char **argv) printf("txq=%d,%d,%d ", portid, 0, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -1086,7 +1069,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index bef409a..999c3e8 100755 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -137,25 +137,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -259,31 +240,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) - -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) @@ -1974,7 +1930,6 @@ parse_args(int argc, char **argv) printf("jumbo frame is enabled - disabling simple TX path\n"); port_conf.rxmode.jumbo_frame = 1; - tx_conf.txq_flags = 0; /* if no max-pkt-len set, use the default value ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -2448,6 +2403,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -2541,8 +2498,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -2574,7 +2536,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 1a87551..9dc0df8 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -78,25 +78,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -153,24 +134,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - struct rte_mempool * lsi_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -754,7 +717,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, lsi_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, port=%u\n", @@ -763,7 +727,8 @@ MAIN(int argc, char **argv) /* init one TX queue logical core on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d,port=%u\n", ret, (unsigned) portid); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 2f00a70..448425b 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -95,26 +95,6 @@ static struct rte_eth_conf port_conf = { }, }; -static struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = APP_DEFAULT_NIC_RX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_RX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_RX_WTHRESH, - }, - .rx_free_thresh = APP_DEFAULT_NIC_RX_FREE_THRESH, - .rx_drop_en = APP_DEFAULT_NIC_RX_DROP_EN, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = APP_DEFAULT_NIC_TX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_TX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_TX_WTHRESH, - }, - .tx_free_thresh = APP_DEFAULT_NIC_TX_FREE_THRESH, - .tx_rs_thresh = APP_DEFAULT_NIC_TX_RS_THRESH, -}; - static void app_assign_worker_ids(void) { @@ -495,7 +475,7 @@ app_init_nics(void) queue, (uint16_t) app.nic_rx_ring_size, socket, - &rx_conf, + NULL, pool); if (ret < 0) { rte_panic("Cannot init RX queue %u for port %u (%d)\n", @@ -516,7 +496,7 @@ app_init_nics(void) 0, (uint16_t) app.nic_tx_ring_size, socket, - &tx_conf); + NULL); if (ret < 0) { rte_panic("Cannot init TX queue 0 for port %d (%d)\n", port, diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index a84d1ee..5b3f06e 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -84,41 +84,6 @@ #define NO_FLAGS 0 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define MP_DEFAULT_PTHRESH 36 -#define MP_DEFAULT_RX_HTHRESH 8 -#define MP_DEFAULT_TX_HTHRESH 0 -#define MP_DEFAULT_WTHRESH 0 - -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_RX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_TX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* The mbuf pool for packet rx */ struct rte_mempool *pktmbuf_pool; @@ -184,13 +149,15 @@ init_port(uint8_t port_num) for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size, - rte_eth_dev_socket_id(port_num), &rx_conf_default, pktmbuf_pool); + rte_eth_dev_socket_id(port_num), + NULL, pktmbuf_pool); if (retval < 0) return retval; } for ( q = 0; q < tx_rings; q ++ ) { retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size, - rte_eth_dev_socket_id(port_num), &tx_conf_default); + rte_eth_dev_socket_id(port_num), + NULL); if (retval < 0) return retval; } diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 03fba55..5899875 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -96,25 +96,6 @@ enum l2fwd_cmd{ CMD_STOP, }; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -190,25 +171,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - static struct rte_mempool * l2fwd_pktmbuf_pool[RTE_MAX_ETHPORTS]; /* Per-port statistics struct */ @@ -1170,7 +1132,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool[portid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -1179,7 +1142,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index b8f31b3..638d167 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -89,36 +89,6 @@ #define PARAM_PROC_ID "proc-id" #define PARAM_NUM_PROCS "num-procs" -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* for each lcore, record the elements of the ports array to use */ struct lcore_ports{ unsigned start_port; @@ -277,7 +247,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -285,7 +256,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 898277e..f935b3b 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -67,29 +67,6 @@ struct rte_eth_conf eth_conf = { }, }; -struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; - -struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - #define MAX_QUEUE_NUM 1 #define RX_QUEUE_NUM 1 #define TX_QUEUE_NUM 1 @@ -103,8 +80,6 @@ struct rte_eth_rxconf rx_conf = { struct rte_netmap_port_conf port_conf = { .eth_conf = ð_conf, - .tx_conf = &tx_conf, - .rx_conf = &rx_conf, .socket_id = SOCKET_ID_ANY, .nr_tx_rings = TX_QUEUE_NUM, .nr_rx_rings = RX_QUEUE_NUM, diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c index 44b3f8e..2348366 100644 --- a/examples/netmap_compat/lib/compat_netmap.c +++ b/examples/netmap_compat/lib/compat_netmap.c @@ -713,7 +713,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) for (i = 0; i < conf->nr_tx_rings; i++) { ret = rte_eth_tx_queue_setup(portid, i, tx_slots, - conf->socket_id, conf->tx_conf); + conf->socket_id, NULL); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -724,7 +724,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) } ret = rte_eth_rx_queue_setup(portid, i, rx_slots, - conf->socket_id, conf->rx_conf, conf->pool); + conf->socket_id, NULL, conf->pool); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -737,8 +737,6 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) /* copy config to the private storage. */ ports[portid].eth_conf = conf->eth_conf[0]; - ports[portid].rx_conf = conf->rx_conf[0]; - ports[portid].tx_conf = conf->tx_conf[0]; ports[portid].pool = conf->pool; ports[portid].socket_id = conf->socket_id; ports[portid].nr_tx_rings = conf->nr_tx_rings; diff --git a/examples/netmap_compat/lib/compat_netmap.h b/examples/netmap_compat/lib/compat_netmap.h index f7f2276..f8a7812 100644 --- a/examples/netmap_compat/lib/compat_netmap.h +++ b/examples/netmap_compat/lib/compat_netmap.h @@ -56,8 +56,6 @@ struct rte_netmap_conf { struct rte_netmap_port_conf { struct rte_eth_conf *eth_conf; - struct rte_eth_txconf *tx_conf; - struct rte_eth_rxconf *rx_conf; struct rte_mempool *pool; int32_t socket_id; uint16_t nr_tx_rings; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b4b8c4f..82a90ac 100755 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -102,26 +102,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* RX prefetch threshold reg */ - .hthresh = 8, /* RX host threshold reg */ - .wthresh = 4, /* RX write-back threshold reg */ - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* TX prefetch threshold reg */ - .hthresh = 0, /* TX host threshold reg */ - .wthresh = 0, /* TX write-back threshold reg */ - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = 0x0, -}; - #define NIC_RX_QUEUE_DESC 128 #define NIC_TX_QUEUE_DESC 512 @@ -394,11 +374,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_rx, ret); - ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret); - ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret); @@ -406,11 +390,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_tx, ret); - ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret); - ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_tx, ret); diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c index a7f8c85..5adb906 100644 --- a/examples/quota_watermark/qw/init.c +++ b/examples/quota_watermark/qw/init.c @@ -64,24 +64,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, -}; - static struct rte_eth_fc_conf fc_conf = { .mode = RTE_FC_TX_PAUSE, .high_water = 80 * 510 / 100, @@ -104,15 +86,17 @@ void configure_eth_port(uint8_t port_id) /* Initialize the port's RX queue */ ret = rte_eth_rx_queue_setup(port_id, 0, RX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &rx_conf, - mbuf_pool); + rte_eth_dev_socket_id(port_id), + NULL, + mbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup RX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); /* Initialize the port's TX queue */ ret = rte_eth_tx_queue_setup(port_id, 0, TX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &tx_conf); + rte_eth_dev_socket_id(port_id), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup TX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index b275747..ec30947 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -135,31 +135,6 @@ static uint32_t enable_vm2vm = 1; /* Enable stats. */ static uint32_t enable_stats = 0; -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { .rxmode = { @@ -301,6 +276,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf *rxconf; struct rte_eth_conf port_conf; uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count(); const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT, tx_ring_size = RTE_TEST_TX_DESC_DEFAULT; @@ -331,17 +307,21 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_dev_info_get(port, &dev_info); + rxconf = &dev_info.default_rxconf; + rxconf->rx_drop_en = 1; /* Setup the queues. */ for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rx_ring_size, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), rxconf, mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 35df234..7246663 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -81,25 +81,6 @@ #define MBUF_CACHE_SIZE 64 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 /* @@ -117,37 +98,6 @@ static uint32_t enabled_port_mask = 0; static uint32_t num_queues = 8; static uint32_t num_pools = 8; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { .rxmode = { @@ -283,6 +233,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf *rxconf; struct rte_eth_conf port_conf; uint16_t rxRings, txRings = (uint16_t)rte_lcore_count(); const uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT, txRingSize = RTE_TEST_TX_DESC_DEFAULT; @@ -308,17 +259,22 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_dev_info_get(port, &dev_info); + rxconf = &dev_info.default_rxconf; + rxconf->rx_drop_en = 1; for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, - mbuf_pool); + rte_eth_dev_socket_id(port), + rxconf, + mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 2f708a1..20726e5 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -87,36 +87,6 @@ static uint32_t enabled_port_mask = 0; /* number of pools (if user does not specify any, 16 by default */ static enum rte_eth_nb_pools num_pools = ETH_16_POOLS; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq+dcb configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_dcb_conf_default = { .rxmode = { @@ -212,7 +182,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -220,7 +191,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } -- 1.7.7.6 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 2/2] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara @ 2014-10-01 9:49 ` Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure Pablo de Lara ` (3 more replies) 2 siblings, 4 replies; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 9:49 UTC (permalink / raw) To: dev These patches modified the dev info structure to include optimal values for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), so users can get these configurations and modify or use them directly, to set up RX/TX queues. Besides, most of the apps that were modifying little or none of the default values of the structures, have been modified to get these values to simplify the code and avoid duplication. Pablo de Lara (3): ether: Reset whole dev info structure pmd: Modified dev_info structure to include default RX/TX configuration app: Used default RX/TX configuration got from dev info in apps examples/dpdk_qat/main.c | 44 ++------------ examples/exception_path/main.c | 30 +--------- examples/ip_fragmentation/main.c | 47 +++------------ examples/ip_reassembly/main.c | 50 +++------------- examples/ipv4_multicast/main.c | 48 +++------------ examples/kni/main.c | 34 +---------- examples/l2fwd-ivshmem/host/host.c | 43 +------------ examples/l2fwd/main.c | 48 +-------------- examples/l3fwd-acl/main.c | 50 +++------------- examples/l3fwd-power/main.c | 51 +++------------- examples/l3fwd-vf/main.c | 36 +++-------- examples/l3fwd/main.c | 58 ++++--------------- examples/link_status_interrupt/main.c | 43 +------------ examples/load_balancer/init.c | 24 +------- .../client_server_mp/mp_server/init.c | 41 +------------ examples/multi_process/l2fwd_fork/main.c | 44 +------------- examples/multi_process/symmetric_mp/main.c | 36 +---------- examples/netmap_compat/bridge/bridge.c | 25 -------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++-------- examples/quota_watermark/qw/init.c | 26 ++------- examples/vhost_xen/main.c | 34 ++--------- examples/vmdq/main.c | 62 +++----------------- examples/vmdq_dcb/main.c | 36 +---------- lib/librte_ether/rte_ethdev.c | 18 +++++- lib/librte_ether/rte_ethdev.h | 6 ++ lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++ 30 files changed, 261 insertions(+), 818 deletions(-) -- 1.7.4.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara @ 2014-10-01 9:49 ` Pablo de Lara 2014-10-10 11:08 ` Thomas Monjalon 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration Pablo de Lara ` (2 subsequent siblings) 3 siblings, 1 reply; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 9:49 UTC (permalink / raw) To: dev To guarantee that RX/TX configuration structures are reseted before modifying them, plus the other dev info fields, dev info structure is zeroed beforehand. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- lib/librte_ether/rte_ethdev.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fd1010a..3c09a23 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1249,10 +1249,9 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) } dev = &rte_eth_devices[port_id]; - /* Default device offload capabilities to zero */ - dev_info->rx_offload_capa = 0; - dev_info->tx_offload_capa = 0; - dev_info->if_index = 0; + /* Reset dev info structure */ + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); + FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; -- 1.7.4.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure Pablo de Lara @ 2014-10-10 11:08 ` Thomas Monjalon 0 siblings, 0 replies; 24+ messages in thread From: Thomas Monjalon @ 2014-10-10 11:08 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev 2014-10-01 10:49, Pablo de Lara: > + /* Reset dev info structure */ > + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); It's typically the kind of situation where a comment is not needed :) -- Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure Pablo de Lara @ 2014-10-01 9:49 ` Pablo de Lara 2014-10-10 11:14 ` Thomas Monjalon 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara 2014-10-01 9:54 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration De Lara Guarch, Pablo 3 siblings, 1 reply; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 9:49 UTC (permalink / raw) To: dev Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf structures. This patch allows the user to get a default optimal RX/TX configuration through rte_eth_dev_info get, and still any parameters may be tweaked as wished, before setting up queues. Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or rte_eth_tx_queue_setup, these functions get internally the default RX/TX configuration for the user. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- lib/librte_ether/rte_ethdev.c | 11 ++++++++++ lib/librte_ether/rte_ethdev.h | 6 +++++ lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++++++++++++++++++++++- lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++++++++++++ lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 1 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 3c09a23..ad4b973 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -980,6 +980,9 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, return (-EINVAL); } + if (rx_conf == NULL) + rx_conf = &dev_info.default_rxconf; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, rx_conf, mp); if (!ret) { @@ -997,6 +1000,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, const struct rte_eth_txconf *tx_conf) { struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info; /* This function is only safe when called from the primary process * in a multi-process setup*/ @@ -1018,7 +1022,14 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, return -EBUSY; } + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP); + + (*dev->dev_ops->dev_infos_get)(dev, &dev_info); + + if (tx_conf == NULL) + tx_conf = &dev_info.default_txconf; + return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc, socket_id, tx_conf); } diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 50df654..1dff97e 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -906,6 +906,8 @@ struct rte_eth_dev_info { uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ uint32_t rx_offload_capa; /**< Device RX offload capabilities. */ uint32_t tx_offload_capa; /**< Device TX offload capabilities. */ + struct rte_eth_rxconf default_rxconf; /**< Default RX configuration */ + struct rte_eth_txconf default_txconf; /**< Default TX configuration */ }; struct rte_eth_dev; @@ -1693,6 +1695,8 @@ extern int rte_eth_dev_configure(uint8_t port_id, * the DMA memory allocated for the receive descriptors of the ring. * @param rx_conf * The pointer to the configuration data to be used for the receive queue. + * NULL value is allowed, in which case default RX configuration + * will be used. * The *rx_conf* structure contains an *rx_thresh* structure with the values * of the Prefetch, Host, and Write-Back threshold registers of the receive * ring. @@ -1730,6 +1734,8 @@ extern int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id, * the DMA memory allocated for the transmit descriptors of the ring. * @param tx_conf * The pointer to the configuration data to be used for the transmit queue. + * NULL value is allowed, in which case default RX configuration + * will be used. * The *tx_conf* structure contains the following data: * - The *tx_thresh* structure with the values of the Prefetch, Host, and * Write-Back threshold registers of the transmit ring. diff --git a/lib/librte_pmd_e1000/igb_ethdev.c b/lib/librte_pmd_e1000/igb_ethdev.c index 3187d92..4bf75f5 100644 --- a/lib/librte_pmd_e1000/igb_ethdev.c +++ b/lib/librte_pmd_e1000/igb_ethdev.c @@ -57,6 +57,18 @@ #include "e1000/e1000_api.h" #include "e1000_ethdev.h" +/** + * Default values for port configuration + */ +#define IGB_DEFAULT_RX_FREE_THRESH 32 +#define IGB_DEFAULT_RX_PTHRESH 8 +#define IGB_DEFAULT_RX_HTHRESH 8 +#define IGB_DEFAULT_RX_WTHRESH 0 + +#define IGB_DEFAULT_TX_PTHRESH 32 +#define IGB_DEFAULT_TX_HTHRESH 0 +#define IGB_DEFAULT_TX_WTHRESH 0 + static int eth_igb_configure(struct rte_eth_dev *dev); static int eth_igb_start(struct rte_eth_dev *dev); static void eth_igb_stop(struct rte_eth_dev *dev); @@ -165,7 +177,6 @@ static int eth_igb_remove_5tuple_filter(struct rte_eth_dev *dev, static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, struct rte_5tuple_filter *filter, uint16_t *rx_queue); - /* * Define VF Stats MACRO for Non "cleared on read" register */ @@ -1331,6 +1342,25 @@ eth_igb_infos_get(struct rte_eth_dev *dev, dev_info->max_tx_queues = 0; dev_info->max_vmdq_pools = 0; } + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = IGB_DEFAULT_RX_PTHRESH, + .hthresh = IGB_DEFAULT_RX_HTHRESH, + .wthresh = IGB_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IGB_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = IGB_DEFAULT_TX_PTHRESH, + .hthresh = IGB_DEFAULT_TX_HTHRESH, + .wthresh = IGB_DEFAULT_TX_WTHRESH, + }, + .txq_flags = 0, + }; } /* return 0 means link status changed, -1 means not changed */ diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 9ed31b5..72faf95 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -58,6 +58,17 @@ #include "i40e_rxtx.h" #include "i40e_pf.h" +#define I40E_DEFAULT_RX_FREE_THRESH 32 +#define I40E_DEFAULT_RX_PTHRESH 8 +#define I40E_DEFAULT_RX_HTHRESH 8 +#define I40E_DEFAULT_RX_WTHRESH 0 + +#define I40E_DEFAULT_TX_FREE_THRESH 32 +#define I40E_DEFAULT_TX_PTHRESH 32 +#define I40E_DEFAULT_TX_HTHRESH 0 +#define I40E_DEFAULT_TX_WTHRESH 0 +#define I40E_DEFAULT_TX_RSBIT_THRESH 32 + /* Maximun number of MAC addresses */ #define I40E_NUM_MACADDR_MAX 64 #define I40E_CLEAR_PXE_WAIT_MS 200 @@ -1231,6 +1242,28 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM; + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = I40E_DEFAULT_RX_PTHRESH, + .hthresh = I40E_DEFAULT_RX_HTHRESH, + .wthresh = I40E_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = I40E_DEFAULT_TX_PTHRESH, + .hthresh = I40E_DEFAULT_TX_HTHRESH, + .wthresh = I40E_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; + } static int diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 59122a1..3b1c156 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -92,6 +92,20 @@ #define IXGBE_MMW_SIZE_DEFAULT 0x4 #define IXGBE_MMW_SIZE_JUMBO_FRAME 0x14 +/** + * Default values for RX/TX configuration + */ +#define IXGBE_DEFAULT_RX_FREE_THRESH 32 +#define IXGBE_DEFAULT_RX_PTHRESH 8 +#define IXGBE_DEFAULT_RX_HTHRESH 8 +#define IXGBE_DEFAULT_RX_WTHRESH 0 + +#define IXGBE_DEFAULT_TX_FREE_THRESH 32 +#define IXGBE_DEFAULT_TX_PTHRESH 32 +#define IXGBE_DEFAULT_TX_HTHRESH 0 +#define IXGBE_DEFAULT_TX_WTHRESH 0 +#define IXGBE_DEFAULT_TX_RSBIT_THRESH 32 + #define IXGBEVF_PMD_NAME "rte_ixgbevf_pmd" /* PMD name */ #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_stats->qprc[0])) @@ -1948,6 +1962,28 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM; + + dev_info->default_rxconf = (struct rte_eth_rxconf) { + .rx_thresh = { + .pthresh = IXGBE_DEFAULT_RX_PTHRESH, + .hthresh = IXGBE_DEFAULT_RX_HTHRESH, + .wthresh = IXGBE_DEFAULT_RX_WTHRESH, + }, + .rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH, + .rx_drop_en = 0, + }; + + + dev_info->default_txconf = (struct rte_eth_txconf) { + .tx_thresh = { + .pthresh = IXGBE_DEFAULT_TX_PTHRESH, + .hthresh = IXGBE_DEFAULT_TX_HTHRESH, + .wthresh = IXGBE_DEFAULT_TX_WTHRESH, + }, + .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, + .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, + .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, + }; } /* return 0 means link status changed, -1 means not changed */ -- 1.7.4.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration Pablo de Lara @ 2014-10-10 11:14 ` Thomas Monjalon 2014-10-10 12:05 ` De Lara Guarch, Pablo 0 siblings, 1 reply; 24+ messages in thread From: Thomas Monjalon @ 2014-10-10 11:14 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev Pablo, I have some minor nits on this patchset. If you agree, I can fix them before applying the patchset. 2014-10-01 10:49, Pablo de Lara: > +/** > + * Default values for port configuration > + */ > +#define IGB_DEFAULT_RX_FREE_THRESH 32 > +#define IGB_DEFAULT_RX_PTHRESH 8 > +#define IGB_DEFAULT_RX_HTHRESH 8 > +#define IGB_DEFAULT_RX_WTHRESH 0 > + > +#define IGB_DEFAULT_TX_PTHRESH 32 > +#define IGB_DEFAULT_TX_HTHRESH 0 > +#define IGB_DEFAULT_TX_WTHRESH 0 Comments in .c files are not for doxygen. So /** should be replaced by /* > static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, > uint16_t index, > struct rte_5tuple_filter *filter, uint16_t *rx_queue); > - > /* > * Define VF Stats MACRO for Non "cleared on read" register > */ This blank line shouldn't be removed. Probably a typo? -- Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration 2014-10-10 11:14 ` Thomas Monjalon @ 2014-10-10 12:05 ` De Lara Guarch, Pablo 0 siblings, 0 replies; 24+ messages in thread From: De Lara Guarch, Pablo @ 2014-10-10 12:05 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Friday, October 10, 2014 12:14 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to > include default RX/TX configuration > > Pablo, I have some minor nits on this patchset. > If you agree, I can fix them before applying the patchset. Sure, those changes seem reasonable. Many thanks, Pablo > > 2014-10-01 10:49, Pablo de Lara: > > +/** > > + * Default values for port configuration > > + */ > > +#define IGB_DEFAULT_RX_FREE_THRESH 32 > > +#define IGB_DEFAULT_RX_PTHRESH 8 > > +#define IGB_DEFAULT_RX_HTHRESH 8 > > +#define IGB_DEFAULT_RX_WTHRESH 0 > > + > > +#define IGB_DEFAULT_TX_PTHRESH 32 > > +#define IGB_DEFAULT_TX_HTHRESH 0 > > +#define IGB_DEFAULT_TX_WTHRESH 0 > > Comments in .c files are not for doxygen. So /** should be replaced by /* > > > static int eth_igb_get_5tuple_filter(struct rte_eth_dev *dev, > > uint16_t index, > > struct rte_5tuple_filter *filter, uint16_t *rx_queue); > > - > > /* > > * Define VF Stats MACRO for Non "cleared on read" register > > */ > > This blank line shouldn't be removed. Probably a typo? > > -- > Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
* [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration Pablo de Lara @ 2014-10-01 9:49 ` Pablo de Lara 2014-10-10 11:20 ` Thomas Monjalon 2014-10-01 9:54 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration De Lara Guarch, Pablo 3 siblings, 1 reply; 24+ messages in thread From: Pablo de Lara @ 2014-10-01 9:49 UTC (permalink / raw) To: dev For apps that were using default rte_eth_rxconf and rte_eth_txconf structures, these have been removed and now they are obtained by calling rte_eth_dev_info_get, just before setting up RX/TX queues. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- examples/dpdk_qat/main.c | 44 ++------------ examples/exception_path/main.c | 30 +--------- examples/ip_fragmentation/main.c | 47 +++------------ examples/ip_reassembly/main.c | 50 +++------------- examples/ipv4_multicast/main.c | 48 +++------------ examples/kni/main.c | 34 +---------- examples/l2fwd-ivshmem/host/host.c | 43 +------------ examples/l2fwd/main.c | 48 +-------------- examples/l3fwd-acl/main.c | 50 +++------------- examples/l3fwd-power/main.c | 51 +++------------- examples/l3fwd-vf/main.c | 36 +++-------- examples/l3fwd/main.c | 58 ++++--------------- examples/link_status_interrupt/main.c | 43 +------------ examples/load_balancer/init.c | 24 +------- .../client_server_mp/mp_server/init.c | 41 +------------ examples/multi_process/l2fwd_fork/main.c | 44 +------------- examples/multi_process/symmetric_mp/main.c | 36 +---------- examples/netmap_compat/bridge/bridge.c | 25 -------- examples/netmap_compat/lib/compat_netmap.c | 6 +- examples/netmap_compat/lib/compat_netmap.h | 2 - examples/qos_meter/main.c | 36 ++++-------- examples/quota_watermark/qw/init.c | 26 ++------- examples/vhost_xen/main.c | 34 ++--------- examples/vmdq/main.c | 62 +++----------------- examples/vmdq_dcb/main.c | 36 +---------- 25 files changed, 141 insertions(+), 813 deletions(-) diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index d61db4c..69b8e6a 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -75,25 +75,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF (32 * 1024) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -178,24 +159,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - static struct rte_mempool * pktmbuf_pool[RTE_MAX_NUMA_NODES]; struct lcore_conf { @@ -785,7 +748,8 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcoreid, queueid, socketid); fflush(stdout); ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, + NULL); if (ret < 0) rte_panic("rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -810,7 +774,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_panic("rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 0204116..8f89dc6 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -109,31 +109,6 @@ * controller's datasheet and supporting DPDK documentation for guidance * on how these parameters should be set. */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static const struct rte_eth_conf port_conf = { @@ -460,13 +435,14 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, rte_eth_dev_socket_id(port), - &rx_conf, pktmbuf_pool); + NULL, + pktmbuf_pool); if (ret < 0) FATAL_ERROR("Could not setup up RX queue for port%u (%d)", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, rte_eth_dev_socket_id(port), - &tx_conf); + NULL); if (ret < 0) FATAL_ERROR("Could not setup up TX queue for port%u (%d)", (unsigned)port, ret); diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 72cd2b2..4181125 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -106,25 +106,6 @@ #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -208,24 +189,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* * IPv4 forwarding table */ @@ -851,6 +814,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; struct rx_queue *rxq; int socket, ret; unsigned nb_ports; @@ -942,7 +907,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, socket_direct_pool[socket]); if (ret < 0) { printf("\n"); @@ -964,8 +929,12 @@ MAIN(int argc, char **argv) socket = (int) rte_lcore_to_socket_id(lcore_id); printf("txq=%u,%d ", lcore_id, queueid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socket, &tx_conf); + socket, txconf); if (ret < 0) { printf("\n"); rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: " diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 3bb6afd..9e3aa52 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -114,25 +114,6 @@ static uint32_t max_flow_num = DEF_FLOW_NUM; static uint32_t max_flow_ttl = DEF_FLOW_TTL; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -236,26 +217,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - /* * IPv4 forwarding table */ @@ -1058,6 +1019,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; struct rx_queue *rxq; int ret, socket; unsigned nb_ports; @@ -1149,7 +1112,7 @@ MAIN(int argc, char **argv) /* init one RX queue */ ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - socket, &rx_conf, + socket, NULL, rxq->pool); if (ret < 0) { printf("\n"); @@ -1172,8 +1135,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socket); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; + ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socket, &tx_conf); + socket, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index dfa0075..0f40d6c 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -92,25 +92,6 @@ /* allow max jumbo frame 9.5 KB */ #define JUMBO_FRAME_MAX_SIZE 0x2600 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -176,24 +157,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - static struct rte_mempool *packet_pool, *header_pool, *clone_pool; @@ -712,6 +675,8 @@ int MAIN(int argc, char **argv) { struct lcore_queue_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; uint16_t queueid; unsigned lcore_id = 0, rx_lcore_id = 0; @@ -810,7 +775,8 @@ MAIN(int argc, char **argv) printf("rxq=%hu ", queueid); fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, packet_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, port=%d\n", @@ -824,8 +790,12 @@ MAIN(int argc, char **argv) continue; printf("txq=%u,%hu ", lcore_id, queueid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - rte_lcore_to_socket_id(lcore_id), &tx_conf); + rte_lcore_to_socket_id(lcore_id), txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); diff --git a/examples/kni/main.c b/examples/kni/main.c index 7df1b36..6cfd8fe 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -125,36 +125,6 @@ struct kni_port_params { static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS]; -/* RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* RX ring configuration */ -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* Ring prefetch threshold */ - .hthresh = 8, /* Ring host threshold */ - .wthresh = 4, /* Ring writeback threshold */ - }, - .rx_free_thresh = 0, /* Immediately free RX descriptors */ -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -/* TX ring configuration */ -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* Ring prefetch threshold */ - .hthresh = 0, /* Ring host threshold */ - .wthresh = 0, /* Ring writeback threshold */ - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; /* Options for configuring ethernet port */ static struct rte_eth_conf port_conf = { @@ -631,13 +601,13 @@ init_port(uint8_t port) (unsigned)port, ret); ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, - rte_eth_dev_socket_id(port), &rx_conf, pktmbuf_pool); + rte_eth_dev_socket_id(port), NULL, pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up RX queue for " "port%u (%d)\n", (unsigned)port, ret); ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, - rte_eth_dev_socket_id(port), &tx_conf); + rte_eth_dev_socket_id(port), NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not setup up TX queue for " "port%u (%d)\n", (unsigned)port, ret); diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 02e65b9..706a7b3 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -63,25 +63,6 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ /* mask of enabled ports */ @@ -117,24 +98,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - #define METADATA_NAME "l2fwd_ivshmem" #define CMDLINE_OPT_FWD_CONF "fwd-conf" @@ -792,7 +755,8 @@ int main(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_ivshmem_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -801,7 +765,8 @@ int main(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 4069d7c..c6131a7 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -77,25 +77,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -147,29 +128,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - /* - * As the example won't handle mult-segments and offload cases, - * set the flag by default. - */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - struct rte_mempool * l2fwd_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -704,7 +662,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -713,7 +672,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 9b2c21b..b979379 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -100,25 +100,6 @@ nb_lcores * MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -207,26 +188,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ @@ -1973,6 +1934,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -2063,8 +2026,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " @@ -2098,7 +2066,7 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, + socketid, NULL, pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 57fc371..cbe9868 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -140,25 +140,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ #define NB_SOCKETS 8 @@ -255,26 +236,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = 0x0, -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -1513,6 +1474,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -1606,8 +1569,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " @@ -1655,7 +1623,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, " diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 2ca5c21..d1049ed 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -215,30 +215,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; @@ -979,6 +955,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -1055,8 +1033,13 @@ MAIN(int argc, char **argv) printf("txq=%d,%d,%d ", portid, 0, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -1086,7 +1069,8 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index bef409a..999c3e8 100755 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -137,25 +137,6 @@ nb_lcores*MEMPOOL_CACHE_SIZE), \ (unsigned)8192) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -259,31 +240,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_free_thresh = 32, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) - -}; - static struct rte_mempool * pktmbuf_pool[NB_SOCKETS]; #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) @@ -1974,7 +1930,6 @@ parse_args(int argc, char **argv) printf("jumbo frame is enabled - disabling simple TX path\n"); port_conf.rxmode.jumbo_frame = 1; - tx_conf.txq_flags = 0; /* if no max-pkt-len set, use the default value ETHER_MAX_LEN */ if (0 == getopt_long(argc, argvopt, "", &lenopts, &option_index)) { @@ -2448,6 +2403,8 @@ int MAIN(int argc, char **argv) { struct lcore_conf *qconf; + struct rte_eth_dev_info dev_info; + struct rte_eth_txconf *txconf; int ret; unsigned nb_ports; uint16_t queueid; @@ -2541,8 +2498,13 @@ MAIN(int argc, char **argv) printf("txq=%u,%d,%d ", lcore_id, queueid, socketid); fflush(stdout); + + rte_eth_dev_info_get(portid, &dev_info); + txconf = &dev_info.default_txconf; + if (port_conf.rxmode.jumbo_frame) + txconf->txq_flags = 0; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, - socketid, &tx_conf); + socketid, txconf); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, " "port=%d\n", ret, portid); @@ -2574,7 +2536,9 @@ MAIN(int argc, char **argv) fflush(stdout); ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd, - socketid, &rx_conf, pktmbuf_pool[socketid]); + socketid, + NULL, + pktmbuf_pool[socketid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d," "port=%d\n", ret, portid); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 1a87551..9dc0df8 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -78,25 +78,6 @@ #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -153,24 +134,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - struct rte_mempool * lsi_pktmbuf_pool = NULL; /* Per-port statistics struct */ @@ -754,7 +717,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, lsi_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup: err=%d, port=%u\n", @@ -763,7 +727,8 @@ MAIN(int argc, char **argv) /* init one TX queue logical core on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d,port=%u\n", ret, (unsigned) portid); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 2f00a70..448425b 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -95,26 +95,6 @@ static struct rte_eth_conf port_conf = { }, }; -static struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = APP_DEFAULT_NIC_RX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_RX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_RX_WTHRESH, - }, - .rx_free_thresh = APP_DEFAULT_NIC_RX_FREE_THRESH, - .rx_drop_en = APP_DEFAULT_NIC_RX_DROP_EN, -}; - -static struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = APP_DEFAULT_NIC_TX_PTHRESH, - .hthresh = APP_DEFAULT_NIC_TX_HTHRESH, - .wthresh = APP_DEFAULT_NIC_TX_WTHRESH, - }, - .tx_free_thresh = APP_DEFAULT_NIC_TX_FREE_THRESH, - .tx_rs_thresh = APP_DEFAULT_NIC_TX_RS_THRESH, -}; - static void app_assign_worker_ids(void) { @@ -495,7 +475,7 @@ app_init_nics(void) queue, (uint16_t) app.nic_rx_ring_size, socket, - &rx_conf, + NULL, pool); if (ret < 0) { rte_panic("Cannot init RX queue %u for port %u (%d)\n", @@ -516,7 +496,7 @@ app_init_nics(void) 0, (uint16_t) app.nic_tx_ring_size, socket, - &tx_conf); + NULL); if (ret < 0) { rte_panic("Cannot init TX queue 0 for port %d (%d)\n", port, diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index a84d1ee..5b3f06e 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -84,41 +84,6 @@ #define NO_FLAGS 0 -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define MP_DEFAULT_PTHRESH 36 -#define MP_DEFAULT_RX_HTHRESH 8 -#define MP_DEFAULT_TX_HTHRESH 0 -#define MP_DEFAULT_WTHRESH 0 - -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_RX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = MP_DEFAULT_PTHRESH, - .hthresh = MP_DEFAULT_TX_HTHRESH, - .wthresh = MP_DEFAULT_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* The mbuf pool for packet rx */ struct rte_mempool *pktmbuf_pool; @@ -184,13 +149,15 @@ init_port(uint8_t port_num) for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size, - rte_eth_dev_socket_id(port_num), &rx_conf_default, pktmbuf_pool); + rte_eth_dev_socket_id(port_num), + NULL, pktmbuf_pool); if (retval < 0) return retval; } for ( q = 0; q < tx_rings; q ++ ) { retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size, - rte_eth_dev_socket_id(port_num), &tx_conf_default); + rte_eth_dev_socket_id(port_num), + NULL); if (retval < 0) return retval; } diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 03fba55..5899875 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -96,25 +96,6 @@ enum l2fwd_cmd{ CMD_STOP, }; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -190,25 +171,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ - .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, -}; - static struct rte_mempool * l2fwd_pktmbuf_pool[RTE_MAX_ETHPORTS]; /* Per-port statistics struct */ @@ -1170,7 +1132,8 @@ MAIN(int argc, char **argv) /* init one RX queue */ fflush(stdout); ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, + rte_eth_dev_socket_id(portid), + NULL, l2fwd_pktmbuf_pool[portid]); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", @@ -1179,7 +1142,8 @@ MAIN(int argc, char **argv) /* init one TX queue on each port */ fflush(stdout); ret = rte_eth_tx_queue_setup(portid, 0, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index b8f31b3..638d167 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -89,36 +89,6 @@ #define PARAM_PROC_ID "proc-id" #define PARAM_NUM_PROCS "num-procs" -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* for each lcore, record the elements of the ports array to use */ struct lcore_ports{ unsigned start_port; @@ -277,7 +247,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -285,7 +256,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues) for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 898277e..f935b3b 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -67,29 +67,6 @@ struct rte_eth_conf eth_conf = { }, }; -struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = (ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOVLANOFFL | - ETH_TXQ_FLAGS_NOXSUMSCTP | - ETH_TXQ_FLAGS_NOXSUMUDP | - ETH_TXQ_FLAGS_NOXSUMTCP) -}; - -struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - #define MAX_QUEUE_NUM 1 #define RX_QUEUE_NUM 1 #define TX_QUEUE_NUM 1 @@ -103,8 +80,6 @@ struct rte_eth_rxconf rx_conf = { struct rte_netmap_port_conf port_conf = { .eth_conf = ð_conf, - .tx_conf = &tx_conf, - .rx_conf = &rx_conf, .socket_id = SOCKET_ID_ANY, .nr_tx_rings = TX_QUEUE_NUM, .nr_rx_rings = RX_QUEUE_NUM, diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c index 44b3f8e..2348366 100644 --- a/examples/netmap_compat/lib/compat_netmap.c +++ b/examples/netmap_compat/lib/compat_netmap.c @@ -713,7 +713,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) for (i = 0; i < conf->nr_tx_rings; i++) { ret = rte_eth_tx_queue_setup(portid, i, tx_slots, - conf->socket_id, conf->tx_conf); + conf->socket_id, NULL); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -724,7 +724,7 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) } ret = rte_eth_rx_queue_setup(portid, i, rx_slots, - conf->socket_id, conf->rx_conf, conf->pool); + conf->socket_id, NULL, conf->pool); if (ret < 0) { RTE_LOG(ERR, USER1, @@ -737,8 +737,6 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf) /* copy config to the private storage. */ ports[portid].eth_conf = conf->eth_conf[0]; - ports[portid].rx_conf = conf->rx_conf[0]; - ports[portid].tx_conf = conf->tx_conf[0]; ports[portid].pool = conf->pool; ports[portid].socket_id = conf->socket_id; ports[portid].nr_tx_rings = conf->nr_tx_rings; diff --git a/examples/netmap_compat/lib/compat_netmap.h b/examples/netmap_compat/lib/compat_netmap.h index f7f2276..f8a7812 100644 --- a/examples/netmap_compat/lib/compat_netmap.h +++ b/examples/netmap_compat/lib/compat_netmap.h @@ -56,8 +56,6 @@ struct rte_netmap_conf { struct rte_netmap_port_conf { struct rte_eth_conf *eth_conf; - struct rte_eth_txconf *tx_conf; - struct rte_eth_rxconf *rx_conf; struct rte_mempool *pool; int32_t socket_id; uint16_t nr_tx_rings; diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b4b8c4f..82a90ac 100755 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -102,26 +102,6 @@ static struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, /* RX prefetch threshold reg */ - .hthresh = 8, /* RX host threshold reg */ - .wthresh = 4, /* RX write-back threshold reg */ - }, - .rx_free_thresh = 32, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, /* TX prefetch threshold reg */ - .hthresh = 0, /* TX host threshold reg */ - .wthresh = 0, /* TX write-back threshold reg */ - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - .txq_flags = 0x0, -}; - #define NIC_RX_QUEUE_DESC 128 #define NIC_TX_QUEUE_DESC 512 @@ -394,11 +374,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_rx, ret); - ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret); - ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_rx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_rx), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret); @@ -406,11 +390,15 @@ MAIN(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_tx, ret); - ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &rx_conf, pool); + ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + NULL, pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret); - ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, rte_eth_dev_socket_id(port_tx), &tx_conf); + ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC, + rte_eth_dev_socket_id(port_tx), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_tx, ret); diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c index a7f8c85..5adb906 100644 --- a/examples/quota_watermark/qw/init.c +++ b/examples/quota_watermark/qw/init.c @@ -64,24 +64,6 @@ static const struct rte_eth_conf port_conf = { }, }; -static const struct rte_eth_rxconf rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -static const struct rte_eth_txconf tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, -}; - static struct rte_eth_fc_conf fc_conf = { .mode = RTE_FC_TX_PAUSE, .high_water = 80 * 510 / 100, @@ -104,15 +86,17 @@ void configure_eth_port(uint8_t port_id) /* Initialize the port's RX queue */ ret = rte_eth_rx_queue_setup(port_id, 0, RX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &rx_conf, - mbuf_pool); + rte_eth_dev_socket_id(port_id), + NULL, + mbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup RX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); /* Initialize the port's TX queue */ ret = rte_eth_tx_queue_setup(port_id, 0, TX_DESC_PER_QUEUE, - rte_eth_dev_socket_id(port_id), &tx_conf); + rte_eth_dev_socket_id(port_id), + NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "Failed to setup TX queue on " "port %u (error %d)\n", (unsigned) port_id, ret); diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index b275747..ec30947 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -135,31 +135,6 @@ static uint32_t enable_vm2vm = 1; /* Enable stats. */ static uint32_t enable_stats = 0; -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { .rxmode = { @@ -301,6 +276,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf *rxconf; struct rte_eth_conf port_conf; uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count(); const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT, tx_ring_size = RTE_TEST_TX_DESC_DEFAULT; @@ -331,17 +307,21 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_dev_info_get(port, &dev_info); + rxconf = &dev_info.default_rxconf; + rxconf->rx_drop_en = 1; /* Setup the queues. */ for (q = 0; q < rx_rings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rx_ring_size, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), rxconf, mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 35df234..7246663 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -81,25 +81,6 @@ #define MBUF_CACHE_SIZE 64 #define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ - #define MAX_PKT_BURST 32 /* @@ -117,37 +98,6 @@ static uint32_t enabled_port_mask = 0; static uint32_t num_queues = 8; static uint32_t num_pools = 8; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = RX_PTHRESH, - .hthresh = RX_HTHRESH, - .wthresh = RX_WTHRESH, - }, - .rx_drop_en = 1, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = TX_PTHRESH, - .hthresh = TX_HTHRESH, - .wthresh = TX_WTHRESH, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { .rxmode = { @@ -283,6 +233,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_dev_info dev_info; + struct rte_eth_rxconf *rxconf; struct rte_eth_conf port_conf; uint16_t rxRings, txRings = (uint16_t)rte_lcore_count(); const uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT, txRingSize = RTE_TEST_TX_DESC_DEFAULT; @@ -308,17 +259,22 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) if (retval != 0) return retval; + rte_eth_dev_info_get(port, &dev_info); + rxconf = &dev_info.default_rxconf; + rxconf->rx_drop_en = 1; for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, - mbuf_pool); + rte_eth_dev_socket_id(port), + rxconf, + mbuf_pool); if (retval < 0) return retval; } for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 2f708a1..20726e5 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -87,36 +87,6 @@ static uint32_t enabled_port_mask = 0; /* number of pools (if user does not specify any, 16 by default */ static enum rte_eth_nb_pools num_pools = ETH_16_POOLS; -/* - * RX and TX Prefetch, Host, and Write-back threshold values should be - * carefully set for optimal performance. Consult the network - * controller's datasheet and supporting DPDK documentation for guidance - * on how these parameters should be set. - */ -/* Default configuration for rx and tx thresholds etc. */ -static const struct rte_eth_rxconf rx_conf_default = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, -}; - -/* - * These default values are optimized for use with the Intel(R) 82599 10 GbE - * Controller and the DPDK ixgbe PMD. Consider using other values for other - * network controllers and/or network drivers. - */ -static const struct rte_eth_txconf tx_conf_default = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ -}; - /* empty vmdq+dcb configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_dcb_conf_default = { .rxmode = { @@ -212,7 +182,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < rxRings; q ++) { retval = rte_eth_rx_queue_setup(port, q, rxRingSize, - rte_eth_dev_socket_id(port), &rx_conf_default, + rte_eth_dev_socket_id(port), + NULL, mbuf_pool); if (retval < 0) return retval; @@ -220,7 +191,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) for (q = 0; q < txRings; q ++) { retval = rte_eth_tx_queue_setup(port, q, txRingSize, - rte_eth_dev_socket_id(port), &tx_conf_default); + rte_eth_dev_socket_id(port), + NULL); if (retval < 0) return retval; } -- 1.7.4.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara @ 2014-10-10 11:20 ` Thomas Monjalon 2014-10-10 12:07 ` De Lara Guarch, Pablo 0 siblings, 1 reply; 24+ messages in thread From: Thomas Monjalon @ 2014-10-10 11:20 UTC (permalink / raw) To: Pablo de Lara; +Cc: dev 2014-10-01 10:49, Pablo de Lara: > For apps that were using default rte_eth_rxconf and rte_eth_txconf > structures, these have been removed and now they are obtained by > calling rte_eth_dev_info_get, just before setting up RX/TX queues. If my understanding is correct, you are cleaning only examples whose you are sure we want default values or you know which parameter to tune. Right? I'd like to see another patch for testpmd and other tests/examples whose default values would be OK. Thanks -- Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps 2014-10-10 11:20 ` Thomas Monjalon @ 2014-10-10 12:07 ` De Lara Guarch, Pablo 0 siblings, 0 replies; 24+ messages in thread From: De Lara Guarch, Pablo @ 2014-10-10 12:07 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon > Sent: Friday, October 10, 2014 12:21 PM > To: De Lara Guarch, Pablo > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX > configuration got from dev info in apps > > 2014-10-01 10:49, Pablo de Lara: > > For apps that were using default rte_eth_rxconf and rte_eth_txconf > > structures, these have been removed and now they are obtained by > > calling rte_eth_dev_info_get, just before setting up RX/TX queues. > > If my understanding is correct, you are cleaning only examples whose > you are sure we want default values or you know which parameter to tune. > Right? > > I'd like to see another patch for testpmd and other tests/examples whose > default values would be OK. That's correct. I have only changed those sample apps that use default values or have very minor changes that I am aware of. Thanks, Pablo > > Thanks > -- > Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara ` (2 preceding siblings ...) 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara @ 2014-10-01 9:54 ` De Lara Guarch, Pablo 2014-10-02 10:18 ` David Marchand 3 siblings, 1 reply; 24+ messages in thread From: De Lara Guarch, Pablo @ 2014-10-01 9:54 UTC (permalink / raw) To: dev > -----Original Message----- > From: De Lara Guarch, Pablo > Sent: Wednesday, October 01, 2014 10:49 AM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo > Subject: [PATCH v3 0/3] Get default RX/TX configuration > > These patches modified the dev info structure to include optimal values > for the RX/TX configuration structures (rte_eth_rxconf and rte_eth_txconf), > so users can get these configurations and modify or use them directly, > to set up RX/TX queues. Besides, most of the apps that were modifying little > or none of the default values of the structures, have been modified to get > these values to simplify the code and avoid duplication. > > Pablo de Lara (3): > ether: Reset whole dev info structure > pmd: Modified dev_info structure to include default RX/TX > configuration > app: Used default RX/TX configuration got from dev info in apps Changes in V3: - Separated dev info reset in different patch - Deleted unnecessary local variables - Added extra documentation for RX/TX queue setup functions. > > examples/dpdk_qat/main.c | 44 ++------------ > examples/exception_path/main.c | 30 +--------- > examples/ip_fragmentation/main.c | 47 +++------------ > examples/ip_reassembly/main.c | 50 +++------------- > examples/ipv4_multicast/main.c | 48 +++------------ > examples/kni/main.c | 34 +---------- > examples/l2fwd-ivshmem/host/host.c | 43 +------------ > examples/l2fwd/main.c | 48 +-------------- > examples/l3fwd-acl/main.c | 50 +++------------- > examples/l3fwd-power/main.c | 51 +++------------- > examples/l3fwd-vf/main.c | 36 +++-------- > examples/l3fwd/main.c | 58 ++++--------------- > examples/link_status_interrupt/main.c | 43 +------------ > examples/load_balancer/init.c | 24 +------- > .../client_server_mp/mp_server/init.c | 41 +------------ > examples/multi_process/l2fwd_fork/main.c | 44 +------------- > examples/multi_process/symmetric_mp/main.c | 36 +---------- > examples/netmap_compat/bridge/bridge.c | 25 -------- > examples/netmap_compat/lib/compat_netmap.c | 6 +- > examples/netmap_compat/lib/compat_netmap.h | 2 - > examples/qos_meter/main.c | 36 ++++-------- > examples/quota_watermark/qw/init.c | 26 ++------- > examples/vhost_xen/main.c | 34 ++--------- > examples/vmdq/main.c | 62 +++----------------- > examples/vmdq_dcb/main.c | 36 +---------- > lib/librte_ether/rte_ethdev.c | 18 +++++- > lib/librte_ether/rte_ethdev.h | 6 ++ > lib/librte_pmd_e1000/igb_ethdev.c | 32 ++++++++++- > lib/librte_pmd_i40e/i40e_ethdev.c | 33 ++++++++++ > lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 36 +++++++++++ > 30 files changed, 261 insertions(+), 818 deletions(-) > > -- > 1.7.4.1 ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration 2014-10-01 9:54 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration De Lara Guarch, Pablo @ 2014-10-02 10:18 ` David Marchand 2014-10-10 12:48 ` Thomas Monjalon 0 siblings, 1 reply; 24+ messages in thread From: David Marchand @ 2014-10-02 10:18 UTC (permalink / raw) To: De Lara Guarch, Pablo; +Cc: dev On Wed, Oct 1, 2014 at 11:54 AM, De Lara Guarch, Pablo < pablo.de.lara.guarch@intel.com> wrote: > > > > -----Original Message----- > > From: De Lara Guarch, Pablo > > Sent: Wednesday, October 01, 2014 10:49 AM > > To: dev@dpdk.org > > Cc: De Lara Guarch, Pablo > > Subject: [PATCH v3 0/3] Get default RX/TX configuration > > > > These patches modified the dev info structure to include optimal values > > for the RX/TX configuration structures (rte_eth_rxconf and > rte_eth_txconf), > > so users can get these configurations and modify or use them directly, > > to set up RX/TX queues. Besides, most of the apps that were modifying > little > > or none of the default values of the structures, have been modified to > get > > these values to simplify the code and avoid duplication. > > > > Pablo de Lara (3): > > ether: Reset whole dev info structure > > pmd: Modified dev_info structure to include default RX/TX > > configuration > > app: Used default RX/TX configuration got from dev info in apps > > Changes in V3: > > - Separated dev info reset in different patch > - Deleted unnecessary local variables > - Added extra documentation for RX/TX queue setup functions. > > Series Acked-by: David Marchand <david.marchand@6wind.com> Thanks Pablo. -- David Marchand ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration 2014-10-02 10:18 ` David Marchand @ 2014-10-10 12:48 ` Thomas Monjalon 0 siblings, 0 replies; 24+ messages in thread From: Thomas Monjalon @ 2014-10-10 12:48 UTC (permalink / raw) To: De Lara Guarch, Pablo; +Cc: dev > > > These patches modified the dev info structure to include optimal values > > > for the RX/TX configuration structures (rte_eth_rxconf and > > rte_eth_txconf), > > > so users can get these configurations and modify or use them directly, > > > to set up RX/TX queues. Besides, most of the apps that were modifying > > little > > > or none of the default values of the structures, have been modified to > > get > > > these values to simplify the code and avoid duplication. > > Acked-by: David Marchand <david.marchand@6wind.com> Applied As previously said, more apps could benefit of these default values, starting with testpmd. Thanks -- Thomas ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2014-10-10 12:41 UTC | newest] Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-09-26 14:19 [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 1/2] pmd: Added rte_eth_rxconf_defaults and rte_eth_txconf defaults functions Pablo de Lara 2014-09-26 14:19 ` [dpdk-dev] [PATCH 2/2] app: Used rte_eth_rxconf_defaults and rte_eth_txconf_defaults in apps Pablo de Lara 2014-09-27 18:45 ` [dpdk-dev] [PATCH 0/2] Added functions to get RX/TX default configuration David Marchand [not found] ` <E115CCD9D858EF4F90C690B0DCB4D89722628264@IRSMSX108.ger.corp.intel.com> 2014-09-29 14:02 ` De Lara Guarch, Pablo 2014-09-29 14:40 ` David Marchand 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 0/2] Get default RX/TX configuration Pablo de Lara 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 1/2] pmd: Modified dev_info structure to include " Pablo de Lara 2014-10-01 8:38 ` Bruce Richardson 2014-10-01 8:42 ` Bruce Richardson 2014-10-01 8:45 ` David Marchand 2014-10-01 8:00 ` [dpdk-dev] [PATCH v2 2/2] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration Pablo de Lara 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 1/3] ether: Reset whole dev info structure Pablo de Lara 2014-10-10 11:08 ` Thomas Monjalon 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 2/3] pmd: Modified dev_info structure to include default RX/TX configuration Pablo de Lara 2014-10-10 11:14 ` Thomas Monjalon 2014-10-10 12:05 ` De Lara Guarch, Pablo 2014-10-01 9:49 ` [dpdk-dev] [PATCH v3 3/3] app: Used default RX/TX configuration got from dev info in apps Pablo de Lara 2014-10-10 11:20 ` Thomas Monjalon 2014-10-10 12:07 ` De Lara Guarch, Pablo 2014-10-01 9:54 ` [dpdk-dev] [PATCH v3 0/3] Get default RX/TX configuration De Lara Guarch, Pablo 2014-10-02 10:18 ` David Marchand 2014-10-10 12:48 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).