[v2,2/2] net/i40e: restrict pointer aliasing for NEON vPMD

Message ID 20200413155640.53581-3-gavin.hu@arm.com (mailing list archive)
State Superseded, archived
Headers
Series i40e NEON vPMD optimization on aarch64 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Gavin Hu April 13, 2020, 3:56 p.m. UTC
  restrict pointer aliasing to optimize the code generated.

The patch showed ~3% performnace uplift on Arm N1SDP platform, and no
degradation on ThunderX2. The tet case is RFC2544 zero-loss L2
forwarding running testpmd.

[1] https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Restricted-Pointers.html

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
---
 drivers/net/i40e/i40e_rxtx_vec_neon.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
  

Comments

Ferruh Yigit April 20, 2020, 2:51 p.m. UTC | #1
On 4/13/2020 4:56 PM, Gavin Hu wrote:
> restrict pointer aliasing to optimize the code generated.
> 
> The patch showed ~3% performnace uplift on Arm N1SDP platform, and no
> degradation on ThunderX2. The tet case is RFC2544 zero-loss L2
> forwarding running testpmd.
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Restricted-Pointers.html
> 
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Steve Capper <steve.capper@arm.com>

Hi Gavin,

Raslan supported following build error [1], this is blocking the next-net, can
you please check the error, and send a fix for it?

[1]
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:175:65: error: expected
';', ',' or ')' before 'rx_pkts'
desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **restrict rx_pkts,
^
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:197:51: error: expected
';', ',' or ')' before 'rxq'
_recv_raw_pkts_vec(struct i40e_rx_queue *restrict rxq, struct rte_mbuf
^
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:435:35: error: expected
';', ',' or ')' before 'rx_queue'
i40e_recv_pkts_vec(void *restrict rx_queue, struct rte_mbuf **restrict rx_pkts,
^
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c: In function
'i40e_recv_scattered_pkts_vec':
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:456:2: error: implicit
declaration of function '_recv_raw_pkts_vec' [-Werror=implicit-function-declaration]
uint16_t nb_bufs = _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts,
^
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:456:2: error: nested extern
declaration of '_recv_raw_pkts_vec' [-Werror=nested-externs]
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c: At top level:
/download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:507:42: error: expected
';', ',' or ')' before 'tx_queue'
i40e_xmit_fixed_burst_vec(void *restrict tx_queue,


gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
seen this with T=arm64-bluefield-linuxapp-gcc and T=arm64-armv8a-linux-gcc
using make
  
Gavin Hu April 21, 2020, 9:51 a.m. UTC | #2
Hi Ferruh,

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Monday, April 20, 2020 10:51 PM
> To: Gavin Hu <Gavin.Hu@arm.com>; dev@dpdk.org
> Cc: nd <nd@arm.com>; david.marchand@redhat.com;
> thomas@monjalon.net; jerinj@marvell.com; xiaolong.ye@intel.com;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; Phil Yang <Phil.Yang@arm.com>; Joyce Kong
> <Joyce.Kong@arm.com>; Steve Capper <Steve.Capper@arm.com>; Raslan
> Darawsheh <rasland@mellanox.com>
> Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/i40e: restrict pointer aliasing for
> NEON vPMD
> 
> On 4/13/2020 4:56 PM, Gavin Hu wrote:
> > restrict pointer aliasing to optimize the code generated.
> >
> > The patch showed ~3% performnace uplift on Arm N1SDP platform, and
> no
> > degradation on ThunderX2. The tet case is RFC2544 zero-loss L2
> > forwarding running testpmd.
> >
> > [1] https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Restricted-Pointers.html
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Steve Capper <steve.capper@arm.com>
> 
> Hi Gavin,
> 
> Raslan supported following build error [1], this is blocking the next-net, can
> you please check the error, and send a fix for it?
> 
> [1]
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:175:65: error:
> expected
> ';', ',' or ')' before 'rx_pkts'
> desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **restrict rx_pkts,
> ^
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:197:51: error:
> expected
> ';', ',' or ')' before 'rxq'
> _recv_raw_pkts_vec(struct i40e_rx_queue *restrict rxq, struct rte_mbuf
> ^
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:435:35: error:
> expected
> ';', ',' or ')' before 'rx_queue'
> i40e_recv_pkts_vec(void *restrict rx_queue, struct rte_mbuf **restrict
> rx_pkts,
> ^
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c: In function
> 'i40e_recv_scattered_pkts_vec':
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:456:2: error:
> implicit
> declaration of function '_recv_raw_pkts_vec' [-Werror=implicit-function-
> declaration]
> uint16_t nb_bufs = _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts,
> ^
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:456:2: error:
> nested extern
> declaration of '_recv_raw_pkts_vec' [-Werror=nested-externs]
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c: At top level:
> /download/dpdk/drivers/net/i40e/i40e_rxtx_vec_neon.c:507:42: error:
> expected
> ';', ',' or ')' before 'tx_queue'
> i40e_xmit_fixed_burst_vec(void *restrict tx_queue,
> 
> 
> gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
> seen this with T=arm64-bluefield-linuxapp-gcc and T=arm64-armv8a-linux-
> gcc
> using make

Sorry for the leakage, I submitted a patch to fix this: http://patches.dpdk.org/patch/69006/
It was verified with gcc 4.8.5 and gcc-8, as well as meson + clang.
  

Patch

diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 4376d8911..405bd82df 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -172,8 +172,8 @@  desc_to_olflags_v(struct i40e_rx_queue *rxq, uint64x2_t descs[4],
 #define I40E_UINT16_BIT (CHAR_BIT * sizeof(uint16_t))
 
 static inline void
-desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **rx_pkts,
-		uint32_t *ptype_tbl)
+desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **restrict rx_pkts,
+		uint32_t *restrict ptype_tbl)
 {
 	int i;
 	uint8_t ptype;
@@ -194,8 +194,8 @@  desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **rx_pkts,
  *   numbers of DD bits
  */
 static inline uint16_t
-_recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
-		   uint16_t nb_pkts, uint8_t *split_packet)
+_recv_raw_pkts_vec(struct i40e_rx_queue *restrict rxq, struct rte_mbuf
+	**restrict rx_pkts, uint16_t nb_pkts, uint8_t *split_packet)
 {
 	volatile union i40e_rx_desc *rxdp;
 	struct i40e_rx_entry *sw_ring;
@@ -432,7 +432,7 @@  _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
  *   numbers of DD bits
  */
 uint16_t
-i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+i40e_recv_pkts_vec(void *restrict rx_queue, struct rte_mbuf **restrict rx_pkts,
 		   uint16_t nb_pkts)
 {
 	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
@@ -494,8 +494,8 @@  vtx1(volatile struct i40e_tx_desc *txdp,
 }
 
 static inline void
-vtx(volatile struct i40e_tx_desc *txdp,
-		struct rte_mbuf **pkt, uint16_t nb_pkts,  uint64_t flags)
+vtx(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkt,
+		uint16_t nb_pkts,  uint64_t flags)
 {
 	int i;
 
@@ -504,8 +504,8 @@  vtx(volatile struct i40e_tx_desc *txdp,
 }
 
 uint16_t
-i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
-			  uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *restrict tx_queue,
+	struct rte_mbuf **restrict tx_pkts, uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;