eventdev: remove event copy in Rx adapter
diff mbox series

Message ID 1558475573-34837-1-git-send-email-nikhil.rao@intel.com
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series
  • eventdev: remove event copy in Rx adapter
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Rao, Nikhil May 21, 2019, 9:52 p.m. UTC
Remove copy from temporary event array on the stack to the
enqueue buffer event array entry, instead initialize event in the
enqueue buffer event array entry.

Suggested-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---

Hi Mattias,

This patch eliminates the event copy as you previously mentioned
(https://patches.dpdk.org/patch/53350/), the enqueue buffer
array is still retained in the rx_adapter struct, since the Rx adapter
service function can return with events in the enqueue buffer
that have not yet been shipped to the event device.

Let me know your comments.

Thanks,
Nikhil

 lib/librte_eventdev/rte_event_eth_rx_adapter.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

Comments

Mattias Rönnblom June 11, 2019, 10:55 a.m. UTC | #1
On 2019-05-21 23:52, Nikhil Rao wrote:
> Remove copy from temporary event array on the stack to the
> enqueue buffer event array entry, instead initialize event in the
> enqueue buffer event array entry.
> 
> Suggested-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
> 
> Hi Mattias,
> 
> This patch eliminates the event copy as you previously mentioned
> (https://patches.dpdk.org/patch/53350/), the enqueue buffer
> array is still retained in the rx_adapter struct, since the Rx adapter
> service function can return with events in the enqueue buffer
> that have not yet been shipped to the event device.
> 
> Let me know your comments.
> 
> Thanks,
> Nikhil

Looks good to me. Sorry about the late reply.

> 
>   lib/librte_eventdev/rte_event_eth_rx_adapter.c | 20 ++++----------------
>   1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> index 8d178be..a201668 100644
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -715,18 +715,6 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
>   	}
>   }
>   
> -/* Add event to buffer, free space check is done prior to calling
> - * this function
> - */
> -static inline void
> -rxa_buffer_event(struct rte_event_eth_rx_adapter *rx_adapter,
> -		struct rte_event *ev)
> -{
> -	struct rte_eth_event_enqueue_buffer *buf =
> -	    &rx_adapter->event_enqueue_buffer;
> -	rte_memcpy(&buf->events[buf->count++], ev, sizeof(struct rte_event));
> -}
> -
>   /* Enqueue buffered events to event device */
>   static inline uint16_t
>   rxa_flush_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter)
> @@ -769,11 +757,11 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
>   					&dev_info->rx_queue[rx_queue_id];
>   	struct rte_eth_event_enqueue_buffer *buf =
>   					&rx_adapter->event_enqueue_buffer;
> +	struct rte_event *ev = &buf->events[buf->count];
>   	int32_t qid = eth_rx_queue_info->event_queue_id;
>   	uint8_t sched_type = eth_rx_queue_info->sched_type;
>   	uint8_t priority = eth_rx_queue_info->priority;
>   	uint32_t flow_id;
> -	struct rte_event events[BATCH_SIZE];
>   	struct rte_mbuf *m = mbufs[0];
>   	uint32_t rss_mask;
>   	uint32_t rss;
> @@ -811,7 +799,6 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
>   
>   	for (i = 0; i < num; i++) {
>   		m = mbufs[i];
> -		struct rte_event *ev = &events[i];
>   
>   		rss = do_rss ?
>   			rxa_do_softrss(m, rx_adapter->rss_key_be) :
> @@ -828,9 +815,10 @@ static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
>   		ev->sub_event_type = 0;
>   		ev->priority = priority;
>   		ev->mbuf = m;
> -
> -		rxa_buffer_event(rx_adapter, ev);
> +		ev++;
>   	}
> +
> +	buf->count += num;
>   }
>   
>   /* Enqueue packets from  <port, q>  to event buffer */
>
Rao, Nikhil June 13, 2019, 1:02 p.m. UTC | #2
Hi Jerin,

