Skip to contentSkip to conversation

lib/hash: fix the return value description of rte_hash

PATCH In review Chenming C 4 participants 4 messages Jun 27, 2022 – Jun 14, 2024

lore
Share & tools
lore

Chenming C

author
#0 lore raw

PATCH 1/1 lib/hash: fix the return value description of rte_hash

The rte_hash lookup can return ZERO which is not a positive value.

---
 lib/hash/rte_hash.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
lib/hash/rte_hash.h +8 -8
index 7fa9702..1bf1aac 100644
@@ -288,7 +288,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOSPC if there is no space in the hash for this key.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key. This
  *     unique key id may be larger than the user specified entry count
  *     when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set.
@@ -312,7 +312,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOSPC if there is no space in the hash for this key.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key. This
  *     unique key ID may be larger than the user specified entry count
  *     when RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD flag is set.
@@ -343,7 +343,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOENT if the key is not found.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  */
@@ -375,7 +375,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOENT if the key is not found.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  */
@@ -442,7 +442,7 @@ struct rte_hash *
  * @param data
  *   Output with pointer to data returned from the hash table.
  * @return
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  *   - -EINVAL if the parameters are invalid.
@@ -467,7 +467,7 @@ struct rte_hash *
  * @param data
  *   Output with pointer to data returned from the hash table.
  * @return
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  *   - -EINVAL if the parameters are invalid.
@@ -490,7 +490,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOENT if the key is not found.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  */
@@ -512,7 +512,7 @@ struct rte_hash *
  * @return
  *   - -EINVAL if the parameters are invalid.
  *   - -ENOENT if the key is not found.
- *   - A positive value that can be used by the caller as an offset into an
+ *   - A non-negative value that can be used by the caller as an offset into an
  *     array of user data. This value is unique for this key, and is the same
  *     value that was returned when the key was added.
  */
Signature · 1 line
1.8.3.1
#2 lore raw

I believe this patch requires fixline and cc stable@

Fixes af75078fece3 ("first public release")

Apart from it

чт, 6 июл. 2023 г. в 23:58, Stephen Hemminger <[email protected]>:

Quoted 10 lines
Quoted 3 lines · On Mon, 27 Jun 2022 21:11:21 +0800 Chenming C <[email protected]> wrote:

The rte_hash lookup can return ZERO which is not a positive value.

Right, zero is neither positive or negative.

Signature · 2 lines
Regards,
Vladimir
Acked-by Stephen Hemminger Acked-by Vladimir Medvedkin on v1 1/1
#3 lore raw
In reply to Chenming C

Hello,

Quoted 3 lines · Chenming C

The rte_hash lookup can return ZERO which is not a positive value.

Fixes af75078fece3 ("first public release")
Quoted 1 line

Sorry, I had forgotten about this patch.
Applied, thanks.

Signature · 1 line
David Marchand