diff mbox

[rdma-core,3/6] mlx5: Fix missing break statement in sq_overhead

Message ID 1485896886-23517-4-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe Jan. 31, 2017, 9:08 p.m. UTC
gcc 7.0.1 observes:

providers/mlx5/verbs.c:745:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
   size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 providers/mlx5/verbs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jason Gunthorpe Jan. 31, 2017, 9:12 p.m. UTC | #1
On Tue, Jan 31, 2017 at 02:08:03PM -0700, Jason Gunthorpe wrote:
> gcc 7.0.1 observes:
> 
> providers/mlx5/verbs.c:745:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>  providers/mlx5/verbs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
> index 04a5462ce41d03..60854402fec2d4 100644
> +++ b/providers/mlx5/verbs.c
> @@ -743,6 +743,8 @@ static int sq_overhead(enum ibv_qp_type	qp_type)
>  
>  	case IBV_QPT_XRC_SEND:
>  		size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;
> +		break;
> +
>  	case IBV_QPT_XRC_RECV:
>  		size = max(size, sizeof(struct mlx5_wqe_ctrl_seg) +
>  			   sizeof(struct mlx5_wqe_xrc_seg) +

Hum, looking again this confusing construction was probably as
intended before.. Yishai can you let me know?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yishai Hadas Jan. 31, 2017, 9:37 p.m. UTC | #2
On 1/31/2017 11:12 PM, Jason Gunthorpe wrote:
> On Tue, Jan 31, 2017 at 02:08:03PM -0700, Jason Gunthorpe wrote:
>> gcc 7.0.1 observes:
>>
>> providers/mlx5/verbs.c:745:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>    size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;
>>
>> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>>  providers/mlx5/verbs.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
>> index 04a5462ce41d03..60854402fec2d4 100644
>> +++ b/providers/mlx5/verbs.c
>> @@ -743,6 +743,8 @@ static int sq_overhead(enum ibv_qp_type	qp_type)
>>
>>  	case IBV_QPT_XRC_SEND:
>>  		size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;
>> +		break;
>> +
>>  	case IBV_QPT_XRC_RECV:
>>  		size = max(size, sizeof(struct mlx5_wqe_ctrl_seg) +
>>  			   sizeof(struct mlx5_wqe_xrc_seg) +
>
> Hum, looking again this confusing construction was probably as
> intended before.. Yishai can you let me know?

The original code is correct, it intended to fallback to 
IBV_QPT_XRC_RECV to take into account the size of struct 
mlx5_wqe_xrc_seg in both cases.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe Jan. 31, 2017, 9:56 p.m. UTC | #3
On Tue, Jan 31, 2017 at 11:37:49PM +0200, Yishai Hadas wrote:

> >Hum, looking again this confusing construction was probably as
> >intended before.. Yishai can you let me know?
> 
> The original code is correct, it intended to fallback to IBV_QPT_XRC_RECV to
> take into account the size of struct mlx5_wqe_xrc_seg in both cases.

okay thanks I updated the PR

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index 04a5462ce41d03..60854402fec2d4 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -743,6 +743,8 @@  static int sq_overhead(enum ibv_qp_type	qp_type)
 
 	case IBV_QPT_XRC_SEND:
 		size = sizeof(struct mlx5_wqe_ctrl_seg) + mw_bind_size;
+		break;
+
 	case IBV_QPT_XRC_RECV:
 		size = max(size, sizeof(struct mlx5_wqe_ctrl_seg) +
 			   sizeof(struct mlx5_wqe_xrc_seg) +