From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id DBC642BA1 for ; Mon, 11 Jul 2016 10:29:41 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 11 Jul 2016 01:29:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,345,1464678000"; d="scan'208";a="732446491" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 11 Jul 2016 01:29:25 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u6B8TN0R014440; Mon, 11 Jul 2016 16:29:23 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u6B8TJMR013500; Mon, 11 Jul 2016 16:29:21 +0800 Received: (from wenzhuol@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u6B8TJb1013496; Mon, 11 Jul 2016 16:29:19 +0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, pablo.de.lara.guarch@intel.com, Wenzhuo Lu Date: Mon, 11 Jul 2016 16:29:18 +0800 Message-Id: <1468225758-13466-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1468218079-8064-1-git-send-email-wenzhuo.lu@intel.com> References: <1468218079-8064-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v2] app/testpmd: bypass code cleanup 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: Mon, 11 Jul 2016 08:29:42 -0000 In testpmd code, device id is used directly to check if bypass is supported. But APP should not know the details of HW, the NIC specific info should not be exposed here. As every bypass API does know if it's supported, no need to check that at first. So, this patch removes the *bypass_is_supported*. Suggested-by: Jingjing Wu Signed-off-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b6b61ad..f90befc 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -94,10 +94,6 @@ static struct cmdline *testpmd_cl; static void cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue); -#ifdef RTE_NIC_BYPASS -uint8_t bypass_is_supported(portid_t port_id); -#endif - /* *** Help command with introduction. *** */ struct cmd_help_brief_result { cmdline_fixed_string_t help; @@ -3656,9 +3652,6 @@ cmd_set_bypass_mode_parsed(void *parsed_result, portid_t port_id = res->port_id; uint32_t bypass_mode = RTE_BYPASS_MODE_NORMAL; - if (!bypass_is_supported(port_id)) - return; - if (!strcmp(res->value, "bypass")) bypass_mode = RTE_BYPASS_MODE_BYPASS; else if (!strcmp(res->value, "isolate")) @@ -3725,9 +3718,6 @@ cmd_set_bypass_event_parsed(void *parsed_result, uint32_t bypass_event = RTE_BYPASS_EVENT_NONE; uint32_t bypass_mode = RTE_BYPASS_MODE_NORMAL; - if (!bypass_is_supported(port_id)) - return; - if (!strcmp(res->event_value, "timeout")) bypass_event = RTE_BYPASS_EVENT_TIMEOUT; else if (!strcmp(res->event_value, "os_on")) @@ -3903,9 +3893,6 @@ cmd_show_bypass_config_parsed(void *parsed_result, "timeout"}; int num_events = (sizeof events) / (sizeof events[0]); - if (!bypass_is_supported(port_id)) - return; - /* Display the bypass mode.*/ if (0 != rte_eth_dev_bypass_state_show(port_id, &bypass_mode)) { printf("\tFailed to get bypass mode for port = %d\n", port_id); @@ -10800,29 +10787,3 @@ cmd_reconfig_device_queue(portid_t id, uint8_t dev, uint8_t queue) ports[id].need_reconfig_queues = queue; } } - -#ifdef RTE_NIC_BYPASS -#include -uint8_t -bypass_is_supported(portid_t port_id) -{ - struct rte_port *port; - struct rte_pci_id *pci_id; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return 0; - - /* Get the device id. */ - port = &ports[port_id]; - pci_id = &port->dev_info.pci_dev->id; - - /* Check if NIC supports bypass. */ - if (pci_id->device_id == IXGBE_DEV_ID_82599_BYPASS) { - return 1; - } - else { - printf("\tBypass not supported for port_id = %d.\n", port_id); - return 0; - } -} -#endif -- 1.9.3