[v4,1/2] lpm: add const to lpm arg of rte_lpm_lookup
Checks
Commit Message
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: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/lpm/rte_lpm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
01/06/2022 13:15, Stanislaw Kardach:
> 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.
It is an API change and should be noted in the release notes.
> 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)
On Thu, Jun 02, 2022 at 10:52:25PM +0200, Thomas Monjalon wrote:
> 01/06/2022 13:15, Stanislaw Kardach:
> > 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.
>
> It is an API change and should be noted in the release notes.
>
> > 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)
>
While I've no particular objection to it appearing in the RN doc, I wonder
whether it really counts as an API change. I can't see any practical
difference that this change would make to the end user - no source code
needs updating for example.
/Bruce
03/06/2022 09:29, Bruce Richardson:
> On Thu, Jun 02, 2022 at 10:52:25PM +0200, Thomas Monjalon wrote:
> > 01/06/2022 13:15, Stanislaw Kardach:
> > > 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.
> >
> > It is an API change and should be noted in the release notes.
> >
> > > 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)
> >
> While I've no particular objection to it appearing in the RN doc, I wonder
> whether it really counts as an API change. I can't see any practical
> difference that this change would make to the end user - no source code
> needs updating for example.
Yes you're right, we can skip the release notes here.
@@ -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;