From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0062.outbound.protection.outlook.com [104.47.0.62]) by dpdk.org (Postfix) with ESMTP id 4D70F9B6B for ; Tue, 12 Dec 2017 13:53:44 +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=YZi9N4ve/p4bnPQhPVE9CVRZlWz62fZMnqL/A3AlQQM=; b=Dnry8QyEQNg9TmfvImoLW+g/FudDceyefDwlz+XDKTOiaOT3ItXpnxapEH1/IyK1kQc5RQDBtH1KOm4x/Vc60KsmdVGrEHdEoHU7fYGd085VLoWx3bjLTmlOWQmneKVBs6qRCJ3iFqGW+0EXQeAXj0ebS2TdhB+nHnYURYFkAmA= 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:42 +0000 From: Shahaf Shuler To: ferruh.yigit@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org Date: Tue, 12 Dec 2017 14:52:53 +0200 Message-Id: <945f07f4d80bf2700104284bedd71f3c401d888c.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: 467b7a63-ddee-4796-7bd8-08d5415f602b 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:+lfY7u0mlIxNpySXdJAItf92jyavjbo0NzjAwMoySxnHA+DTUx0gQFCLDivU43FtShCe/8l4hH7wAmukna6S+I+F0RhuofIcEA2GV4hqMzLx9WuiO2XHAKDWn3nSFP+ltuGh4SNzvwScnTQbFVxtX8lCws6Uj6GfMn4/NmFclfbCcYQO0gYWbCzuHUYZ9slPP+dIzbybx2GDtGFKgKc0LjgFW/OqvQrUANHiKBM4TREV/xPvemubzqPPy18W5qpD; 25:wWUUHczNF+pTFk01iVSAoRtT7l065iaYAwEuFF+0rVF1fvHd5qyemzPjNcUs0sQKlslYpbpVFCnIKMUkcRjMmfJgWmWGtu/i0ZlXhSIuqygakgAH1ZD4Y5y+GDJrdZ/nAGKQdbVghfJke50KmbSbFyoOcUZS3Imos9YT9FGSWcBVhLwPjZwS76Sz3cDV4Jmz/Km6gt04k07mh+wMHx5n6u2vDqIVoUFgfViZ/HfGEdqUm0edDe4A/MySJkT9fHIzLEOqIEYfgWHoplH4g9pYRCP1OE9tpjFiARfJP9ETWIiDMgayR3Yo2kUevh5G7MISP0+i2y43Fzt8alInzsRM6XoD1YgwPNlrHIZAaJ7a0nA=; 31:N8tvP2tcgWbfcmxfyF5EMYhQIRo70K9uOeaJgjtMtzbcPn8TKfXH7fdTaBbujHCATzoBmJwZZVtacV9pN0fFD+KU4WeUak8+r5H3Jb8sNUP6Wx2EQmX6+BAT7z6/tNGf4N0/+VyTtFJG6qIrmS48tefnXVh4s6Ww+obbeZ9I81TcbOXBlWC0mNz7iB4L+uTalvrtFBa97i8Vj8Fmaug18YKje9hQHokNPQCieUqVj9g= X-MS-TrafficTypeDiagnostic: VI1PR05MB3150: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 20:xI6MITxsVA1o75ZTCsidrQ+HSUh5oFAoc4LYf0aHobAi5VwyA+Jt3ygT5luw0bkhsqn+EXdSXlLhH4Ut96rAsK08oH7Wv+J9q0N5V54ZM2Md/X61Xj7Qq2cscrzIFxXSDP95/Kf+so1vHv+iVD+PUxKGb0dpz55TrpdB4PMXoid7Eire6rt5KFvcAHomYkF2nhzObO94sIGcd8gThXMYSDvtjkYIoOgJ+UyYQNoVb26vzV1slLuaSJShergINw9Holyk/zRsRZo8fuhK1JTPSiIFjNXZsgSeLwvzpDHIZHi68ZXHhPyRMticyBWAvKhgFfDYcmWmPjfaOB2tHndqHHEcAiprMcaeoUsNhaRHuN3S/ToDTBOiPaR8q81o2qjmh4G85JNyBQoZIDMikevUc3cNy6hkHa0fABIJ7Sr/fjlbq+O6Nm499UcZQFf6lPunKuQcbrANW5YDN0sl8ilsgro4jFsYXfgnM4cm5zQ8+2ZSdwb1ZNEhsG0ox/7FRvaH; 4:0ucfKzfcX1w0XFCbT18v+/10N8x4/+wMRFFZKKlw3pXynZTxHi8x8V24nTUmmOg9sI06PVNaokcDXdNT5zUAP8SfWoa+9OPOEcSJwmINYdeXBHVQg0hTSiRZw3n3p9yKL7yadQPDM0KA3YJwEku46auYow946SyM5JgCAcntsyggrCVWL8KaDG3llYGYmrt3IQ/CLg5kQ6Qs/7t8IYUQesob7U2bp5q/dRot3xIiJxibPEmw6SfBZlc+NiYVz21wzmQDcvWQtoju57KlV0cPNQ== 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:rsE7cnNnArsBFFGnJLb7TUVPDOaM9eW15VDUj50y1?= =?us-ascii?Q?xZWAWM/Hs9X3RHjBIuiLzLZZcqqq7PjrFwiiPBcwrHc4I6T2EH9x2LH9UhNs?= =?us-ascii?Q?wpqgghpxVFvngZpjuqGgsaYm7kg3ogEFJldeMOfRdMOK4+6jNoq4KYYSD8RT?= =?us-ascii?Q?WBBBAivhUGxdM/DfU0oaOlUk2AC9jz1/5X5cYpHdEiW2xv0d8SJxVeiASUJt?= =?us-ascii?Q?ZQedbpLoZ7zqq+eVvhP9FRCMNx7JM8evxnMSDD9QxnxrGkyQAPsLyPr3GOEP?= =?us-ascii?Q?yKWL4N16vGvHIOlfUJLVjDavhXXYUQKlFwbkLol4Dh91z74YNLZdytUE4KcS?= =?us-ascii?Q?PdjjYAfyn7s6HrahhfsiaHL4pk5K8tW6Hqf23zQ7tXXxPUskHZKnafaYJ44a?= =?us-ascii?Q?IRPViLD8KqZ+HZHjoRJWGIPBEatky9wJjd7mHn1Z5zL1A+EyNl7JiXNYBjlO?= =?us-ascii?Q?WlssSOrromb719FFgwP+O3hkOCkIvi/cBqWi0582kUZ8YcwWjiwS+sRCkqgk?= =?us-ascii?Q?LIXjsZdwuOCdcV2chN0pjlc9fUGl1tBJTpCaoMr+vhuvVNHMCsuEcHKjjQO1?= =?us-ascii?Q?cqQ9Uiuj03DcV/Y25TjnK2/xqZI/2Mj0n6+cCu7CwTuzF9qPCgGLCa8G7X39?= =?us-ascii?Q?rBkM2jV+geKOwzKHQGIn1yBz5hBANH3GWbCrAbN1169kN77DAV9hMrdqpgBK?= =?us-ascii?Q?Jx+n7BAISSpVnwYhN6DQDlW6Gl0B8Td7s4oYGNMrnQC7REkvd3qJnpcygm4O?= =?us-ascii?Q?aRaAZlBTZznyoxWeVBJuEXrVwaZuz+9Yv4tqKVRzyVnLangrv+ijF9EyC1AM?= =?us-ascii?Q?tb/44ZdW09UDFG1OAqJoxBhezhCp9cO+M1WrEk4CZy4jgfhqITvr8BBNvMGX?= =?us-ascii?Q?0L9fwYNO5oB82Wh9PJGKA4lFZ9iG2pdirk7hDv3iTxFdd3V7adFFFGQ1jXoc?= =?us-ascii?Q?ugveYBLQ6lEBTHenKXtvnDclYzInLlcmBojb3yoWV7hQy7/40z6SBRb3I2Kj?= =?us-ascii?Q?IX7FZhumVsq6w/xjA+0RzY2uf1i09uPkbGnPW4d+BzLnUg40xDekKAzDXQLc?= =?us-ascii?Q?ZEJNZGaBJW0oiOqRwbrI6Mojt3DR2v5x4Gf0ev0psU3i/e4Mw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3150; 6:t6ZFAv1QhFBm2Css6hzMzrViuBD50WCMhER5D4Rv9t+gekmxrMn8MYuzZNgr+paqULq4ZqlUxc9c0oiY7N1bvBpWzii5YVMa3cvniQ9C80pBMmxXgDA5d5q3yFILYpWi8cxF5MF7YRyKV23Sg/NDaN68C0IubJyyJk8EP4itOOLM3AbVdlXmLU/MbtfxR9lOBmxmAaFyaYWhpIgAbXEOHxYsuPRoMV2tG4TKohlX7zorGlnUwOHilrotMUl9tJTXfZohPBDB/pcQfEfpzaJnqoM6ydivMKVZB8Kj5EBJqc+tydpIaCfrIwbs/g7MvUZoi7CAeWtNGpKHUd9cGEKu2Q6h3pqIq7L/RGFqjAz16lA=; 5:XSeKoMFuiXUf3Qg/YdPiZ7dqYecD4Z/QRhfJBbyjHX8GMs2BrLmGYijXczvbSPXlc5u3SEm8q7mKnamA9gGfsKem/09Bg8h202sn6OeNOOuT+V4cT0bFZze8CXPTwy4f4M6D6xhQ8CYY64awVLmWsCTSAZtCj9DnLoUFNsKhNUI=; 24:ZFra514FY06veh8U79GCqQGOadbQKk8u4Y1wCwUD0nhZzI8suteNSEwcSZuiCeMGHa4UXqsiCM186XL71b/7oZf5NRJXpo7G1bxzjl7puuY=; 7:sXDwgH0WD7wul+uIvKHVf0bnp+8wZw0ja8xeBTs9sfYCrek+ws4MD7YaNnOnyhuOdTppRnK74MAFWQ5c/g+heiJUcfyvYZ9UPeLaa9EGR0mtyidipp2zDEIdCCqdlZxRqg3yR3xNR0YHnDtZTy7TPQEC6Ak4a4XDYGeW1Rz1zQj+ikqhqgNO3o23CRlDQ47+LcgVEseOPzKyE08J/XBxqR8sQTjhkiQ7TNuSVvaJoeAtU3j2nOwFPscRM5TVMsJK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 12:53:42.7235 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 467b7a63-ddee-4796-7bd8-08d5415f602b 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 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, 12 Dec 2017 12:53:44 -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 ++++++ app/test-pmd/testpmd.c | 25 +++++++++++ 3 files changed, 117 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ef1d0..d1b8dab 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3638,6 +3638,7 @@ struct cmd_csum_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 @@ struct cmd_csum_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 @@ struct cmd_tso_set_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 @@ struct cmd_tunnel_tso_set_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 @@ struct cmd_tunnel_tso_set_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 @@ struct cmd_tunnel_tso_set_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 @@ struct cmd_tunnel_tso_set_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 @@ struct cmd_macsec_offload_on_result { 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 @@ struct cmd_macsec_offload_on_result { 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 @@ struct cmd_macsec_offload_off_result { { 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 @@ struct cmd_macsec_offload_off_result { 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 41855ab..33848d8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2791,6 +2791,7 @@ struct igb_ring_desc_16_bytes { 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; @@ -2802,6 +2803,12 @@ struct igb_ring_desc_16_bytes { 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; @@ -2812,6 +2819,7 @@ struct igb_ring_desc_16_bytes { 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; @@ -2825,6 +2833,12 @@ struct igb_ring_desc_16_bytes { 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; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 91dcb31..3758410 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1440,6 +1440,28 @@ static int eth_event_callback(portid_t port_id, return 1; } +static void +check_port_offloads_conf(portid_t pi, struct rte_eth_conf *port_conf) +{ + struct rte_eth_dev_info dev_info; + + rte_eth_dev_info_get(pi, &dev_info); + if ((dev_info.tx_offload_capa & port_conf->txmode.offloads) != + port_conf->txmode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pi, port_conf->txmode.offloads, + dev_info.tx_offload_capa); + } + if ((dev_info.rx_offload_capa & port_conf->rxmode.offloads) != + port_conf->rxmode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pi, port_conf->rxmode.offloads, + dev_info.rx_offload_capa); + } +} + int start_port(portid_t pid) { @@ -1481,6 +1503,8 @@ static int eth_event_callback(portid_t port_id, printf("Configuring Port %d (socket %u)\n", pi, port->socket_id); + /* Check for unsupported offloads */ + check_port_offloads_conf(pi, &port->dev_conf); /* configure port */ diag = rte_eth_dev_configure(pi, nb_rxq, nb_txq, &(port->dev_conf)); @@ -2263,6 +2287,7 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) * Set the numbers of RX & TX queues to 0, so * the RX & TX queues will not be setup. */ + check_port_offloads_conf(pid, &port_conf); rte_eth_dev_configure(pid, 0, 0, &port_conf); rte_eth_dev_info_get(pid, &rte_port->dev_info); -- 1.8.3.1