From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0069.outbound.protection.outlook.com [104.47.1.69]) by dpdk.org (Postfix) with ESMTP id 6B7EC1B63A for ; Tue, 26 Dec 2017 10:45:02 +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=7w/evzRUpoFqtn9SReRfZfrUzZ34bULT88lYirgamQc=; b=ntlNB38sIrmpCqGtWv8VbLDnhnzE1jO60d459gnmsQxp/Y/ulHq9VhJ7UYUB6rN3o1mr+6V2iefZWAKCIYGFC0AmXsOw9o+mFzWm4nO5w6qWVN8lt6prJ0pWfkfTtIUOB34wuV2naVbYMLl2DD2csPdtbqseJ7xkPEdwfaN9t0o= 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.345.14; Tue, 26 Dec 2017 09:45:00 +0000 From: Shahaf Shuler To: jingjing.wu@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org Date: Tue, 26 Dec 2017 11:44:20 +0200 Message-Id: <11e9149de883871295c9b9ad069af5fee0cd64b2.1514281260.git.shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: DB6PR07CA0012.eurprd07.prod.outlook.com (2603:10a6:6:2d::22) To VI1PR05MB3150.eurprd05.prod.outlook.com (2603:10a6:802:1b::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 186f286a-5184-44db-dae5-08d54c455544 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(48565401081)(2017052603307)(7153060); SRVR:VI1PR05MB3150; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 3:ms4WUGGtfoqts+ciDKhlaDjvvOsX8jECP6bSR/8/hgRHiamHnp9LJfO5mcFIUj62832ncdM9iLJ/SEicdsOo6crq6w2idoOEHxoDBwPBWunts7vLLMyFbFFou28zabh9b7AzeWTe/NgroobdgR5kIF2rubgDfd+2KRJ1ncXbfHOYPpprA/S80/Cs4fDcRUs6EueoVnDp0sd3S2AmLXhCUoibbrHBAdjqUUak6ySrxM52oyEOhiwEfgslpYi7+nAF; 25:66HaOslZrfYfgU2L+N60s5WxeL/NgWKZPDIk5VsK90vZg8Xb7WAdWBaKIDuOtyHLriYjx29rI5czCEXaqHfi2aDS6mEYT2KdjUHSs/RbE1vACmLv4EA6gWc67OIWuWE/WaCQ7xERLyzyYq8d/6r5yITBlhtlwSY4SRK2+/bbdIPKF3SVmQZJoWXzLYzyMkX9xwDO2d/EBGMxxGR5vSA5KiOLPwMq72shD8GOrpE4MXUhmOZ/E8UtYCB4Xm3u8aD3y6C3MP0gR6NiorurZOZr7zMdhiUDwcCJ+5hU/CiR+nVbGZob6fRYKmAACh34ZDWYYg8eGa3jIBQ+O5h8734kIg==; 31:0z3h2ZxN1j83qV7sWG/34W0p/kTFT88/63plx47MKNHpMvD3m7ZTSYcCkX3Ttf1JrvgpwM5lm1NrAQw14Yt8FuyYWAYdkGNSE8jeplHiaTydZmyC2U5NT0Re7x82NNTfWUcMiHI5vDotV1FwA8QxaDsDbufrMkVyiwVIbylelvPy1hJFzMM5y64m87WmwkFMK74+pI+zaR0evzwcYqCz4R5WH0yaaf6mf8XWo4Y8slg= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:89CdKTVvKV+S143J2x+uhsLnJErqo7Abv32Lh6w3iiLSySb8obI4zIZeUHb2RHuLYYjI2rddcOFXzU2Vsj1ntjcVzq/9Kf2rLxkEOxyv8oMT7rryDD2D9pOTj+ZRgeYrBWm8zlGPKCa6PiwKsGQUNSMk4Irk7EfPQme8t4Rf9kYiwKmn+YsP0cVy9cm2f4PLC2A5jWdE9humMHxTMLXIqdCpjBhbJ4Qyt/oWu4Nj1Imz2gCJc5ZE4ZWDVi3HZqozxITep8IkKfmdlM0BIsTxEa1spBB6WiJPKwcGw9rKtjV7rsiQGD8GXwZuh/2+f6WefQs6LgxpOo23HB7NdEuirv4wehgDgUEx/+EneNGWgTYNjtjnGCUr8R01tH2KvdOpSgBRV5dzYEZBfI/s5loIF06/NPQ1I1Gu3aDWSyASX7Kksx4q9PpnH1hSYQel+m5S0LSIilq+KqxSiM4OvmG2947fgJshZ4j0AMHV9qGrAkh4IEhocSgSjw1TvVVNJptT; 4:Q47EKfW33gFvYeHfWQ+jdEG4bx6jrZHXS47HZ8MYM9MXztwxAVhzpT77BouHF099M2Vg+yrj7ktkJUxVVN6buKBbRlTvCRUCUj3p0/ECrDKYyK4wmpXWWzNnLTfZVHXPIz8GFci/UBkdJBLhuYGsM2HKbDB5D89JK1xWW1m4DxLyEN+HERs+hUU570qQzF5biAqWmfwuNz5IyRsCSm53NJO21cYrtczpmLGBietLIT4X1uV8V8WsL7UGYypMCbSNUnfbCxOn3FqXGzbYcvHXXA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041268)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR05MB3150; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR05MB3150; X-Forefront-PRVS: 053315510E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(366004)(346002)(39380400002)(376002)(199004)(189003)(33026002)(50226002)(52116002)(59450400001)(51416003)(55016002)(8936002)(76176011)(7696005)(81166006)(36756003)(575784001)(86362001)(68736007)(3846002)(81156014)(6116002)(386003)(16586007)(316002)(8676002)(50466002)(69596002)(48376002)(53936002)(2906002)(25786009)(2950100002)(6666003)(5660300001)(118296001)(16526018)(21086003)(4326008)(478600001)(97736004)(106356001)(47776003)(305945005)(7736002)(66066001)(105586002); 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:wIDnzALnWEs5lVAGVBvRRGFtog5ieKmCDDhQiFu9s?= =?us-ascii?Q?F0gjFfAwsRLn6yXPWd7MMcba/gbP32j5uzWheZHuo9UvTUxjWlTivHa+i55n?= =?us-ascii?Q?9vtjHGBW8j74mDzwM3ZfsOoUnwnFJAS3OXzOYTaReWoVqxq+jY/SSv+tQLzT?= =?us-ascii?Q?5GB+rsQiPMLryNiic4fQEZN5tFM0wOY5rIb6g2quXcSWGXKrJn21jkXTJ0Bv?= =?us-ascii?Q?xKee7I7NggyaGvaTvH1QbfpMdEP/coB98zfE6wPbMuaP4tIePdv39ffKaWKu?= =?us-ascii?Q?3tbvgWrEIMlbZnq7eIXevjRGxQO8BZoMXXNke35jHSWB072g3xv+HHY97X7W?= =?us-ascii?Q?1FVS1EF94x/baFF2YLI4PmTXHkf8sqBHHvcLeUD54gRLU4XFFUr9SN3eVWtg?= =?us-ascii?Q?+nxd53jma1UNFote+D8cFjOtrnv9z9tL8u21Svf135gbHp+NvR61s0bGnH/x?= =?us-ascii?Q?YMU+Po1/io4oSJQ6GAUHvGzKRNc/zUqt7/ANcG5CW4l/YMJZWj4LRX5470Q4?= =?us-ascii?Q?x4fOAKvbJgmMEuLJG5E/xSgK27AVCjsCL2MdSY6iKuSRXca1hBc69pUg8axN?= =?us-ascii?Q?V+p2JGpQB/D6jCDf9fOqqhUwmgBmtvjizEpbTtkTYcYslhxp1w1wBuTU2mfE?= =?us-ascii?Q?7NxxtdO5h6P1ipPzgKA9ie9AZExwYdjFQuYtjusqEsj41mSCt25+GUvaITLw?= =?us-ascii?Q?WPTKs4c1xzk/x82PPCziSlK+Jq47nZGdHWXlE6XjkQsjv8UEugZa4rD5W0LZ?= =?us-ascii?Q?8at8l61VM8UGyWGNvYyTjIGqBTdT2AzSSwIlZpf+wsHOgZ3nOYe9HdXFAX0n?= =?us-ascii?Q?m+sGzw4fJPLdrqKzQJ+wXITzoU7PCYnWgO0G2Ev1hk/yPngwM1nRb6FfBtEM?= =?us-ascii?Q?Rs1v8XwtqJN+K3mQ8vgfk2PdevDcN5Y4Mmk2NToZeao9y4fWp2fDzYgZ6yiR?= =?us-ascii?Q?GE+UQXEnTDSikLKR053sxoBrUggIujB2e/MeY75OuAM8cwQPdafwA4knVdHN?= =?us-ascii?Q?Eha+hGkcowZx5eaRgD9uTspEKEoiCBSkUHyisF3S1FTe7wMfMGlTenSDZnUd?= =?us-ascii?Q?1560NMSUu8uPTL9MU91bG05Od4s9AeF5w6Sh9YQ339kbU74LQLFv6BUVV1pH?= =?us-ascii?Q?Jp9Gn80Uo25DHz+ZMn5hrjSuPogwVHhH0MsvlUxSb60em/6a+yU1A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:EK1XCpONKSE9wPHv67HMzBdLa9wVsb9aadROJwJinMmxTdJe/TEagFGGEGKcPk/hcIClDN0Gc6aDdTWlkgdN44AKJs69KqSP7sz8+s6bk8Vd2aLybqO9gE3bJommqzeZlG4h9ZFXEWtY6sEieyDnePTFCrGbejV01nyoE4PRl+ZSb50nW7ntnS5ngu4/3wH742Z2edpOz65d9BlktLCFGwZPOrSmede/HfFSNFuMSIvncz50pq8NenRMwSV6Px7Z9ttHF5FOuqDwFk/HU/uu8xQH2oLi3VcJP1TmKmDW7eDI9hgcYbaPQ+cIHla7cmXsQPnP7NwD2rdNNW94KCHVExGS/l4ZeBtIZ/8t+yFAFVg=; 5:24SvmJvCKeX4+xzfSDx9GMVvG0SPG7O5DHeimCuWhkQnthOSlFdvJvoRy5KwScViRmWP5AjyuzPTQyLkqp6uumHWnzTeHRs/CS/Wg/CkYPAbk8QB17ViaLbTGkIzF2ugKtWbbSzSS7uhyRZF6sna3RzwSLvsFFOvQhG3S9G7W3M=; 24:xK5TdwEapJ1IrRFERE5p+DlcDTgrbXrAZArOEkbir9O+mhYCmgRoU7AHeLlhqQiuF+MN6xHFWsFNsmcNxnjeqaupUFKizWihk5FRcey7w+s=; 7:7tr8YZ1gEWjCBh8bkwl3anYMSwhnzdOUYMERVL42WHPYf7+vUC5JIagQjNbvoMIuoO7uu3rQnHLo8fug1+uI+35FM8MLpbt09v9BP1sZwu56dllbOVwb46M7MocBfMTQOIyTzimqDVQXem42Tf4cZlg+7HDUyi7jDeQWcE/oVGgTfvXaDHeyjSVcsgrx8+zil9F6rM8JDy9U3Y0LI3D8Dt+l1mBvSWFPBe97ZUfftRJSaqhTSeBYK9iqEAEWUR9o SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 09:45:00.3573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 186f286a-5184-44db-dae5-08d54c455544 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 v3 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: , X-List-Received-Date: Tue, 26 Dec 2017 09:45:02 -0000 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 58125839a..858482174 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ static void 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 @@ cmd_csum_parsed(void *parsed_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 @@ cmd_csum_parsed(void *parsed_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 @@ cmd_csum_tunnel_parsed(void *parsed_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 @@ cmd_tunnel_tso_set_parsed(void *parsed_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 @@ cmd_set_macsec_offload_on_parsed( 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 @@ cmd_set_macsec_offload_off_parsed( 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 d0056fa69..29115e255 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2808,7 +2808,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) } 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; } @@ -2832,7 +2831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) } 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; @@ -2843,8 +2841,6 @@ tx_vlan_reset(portid_t port_id) { 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 aa29f5fc1..dbd2f9842 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) * 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 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, 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 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* 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 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, 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 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, 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 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* 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 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) 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 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) 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 46478fc3a..0531b5d27 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) 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 @@ pkt_burst_flow_gen(struct fwd_stream *fs) 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 f4a4bf29a..56ee3cc0b 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) 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 @@ pkt_burst_mac_forward(struct fwd_stream *fs) #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 721865c96..e2cc4812c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) 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 @@ pkt_burst_mac_swap(struct fwd_stream *fs) #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 ab74d39ce..c6baa1066 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 4ce4d61cc..5b5e4dff8 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -194,6 +194,7 @@ pkt_burst_transmit(struct fwd_stream *fs) 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; @@ -207,13 +208,14 @@ pkt_burst_transmit(struct fwd_stream *fs) 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); -- 2.12.0