From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.oneaccess-net.com (mail2.belgium.oneaccess-net.com [91.183.184.101]) by dpdk.org (Postfix) with ESMTP id DBB28378B for ; Tue, 23 Aug 2016 11:10:56 +0200 (CEST) Received: from frederico-HP-8100.oneaccess.intra (10.0.21.149) by oab1mx2.oneaccess.intra (10.0.24.95) with Microsoft SMTP Server id 14.2.347.0; Tue, 23 Aug 2016 11:10:56 +0200 From: To: CC: , Frederico Cadete Date: Tue, 23 Aug 2016 11:10:45 +0200 Message-ID: <1471943445-20696-1-git-send-email-Frederico.Cadete-ext@oneaccess-net.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.21.149] Subject: [dpdk-dev] [PATCH] testpmd: fix fdir command on MAC and tunnel modes 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: Tue, 23 Aug 2016 09:10:57 -0000 From: Frederico Cadete The flow_director_filter commands has a pf|vf option for most modes except for MAC-VLAN and tunnel. On Intel NIC's these modes are not supported under virtualized environments. But the application was checking that this field was parsed for these cases, even though this token is not registered with the cmdline parser. This patch skips checking of this field for the commands that don't accept it. Signed-off-by: Frederico Cadete --- app/test-pmd/cmdline.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f90befc..f516b1b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8502,24 +8502,28 @@ cmd_flow_director_filter_parsed(void *parsed_result, else entry.action.behavior = RTE_ETH_FDIR_ACCEPT; - if (!strcmp(res->pf_vf, "pf")) - entry.input.flow_ext.is_vf = 0; - else if (!strncmp(res->pf_vf, "vf", 2)) { - struct rte_eth_dev_info dev_info; + if (fdir_conf.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN && + fdir_conf.mode != RTE_FDIR_MODE_PERFECT_TUNNEL){ - memset(&dev_info, 0, sizeof(dev_info)); - rte_eth_dev_info_get(res->port_id, &dev_info); - errno = 0; - vf_id = strtoul(res->pf_vf + 2, &end, 10); - if (errno != 0 || *end != '\0' || vf_id >= dev_info.max_vfs) { + if (!strcmp(res->pf_vf, "pf")) + entry.input.flow_ext.is_vf = 0; + else if (!strncmp(res->pf_vf, "vf", 2)) { + struct rte_eth_dev_info dev_info; + + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(res->port_id, &dev_info); + errno = 0; + vf_id = strtoul(res->pf_vf + 2, &end, 10); + if (errno != 0 || *end != '\0' || vf_id >= dev_info.max_vfs) { + printf("invalid parameter %s.\n", res->pf_vf); + return; + } + entry.input.flow_ext.is_vf = 1; + entry.input.flow_ext.dst_id = (uint16_t)vf_id; + } else { printf("invalid parameter %s.\n", res->pf_vf); return; } - entry.input.flow_ext.is_vf = 1; - entry.input.flow_ext.dst_id = (uint16_t)vf_id; - } else { - printf("invalid parameter %s.\n", res->pf_vf); - return; } /* set to report FD ID by default */ -- 2.7.4