From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Cc: jingjing.wu@intel.com, helin.zhang@intel.com
Subject: [dpdk-dev] [PATCH v3 16/17] net/i40e: use set switch aq instead of register setting
Date: Tue, 27 Jun 2017 21:29:17 +0800 [thread overview]
Message-ID: <1498570158-57201-17-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1498570158-57201-1-git-send-email-jingjing.wu@intel.com>
TPID can be set by set_switch_config aq, change the TPID setting
by set_switch_config on new FW release.
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 102 +++++++++++++++++++++++++----------------
1 file changed, 62 insertions(+), 40 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4ee1113..b1706a0 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2973,71 +2973,93 @@ i40e_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
}
static int
-i40e_vlan_tpid_set(struct rte_eth_dev *dev,
- enum rte_vlan_type vlan_type,
- uint16_t tpid)
+i40e_vlan_tpid_set_by_registers(struct rte_eth_dev *dev,
+ enum rte_vlan_type vlan_type,
+ uint16_t tpid, int qinq)
{
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint64_t reg_r = 0, reg_w = 0;
- uint16_t reg_id = 0;
- int ret = 0;
- int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend;
+ uint64_t reg_r = 0;
+ uint64_t reg_w = 0;
+ uint16_t reg_id = 3;
+ int ret;
- switch (vlan_type) {
- case ETH_VLAN_TYPE_OUTER:
- if (qinq)
+ if (qinq) {
+ if (vlan_type == ETH_VLAN_TYPE_OUTER)
reg_id = 2;
- else
- reg_id = 3;
- break;
- case ETH_VLAN_TYPE_INNER:
- if (qinq)
- reg_id = 3;
- else {
- ret = -EINVAL;
- PMD_DRV_LOG(ERR,
- "Unsupported vlan type in single vlan.");
- return ret;
- }
- break;
- default:
- ret = -EINVAL;
- PMD_DRV_LOG(ERR, "Unsupported vlan type %d", vlan_type);
- return ret;
}
+
ret = i40e_aq_debug_read_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id),
®_r, NULL);
if (ret != I40E_SUCCESS) {
PMD_DRV_LOG(ERR,
"Fail to debug read from I40E_GL_SWT_L2TAGCTRL[%d]",
reg_id);
- ret = -EIO;
- return ret;
+ return -EIO;
}
PMD_DRV_LOG(DEBUG,
- "Debug read from I40E_GL_SWT_L2TAGCTRL[%d]: 0x%08"PRIx64,
- reg_id, reg_r);
+ "Debug read from I40E_GL_SWT_L2TAGCTRL[%d]: 0x%08"PRIx64,
+ reg_id, reg_r);
reg_w = reg_r & (~(I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_MASK));
reg_w |= ((uint64_t)tpid << I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT);
if (reg_r == reg_w) {
- ret = 0;
PMD_DRV_LOG(DEBUG, "No need to write");
- return ret;
+ return 0;
}
ret = i40e_aq_debug_write_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id),
reg_w, NULL);
if (ret != I40E_SUCCESS) {
- ret = -EIO;
PMD_DRV_LOG(ERR,
- "Fail to debug write to I40E_GL_SWT_L2TAGCTRL[%d]",
- reg_id);
- return ret;
+ "Fail to debug write to I40E_GL_SWT_L2TAGCTRL[%d]",
+ reg_id);
+ return -EIO;
}
PMD_DRV_LOG(DEBUG,
- "Debug write 0x%08"PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]",
- reg_w, reg_id);
+ "Debug write 0x%08"PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]",
+ reg_w, reg_id);
+
+ return 0;
+}
+
+static int
+i40e_vlan_tpid_set(struct rte_eth_dev *dev,
+ enum rte_vlan_type vlan_type,
+ uint16_t tpid)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ int qinq = dev->data->dev_conf.rxmode.hw_vlan_extend;
+ int ret = 0;
+
+ if ((vlan_type != ETH_VLAN_TYPE_INNER &&
+ vlan_type != ETH_VLAN_TYPE_OUTER) ||
+ (!qinq && vlan_type == ETH_VLAN_TYPE_INNER)) {
+ PMD_DRV_LOG(ERR,
+ "Unsupported vlan type.");
+ return -EINVAL;
+ }
+ /* 802.1ad frames ability is added in NVM API 1.7*/
+ if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) {
+ if (qinq) {
+ if (vlan_type == ETH_VLAN_TYPE_OUTER)
+ hw->first_tag = rte_cpu_to_le_16(tpid);
+ else if (vlan_type == ETH_VLAN_TYPE_INNER)
+ hw->second_tag = rte_cpu_to_le_16(tpid);
+ } else {
+ if (vlan_type == ETH_VLAN_TYPE_OUTER)
+ hw->second_tag = rte_cpu_to_le_16(tpid);
+ }
+ ret = i40e_aq_set_switch_config(hw, 0, 0, NULL);
+ if (ret != I40E_SUCCESS) {
+ PMD_DRV_LOG(ERR,
+ "Set switch config failed aq_err: %d",
+ hw->aq.asq_last_status);
+ ret = -EIO;
+ }
+ } else
+ /* If NVM API < 1.7, keep the register setting */
+ ret = i40e_vlan_tpid_set_by_registers(dev, vlan_type,
+ tpid, qinq);
return ret;
}
@@ -3066,7 +3088,7 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
if (mask & ETH_VLAN_EXTEND_MASK) {
if (dev->data->dev_conf.rxmode.hw_vlan_extend) {
i40e_vsi_config_double_vlan(vsi, TRUE);
- /* Set global registers with default ether type value */
+ /* Set global registers with default ethertype. */
i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER,
ETHER_TYPE_VLAN);
i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_INNER,
--
2.4.11
next prev parent reply other threads:[~2017-06-27 13:34 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-27 3:47 [dpdk-dev] [PATCH 00/10] net/i40e: base code update Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 01/10] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 02/10] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 03/10] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 04/10] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 05/10] net/i40e/base: store the requested FEC information Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 06/10] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 07/10] net/i40e/base: report supported link modes Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 08/10] net/i40e/base: track id can be 0 Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 09/10] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-05-27 3:47 ` [dpdk-dev] [PATCH 10/10] net/i40e/base: update base code info Jingjing Wu
2017-05-30 11:10 ` [dpdk-dev] [PATCH 00/10] net/i40e: base code update Ferruh Yigit
2017-06-02 2:24 ` Wu, Jingjing
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 00/16] " Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 01/16] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 02/16] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 03/16] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 04/16] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 05/16] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 06/16] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 07/16] net/i40e/base: report supported link modes Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 08/16] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 09/16] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 10/16] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 11/16] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 12/16] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 13/16] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 14/16] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 15/16] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-26 13:18 ` Ferruh Yigit
2017-06-26 9:48 ` [dpdk-dev] [PATCH v2 16/16] net/i40e: use set switch aq instead of register setting Jingjing Wu
2017-06-26 13:20 ` Ferruh Yigit
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 00/17] net/i40e: base code update Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 01/17] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 02/17] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 03/17] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 04/17] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 05/17] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 06/17] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 07/17] net/i40e/base: report supported link modes Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 08/17] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 09/17] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 10/17] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 11/17] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 12/17] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 13/17] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 14/17] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 15/17] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-27 13:29 ` Jingjing Wu [this message]
2017-06-27 13:29 ` [dpdk-dev] [PATCH v3 17/17] net/i40e/base: update base code info Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 00/17] net/i40e: base code update Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 01/17] net/i40e/base: use new virtchnl header file Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 02/17] net/i40e/base: sync nvmupdate command and adminq subtask Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 03/17] net/i40e/base: add AQ command for read/write PHY registers Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 04/17] net/i40e/base: add support for Adaptive Virtual Function Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 05/17] net/i40e/base: store the requested FEC information Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 06/17] net/i40e/base: add new phy types for 25G AOC and ACC Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 07/17] net/i40e/base: report supported link modes Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 08/17] net/i40e/base: track id can be 0 Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 09/17] net/i40e/base: update FW AQ API version to 1.7 Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 10/17] net/i40e/base: add support for switch parameters Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 11/17] net/i40e/base: use admin queue for setting LEDs behavior Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 12/17] net/i40e/base: avoid potential null pointer dereference Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 13/17] net/i40e/base: avoid reset timeout issue Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 14/17] net/i40e/base: add EEPROM checksum verification Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 15/17] net/i40e/base: extend processing of DDP Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 16/17] net/i40e: use set switch aq instead of register setting Jingjing Wu
2017-06-27 14:00 ` [dpdk-dev] [PATCH v4 17/17] net/i40e/base: update base code info Jingjing Wu
2017-06-27 14:25 ` [dpdk-dev] [PATCH v4 00/17] net/i40e: base code update 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=1498570158-57201-17-git-send-email-jingjing.wu@intel.com \
--to=jingjing.wu@intel.com \
--cc=dev@dpdk.org \
--cc=helin.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).