From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0068.outbound.protection.outlook.com [104.47.2.68]) by dpdk.org (Postfix) with ESMTP id 30ABF1B1DA for ; Wed, 10 Jan 2018 10:10:07 +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=xhEmEXIU4HqDYY6zhY4Utw86mhuvVugmbE0Ypy+UXOE=; b=IsDoNq0Q49gMFLAeeXMhtsZjLQQd5hSdhvFdh7jvm+DgUoBjRX1hS6n/OOBEV+zabz1cYtJMNJoza6hDsQsF0Ee+NyInOVYzLG8cwcibE7zR4CcKDr56Y8AKiw7WYWCsEExw3r/lR3rFZEwDXl03wfcCwZWba8TIxFzoRX49dFo= 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:10:05 +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:18 +0200 Message-Id: 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: c69fa6c2-dbb4-4fed-e695-08d55809f0bd 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:c7EbYH5pDYC156+9qHJSzCUpw3IIAkGCcLp1VT0muY++XK7BP1AquuaHndV8860+w9aDNI3E08g3R3OY98Z0Iuh16zDWUUqoBiY7n9jfMAbBaPtECqrmltTA1w/pazh7Q1wsBxIakxGTusenm7T83rBKRWn4IpGi62nGZvpodbGpja7dSD0da/ZxII31O9NnJ86Se2gfKlTd6CbaSRPRYGCL/CgoFWfMi5wakRQBVLPb0tdUlp768hIlcDZ+NsGZ; 25:NnRv+ViQNzzKKfUME4bOy1z6y/QRUvzhCKQ7RNJ7UV2HvXDgTeOCaHTvxdT7rrYBt1C4r/vFdBw6fxwX7wCc/XG9Gawh3c8xOVyEiZhzuxHFo52G/aJ0iED12CVao7ThnFWYz+TsjBf2S8onaOd9GR3ODSYdnSYzm6uB8VLdCL+AkqZMNmcvDzWVKRYMJ2IDIiMAiQ0txY8IdbPZ2r4WJoHipjplJ/h6C7k5bkEPwqIS+6FwR4gb+JaZzXDeZNV/+707pWfkN2/mnS7v0yYiwVkE8OclqUDrMCxOC3tV6G0GEwDJxQ2eOPc7oVdNod01guPc7/Bnd88amwIoSr4sRQ==; 31:Biq6LJuWGCeFa6dwhkr65+ToRcqFjKvVlADZhhm6tn6WCZ+O3sGjizk4sQK+p9R059dGy/ssA2AIii7bjkceh66sMTuW0s33oCioFP64hFJWDckPEC1CS4v3XmBnheiD5bIaj6nazUeYTBPaXBubxWDHTtGHLvQ4fF0LKFPgzGB4rsWdy5qhagQ+xX46OOt7Ga73lMsN8LmchH/Fe5lSaYFmy6q0EadxCeof3SET69w= X-MS-TrafficTypeDiagnostic: AM4PR05MB3137: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 20:+pPJTr9q2c0ljXkLzCXPVfunGoDFwtfoC9zXQ4JyGHu04PnZ6tHDRVj8GavzQn2kP3sqfI5Od0afXOClF7Kxl9fbMCxBb2tOT253Rw/AevfQZ83eJEIJgIXqabdPVncwgk6BPBxM0fmAupUE4tWboyPcdmKiAorse8w1j/6hap+GIYW+U5E18IzkDxsFR2HgcNMIJxdJJXfyGF0rGvR2MCFxjgp7iC4ZdcKgYR+jN+HJDKDBbTWXUyv+A4xzQnQVrDOavqimPwhNu3MdrSuwECsPnZovICafWYezaeQOut1xhTNOHwbZ+FS93LCqASMjrXlpjGCQ7wN33tFOh5ref2lt1Ke9mLTsq/NT3PB4lbVhZwp8gzNo5uTfzMUttPYt/AgLJWKevWL1s54vMdfbD4/JqYMPFA0lZcQn0lKNZWHLlLZOdhftxmwSI/T9CVg1SKOzwnxU9JgVJv4/SfSjRC2N1Yp2GYQCn3mqodydj7Rq0tMsOXU+IvtsgegB2aeu; 4:EzxDUeRWy58TUYWFxjXTfa7BdTBvGZylmp7Q4DFUmhywhJI7aIpaphbHpmg/bNc22CAxpY2uALgv1zGMLTcJIMFqol/F3cHxx3psTJG3jfgcq73W8iQNU8jfWHqMTVqt3HiqNCX/+kuK37pJCg0JV4x2MIpLCmGW1ctTgFo8vZgLMwx99VHBEIw1iNH3Q/PdjSAp8IsvoQstMrzudrI2bststHBR+f+nigH8yqwEpjvJ420Gq6ONsmxBrBlq0Baw0uQC6zc6cuHNbDy6qZocEA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; 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)(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:H5YZTmH2QIukz5rtNHc7YDe+QH1LMPsK4D//1+Sw2?= =?us-ascii?Q?PPqNlBjrZwmCel1DqCKiAdkZkZrurvMmn4l7rz7mWZi2jgwtSJPnr8Q+yjLg?= =?us-ascii?Q?6EJjYy/0QZ2qxbUARALq8IZLWSD0P1Kfn1DZGqEL28X+lexFQ8V0Kg/r/Bot?= =?us-ascii?Q?myfxRcZdvGhUJ9yu9fC8I2gL39GEIXvc0aBB3PAYTrNh+DX1cQqze9bcX0LH?= =?us-ascii?Q?j+fpIeN7Q51p7NXpCTJIvejYnsZSDf5otzzBEveSYEajHlTUtiveBeut4XS9?= =?us-ascii?Q?Rhq4h31OnaAQLV3U/BhyMP1bbzlimcjCw/VkYVwB8lwXPy3yirvnmW0cK7kN?= =?us-ascii?Q?7LX2fNCfN55zc40GjB0+NEIf7aMJpY1AXNS8TD9f5zyf/P5TMeY6N7k55eJT?= =?us-ascii?Q?q8K9hMfMLWjJvsWqHq4WvMEgtDowjiuHTowU30SZVT+/v1IBkAvvThaz6+K/?= =?us-ascii?Q?CxYqPAelmvUZ3OgkXRObQRv7uG4qdkgJdhxUQs1PV5MzAuY3gi1Q6hhjrdMb?= =?us-ascii?Q?LP2xg3sR1yowGZXa15LcrWJIHsh2jpxsn5iscTKipD4cueWt+D9Cq8HU8hmV?= =?us-ascii?Q?FG8M55NeMNVcYnrR/MT0jxoCFg0/0Wo7rRx7Qenxa7h8kM4Y9bHCDwcCJG9Z?= =?us-ascii?Q?ir46hGu1sGkTEAmeLLcfPGNKeMHhxL4MeKST1M/fO9y00oXTCbYgNNVWpC5J?= =?us-ascii?Q?XyGzRRdoKHjBL++O51jN5IyAKjVQbDswDcNas7YIWLNw/y38Xnz245Zypgyg?= =?us-ascii?Q?Ar1KquGvQrTo9J3qfDXD2SlcF9uPcsYJC113hBtCtqAlqvpj7xLODP38sYKF?= =?us-ascii?Q?NxPA5Jjs2EIBktc67jyFB7EoZCpCs0cpVIARdsH4nDgKkZL8aiJiGmn7rTO8?= =?us-ascii?Q?11+OfE/rPRn2DjjgTfp7UR/zZ7POpmiPsLG+TdmB69zOi2RvlPK34ikeUwwl?= =?us-ascii?Q?ptYDgIKBCIB7fmwvxFDMkn1cdIQLpVlXKqaaybOy2KJlbvpGG+LO9DWqo6lF?= =?us-ascii?Q?YlmsHJXigS815Qq53+9Ch/w/oXgEh4ZUOgfcRsJtWwIBtyVG20ZGh5JFXJrC?= =?us-ascii?Q?p2VuVrRrNULh8P1Le1kuoWYUHajOuWc9SUYzEBuOJifXrywcDgoifCQGdT9F?= =?us-ascii?Q?jXI6bUyNII=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 6:6dVlvb333ZkMug5oaH5VblXo9cJAChmha1uWg3EmfBQp75BaO+ELExoa524eru25L1PMeKEb9m3sZQQFt2F0/dTidWNWyuyo2yOdROCplZc5golgSrr9a1N8/j8qZv66OVxScJTMrzlZR6Ob8GwFvtjiNsMSTfoWh+oWr0nqcfSxD8dEjNur/Nh2YUMHy7TQVnfgwx+pQqBpDEf8wghKRFIR0F5bxeKpW2TWaacSWtDbC3SQNpxb7MmyL0u0NDge4V0rTc8+Qr4nwlPq/nGdQi9Bf9mrHOnYFbn4/MIoz1dwBZayzZXKzBJLta1CKjfZcNP8gVyT9RD7nuBHWHMt9uiLK4b48Cm8M0yHMyVsNHw=; 5:fT4esElRoTLfkiBS4kq2r0S4XGvgxmq5Sv7ktpGr6UQ8jl3PhOEBR9yZLwIqoyXrkl2jVkbI0/EDVDomDeIhQCl7fGREevGMp9dUJOo31cecmJtm1GXOQMZKoBjwLymmWZDB2dlMf2kWsd5XaM+76EhmkIebbaNXDnUYDuK7JoI=; 24:uM5E7KB/d6WOqR/4ShqcLr2t4OI3bS4rsr7Wzc4eGxN78zXbQmo4oTllRAiYo3OZUjauJzICSy5vED0lT/bbkFabgUDQ72MtZKF/qB7hjb0=; 7:wUtttoJdpN68dds3I6ho00rlBDehE1w88QoFmbWGo2K1ZqaK6EXSo5s8kdAyPzpCP9UuuNyaI9qPFTMfpxkOy27zR2lA9gpcjR2MDN6821YGHgohapSkd6NHV1RufQ1G9g2H4Ho35HYZRqtGFwiyqQmmw3u+UjGA/HFy0sXsNHXZ3guifHz44sYiEuUyA+z75+XQ+LM8B5Q+EZc5cIh59a9hVefG92Xes5huun4R8pG91g+s9CsQxaHYOT+YBth0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 09:10:05.2220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c69fa6c2-dbb4-4fed-e695-08d55809f0bd 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 10/11] app/testpmd: adjust on the flight VLAN configuration 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:10:07 -0000 On ethdev there is an API to configure VLAN offloads after the port was started and without reconfiguration of the port or queues. In the current design of the application, when the Rx offloads are changed (through "port config all" CLI command) the port configuration is overwritten, therefore the configuration made for the VLAN is lost. This patch is to address the issue by a configuration of each port Rx offloads separately instead of using the global Rx config. Such adjustment is required due to the conversion of the application to the new offloads API. Signed-off-by: Shahaf Shuler --- app/test-pmd/cmdline.c | 217 +++++++++++++++++++++++--------------------- app/test-pmd/config.c | 27 ++++-- app/test-pmd/testpmd.c | 2 +- 3 files changed, 135 insertions(+), 111 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1b8dab6e..00a229a41 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,34 +1577,38 @@ 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; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { - printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port = &ports[pid]; + uint64_t rx_offloads = port->dev_conf.rxmode.offloads; + + if (!strcmp(res->name, "max-pkt-len")) { + if (res->value < ETHER_MIN_LEN) { + printf("max-pkt-len can not be less than %d\n", + ETHER_MIN_LEN); + return; + } + if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) + return; + + port->dev_conf.rxmode.max_rx_pkt_len = res->value; + if (res->value > ETHER_MAX_LEN) + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + else + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + port->dev_conf.rxmode.offloads = rx_offloads; + } else { + printf("Unknown parameter\n"); return; } - if (res->value == rx_mode.max_rx_pkt_len) - return; - - rx_mode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) - rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; - else - 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); @@ -1706,103 +1710,108 @@ 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; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "crc-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; - else if (!strcmp(res->value, "off")) - 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_offloads |= DEV_RX_OFFLOAD_SCATTER; - } else if (!strcmp(res->value, "off")) { - rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port; + uint64_t rx_offloads; + + port = &ports[pid]; + rx_offloads = port->dev_conf.rxmode.offloads; + if (!strcmp(res->name, "crc-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; + else if (!strcmp(res->value, "off")) + 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_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_offloads |= DEV_RX_OFFLOAD_CHECKSUM; + else if (!strcmp(res->value, "off")) + 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_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + else if (!strcmp(res->value, "off")) + 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_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-filter")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + else if (!strcmp(res->value, "off")) + 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_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + else if (!strcmp(res->value, "off")) + 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_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "drop-en")) { + if (!strcmp(res->value, "on")) + rx_drop_en = 1; + else if (!strcmp(res->value, "off")) + rx_drop_en = 0; + else { + printf("Unknown parameter\n"); + return; + } } else { printf("Unknown parameter\n"); return; } - } else if (!strcmp(res->name, "rx-cksum")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; - else if (!strcmp(res->value, "off")) - 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_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; - else if (!strcmp(res->value, "off")) - 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_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else if (!strcmp(res->value, "off")) { - rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-filter")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; - else if (!strcmp(res->value, "off")) - 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_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; - else if (!strcmp(res->value, "off")) - 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_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "drop-en")) { - if (!strcmp(res->value, "on")) - rx_drop_en = 1; - else if (!strcmp(res->value, "off")) - rx_drop_en = 0; - else { - printf("Unknown parameter\n"); - return; - } - } else { - printf("Unknown parameter\n"); - return; + port->dev_conf.rxmode.offloads = rx_offloads; } - rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d32a4672b..da968cb64 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2665,21 +2665,26 @@ vlan_extend_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + } else { vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2687,21 +2692,26 @@ rx_vlan_strip_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_STRIP_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2723,21 +2733,26 @@ rx_vlan_filter_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_FILTER_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + } else { vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } int diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 91dcb31c0..c1fb387fb 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -603,6 +603,7 @@ init_config(void) port = &ports[pid]; /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; + port->dev_conf.rxmode = rx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { @@ -2089,7 +2090,6 @@ init_port_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; - port->dev_conf.rxmode = rx_mode; port->dev_conf.fdir_conf = fdir_conf; if (nb_rxq > 1) { port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; -- 2.12.0