2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif-netdev: Avoid "sparse" warning.

"sparse" warns when odp_port_t is used directly in an inequality
comparison.  This avoids the warning.

CC: Kevin Traynor <ktraynor@redhat.com>
Fixes: a130f1a89b ("dpif-netdev: Add port/queue tiebreaker to rxq_cycle_sort.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Ben Pfaff
2017-12-11 10:34:01 -08:00
parent 836476ce24
commit f0aa3801f1

View File

@@ -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);