From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0127.outbound.protection.outlook.com [104.47.34.127]) by dpdk.org (Postfix) with ESMTP id 44B101B3A5 for ; Thu, 2 Aug 2018 01:15:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lGHBzLXsuNNwBrj1UJXj3Q9FUU/M3Us/0iH55hkzedE=; b=Nm+NQOHR/wsOnF8ylkXKPtdYOl2qnYWXQydY1DBVyKrj3JpR23n8bixln0nD/UoRPH2D4vhaPWjBAG1FP0ODGTFvJSMcLqKk1UPzWOF+ycpN9vQRQ3R0etdJDsoD+g+gmiWkVLGcANtVWfOSCtosAJaNJAe24nNUnnzfyE1RqJ8= Received: from CY4PR2101MB0866.namprd21.prod.outlook.com (52.132.101.161) by CY4PR2101MB0867.namprd21.prod.outlook.com (52.132.102.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.7; Wed, 1 Aug 2018 23:15:43 +0000 Received: from CY4PR2101MB0866.namprd21.prod.outlook.com ([fe80::5c7b:aa05:6912:385e]) by CY4PR2101MB0866.namprd21.prod.outlook.com ([fe80::5c7b:aa05:6912:385e%4]) with mapi id 15.20.1038.003; Wed, 1 Aug 2018 23:15:42 +0000 From: Petr Houska To: "users@dpdk.org" Thread-Topic: Mismatch between return value and documentation for `rte_hash_lookup_data` (cuckoo hashing implementation) Thread-Index: AdQp7So1DnOTE8TMQ1eVrvdRAfYCQw== Date: Wed, 1 Aug 2018 23:15:42 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=t-pehous@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-08-01T23:15:40.2328591Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [2001:4898:80e8:2:680c:dd82:c722:3f44] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR2101MB0867; 6:x+t7w2I5jkxn6O1Do6Ca/dhl8Q2717AdwsmfZ9jn+cSBjoTORjPCCdAYAW4gJV1hG/OE+TBvyld8XyzrJUbZCktOOTj8VPuCnzgYyyodObqdkh7pOCT1ZTUUB4eoBTWc0A65k6FHnAKacO/lsHBjhsdS6HweaA4imsQZvc+D+lK5cP8BtSweWZNc0SEMsHE2aP0+Z5xi8b4Lv9HNWvJswezpaVpzbCdWv8jGgnbV/yJtJhYpjhXh4+FINfjBpIh8D4pRwdGvcM5BniDLY5kxLk3v8Esl8YZAhCTXpYLBHzl7WlVFUrCF69rFmt6WQ+5KVtWxU4YVMKIKgD0FpvZOXIeqlTZ/4vsM6oYtnA7zsiWW8StTk8cB5sEJUS/2+9Vgz++fK/rpIbqRPehCgy+hnW9o0yespqj1xpwGXxa8lxopfKWBRXPwoU9SqAM48vCgS1fiSme1vtq+bQN3lhgnsg==; 5:TpRGy5h6RzGEKrAITF/M4iE1h7v6F2INxw81DLGtTOCCmV2g5wNpT/aOZgCBQCLaj3LFuTwhiyQyYAKFVIkWtU9Zpc7+jaW801oLj7jZMuB6GUTdbfyJNyFHlJMyQdYZ3c1HJTp8Phu6JQoAB9TkEE5s3K3bPBIV/9IgeapcRu8=; 7:9PYrXfR9hMpTho6FpYow8JimYlyDIDap4p+RpsK7KM+t2mYqMoFm2prc8G7D8xYbwlrnGI9UBd4Liv0JYv2AxNMhNHmiRyeFVsHGWS87trOtrMt+vgu09ZPaGpQ14BDSXkdtoO5NvGkcQ5xk3PVeiY+NRPSoo9s7e2YFIP67GrglAZ3v/djeL6ClV8V4KFEQ+WXFJP0TdMYzGpKoKseGzqGnz4W8jrE7NronNsmjH8VvZCIYz9tyozkoPkrlc5cs x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: c48faec3-c1fe-457d-d7f1-08d5f804b415 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7193020); SRVR:CY4PR2101MB0867; x-ms-traffictypediagnostic: CY4PR2101MB0867: authentication-results: spf=none (sender IP is ) smtp.mailfrom=t-pehous@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(21748063052155); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(2018427008)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:CY4PR2101MB0867; BCL:0; PCL:0; RULEID:; SRVR:CY4PR2101MB0867; x-forefront-prvs: 0751474A44 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(376002)(346002)(136003)(199004)(189003)(6506007)(5640700003)(9686003)(54896002)(6306002)(8990500004)(46003)(236005)(102836004)(55016002)(476003)(2906002)(486006)(478600001)(25786009)(186003)(316002)(256004)(6436002)(22452003)(53936002)(10290500003)(10090500001)(97736004)(5660300001)(2501003)(5250100002)(8936002)(86362001)(33656002)(790700001)(14454004)(86612001)(6116002)(99286004)(2900100001)(6916009)(8676002)(106356001)(105586002)(81156014)(81166006)(2351001)(5630700001)(7696005)(7736002)(1730700003)(68736007)(74316002)(81973001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR2101MB0867; H:CY4PR2101MB0866.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5Brbym3Hw3yE1AxmtmVNCOrteChBmmTdLdUcVu6qZ4Ftlv/CGObJKjXjedkzLDxRRfr6HkjfH7QMd4RTOwr17D7+G9igd1/2yDaQFw8TCsq/X91FNMLr5wtvKu9tL+1czQh9OZ0IcqmzuNMWPMFyv07uRid3sXTIYIoGwxobvb81cL9LJgXJQ4EGt2bTXVTftFLyTCxpKYcyFVF6AtUlozoFA+ihechgefll8UBwFWcJmyK1efg8/QGQxG3cxB9j6bIwsY4G4huDQ+jtaiEWpr8xvxd2Dnuk+kMU8+vssbTnWEVCFqQqUOKLD8EaYxjOCIzxwPaoiOI4sxWoEN2BHNbSlzr9lCVgQhI2nuLr6Zc= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c48faec3-c1fe-457d-d7f1-08d5f804b415 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Aug 2018 23:15:42.6440 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR2101MB0867 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] Mismatch between return value and documentation for `rte_hash_lookup_data` (cuckoo hashing implementation) X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2018 23:15:45 -0000 Documentation for `rte_hash_lookup_data` specifies that this method returns= 0 on successful data lookup or positive error code on not-found / wrong paramete= rs. In reality it returns positive index of found data on success and negative err= or on error, in essence it behaves the same as (i.e. the same as rte_hash_lookup while= also (correctly) populating the data pointer). rte_cuckoo_hash.c: 733 ```c int rte_hash_lookup_data(const struct rte_hash *h, const void *key, void **data= ) { RETURN_IF_TRUE(((h =3D=3D NULL) || (key =3D=3D NULL)), -EIN= VAL); return __rte_hash_lookup_with_hash(h, key, rte_hash_hash(h,= key), data); } ``` Rte_cuckoo_hash.c: 693 ```c static inline int32_t __rte_hash_lookup_with_hash(const struct rte_hash *h, const void *key, = hash_sig_t sig, void **data) { ... /* * Return in= dex where key is stored, * subtracti= ng the first dummy index */ return bkt-= >key_idx[i] - 1; ``` DPDK version 18.05 release. PS: I'm not sure whether this email shouldn't have gone to dev@dpdk.org, please accept my apology if that's the case. Petr Houska Azure Intern