DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] i40e: use i40e_clear_hw() to clear hardware before PF reset
Date: Wed,  2 Jul 2014 11:10:24 +0800
Message-ID: <1404270625-2470-2-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1404270625-2470-1-git-send-email-helin.zhang@intel.com>

i40e_clear_hw() was provided recently in shared code to clear
hardware, which can cover disabling all queues. The code
changes are to remove i40e_pf_disable_all_queues() and use
i40e_clear_hw() instead.

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 | 103 +-------------------------------------
 1 file changed, 2 insertions(+), 101 deletions(-)

diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 068b847..6624586 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -188,7 +188,6 @@ static struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf,
 						struct i40e_vsi *vsi);
 static int i40e_pf_config_mq_rx(struct i40e_pf *pf);
 static int i40e_vsi_config_double_vlan(struct i40e_vsi *vsi, int on);
-static int i40e_pf_disable_all_queues(struct i40e_hw *hw);
 static inline int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi,
 					     struct i40e_macvlan_filter *mv_f,
 					     int num,
@@ -373,12 +372,8 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 	hw->bus.device = pci_dev->addr.devid;
 	hw->bus.func = pci_dev->addr.function;
 
-	/* Disable all queues before PF reset, as required */
-	ret = i40e_pf_disable_all_queues(hw);
-	if (ret != I40E_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Failed to disable queues %u\n", ret);
-		return ret;
-	}
+	/* Make sure all is clean before doing PF reset */
+	i40e_clear_hw(hw);
 
 	/* Reset here to make sure all is clean for each PF */
 	ret = i40e_pf_reset(hw);
@@ -3948,97 +3943,3 @@ i40e_pf_config_mq_rx(struct i40e_pf *pf)
 
 	return 0;
 }
-
-static int
-i40e_disable_queue(struct i40e_hw *hw, uint16_t q_idx)
-{
-	uint16_t i;
-	uint32_t reg;
-
-	/* Disable TX queue */
-	for (i = 0; i < I40E_CHK_Q_ENA_COUNT; i++) {
-		reg = I40E_READ_REG(hw, I40E_QTX_ENA(q_idx));
-		if (!(((reg >> I40E_QTX_ENA_QENA_REQ_SHIFT) & 0x1) ^
-			((reg >> I40E_QTX_ENA_QENA_STAT_SHIFT) & 0x1)))
-			break;
-		rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
-	}
-	if (i >= I40E_CHK_Q_ENA_COUNT) {
-		PMD_DRV_LOG(ERR, "Failed to disable "
-			"tx queue[%u]\n", q_idx);
-		return I40E_ERR_TIMEOUT;
-	}
-
-	if (reg & I40E_QTX_ENA_QENA_STAT_MASK) {
-		reg &= ~I40E_QTX_ENA_QENA_REQ_MASK;
-		I40E_WRITE_REG(hw, I40E_QTX_ENA(q_idx), reg);
-		for (i = 0; i < I40E_CHK_Q_ENA_COUNT; i++) {
-			rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
-			reg = I40E_READ_REG(hw, I40E_QTX_ENA(q_idx));
-			if (!(reg & I40E_QTX_ENA_QENA_REQ_MASK) &&
-				!(reg & I40E_QTX_ENA_QENA_STAT_MASK))
-				break;
-		}
-		if (i >= I40E_CHK_Q_ENA_COUNT) {
-			PMD_DRV_LOG(ERR, "Failed to disable "
-				"tx queue[%u]\n", q_idx);
-			return I40E_ERR_TIMEOUT;
-		}
-	}
-
-	/* Disable RX queue */
-	for (i = 0; i < I40E_CHK_Q_ENA_COUNT; i++) {
-		reg = I40E_READ_REG(hw, I40E_QRX_ENA(q_idx));
-		if (!((reg >> I40E_QRX_ENA_QENA_REQ_SHIFT) & 0x1) ^
-			((reg >> I40E_QRX_ENA_QENA_STAT_SHIFT) & 0x1))
-			break;
-		rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
-	}
-	if (i >= I40E_CHK_Q_ENA_COUNT) {
-		PMD_DRV_LOG(ERR, "Failed to disable "
-			"rx queue[%u]\n", q_idx);
-		return I40E_ERR_TIMEOUT;
-	}
-
-	if (reg & I40E_QRX_ENA_QENA_STAT_MASK) {
-		reg &= ~I40E_QRX_ENA_QENA_REQ_MASK;
-		I40E_WRITE_REG(hw, I40E_QRX_ENA(q_idx), reg);
-		for (i = 0; i < I40E_CHK_Q_ENA_COUNT; i++) {
-			rte_delay_us(I40E_CHK_Q_ENA_INTERVAL_US);
-			reg = I40E_READ_REG(hw, I40E_QRX_ENA(q_idx));
-			if (!(reg & I40E_QRX_ENA_QENA_REQ_MASK) &&
-				!(reg & I40E_QRX_ENA_QENA_STAT_MASK))
-				break;
-		}
-		if (i >= I40E_CHK_Q_ENA_COUNT) {
-			PMD_DRV_LOG(ERR, "Failed to disable "
-				"rx queue[%u]\n", q_idx);
-			return I40E_ERR_TIMEOUT;
-		}
-	}
-
-	return I40E_SUCCESS;
-}
-
-static int
-i40e_pf_disable_all_queues(struct i40e_hw *hw)
-{
-	uint32_t reg;
-	uint16_t firstq, lastq, maxq, i;
-	int ret;
-	reg = I40E_READ_REG(hw, I40E_PFLAN_QALLOC);
-	if (!(reg & I40E_PFLAN_QALLOC_VALID_MASK)) {
-		PMD_DRV_LOG(INFO, "PF queue allocation is invalid\n");
-		return I40E_ERR_PARAM;
-	}
-	firstq = reg & I40E_PFLAN_QALLOC_FIRSTQ_MASK;
-	lastq = (reg & I40E_PFLAN_QALLOC_LASTQ_MASK) >>
-			I40E_PFLAN_QALLOC_LASTQ_SHIFT;
-	maxq = lastq - firstq;
-	for (i = 0; i <= maxq; i++) {
-		ret = i40e_disable_queue(hw, i);
-		if (ret != I40E_SUCCESS)
-			return ret;
-	}
-	return I40E_SUCCESS;
-}
-- 
1.8.1.4

  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 ` Helin Zhang [this message]
2014-07-02  3:10 ` [dpdk-dev] [PATCH 2/2] i40e: add required steps in TX queue enable, disable Helin Zhang
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-2-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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git