DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiao Wang <xiao.w.wang@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, john.mcnamara@intel.com, qi.z.zhang@intel.com,
	Xiao Wang <xiao.w.wang@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/4] net/fm10k: support switch restart on PF
Date: Tue, 24 Oct 2017 06:45:50 -0700	[thread overview]
Message-ID: <1508852752-127925-3-git-send-email-xiao.w.wang@intel.com> (raw)
In-Reply-To: <1508852752-127925-1-git-send-email-xiao.w.wang@intel.com>

For events indicating the change in the state of the switch manager. The
driver will restore the basic port configurations and then pass this event
to application so that the application can restore any additional
configurations if required. In this way, once the switch manager restarts,
the DPDK application can resume its network.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
v2:
- Fix line over 90 characters.
---
 drivers/net/fm10k/fm10k_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 2587696..c71c0fc 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2556,6 +2556,10 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev,
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t cause, status;
+	struct fm10k_dev_info *dev_info =
+		FM10K_DEV_PRIVATE_TO_INFO(dev->data->dev_private);
+	int status_mbx;
+	s32 err;
 
 	if (hw->mac.type != fm10k_mac_pf)
 		return;
@@ -2572,14 +2576,60 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev,
 	if (cause & FM10K_EICR_SWITCHNOTREADY)
 		PMD_INIT_LOG(ERR, "INT: Switch is not ready");
 
-	if (cause & FM10K_EICR_SWITCHREADY)
+	if (cause & FM10K_EICR_SWITCHREADY) {
 		PMD_INIT_LOG(INFO, "INT: Switch is ready");
+		if (dev_info->sm_down == 1) {
+			fm10k_mbx_lock(hw);
+
+			/* For recreating logical ports */
+			status_mbx = hw->mac.ops.update_lport_state(hw,
+					hw->mac.dglort_map, MAX_LPORT_NUM, 1);
+			if (status_mbx == FM10K_SUCCESS)
+				PMD_INIT_LOG(INFO, "INT: Recreated Logical port");
+			else
+				PMD_INIT_LOG(INFO, "INT: Logical ports weren't recreated");
+
+			status_mbx = hw->mac.ops.update_xcast_mode(hw,
+					hw->mac.dglort_map, FM10K_XCAST_MODE_NONE);
+			if (status_mbx != FM10K_SUCCESS)
+				PMD_INIT_LOG(ERR, "Failed to set XCAST mode");
+
+			fm10k_mbx_unlock(hw);
+
+			/* first clear the internal SW recording structure */
+			if (!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG))
+				fm10k_vlan_filter_set(dev, hw->mac.default_vid, false);
+
+			fm10k_MAC_filter_set(dev, hw->mac.addr, false,
+					MAIN_VSI_POOL_NUMBER);
+
+			/* Add default mac address and vlan for the logical ports that
+			 * have been created, leave to the application to fully recover
+			 * Rx filtering.
+			 */
+			fm10k_MAC_filter_set(dev, hw->mac.addr, true,
+					MAIN_VSI_POOL_NUMBER);
+
+			if (!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_VMDQ_FLAG))
+				fm10k_vlan_filter_set(dev, hw->mac.default_vid, true);
+
+			dev_info->sm_down = 0;
+			_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
+					NULL, NULL);
+		}
+	}
 
 	/* Handle mailbox message */
 	fm10k_mbx_lock(hw);
-	hw->mbx.ops.process(hw, &hw->mbx);
+	err = hw->mbx.ops.process(hw, &hw->mbx);
 	fm10k_mbx_unlock(hw);
 
+	if (err == FM10K_ERR_RESET_REQUESTED) {
+		PMD_INIT_LOG(INFO, "INT: Switch is down");
+		dev_info->sm_down = 1;
+		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL, NULL);
+	}
+
 	/* Handle SRAM error */
 	if (cause & FM10K_EICR_SRAMERROR) {
 		PMD_INIT_LOG(ERR, "INT: SRAM error on PEP");
-- 
1.8.3.1

  parent reply	other threads:[~2017-10-24  5:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 21:37 [dpdk-dev] [PATCH 0/4] net/fm10k: support switch restart Xiao Wang
2017-10-22 21:37 ` [dpdk-dev] [PATCH 1/4] net/fm10k: redefine link status semantics Xiao Wang
2017-10-22 21:37 ` [dpdk-dev] [PATCH 2/4] net/fm10k: support switch restart on PF Xiao Wang
2017-10-22 21:37 ` [dpdk-dev] [PATCH 3/4] net/fm10k: support switch restart on VF Xiao Wang
2017-10-22 21:37 ` [dpdk-dev] [PATCH 4/4] doc: add switch restart support to fm10k guide Xiao Wang
2017-10-23 13:06   ` Mcnamara, John
2017-10-24  1:31     ` Wang, Xiao W
2017-10-24 13:45   ` [dpdk-dev] [PATCH v2 0/4] net/fm10k: support switch restart Xiao Wang
2017-10-24 13:45     ` [dpdk-dev] [PATCH v2 1/4] net/fm10k: redefine link status semantics Xiao Wang
2017-10-24 13:45     ` Xiao Wang [this message]
2017-10-24 13:45     ` [dpdk-dev] [PATCH v2 3/4] net/fm10k: support switch restart on VF Xiao Wang
2017-10-24 13:45     ` [dpdk-dev] [PATCH v2 4/4] doc: add switch restart support to fm10k guide Xiao Wang
2017-10-24 10:56       ` Mcnamara, John
2017-10-24 19:29     ` [dpdk-dev] [PATCH v2 0/4] net/fm10k: support switch restart Ferruh Yigit
2017-10-24 19:37       ` Ferruh Yigit

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=1508852752-127925-3-git-send-email-xiao.w.wang@intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=qi.z.zhang@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).