[1/3] ring: fix build with -Wswitch-enum

Message ID 20200427132341.27681-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series 20.05-rc1 fixes for OVS |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

David Marchand April 27, 2020, 1:23 p.m. UTC
  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>
---
 lib/librte_ring/rte_ring_peek.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Ananyev, Konstantin April 27, 2020, 2:55 p.m. UTC | #1
> 
> 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>
> ---
>  lib/librte_ring/rte_ring_peek.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/lib/librte_ring/rte_ring_peek.h b/lib/librte_ring/rte_ring_peek.h
> index 9e7f4db323..d5e6ea1cf3 100644
> --- a/lib/librte_ring/rte_ring_peek.h
> +++ b/lib/librte_ring/rte_ring_peek.h
> @@ -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);
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.23.0
  

Patch

diff --git a/lib/librte_ring/rte_ring_peek.h b/lib/librte_ring/rte_ring_peek.h
index 9e7f4db323..d5e6ea1cf3 100644
--- a/lib/librte_ring/rte_ring_peek.h
+++ b/lib/librte_ring/rte_ring_peek.h
@@ -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);