ring: fix build with -Wswitch-enum
authorDavid Marchand <david.marchand@redhat.com>
Mon, 27 Apr 2020 13:23:39 +0000 (15:23 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 28 Apr 2020 09:34:40 +0000 (11:34 +0200)
Some popular vswitch implementation might use a gcc option that
complains about missing enums in switch statements.
Fix this by listing all possible values.

Fixes: 664ff4b1729b ("ring: introduce peek style API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_ring/rte_ring_peek.h

index 9e7f4db..d5e6ea1 100644 (file)
@@ -68,6 +68,8 @@ __rte_ring_do_enqueue_start(struct rte_ring *r, uint32_t n,
                n =  __rte_ring_hts_move_prod_head(r, n, behavior,
                        &head, &free);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
@@ -217,6 +219,8 @@ rte_ring_enqueue_elem_finish(struct rte_ring *r, const void *obj_table,
                        __rte_ring_enqueue_elems(r, tail, obj_table, esize, n);
                __rte_ring_hts_set_head_tail(&r->hts_prod, tail, n, 1);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
@@ -263,6 +267,8 @@ __rte_ring_do_dequeue_start(struct rte_ring *r, void *obj_table,
                n =  __rte_ring_hts_move_cons_head(r, n, behavior,
                        &head, &avail);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);
@@ -414,6 +420,8 @@ rte_ring_dequeue_elem_finish(struct rte_ring *r, unsigned int n)
                n = __rte_ring_hts_get_tail(&r->hts_cons, &tail, n);
                __rte_ring_hts_set_head_tail(&r->hts_cons, tail, n, 0);
                break;
+       case RTE_RING_SYNC_MT:
+       case RTE_RING_SYNC_MT_RTS:
        default:
                /* unsupported mode, shouldn't be here */
                RTE_ASSERT(0);