From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0070.outbound.protection.outlook.com [104.47.1.70]) by dpdk.org (Postfix) with ESMTP id CAB991B61A for ; Tue, 26 Dec 2017 10:44: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=7CUJrVFW5C/r/kqViwvtLCS0nFBsMF/E4EeQY+Avv3U=; b=mecrk3XFQ+IKEiPTjpzlbGlPcNTfDV2c/kFg/q5uH3ydbd4505wO9bnJflUDEdSxn59UNSHKy57X4QcfpgfUEmmKjE/uXmaCshL4lki2EWp0kuf+rN8Zc7WR7nzrWuX0lo3SIKJHs+nAdMr45Zkq3At3oRWqPwdmDoXnC8L8pEY= 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:44:55 +0000 From: Shahaf Shuler To: jingjing.wu@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org Date: Tue, 26 Dec 2017 11:44:16 +0200 Message-Id: <8cb2768f5d38fcdbef83c0c7df4ce5ceb0dc5c59.1514281259.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: 44a7f804-eae1-416b-9580-08d54c455298 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:jtJYeL2OWlvvpAdEIiObsUW+4sliPiXIjg9xt/p6brYPj8GJkflgEvPaAXZcMH1VfP0EROKa4vlPzanG5ck11GQ4e59fUa7UYlPjM3xxc0w9/9J9fvziGffhijmqgRQ3OFSnJB8zbZK9xI8b8mbkLSacvZMVdRUyWZTAIs1NgLE2PC2Oz5xnOEho2eL2uV8prxTRvaWXpW7MUtVbhmjdJ2g2Jbg1MdbjqRmEPjd8FaJ85za27xf8tvZO20HkQPTB; 25:r6KvplSmASmqYCyQXmnWkkA02l7YM3rfq4hv56hk2Iei8DqOAxCQJsYFpT25fKXpl9ZrHNXBWT2snZKI0Tw3Rnf8Yw4rjA9Dt//9X1e0hXVHgrtsFyCtL97MqB0f9J5LkOpF/eGIeCxgd06agimqRknzG2aJwMO6YzBgMUmN9BgGtr0ATLarvh4vI5HKOZUxSG7VnKWyE72F1g4kBfhgBwobH/77MF3BzUTcdNLyv90BMuGCY5NoWETOXaQIvimM9ypxXYPsnXxuyz9LzIK49XNPzWc09b5+h4KAYQXZQnfBfnnT5a7Kruh84UMylH2l/qd87KHCw4DhUt2MhPyd9Q==; 31:hJNBmDgjOh6rq6rRM2n2r35KrhWXh/eQfAZ/d9UUybNqpklQeup4MxSU+3jZiCgsjmoXWf6v2HAioAMlm3yhIpCJ8lzDxOlpT5WEgn9qnVrzdN49Ryb7MRoYe2Zgmcys3zv6XWNHbx/fCFqQeQfzS4PQFg0MQLtUJy6pA3m0Liow9p2yGaE+JGhqa1cbZbCB8PUUqo2xx7gZZuVUz/Jzm5T2NlhQURVsXESDIuZ81Uk= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:w2sFAr3iAlkLiLR2RVeyr/UtAsM4S9L99VdXNWoP0AMqmFRQTcbx+Gk+LUhmjP/nij48r356A+YNvyNc0+yQOn7aK+AHsVfjBzO8HGiMb8YVZp3TkAN4kxuiUfCL5Re4+doARaPMMtPVkI+YCMDHUvFk14dqeMWiZR2CnERublXIy6vNxRb8fmAEsuL36fxnIrkhZE43iBjoR4MY7ckAvU7fYl2DUaz2KdygOuuyBxj4hq/o5rPQLu8T9CjEKNBKtom/pw1hnNI6VGCes0ZjhfOLYpWSTjB0O7wi6SKqIvWCGdn2XLiTpRod8DfD8VWHzMmToGARxwx7r/CtW4mAhxWz23eoqxVSdftJ/rZ9jxbsOkgBnT0tHpCfCMN9dk5UwGxronPt8R2WiwMj9LH4xgRTK2BZhYYNH6Cz76iqw0pP2xgmvkPPHDapVXnOei9CKF3r/BfstJgx2yHDfWVvmqOYdqOWJxNk+ytwQdcApdofHd624LxttWd+Nkg8EX9y; 4:1gCnGJaP+k29S4QMLdF90qar4m4S8ZKJfbsNmCJGrpXCyKZgNQOQhwNg2zMiGIPqIYpYWC4UGviPKxkkzYk3l5pSVQoZPHPHH8BTRVe+YkuVgNr8/eIvRa35s+fO4GDC8Fz9Swtr3Dchn0o7ULvlms88vsx3l2MTkjvJ4wRn90OlxGYnhJgqzoO9hnuUQe0yct4Nhy2UtIrG+4LxUZHFLruEYbyMXhavu0jh3FdAtWi5I1r8GouhYrhh0Zw/h/Z2VIvEDXpzwv8IVa1oIrxA0g== 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)(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:1TbRDxZFcjRqchFlPfaAalcWJxCc/GCy/ay/bfri3?= =?us-ascii?Q?zoidGp5KaehvowZ8KlmPgijGZOzfIpZiAsLoTl4InIH7Mbs9qSBy+QE/xeEq?= =?us-ascii?Q?pnZWAh9yLFy5ZnlKEQuKVewkWDKKOHKWbT30mneWYCrRhcrGwPlaiM+IlByW?= =?us-ascii?Q?tcCp7DqBySaHufdYhQY2y4oN0eCXqifvSws+J869EqSJYLfwYQOJuAID/ymw?= =?us-ascii?Q?tQmo7WX97GlY0LwF+AynohUYVYWLZyIy+lmvzCy5brF+p9ZUtYz12XVzYHQ8?= =?us-ascii?Q?CrA6j3eM4FrApR4LA/eETebaTSMMc7lrM25hLEksGTVC6xaQVrGim+DPrEmA?= =?us-ascii?Q?0hGUbFURCL4AM+vJMDnC6v6kubOvEgpTfCkZWF/tibtaHtFpsNI7hFxGSCta?= =?us-ascii?Q?tfpAJMgxCwdxrCGWynzFG3oK81Wt7Jc0bGRY4B9rtFlHyxmDtsSCPsm//o8S?= =?us-ascii?Q?dvzggBzxIWHEj9a/7OmW++B/iO8OqReXwCkhCnS3OuGWXpyhB46odisoHSA0?= =?us-ascii?Q?ms9895JEZ/gg3R4Xk3XoIXIdV9WeAy3RHWkrP1t5HKMb0h3FN6JiVfVLaoFL?= =?us-ascii?Q?6EzoOT5UrDIygcgIFFOG36clNrEh0tS1ga7S1wPnFZTcSasEkVe44K8viRyr?= =?us-ascii?Q?JKr1+KybjkTP5BeKRXc0NxV5LMU8JkFlWQ8OGf1kQfw6lE6M8mQHU3R1TlIS?= =?us-ascii?Q?Bq9ZtcxaxV69iGCSbZ8i+67VE+KoHDsPPLGSK3/5wbDQ76R1qdKuZCjCkrjX?= =?us-ascii?Q?aZAy2DCtE+c648Zh9Tv6O0+DwfUsP5j0CMBTBZdfg4JVIoJJ05PTwCCS5AcU?= =?us-ascii?Q?jLi17uSLbvonHqC50e5csBpjlNqgyEf+DPlCJqt5JKH935GlfYoL7/WHSgep?= =?us-ascii?Q?LwAk4O07PP0HPy/MN29bg/VA8RheGKbTk7If1Df+wP4cxdwzURIIIN3OUZdD?= =?us-ascii?Q?g5sr41tatgxu+XGDJDxjy7G8MkJAI3P8gZo3DTJqcOxsHgGjB1Wj+4GLpNjH?= =?us-ascii?Q?Iwu8DMq+qoryzjUcD+4vCI0a8ZqBDXMjNtS+ATySk5iDgHU6q+u14DMyab3q?= =?us-ascii?Q?qwFtz78+4sbCgpNOJUZ/pjJ/YoZrDae/MpzPLP9omTFyVd81zK85/WKDN/ja?= =?us-ascii?Q?6bcdWgRcsTDstVrT4EU+faq4Kq7LALG?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:PtPR0ZzAeqsRuD9xFoXw4CDI3qAbwveg80M8GpH+JSrL2HxFkX+gBe5pn1xH1HFiYzvwygTrZPmZ1BlSrumOz0WLv5EbFDFOjo2CSw6WBa6mq82gm9yjWH8cHZqm1f3+li/EZAdmnmFAlmv2pg+YIwM7KDqvXdJKpqGIzvS0BMpOXIpzgMesOARuEv/J7CCjeezEe3lWf9g4pdqvGo8J1eEuUJk3zn6CdRSZALfR6rTnEb38SAgTLhKNsyqkO6zYxqQlsOloKq0OQGEiZafTubaSJR85e7041aBqwMP+gb/N7I1bVeQhdLD44PznkKaGYobhztHQ44/cIF2rHRZ8dfx6d6LewvvUoklYf+RUN7w=; 5:X6lg9OGibdHBEEFhP+mfUXrbLqheHBsWEqIvTA9sR76oJ7xW35ehD9I/j8FLBEVA/JX2c3SYjfPY3wpNNzpXX3TycG37BixoXTCM6xjFnEXE+41wij01O/nHRReUuXO308SRW8PTANZD0JZU7tZjupNIi0qNM1WxLChCzk5ozEo=; 24:hxBSMcdXR/reO5lHiTYqr3XLriWyoU0JyfdFja25/41oWnpJj3ojW0kBRvt+PD54klSidwTV8jCZNxPaQ3gzdUo7lcow/sSptpSR3JbT2ro=; 7:sf7KaNrz+l7c5sRyfWUu/NNEq0ZpJbNSddRrboH6dX/RpHfJIgc3SYFargDvLwfTcJuA/xEZjjPNiz0+eQMlGq2oQKFke4kJwupnChFc1zT+Gmdbo5NQvg1kAo6PXEiGceh8FH5xFL/8KCneqeDQi8Rr4shVeRyXvcdlFCiLlxGH+O21/HlBIlPWQ9sLWqEUl/KmGCYG9A9vJ89AoIz/P02cnEMpeojb+lnj5ow+df12Gb5TJBywQeQl/Ap3lCxp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 09:44:55.8885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44a7f804-eae1-416b-9580-08d54c455298 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 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, 26 Dec 2017 09:44: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 --- 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