[v3,1/2] lpm: add const to lpm arg of rte_lpm_lookup

Message ID 20220530182437.56853-1-kda@semihalf.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v3,1/2] lpm: add const to lpm arg of rte_lpm_lookup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stanislaw Kardach May 30, 2022, 6:24 p.m. UTC
  All other rte_lpm_lookup* functions take lpm argument as a const. As the
basic rte_lpm_lookup() performs the same function, it should also do
that.

As this function is inline, no API/ABI change happens.

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
---
 lib/lpm/rte_lpm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stephen Hemminger May 30, 2022, 8:38 p.m. UTC | #1
On Mon, 30 May 2022 20:24:36 +0200
Stanislaw Kardach <kda@semihalf.com> wrote:

> All other rte_lpm_lookup* functions take lpm argument as a const. As the
> basic rte_lpm_lookup() performs the same function, it should also do
> that.
> 
> As this function is inline, no API/ABI change happens.
> 
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Vladimir Medvedkin June 1, 2022, 9:35 a.m. UTC | #2
On 30/05/2022 19:24, Stanislaw Kardach wrote:
> All other rte_lpm_lookup* functions take lpm argument as a const. As the
> basic rte_lpm_lookup() performs the same function, it should also do
> that.
> 
> As this function is inline, no API/ABI change happens.
> 
> Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> ---
>   lib/lpm/rte_lpm.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
> index eb91960e81..1cf863a146 100644
> --- a/lib/lpm/rte_lpm.h
> +++ b/lib/lpm/rte_lpm.h
> @@ -279,7 +279,7 @@ rte_lpm_delete_all(struct rte_lpm *lpm);
>    *   -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
>    */
>   static inline int
> -rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
> +rte_lpm_lookup(const struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
>   {
>   	unsigned tbl24_index = (ip >> 8);
>   	uint32_t tbl_entry;

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
  

Patch

diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
index eb91960e81..1cf863a146 100644
--- a/lib/lpm/rte_lpm.h
+++ b/lib/lpm/rte_lpm.h
@@ -279,7 +279,7 @@  rte_lpm_delete_all(struct rte_lpm *lpm);
  *   -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
  */
 static inline int
-rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
+rte_lpm_lookup(const struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)
 {
 	unsigned tbl24_index = (ip >> 8);
 	uint32_t tbl_entry;