From patchwork Tue Dec 12 12:52:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shahaf Shuler X-Patchwork-Id: 32164 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 35E4C1B1A4; Tue, 12 Dec 2017 13:53:49 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0059.outbound.protection.outlook.com [104.47.0.59]) by dpdk.org (Postfix) with ESMTP id 90CA6199AF for ; Tue, 12 Dec 2017 13:53:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1bNLEPX7T8Kg1OA1oxQ2/UPvtXGqJN69cgyw4I5qAh4=; b=daNet7Vtn6Ygsa5S5PN31btRZYI4840S0AZNNwow/DMCY23uY6Rwt8zrJFWv5arU3bDeOZBo0NR2zBvx13Ua4ds7UL5uwuzc18N5ozPtCQpn5HR0d5r9LcUsSjESNN/kzmEqbTUD3TqHpCSzC9OXQ1KF0WMhSrwWoUNf56q4Als= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by VI1PR05MB3150.eurprd05.prod.outlook.com (2603:10a6:802:1b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Tue, 12 Dec 2017 12:53:39 +0000 From: Shahaf Shuler To: ferruh.yigit@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org Date: Tue, 12 Dec 2017 14:52:50 +0200 Message-Id: <725d38e2fddbfa3d335861a65782c6e60aed18f0.1513082773.git.shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: <20171123120804.143897-1-shahafs@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: DB6PR1001CA0037.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::23) To VI1PR05MB3150.eurprd05.prod.outlook.com (2603:10a6:802:1b::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a7d8746-877b-49bd-f4bc-08d5415f5e1e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:VI1PR05MB3150; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 3:31FSqo4Qnz9vOlNK+teImChqgg25ZlX8a4cuYQ+YBJ7rf1OF22JwooFTaY03et4GTm9puZLWaYrcf6JJ8IoxiRq/e9P6gYaeNHfgVepMLPaADHS57MwgqlpCUC8VsiOtN5TcAbBij5Osa70xLjtTNN9vINn/BY6JB379Rjh61ocSN2S5cP+U3t5HPfcTB71owfeJ15eI9S2LXAi3wQ2WWcUV6Q1W6jm1Ji3T+083+O8boOzGSuXt1ZhEIhQaM9OR; 25:DO39/9aRchq/m1JYwh+qEMVJdsoohDByAZgLu1PeTgdx9QSFSXHsecNIXpHYJ6b+67F5kiDUFjAjPB9VFWwrkaYStlpf07s2Jy1glI1lYL7jmN4lYkE6H1LHEjCA7mLs5kL8lz4hd6Vpd0DuhWvysBpyj8UTdTExQGV6Szm1AwVcKX1ym3Pfqj6xpQv43RnZ0Fo9dE/CYxEW0pu81qmbJbPjpORRrJTRygi+UfED9x5FECV8zEAMLbGMVapeF0jigPOVN5Nqog+iFinZ7534AYzRf5zcDMCHUnfOAKVUFBo4wgiFmTG3OsBp3jIkduTbYiC2m1VJWGlzQhOc/LK7v8QS7TT3UrGIoN6a0Hbey+4=; 31:m0yvBKnQasaTq2m0gO0wYqXRe2GIFs6xGlakLgQSHri1hzt7j4Fep9RI51PNWmazaoAYTtT8dQzBw9aGsavRkuNOoDyuL8QUjRQ0odKv50Ua1lf1JNWmsOLM1Ilz48KtcccIc0assvwXfT1sV+XOVhG00TwTnglI+uhJljP7rvu3ET/Tm4C13evbRC8Qy1u5M79C8UUgraqn8uQpiQQVRCTZrTx/aUdlWZ39rwGcK5Y= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:Ie+jxJjP9oDSc4y+yvY3u1cOAj8I6GzOrgvdJxU0pd24X+jmbuXbQOgtUTwjz4/FVm0mBfvQOdmbegeKmyRcwmr5PKQXcQRwD/likqi/JrEQXMGRB7LoFoNlNIur1aFUvu41wINHrPOqfLLHPheqEP3sipDGeD4nTu+xNmUcHQoV+luZBzPoL44Fm5KB/Jxeu1CtcPJ1pyHSwivstWxSvYUrp2At4qsztL/U1o8Qn2GAj7vm3MqOMbPQc6qGsJ+soGxsxuSFe+PxKtnDw25VI13H1yXNafQZZJ2jJhfsUO1WBsh06aJINmXmj4csoSjTAk74bIsnXWgMI7nkL6VE4mHvPsEiapgzPDFeDhxaShHfycHhNbNzXbN1KzWtDvo2k3AzIkCZuwC/JCKjLn6SJO7HBN86++beZiCesKcaxiivhRUFJg2Fp62odePalPEFGbmgp6r4mVjnNbUDfyau93wQeAUqhaX2Xh9sdN8fS/R9h2UoViL/L415oMlbwJn4; 4:vP2onXtXkO1UgkZYXvbWGhQzyrnCIElQ8VHjjsf1KFVTaBXWQnwcXMhYxN+eZ6I+b5Oe8icmbO16XaC5nTRWdUKeh8sXkaMcq19ve8H9PFVkBj8IjAmMCSqViUzLlBbgaplLjLbDIXuGlS8Ivxvrw/Syi8eZc3LtU07bxzv+mOf37icC+PJjRksPs0UpMNPkmJ4lwKomAIg6Ta69xEXsco6wgWlW+NMl9CcBmLoYlaQQpOiPyNNMBE11lHm794aoUwjfXmOzia8hBrS/5wSltQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231023)(6055026)(6041248)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011); SRVR:VI1PR05MB3150; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR05MB3150; X-Forefront-PRVS: 051900244E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(346002)(376002)(199004)(189003)(55016002)(81166006)(106356001)(7736002)(81156014)(47776003)(8676002)(305945005)(105586002)(66066001)(36756003)(4326008)(118296001)(53936002)(16586007)(50466002)(48376002)(7696005)(33026002)(69596002)(52116002)(51416003)(478600001)(5660300001)(16526018)(97736004)(21086003)(316002)(6116002)(76176011)(3846002)(50226002)(6666003)(2906002)(2950100002)(8936002)(86362001)(59450400001)(68736007)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3150; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB3150; 23:FLqdlW8buW2sizq4ukuWUtzFYfqvwqR6wFSOVyp9z?= e9mS2tz6KZTSiCh5YDEC6RxmZ6/78XdZFq7d+8RHOp4W0nIy9BTmSkt2E+t9zH+z8BWXetO2Q0e2ucX3MhDhUaM5/PHgIyBgWVx8rKoPNr6ZFdiTf47aG9jsXMUpm79RfMSI0Hu2owbUd5t0IzsrHlxAKVfnQef5yj7ykttg2fl+2AIWY3Xfzr/hVYBDvZHNnUzJx+kpI159sIZEi783cydBCLDfW9x99PvkmFJqWP2pvLq+OUSDV1cnQOk9MVJHZR/6V8d781vDzYETTpo2awqJUYsZNuPcMBoexaxfC12kavmjr86kIMNjU2C3zDR/VjaP8YXXw39PxalykeOScwt11Hs6eXX5JTsU8xEw226xlwxD/I9R+iM5oVBINjhwQZFMfd6LJJgNRIV5Q0G7mRKFtCzuWjlDpyqPApIk90YPeCjM5ps0NL+pC60V8fc5TkrHbsqZYRD8Fk2ryQvJS+fILCYNArsuv1IhVzybEEDKGdCwNUq5KskcEqbXCl9snvsAmj8zExvJ6G3J4/ZmwRoF0RvZC+pKpgyVun7HZamA/Z7Nj3uJWDY5wBBNklXySzy/9nqh6VaZP9tEDShiLcKj82ubI92rBSOjHBDp6eW/h58Dl+lW24Pb2b3DzMFBWXL3xmryuYBT1KenaGH6DR8IAvSIfIkzMQPxV3+1hDz0o2caGd9KAbCQ1dOsvvlBh9+HAByqiC7LqUUQlDtGb9B6cKvZdh53i5w4oDNvK2YRlhon/3wsZm1kqkGMXO5Nl30zXXCnMSJ1yAMC5V++A1/7iTHswehmp8ldri7r5K///uxSO6pc8nLI1YJyWJtsOFIzxGm9ILgu3LhvufuaoaH0/UH9Lo70y4ME6tY6mayCYYPUKlhwKT3TAleooWWHC426wlEHxg7voh+6UrRNFF7onk63SMeqCS2TgaLVSjO1JAweueSMDGKcfAl+GH3JDb6nXECSC3cPRvSIhTDc9MZjo1FVjIR2Zk4ajqt8abNbDK1XAtV0RC2TTwgUJDfl+NY4b8kVLfFpW8GHzZrZWQNkPofwAyaygfn8kFFtTioNg== X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:KPysdabcFq1SeuUrqQ/MJwKXXsflMRG1wSTaHQsNERoaa4Z9tKdLVSw/sHcj3Lc6QP1Y/iY5PrDXwMlNPnIPBDFAaFoCsKLJnfj5Nqi72P/6lEjXRYOPMtJXDvckCRuWzd06Zuvah8a4e+h5zsB922GHouEdpEzw5Bc5nQ4XM8lcv830l423FWkf7bQgOSCaNpzgkiFUoii4XNnOPOcXV73n1MLHTVuhMEi0MqiSEwIQdICMTV9HKLcRW49jgp+PxevSLUKC530ksKFjwtVu5k+mlUNkcpzdb4i4MMipPfZqT5HA/2R3J9j2jK+15TgF8jyNnzGBuYVNRjbtc3v1Yc0A4Ffknq/USeFugO1hqeA=; 5:fovuJT+dA3HYjLGU2+4R4NUZigXuilX9vN2aFYzHXN6vhbx7Qr//N1zrghba4yCBHdZpiC0xXsl4yMTBefgDDVTV20A/gWIT+IAkflrPbXO2N/GkgprYkbLQIjdpgppZe818BnmTnHKCHyZX3QqRc+wMtphd3ZHw6vD2M1vNG68=; 24:wRNexhY4vutBGF0XL5nxmS6O/Nl141BCq3VWpUEvXTNWb8vW0BMyIWMiGgNtvtaF16qWihlD0yLzsXY976bwfHLrvnQnER0K/LQk0g3hOSE=; 7:k4tIDAlsF3AgNoEmf3o+PzmQFrP/omXeofrHBYuzoSVS4zqrrI0Z/5Dd4TsGA9DOqJZlAg8Vwi7wSm8OqOLNZp1f6bsKU57eDBZy8RbrqtE448lZVOPlsDhzFE2goVZUNXch8SpTeL8cb9B+Dq/WiNNXXQrJt+lOP39f4XO8gCdtnKzjusP6uilCHflmyTsuYo3t6EFw/KoHz7RiiYM+F0VZpctMpPqPUWIPEHg9qTLaf8QxAYh19R9gjMjNjRjS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 12:53:39.3172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a7d8746-877b-49bd-f4bc-08d5415f5e1e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3150 Subject: [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field 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" The tx_ol_flags field was used in order to control the different Tx offloads set. After the conversion to the new Ethdev Tx offloads API it is not needed anymore as the offloads configuration is stored in ethdev structs. Signed-off-by: Shahaf Shuler --- app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- app/test-pmd/config.c | 4 ---- app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ app/test-pmd/flowgen.c | 8 +++++--- app/test-pmd/macfwd.c | 8 +++++--- app/test-pmd/macswap.c | 8 +++++--- app/test-pmd/testpmd.h | 22 +------------------- app/test-pmd/txonly.c | 8 +++++--- 8 files changed, 59 insertions(+), 88 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5812583..8584821 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ struct cmd_csum_result { csum_show(int port_id) { struct rte_eth_dev_info dev_info; - uint16_t ol_flags; + uint64_t tx_offloads; - ol_flags = ports[port_id].tx_ol_flags; + tx_offloads = ports[port_id].dev_conf.txmode.offloads; printf("Parse tunnel is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off"); + (ports[port_id].parse_tunnel) ? "on" : "off"); printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw"); printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_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) && + if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_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) && + if ((tx_offloads & DEV_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) && + if ((tx_offloads & DEV_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) && + if ((tx_offloads & DEV_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); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) { printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); @@ -3705,7 +3705,6 @@ struct cmd_csum_result { { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t mask = 0; uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { @@ -3723,28 +3722,21 @@ struct cmd_csum_result { hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } if (hw) { - ports[res->port_id].tx_ol_flags |= mask; ports[res->port_id].dev_conf.txmode.offloads |= csum_offloads; } else { - ports[res->port_id].tx_ol_flags &= (~mask); ports[res->port_id].dev_conf.txmode.offloads &= (~csum_offloads); } @@ -3821,11 +3813,9 @@ struct cmd_csum_tunnel_result { return; if (!strcmp(res->onoff, "on")) - ports[res->port_id].tx_ol_flags |= - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL; + ports[res->port_id].parse_tunnel = 1; else - ports[res->port_id].tx_ol_flags &= - (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL); + ports[res->port_id].parse_tunnel = 0; csum_show(res->port_id); } @@ -4025,12 +4015,11 @@ struct cmd_tunnel_tso_set_result { */ check_tunnel_tso_nic_support(res->port_id); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) + if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " "so that tunneled packets are recognized\n"); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)) + if (!(ports[res->port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } @@ -13082,7 +13071,6 @@ struct cmd_macsec_offload_on_result { return; } - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); @@ -13172,7 +13160,6 @@ struct cmd_macsec_offload_off_result { return; } - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ee7d083..57d73aa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2807,7 +2807,6 @@ struct igb_ring_desc_16_bytes { } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2831,7 +2830,6 @@ struct igb_ring_desc_16_bytes { } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; @@ -2842,8 +2840,6 @@ struct igb_ring_desc_16_bytes { { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | - TESTPMD_TX_OFFLOAD_INSERT_QINQ); ports[port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT); diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index aa29f5f..dbd2f98 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ struct simple_gre_hdr { * depending on the testpmd command line configuration */ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags) + uint64_t tx_offloads) { struct ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; @@ -347,7 +347,7 @@ struct simple_gre_hdr { if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ol_flags |= PKT_TX_IP_CKSUM; else ipv4_hdr->hdr_checksum = @@ -363,7 +363,7 @@ struct simple_gre_hdr { /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ol_flags |= PKT_TX_UDP_CKSUM; else { udp_hdr->dgram_cksum = @@ -376,7 +376,7 @@ struct simple_gre_hdr { tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ol_flags |= PKT_TX_TCP_CKSUM; else { tcp_hdr->cksum = @@ -390,7 +390,7 @@ struct simple_gre_hdr { sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ - if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; } else { @@ -405,7 +405,7 @@ struct simple_gre_hdr { /* Calculate the checksum of outer header */ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags, int tso_enabled) + uint64_t tx_offloads, int tso_enabled) { struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; @@ -416,7 +416,7 @@ struct simple_gre_hdr { ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ol_flags |= PKT_TX_OUTER_IP_CKSUM; else ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -646,7 +646,7 @@ struct simple_gre_hdr { uint16_t nb_prep; uint16_t i; uint64_t rx_ol_flags, tx_ol_flags; - uint16_t testpmd_ol_flags; + uint64_t tx_offloads; uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; @@ -678,7 +678,7 @@ struct simple_gre_hdr { gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; - testpmd_ol_flags = txp->tx_ol_flags; + tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; @@ -714,7 +714,7 @@ struct simple_gre_hdr { l3_hdr = (char *)eth_hdr + info.l2_len; /* check if it's a supported tunnel */ - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) { + if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { struct udp_hdr *udp_hdr; @@ -754,14 +754,14 @@ struct simple_gre_hdr { /* process checksums of inner headers first */ tx_ol_flags |= process_inner_cksums(l3_hdr, &info, - testpmd_ol_flags); + tx_offloads); /* Then process outer headers if any. Note that the software * checksum will be wrong if one of the inner checksums is * processed in hardware. */ if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, - testpmd_ol_flags, + tx_offloads, !!(tx_ol_flags & PKT_TX_TCP_SEG)); } @@ -769,8 +769,8 @@ struct simple_gre_hdr { if (info.is_tunnel == 1) { if (info.tunnel_tso_segsz || - (testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len = info.outer_l2_len; m->outer_l3_len = info.outer_l3_len; @@ -832,17 +832,17 @@ struct simple_gre_hdr { rte_be_to_cpu_16(info.outer_ethertype), info.outer_l3_len); /* dump tx packet info */ - if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | - TESTPMD_TX_OFFLOAD_UDP_CKSUM | - TESTPMD_TX_OFFLOAD_TCP_CKSUM | - TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM)) || info.tso_segsz != 0) printf("tx: m->l2_len=%d m->l3_len=%d " "m->l4_len=%d\n", m->l2_len, m->l3_len, m->l4_len); if (info.is_tunnel == 1) { - if ((testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + if ((tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=%d " "m->outer_l3_len=%d\n", diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46478fc..0531b5d 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ uint16_t nb_pkt; uint16_t i; uint32_t retry; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -152,11 +153,12 @@ vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f4a4bf2..56ee3cc 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ uint16_t nb_tx; uint16_t i; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 721865c..e2cc481 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ uint16_t i; uint32_t retry; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ab74d39..c6baa10 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -138,26 +138,6 @@ struct fwd_stream { #endif }; -/** Offload IP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001 -/** Offload UDP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002 -/** Offload TCP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004 -/** Offload SCTP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008 -/** Offload outer IP checksum in csum forward engine for recognized tunnels */ -#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010 -/** Parse tunnel in csum forward engine. If set, dissect tunnel headers - * of rx packets. If not set, treat inner headers as payload. */ -#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020 -/** Insert VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040 -/** Insert double VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080 -/** Offload MACsec in forward engine */ -#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100 - /** Descriptor for a single flow. */ struct port_flow { size_t size; /**< Allocated space including data[]. */ @@ -215,7 +195,7 @@ struct rte_port { struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ unsigned int socket_id; /**< For NUMA support */ - uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */ + uint16_t parse_tunnel:1; /**< Parse internal headers */ uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */ uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 309c738..418901c 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -193,6 +193,7 @@ uint32_t retry; uint64_t ol_flags = 0; uint8_t i; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -206,13 +207,14 @@ mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; + tx_offloads = txp->dev_conf.txmode.offloads; vlan_tci = txp->tx_vlan_id; vlan_tci_outer = txp->tx_vlan_id_outer; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp);