From: Qi Zhang <qi.z.zhang@intel.com>
To: jingjing.wu@intel.com, helin.zhang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] net/i40e: enable VF untag drop
Date: Mon, 13 Mar 2017 00:55:42 -0400 [thread overview]
Message-ID: <20170313045543.65464-2-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20170313045543.65464-1-qi.z.zhang@intel.com>
Add a new private API to support the untag drop enable/disable
for specific VF.
Add a flag "untag_drop" in i40e_vsi to help track the untag drop
status, so it prevent error from i40e_aq_remove_vlan when call
rte_pmd_i40e_set_vf_vlan_untag_drop twice.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
V2:
- Add a flag "untag_drop" in i40e_vsi to track the untag drop status.
drivers/net/i40e/i40e_ethdev.c | 54 +++++++++++++++++++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.h | 1 +
drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++++++++
3 files changed, 73 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 303027b..304b02b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11212,3 +11212,57 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,
return 0;
}
+
+int rte_pmd_i40e_set_vf_vlan_untag_drop(uint8_t port,
+ uint16_t vf_id,
+ uint8_t on)
+{
+ struct rte_eth_dev *dev;
+ struct i40e_pf *pf;
+ struct i40e_vsi *vsi;
+ struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+ struct i40e_hw *hw;
+ int ret = 0;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+ dev = &rte_eth_devices[port];
+
+ if (!is_device_supported(dev, &rte_i40e_pmd))
+ return -ENOTSUP;
+
+ pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (vf_id >= pf->vf_num || !pf->vfs) {
+ PMD_DRV_LOG(ERR, "Invalid VF ID.");
+ return -EINVAL;
+ }
+
+ vsi = pf->vfs[vf_id].vsi;
+ if (!vsi) {
+ PMD_DRV_LOG(ERR, "Invalid VSI.");
+ return -EINVAL;
+ }
+
+
+ hw = I40E_VSI_TO_HW(vsi);
+ vlan_data.vlan_tag = 0;
+ vlan_data.vlan_flags = 0x1;
+
+ if (on && !vsi->untag_drop) {
+ ret = i40e_aq_add_vlan(hw, vsi->seid, &vlan_data, 1, NULL);
+ if (ret != I40E_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to add vlan filter");
+ else
+ vsi->untag_drop = 1;
+ } else if (!on && vsi->untag_drop) {
+ ret = i40e_aq_remove_vlan(hw, vsi->seid,
+ &vlan_data, 1, NULL);
+ if (ret != I40E_SUCCESS)
+ PMD_DRV_LOG(ERR, "Failed to remove vlan filter");
+ else
+ vsi->untag_drop = 0;
+ }
+
+ return ret;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index f545850..25d0c49 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -365,6 +365,7 @@ struct i40e_vsi {
uint8_t enabled_tc; /* The traffic class enabled */
uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */
struct i40e_bw_info bw_info; /* VSI bandwidth information */
+ uint8_t untag_drop; /* VLAN untagged drop enable/disable status */
};
struct pool_entry {
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index a0ad88c..895e2cc 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -332,4 +332,22 @@ int rte_pmd_i40e_get_vf_stats(uint8_t port,
int rte_pmd_i40e_reset_vf_stats(uint8_t port,
uint16_t vf_id);
+/**
+ * Enable/Disable VF untag drop
+ *
+ * @param port
+ * The port identifier of the Ethernet device.
+ * @param vf_id
+ * VF on witch to enable/disable
+ * @param on
+ * Enable or Disable
+ * @retura
+ * - (0) if successful.
+ * -(-ENODEVE) if *port* invalid
+ * -(-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_untag_drop(uint8_t port,
+ uint16_t vf_id,
+ uint8_t on);
+
#endif /* _PMD_I40E_H_ */
--
2.9.3
next prev parent reply other threads:[~2017-03-13 4:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 1:59 [dpdk-dev] [PATCH 0/2] " Qi Zhang
2017-03-03 1:59 ` [dpdk-dev] [PATCH 1/2] net/i40e: " Qi Zhang
2017-03-07 10:51 ` Ferruh Yigit
2017-03-09 3:24 ` Zhang, Qi Z
2017-03-14 13:29 ` Ferruh Yigit
2017-03-14 14:32 ` Zhang, Qi Z
2017-03-14 18:16 ` Iremonger, Bernard
2017-03-23 17:00 ` Ferruh Yigit
2017-03-23 17:22 ` Iremonger, Bernard
2017-03-03 1:59 ` [dpdk-dev] [PATCH 2/2] app/testpmd: enable VF untag drop in testpmd Qi Zhang
2017-03-07 11:13 ` Ferruh Yigit
2017-03-09 2:59 ` Zhang, Qi Z
2017-03-14 13:32 ` Ferruh Yigit
2017-03-14 14:43 ` Zhang, Qi Z
2017-03-13 4:55 ` [dpdk-dev] [PATCH v2 0/2] net/i40e: enable VF untag drop Qi Zhang
2017-03-13 4:55 ` Qi Zhang [this message]
2017-03-13 4:55 ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: enable VF untag drop in testpmd Qi Zhang
2017-03-23 17:01 ` 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=20170313045543.65464-2-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=dev@dpdk.org \
--cc=helin.zhang@intel.com \
--cc=jingjing.wu@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).