From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1C311B567 for ; Fri, 20 Feb 2015 11:27:46 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 20 Feb 2015 02:20:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,614,1418112000"; d="scan'208";a="688325318" Received: from unknown (HELO Sent) ([10.217.248.178]) by orsmga002.jf.intel.com with SMTP; 20 Feb 2015 02:27:43 -0800 Received: by Sent (sSMTP sendmail emulation); Fri, 20 Feb 2015 11:27:21 +0200 From: Michal Jastrzebski To: dev@dpdk.org Date: Fri, 20 Feb 2015 11:26:12 +0100 Message-Id: <1424427972-6392-3-git-send-email-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1424427972-6392-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1422379175-10004-1-git-send-email-michalx.k.jastrzebski@intel.com> <1424427972-6392-1-git-send-email-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v3 2/2] testpmd: check return value of rte_eth_dev_vlan_filter() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2015 10:27:47 -0000 This patch modifies testpmd behavior when setting: rx_vlan add all vf_port (enabling all vlanids to be passed thru rx filter on VF). Rx_vlan_all_filter_set() function, checks if the next vlanid can be enabled by the driver. Number of vlanids is limited by the NIC and thus the NIC do not allow to enable more vlanids than it can allocate in VFTA table. Signed-off-by: Michal Jastrzebski --- app/test-pmd/config.c | 15 +++++++++------ app/test-pmd/testpmd.h | 2 +- lib/librte_ether/rte_ethdev.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 6bcd23c..4be3afa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1648,21 +1648,22 @@ rx_vlan_filter_set(portid_t port_id, int on) "diag=%d\n", port_id, on, diag); } -void +int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on) { int diag; if (port_id_is_invalid(port_id)) - return; + return 1; if (vlan_id_is_invalid(vlan_id)) - return; + return 1; diag = rte_eth_dev_vlan_filter(port_id, vlan_id, on); if (diag == 0) - return; + return 0; printf("rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed " "diag=%d\n", port_id, vlan_id, on, diag); + return -1; } void @@ -1672,8 +1673,10 @@ rx_vlan_all_filter_set(portid_t port_id, int on) if (port_id_is_invalid(port_id)) return; - for (vlan_id = 0; vlan_id < 4096; vlan_id++) - rx_vft_set(port_id, vlan_id, on); + for (vlan_id = 0; vlan_id < 4096; vlan_id++) { + if (rx_vft_set(port_id, vlan_id, on)) + break; + } } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 581130b..de87a08 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -499,7 +499,7 @@ void rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on); void rx_vlan_filter_set(portid_t port_id, int on); void rx_vlan_all_filter_set(portid_t port_id, int on); -void rx_vft_set(portid_t port_id, uint16_t vlan_id, int on); +int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on); void vlan_extend_set(portid_t port_id, int on); void vlan_tpid_set(portid_t port_id, uint16_t tp_id); void tx_vlan_set(portid_t port_id, uint16_t vlan_id); diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 17be2f3..4cf2121 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1524,8 +1524,8 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on) return (-EINVAL); } FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP); - (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on); - return (0); + + return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on); } int -- 1.7.9.5