[v2,4/6] net/i40e: replace restrict with rte restrict

Message ID 20200706074930.54299-5-joyce.kong@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series Restrict pointer aliasing with a common wrapper |

Checks

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

Commit Message

Joyce Kong July 6, 2020, 7:49 a.m. UTC
  '__rte_restrict' is a common wrapper for restricted pointers which
can be supported by all compilers. Use '__rte_restrict' instead of
'__restrict' for code consistency.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
---
 drivers/net/i40e/i40e_rxtx_vec_neon.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
  

Comments

Phil Yang July 7, 2020, 2:25 a.m. UTC | #1
> -----Original Message-----
> From: Joyce Kong <joyce.kong@arm.com>
> Sent: Monday, July 6, 2020 3:49 PM
> To: maxime.coquelin@redhat.com; jerinj@marvell.com;
> zhihong.wang@intel.com; xiaolong.ye@intel.com; beilei.xing@intel.com;
> jia.guo@intel.com; john.mcnamara@intel.com; matan@mellanox.com;
> shahafs@mellanox.com; viacheslavo@mellanox.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>
> Subject: [PATCH v2 4/6] net/i40e: replace restrict with rte restrict
> 
> '__rte_restrict' is a common wrapper for restricted pointers which
> can be supported by all compilers. Use '__rte_restrict' instead of
> '__restrict' for code consistency.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> ---
Reviewed-by: Phil Yang <phil.yang@arm.com> 


