From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 892A57D52 for ; Tue, 12 Dec 2017 13:53:40 +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=PDZ+TSXIJvPNDA9ZKvIULiyDyxdkGy40zvTYWUIEDIU=; b=UIFKkRY+knt+1RD+Xhz7tOmSCh3vZYpGcWoavKUrylgp1AlPaykWohmkh2nS81OP4FhQ4ymr0J20yDnBIdpXEBPrs78pxFmW2M1PyhVDt8iX8EbLle2SPnjoEOW7sVyDM5omw2s8nCZdnKOkqqnFqlDmTeQD/makpWPUYGLPBXQ= 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:33 +0000 From: Shahaf Shuler To: ferruh.yigit@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org Date: Tue, 12 Dec 2017 14:52:46 +0200 Message-Id: <6dbb2b336586025af6d1c054b450cadd4b008664.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 Content-Type: text/plain 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: f572dd1a-0150-4e79-887b-08d5415f5b6b 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:YTXkgEd5UqXzuQTC6i1wazEhJnWai9Nc4g9UAEWv5GZL6uU/+21DKYnl0UgFA8w9iuflWrgTg+CEm3b1Az57/IJTVRTr2Ob95PCKIiwZ6hIEg+JSnO8ZDVjZCkTMNCbtiHSF4wKqcsQEdK8DrpmuQqoczC8EJdgT8O/uPWpZXaEdIBlIT04aKCCpPSG1G37oUj1DTFzdEsmPmKDsFC4lLCgX7hxm0nCNXstNq9UWvKZJDqiUjhxjckJkvMCYcQAE; 25:cOoRbgNPTMuRQJQ5acNhEda6RSwwia1DhxdiRtiDkYqYCyXUST9nWtAm/bI9wTIsFilr6K8loWuB3qQfR+CqaLYAhG41V8CEJAJezkVYnlIYdpx2yNg0okvToQ9pAdqYzRZ9UqQB6cPJs2qIpb6aZPyXsO0t7UTnCXjcbAhqrDkY7iHKnpJkE2215B1+QPWkzbUoWZ5wAVs60T5TYQj0RCXhm7tanaVYQD7k5RM1sYHATsGhkwFlGHBMnniyIfFgSt43G0HJ3vWGXEENwAOKUoBA6LkpE1Le/XQAZLOClCHbbUgMUBZ0gv/jR+XpjTPYHRQ5bkKT50vOKw0X2P2tJr25IGQ6/7q2+2UoAU8y24s=; 31:4XnziUONxm1DfknBveE+KxVHtVupOGyRAGAU4d6u03g514/XiMtoN07ZjCuxxYIPxCQU9K4lHw5mGZWNImRO83G34c/z8Rs7oHRECSLH4rT5yA6APgopBN7LhQ8tQxnSB6WFOFKu+lLFEjMpveSj1uAQooyo8BJzxU10LB/kxh9lhhDzRC8oZdtvClXSVAdRzS0QNttePkal2X+x2H7Up1X7g6Ld7XAu6EHX7KdkdkY= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:QRFX3D2ctU8MCiIUS6QWDvt1NLlORW2exkz2gSf5uYPUs0aOuup31NNRi4R+gm3YBSFwlIAzLPjou6Mn+KVbyHEEJ5TF2PoUNzjO9OL+SL3fkxNH/+N9hxFwUJP68fj27JgY9XTVZzEoV5uI+H9cdQIkmL1EPYONXv/dZNmmyZlUx/nWKG4pJ0diIwHu6247dVdbhxo6mEoPXsd4K6eNn6ftJbXWTRYaKxOij4OwE3vjyjmDm1aczFjqMi/Snv/ODBKu60CVmmQMYMGBKdln62KzOIr/1/amDNoRiofhSDodCtGcTP055v/QKQGX6KRVUWSxbO7mjb4yWIw7piLvulKpQhCT55aPFbBDGNDBNCAHIX3VM+jduJLf8wcvJPPRfdZkUxmW2bZeI391PTV5h1xcLpvo+awTKtWPPHjFbNYayte+ftXwfX3dGWDfVwGkX2lisWVNbSHCuHIxT/1Fs6hGLsQ8dJjvI2dVJGApen0cvHulJtki9nETTFLvgrom; 4:Lnf/wFVlz+MF4JhF6UmqvW89k8IRASZRzZ3GBHhBMaEZmLfb03HWE5AsMzAZ0JRQgk4nn243utzuf6X0PF7rh1c0edahSZMf3SrYE5jOqoh9R7Idbepc9GDUNDrJ/SAvB+pKMCRM50lhzHigi3cUGxkOmcxmvx36pUp6CJaL7qBe+g7Oa0tbdIOeq4MgDDoUK7QTRV2AMi2cmNox/tBC7FmIMhzzXvwaar7ghsiSHUaGfhDJ3wxEaeaTSFJsO0+0Zw3AUBSBPb4Gf15p+e61fQ== 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:nzAmHr9v+wVnQWZ511hNEioDCj1nJVXgXmirBaNjU?= =?us-ascii?Q?zRzfycC6hfuUHaAMYBxTm/eqMdiZxRbxgmvshoad6f28uabNPVDOjk/uCWqf?= =?us-ascii?Q?XnXwOUVcUvL9LPW50Gbr7x5pE9pQa8/6FCE2zcEXfEactFHpsShZ40MVOijX?= =?us-ascii?Q?P7haNfWju/U16X1j+bygY5NHeCWvIWDI0lGcLct1vbM4XglW9/x++BQY7Wjq?= =?us-ascii?Q?6f5krs7ZGBkm7I1CXXf36rHiIF5WfMYD8XeP99LAIkHmdnXNGg/gIJ7JThhO?= =?us-ascii?Q?T/mFU9t2w4OTsvch5rXMF8mgiM1u5zIZDEbSLN2u0FdhWM7qDUqvajWNz3v3?= =?us-ascii?Q?JefkMeYR7fFCXoxwshM4uaa6//0lrsx3/rC/BcwABhZEYD69n25kXrG/bkP8?= =?us-ascii?Q?axyKM1MOkrcy9Rm57x8q7Xy7kb6sm3LM46uAdxxlKhTf1GyJvz+3IbVVoIRe?= =?us-ascii?Q?cpnSGK9o7b6gUQrG+48HsF4LpmGSTzAkDVI7DAFZiu+PxSwKRVq7G3LfUHFH?= =?us-ascii?Q?BjNWSYgjQxf7jFZFFseeBosElD5CAgpsOhd/P3uY9I8maXa0d7d40c35rMb8?= =?us-ascii?Q?ARV7PSTKMT/DM6UOXGUwp3zz/zbxDoNEcs+CQ4qbyrCC6j7Lkl3yyECYDZft?= =?us-ascii?Q?zJBEy6/yiOkqi4PMbRO7DX3Th/1gYuGvTrPpI+ZCDQlw6q012avk6pchE4Sg?= =?us-ascii?Q?MC0uZYazNvpGhhpe3mbdKt9LMKZyfb184WqzhQ3gjlQF0hQNbHmWe0zHHiAS?= =?us-ascii?Q?GxKzxjYkjoHEEFN+4M1MvjX4MmEtEMtLz4CufdFq03utOEpY4iPOdwWRVjIH?= =?us-ascii?Q?JhpMW85EDKHILsW8UbODxTyGbnkF4nFoMXjNqVJTA3Um3ibE2Iq9t905fxkX?= =?us-ascii?Q?oMNC+yn+9jSjUHZ4Oe+ZfB7C8GFWKvGxSS2jMEsGT5pzcL3fhSSukC18MrBR?= =?us-ascii?Q?NcmBj324c5QQuQ1oylFh5QfNzsEDMpxbfXlX3fOHjWgEEVF73ovfiTj/pysz?= =?us-ascii?Q?ny3Ytz1J9MYjgeqVOVzGwfcxYOyErFXv02y53VOqSZNXZxB789UZhW2HsJt5?= =?us-ascii?Q?LjMyQh34z1IDE95KQfBwK8kX6GI8bOtGXqzkh2qbfZBJFGzMw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:7W03Kf8hsLrz/U1o6uY7zWyzngsOXHdYwf0PL8lIHB8z1tL7dVxFHRk9vbWnPFJh5zbGPxssnlNuAlCfAIN70l1MdfRL5tS7aH5RUAs9s/bIMdRFvkRvFbP13DnaeVtcNsvMn14IcBkQii7tHueZab8rZqUmKtJZi7CPtIIeG/hgNInTN5y2ZkiFxp/VBAMXwqzaLcr54pL0QlCwqXdc9e7wSaz9zCgeAtW8XHFCjB+hLhF1/0zMFmhYfcmtynRCkSyNH7sLLNQuRu6XCTSenQ8R8vkUJejWsWO0OXPBnoJ2sLPX/7Z+TU/IgrtKJJpdwS6mQrPoaw1XLqxGuISkDeTUPTkmgt1VVHH3Lca6Q00=; 5:YJEdBZiWURyMa1RkKAd89ae6cY+UbMTfOwBNabn/o9KSASajLYWKLVLSewbhfm7IsgN8ps6u7dXGvGnRMmjwpcqRdHujeVCAFgy4SAN/aFFsS8TqdnPiNS3NYw8ss/Fft962lHVIMA8Lv+289UevRY5xOUn5B7aFzfdkuqggqQY=; 24:KtxwZoyUTnHfOXv+uAva/qOSsWJMNuxPCoPQvhztfFpGIqdtPm9I8L6EG/XK2/XrPJlT7P8E7aOuFhqcHXx6kvT7VrYtumGBqB56kSSlkQE=; 7:HU0BYRtODXEXFlY6q0m1ocvVJ2hw8oW+I0BQw+4WncEibEcunLl0AepijggzJVHXiS2mz4d8VwgBh8QTb72pdLAegCO9A5VjWLom0m4iGddgqcG5qvkHFBgwyMIGj93AL2yfajswiZTUxxxUTgHpVvhSJtQV3ehSoeJ5t7o2WqcTpH/oS8eufFzbeVW5LCN65YHk49KV+cPP2RsIO1EzR8WSS6LHFKJgQun6ZXCYp0FVHdZTe7lcWVN6V2vcIa0L SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 12:53:33.5827 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f572dd1a-0150-4e79-887b-08d5415f5b6b 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 02/10] 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: Tue, 12 Dec 2017 12:53:40 -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 --- 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 f71d963..d8c73a9 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ struct cmd_config_max_pkt_len_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 @@ struct cmd_config_max_pkt_len_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 @@ struct cmd_config_rx_mode_flag { __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 @@ struct cmd_config_rx_mode_flag { 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 @@ struct cmd_config_rx_mode_flag { } } 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 @@ struct cmd_config_rx_mode_flag { 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 8a2d30c..2fdc051 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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 @@ struct rss_type_info { 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"); @@ -1675,7 +1686,8 @@ struct igb_ring_desc_16_bytes { 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 84e7a63..263651c 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ 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 @@ 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 @@ } #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 @@ 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 c3ab448..6785b09 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ struct fwd_engine * fwd_engines[] = { */ 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 @@ static int eth_event_callback(portid_t port_id, 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 @@ uint8_t port_is_bonding_slave(portid_t slave_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 @@ uint8_t port_is_bonding_slave(portid_t slave_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); -- 1.8.3.1