diff mbox

[rdma-core] mlx4: Enable WQ creation with IBV_WQ_FLAGS_SCATTER_FCS

Message ID 1522143442-31794-1-git-send-email-yishaih@mellanox.com (mailing list archive)
State Accepted
Delegated to: Leon Romanovsky
Headers show

Commit Message

Yishai Hadas March 27, 2018, 9:37 a.m. UTC
From: Guy Levi <guyle@mellanox.com>

Enable WQ creation with the IBV_WQ_FLAGS_SCATTER_FCS flag.

Prior to using this option an application should check whether the
IBV_RAW_PACKET_CAP_SCATTER_FCS capability is set on the device's
raw_packet_caps.

Signed-off-by: Guy Levi <guyle@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
---

PR was sent:
https://github.com/linux-rdma/rdma-core/pull/314

 providers/mlx4/verbs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky March 27, 2018, 3:36 p.m. UTC | #1
On Tue, Mar 27, 2018 at 12:37:22PM +0300, Yishai Hadas wrote:
> From: Guy Levi <guyle@mellanox.com>
>
> Enable WQ creation with the IBV_WQ_FLAGS_SCATTER_FCS flag.
>
> Prior to using this option an application should check whether the
> IBV_RAW_PACKET_CAP_SCATTER_FCS capability is set on the device's
> raw_packet_caps.
>
> Signed-off-by: Guy Levi <guyle@mellanox.com>
> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> ---
>
> PR was sent:
> https://github.com/linux-rdma/rdma-core/pull/314
>
>  providers/mlx4/verbs.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c
> index 9d8d340..534838b 100644
> --- a/providers/mlx4/verbs.c
> +++ b/providers/mlx4/verbs.c
> @@ -1422,7 +1422,13 @@ struct ibv_wq *mlx4_create_wq(struct ibv_context *context,
>  		}
>  	}
>
> -	if (attr->comp_mask) {
> +	if (!check_comp_mask(attr->comp_mask, IBV_WQ_INIT_ATTR_FLAGS)) {
> +		errno = ENOTSUP;

It will be great to use variant "errno = EINVAL" as it is done in other cases.

> +		return NULL;
> +	}
> +
> +	if ((attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) &&
> +	    (attr->create_flags & ~IBV_WQ_FLAGS_SCATTER_FCS)) {
>  		errno = ENOTSUP;
>  		return NULL;
>  	}
> --
> 1.8.3.1
>
> --
> 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 March 27, 2018, 10:44 p.m. UTC | #2
On Tue, Mar 27, 2018 at 12:37:22PM +0300, Yishai Hadas wrote:
> From: Guy Levi <guyle@mellanox.com>
> 
> Enable WQ creation with the IBV_WQ_FLAGS_SCATTER_FCS flag.
> 
> Prior to using this option an application should check whether the
> IBV_RAW_PACKET_CAP_SCATTER_FCS capability is set on the device's
> raw_packet_caps.
> 
> Signed-off-by: Guy Levi <guyle@mellanox.com>
> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> 
> PR was sent:
> https://github.com/linux-rdma/rdma-core/pull/314
> 
>  providers/mlx4/verbs.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c
> index 9d8d340..534838b 100644
> +++ b/providers/mlx4/verbs.c
> @@ -1422,7 +1422,13 @@ struct ibv_wq *mlx4_create_wq(struct ibv_context *context,
>  		}
>  	}
>  
> -	if (attr->comp_mask) {
> +	if (!check_comp_mask(attr->comp_mask, IBV_WQ_INIT_ATTR_FLAGS)) {
> +		errno = ENOTSUP;
> +		return NULL;
> +	}
> +
> +	if ((attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) &&
> +	    (attr->create_flags & ~IBV_WQ_FLAGS_SCATTER_FCS)) {
>  		errno = ENOTSUP;
>  		return NULL;
>  	}

I was looking at this and wondering why we dont have SCATTER_FCS in
include/uapi/rdma at all.

Please send a patch fixing that.

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 March 28, 2018, 4:55 p.m. UTC | #3
On 3/28/2018 1:44 AM, Jason Gunthorpe wrote:
> On Tue, Mar 27, 2018 at 12:37:22PM +0300, Yishai Hadas wrote:
>> From: Guy Levi <guyle@mellanox.com>
>>
>> Enable WQ creation with the IBV_WQ_FLAGS_SCATTER_FCS flag.
>>
>> Prior to using this option an application should check whether the
>> IBV_RAW_PACKET_CAP_SCATTER_FCS capability is set on the device's
>> raw_packet_caps.
>>
>> Signed-off-by: Guy Levi <guyle@mellanox.com>
>> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
>>
>> PR was sent:
>> https://github.com/linux-rdma/rdma-core/pull/314
>>
>>   providers/mlx4/verbs.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c
>> index 9d8d340..534838b 100644
>> +++ b/providers/mlx4/verbs.c
>> @@ -1422,7 +1422,13 @@ struct ibv_wq *mlx4_create_wq(struct ibv_context *context,
>>   		}
>>   	}
>>   
>> -	if (attr->comp_mask) {
>> +	if (!check_comp_mask(attr->comp_mask, IBV_WQ_INIT_ATTR_FLAGS)) {
>> +		errno = ENOTSUP;
>> +		return NULL;
>> +	}
>> +
>> +	if ((attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) &&
>> +	    (attr->create_flags & ~IBV_WQ_FLAGS_SCATTER_FCS)) {
>>   		errno = ENOTSUP;
>>   		return NULL;
>>   	}
> 
> I was looking at this and wondering why we dont have SCATTER_FCS in
> include/uapi/rdma at all.
> 

This may be some kernel refactoring to move it as part of other uAPI 
stuff to include/uapi/rdma. No change is expected in rdma-core as it's 
part of verbs.h which is used directly by the applications.

Re "comp_mask errno": we should go forward with ENOTSUP/EOPNOTSUPP as 
was lastly introduced by the ioctl series and followed by that patch.

The patch was merged.
Yishai
--
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/mlx4/verbs.c b/providers/mlx4/verbs.c
index 9d8d340..534838b 100644
--- a/providers/mlx4/verbs.c
+++ b/providers/mlx4/verbs.c
@@ -1422,7 +1422,13 @@  struct ibv_wq *mlx4_create_wq(struct ibv_context *context,
 		}
 	}
 
-	if (attr->comp_mask) {
+	if (!check_comp_mask(attr->comp_mask, IBV_WQ_INIT_ATTR_FLAGS)) {
+		errno = ENOTSUP;
+		return NULL;
+	}
+
+	if ((attr->comp_mask & IBV_WQ_INIT_ATTR_FLAGS) &&
+	    (attr->create_flags & ~IBV_WQ_FLAGS_SCATTER_FCS)) {
 		errno = ENOTSUP;
 		return NULL;
 	}