From: Petr Houska <t-pehous@microsoft.com>
To: "users@dpdk.org" <users@dpdk.org>
Subject: [dpdk-users] Mismatch between return value and documentation for `rte_hash_lookup_data` (cuckoo hashing implementation)
Date: Wed, 1 Aug 2018 23:15:42 +0000 [thread overview]
Message-ID: <CY4PR2101MB086670F0EEE64E117CEF932D8C2D0@CY4PR2101MB0866.namprd21.prod.outlook.com> (raw)
Documentation for `rte_hash_lookup_data` specifies that this method returns 0 on
successful data lookup or positive error code on not-found / wrong parameters. In
reality it returns positive index of found data on success and negative error 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 == NULL) || (key == NULL)), -EINVAL);
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 index where key is stored,
* subtracting 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<mailto:dev@dpdk.org>,
please accept my apology if that's the case.
Petr Houska
Azure Intern
reply other threads:[~2018-08-01 23:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CY4PR2101MB086670F0EEE64E117CEF932D8C2D0@CY4PR2101MB0866.namprd21.prod.outlook.com \
--to=t-pehous@microsoft.com \
--cc=users@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).