From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0073.outbound.protection.outlook.com [104.47.2.73]) by dpdk.org (Postfix) with ESMTP id E70021B171 for ; Wed, 10 Jan 2018 10:09:57 +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=QwsFdMtxVKuQVhos1kRbDXelApN0q9ZI8vhpR8xhDzA=; b=TFX3Sd8MDl3cr4uAzF7zD5k4ikrfM6vGe1MUbecTINMOKezDlCYofaT9Ul8Vv5pYJrGdSTDekJjHiSRgucqeKgR48wUn1CSFdVVzGes52/xFbCxIJB4nK7scfW0jdvbXl8CVN0aAoMlxWL+UZ4HpyBUb89/VZiuFN5KoLYJslI0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by AM4PR05MB3137.eurprd05.prod.outlook.com (2603:10a6:205:3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 09:09:55 +0000 From: Shahaf Shuler To: jingjing.wu@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com Cc: dev@dpdk.org Date: Wed, 10 Jan 2018 11:09:10 +0200 Message-Id: <83e16ac3bcbf324350203e6798fbaebbbfdd46b2.1515575134.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 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: VI1PR0202CA0030.eurprd02.prod.outlook.com (2603:10a6:803:14::43) To AM4PR05MB3137.eurprd05.prod.outlook.com (2603:10a6:205:3::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a991d9a3-3d4e-49a8-b0b6-08d55809eb16 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM4PR05MB3137; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 3:HyOp3V7vCpJBFQYzU1WE+04NQCuD6kOfEQyQttsW4gvKcmjL65NM2qR9p444JNPxl/65iBwhDZjD1YYnEW2lVzrvMDxO9/qA5rNVYCnUpcPxiV3WcpI04oNbEEyFThITzzfnKzCUaP3LXA4pIC3fTAtAXMljcF5K7jYGohCEDFmxbjqQiE8EYPc/sWqKq2SvxpNr/d9azJE8J68FZXlzs27BRBk9FvhdsoLB50WeSRzDRi0q7e3+7DITt8jnvu3j; 25:5SsYCj29wvAcx9lLY9DqPd4Ah/kxJQn4oNm1j3D29sNXPB4ASilI19EcPlscIOW7dVNVsQ/jjCaH1N39pGBY5cKliRud1IlNfIhaTUjm3TR4TyvlH6ZusZ5defsXNfoDvo+npoNNWXbcVizlIVmIUA5aQRkQgwG+eEscJwrZ/FCwSuW8TM6p6TEcB7XFvxOAAlJOTQdrVsehMq1EB4unzhJkNO6mwHl2ySs82xxQKXoBM5JjjeJfUVmCJ6HSVW3euKwHcOJoVJWAY/S4yM1DuUB+27nxlhj+oGKLiLyFGFqsOeTWHzcOyMHu1Xp8JmL2j3GXVrLZweo3urLzLfXGTw==; 31:VWrS1Wdtn6T1yzWxHoa2cgj09sBlRkXEPzSZQs56Iq1MqIxGD8ePDgcWi1PjMwSpAEmZYXXaYJ3baHKMHYFUClVFwYoy4dM4chOOJd+0KxjHk4lUqHvBMwwjQzC4yd0ypFJn3nAKnax3NXKorg52pxPWel71BJos/gJXZc9PTbTmJQ1qKVxES38I53ew2szDKJfvZDzIKtD95x/yjExngfFlpVWwSM0dOSYks+PrA5k= X-MS-TrafficTypeDiagnostic: AM4PR05MB3137: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 20:dj+rmkwNqztbTIBa/akm/qgkhIKCpbHrsGm/KHhv18MyNQZ1drTNJmsEo5Z7j8S4AXdj8DIl6/5cGETHVKTrqBZLrRv1yOh+gsNC8f4ndfk2hphb3e+yisbbcaylbexqd9JA1iEW1ByKpxYvTa7/jhup+V/FuVNLAWjAmCsnRAVDI5g5NWciMaH0wOxm2QRffLOnfjCEqByFXGQKY1S7XBMRrmceD4bo3PghD+dm2hmbbXYemN+rJCA8InY+JxScFt0ELqNAIFGZnWuwN9OnNcI7u6sU1ifD6tSPibVR0XEltwCbmc7aoGZ1ImUvk9sABovUytG1cEO5nlHIuzR/wPHhJCc/iJKtTrJAT35iRJW4Tig31I2AZqALAgZYDJIhBC0w4JZTLEPMyD8uYwT7jPsKjVPr9e8xC4hWV6Ij4yGQX4boHV+RnhD3PotFsC3SJelTqqbCTXX5FkJQLft7mNMwRCH21b/DXhz5C/jaANNp1yzzqiqAQWVxSwbtKxke; 4:eMrD3SNTauxzzcda5S07/O8fgdeteEtd+F6svuYk1w9DIOwE7QhC1gtd1KnnwIlPo0XcWiGN+SPBGnTBwwfZjFoMZF6N9EfknNzJhZtXL5QfV5cduEqqPrR30L9OvDbnzvQFfAtP3h85Ek9c/T9G3tMeVNBXmBpVp41GCOGhPomo5cLxMhbr2xMGtkmWRYpPnVGw/lPUU7UMIGfMHuQCel97Yz3aTi4VJ68/Xxt/eZRu72+aCxWhaoSGVvGp2YRfQ1iRgOpVmLUXwKBUa+wj8mRoivFRcs+MIphPd5eWICGlLzQHYTAETejj1SCjfzfr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231023)(944501075)(6055026)(6041268)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM4PR05MB3137; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM4PR05MB3137; X-Forefront-PRVS: 0548586081 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(396003)(366004)(39380400002)(346002)(199004)(189003)(6666003)(478600001)(2950100002)(5660300001)(8936002)(50226002)(8676002)(81156014)(68736007)(86362001)(81166006)(118296001)(305945005)(7736002)(55016002)(2906002)(21086003)(6116002)(3846002)(106356001)(105586002)(59450400001)(316002)(50466002)(69596002)(386003)(16586007)(36756003)(4326008)(52116002)(76176011)(51416003)(7696005)(97736004)(16526018)(47776003)(53936002)(25786009)(48376002)(33026002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3137; 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; AM4PR05MB3137; 23:9IaFfMqGvbFfDTcpaoqDw0owLxF09y8rcG5SLezdH?= =?us-ascii?Q?+kqVJJw2RJrkWUBDqjrRI7J7Qe9r6+dOSrrzZf1cHLIGFhhQ7JvhWJ7NUOcq?= =?us-ascii?Q?lN7zIrnbkCwOgSMAoBztRwKc86LGp4u3qjB3kxIARJb6reAJ9Sp1G/lFJz28?= =?us-ascii?Q?NkLtRoqyUzUd280Zfyjdc7vZBPLfZLRzfGnzlBBLfDNtye4qO6uO1dpDLZUh?= =?us-ascii?Q?iVwnXKd8WciaWFjsM8Mir4Pt7r60OwYMaempJ4nG2uv+7ABh7UAEAXnVaEqd?= =?us-ascii?Q?KV76yH3+Y9lc+qs94x8q2nxApnd11xr9gspufS5j/5oEoUVccdDa+qrqqrjq?= =?us-ascii?Q?ZZp8wbqzVZ0A6Eo+s4BRxiEMGqdza8JSx3vRcFFl9J+wo/N4Rr3uZMzX2wdx?= =?us-ascii?Q?lOq5+KL/7Zh4VdpayqSoIxp5+44+JP/vSr1anY1D866Jh0KYwbQeq8BXK7ja?= =?us-ascii?Q?JDG+uWxaxmEVp9BEQnNmapVDbx4M2V1Omsww0bzeWRdFpGSAEMRDWAwS0IbO?= =?us-ascii?Q?b/16q6CpankKNIJUlhgg4AroMvA0i0CCac80CdMPQZTYnLJXjkfMCC+sK9Q7?= =?us-ascii?Q?Xi0P/thkfihGecXRaN7pZNiZ7LeSscdBoPFfjoyAaxMlB92X0kL3WYadTR3z?= =?us-ascii?Q?GlAFbJ0cGHV12V0cqjOj/6Y9tAJbf/kxkzRfwa6igJO7obyUneTGDujPPczP?= =?us-ascii?Q?H2HfUBVM0uiwAzQ+vw0fZ671vSlz+ZbC4s41NWMCNwwxv9GR6dfTPZa/iabS?= =?us-ascii?Q?U+EKz255fYArn3vSQlEDZLiZo1ZYp4lngIRfmoeoh+BptBf9wbMZHPtAVbcx?= =?us-ascii?Q?A4J/uvRkCTMkGWW8YrKCwA/zsCk/fwNeQIEaFW/AzPoBqkp9eCrAuiTQ1WaG?= =?us-ascii?Q?tctNuL3k+WoYCurQXNzGbitwanyDLJDCy/KNmS62gQUxRZMe+5xVMKy1jcfO?= =?us-ascii?Q?kAX/a/cMNFaLUwWdGQrVsCo/CZfG9Oh9BttE5OzMewCoSFs0NxK1cDDNqccj?= =?us-ascii?Q?0HT5rCXEx0sHU4y++bkbOLvQb42yr2rRrMe9tyDxa94y0MxI/clrHSCX3hCt?= =?us-ascii?Q?QLbW2Gyf8c/zFxqQwWidzEG6oOvVerB00y/heCX84Mj9JCRVCF5I3Ol1StEM?= =?us-ascii?Q?GpRymqIhnEHIPgn3KjpU1K9r2SLyg01?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 6:DJlrt8ATXT/ddr7f6IOdmgkXQiDiPs52cD+8bnN+acc5Mq4/ioIU3mu3RZRmJ6MealkVaES8t8ufA32YmuOtRSaXP4eZClfN0nNgzgEXNEEfkY/Zz1RqBZHyQsfwT4iVyBBHKZJLqGfIoW57NnOZ/RWRmbpiZCef8skMhv+dgRgGzdDPIspnQwq8hqIumcYMGopNsRyvVYocF3cbx4+gggQm8hZB9AxVi/CVYOj0oo25yTebuoQ0WDZ9xho42fY+q1XA6ZJXy9CVnsJ7ILrBunc4KpoUHu9MguTgIhVz7XkdFDbfAa2pfltfcL0J4+WUPPLjMxDRwMHEfHHqa1tlJLGgPeVdTx3n8xD+akx4Rl0=; 5:uE7rOAXzrl9cGemso4V2WsElHpLYIxpta6uBitgLMgAvjHptMR9KxyRaYFhLpNIPgLrprcaLc3DN6fbGjbrhcSEWGXabkjhtl2YlNH1Qe33kGWjqSuhkRks81RvjaE70fBtzHcfht+EnQMQ+T12YYeQMNWDJXKQ1H5b1N7Fum6w=; 24:JwClR2Wi9MbmCbfbCnQOQaVWv8GHt/RjY4b8/LRBmM6pUe/vcauR7RmidOppPhN9eYDnCPgOvKGYAXzzQFiUYkrEEJSxFeL7rLFbXW5cWd0=; 7:e13sogMkZPZdTeoksEuqoPzky3pcMBTh0vb9oyKh6kkbbPy2RhUmiFZXtxQlyEPZDVDmIByTVRr/kf+xV9fbRR5xlnqxYvlA2v7wnsnHyABxUsr2s5l6M5Qxd9tnHHoRnJ0wW4IUmSFRmk+ZmfDH51hspNcs4OgP2//dYmSE5U8ogI9sJE0irkjgpvqr/l3WaDhQe61bzZUXn4RvnHGmvyRxdYoiNGw9QtxxanRK36gV07ZBQkBlZ0WU4kiTyte0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 09:09:55.7375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a991d9a3-3d4e-49a8-b0b6-08d55809eb16 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3137 Subject: [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API 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: Wed, 10 Jan 2018 09:09:58 -0000 Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Convert the application to use the new API. The is no functionality changes rather simple conversion of the flags. Signed-off-by: Shahaf Shuler Acked-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 51 +++++++++++++++++++++++------------------- app/test-pmd/config.c | 36 +++++++++++++++++++---------- app/test-pmd/parameters.c | 32 +++++++++++++------------- app/test-pmd/testpmd.c | 19 +++++++--------- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d96301..d8c73a9b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1594,14 +1595,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, rx_mode.max_rx_pkt_len = res->value; if (res->value > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - rx_mode.jumbo_frame = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } else { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1703,6 +1706,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1711,48 +1715,48 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, if (!strcmp(res->name, "crc-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_strip_crc = 1; + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) - rx_mode.enable_scatter = 1; - else if (!strcmp(res->value, "off")) - rx_mode.enable_scatter = 0; - else { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-cksum")) { if (!strcmp(res->value, "on")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; else if (!strcmp(res->value, "off")) - rx_mode.hw_ip_checksum = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-timestamp")) { if (!strcmp(res->value, "on")) - rx_mode.hw_timestamp = 1; + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; else if (!strcmp(res->value, "off")) - rx_mode.hw_timestamp = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan")) { if (!strcmp(res->value, "on")) { - rx_mode.hw_vlan_filter = 1; - rx_mode.hw_vlan_strip = 1; + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else if (!strcmp(res->value, "off")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else { printf("Unknown parameter\n"); @@ -1760,27 +1764,27 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, } } else if (!strcmp(res->name, "hw-vlan-filter")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_filter = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_strip = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-extend")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_extend = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; else { printf("Unknown parameter\n"); return; @@ -1798,6 +1802,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 387fefbaa..3bc99be76 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ port_infos_display(portid_t port_id) void port_offload_cap_display(portid_t port_id) { - struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; static const char *info_border = "************"; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - dev = &rte_eth_devices[port_id]; rte_eth_dev_info_get(port_id, &dev_info); printf("\n%s Port %d supported offload features: %s\n", @@ -555,7 +553,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { printf("VLAN stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) printf("on\n"); else printf("off\n"); @@ -563,7 +562,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { printf("Double VLANs stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_EXTEND) printf("on\n"); else printf("off\n"); @@ -571,7 +571,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { printf("RX IPv4 checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -579,7 +580,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { printf("RX UDP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -587,18 +589,26 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { printf("RX TCP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) - printf("RX Outer IPv4 checksum: on"); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { + printf("RX Outer IPv4 checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) + printf("on\n"); + else + printf("off\n"); + } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); - if (dev->data->dev_conf.rxmode.enable_lro) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_LRO) printf("on\n"); else printf("off\n"); @@ -615,7 +625,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { printf("HW timestamp: "); - if (dev->data->dev_conf.rxmode.hw_timestamp) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); @@ -1676,7 +1687,8 @@ rxtx_config_display(void) printf(" port %d:\n", (unsigned int)pid); printf(" CRC stripping %s\n", - ports[pid].dev_conf.rxmode.hw_strip_crc ? + (ports[pid].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CRC_STRIP) ? "enabled" : "disabled"); printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", nb_rxq, nb_rxd, rx_conf->rx_free_thresh); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 84e7a63ef..263651cba 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; + /* Default Rx offloads for all ports. */ + uint64_t rx_offloads = rx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -804,7 +806,8 @@ launch_args_parse(int argc, char** argv) if (n >= ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; if (n > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", @@ -897,34 +900,30 @@ launch_args_parse(int argc, char** argv) } #endif if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; if (!strcmp(lgopts[opt_idx].name, "enable-lro")) - rx_mode.enable_lro = 1; + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) - rx_mode.enable_scatter = 1; + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; if (!strcmp(lgopts[opt_idx].name, "enable-rx-timestamp")) - rx_mode.hw_timestamp = 1; - - if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; - rx_mode.hw_vlan_extend = 0; - } + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-filter")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-strip")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-extend")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; @@ -1140,4 +1139,7 @@ launch_args_parse(int argc, char** argv) break; } } + + /* Set offload configuration from command line parameters. */ + rx_mode.offloads = rx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c3ab44849..6785b095f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; */ struct rte_eth_rxmode rx_mode = { .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ - .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled. */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ - .hw_timestamp = 0, /**< HW timestamp enabled. */ + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP), + .ignore_offload_bitfield = 1, }; struct rte_fdir_conf fdir_conf = { @@ -1521,6 +1516,8 @@ start_port(portid_t pid) port->need_reconfig_queues = 1; return -1; } + /* Apply Rx offloads configuration */ + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { if ((numa_support) && @@ -2252,7 +2249,7 @@ init_port_dcb_config(portid_t pid, retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); if (retval < 0) return retval; - port_conf.rxmode.hw_vlan_filter = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /** * Write the configuration into the device. @@ -2301,7 +2298,7 @@ init_port_dcb_config(portid_t pid, rxtx_port_config(rte_port); /* VLAN filter */ - rte_port->dev_conf.rxmode.hw_vlan_filter = 1; + rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); -- 2.12.0