[v3,18/19] net/hinic: optimize RX performance

Message ID 8dea773bd37c783e349692afae166cfa1cf9a8b5.1569850827.git.cloud.wangxiaoyun@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series Add advanced features for Huawei hinic pmd |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Wangxiaoyun (Cloud) Sept. 30, 2019, 2 p.m. UTC
  This patch optimizes receive packets performance
on arm platform.

Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
---
 drivers/net/hinic/hinic_pmd_rx.c |  5 +----
 drivers/net/hinic/hinic_pmd_rx.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Sept. 30, 2019, 3:10 p.m. UTC | #1
On 9/30/2019 3:00 PM, Xiaoyun wang wrote:
> This patch optimizes receive packets performance
> on arm platform.
> 
> Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>

<...>

> @@ -28,6 +28,7 @@ struct hinic_rq_ctrl {
>  	u32	ctrl_fmt;
>  };
>  
> +#if defined(__X86_64_SSE__)
>  struct hinic_rq_cqe {
>  	u32 status;
>  	u32 vlan_len;
> @@ -36,6 +37,16 @@ struct hinic_rq_cqe {
>  
>  	u32 rsvd[4];
>  };
> +#elif defined(__ARM64_NEON__)
> +struct hinic_rq_cqe {
> +	u32 status;
> +	u32 vlan_len;
> +	u32 offload_type;
> +	u32 rss_hash;
> +
> +	u32 rsvd[4];
> +} __rte_cache_aligned;
> +#endif

This change makes "struct hinic_rq_cqe" only exist for 'x86_64' and 'ARM64', if
the intention is to add '__rte_cache_aligned' for the neon, would following
work, which will also work for all archs:


 struct hinic_rq_cqe {
 	u32 status;
 	u32 vlan_len;
 	u32 offload_type;
 	u32 rss_hash;

 	u32 rsvd[4];
 #if defined(__ARM64_NEON__)
 } __rte_cache_aligned;
 #else
 };
 #endif

If this works, can you please send a new version with this update?
  
Wangxiaoyun (Cloud) Oct. 8, 2019, 3:19 p.m. UTC | #2
Hi Ferruh,
      Thanks for your comments. I think you're right, i will modify it with Patch V4. Also I change it with the same structure
for X86-64 and ARM platform with cache-aligned, and test the RX performance, all is OK.

Best Regards
Xiaoyun Wang

在 2019/9/30 23:10, Ferruh Yigit 写道:
> On 9/30/2019 3:00 PM, Xiaoyun wang wrote:
>> This patch optimizes receive packets performance
>> on arm platform.
>>
>> Signed-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>
> <...>
>
>> @@ -28,6 +28,7 @@ struct hinic_rq_ctrl {
>>   	u32	ctrl_fmt;
>>   };
>>   
>> +#if defined(__X86_64_SSE__)
>>   struct hinic_rq_cqe {
>>   	u32 status;
>>   	u32 vlan_len;
>> @@ -36,6 +37,16 @@ struct hinic_rq_cqe {
>>   
>>   	u32 rsvd[4];
>>   };
>> +#elif defined(__ARM64_NEON__)
>> +struct hinic_rq_cqe {
>> +	u32 status;
>> +	u32 vlan_len;
>> +	u32 offload_type;
>> +	u32 rss_hash;
>> +
>> +	u32 rsvd[4];
>> +} __rte_cache_aligned;
>> +#endif
> This change makes "struct hinic_rq_cqe" only exist for 'x86_64' and 'ARM64', if
> the intention is to add '__rte_cache_aligned' for the neon, would following
> work, which will also work for all archs:
>
>
>   struct hinic_rq_cqe {
>   	u32 status;
>   	u32 vlan_len;
>   	u32 offload_type;
>   	u32 rss_hash;
>
>   	u32 rsvd[4];
>   #if defined(__ARM64_NEON__)
>   } __rte_cache_aligned;
>   #else
>   };
>   #endif
>
> If this works, can you please send a new version with this update?
>
  

Patch

diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index 37b4f5c..b3c2eb4 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -972,13 +972,10 @@  u16 hinic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, u16 nb_pkts)
 	while (pkts < nb_pkts) {
 		 /* 2. current ci is done */
 		rx_cqe = &rxq->rx_cqe[sw_ci];
-		status = rx_cqe->status;
+		status = __atomic_load_n(&rx_cqe->status, __ATOMIC_ACQUIRE);
 		if (!HINIC_GET_RX_DONE_BE(status))
 			break;
 
-		/* read other cqe member after status */
-		rte_rmb();
-
 		/* convert cqe and get packet length */
 		hinic_rq_cqe_be_to_cpu32(&cqe, (volatile void *)rx_cqe);
 		vlan_len = cqe.vlan_len;
diff --git a/drivers/net/hinic/hinic_pmd_rx.h b/drivers/net/hinic/hinic_pmd_rx.h
index fe2735b..fa27e91 100644
--- a/drivers/net/hinic/hinic_pmd_rx.h
+++ b/drivers/net/hinic/hinic_pmd_rx.h
@@ -28,6 +28,7 @@  struct hinic_rq_ctrl {
 	u32	ctrl_fmt;
 };
 
+#if defined(__X86_64_SSE__)
 struct hinic_rq_cqe {
 	u32 status;
 	u32 vlan_len;
@@ -36,6 +37,16 @@  struct hinic_rq_cqe {
 
 	u32 rsvd[4];
 };
+#elif defined(__ARM64_NEON__)
+struct hinic_rq_cqe {
+	u32 status;
+	u32 vlan_len;
+	u32 offload_type;
+	u32 rss_hash;
+
+	u32 rsvd[4];
+} __rte_cache_aligned;
+#endif
 
 struct hinic_rq_cqe_sect {
 	struct hinic_sge	sge;