From patchwork Thu Jan 25 02:13:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hu, Jiayu" X-Patchwork-Id: 34428 X-Patchwork-Delegate: thomas@monjalon.net 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 D61E53195; Thu, 25 Jan 2018 03:10:04 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id E865F2951 for ; Thu, 25 Jan 2018 03:10:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 18:10:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,409,1511856000"; d="scan'208";a="12856900" Received: from dpdk15.sh.intel.com ([10.67.111.77]) by orsmga008.jf.intel.com with ESMTP; 24 Jan 2018 18:09:59 -0800 From: Jiayu Hu To: dev@dpdk.org Cc: shahafs@mellanox.com, wenzhuo.lu@intel.com, lei.a.yao@intel.com, Jiayu Hu Date: Thu, 25 Jan 2018 10:13:44 +0800 Message-Id: <1516846424-19929-1-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/testpmd: fix failing to enable SW checksum calculation 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" In current design, we can't enable SW checksum calculation for the devices which don't have checksum offloading abilities via the command "csum set ip|tcp|udp|sctp|outer-ip sw ". But SW checksum calculation shouldn't depend on HW offloading abilities. This patch is to fix this issue. Fixes: 3926dd2b6668 ("app/testpmd: enforce offload capabilities check") Signed-off-by: Jiayu Hu Reviewed-by: Shahaf Shuler --- app/test-pmd/cmdline.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 9f12c0f..a2db9b7 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3706,40 +3706,40 @@ cmd_csum_parsed(void *parsed_result, hw = 1; if (!strcmp(res->proto, "ip")) { - if (dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_IPV4_CKSUM) { + if (hw == 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM)) { csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else { printf("IP checksum offload is not supported " "by port %u\n", res->port_id); } } else if (!strcmp(res->proto, "udp")) { - if (dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_UDP_CKSUM) { + if (hw == 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM)) { csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else { printf("UDP checksum offload is not supported " "by port %u\n", res->port_id); } } else if (!strcmp(res->proto, "tcp")) { - if (dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_TCP_CKSUM) { + if (hw == 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM)) { csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else { printf("TCP checksum offload is not supported " "by port %u\n", res->port_id); } } else if (!strcmp(res->proto, "sctp")) { - if (dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_SCTP_CKSUM) { + if (hw == 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM)) { csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else { printf("SCTP checksum offload is not supported " "by port %u\n", res->port_id); } } else if (!strcmp(res->proto, "outer-ip")) { - if (dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + if (hw == 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) { csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } else {