DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] i40e: add required steps in TX queue enable, disable
Date: Wed,  2 Jul 2014 11:10:25 +0800	[thread overview]
Message-ID: <1404270625-2470-3-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1404270625-2470-1-git-send-email-helin.zhang@intel.com>

Hardware specification changed recently which requires to set
or clear TX queue disable flags before actually enabling or
disabling a specific TX queue. 'QTX_HEAD' register needs to
be cleared before setting the QENA_REQ flag.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
---
 lib/librte_pmd_i40e/i40e_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 6624586..9ed31b5 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -85,6 +85,8 @@
 #define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32 /* 32 us */
 #define I40E_QUEUE_ITR_INTERVAL_MAX     8160 /* 8160 us */
 
+#define I40E_PRE_TX_Q_CFG_WAIT_US       10 /* 10 us */
+
 #define I40E_RSS_OFFLOAD_ALL ( \
 	ETH_RSS_NONF_IPV4_UDP | \
 	ETH_RSS_NONF_IPV4_TCP | \
@@ -2780,6 +2782,13 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on)
 	uint32_t reg;
 	uint16_t j;
 
+	/**
+	 * Set or clear TX Queue Disable flags,
+	 * which is required by hardware.
+	 */
+	i40e_pre_tx_queue_cfg(hw, q_idx, on);
+	rte_delay_us(I40E_PRE_TX_Q_CFG_WAIT_US);
+
 	/* Wait until the request is finished */
 	for (j = 0; j < I40E_CHK_Q_ENA_COUNT; j++) {
 		rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
@@ -2793,6 +2802,8 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on)
 	if (on) {
 		if (reg & I40E_QTX_ENA_QENA_STAT_MASK)
 			return I40E_SUCCESS; /* already on, skip next steps */
+
+		I40E_WRITE_REG(hw, I40E_QTX_HEAD(q_idx), 0);
 		reg |= I40E_QTX_ENA_QENA_REQ_MASK;
 	} else {
 		if (!(reg & I40E_QTX_ENA_QENA_STAT_MASK))
@@ -2821,8 +2832,10 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on)
 			(on ? "enable" : "disable"), q_idx);
 		return I40E_ERR_TIMEOUT;
 	}
+
 	return I40E_SUCCESS;
 }
+
 /* Swith on or off the tx queues */
 static int
 i40e_vsi_switch_tx_queues(struct i40e_vsi *vsi, bool on)
-- 
1.8.1.4

  parent reply	other threads:[~2014-07-02  3:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02  3:10 [dpdk-dev] [PATCH 0/2] i40e improvements Helin Zhang
2014-07-02  3:10 ` [dpdk-dev] [PATCH 1/2] i40e: use i40e_clear_hw() to clear hardware before PF reset Helin Zhang
2014-07-02  3:10 ` Helin Zhang [this message]
2014-07-02  4:16 ` [dpdk-dev] [PATCH 0/2] i40e improvements Cao, Min
2014-07-02  8:56 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404270625-2470-3-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).