From: Qi Zhang <qi.z.zhang@intel.com>
To: jing.d.chen@intel.com
Cc: helin.zhang@intel.com, dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v2 15/18] net/fm10k/base: improve re-map queues handle
Date: Wed, 8 Mar 2017 01:19:03 -0500 [thread overview]
Message-ID: <20170308061906.950-16-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20170308061906.950-1-qi.z.zhang@intel.com>
Avoid potential FUM fault errors on a VF when updating MAC address
and VLAN information. Only use the register flow when the mailbox is
disconnected, by checking if the enqueue_tx returns
FM10K_MBX_ERR_NO_MBX. If the mailbox message can be sent, there is no
reason to bother with the register writes which are only intended to
be used during VF driver initialization.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/fm10k/base/fm10k_common.c | 3 +++
drivers/net/fm10k/base/fm10k_pf.c | 42 ++++++++++++++++++++++++-----------
2 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_common.c b/drivers/net/fm10k/base/fm10k_common.c
index 7acc1ba..29f35d7 100644
--- a/drivers/net/fm10k/base/fm10k_common.c
+++ b/drivers/net/fm10k/base/fm10k_common.c
@@ -230,6 +230,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)
/* clear tx_ready to prevent any false hits for reset */
hw->mac.tx_ready = false;
+ if (FM10K_REMOVED(hw->hw_addr))
+ return FM10K_SUCCESS;
+
/* clear the enable bit for all rings */
for (i = 0; i < q_cnt; i++) {
reg = FM10K_READ_REG(hw, FM10K_TXDCTL(i));
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bce2913..5b1098e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -926,9 +926,35 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
fm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_DEFAULT_MAC,
vf_info->mac, vf_vid);
- /* load onto outgoing mailbox, ignore any errors on enqueue */
- if (vf_info->mbx.ops.enqueue_tx)
- vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+ /* Configure Queue control register with new VLAN ID. The TXQCTL
+ * register is RO from the VF, so the PF must do this even in the
+ * case of notifying the VF of a new VID via the mailbox.
+ */
+ txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
+ FM10K_TXQCTL_VID_MASK;
+ txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
+ FM10K_TXQCTL_VF | vf_idx;
+
+ for (i = 0; i < queues_per_pool; i++)
+ FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
+
+ /* try loading a message onto outgoing mailbox first */
+ if (vf_info->mbx.ops.enqueue_tx) {
+ err = vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+ if (err != FM10K_MBX_ERR_NO_MBX)
+ return err;
+ err = FM10K_SUCCESS;
+ }
+
+ /* If we aren't connected to a mailbox, this is most likely because
+ * the VF driver is not running. It should thus be safe to re-map
+ * queues and use the registers to pass the MAC address so that the VF
+ * driver gets correct information during its initialization.
+ */
+
+ /* MAP Tx queue back to 0 temporarily, and disable it */
+ FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
+ FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
/* verify ring has disabled before modifying base address registers */
txdctl = FM10K_READ_REG(hw, FM10K_TXDCTL(vf_q_idx));
@@ -967,16 +993,6 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
FM10K_TDLEN_ITR_SCALE_SHIFT);
err_out:
- /* configure Queue control register */
- txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
- FM10K_TXQCTL_VID_MASK;
- txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
- FM10K_TXQCTL_VF | vf_idx;
-
- /* assign VLAN ID */
- for (i = 0; i < queues_per_pool; i++)
- FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
-
/* restore the queue back to VF ownership */
FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
return err;
--
2.9.3
next prev parent reply other threads:[~2017-03-08 5:28 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport Qi Zhang
2017-03-05 11:41 ` Ferruh Yigit
2017-03-03 3:17 ` [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK Qi Zhang
2017-03-05 11:41 ` Ferruh Yigit
2017-03-03 3:17 ` [dpdk-dev] [PATCH 04/17] net/fm10k/base: add error code Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 05/17] net/fm10k/base: clean up the logic Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 06/17] net/fm10k/base: add new item to lport msg attr Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation Qi Zhang
2017-03-05 11:42 ` Ferruh Yigit
2017-03-03 3:17 ` [dpdk-dev] [PATCH 08/17] net/fm10k/base: use different name for override bit Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 09/17] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
2017-03-05 11:42 ` Ferruh Yigit
2017-03-03 3:17 ` [dpdk-dev] [PATCH 11/17] net/fm10k/base: enable lport map request Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 12/17] net/fm10k/base: add macros for global interrupt Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 13/17] net/fm10k/base: don't stop reset Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 14/17] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 15/17] net/fm10k/base: improve re-map queues handle Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 16/17] net/fm10k/base: replace macros Qi Zhang
2017-03-03 3:17 ` [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes Qi Zhang
2017-03-05 11:42 ` Ferruh Yigit
2017-03-05 11:41 ` [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Ferruh Yigit
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 02/18] net/fm10k/base: reset multicast mode when deleting lport Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 03/18] net/fm10k/base: expose macros needed by DPDK Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 04/18] net/fm10k/base: add error code Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 05/18] net/fm10k/base: clean up the logic Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 06/18] net/fm10k/base: add new item to lport msg attr Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 07/18] net/fm10k/base: update comment Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 08/18] net/fm10k/base: use different name for override bit Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 09/18] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 10/18] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
2017-03-08 6:18 ` [dpdk-dev] [PATCH v2 11/18] net/fm10k/base: enable lport map request Qi Zhang
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 12/18] net/fm10k/base: add macros for global interrupt Qi Zhang
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 13/18] net/fm10k/base: don't stop reset Qi Zhang
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 14/18] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
2017-03-08 6:19 ` Qi Zhang [this message]
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 16/18] net/fm10k/base: replace macros Qi Zhang
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 17/18] net/fm10k/base: request reset when mbx->state changes Qi Zhang
2017-03-08 6:19 ` [dpdk-dev] [PATCH v2 18/18] net/fm10k/base: add base driver information Qi Zhang
2017-03-09 11:13 ` [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code Ferruh Yigit
2017-03-10 3:11 ` Zhang, Qi Z
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=20170308061906.950-16-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=helin.zhang@intel.com \
--cc=jing.d.chen@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).