[dpdk-dev,14/18] fm10k: add function to set vlan

Message ID 1422594454-11045-15-git-send-email-jing.d.chen@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Chen, Jing D Jan. 30, 2015, 5:07 a.m. UTC
From: Jeff Shaw <jeffrey.b.shaw@intel.com>

Add fm10k_vlan_filter_set to set vlan.

Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
 lib/librte_pmd_fm10k/fm10k_ethdev.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
  

Patch

diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c b/lib/librte_pmd_fm10k/fm10k_ethdev.c
index b231c31..daa687e 100644
--- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
+++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
@@ -772,6 +772,19 @@  fm10k_dev_infos_get(struct rte_eth_dev *dev,
 
 }
 
+static int
+fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	PMD_FUNC_TRACE();
+
+	/* @todo - add support for the VF */
+	if (hw->mac.type != fm10k_mac_pf)
+		return -ENOTSUP;
+
+	return fm10k_update_vlan(hw, vlan_id, 0, on);
+}
+
 static inline int
 check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t request)
 {
@@ -1369,6 +1382,7 @@  static struct eth_dev_ops fm10k_eth_dev_ops = {
 	.stats_get               = fm10k_stats_get,
 	.stats_reset             = fm10k_stats_reset,
 	.dev_infos_get           = fm10k_dev_infos_get,
+	.vlan_filter_set         = fm10k_vlan_filter_set,
 	.rx_queue_start          = fm10k_dev_rx_queue_start,
 	.rx_queue_stop           = fm10k_dev_rx_queue_stop,
 	.tx_queue_start          = fm10k_dev_tx_queue_start,