>  drivers/net/i40e/i40e_rxtx_vec_neon.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c
> b/drivers/net/i40e/i40e_rxtx_vec_neon.c
> index 1dfd0478b..4574139d5 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 **__restrict rx_pkts,
> -		uint32_t *__restrict ptype_tbl)
> +desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **__rte_restrict
> rx_pkts,
> +		uint32_t *__rte_restrict ptype_tbl)
>  {
>  	int i;
>  	uint8_t ptype;
> @@ -194,8 +194,9 @@ desc_to_ptype_v(uint64x2_t descs[4], struct
> rte_mbuf **__restrict rx_pkts,
>   *   numbers of DD bits
>   */
>  static inline uint16_t
> -_recv_raw_pkts_vec(struct i40e_rx_queue *__restrict rxq, struct rte_mbuf
> -	**__restrict rx_pkts, uint16_t nb_pkts, uint8_t *split_packet)
> +_recv_raw_pkts_vec(struct i40e_rx_queue *__rte_restrict rxq,
> +		   struct rte_mbuf **__rte_restrict rx_pkts,
> +		   uint16_t nb_pkts, uint8_t *split_packet)
>  {
>  	volatile union i40e_rx_desc *rxdp;
>  	struct i40e_rx_entry *sw_ring;
> @@ -432,8 +433,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue
> *__restrict rxq, struct rte_mbuf
>   *   numbers of DD bits
>   */
>  uint16_t
> -i40e_recv_pkts_vec(void *__restrict rx_queue,
> -		struct rte_mbuf **__restrict rx_pkts, uint16_t nb_pkts)
> +i40e_recv_pkts_vec(void *__rte_restrict rx_queue,
> +		struct rte_mbuf **__rte_restrict rx_pkts, uint16_t nb_pkts)
>  {
>  	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
>  }
> @@ -504,8 +505,8 @@ vtx(volatile struct i40e_tx_desc *txdp, struct
> rte_mbuf **pkt,
>  }
> 
>  uint16_t
> -i40e_xmit_fixed_burst_vec(void *__restrict tx_queue,
> -	struct rte_mbuf **__restrict tx_pkts, uint16_t nb_pkts)
> +i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
> +	struct rte_mbuf **__rte_restrict tx_pkts, uint16_t nb_pkts)
>  {
>  	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
>  	volatile struct i40e_tx_desc *txdp;
> --
> 2.27.0
  
Ruifeng Wang July 7, 2020, 2:43 a.m. UTC | #2
> -----Original Message-----
> From: Joyce Kong <joyce.kong@arm.com>
> Sent: Monday, July 6, 2020 3:49 PM
> To: maxime.coquelin@redhat.com; jerinj@marvell.com;
> zhihong.wang@intel.com; xiaolong.ye@intel.com; beilei.xing@intel.com;
> jia.guo@intel.com; john.mcnamara@intel.com; matan@mellanox.com;
> shahafs@mellanox.com; viacheslavo@mellanox.com; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>
> Subject: [PATCH v2 4/6] net/i40e: replace restrict with rte restrict
> 
> '__rte_restrict' is a common wrapper for restricted pointers which can be
> supported by all compilers. Use '__rte_restrict' instead of '__restrict' for
> code consistency.
> 
> Signed-off-by: Joyce Kong <joyce.kong@arm.com>
> ---
>  drivers/net/i40e/i40e_rxtx_vec_neon.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c
> b/drivers/net/i40e/i40e_rxtx_vec_neon.c
> index 1dfd0478b..4574139d5 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 **__restrict rx_pkts,
> -		uint32_t *__restrict ptype_tbl)
> +desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **__rte_restrict
> rx_pkts,
> +		uint32_t *__rte_restrict ptype_tbl)
>  {
>  	int i;
>  	uint8_t ptype;
> @@ -194,8 +194,9 @@ desc_to_ptype_v(uint64x2_t descs[4], struct
> rte_mbuf **__restrict rx_pkts,
>   *   numbers of DD bits
>   */
>  static inline uint16_t
> -_recv_raw_pkts_vec(struct i40e_rx_queue *__restrict rxq, struct rte_mbuf
> -	**__restrict rx_pkts, uint16_t nb_pkts, uint8_t *split_packet)
> +_recv_raw_pkts_vec(struct i40e_rx_queue *__rte_restrict rxq,
> +		   struct rte_mbuf **__rte_restrict rx_pkts,
> +		   uint16_t nb_pkts, uint8_t *split_packet)
>  {
>  	volatile union i40e_rx_desc *rxdp;
>  	struct i40e_rx_entry *sw_ring;
> @@ -432,8 +433,8 @@ _recv_raw_pkts_vec(struct i40e_rx_queue
> *__restrict rxq, struct rte_mbuf
>   *   numbers of DD bits
>   */
>  uint16_t
> -i40e_recv_pkts_vec(void *__restrict rx_queue,
> -		struct rte_mbuf **__restrict rx_pkts, uint16_t nb_pkts)
> +i40e_recv_pkts_vec(void *__rte_restrict rx_queue,
> +		struct rte_mbuf **__rte_restrict rx_pkts, uint16_t nb_pkts)
>  {
>  	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);  }
> @@ -504,8 +505,8 @@ vtx(volatile struct i40e_tx_desc *txdp, struct
> rte_mbuf **pkt,  }
> 
>  uint16_t
> -i40e_xmit_fixed_burst_vec(void *__restrict tx_queue,
> -	struct rte_mbuf **__restrict tx_pkts, uint16_t nb_pkts)
> +i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
> +	struct rte_mbuf **__rte_restrict tx_pkts, uint16_t nb_pkts)
>  {
>  	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
>  	volatile struct i40e_tx_desc *txdp;
> --
> 2.27.0
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
  
David Marchand July 7, 2020, 2 p.m. UTC | #3
On Mon, Jul 6, 2020 at 9:50 AM Joyce Kong <joyce.kong@arm.com> wrote:
>
> '__rte_restrict' is a common wrapper for restricted pointers which
> can be supported by all compilers. Use '__rte_restrict' instead of
> '__restrict' for code consistency.

This patch 4, 5 and 6 are simple replacements and can be squashed into
the first patch.

Thanks.
  
Joyce Kong July 8, 2020, 3:21 a.m. UTC | #4
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, July 7, 2020 10:00 PM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; jerinj@marvell.com;
> Zhihong Wang <zhihong.wang@intel.com>; Xiaolong Ye
> <xiaolong.ye@intel.com>; Beilei Xing <beilei.xing@intel.com>; Jeff Guo
> <jia.guo@intel.com>; Mcnamara, John <john.mcnamara@intel.com>; Matan
> Azrad <matan@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>;
> Viacheslav Ovsiienko <viacheslavo@mellanox.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; dev <dev@dpdk.org>; nd
> <nd@arm.com>
> Subject: Re: [dpdk-dev] [PATCH v2 4/6] net/i40e: replace restrict with rte
> restrict
> 
> On Mon, Jul 6, 2020 at 9:50 AM Joyce Kong <joyce.kong@arm.com> wrote:
> >
> > '__rte_restrict' is a common wrapper for restricted pointers which can
> > be supported by all compilers. Use '__rte_restrict' instead of
> > '__restrict' for code consistency.
> 
> This patch 4, 5 and 6 are simple replacements and can be squashed into the
> first patch.
> 
> Thanks.
> 
The first patch is to add a common definition for lib_eal, could we squash the 4,5 and 6 
into one replacement patch, while separate them from the first one?
This might be more convenient for review?

> --
> David Marchand
  
David Marchand July 9, 2020, 9:57 a.m. UTC | #5
On Wed, Jul 8, 2020 at 5:21 AM Joyce Kong <Joyce.Kong@arm.com> wrote:
>
> > -----Original Message-----
> > From: David Marchand <david.marchand@redhat.com>
> > Sent: Tuesday, July 7, 2020 10:00 PM
> > To: Joyce Kong <Joyce.Kong@arm.com>
> > Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; jerinj@marvell.com;
> > Zhihong Wang <zhihong.wang@intel.com>; Xiaolong Ye
> > <xiaolong.ye@intel.com>; Beilei Xing <beilei.xing@intel.com>; Jeff Guo
> > <jia.guo@intel.com>; Mcnamara, John <john.mcnamara@intel.com>; Matan
> > Azrad <matan@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>;
> > Viacheslav Ovsiienko <viacheslavo@mellanox.com>; Honnappa Nagarahalli
> > <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> > Ruifeng Wang <Ruifeng.Wang@arm.com>; dev <dev@dpdk.org>; nd
> > <nd@arm.com>
> > Subject: Re: [dpdk-dev] [PATCH v2 4/6] net/i40e: replace restrict with rte
> > restrict
> >
> > On Mon, Jul 6, 2020 at 9:50 AM Joyce Kong <joyce.kong@arm.com> wrote:
> > >
> > > '__rte_restrict' is a common wrapper for restricted pointers which can
> > > be supported by all compilers. Use '__rte_restrict' instead of
> > > '__restrict' for code consistency.
> >
> > This patch 4, 5 and 6 are simple replacements and can be squashed into the
> > first patch.
> >
> > Thanks.
> >
> The first patch is to add a common definition for lib_eal, could we squash the 4,5 and 6
> into one replacement patch, while separate them from the first one?
> This might be more convenient for review?

A copy/paste commitlog hints that it did not deserve separate patches.
About easing reviews, the changes are mechanical, there is no special case.
I am not convinced but, go as you like.

Can you provide a new revision wrt patch 1 problem?
Thanks.
  
Joyce Kong July 10, 2020, 2:45 a.m. UTC | #6
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, July 9, 2020 5:58 PM
> To: Joyce Kong <Joyce.Kong@arm.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; jerinj@marvell.com;
> Zhihong Wang <zhihong.wang@intel.com>; Xiaolong Ye
> <xiaolong.ye@intel.com>; Beilei Xing <beilei.xing@intel.com>; Jeff Guo
> <jia.guo@intel.com>; Mcnamara, John <john.mcnamara@intel.com>; Matan
> Azrad <matan@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>;
> Viacheslav Ovsiienko <viacheslavo@mellanox.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; dev <dev@dpdk.org>; nd
> <nd@arm.com>
> Subject: Re: [dpdk-dev] [PATCH v2 4/6] net/i40e: replace restrict with rte
> restrict
> 
> On Wed, Jul 8, 2020 at 5:21 AM Joyce Kong <Joyce.Kong@arm.com> wrote:
> >
> > > -----Original Message-----
> > > From: David Marchand <david.marchand@redhat.com>
> > > Sent: Tuesday, July 7, 2020 10:00 PM
> > > To: Joyce Kong <Joyce.Kong@arm.com>
> > > Cc: Maxime Coquelin <maxime.coquelin@redhat.com>;
> > > jerinj@marvell.com; Zhihong Wang <zhihong.wang@intel.com>; Xiaolong
> > > Ye <xiaolong.ye@intel.com>; Beilei Xing <beilei.xing@intel.com>;
> > > Jeff Guo <jia.guo@intel.com>; Mcnamara, John
> > > <john.mcnamara@intel.com>; Matan Azrad <matan@mellanox.com>;
> Shahaf
> > > Shuler <shahafs@mellanox.com>; Viacheslav Ovsiienko
> > > <viacheslavo@mellanox.com>; Honnappa Nagarahalli
> > > <Honnappa.Nagarahalli@arm.com>; Phil Yang <Phil.Yang@arm.com>;
> > > Ruifeng Wang <Ruifeng.Wang@arm.com>; dev <dev@dpdk.org>; nd
> > > <nd@arm.com>
> > > Subject: Re: [dpdk-dev] [PATCH v2 4/6] net/i40e: replace restrict
> > > with rte restrict
> > >
> > > On Mon, Jul 6, 2020 at 9:50 AM Joyce Kong <joyce.kong@arm.com>
> wrote:
> > > >
> > > > '__rte_restrict' is a common wrapper for restricted pointers which
> > > > can be supported by all compilers. Use '__rte_restrict' instead of
> > > > '__restrict' for code consistency.
> > >
> > > This patch 4, 5 and 6 are simple replacements and can be squashed
> > > into the first patch.
> > >
> > > Thanks.
> > >
> > The first patch is to add a common definition for lib_eal, could we
> > squash the 4,5 and 6 into one replacement patch, while separate them
> from the first one?
> > This might be more convenient for review?
> 
> A copy/paste commitlog hints that it did not deserve separate patches.
> About easing reviews, the changes are mechanical, there is no special case.
> I am not convinced but, go as you like.
> 
> Can you provide a new revision wrt patch 1 problem?
> Thanks.
> 
> --
> David Marchand

Have just squashed the patch 4,5 and 6 into the first one,
and corrected the issue with a new version.
Thanks.
  

Patch

diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 1dfd0478b..4574139d5 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 **__restrict rx_pkts,
-		uint32_t *__restrict ptype_tbl)
+desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **__rte_restrict rx_pkts,
+		uint32_t *__rte_restrict ptype_tbl)
 {
 	int i;
 	uint8_t ptype;
@@ -194,8 +194,9 @@  desc_to_ptype_v(uint64x2_t descs[4], struct rte_mbuf **__restrict rx_pkts,
  *   numbers of DD bits
  */
 static inline uint16_t
-_recv_raw_pkts_vec(struct i40e_rx_queue *__restrict rxq, struct rte_mbuf
-	**__restrict rx_pkts, uint16_t nb_pkts, uint8_t *split_packet)
+_recv_raw_pkts_vec(struct i40e_rx_queue *__rte_restrict rxq,
+		   struct rte_mbuf **__rte_restrict rx_pkts,
+		   uint16_t nb_pkts, uint8_t *split_packet)
 {
 	volatile union i40e_rx_desc *rxdp;
 	struct i40e_rx_entry *sw_ring;
@@ -432,8 +433,8 @@  _recv_raw_pkts_vec(struct i40e_rx_queue *__restrict rxq, struct rte_mbuf
  *   numbers of DD bits
  */
 uint16_t
-i40e_recv_pkts_vec(void *__restrict rx_queue,
-		struct rte_mbuf **__restrict rx_pkts, uint16_t nb_pkts)
+i40e_recv_pkts_vec(void *__rte_restrict rx_queue,
+		struct rte_mbuf **__rte_restrict rx_pkts, uint16_t nb_pkts)
 {
 	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
 }
@@ -504,8 +505,8 @@  vtx(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkt,
 }
 
 uint16_t
-i40e_xmit_fixed_burst_vec(void *__restrict tx_queue,
-	struct rte_mbuf **__restrict tx_pkts, uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *__rte_restrict tx_queue,
+	struct rte_mbuf **__rte_restrict tx_pkts, uint16_t nb_pkts)
 {
 	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
 	volatile struct i40e_tx_desc *txdp;