From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernard Iremonger Subject: [PATCH v5 1/3] librte_ether: add API for VF management Date: Thu, 29 Sep 2016 15:16:29 +0100 Message-ID: <1475158591-2243-2-git-send-email-bernard.iremonger@intel.com> References: <1474453204-31516-1-git-send-email-bernard.iremonger@intel.com> Cc: Bernard Iremonger , azelezniak To: dev@dpdk.org, rahul.r.shah@intel.com, wenzhuo.lu@intel.com, az5157@att.com Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6FA6A2C39 for ; Thu, 29 Sep 2016 16:16:43 +0200 (CEST) In-Reply-To: <1474453204-31516-1-git-send-email-bernard.iremonger@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add new API function to configure and manage VF's on a NIC. add rte_eth_dev_set_vf_vlan_stripq function. Signed-off-by: azelezniak Signed-off-by: Bernard Iremonger --- lib/librte_ether/rte_ethdev.c | 27 +++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 23 ++++++++++++++++++++++- lib/librte_ether/rte_ether_version.map | 6 ++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 382c959..15e21ca 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2489,6 +2489,33 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id, vf_mask, vlan_on); } +int +rte_eth_dev_set_vf_vlan_stripq(uint8_t port_id, uint16_t vf, int on) +{ + struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info; + uint16_t queues_per_pool; + uint32_t q; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + rte_eth_dev_info_get(port_id, &dev_info); + + if (vf >= dev_info.max_vfs) { + RTE_PMD_DEBUG_TRACE("set VF vlan stripq: invalid VF %d\n", vf); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP); + + queues_per_pool = dev_info.vmdq_queue_num/dev_info.max_vmdq_pools; + + for (q = 0; q < queues_per_pool; q++) + (*dev->dev_ops->vlan_strip_queue_set)(dev, q + vf * queues_per_pool, on); + return 0; +} + int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx, uint16_t tx_rate) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 96575e8..fb2be45 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3499,7 +3499,28 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, uint8_t vlan_on); /** - * Set a traffic mirroring rule on an Ethernet device + * Enable/Disable vf vlan strip for all queues in a pool + * + * @param port + * The port identifier of the Ethernet device. + * @param vf + * ID specifying VF. + * @param on + * 1 - Enable VF's vlan strip on RX queues. + * 0 - Disable VF's vlan strip on RX queues. + * @param queues_per_pool + * The number of queues per pool. + * + * @return + * - (0) if successful. + * - (-ENOTSUP) if hardware doesn't support this feature. + * - (-ENODEV) if *port* invalid. + * - (-EINVAL) if bad parameter. + */ +int +rte_eth_dev_set_vf_vlan_stripq(uint8_t port, uint16_t vf, int on); + +/** Set a traffic mirroring rule on an Ethernet device * * @param port_id * The port identifier of the Ethernet device. diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index 45ddf44..ae44074 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -139,3 +139,9 @@ DPDK_16.07 { rte_eth_dev_get_port_by_name; rte_eth_xstats_get_names; } DPDK_16.04; + +DPDK_16.11 { + global: + + rte_eth_dev_set_vf_vlan_stripq; +} DPDK_16.07; -- 2.9.0