From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0077.outbound.protection.outlook.com [104.47.2.77]) by dpdk.org (Postfix) with ESMTP id C9E0D2BD0 for ; Thu, 23 Nov 2017 13:08:32 +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=uC4leG6ou66fhP9wJ75ijgQDMSlbmQ+awu9Y92xqtdY=; b=gxn+v3oxH19idhXTNwBle2DsnexlerfoPqTJmJCn7CLKEQJXQ0D22X7nDyZ5OXwH+eqlx8HDCLifcuZLRZuDpCjCvGqmio1a9d2EeEAggJT+WQdGohm/DbGEuxgkW64RRXcZr3hJglbcEsep3KZMMuLAy/UorWu7ptON5lbBXmY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (82.166.227.17) by DB6PR05MB3144.eurprd05.prod.outlook.com (2603:10a6:6:1a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Thu, 23 Nov 2017 12:08:31 +0000 From: Shahaf Shuler To: jingjing.wu@intel.com Cc: dev@dpdk.org Date: Thu, 23 Nov 2017 14:08:04 +0200 Message-Id: <20171123120804.143897-6-shahafs@mellanox.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171123120804.143897-1-shahafs@mellanox.com> References: <20171123120804.143897-1-shahafs@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [82.166.227.17] X-ClientProxiedBy: AM5PR0601CA0033.eurprd06.prod.outlook.com (2603:10a6:203:68::19) To DB6PR05MB3144.eurprd05.prod.outlook.com (2603:10a6:6:1a::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c07e48c0-f0f2-4401-a684-08d5326aea0d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600025)(4604075)(2017052603258); SRVR:DB6PR05MB3144; X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3144; 3:qpKh/N9ZpACsPGdT4dGKdxAbxAa8NVJU/eLKg3sMfm0lg1O37sWC9gItk7GMTNbS/4z2aIUhRXEhg+uJQOFFL/touPfxN9Mvoo23O8uE8yRtuQ/o6MxGMtofvbJOfqgX1fF8ZRjQpMZ8Y3sgitPdO7M/Opvrh3sroLd3gXezDzVpjxTvziGWrVrOP9a2aWgsRlrcNBGNhW3Hz+4RYDCG8PjmdF1lmPdpyqN1c8WCQBCairx6ukNDjwUugwzUNlfA; 25:+U5TcpnsoJ3YbMHmdki+FB529WDG04A+yAKNpvZB4E4oUgz4xXSVafDihWqWyb4KH23HOI4ll9DVnkzJU+4ev2istEXl9/hjWXuKGEyGjJTSnVtDJV7737nqUis8LpFSMAEILG5gPD6p8UrxJGELL+N9FkJy0t88amrgFZILcVUToBvFfv1QwteH3dsUF9dLIkS3a2POKBMVh3BrFa9gEbLSOZyuBCyWDba7mEoFTyfXoRCbgC8GnFaP86NANZFFqTqLcim4MXPIIt4i9JIalFWed+HrxzjJxa5ChpSeUn6OGzqcdUoRM4dQUveLkWNP/W+VUtYgActU3+H5EBEdtEl3EdWHUN9pp4tWtg7ql+0=; 31:V94HQe5tnHnCzVFLd4uALM1DQEN0iBqTODjbT4t1phz0SEm2Ul26p1acL3j87wDQY85BU9bRW/C9NaXlkVs5fFNmLJg1G/qqCjPOEZPQrnjdMrVIl20+PGt15m5YkWWsQ/qZQw5vUQ5lQsqngh9+SW6IFwJW5KDBP3uaiag3KUcrI0ZfVbTyea6aEELGLRYJTXG6e1NZIMLv5YXEXCkkaCnQDjIprPmmRh02bolkDhE= X-MS-TrafficTypeDiagnostic: DB6PR05MB3144: X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3144; 20:zzlu+ArO6NLE39e96AoS0/p1tF76xt/vcR94lungSbf5HE40p1t5vk3WNkjI+59vB+kmwcAYTzVdx8FqN9cUC43gRGbd+dnvX0TMPQ0cETqjO1PDs1mY8pXHA+SYAKNE3g29hSCh90lQ9iIet9UYtN4BGq0GlyyBg/OGMJwEiC1pJMWejWGBK5AKVv1+nA7csmP5tQJK5Xp1Cc6FXS5QVC5H2NDmx2PJrJqPeDdHMLZ4Jg6SldfuB32vDmn0P1hV6Zpf6LBFyN2t2y/d8fpFO8a23v+STGFB9dfFsbkjwfVgVNAOISGOdiFSiiGFF0dlNTbuPNcyUI2A9pZvqJnxqwQg6I8sbsQmRtYJrtDUGILYpOcWk4qSWMmu9wNs7YWSMxbKRyVD/Zgrv0C7E2F0EusBe2aTiFi7aTPwt6Y3nip82m68Jw3yVJWm3jcBayEJ8OlHlL0v3CmQaabFfey2E2rqc4POcPuNkoGrSMOVI32G/riqzdmE6eoNYZCvzH0L; 4:Bvs2D4nF2yUiUdT1juRbd3qpJvUPQOvc0Hv+QnLCWFEgwevRQFmNMafgVvQIfnUwrlbnCsJ1aIB7ZJtq0upOWLkcfYONJew51yRn9ONhbl71Ryf5WotzP8qKNSbmfrgHHINby9kSSD24lqW5KLn186zpCDlzBfBOzUPn8WuvFOjdztSk/ILQacOM/Rdmg9keVH80fQyTnoQk1uJlQWVsN2xOu1R/eVrVQSpnttma/616KNMRmsmcI8K7sSnXg6tClW8h2Admfs8ietFBLg9RfA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3231022)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DB6PR05MB3144; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DB6PR05MB3144; X-Forefront-PRVS: 05009853EF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(366004)(376002)(199003)(189002)(6666003)(478600001)(8936002)(2361001)(50226002)(4326008)(106356001)(50986999)(76176999)(2351001)(33646002)(68736007)(5660300001)(189998001)(101416001)(36756003)(48376002)(6916009)(2950100002)(21086003)(50466002)(105586002)(16586007)(33026002)(25786009)(86362001)(66066001)(97736004)(2906002)(316002)(53936002)(47776003)(5003940100001)(16526018)(69596002)(55016002)(1076002)(6116002)(7736002)(3846002)(52116002)(305945005)(81156014)(81166006)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR05MB3144; 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; DB6PR05MB3144; 23:vWashiC2ND1GzTCSkWGtQh90cjZiDgNKqlEpU+k2M?= =?us-ascii?Q?k2jEYzTwqQOTKq/nqmm4IAcx9mwceT+SYZUssPdCf11VLmOQ/fkTLCg9GX6U?= =?us-ascii?Q?VtZsqJF9R+fErrO4hIl4BVLJ0xfoLGyRD/2C+F7b8OJUYmW1kHsw2wHlNp+n?= =?us-ascii?Q?DiaCCFc2BQs8p6l8Q0Hl/a14PdPI8LZxRPusy2Phqo6k4vfEYyoWGBplSzVQ?= =?us-ascii?Q?Xkq5cMbMoSsUijMppTVtr2Wq5ef2mv19MLQ0eBysv45VoX4oM2gLkmNJRuvT?= =?us-ascii?Q?w21Mt1kr1FJnw+21U415MUZS8EhzNJ6qg7DPRsugGz/DMyUPLW/zAIGZkqrN?= =?us-ascii?Q?UgtIwjPcPovVHTkMzVy1miWcZWtwd/syQBxI5C1oG+w6517pjBqJFibiGUXU?= =?us-ascii?Q?cTMT16OOof2s9J/HofVw8OKKw3nQJkKHSiUsH9VOQ2FAUuZ7z22ngn0C8b+/?= =?us-ascii?Q?Eh9fRQJSZRHb83wx0lm5onleArTy9HJ/oMwV/1CXYqruVnrdG919xYj+RSif?= =?us-ascii?Q?Z6Htil3YXjxZbHCOhrYFUTCc8f5zdmWHdWBId94zpriwmidV7aXcOm6YMaIy?= =?us-ascii?Q?SDQzdY1ufKMfzlbudhC5rT1rFyxIgquVXMajKj8QWgJ2Bf38Gy2Pad1VIc88?= =?us-ascii?Q?nPa1fv0+YW+tuKQe74a5/wBuetisf2cXNuU2+BNa8AVTLgdQhxA4cBMjVHSH?= =?us-ascii?Q?W5RGGbgu3TY55rfDszFL51x9Xq5l46JYxIQuKVPKy01fkAuASp2oHExmXWgI?= =?us-ascii?Q?e3RfFBbXqnwjFOJD5rRZSYxUbWg6RuOQE7n9QNKGCq1g4dIo5uMaVrCYtI5s?= =?us-ascii?Q?3bSXzXu6kow4rb1HAJYoJG/VvD001MRg3UkXcFaMvmQyD4RVeMUwDrb/BsRi?= =?us-ascii?Q?b4rTDONM+MmCfr0Eyn9Ftai3F872EtMjz+vtndmXOB1kt+c726pFTHjc6VrD?= =?us-ascii?Q?VuAz9kWVwrorw9ndbABSyb8jzKULo4YfkVnY6TmD4ihv8NBamV4GU1P/uMpL?= =?us-ascii?Q?vNKjZf8Nbow5rHcRprDAGfKuD+eSmAHnopZWAced4rSv5jB+rYzmQrJaxUDT?= =?us-ascii?Q?3bV/4zrA9aCYFwfrP+ZOh6LA1cJqbsorth0LjUvH8ne3TjWFkEDFQeZO3z0R?= =?us-ascii?Q?FvWo1DKtd4fTsnZrrvbS8wMISElkjSo0abOUYIVFDTbwsfwhr+BeMKVT++yc?= =?us-ascii?Q?qH0/yM7KJfWCVG8mrmc1/FWm5msMLFRRmXr?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR05MB3144; 6:pH3Dni3KvHR3/rWBcyJW3l79HLpqvwrRYm9XYNIg9uRmsz6jMy/+am66SC45uuOLVLg0nveI2Ts2Au4dKnfAr4eAfXuWsHwzoGbZH4pGgZveM932Rohmuv7fXApacgPraXjaIICvUI5csxGEd7lu6+S3ccr0+QxIJ0/57n7G3maStEHMQCoEem7a4pBiITNfO8UlMV1dpazRBw0IrimbfBOdPsqvc6qEhmze1lAtrbbrC6fPG7UbLRRApx3Qx+e2gpWvQFiWOpoIs2BcI0RtUPVWLyLXir/BxDLk5w+h3laRogX9abgxfnpIDjVDkWDY/7CPs+Upvnts3Ch449cj4c9OaTqL37HJ15GPKLpW+vk=; 5:PB2uZZMpuNCax6mo6H4lxC8ErrjXfN+8bmqaRN9D0MKmh3LIZATiEmimvAe6NlGVmWSTcCzmgxGKr/xl3U5XCvUz6uk+N45ee1dQL43B0HBOy9x8LghjjB8mUmcJvIZy+C6C2L5g7NHHLlyA2fK3tOaF69tbSRg/CNDLEkgGaFA=; 24:IU3qqyhM7ElQGmqSKyfwcjFW8mDLJZGVZD+wPuiH3iu7VRSV1fMIyroz/D+9DVBk49f710h+kpanz/+aYXLErLCFkozEAg3ANsMn3jA9xL0=; 7:VH+xyKOT8ko1Trks9LI3g3//0vyGm/X5XLctsSkBBNKxT1FQQCfC59jRNhcKjspeNVHLYsMZDqa20aD6YmZf4MgyX3o6y4O7jAA2dZH1VieyXMANXAhQmEmu8KCpDmBp5GUAb8+Z0UmUqkqY+2+s1U2l4JJHaujzvj20Fnw4o2khuhzq72ZOUGMRtq6EBJR+fxBNNyNaKWZ+67QHl9tvrm2mrephCvgEI9k3pvilzYtKuAbdPGj1qwiwd9NeuIuM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2017 12:08:31.2790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c07e48c0-f0f2-4401-a684-08d5326aea0d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR05MB3144 Subject: [dpdk-dev] [PATCH 5/5] 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: Thu, 23 Nov 2017 12:08:33 -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 | 132 ++++++++++++++++++++++++++++---------------- app/test-pmd/config.c | 22 ++++---- app/test-pmd/testpmd.c | 21 ++++++- 3 files changed, 115 insertions(+), 60 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 9e3f02ec5..2f099a8e6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3639,6 +3639,7 @@ cmd_csum_parsed(void *parsed_result, int hw = 0; uint16_t mask = 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); @@ -3649,26 +3650,58 @@ 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")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_IP_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")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + mask = TESTPMD_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")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + mask = TESTPMD_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")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + mask = TESTPMD_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")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_OUTER_IP_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) { @@ -3815,6 +3848,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; @@ -3826,14 +3867,6 @@ cmd_tso_set_parsed(void *parsed_result, ports[res->port_id].tso_segsz); } - /* display warnings if configuration is not supported by the NIC */ - 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("Warning: TSO enabled but not " - "supported by port %d\n", res->port_id); - } - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } @@ -3891,24 +3924,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 @@ -3917,6 +3951,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; @@ -3928,6 +3963,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 | @@ -3936,11 +3972,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); @@ -3955,7 +3993,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].tx_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) @@ -13014,23 +13051,20 @@ cmd_set_macsec_offload_on_parsed( printf("Please stop all ports first\n"); return; } - - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; - 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: - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { - printf("Warning: macsec insert enabled but not " - "supported by port %d\n", port_id); - } + ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: @@ -13102,6 +13136,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)) @@ -13110,16 +13145,17 @@ cmd_set_macsec_offload_off_parsed( printf("Please stop all ports first\n"); return; } - - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; - 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].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 089e9f4cf..a20df307b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2790,16 +2790,17 @@ 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].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { - printf("Warning: vlan insert enabled but not " - "supported by port %d\n", port_id); - } } void @@ -2820,17 +2821,18 @@ 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].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { - printf("Warning: qinq insert enabled but not " - "supported by port %d\n", port_id); - } } void diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 2550677c3..2b8142162 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -601,10 +601,18 @@ init_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + rte_eth_dev_info_get(pid, &port->dev_info); /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; - rte_eth_dev_info_get(pid, &port->dev_info); - + if ((port->dev_info.tx_offload_capa & tx_mode.offloads) != + tx_mode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pid, tx_mode.offloads, + port->dev_info.tx_offload_capa); + port->dev_conf.txmode.offloads &= + port->dev_info.tx_offload_capa; + } if (numa_support) { if (port_numa[pid] != NUMA_NO_CONFIG) port_per_socket[port_numa[pid]]++; @@ -2082,6 +2090,15 @@ init_port_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; port->dev_conf.rxmode = rx_mode; + if ((port->dev_info.rx_offload_capa & rx_mode.offloads) != + rx_mode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pid, rx_mode.offloads, + port->dev_info.rx_offload_capa); + port->dev_conf.rxmode.offloads &= + port->dev_info.rx_offload_capa; + } 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