From patchwork Sat Oct 12 12:18:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Ting" X-Patchwork-Id: 61012 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 841461EB83; Sat, 12 Oct 2019 07:24:20 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5B2241EB82; Sat, 12 Oct 2019 07:24:17 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 22:24:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,286,1566889200"; d="scan'208";a="394654603" Received: from dpdk-xuting-main.sh.intel.com ([10.67.117.83]) by fmsmga005.fm.intel.com with ESMTP; 11 Oct 2019 22:24:14 -0700 From: Ting Xu To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, stable@dpdk.org Date: Sat, 12 Oct 2019 12:18:35 +0000 Message-Id: <22fa727a2ce09834133530c40cb02666e0be10ba.1570882485.git.ting.xu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v1] app/testpmd: fix CRC strip config error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixed the bug that an error appears when config rx_offload crc_strip using command "port config all crc-strip on|off". The reason is that this command was removed previously. However, the current command does not enable "crc_strip" option properly, so that testpmd returns error when config crc_strip. In this patch, an additional operation is added to recognize "crc_strip" option, since "crc_strip" and "keep_crc" are using the same flag "DEV_RX_OFFLOAD_KEEP_CRC". The current command is "port config rx_offload crc_strip on|off". Fixes: e5db17a1e54e ("app/testpmd: remove duplicated Rx offload commands") Cc: stable@dpdk.org Signed-off-by: Ting Xu --- app/test-pmd/cmdline.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index def471d97..31dbe4a07 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -18084,6 +18084,9 @@ search_rx_offload(const char *name) int found = 0; unsigned int bit; + if (!strcmp(name, "crc_strip")) + name = "keep_crc"; + single_offload = 1; for (bit = 0; bit < sizeof(single_offload) * CHAR_BIT; bit++) { single_name = rte_eth_dev_rx_offload_name(single_offload); @@ -18113,6 +18116,7 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result, uint16_t nb_rx_queues; int q; int ret; + int res_on_off = 1; if (port->port_status != RTE_PORT_STOPPED) { printf("Error: Can't config offload when Port %d " @@ -18131,7 +18135,11 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result, return; nb_rx_queues = dev_info.nb_rx_queues; - if (!strcmp(res->on_off, "on")) { + res_on_off = strcmp(res->on_off, "on"); + + if (!strcmp(res->offload, "crc_strip")) + res_on_off = ~res_on_off; + if (!res_on_off) { port->dev_conf.rxmode.offloads |= single_offload; for (q = 0; q < nb_rx_queues; q++) port->rx_conf[q].offloads |= single_offload;