From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0071.outbound.protection.outlook.com [104.47.38.71]) by dpdk.org (Postfix) with ESMTP id B35221B580 for ; Tue, 9 Oct 2018 16:18:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IWY7UHUVcxtTMW7b2Zxkke09sRHNbo+fjgwADVAv75U=; b=GyONGyti4ER4M7/aJF5sfEBzyq6ZrEpWtmyTJ4/cJUefDAbvtPKTIissBnilqy8wrX+Z9pyjkejT4LbjTnFTQpzutv9gGzlATzn8H4NAQijxXezSuEMEaKIDCjdpEV5LFDfLvmR8rkq7+6q8UrnmUL3japa4vofVlZ6MSU8luLQ= Received: from BYAPR07MB4997.namprd07.prod.outlook.com (52.135.238.214) by BYAPR07MB5352.namprd07.prod.outlook.com (20.177.125.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.23; Tue, 9 Oct 2018 14:18:14 +0000 Received: from BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c5c:4d86:b353:175a]) by BYAPR07MB4997.namprd07.prod.outlook.com ([fe80::c5c:4d86:b353:175a%4]) with mapi id 15.20.1207.024; Tue, 9 Oct 2018 14:18:14 +0000 From: Jerin Jacob To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: "dev@dpdk.org" , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "arybchenko@solarflare.com" , "olivier.matz@6wind.com" , "Jacob, Jerin" Thread-Topic: [dpdk-dev] [PATCH v5 3/4] app/testpmd: add outer UDP HW checksum support Thread-Index: AQHUX9rqscTauTncdUySLtoy7oNOiA== Date: Tue, 9 Oct 2018 14:18:14 +0000 Message-ID: <20181009141741.5162-3-jerin.jacob@caviumnetworks.com> References: <20181008160953.32510-1-jerin.jacob@caviumnetworks.com> <20181009141741.5162-1-jerin.jacob@caviumnetworks.com> In-Reply-To: <20181009141741.5162-1-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [111.93.218.67] x-clientproxiedby: DM5PR21CA0032.namprd21.prod.outlook.com (2603:10b6:3:ed::18) To BYAPR07MB4997.namprd07.prod.outlook.com (2603:10b6:a03:5b::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BYAPR07MB5352; 6:o3A0PniwrlqYqeP9IaUwTmZ9EdspZ624oNZxap6zD/mQdbfiYFuDqIbffg7qy/api7Q1DYmOJ5MMl60aangvx1WRpHSgg9LPnH+y4ry9dQ1VHDPHschwFCJUiDzLdXherUBPRVyteHSejidza6Phmu5KZ03Qq2lzSGIYOkL+qBOpl1IJd2Or8rw4rg44jX/6sCiDTGeXltwAsOOWQmyhpC0RXcsdAgw171F+o1ltQGv7WJWnukUHruwX7Z1oUWOvNgDWUNOSw1a75vzgew0BSw240Klx/q4VmvpzcbS2nh825zt3a5yTev954QgL90nfXAqDFIaGwp7jFEQgGYJ4N8ge/j+kJyUEe7jMfUwiVW7Wj+GgrJzWx6cGktYM+HxHlnmkexIo/8kjRYlarFd3whNTKloBnIJttu7tXInObkygK+P5X2+3Mz5IJWqb2SJZy44f0vRApQmFQNMOCOGp8g==; 5:2UEbtkeb1nmp9uunwCNmjoP5gzSclxWlpeYbKPWwnmm6zxqPn3vFLzQrem0x8MrIJfsvEr2viN08AkH9SCFzlKlgShzYo6nK2ftMZHwBNdRXzsPWov7vT7l5jNu8w5CkOhiSAv7TRWghn6/yz1lQft/WS9jogwprnMrjKrBKg0c=; 7:v4zF1XZQcv0b2UDin1UfQ/zYl3+W1IvWKJQJxsr7ISyzpqDvvKUfpI2rYHbN0fJR9QzlqUMFSQVEgHnItrCTaG5Y3N0VMGRM9CQvIGvE5qy3G/7z2LhrsHeb9eHQcbolz57n2yjsuh5mpeRnY2tKcx6AHxPuW+NRNhzIxFlifX/lwrcGSTpttSgvmwTSymgFl4n4GSIPqNMWRYoWEUIBtKaRjes6ILEBxGI+iScMsyefcquna8ee6I2Q4CRbAAFl x-ms-office365-filtering-correlation-id: a456a074-5393-4f62-c881-08d62df20cd2 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB5352; x-ms-traffictypediagnostic: BYAPR07MB5352: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:BYAPR07MB5352; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB5352; x-forefront-prvs: 08200063E9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(39860400002)(376002)(346002)(199004)(189003)(102836004)(14444005)(256004)(5660300001)(6486002)(6512007)(53936002)(26005)(4326008)(107886003)(8936002)(2900100001)(81166006)(71200400001)(71190400001)(81156014)(97736004)(106356001)(105586002)(54906003)(110136005)(36756003)(316002)(68736007)(8676002)(25786009)(76176011)(7736002)(7416002)(5250100002)(6506007)(386003)(42882007)(66066001)(1076002)(72206003)(99286004)(6436002)(478600001)(305945005)(14454004)(52116002)(3846002)(1857600001)(2616005)(486006)(186003)(6116002)(11346002)(2906002)(476003)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB5352; H:BYAPR07MB4997.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 42rvvmcLWDkn90XStKVClDzjSlsBWKmhVsudB9dcusIKsexjuH89MiGxyC0U0OpJyz2vBIRmnW7tSy3gyeAvVjgBx8IG9qdCDCFPadaXvuS8IA052WPlMA+Cka5BFqp4F4bE50eGyn2BfnvRRmMhe7wL/iyOjOaMdSefCB57cL880nrG5wVsAfYvUozqdeMCo/1rtj/anc6Jvq+5uIVN8lpg5zRomg5tuamACb7OYJ61h3ndsGF03bA5VYUCxWRU79/Rmf5DOs0NYbOID9FUQwc6PZs+u9CRXkwHxY9kOE1yCXAMAmTC4mIn06sIAlQ3IjfWKD9VbIS+qn4+4hAz6vMIOjG8L2U565OdMULjKy4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: a456a074-5393-4f62-c881-08d62df20cd2 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2018 14:18:14.6542 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB5352 Subject: [dpdk-dev] [PATCH v5 3/4] app/testpmd: add outer UDP HW checksum support 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, 09 Oct 2018 14:18:18 -0000 Added outer-udp Tx HW checksum support for csum forward engine if device supports DEV_TX_OFFLOAD_OUTER_UDP_CKSUM. Signed-off-by: Jerin Jacob Acked-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 24 ++++++++++++++++++--- app/test-pmd/csumonly.c | 13 +++++++++-- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0c5399dc4..2fd007423 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -397,12 +397,13 @@ static void cmd_help_long_parsed(void *parsed_result, " Disable hardware insertion of a VLAN header in" " packets sent on a port.\n\n" =20 - "csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id)\n" + "csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)\n" " Select hardware or software calculation of the" " checksum when transmitting a packet using the" " csum forward engine.\n" " ip|udp|tcp|sctp always concern the inner layer.\n" " outer-ip concerns the outer IP layer in" + " outer-udp concerns the outer UDP layer in" " case the packet is recognized as a tunnel packet by" " the forward engine (vxlan, gre and ipip are supported)\n" " Please check the NIC datasheet for HW limits.\n\n" @@ -4177,6 +4178,8 @@ csum_show(int port_id) (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw"); + printf("Outer-Udp checksum offload is %s\n", + (tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) ? "hw" : "sw"); =20 /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(port_id, &dev_info); @@ -4205,6 +4208,12 @@ csum_show(int port_id) printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); } + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) + =3D=3D 0) { + printf("Warning: hardware outer UDP checksum enabled but not " + "supported by port %d\n", port_id); + } } =20 static void @@ -4273,6 +4282,15 @@ cmd_csum_parsed(void *parsed_result, printf("Outer IP checksum offload is not " "supported by port %u\n", res->port_id); } + } else if (!strcmp(res->proto, "outer-udp")) { + if (hw =3D=3D 0 || (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)) { + csum_offloads |=3D + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM; + } else { + printf("Outer UDP checksum offload is not " + "supported by port %u\n", res->port_id); + } } =20 if (hw) { @@ -4296,7 +4314,7 @@ cmdline_parse_token_string_t cmd_csum_mode =3D mode, "set"); cmdline_parse_token_string_t cmd_csum_proto =3D TOKEN_STRING_INITIALIZER(struct cmd_csum_result, - proto, "ip#tcp#udp#sctp#outer-ip"); + proto, "ip#tcp#udp#sctp#outer-ip#outer-udp"); cmdline_parse_token_string_t cmd_csum_hwsw =3D TOKEN_STRING_INITIALIZER(struct cmd_csum_result, hwsw, "hw#sw"); @@ -4307,7 +4325,7 @@ cmdline_parse_token_num_t cmd_csum_portid =3D cmdline_parse_inst_t cmd_csum_set =3D { .f =3D cmd_csum_parsed, .data =3D NULL, - .help_str =3D "csum set ip|tcp|udp|sctp|outer-ip hw|sw : " + .help_str =3D "csum set ip|tcp|udp|sctp|outer-ip|outer-udp hw|sw : " "Enable/Disable hardware calculation of L3/L4 checksum when " "using csum forward engine", .tokens =3D { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 494829266..ea5b112d6 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -468,10 +468,15 @@ process_outer_cksums(void *outer_l3_hdr, struct testp= md_offload_info *info, if (info->outer_l4_proto !=3D IPPROTO_UDP) return ol_flags; =20 + /* Skip SW outer UDP checksum generation if HW supports it */ + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) { + ol_flags |=3D PKT_TX_OUTER_UDP_CKSUM; + return ol_flags; + } + udp_hdr =3D (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len)= ; =20 - /* outer UDP checksum is done in software as we have no hardware - * supporting it today, and no API for it. In the other side, for + /* outer UDP checksum is done in software. In the other side, for * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be * set to zero. * @@ -826,6 +831,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.tunnel_tso_segsz || (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len =3D info.outer_l2_len; m->outer_l3_len =3D info.outer_l3_len; @@ -898,6 +905,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.is_tunnel =3D=3D 1) { if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=3D%d " "m->outer_l3_len=3D%d\n", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testp= md_app_ug/testpmd_funcs.rst index 3a73000a6..cfcabf6f0 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -857,7 +857,7 @@ csum set Select hardware or software calculation of the checksum when transmitting a packet using the ``csum`` forwarding engine:: =20 - testpmd> csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id) + testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id= ) =20 Where: =20 @@ -867,6 +867,10 @@ Where: as a tunnel packet by the forwarding engine (vxlan, gre and ipip are supported). See also the ``csum parse-tunnel`` command. =20 +* ``outer-udp`` relates to the outer UDP layer in the case where the packe= t is recognized + as a tunnel packet by the forwarding engine (vxlan, vxlan-gpe are + supported). See also the ``csum parse-tunnel`` command. + .. note:: =20 Check the NIC Datasheet for hardware limits. @@ -940,7 +944,7 @@ Consider a packet in packet like the following:: =20 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum= set`` command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), a= nd the - ``outer-ip parameter`` relates to the outer headers (here ``ipv4_out``). + ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ip= v4_out`` and ``udp_out``). =20 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csu= m set`` command relate to the outer headers, here ``ipv4_out`` and ``udp_out``. --=20 2.19.1