[dpdk-dev,v5,13/17] fm10k: add function to set vlan

Message ID 1423815597-17819-14-git-send-email-jing.d.chen@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Chen, Jing D Feb. 13, 2015, 8:19 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 |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
  

Patch

diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c b/lib/librte_pmd_fm10k/fm10k_ethdev.c
index ead1585..e28a94c 100644
--- a/lib/librte_pmd_fm10k/fm10k_ethdev.c
+++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c
@@ -787,6 +787,20 @@  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_INIT_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)
 {
@@ -1389,6 +1403,7 @@  static struct eth_dev_ops fm10k_eth_dev_ops = {
 	.stats_reset		= fm10k_stats_reset,
 	.link_update		= fm10k_link_update,
 	.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,