From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CF16FA0C41; Fri, 8 Oct 2021 13:31:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AEAF40040; Fri, 8 Oct 2021 13:31:17 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2A7584003C for ; Fri, 8 Oct 2021 13:31:15 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="213436390" X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="scan'208";a="213436390" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 04:31:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="scan'208";a="657770588" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga005.jf.intel.com with ESMTP; 08 Oct 2021 04:31:14 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 8 Oct 2021 04:31:13 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 8 Oct 2021 04:31:13 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 8 Oct 2021 04:31:13 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.46) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 8 Oct 2021 04:31:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BHxVC7EsnfHtvV4wnwIEI0LuqY8WQhCtCCqEKCO/PRJTuft7A8bGZTl7NMxNzVZe7JWwt54UTDTEudiSOX/75N4dJfZjioTlvkw1AoykYw4AB3BOlKXlBfnyN8B9nRKVoShkB6VZkV8iXLOSc0k2s2eTwVtsl3QoKUF2cH8AuJ3hGo/A4GqGdbwtDSl3prnR9lcHzf78ONH9s3WU7Av1yRAcfcnSD+2tappBeUlAu3RopMpNzBBnNxPmgfcMknzMhs885RI+ZXd81MrQ9gbKdWJ8zMv6i/4I7CknHirZ04Zv8nKLwcSeRyH662q4+JJ6CW8pxwPxeiid4bmfvVousw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OLb8JQRavNq3coCtcua7vEXPJ8jTs6027OqxT/XfEZA=; b=XejmATN/VsxKqfF0YeotTW2apa58JON00FLXvrO3pyt+R3Sw/ebQed6P1sbz1tDpjqFp8ple9SZdRfZ8G74p8kp9EQglSzwX8h5XZ6ic9o+kfQDVK5pPYEBqg+Lr1VxEEQUe/WJUpO5ROK7QzBOPuQEllAMTYMf+7t54SzM8hl71w8lNSRdofNHTleh1ipSXGSOMtihcnpCkhC116oBUyqE/6qBOeiVwgW2A1XChYMh55PCp7XwSECOARj2/GE+Dhd1evdypJ3cXz4H7AqjIryU5pxgtJQRgwf18f3awMUQh8yJApIGZZr/eTb+mSUhgjD/k4LHgpEUZVg+vIdzOOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OLb8JQRavNq3coCtcua7vEXPJ8jTs6027OqxT/XfEZA=; b=llm9lgL9V6tK7wfY8l3I2mV6fWQo1Tza5vBVv/RlLjW9kvQHl+Q7m5rKSNdR+fbvLf+DmrmT6M08NgkR45yX8ofj+B+ecW+t6v6N43F5doQS3/lWHH2ow9usitx93tZWLCwvorbxqhHDkgITEZmGkqAxT31GxyTDsEXKu4QkssA= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB3019.namprd11.prod.outlook.com (2603:10b6:5:67::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Fri, 8 Oct 2021 11:31:03 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4587.019; Fri, 8 Oct 2021 11:31:03 +0000 From: "Ananyev, Konstantin" To: "Medvedkin, Vladimir" , "dev@dpdk.org" CC: "Chilikin, Andrey" , "Wang, Yipeng1" , "Gobriel, Sameh" , "Richardson, Bruce" Thread-Topic: [PATCH 2/5] hash: enable gfni thash implementation Thread-Index: AQHXozjcq39eUos+CEilI9HJQfyOTqvJJnUw Date: Fri, 8 Oct 2021 11:31:03 +0000 Message-ID: References: <1630944239-363648-1-git-send-email-vladimir.medvedkin@intel.com> <1630944239-363648-3-git-send-email-vladimir.medvedkin@intel.com> In-Reply-To: <1630944239-363648-3-git-send-email-vladimir.medvedkin@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a6298a9a-0f46-43eb-cfdc-08d98a4f1c96 x-ms-traffictypediagnostic: DM6PR11MB3019: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Od1iMLlpiihNyBd1nkotsKS3t6tN8pSDUctI5KlteZH4617qRO64FV9lr3L5ziOHN4QG4VtOe+q1C+V+NTrQynvLJWhZrJ8Ab3g3TzKnJ5MKb2G/iXqA/N22YFQXDXdcZxStseWG9vC0a4hP/DIMBJhUkkv2qWltapkOIh785VtHAqukS3fiQVemwZIjmAiC1Xx4Be4b7UP3FS91raHJEc5tQSnHGCO6bURX5YYZDehvZw+eno+SNVhYc/77AfAlI/GWU6IWdrblvS6/jZpGi8ZYdd93MTMTyLV3QVLtnLzAFuknp+tWDL8k8k935EIf6POh05+i8HlBhf6zRsxPi2Tk+qqOpgtgvjkXGwlziCUaN/6MsWQUPV750soLBc4Ln18DFy/h9TF3U3BMh//bYfXSS8xyFiz28hBwen5/n5zCZqEhArN/zJ1TqD9KZgM8lHVrWocVY4NQsLx66u6dvUaWVXa+0OwbSxwlveMHMkgAHj1NZzbdf82j/IOZwnXknnbWzWJ8SntljyhzQDDrpB6mCtAZv+XtZF5mWJ/Q+NkIYQaTuzD527BdkJZBBqCVMlSKZGq16y0VVGg7qPuC06bmf52jzfsMuViqqTS6wSdaninfPbH8u+ZcKk5LZ+F/T6B+b0jl18ZPuY4hBsTWuZbBUPt5ly0fU5K6VLdH4oZhfeD5RGNR2nV0HcoonRS9YAdOp9N0+LTsD8UN/sMbeg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(2906002)(186003)(7696005)(38100700002)(122000001)(83380400001)(76116006)(316002)(52536014)(107886003)(71200400001)(54906003)(9686003)(38070700005)(110136005)(4326008)(26005)(6506007)(66446008)(8676002)(66476007)(55016002)(86362001)(64756008)(508600001)(55236004)(8936002)(33656002)(66556008)(66946007)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2Ce6ITmssxgMVQoGCndePtdBnhTsZgySEO7ZiIuY84d7agpYFNUjbJQ0n+wL?= =?us-ascii?Q?zfU4HfHvLX4GJZadiC1AWd4O5Jr/LAwsSAgzMl3RDMA2Zj3FulbApgQhP5NB?= =?us-ascii?Q?p6UOSKa+7BsrMAUycAfSaUTdlHXU66ybDEtEf4F2NmKxsG0JuMgQdlyAH/kp?= =?us-ascii?Q?ciid24YkVGY6WrsBSTjQ018Cn9y2XSKoqqwD1EuL/USFOm/ghucnwjzc+cXp?= =?us-ascii?Q?KiBRYZZKgUIeWaiC1ARSmTei7ZpnTcsNkQOGqn4weXw/LAZb6dncaWER6Z83?= =?us-ascii?Q?SLKT7C6keZXHmzcURTmWREzzt8piuoxtXqBafWBWP2g3sUUd0qQdZdoBklPF?= =?us-ascii?Q?SNCt9SnvUdh+s1V1R7m/3RsvFhbfqOuu6KGLgrfrAxi1TrcX3kUeLGhA2wCG?= =?us-ascii?Q?EEqGOB7hBoCJWImInDTVtFLwwInrl45OGCMd+vOFkxs0hMDWku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= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6298a9a-0f46-43eb-cfdc-08d98a4f1c96 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2021 11:31:03.4781 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lUJce+uSb6JHZ7l5EQfe2qaVZL9COzrBZxIHbK3nDm2oK3DVt7XyeTFjB5w6093DPNmu9IZfZd77u1rTbobND7PlDjFmvYp7GHFd4FlQABE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3019 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 2/5] hash: enable gfni thash implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > This patch enables new GFNI Toeplitz hash in > predictable RSS library. >=20 > Signed-off-by: Vladimir Medvedkin > --- > lib/hash/rte_thash.c | 43 +++++++++++++++++++++++++++++++++++++++---- > lib/hash/rte_thash.h | 19 +++++++++++++++++++ > lib/hash/version.map | 1 + > 3 files changed, 59 insertions(+), 4 deletions(-) >=20 > diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c > index 07447f7..86a0e96 100644 > --- a/lib/hash/rte_thash.c > +++ b/lib/hash/rte_thash.c > @@ -86,6 +86,8 @@ struct rte_thash_ctx { > uint32_t reta_sz_log; /** < size of the RSS ReTa in bits */ > uint32_t subtuples_nb; /** < number of subtuples */ > uint32_t flags; > + uint64_t *matrices; Comment, what is that, etc. > + /**< rte_thash_complete_matrix generated matrices */ > uint8_t hash_key[0]; > }; >=20 > @@ -253,12 +255,25 @@ rte_thash_init_ctx(const char *name, uint32_t key_l= en, uint32_t reta_sz, > ctx->hash_key[i] =3D rte_rand(); > } >=20 > + if (rte_thash_gfni_supported) { I think it should be: if (rte_thash_gfni_supported && rte_vect_get_max_simd_bitwidth() >=3D RTE_V= ECT_SIMD_512) > + ctx->matrices =3D rte_zmalloc(NULL, key_len * sizeof(uint64_t), > + RTE_CACHE_LINE_SIZE); You can do it probably before allocation ctx, at the same place where te is= allocated. Might be a bit nicer. > + if (ctx->matrices =3D=3D NULL) RTE_LOG(ERR, ...); rte_ernno =3D ENOMEM; > + goto free_ctx; > + > + rte_thash_complete_matrix(ctx->matrices, ctx->hash_key, > + key_len); > + } > + > te->data =3D (void *)ctx; > TAILQ_INSERT_TAIL(thash_list, te, next); >=20 > rte_mcfg_tailq_write_unlock(); >=20 > return ctx; > + > +free_ctx: > + rte_free(ctx); > free_te: > rte_free(te); > exit: > @@ -372,6 +387,10 @@ generate_subkey(struct rte_thash_ctx *ctx, struct th= ash_lfsr *lfsr, > set_bit(ctx->hash_key, get_rev_bit_lfsr(lfsr), i); > } >=20 > + if (rte_thash_gfni_supported) Here and in data-path functions, I think it would be better: if (ctx->matrices !=3D NULL) > + rte_thash_complete_matrix(ctx->matrices, ctx->hash_key, > + ctx->key_len); > + > return 0; > } >=20 > @@ -628,6 +647,16 @@ rte_thash_get_key(struct rte_thash_ctx *ctx) > return ctx->hash_key; > } >=20 > +const uint64_t * > +rte_thash_get_gfni_matrices(struct rte_thash_ctx *ctx) > +{ > + if (rte_thash_gfni_supported) > + return ctx->matrices; Why not just always: return ctx->matices; ? > + > + rte_errno =3D ENOTSUP; > + return NULL; > +} > + > static inline uint8_t > read_unaligned_byte(uint8_t *ptr, unsigned int len, unsigned int offset) > { > @@ -739,11 +768,17 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, > attempts =3D RTE_MIN(attempts, 1U << (h->tuple_len - ctx->reta_sz_log))= ; >=20 > for (i =3D 0; i < attempts; i++) { > - for (j =3D 0; j < (tuple_len / 4); j++) > - tmp_tuple[j] =3D > - rte_be_to_cpu_32(*(uint32_t *)&tuple[j * 4]); > + if (rte_thash_gfni_supported) if (ctx->matrices) > + hash =3D rte_thash_gfni(ctx->matrices, tuple, tuple_len); > + else { > + for (j =3D 0; j < (tuple_len / 4); j++) > + tmp_tuple[j] =3D > + rte_be_to_cpu_32( > + *(uint32_t *)&tuple[j * 4]); > + > + hash =3D rte_softrss(tmp_tuple, tuple_len / 4, hash_key); > + } >=20 > - hash =3D rte_softrss(tmp_tuple, tuple_len / 4, hash_key); > adj_bits =3D rte_thash_get_complement(h, hash, desired_value); >=20 > /* > diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h > index e3f1fc6..6e6861c 100644 > --- a/lib/hash/rte_thash.h > +++ b/lib/hash/rte_thash.h > @@ -410,6 +410,25 @@ const uint8_t * > rte_thash_get_key(struct rte_thash_ctx *ctx); >=20 > /** > + * Get a pointer to the toeplitz hash matrices contained in the context. > + * These matrices could be used with fast toeplitz hash implementation i= f > + * CPU supports GFNI. > + * Matrices changes after each addition of a helper. > + * > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * @param ctx > + * Thash context > + * @return > + * A pointer to the toeplitz hash key matrices on success > + * NULL if GFNI is not supported. > + */ > +__rte_experimental > +const uint64_t * > +rte_thash_get_gfni_matrices(struct rte_thash_ctx *ctx); > + > +/** > * Function prototype for the rte_thash_adjust_tuple > * to check if adjusted tuple could be used. > * Generally it is some kind of lookup function to check > diff --git a/lib/hash/version.map b/lib/hash/version.map > index cecf922..3eda695 100644 > --- a/lib/hash/version.map > +++ b/lib/hash/version.map > @@ -43,6 +43,7 @@ EXPERIMENTAL { > rte_thash_find_existing; > rte_thash_free_ctx; > rte_thash_get_complement; > + rte_thash_get_gfni_matrices; > rte_thash_get_helper; > rte_thash_get_key; > rte_thash_gfni_supported; > -- > 2.7.4