From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0083.outbound.protection.outlook.com [104.47.1.83]) by dpdk.org (Postfix) with ESMTP id A15E31B67B for ; Tue, 26 Dec 2017 10:45:05 +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=ET16xkTq+DoWzj7vea9OrAPwbTRFxnEUtT4pHsSriN4=; b=HRUpsgzktX/g1VCS2T6GDWR8jspGvTeJ76HoQDwIG8tVPKmi4KDEz4YDBt/mrXjKQ+6PyQeZrhEntHM70MufaGz/LmCTt5GYkJTa221F6pdDI/uGqd9U38hagMr9wq7wmzJkO9roff62r6wTLptHExcSyjkC/weDnGMWwtMEs/4= 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:03 +0000 From: Shahaf Shuler To: jingjing.wu@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org Date: Tue, 26 Dec 2017 11:44:23 +0200 Message-Id: <3753b04124e07a00c8d45dc8b792f46dd4e21224.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: d616923d-420f-4028-77a6-08d54c455726 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:RbSj8sQf6ldRB7MfKs2HAOnIwML06uDXzVCkql248+ZogGqAX0ERdjpwz7BclDGzoBAG4BfnCifdFvPRGOe2Kexf0GuKtTL9egptT51Z22DCoQFV+LlqcWXnyCSqRXZnE92C1mWyWsZgnSUOOC/UjLdSi14WcFaTVyfgGRuT8Vfxn2iaOmiOMsvXPh5JgyO/nxjwqJ7MqRd00wrft85LyQ2KOBA+eAYZll/TUTbtwp5vzaq8byElzTp/EGbzYcny; 25:CdPql6iwzQ8FZRv9J9jwZuyjaZecfX16tp5x1v4CAiKmVqr5m/u+jbWtqIJiuGkkIYpzjZfwjXTWaSU9w8MSjDNHDakSVldqGRo+NTp6TFW1MU7az23dcJgO6L/xuBpo3+YtfdsBs80ylLQD7TK0CMxkd05W4/Gs4UYtD7G6wE5ijvAFTqadeoka1oVHLF6lx8BdG42mm8Nwbv31uglVT10fgQ1dlJ6XybQ6mCBEQ/G3SCui9IqOqSfdLmY4mAAfvzFmSAIZ6VDF6x7XRo5p+Vtk8+zeLvruzwiJHdfI4m5VLaq8gy3/rzaitRjluds6lKhT4zcE2mHUViHAsjMjmA==; 31:6AQAn3ar6NC1DXoPIFWa0hyDg5fIvLgCObYCj9KH+efoLz+AMqnXKlV8B3oQHIN/VNpSSMPjtYcivQ75M9/NWAuzzKPYN1eWNjMYpXIFKLRTeJvXCwj/fXaOwp2j3fJWdnmQrq4oCd/EkU9YyELmBmONMDppVytK8IOlcYPEle5qH9fI/FPhuBUPs+tY/DGBhNT/JexrPUPNwUaxo8oBXCSO+qxMG14AETX2P2de30U= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:NktfoCsXmCxdxiAFOTLH4IDaoH41fiRP7BAgWnW+jgjx4dPmT4lBYlDfrnYO0VPL2syY9aQ763spSvc1keO6LW+/03AJLjKAbYZxfyt5KYuPB2IvLjVTG9Lep68fmqUZlD7HnBO8RsQrONyuozKBUoM5Cqk+a9KcTK9+0eSRYrbarSlulkX3Yqb61vuZFRJ5ztxdsgrlzSUvevEUJr/Aa9vnDpZCXbWmKMBve0uFAzelgbw/fDYerary6T6pcvI43LkzRHzv1yopoAztpTLletwum4Yewje5whUJvPDZkl4ZlRkjnauBBWh8b71afveT+Qvg/Nwo6OX+i+CZkQ2n9VT+GYpLlkSA+f+F4CB5Bss5F6XF9n3H8S1XkGsPnL7ixa5LsSbMRzwN0ynrmZztwd3Gn+MHPNkJuZbtMANoUzvYntjMpR1vv7fXfxgTiQuwNWK0gwOsQ1p8es4u1PiPoOW0xRaCA84UojNAkSEk1G41UE/eAYP26ZclH8BVTSwQ; 4:s6Z0TKJ/HbOFjGvIagc/A9/yfm8hYWJjPaUccuWb67KJHbI5xmtcS2Q/P/NmdIITq8CraB8xv/uJTG18GoGZMpT2wAaJ3ooiYjKoq+nSvpaxm3XQYJybREz79FLCFDjw56ji1zPsaHnH94QqozWMEFSKLZYUtGeYAHwmTBYFoTKEbTKUNGgMgaPbqjcZf3CCVRtJpBXg0LVX8W5EIYDQGvuJNLhnbJ3QN98e/ukmSTwucLcB22INrBZJKSR8z8P+sN6o4e4wYVhYpeliWQ5d8g== 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:GnL/wwAmepeRhDihBKFX/E/qeUZdSsmb05LG+91mp?= =?us-ascii?Q?BVL1Ayv5EFteEDduSNM9advDSJ//NHYB4vzmPd5833qa+Emv5C2TjZHICM9I?= =?us-ascii?Q?AKcjZnJk1T9ExZ2Wjuf+Kev3WpKrkKnvZXCpbbPxJZwjADoRgE4dpYhyewdj?= =?us-ascii?Q?TaomKAhWERu0/INcvJQfbWXcRfWkbD0bZvibI5ghmdl3FB0KGiVzrH9DW5PZ?= =?us-ascii?Q?ytutWQTOclc5ZyC5/NJx+DDCw1o+bKMOFOhLdyKb4yt/CjblIvDpN8Bl79qv?= =?us-ascii?Q?PcJRRL0Q2BHaHgEVBBKJK6fYy2C8q8wdZwL5JgcvEk7L+YuouoPpn8Ih32Sy?= =?us-ascii?Q?mRBDZ7xdZ7F0AwH3mjbnlcqeUIvFQfExCOvNToslI0L9UfahQFL1NLZBwOGb?= =?us-ascii?Q?+z+yNx/IkL3K/8lB46qllNygcjDfkMvtq+JZdEPgBYHdXwViYW0k1JwsLe2f?= =?us-ascii?Q?ZqXNNwLUibgEgiHQdQX+3Mqt2NduQ55d5E2KiJ2MLcfwWpxFdsZCEozi12a9?= =?us-ascii?Q?C3ES2jNvNA77AYgGRdQa4xp17OkwR/m7JIQRjFUiGyqw6tgg7hdORXzyEOhW?= =?us-ascii?Q?AcHdkM2NAm6hWgSl9U8w7TR9qZFLRrX+1opfFuVXz0I3RbEsLZHzvJSlqVFb?= =?us-ascii?Q?gJ8xF16MFzXs79PQ+VfYOO8oWrYTAII/bNXIn+mZ8XNLEeS42Az6LRSjRvQX?= =?us-ascii?Q?2MokGMWbafZv55bXhHrbfeZ+CiwRKSYpP+kslPGlsqqoI2xkOdRo1IJSgv8r?= =?us-ascii?Q?3wQKT+BDLbeseN1ROU4t9y7HILE99mUNPamsPlmmgMKUPlRBEXdHx2XIPyrc?= =?us-ascii?Q?s4tmoNUsLKDwF26Cw7BSSzt3QMxqcPEa/9J0X1Nwxe8PSpDa/haSTRc6Q4Ki?= =?us-ascii?Q?nFKTgxzsEakfg3sMccRePtVICDZNv5EbKLzPSFCaseJDCklSvM3qHEzV4Xmb?= =?us-ascii?Q?lXQR9q7FbYPKDy9/1ExRaF6AE9yePqiy+TBh7REooJQeluyfKgIh0q73P/BZ?= =?us-ascii?Q?8sjx9ZbUVPpHPqQp2wimfb43XM/4AC65zcbziKeS5Y5PIj5BHSXFBEXKm4QR?= =?us-ascii?Q?WesJGrZNn6fMtOQvpRglM8Ou2kpV7pOcEHQRAGNSxGPaKKbGhR4FqqMlxJHw?= =?us-ascii?Q?caCynjBYRrXD7V82MNE1RejHDWWb2yiwEbtvrQMN+Zk0TmzPJEuVg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:G5Jq/J3GzPJK9TPwhmjDEm0/fIGiKVs95RmM2I7lEeJy98li3Jtt5wx9lW8aceu9+RBuhs87VKsElqXv8STQRBWoVOGz6cSTDEzOnJqqRpvAm3xSHdn6YqK/jKPRJfElsD4/O/jCb++LmBz0lIHOxliZiVWP5NmGLQEFhOGg6L9E3yXmArAWY2iKGW3dPdhtSDrjcZL5ibVxPTu9OX+5WOBA6yX82s4dyIgRSuE729NHkOnoaDOaONBksXasXATOs8zs0k8apsdYJjk5m1QgWDk2pGhza1Y0d9URQSte9npjCKzwVdPOrmHZptZkzxSDxkYUHxgtKLsu8HbGM2Y7YVp08+mz22q7ONurFq9XioA=; 5:N3z6JrdsZom6KxgHLsqm6B5Sid0/O/cmcFSTRWNr98ep8jpWYcPnuwAibc6kvyIImSuL/N5hPledAar2S7pvD7+TNqiyJxC5woq/WESgXUMwZ53SoUPv8bCm+eq1Fr5Xf7unpg7UrjuocV2p+ijXOl62Zg2q4k2LLzau1xVYZgU=; 24:yMQ3jF0ctb2141gF2M5abbnQHgelPKBLXTZPdOacH1uUXFuc9WhocASNk+GaZgmgCi7Ek+06bKItBFw9M5uAHMdqjP/IWWYrZVjtMKRC+C4=; 7:JcwLqACWqCynUMvQoLjpHQetA9qbZZVKOnv1GJp1OCLIpw/hQ7odXjP3LSnr7fYKBmjQJ5CiiW/epCB1gLMge4vPqpG/+zML3Tum8DAPTBb61IEWYl5+2SSiGxV6YYf2zfWopQ4mhVau4i15u829f89jaPIJBXVTF6Y6yqUDSs4Kcebdypb9HV15YdjwDivFtlff9G4X43dbs8XNvpiyi/+ELKS0OFcOYAo4yZ5P9+gKwW1Izlf91QlcX82Zvv6i SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2017 09:45:03.5136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d616923d-420f-4028-77a6-08d54c455726 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 09/10] app/testpmd: enforce offloads caps 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:06 -0000 In the current design it was possible for offload to be set even though the device is not supporting it. A warning message was printed instead. This is a wrong behaviour, as application should set only the offloads reported by the capabilities of the device. This patch adds verification for the offloads being set and make sure the offload configuration passed to the device always match its capabilities. Signed-off-by: Shahaf Shuler --- app/test-pmd/cmdline.c | 103 +++++++++++++++++++++++++++++++++----------- app/test-pmd/config.c | 14 ++++++ 2 files changed, 92 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ef1d0eb..d1b8dab6e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3638,6 +3638,7 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint64_t csum_offloads = 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); @@ -3648,21 +3649,53 @@ cmd_csum_parsed(void *parsed_result, return; } + rte_eth_dev_info_get(res->port_id, &dev_info); if (!strcmp(res->mode, "set")) { if (!strcmp(res->hwsw, "hw")) hw = 1; if (!strcmp(res->proto, "ip")) { - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + } else { + printf("IP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "udp")) { - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + } else { + printf("UDP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "tcp")) { - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + } else { + printf("TCP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "sctp")) { - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + } else { + printf("SCTP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "outer-ip")) { - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + csum_offloads |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + } else { + printf("Outer IP checksum offload is not " + "supported by port %u\n", res->port_id); + } } if (hw) { @@ -3805,6 +3838,14 @@ cmd_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; + rte_eth_dev_info_get(res->port_id, &dev_info); + if ((ports[res->port_id].tso_segsz != 0) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { + printf("Error: TSO is not supported by port %d\n", + res->port_id); + return; + } + if (ports[res->port_id].tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_TCP_TSO; @@ -3881,24 +3922,25 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; }; -static void +static struct rte_eth_dev_info check_tunnel_tso_nic_support(portid_t port_id) { struct rte_eth_dev_info dev_info; rte_eth_dev_info_get(port_id, &dev_info); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) - printf("Warning: TSO enabled but VXLAN TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: VXLAN TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO)) - printf("Warning: TSO enabled but GRE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GRE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO)) - printf("Warning: TSO enabled but IPIP TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: IPIP TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) - printf("Warning: TSO enabled but GENEVE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GENEVE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); + return dev_info; } static void @@ -3907,6 +3949,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_tunnel_tso_set_result *res = parsed_result; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -3918,6 +3961,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; + dev_info = check_tunnel_tso_nic_support(res->port_id); if (ports[res->port_id].tunnel_tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | @@ -3926,11 +3970,13 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); } else { + uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + ports[res->port_id].dev_conf.txmode.offloads |= - (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + (tso_offloads & dev_info.tx_offload_capa); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3945,7 +3991,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, * is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - check_tunnel_tso_nic_support(res->port_id); if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " @@ -12995,6 +13040,7 @@ cmd_set_macsec_offload_on_parsed( portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -13003,15 +13049,19 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif + } RTE_SET_USED(en); RTE_SET_USED(rp); switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: @@ -13083,6 +13133,7 @@ cmd_set_macsec_offload_off_parsed( { struct cmd_macsec_offload_off_result *res = parsed_result; int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -13092,14 +13143,16 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].dev_conf.txmode.offloads &= - ~DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_disable(port_id); + ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif - + } switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index faccb84ca..d32a4672b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2792,6 +2792,7 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2803,6 +2804,12 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) printf("Error, as QinQ has been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Error: vlan insert is not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; @@ -2813,6 +2820,7 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2826,6 +2834,12 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) printf("Error, as QinQ hasn't been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Error: qinq insert not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; -- 2.12.0