DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ouyang Changchun <changchun.ouyang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 15/18] ixgbe: New function for resetting VF register
Date: Thu, 25 Sep 2014 22:19:01 +0800	[thread overview]
Message-ID: <1411654744-9460-16-git-send-email-changchun.ouyang@intel.com> (raw)
In-Reply-To: <1411654744-9460-1-git-send-email-changchun.ouyang@intel.com>

This patch implements a function to reset VF register to initial 
values in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
index a2d6e61..e6b6c51 100644
--- a/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
+++ b/lib/librte_pmd_ixgbe/ixgbe/ixgbe_vf.c
@@ -89,6 +89,49 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	return IXGBE_SUCCESS;
 }
 
+/* ixgbe_virt_clr_reg - Set register to default (power on) state.
+ *  @hw: pointer to hardware structure
+ */
+static void ixgbe_virt_clr_reg(struct ixgbe_hw *hw)
+{
+	int i;
+	u32 vfsrrctl;
+	u32 vfdca_rxctrl;
+	u32 vfdca_txctrl;
+
+	/* VRSRRCTL default values (BSIZEPACKET = 2048, BSIZEHEADER = 256) */
+	vfsrrctl = 0x100 << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT;
+	vfsrrctl |= 0x800 >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
+
+	/* DCA_RXCTRL default value */
+	vfdca_rxctrl = IXGBE_DCA_RXCTRL_DESC_RRO_EN |
+		       IXGBE_DCA_RXCTRL_DATA_WRO_EN |
+		       IXGBE_DCA_RXCTRL_HEAD_WRO_EN;
+
+	/* DCA_TXCTRL default value */
+	vfdca_txctrl = IXGBE_DCA_TXCTRL_DESC_RRO_EN |
+		       IXGBE_DCA_TXCTRL_DESC_WRO_EN |
+		       IXGBE_DCA_TXCTRL_DATA_RRO_EN;
+
+	IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0);
+
+	for (i = 0; i < 7; i++) {
+		IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFSRRCTL(i), vfsrrctl);
+		IXGBE_WRITE_REG(hw, IXGBE_VFTDH(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFTDT(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFTXDCTL(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAH(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFTDWBAL(i), 0);
+		IXGBE_WRITE_REG(hw, IXGBE_VFDCA_RXCTRL(i), vfdca_rxctrl);
+		IXGBE_WRITE_REG(hw, IXGBE_VFDCA_TXCTRL(i), vfdca_txctrl);
+	}
+
+	IXGBE_WRITE_FLUSH(hw);
+}
+
 /**
  *  ixgbe_start_hw_vf - Prepare hardware for Tx/Rx
  *  @hw: pointer to hardware structure
@@ -161,6 +204,9 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw)
 	if (!timeout)
 		return IXGBE_ERR_RESET_FAILED;
 
+	/* Reset VF registers to initial values */
+	ixgbe_virt_clr_reg(hw);
+
 	/* mailbox timeout can now become active */
 	mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;
 
-- 
1.8.4.2

  parent reply	other threads:[~2014-09-25 14:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 14:18 [dpdk-dev] [PATCH 00/18] Update IXGBE base code Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 01/18] ixgbe: Update comments and fix some comments typo in " Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 02/18] ixgbe: Clean up IXGBE base codes Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 03/18] ixgbe: New function to check command complete in IXGBE base code Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 04/18] ixgbe: Support cloud mode " Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 05/18] ixgbe: eeprom checksum calculation return new value " Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 06/18] ixgbe: New argument in host interface command function Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 07/18] ixgbe: Extend mask for SWFW semaphore Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 08/18] ixgbe: New function to read and write I2C bytes Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 09/18] ixgbe: Support new device id 82599_QSFP and 82599_LS Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 10/18] ixgbe: Modify time to wait in polling flash update Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 11/18] ixgbe: New error type Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 12/18] ixgbe: Use hardware MAC type for I2C control Ouyang Changchun
2014-09-25 14:18 ` [dpdk-dev] [PATCH 13/18] ixgbe: semaphore mask move into hardware physical information Ouyang Changchun
2014-09-25 14:19 ` [dpdk-dev] [PATCH 14/18] ixgbe: Remove unnecessary delay Ouyang Changchun
2014-09-25 14:19 ` Ouyang Changchun [this message]
2014-09-25 14:19 ` [dpdk-dev] [PATCH 16/18] ixgbe: New functionalities in IXGBE base code Ouyang Changchun
2014-09-25 14:19 ` [dpdk-dev] [PATCH 17/18] ixgbe: Support X550 " Ouyang Changchun
2014-09-25 14:19 ` [dpdk-dev] [PATCH 18/18] ixgbe: Support X550 in IXGBE poll mode driver Ouyang Changchun

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=1411654744-9460-16-git-send-email-changchun.ouyang@intel.com \
    --to=changchun.ouyang@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).