> -----Original Message-----
> From: Mattias Rönnblom [mailto:mattias.ronnblom@ericsson.com]
> Sent: Tuesday, June 11, 2019 4:25 PM
> To: Rao, Nikhil <nikhil.rao@intel.com>; jerinj@marvell.com
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] eventdev: remove event copy in Rx adapter
> 
> On 2019-05-21 23:52, Nikhil Rao wrote:
> > Remove copy from temporary event array on the stack to the enqueue
> > buffer event array entry, instead initialize event in the enqueue
> > buffer event array entry.
> >
> > Suggested-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> > ---
> >
> > Hi Mattias,
> >
> > This patch eliminates the event copy as you previously mentioned
> > (https://patches.dpdk.org/patch/53350/), the enqueue buffer array is
> > still retained in the rx_adapter struct, since the Rx adapter service
> > function can return with events in the enqueue buffer that have not
> > yet been shipped to the event device.
> >
> > Let me know your comments.
> >
> > Thanks,
> > Nikhil
> 
> Looks good to me. Sorry about the late reply.
> 
Would you be able to merge this patch.

The patch below is dependent on it. 
http://patchwork.dpdk.org/patch/53764/

Thanks,
Nikhil
Jerin Jacob Kollanukkaran June 13, 2019, 2:05 p.m. UTC | #3
> -----Original Message-----
> From: Rao, Nikhil <nikhil.rao@intel.com>
> Sent: Thursday, June 13, 2019 6:33 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Cc: dev@dpdk.org; Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Subject: [EXT] RE: [dpdk-dev] [PATCH] eventdev: remove event copy in Rx
> adapter
> 
> > -----Original Message-----
> > From: Mattias Rönnblom [mailto:mattias.ronnblom@ericsson.com]
> > Sent: Tuesday, June 11, 2019 4:25 PM
> > To: Rao, Nikhil <nikhil.rao@intel.com>; jerinj@marvell.com
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH] eventdev: remove event copy in Rx
> > adapter
> >
> > On 2019-05-21 23:52, Nikhil Rao wrote:
> > > Remove copy from temporary event array on the stack to the enqueue
> > > buffer event array entry, instead initialize event in the enqueue
> > > buffer event array entry.
> > >
> > > Suggested-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>
Jerin Jacob Kollanukkaran June 13, 2019, 2:43 p.m. UTC | #4
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jerin Jacob Kollanukkaran
> Sent: Thursday, June 13, 2019 7:35 PM
> To: Rao, Nikhil <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Subject: Re: [dpdk-dev] [PATCH] eventdev: remove event copy in Rx adapter
> 
> > -----Original Message-----
> > From: Rao, Nikhil <nikhil.rao@intel.com>
> > Sent: Thursday, June 13, 2019 6:33 PM
> > To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Subject: [EXT] RE: [dpdk-dev] [PATCH] eventdev: remove event copy in
> > Rx adapter
> >
> > > -----Original Message-----
> > > From: Mattias Rönnblom [mailto:mattias.ronnblom@ericsson.com]
> > > Sent: Tuesday, June 11, 2019 4:25 PM
> > > To: Rao, Nikhil <nikhil.rao@intel.com>; jerinj@marvell.com
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH] eventdev: remove event copy in Rx
> > > adapter
> > >
> > > On 2019-05-21 23:52, Nikhil Rao wrote:
> > > > Remove copy from temporary event array on the stack to the enqueue
> > > > buffer event array entry, instead initialize event in the enqueue
> > > > buffer event array entry.
> > > >
> > > > Suggested-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> 
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-eventdev/master. Thanks.

Patch
diff mbox series

diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index 8d178be..a201668 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -715,18 +715,6 @@  static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
 	}
 }
 
-/* Add event to buffer, free space check is done prior to calling
- * this function
- */
-static inline void
-rxa_buffer_event(struct rte_event_eth_rx_adapter *rx_adapter,
-		struct rte_event *ev)
-{
-	struct rte_eth_event_enqueue_buffer *buf =
-	    &rx_adapter->event_enqueue_buffer;
-	rte_memcpy(&buf->events[buf->count++], ev, sizeof(struct rte_event));
-}
-
 /* Enqueue buffered events to event device */
 static inline uint16_t
 rxa_flush_event_buffer(struct rte_event_eth_rx_adapter *rx_adapter)
@@ -769,11 +757,11 @@  static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
 					&dev_info->rx_queue[rx_queue_id];
 	struct rte_eth_event_enqueue_buffer *buf =
 					&rx_adapter->event_enqueue_buffer;
+	struct rte_event *ev = &buf->events[buf->count];
 	int32_t qid = eth_rx_queue_info->event_queue_id;
 	uint8_t sched_type = eth_rx_queue_info->sched_type;
 	uint8_t priority = eth_rx_queue_info->priority;
 	uint32_t flow_id;
-	struct rte_event events[BATCH_SIZE];
 	struct rte_mbuf *m = mbufs[0];
 	uint32_t rss_mask;
 	uint32_t rss;
@@ -811,7 +799,6 @@  static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
 
 	for (i = 0; i < num; i++) {
 		m = mbufs[i];
-		struct rte_event *ev = &events[i];
 
 		rss = do_rss ?
 			rxa_do_softrss(m, rx_adapter->rss_key_be) :
@@ -828,9 +815,10 @@  static uint16_t rxa_gcd_u16(uint16_t a, uint16_t b)
 		ev->sub_event_type = 0;
 		ev->priority = priority;
 		ev->mbuf = m;
-
-		rxa_buffer_event(rx_adapter, ev);
+		ev++;
 	}
+
+	buf->count += num;
 }
 
 /* Enqueue packets from  <port, q>  to event buffer */