From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60076.outbound.protection.outlook.com [40.107.6.76]) by dpdk.org (Postfix) with ESMTP id BB2BF1B1D1 for ; Wed, 10 Jan 2018 10:10:02 +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=wniCR7XENGFKkRh3GN06EnS4t8IrBP7ilq0SuBzf7OY=; b=UkoIMgrlY7azw82cXU1yTlSocTYif2XIvId+LKYTgMQw+3TDFoe8wE+z2ziMuajx2Ud2JyKPPCPjuY1rI2W/fE/yp4rwhBqeREy5iTaW+E0UXrjhWDOfyRcNX1DliLAEJk5PSI7D0hmTE0TsllnTwSf3ccpC9xf+af4vTPVKArY= 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:00 +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:14 +0200 Message-Id: <73e30c58e430a803963c6a50a42c7d8d3b9a534e.1515575134.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: 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: 783a726f-9b64-4070-1a7c-08d55809ede9 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:34w2e+UP9PWt3bz5Ozgv6eWlE8/aISpgU2/jBOFwL9FrUvUhVzHnxXLAkf59ZvkXlh/j626KoLtozyJ/85mHwqCqzhYh8gnTEdSo+wCiKaZXQylUVJJAOlZcd+4NLiq7UaA05icrGEbN3JXTbDWZtCsgqKfUh3Vsmloot84hG25xtnujZ5XWXDLAJ5LoLcRGtGpficV4JPTLV5VdxBgixEN5d8Wt1t4RoJAEh/QHiD10B/hJBEKLBHZnryKyj7C5; 25:znTRcF+bcg1vufKYEiXRgAOz8ii6iM+wjwxcGzzx5vBlBKckSSVwjps8O4qAqFnOUVhLUykXd19G4ins08IhSPdpGwWr9q0iWxZXEODZP3cM6Yz3pxLrwDuW/UDlQaqoc4Z01BLpuEkXDxVBp8QhGzB5v266hlasIpPjhNjLlwvirePlRr9SwaE1jmCfV9O+ujnz45Hqd74r4/3shozekrJfQQ2eNDFgiJYGSF7hCVnXDNiyXEKfA0GZsAQPgsC4VYtg6c7rdSPaRcon8FAJiZwsoPZbBIpl161VPx4flx08SFLQpC+x7JSfWZzijNmX/zt+4KYCAORsY3o3iIEgzg==; 31:vcmw+GuDYQUZGqYZ5fKBb6lJH481L++lRqiW+y0QK7n91oVgLb7pb81oWtxX2SErl/jiUhy9hm6HAVy+Rwci/UzJjYTXWOBbn3KE6qVqWTOX3IkvgK2yCyF/TPMHlacoaPLd/qVaDNBW/4ob0mYjdmnyHcpLc95Q/PTUCtHjFiuxOrMPUyzU7OX2mjNbWExpzKvfCTGJE74zM6RMg4uBH4DFVew2EpkARk6lh/3QRYw= X-MS-TrafficTypeDiagnostic: AM4PR05MB3137: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 20:r9HgDrsLabcabd8jTWUYabSg+PU2myLVn2l2vzNH4Vx1X85TmuP5n8Vpwf0JjLDZXj/w5aOMV3FY2pAS5h1zjlaDH/WnOv1DiCHZXITE8W3PrVViudfOgqmRDvRL1w2E99fvpsGeW5KkLYavgyOuDyam+kAs0ZW521OYnnPjhv3n38VYJTLBfbEu7pNjTDPHCkNm8cT1ssQ/u9kKE0INkj5JwQukZh6tVqmdVVH1r1luqpTZSVRdd/SjHpYKmzBFiOFX7enFkxI4HRiAIX/PGFFTeVWy5aHu8abklk1Ex8FUrJZmMycap+a3mWy+585KsT6TFBpaBceU+bcApFUQMUO4WHXECc/9FuRt92VNd635DMu105grBETDMDGTXQqGP/Zj3xdd12aGHKY5r0t4DfKSUhkTnttOjhNMEZiFr9oK6/Lr6+c7gPvxS6G4WaBsC+eurkfUrdzotA8S5IxwyZb+uTuKMZ14vZtv9YicJ2KNi1EDBmCf9tELPun39y9p; 4:+1J4is88qfTkiEzmbK2i4JUnsdkhzUW2p2VU5u07dVkl9vjjAeelNlfp8AkK98j5xen0UylTXNL1z9HRyXHBFJdJEoSdTlJ+6grUhTJpudlxiBcshNboPLlnH/OfYbNdB71BxWNutN6VdPPZgNomepc69agmBHyE/1HCSr2qHpUC76eYUGuwdtiSWud5N1gpdkBLZIkA1u5pvAY8pG10rnuUPdoam9D7at7IKbWNqX77ylxDQlgewU0T+8Iq7rnntdjWByF+Piyn6Atu5ZMWqswX8byBby9ZqoS2ua1wgG/GKz3YlG6e/OoGEbBUaFC6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); 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)(575784001)(118296001)(305945005)(7736002)(55016002)(2906002)(21086003)(6116002)(3846002)(106356001)(105586002)(59450400001)(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:eVgN4EujxwBP8ktRDChm/Mu1kIIJ9kmTXKAwLalc9?= =?us-ascii?Q?OgOrtnvvUmKSmDuMzxL8GcC8Y4rd6A3/NC/fMTXYgCnNwa9IlhqXqOhqR8Pb?= =?us-ascii?Q?AB5/yfCZUGILvoIFy+GjAB9eXcWxbSRDh3VmXry/bvqMlg+F0fRy3YVI8HAW?= =?us-ascii?Q?TKZKLp5Ra2ct3YGbpL0d5xM7BoBj9KfXuN/8rKzby2dxU4SV0yL/VBKIdm6v?= =?us-ascii?Q?1r1eqvWvN9GKWLgdWDLaHreNBAf7bgcuo6LfKK1v85AJ0fpNG2nKGW7ei6YC?= =?us-ascii?Q?v3onVho4q2RraKgHayH/na4JIURZcKWt5HRvvGDe1G7TWg6J5d+ECnsfsuV/?= =?us-ascii?Q?vuTWtg67iU9B7B1EGjp9N6+QFxuvx1D73voE6e3/x5s380R23HmGP9a0XNpF?= =?us-ascii?Q?9SF0pT0cv6WcJ968fNwCunrQUeOqgRNbi+K4v4N33F3KY83IlCO4lDSs3r3B?= =?us-ascii?Q?o5pzBFDSvSB0jSXDG6W1PdZAhQmeTQwClBrNZbGL9e41/4NbLZ3NmaHwt+NV?= =?us-ascii?Q?i04UPiHZTnL8n/F4GyVTUoT9JOkjSUdOezvPj1PQLawnF1KSSjRagj7Hw/oQ?= =?us-ascii?Q?KvC8h699rtYQg+hWxXt/dLHzXwkIFeDmmogHs6BgJ8rU/usIjGJOwuiNm/3g?= =?us-ascii?Q?aMzOB7Dh1LJX4Ak1XgBGWjlM9SG4jTG84GbCSIB7eE3TzXGKNRPmoBhZX0/H?= =?us-ascii?Q?lAy0DnzdCmGkl3gPE/XKeGtvl1sGJpLA8YpqqpXP6y4eHwTbk8m9ajW8Bf8u?= =?us-ascii?Q?CdQNnTkSqQo9GOdG+vTziXW9DcJGVxee/qJHsPoj7eYyps7/1UHAG3GQimZM?= =?us-ascii?Q?9wPVm5ccBX/Bddc1Cu5UMxAdg+ML3YDMFWlXTvn/kRIAQeojQGaSh8akavxX?= =?us-ascii?Q?xId6A1l8tXwrfXLnVCmEIp24oxmuPjESSkS4HAH6DwAGmvoXybdYkg9AfszF?= =?us-ascii?Q?A6Hg4qF+LBhAZ9LywkP+R8BV4W6QmwETYzKk7jVT6pAP/hvQwWtYLXKTqsap?= =?us-ascii?Q?vltSxQNSluEovNKDzm1w+6F8JoR0/f7oVAk18tM+c5Zi6HFlcXrAAV4WQ1SQ?= =?us-ascii?Q?East0M1eoQXwTO2G2zq82tfHFYnovw29vsqoreZfI+0ON4sEeiGPxIa1TrLE?= =?us-ascii?Q?juKD8iXdpqHNs/JERT1VDgm44FhM0EYVPbKIPqGu/Cbi5RlWN9iUA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3137; 6:U408q6RF5NWwfYhKurv7HayFhrWzg5ZvYhlNVRQG4a97VF5Fot8afwZlIScs86EQN9zWmZ+nKdC/1bJUnkA4hXisM3X55iNHZcBKTsUcWKKVyBXkhsJIXeX/72ytTkGBzvojdJYtU8793BcwvTaSGH0ko1RAc7LganiKNuft53NeTNkzQ82OGpWf21dANHKfgECMqoJNC8y5Yv/f11DNfd5pZaQpsLVRBrwprD5VsVRVxyoXnpFLJJh2W/rP+Lk3hmlYt8Bz4cZa2RhG+DRmXnbXQA67Lf/KDtrlBXkZDf2z/5h7q4HccIfq3XrRzT8EH0JiUjHzxqza7LgbcxYm5Oo4KaYwpCdnT+cwrzfX1oE=; 5:j8swePjDG5+RQQAQDW1TCfEUYlv8D5bcRVYGSXMsngZDV3OsC8k4xdbay08lFTepuLEBAu6wpX5iEQOj+RH3r5QrHzGxwVv0b4+ERAzIp/EdKwHOHSVBzshleOVYHTRQKUl09EFvg2LoOisopxE3/H4O1qzCPPxe++sRYKLazN4=; 24:f/1ZIdBzXqFM4jvHy3ODDpvcurp3bpIysl49EdRsvUobHyCgqfC5P1V/V/k2eeA7QTM7XRIpXtPne7XrmqmRYvida8tDoyFYPk/03zsV3fs=; 7:a3cV1oI9+atlNegoHRjDFOoDKuD3kCc9oUnetCZtIqQ4qR5sS1opoS/nGas1bttij+B3hpXBQ8LuUVZwyquG3IbGmy16gOnvX+HWGf/qkUjFePF9B51uHeOrmNXrpAGrS7NqWz3l1fr1eOo/syyGHNiaDpSwaeJVoOr5K4T1owFbDcsmFbXD59TA0WsoVTL/rIZjSswizxMt5MAETjxqQfIFRvJiMMccL2Ni3MbKJeiwJDj3yJ0jSq+GaW5CtGMu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 09:10:00.4876 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 783a726f-9b64-4070-1a7c-08d55809ede9 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 06/11] app/testpmd: cleanup internal Tx offloads flags field 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:03 -0000 The tx_ol_flags field was used in order to control the different Tx offloads set. After the conversion to the new Ethdev Tx offloads API it is not needed anymore as the offloads configuration is stored in ethdev structs. Signed-off-by: Shahaf Shuler Acked-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- app/test-pmd/config.c | 4 ---- app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ app/test-pmd/flowgen.c | 8 +++++--- app/test-pmd/macfwd.c | 8 +++++--- app/test-pmd/macswap.c | 8 +++++--- app/test-pmd/testpmd.h | 22 +------------------- app/test-pmd/txonly.c | 8 +++++--- 8 files changed, 59 insertions(+), 88 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 58125839a..858482174 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ static void csum_show(int port_id) { struct rte_eth_dev_info dev_info; - uint16_t ol_flags; + uint64_t tx_offloads; - ol_flags = ports[port_id].tx_ol_flags; + tx_offloads = ports[port_id].dev_conf.txmode.offloads; printf("Parse tunnel is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off"); + (ports[port_id].parse_tunnel) ? "on" : "off"); printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw"); printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw"); /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(port_id, &dev_info); - if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { printf("Warning: hardware IP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { printf("Warning: hardware UDP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { printf("Warning: hardware TCP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { printf("Warning: hardware SCTP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) { printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); @@ -3705,7 +3705,6 @@ cmd_csum_parsed(void *parsed_result, { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t mask = 0; uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { @@ -3723,28 +3722,21 @@ cmd_csum_parsed(void *parsed_result, hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } if (hw) { - ports[res->port_id].tx_ol_flags |= mask; ports[res->port_id].dev_conf.txmode.offloads |= csum_offloads; } else { - ports[res->port_id].tx_ol_flags &= (~mask); ports[res->port_id].dev_conf.txmode.offloads &= (~csum_offloads); } @@ -3821,11 +3813,9 @@ cmd_csum_tunnel_parsed(void *parsed_result, return; if (!strcmp(res->onoff, "on")) - ports[res->port_id].tx_ol_flags |= - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL; + ports[res->port_id].parse_tunnel = 1; else - ports[res->port_id].tx_ol_flags &= - (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL); + ports[res->port_id].parse_tunnel = 0; csum_show(res->port_id); } @@ -4025,12 +4015,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, */ check_tunnel_tso_nic_support(res->port_id); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) + if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " "so that tunneled packets are recognized\n"); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)) + if (!(ports[res->port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } @@ -13082,7 +13071,6 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); @@ -13172,7 +13160,6 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d0056fa69..29115e255 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2808,7 +2808,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) } 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; } @@ -2832,7 +2831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) } 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; @@ -2843,8 +2841,6 @@ tx_vlan_reset(portid_t port_id) { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | - TESTPMD_TX_OFFLOAD_INSERT_QINQ); ports[port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT); diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index aa29f5fc1..dbd2f9842 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) * depending on the testpmd command line configuration */ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags) + uint64_t tx_offloads) { struct ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; @@ -347,7 +347,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ol_flags |= PKT_TX_IP_CKSUM; else ipv4_hdr->hdr_checksum = @@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ol_flags |= PKT_TX_UDP_CKSUM; else { udp_hdr->dgram_cksum = @@ -376,7 +376,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ol_flags |= PKT_TX_TCP_CKSUM; else { tcp_hdr->cksum = @@ -390,7 +390,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ - if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; } else { @@ -405,7 +405,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* Calculate the checksum of outer header */ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags, int tso_enabled) + uint64_t tx_offloads, int tso_enabled) { struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; @@ -416,7 +416,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ol_flags |= PKT_TX_OUTER_IP_CKSUM; else ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -646,7 +646,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint16_t nb_prep; uint16_t i; uint64_t rx_ol_flags, tx_ol_flags; - uint16_t testpmd_ol_flags; + uint64_t tx_offloads; uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; @@ -678,7 +678,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; - testpmd_ol_flags = txp->tx_ol_flags; + tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; @@ -714,7 +714,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) l3_hdr = (char *)eth_hdr + info.l2_len; /* check if it's a supported tunnel */ - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) { + if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { struct udp_hdr *udp_hdr; @@ -754,14 +754,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* process checksums of inner headers first */ tx_ol_flags |= process_inner_cksums(l3_hdr, &info, - testpmd_ol_flags); + tx_offloads); /* Then process outer headers if any. Note that the software * checksum will be wrong if one of the inner checksums is * processed in hardware. */ if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, - testpmd_ol_flags, + tx_offloads, !!(tx_ol_flags & PKT_TX_TCP_SEG)); } @@ -769,8 +769,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.is_tunnel == 1) { if (info.tunnel_tso_segsz || - (testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len = info.outer_l2_len; m->outer_l3_len = info.outer_l3_len; @@ -832,17 +832,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) rte_be_to_cpu_16(info.outer_ethertype), info.outer_l3_len); /* dump tx packet info */ - if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | - TESTPMD_TX_OFFLOAD_UDP_CKSUM | - TESTPMD_TX_OFFLOAD_TCP_CKSUM | - TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM)) || info.tso_segsz != 0) printf("tx: m->l2_len=%d m->l3_len=%d " "m->l4_len=%d\n", m->l2_len, m->l3_len, m->l4_len); if (info.is_tunnel == 1) { - if ((testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + if ((tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=%d " "m->outer_l3_len=%d\n", diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46478fc3a..0531b5d27 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) uint16_t nb_pkt; uint16_t i; uint32_t retry; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -152,11 +153,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs) vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f4a4bf29a..56ee3cc0b 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) uint16_t nb_tx; uint16_t i; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_forward(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 721865c96..e2cc4812c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) uint16_t i; uint32_t retry; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_swap(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ab74d39ce..c6baa1066 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -138,26 +138,6 @@ struct fwd_stream { #endif }; -/** Offload IP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001 -/** Offload UDP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002 -/** Offload TCP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004 -/** Offload SCTP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008 -/** Offload outer IP checksum in csum forward engine for recognized tunnels */ -#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010 -/** Parse tunnel in csum forward engine. If set, dissect tunnel headers - * of rx packets. If not set, treat inner headers as payload. */ -#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020 -/** Insert VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040 -/** Insert double VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080 -/** Offload MACsec in forward engine */ -#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100 - /** Descriptor for a single flow. */ struct port_flow { size_t size; /**< Allocated space including data[]. */ @@ -215,7 +195,7 @@ struct rte_port { struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ unsigned int socket_id; /**< For NUMA support */ - uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */ + uint16_t parse_tunnel:1; /**< Parse internal headers */ uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */ uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 309c73893..418901c0c 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -193,6 +193,7 @@ pkt_burst_transmit(struct fwd_stream *fs) uint32_t retry; uint64_t ol_flags = 0; uint8_t i; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -206,13 +207,14 @@ pkt_burst_transmit(struct fwd_stream *fs) mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; + tx_offloads = txp->dev_conf.txmode.offloads; vlan_tci = txp->tx_vlan_id; vlan_tci_outer = txp->tx_vlan_id_outer; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 2.12.0