From patchwork Mon Aug 17 10:45:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Zolotarov X-Patchwork-Id: 6764 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 191718DAD; Mon, 17 Aug 2015 12:46:01 +0200 (CEST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id AF94B8D4D for ; Mon, 17 Aug 2015 12:46:00 +0200 (CEST) Received: by wibhh20 with SMTP id hh20so77244114wib.0 for ; Mon, 17 Aug 2015 03:45:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DJjPwUhVZwO88AvbwjG2fAQ5MGBzjDrujU2Avjt4RSs=; b=DS0l3T7cxlyzTI/gtCt2oova+pRLnD0lZP7QmXfHiz09w3nB55RRI2OlNmfL6dh678 RB3stb9OhzzivkDUEN0VanIoANOXgOCPwDQ4hBoE3zxiLQyLPqew/2TnaD4lrJ4BIAQe stlM1noT0jY5HtMpoJfSptU86Kh7b/IiojU3FHjIZXdo4Yjew5Y6a7Ls5nZ03Z7IoI6t Ztl84iowSQgvI4x5TNn2tuK0hWUqp874wQ8Vb8eARUkCMEdibOusxAqWDqnFdPfA7chE yFKNydL3dpTr9XHWJHzTIuJ7d219lliKCWXu+Cj8jzIjY0gqRGF47Fg2pRwJrKd8i6UP r1Eg== X-Gm-Message-State: ALoCoQnZYv4m9WImKGcjnpo8GBUaXLxi2XdA2IzhEzGove29x2dp3/kWSkmjqxy0fU9j29aDZLJm X-Received: by 10.194.24.167 with SMTP id v7mr1502069wjf.37.1439808359501; Mon, 17 Aug 2015 03:45:59 -0700 (PDT) Received: from vladz-laptop.localdomain (bzq-109-64-112-195.red.bezeqint.net. [109.64.112.195]) by smtp.gmail.com with ESMTPSA id hn2sm21244298wjc.45.2015.08.17.03.45.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 03:45:58 -0700 (PDT) From: Vlad Zolotarov To: dev@dpdk.org Date: Mon, 17 Aug 2015 13:45:54 +0300 Message-Id: <1439808354-7269-1-git-send-email-vladz@cloudius-systems.com> X-Mailer: git-send-email 2.1.0 Subject: [dpdk-dev] [PATCH v2] ixgbe_pmd: forbid tx_rs_thresh above 1 for all NICs but 82598 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" According to 82599 and x540 HW specifications RS bit *must* be set in the last descriptor of *every* packet. This patch fixes the Tx hang we were constantly hitting with a seastar-based application on x540 NIC. Signed-off-by: Vlad Zolotarov --- New in v2: - ixgbevf: ixgbevf_dev_info_get(): return tx_rs_thresh=1 in default tx configuration for all devices since VFs are available only on devices newer than 82598. Signed-off-by: Vlad Zolotarov --- drivers/net/ixgbe/ixgbe_ethdev.c | 19 ++++++++++++++++++- drivers/net/ixgbe/ixgbe_rxtx.c | 23 ++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index b8ee1e9..fd9cb77 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2414,6 +2414,15 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, }; + + /* + * According to 82599 and x540 specifications RS bit *must* be set on the + * last descriptor of *every* packet. Therefore we will not allow the + * tx_rs_thresh above 1 for all NICs newer than 82598. + */ + if (hw->mac.type > ixgbe_mac_82598EB) + dev_info->default_txconf.tx_rs_thresh = 1; + dev_info->hash_key_size = IXGBE_HKEY_MAX_INDEX * sizeof(uint32_t); dev_info->reta_size = ETH_RSS_RETA_SIZE_128; dev_info->flow_type_rss_offloads = IXGBE_RSS_OFFLOAD_ALL; @@ -2463,7 +2472,15 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, .wthresh = IXGBE_DEFAULT_TX_WTHRESH, }, .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, - .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, + /* + * According to 82599 and x540 specifications RS bit *must* be + * set on the last descriptor of *every* packet. Therefore we + * will not allow the tx_rs_thresh above 1 for all NICs newer + * than 82598. Since VFs are available only on devices starting + * from 82599, tx_rs_thresh should be set to 1 for ALL VF + * devices. + */ + .tx_rs_thresh = 1, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS, }; diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 91023b9..8dbdffc 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2085,11 +2085,19 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq; struct ixgbe_hw *hw; uint16_t tx_rs_thresh, tx_free_thresh; + bool rs_deferring_allowed; PMD_INIT_FUNC_TRACE(); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); /* + * According to 82599 and x540 specifications RS bit *must* be set on the + * last descriptor of *every* packet. Therefore we will not allow the + * tx_rs_thresh above 1 for all NICs newer than 82598. + */ + rs_deferring_allowed = (hw->mac.type <= ixgbe_mac_82598EB); + + /* * Validate number of transmit descriptors. * It must not exceed hardware maximum, and must be multiple * of IXGBE_ALIGN. @@ -2110,6 +2118,8 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, * to transmit a packet is greater than the number of free TX * descriptors. * The following constraints must be satisfied: + * tx_rs_thresh must be less than 2 for NICs for which RS deferring is + * forbidden (all but 82598). * tx_rs_thresh must be greater than 0. * tx_rs_thresh must be less than the size of the ring minus 2. * tx_rs_thresh must be less than or equal to tx_free_thresh. @@ -2121,9 +2131,20 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, * When set to zero use default values. */ tx_rs_thresh = (uint16_t)((tx_conf->tx_rs_thresh) ? - tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH); + tx_conf->tx_rs_thresh : + (rs_deferring_allowed ? DEFAULT_TX_RS_THRESH : 1)); tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ? tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH); + + if (!rs_deferring_allowed && tx_rs_thresh > 1) { + PMD_INIT_LOG(ERR, "tx_rs_thresh must be less than 2 since RS " + "must be set for every packet for this HW. " + "(tx_rs_thresh=%u port=%d queue=%d)", + (unsigned int)tx_rs_thresh, + (int)dev->data->port_id, (int)queue_idx); + return -(EINVAL); + } + if (tx_rs_thresh >= (nb_desc - 2)) { PMD_INIT_LOG(ERR, "tx_rs_thresh must be less than the number " "of TX descriptors minus 2. (tx_rs_thresh=%u "