From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3655A7DF0 for ; Fri, 26 Sep 2014 07:58:18 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Sep 2014 23:04:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,603,1406617200"; d="scan'208";a="579305160" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 25 Sep 2014 23:04:15 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s8Q64DdL029338; Fri, 26 Sep 2014 14:04:13 +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 s8Q64Bqk013018; Fri, 26 Sep 2014 14:04:13 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8Q64Bia013014; Fri, 26 Sep 2014 14:04:11 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Fri, 26 Sep 2014 14:03:32 +0800 Message-Id: <1411711418-12881-15-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> References: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v3 14/20] app/test-pmd: add test command to flush flow director table 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, 26 Sep 2014 05:58:19 -0000 add test command to flush flow director table Signed-off-by: Jingjing Wu Acked-by: Chen Jing D(Mark) Acked-by: Helin Zhang --- app/test-pmd/cmdline.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 173e863..240a464 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -682,6 +682,9 @@ static void cmd_help_long_parsed(void *parsed_result, " flexwords (flexwords_value) (drop|fwd)" " queue (queue_id) fd_id (fd_id_value)\n" " Add/Del a SCTP type flow director filter.\n\n" + + "flush_flow_diretor (port_id)\n" + " Flush all flow director entries of a device.\n\n" ); } } @@ -7855,6 +7858,51 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = { }, }; +struct cmd_flush_flow_director_result { + cmdline_fixed_string_t flush_flow_director; + uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_flush_flow_director_flush = + TOKEN_STRING_INITIALIZER(struct cmd_flush_flow_director_result, + flush_flow_director, "flush_flow_director"); +cmdline_parse_token_num_t cmd_flush_flow_director_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_flush_flow_director_result, + port_id, UINT8); + +static void +cmd_flush_flow_director_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_flow_director_result *res = parsed_result; + int ret = 0; + + ret = rte_eth_dev_filter_supported(res->port_id, RTE_ETH_FILTER_FDIR); + if (ret < 0) { + printf("flow director is not supported on port %u.\n", + res->port_id); + return; + } + + ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_FDIR, + RTE_ETH_FILTER_OP_FLUSH, NULL); + if (ret < 0) + printf("flow director table flushing error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_flush_flow_director = { + .f = cmd_flush_flow_director_parsed, + .data = NULL, + .help_str = "flush all flow director entries of a device on NIC", + .tokens = { + (void *)&cmd_flush_flow_director_flush, + (void *)&cmd_flush_flow_director_port_id, + NULL, + }, +}; + /* ******************************************************************************** */ /* list of instructions */ @@ -7984,6 +8032,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_add_del_ip_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director, (cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director, + (cmdline_parse_inst_t *)&cmd_flush_flow_director, NULL, }; -- 1.8.1.4