DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
To: dev@dpdk.org
Cc: shaopeng.he@intel.com
Subject: [dpdk-dev] [PATCH 4/6] fm10k: Fix issue that MAC addr can't be set to silicon
Date: Fri, 29 May 2015 16:10:42 +0800	[thread overview]
Message-ID: <1432887044-24777-5-git-send-email-jing.d.chen@intel.com> (raw)
In-Reply-To: <1432887044-24777-1-git-send-email-jing.d.chen@intel.com>

From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>

In fm10k, PF driver needs to communicate with switch through
mailbox if it needs to add/delete MAC address.
This fix will validate if switch is ready before going forward.
Then, it is necessary to acquire LPORT_MAP info after issuing
MAC addr request to switch.

Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 19e718b..dedfbb4 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -45,6 +45,10 @@
 #define FM10K_MBXLOCK_DELAY_US 20
 #define UINT64_LOWER_32BITS_MASK 0x00000000ffffffffULL
 
+/* Max try times to aquire switch status */
+#define MAX_QUERY_SWITCH_STATE_TIMES 10
+/* Wait interval to get switch status */
+#define WAIT_SWITCH_MSG_US    100000
 /* Number of chars per uint32 type */
 #define CHARS_PER_UINT32 (sizeof(uint32_t))
 #define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1)
@@ -1802,6 +1806,32 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
 		fm10k_dev_enable_intr_vf(dev);
 	}
 
+	/* Enable uio intr after callback registered */
+	rte_intr_enable(&(dev->pci_dev->intr_handle));
+
+	hw->mac.ops.update_int_moderator(hw);
+
+	/* Make sure Switch Manager is ready before going forward. */
+	if (hw->mac.type == fm10k_mac_pf) {
+		int switch_ready = 0;
+		int i;
+
+		for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) {
+			fm10k_mbx_lock(hw);
+			hw->mac.ops.get_host_state(hw, &switch_ready);
+			fm10k_mbx_unlock(hw);
+			if (switch_ready)
+				break;
+			/* Delay some time to acquire async LPORT_MAP info. */
+			rte_delay_us(WAIT_SWITCH_MSG_US);
+		}
+
+		if (switch_ready == 0) {
+			PMD_INIT_LOG(ERR, "switch is not ready");
+			return -1;
+		}
+	}
+
 	/*
 	 * Below function will trigger operations on mailbox, acquire lock to
 	 * avoid race condition from interrupt handler. Operations on mailbox
@@ -1811,7 +1841,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
 	 */
 	fm10k_mbx_lock(hw);
 	/* Enable port first */
-	hw->mac.ops.update_lport_state(hw, 0, 0, 1);
+	hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map, 1, 1);
 
 	/* Update default vlan */
 	hw->mac.ops.update_vlan(hw, hw->mac.default_vid, 0, true);
@@ -1831,8 +1861,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
 
 	fm10k_mbx_unlock(hw);
 
-	/* enable uio intr after callback registered */
-	rte_intr_enable(&(dev->pci_dev->intr_handle));
 
 	return 0;
 }
-- 
1.7.7.6

  parent reply	other threads:[~2015-05-29  8:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  8:10 [dpdk-dev] [PATCH 0/6] fm10k: A series of bug fixes Chen Jing D(Mark)
2015-05-29  8:10 ` [dpdk-dev] [PATCH 1/6] fm10k: Fix improper RX buffer size assignment Chen Jing D(Mark)
2015-06-16 11:55   ` Qiu, Michael
2015-05-29  8:10 ` [dpdk-dev] [PATCH 2/6] fm10k: Fix jumbo frame issue Chen Jing D(Mark)
2015-06-12  1:15   ` Qiu, Michael
2015-05-29  8:10 ` [dpdk-dev] [PATCH 3/6] fm10k: Fix data integrity issue with multi-segment frame Chen Jing D(Mark)
2015-06-16 12:07   ` Qiu, Michael
2015-05-29  8:10 ` Chen Jing D(Mark) [this message]
2015-06-09 16:23   ` [dpdk-dev] [PATCH 4/6] fm10k: Fix issue that MAC addr can't be set to silicon Qiu, Michael
2015-06-10  5:34     ` Chen, Jing D
2015-06-12  2:03   ` Qiu, Michael
2015-05-29  8:10 ` [dpdk-dev] [PATCH 5/6] fm10k: Do sanity check on mac address Chen Jing D(Mark)
2015-06-16 12:08   ` Qiu, Michael
2015-05-29  8:10 ` [dpdk-dev] [PATCH 6/6] fm10k: Add default mac/vlan filter to SM Chen Jing D(Mark)
2015-06-08  2:39 ` [dpdk-dev] [PATCH 0/6] fm10k: A series of bug fixes He, Shaopeng
2015-06-09 15:21 ` Qiu, Michael
2015-06-22 13:55   ` 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=1432887044-24777-5-git-send-email-jing.d.chen@intel.com \
    --to=jing.d.chen@intel.com \
    --cc=dev@dpdk.org \
    --cc=shaopeng.he@intel.com \
    /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).