[dpdk-dev] [PATCH v13 3/7] net/iavf: add support for asynchronous virt channel messages

Ferruh Yigit ferruh.yigit at intel.com
Fri Oct 29 22:33:07 CEST 2021


On 10/28/2021 5:04 PM, Radu Nicolau wrote:
> @@ -339,15 +340,35 @@ _clear_cmd(struct iavf_info *vf)
>   static inline int
>   _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
>   {
> -	int ret = rte_atomic32_cmpset((volatile uint32_t *)&vf->pend_cmd,
> -		VIRTCHNL_OP_UNKNOWN, ops);
> +	enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
> +	int ret = __atomic_compare_exchange((volatile uint32_t *)&vf->pend_cmd,
> +			&op_unk, &ops,
> +			0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
>   
>   	if (!ret)
>   		PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
>   
> +	__atomic_store_n(&vf->pend_cmd_count, 1, __ATOMIC_RELAXED);
> +
>   	return !ret;
>   }
>   
> +/* Check there is pending cmd in execution. If none, set new command. */
> +static inline int
> +_atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
> +{
> +	enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
> +	int ret = __atomic_compare_exchange((volatile uint32_t *)&vf->pend_cmd,
> +			&op_unk, &ops,
> +			0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);
> +
> +	if (!ret)
> +		PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
> +
> +	__atomic_store_n(&vf->pend_cmd_count, 2, __ATOMIC_RELAXED);
> +
> +	return !ret;
> +}

David reported build error on Windows [1], fixing in next-net [2].
@Radu can you please confirm the latest code in the next-net?



[1]
../drivers/net/iavf/iavf_rxtx_vec_avx512.c
In file included from ../drivers/net/iavf/iavf_rxtx_vec_avx512.c:5:
In file included from ..\drivers\net\iavf/iavf_rxtx_vec_common.h:11:
..\drivers\net\iavf/iavf.h:376:4: error: passing 'enum virtchnl_ops *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
                         &op_unk, &ops,
                         ^~~~~~~
..\drivers\net\iavf/iavf.h:376:13: error: passing 'enum virtchnl_ops *' to parameter of type 'volatile uint32_t *' (aka 'volatile unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
                         &op_unk, &ops,
                                  ^~~~
..\drivers\net\iavf/iavf.h:393:4: error: passing 'enum virtchnl_ops *' to parameter of type 'uint32_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
                         &op_unk, &ops,
                         ^~~~~~~
..\drivers\net\iavf/iavf.h:393:13: error: passing 'enum virtchnl_ops *' to parameter of type 'volatile uint32_t *' (aka 'volatile unsigned int *') converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
                         &op_unk, &ops,
                                  ^~~~
4 errors generated.


[2]
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 42fb66d71193..f413dbed833a 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -372,8 +372,7 @@ static inline int
  _atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
  {
         enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
-       int ret = __atomic_compare_exchange((volatile uint32_t *)&vf->pend_cmd,
-                       &op_unk, &ops,
+       int ret = __atomic_compare_exchange(&vf->pend_cmd, &op_unk, &ops,
                         0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);

         if (!ret)
@@ -389,8 +388,7 @@ static inline int
  _atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
  {
         enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
-       int ret = __atomic_compare_exchange((volatile uint32_t *)&vf->pend_cmd,
-                       &op_unk, &ops,
+       int ret = __atomic_compare_exchange(&vf->pend_cmd, &op_unk, &ops,
                         0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);

         if (!ret)


More information about the dev mailing list