DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Jingjing Wu <jingjing.wu@intel.com>; Helin Zhang
	<helin.zhang@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-dev] [PATCH v4 16/29] net/i40e: set VF VLAN tag from PF
Date: Fri, 16 Dec 2016 14:39:06 +0000	[thread overview]
Message-ID: <20161216143919.4909-17-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20161216143919.4909-1-ferruh.yigit@intel.com>

From: Bernard Iremonger <bernard.iremonger@intel.com>

Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific
VF's VLAN tag.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c            | 59 +++++++++++++++++++++++++++++++
 drivers/net/i40e/rte_pmd_i40e.h           | 18 ++++++++++
 drivers/net/i40e/rte_pmd_i40e_version.map |  1 +
 3 files changed, 78 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a8361df..207a62e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 
 	return ret;
 }
+
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
+	struct i40e_pf *pf;
+	struct i40e_pf_vf *vf;
+	struct i40e_hw *hw;
+	struct i40e_vsi *vsi;
+	struct i40e_vsi_context ctxt;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	rte_eth_dev_info_get(port, &dev_info);
+
+	if (vf_id >= dev_info.max_vfs)
+		return -EINVAL;
+
+	if (on > 1)
+		return -EINVAL;
+
+	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	hw = I40E_PF_TO_HW(pf);
+
+	/**
+	 * return -ENODEV if SRIOV not enabled, VF number not configured
+	 * or no queue assigned.
+	 */
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+		return -ENODEV;
+
+	if (vf_id >= pf->vf_num)
+		return -EINVAL;
+
+	vf = &pf->vfs[vf_id];
+	vsi = vf->vsi;
+
+	vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
+	if (on) {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+	} else {
+		vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED;
+		vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED;
+	}
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	(void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
+	ctxt.seid = vsi->seid;
+
+	hw = I40E_VSI_TO_HW(vsi);
+	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
+	if (ret != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to update VSI params");
+
+	return ret;
+}
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 02f7109..b9bf8d1 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
 					uint8_t on);
 
+/**
+ * Enable/Disable vf vlan tag
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *    ID specifying VF.
+ * @param vlan_id
+ *    0 - Disable VF's vlan tag.
+ *    n - Enable VF's vlan tag.
+ *
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
+
 #endif /* _PMD_I40E_H_ */
diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map
index 76a3ef8..22e2716 100644
--- a/drivers/net/i40e/rte_pmd_i40e_version.map
+++ b/drivers/net/i40e/rte_pmd_i40e_version.map
@@ -16,5 +16,6 @@ DPDK_17.02 {
 	rte_pmd_i40e_set_vf_vlan_stripq;
 	rte_pmd_i40e_set_vf_vlan_insert;
 	rte_pmd_i40e_set_vf_broadcast;
+	rte_pmd_i40e_set_vf_vlan_tag;
 
 } DPDK_2.0;
-- 
2.9.3

  parent reply	other threads:[~2016-12-16 14:42 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 21:04 [dpdk-dev] [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 01/29] net/i40e: support link status notification Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 02/29] net/i40e: add callback to user on VF to PF mbox msg Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 03/29] net/i40e: set VF MAC anti-spoofing from PF Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 04/29] net/i40e: set VF VLAN " Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 05/29] net/i40e: set Tx loopback " Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 06/29] net/i40e: set VF unicast promisc mode " Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 07/29] net/i40e: set VF multicast " Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 08/29] net/i40e: enable VF MTU change Qi Zhang
