[ovs-dev] [PATCH] dpif-netdev: Avoid "sparse" warning.

Kevin Traynor ktraynor at redhat.com
Mon Dec 11 20:18:35 UTC 2017


On 12/11/2017 06:34 PM, Ben Pfaff wrote:
> "sparse" warns when odp_port_t is used directly in an inequality
> comparison.  This avoids the warning.
> 
> CC: Kevin Traynor <ktraynor at redhat.com>
> Fixes: a130f1a89bd8 ("dpif-netdev: Add port/queue tiebreaker to rxq_cycle_sort.")
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---

Thanks for fixing this :/ I'm not seeing that warning, so I need to
figure that part out on my side.

Acked-by: Kevin Traynor <ktraynor at redhat.com>

>  lib/dpif-netdev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 43f6a7857412..68fb3925bcf1 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -3444,8 +3444,10 @@ compare_rxq_cycles(const void *a, const void *b)
>          /* Cycles are the same so tiebreak on port/queue id.
>           * Tiebreaking (as opposed to return 0) ensures consistent
>           * sort results across multiple OS's. */
> -        if (qa->port->port_no != qb->port->port_no) {
> -            return (qa->port->port_no > qb->port->port_no) ? 1 : -1;
> +        uint32_t port_qa = odp_to_u32(qa->port->port_no);
> +        uint32_t port_qb = odp_to_u32(qb->port->port_no);
> +        if (port_qa != port_qb) {
> +            return port_qa > port_qb ? 1 : -1;
>          } else {
>              return netdev_rxq_get_queue_id(qa->rx)
>                      - netdev_rxq_get_queue_id(qb->rx);
> 



More information about the dev mailing list