[dpdk-dev,4/5] net/mlx5: fix build with gcc 7.1
Checks
Commit Message
build error:
.../dpdk/drivers/net/mlx5/mlx5_fdir.c:
In function ‘fdir_filter_to_flow_desc’:
.../dpdk/drivers/net/mlx5/mlx5_fdir.c:146:18:
error: this statement may fall through [-Werror=implicit-fallthrough=]
desc->dst_port = fdir_filter->input.flow.udp4_flow.dst_port;
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/mlx5/mlx5_fdir.c:147:2: note: here
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
^~~~
Fixed by adding fallthrough comment to the code.
Fixes: 76f5c99e6840 ("mlx5: support flow director")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/mlx5/mlx5_fdir.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Tue, Jun 13, 2017 at 05:42:11PM +0100, Ferruh Yigit wrote:
> build error:
> .../dpdk/drivers/net/mlx5/mlx5_fdir.c:
> In function ‘fdir_filter_to_flow_desc’:
> .../dpdk/drivers/net/mlx5/mlx5_fdir.c:146:18:
> error: this statement may fall through [-Werror=implicit-fallthrough=]
> desc->dst_port = fdir_filter->input.flow.udp4_flow.dst_port;
> ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> .../dpdk/drivers/net/mlx5/mlx5_fdir.c:147:2: note: here
> case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
> ^~~~
>
> Fixed by adding fallthrough comment to the code.
>
> Fixes: 76f5c99e6840 ("mlx5: support flow director")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> drivers/net/mlx5/mlx5_fdir.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/mlx5/mlx5_fdir.c b/drivers/net/mlx5/mlx5_fdir.c
> index 1cff41bab..c8d47489f 100644
> --- a/drivers/net/mlx5/mlx5_fdir.c
> +++ b/drivers/net/mlx5/mlx5_fdir.c
> @@ -144,6 +144,7 @@ fdir_filter_to_flow_desc(const struct rte_eth_fdir_filter *fdir_filter,
> case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
> desc->src_port = fdir_filter->input.flow.udp4_flow.src_port;
> desc->dst_port = fdir_filter->input.flow.udp4_flow.dst_port;
> + /* fallthrough */
> case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
> desc->src_ip[0] = fdir_filter->input.flow.ip4_flow.src_ip;
> desc->dst_ip[0] = fdir_filter->input.flow.ip4_flow.dst_ip;
That's a fine workaround, therefore:
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
On a personal note though, GCC, seriously? While I understand missing breaks
inside switch statements is a common mistake, having the compiler rely on a
comment that basically says "yes, it's done on purpose" just doesn't feel
right; compilers should discard comments and not attempt to interpret them,
otherwise they have to deal with locale-related issues. It's like enforcing
checkpatch.pl rules in GCC by default. Anyway, back to work.
@@ -144,6 +144,7 @@ fdir_filter_to_flow_desc(const struct rte_eth_fdir_filter *fdir_filter,
case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
desc->src_port = fdir_filter->input.flow.udp4_flow.src_port;
desc->dst_port = fdir_filter->input.flow.udp4_flow.dst_port;
+ /* fallthrough */
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
desc->src_ip[0] = fdir_filter->input.flow.ip4_flow.src_ip;
desc->dst_ip[0] = fdir_filter->input.flow.ip4_flow.dst_ip;