From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f173.google.com (mail-we0-f173.google.com [74.125.82.173]) by dpdk.org (Postfix) with ESMTP id 60ABF5AAE for ; Thu, 22 Jan 2015 00:36:55 +0100 (CET) Received: by mail-we0-f173.google.com with SMTP id w62so5532359wes.4 for ; Wed, 21 Jan 2015 15:36:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JjuYZ47iNmKm8NYS6PxaPModcNp6KBzSt2SLR1YajJU=; b=DY16RUvwxfSIVGV0YsLhqzZ8avafU2vD1D0ruSZGrs5ISixpKpIKBtGDulxeDL6MtG II0PfsNkZ5MHh1XWMZ9k/0ywAs6Xalz4PKVNH1+6oPQlNvYrfLyhmbybgrQZhfsIVFRK ftkvgeGMrPL/BXHCRxxP/cmnysejv7TT7Q/UxvVBYZPUPqoeCoK8XVA/9uLR3XBTTPNV IyEBIlmiC7NDHfOCXbPZGNrIKwWb9I1zZcu5tuoTZjsuYEtzJ2ZCrdAse68DWxxeUgEi Btvzfqv9nx/IF+HAqwFQ82jfBRDpHdcRlWelVmpviAE1Uskp6FEn2PIeelPhyM7SsF8C mxig== X-Gm-Message-State: ALoCoQmrXB8nSKyGWUP0Uyd2w2s0lO+u9xW4HdTgKNaXWLyo+Q0af3Wp5ZdUMaQQJTeSwkOo7AyI X-Received: by 10.194.81.104 with SMTP id z8mr87016252wjx.45.1421883415254; Wed, 21 Jan 2015 15:36:55 -0800 (PST) Received: from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id wa5sm1710761wjc.8.2015.01.21.15.36.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jan 2015 15:36:54 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Thu, 22 Jan 2015 00:36:28 +0100 Message-Id: <1421883395-27235-10-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1421883395-27235-1-git-send-email-olivier.matz@6wind.com> References: <1421883395-27235-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [RFC 09/16] testpmd: move csum_show in a function 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: Wed, 21 Jan 2015 23:36:57 -0000 No functional changes in this commit, we just move the code that displays the csum forward engine configuration in a function. This makes the next commit easier to read as it will also use this function. Signed-off-by: Olivier Matz --- app/test-pmd/cmdline.c | 82 +++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1aecbbb..260a273 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2867,14 +2867,56 @@ struct cmd_csum_result { }; static void +csum_show(int port_id) +{ + struct rte_eth_dev_info dev_info; + uint16_t ol_flags; + + ol_flags = ports[port_id].tx_ol_flags; + printf("IP checksum offload is %s\n", + (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + printf("UDP checksum offload is %s\n", + (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + printf("TCP checksum offload is %s\n", + (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + printf("SCTP checksum offload is %s\n", + (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + printf("VxLAN checksum offload is %s\n", + (ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) ? "hw" : "sw"); + + /* display warnings if configuration is not supported by the NIC */ + rte_eth_dev_info_get(port_id, &dev_info); + if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { + printf("Warning: hardware IP checksum enabled but not " + "supported by port %d\n", port_id); + } + if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { + printf("Warning: hardware UDP checksum enabled but not " + "supported by port %d\n", port_id); + } + if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { + printf("Warning: hardware TCP checksum enabled but not " + "supported by port %d\n", port_id); + } + if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { + printf("Warning: hardware SCTP checksum enabled but not " + "supported by port %d\n", port_id); + } + +} + +static void cmd_csum_parsed(void *parsed_result, __attribute__((unused)) struct cmdline *cl, __attribute__((unused)) void *data) { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t ol_flags, mask = 0; - struct rte_eth_dev_info dev_info; + uint16_t mask = 0; if (port_id_is_invalid(res->port_id)) { printf("invalid port %d\n", res->port_id); @@ -2903,41 +2945,7 @@ cmd_csum_parsed(void *parsed_result, else ports[res->port_id].tx_ol_flags &= (~mask); } - - ol_flags = ports[res->port_id].tx_ol_flags; - printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); - printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); - printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); - printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); - printf("VxLAN checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM) ? "hw" : "sw"); - - /* display warnings if configuration is not supported by the NIC */ - rte_eth_dev_info_get(res->port_id, &dev_info); - if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && - (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { - printf("Warning: hardware IP checksum enabled but not " - "supported by port %d\n", res->port_id); - } - if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && - (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { - printf("Warning: hardware UDP checksum enabled but not " - "supported by port %d\n", res->port_id); - } - if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && - (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { - printf("Warning: hardware TCP checksum enabled but not " - "supported by port %d\n", res->port_id); - } - if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && - (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { - printf("Warning: hardware SCTP checksum enabled but not " - "supported by port %d\n", res->port_id); - } + csum_show(res->port_id); } cmdline_parse_token_string_t cmd_csum_csum = -- 2.1.3