2016-12-15 21:04 ` [dpdk-dev] [PATCH v3 09/29] net/i40e: fix VF reset flow Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 10/29] net/i40e: set VF MAC from PF support Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 11/29] net/i40e: set VF MAC from VF support Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 12/29] net/i40e: fix VF MAC address assignment Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 13/29] net/i40e: add VF VLAN strip func Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 14/29] net/i40e: add set VF VLAN insert function Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 15/29] net/i40e: set VF broadcast mode from PF Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 16/29] net/i40e: set VF VLAN tag " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 17/29] net/i40e: set VF VLAN filter " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 18/29] app/testpmd: use VFD APIs on i40e Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 19/29] app/testpmd: use unicast promiscuous mode " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 20/29] app/testpmd: use multicast " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 21/29] app/testpmd: add command to test VF broadcast " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 22/29] app/testpmd: add command to test VF VLAN tag " Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 23/29] app/testpmd: handle i40e in VF VLAN filter command Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 24/29] net/i40e: change version number to support Linux VF Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 25/29] net/i40e: return correct VSI id Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 26/29] net/i40e: parse more VF parameter and configure Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 27/29] net/i40e: support Linux VF to configure IRQ link list Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 28/29] net/i40e: enhance in sanity check of MAC Qi Zhang
2016-12-15 21:05 ` [dpdk-dev] [PATCH v3 29/29] net/i40e: set/clear VF stats from PF Qi Zhang
2016-12-16 14:28 ` [dpdk-dev] [PATCH v3 00/29] Support VFD and DPDK PF + kernel VF on i40e Ferruh Yigit
2016-12-16 14:38 ` [dpdk-dev] [PATCH v4 " Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 01/29] net/i40e: support link status notification Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 04/29] net/i40e: set VF VLAN " Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 05/29] net/i40e: set Tx loopback " Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 07/29] net/i40e: set VF multicast " Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 08/29] net/i40e: enable VF MTU change Ferruh Yigit
2016-12-16 14:38   ` [dpdk-dev] [PATCH v4 09/29] net/i40e: fix VF reset flow Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
2016-12-16 14:39   ` Ferruh Yigit [this message]
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 20/29] app/testpmd: use multicast " Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 25/29] net/i40e: return correct VSI id Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
2016-12-16 14:39   ` [dpdk-dev] [PATCH v4 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
2016-12-16 14:45   ` [dpdk-dev] [PATCH v4 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent Jardin
2016-12-16 19:02   ` [dpdk-dev] [PATCH v5 " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 01/29] net/i40e: support link status notification Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 02/29] net/i40e: add callback to user on VF to PF mbox msg Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 03/29] net/i40e: set VF MAC anti-spoofing from PF Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 04/29] net/i40e: set VF VLAN " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 05/29] net/i40e: set Tx loopback " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 06/29] net/i40e: set VF unicast promisc mode " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 07/29] net/i40e: set VF multicast " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 08/29] net/i40e: enable VF MTU change Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 09/29] net/i40e: fix VF reset flow Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 10/29] net/i40e: set VF MAC from PF support Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 11/29] net/i40e: set VF MAC from VF support Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 12/29] net/i40e: fix VF MAC address assignment Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 13/29] net/i40e: add VF VLAN strip func Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 14/29] net/i40e: add set VF VLAN insert function Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 15/29] net/i40e: set VF broadcast mode from PF Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 16/29] net/i40e: set VF VLAN tag " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 17/29] net/i40e: set VF VLAN filter " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e Ferruh Yigit
2016-12-16 20:30       ` Vincent JARDIN
2016-12-19 11:03         ` Ferruh Yigit
2016-12-20 15:19           ` Vincent JARDIN
2016-12-19 17:09       ` Ferruh Yigit
2016-12-20  1:05         ` Lu, Wenzhuo
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode " Ferruh Yigit
2016-12-16 20:28       ` Vincent JARDIN
2016-12-19 11:05         ` Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 20/29] app/testpmd: use multicast " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 21/29] app/testpmd: add command to test VF broadcast " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 22/29] app/testpmd: add command to test VF VLAN tag " Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command Ferruh Yigit
2016-12-16 20:31       ` Vincent JARDIN
2016-12-19 11:13         ` Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 24/29] net/i40e: change version number to support Linux VF Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 25/29] net/i40e: return correct VSI id Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 26/29] net/i40e: parse more VF parameter and configure Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 27/29] net/i40e: support Linux VF to configure IRQ link list Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 28/29] net/i40e: enhance in sanity check of MAC Ferruh Yigit
2016-12-16 19:02     ` [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PF Ferruh Yigit
2016-12-20 13:24       ` Ferruh Yigit
2016-12-20 13:40         ` Iremonger, Bernard
2016-12-21  0:56           ` Lu, Wenzhuo
2016-12-22 16:38             ` Iremonger, Bernard
2016-12-16 20:36     ` [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e Vincent JARDIN
2016-12-19  9:01       ` Chen, Jing D
2016-12-19 13:20         ` Thomas Monjalon
2016-12-19 13:39           ` Chen, Jing D
2016-12-19 13:45             ` Vincent JARDIN
2016-12-20  4:48               ` Chen, Jing D
2016-12-20 15:18                 ` Vincent JARDIN
2016-12-20 15:31                   ` Ferruh Yigit
2016-12-21  0:50                     ` Lu, Wenzhuo
2016-12-22  8:10                   ` Chen, Jing D
2016-12-22 13:46                     ` Vincent JARDIN
2016-12-26 11:59                       ` Chen, Jing D
2017-01-04 21:09                         ` Scott Daniels
2017-01-10 13:29                           ` Vincent JARDIN
2017-01-12  3:47                             ` Chen, Jing D
2017-01-13 23:04                               ` John Fastabend
2017-01-13 23:49                                 ` JOSHI, KAUSTUBH  (KAUSTUBH)
2017-01-15 23:32                                   ` Vincent JARDIN
2017-01-16 11:42                                   ` Ferruh Yigit
2017-01-16  9:32                                 ` 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=20161216143919.4909-17-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --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).