From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 0310A2C16; Sun, 3 Jun 2018 14:44:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2018 05:44:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,472,1520924400"; d="scan'208";a="44905895" Received: from unknown (HELO localhost.localdomain.localdomain) ([10.224.122.193]) by fmsmga008.fm.intel.com with ESMTP; 03 Jun 2018 05:44:23 -0700 From: Nikhil Rao To: jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Nikhil Rao , stable@dpdk.org Date: Sun, 3 Jun 2018 18:12:25 +0530 Message-Id: <1528029745-69148-1-git-send-email-nikhil.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] eventdev: add event buffer flush in Rx adapter X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2018 12:44:28 -0000 Add an event buffer flush when the current invocation of the Rx adapter is completed. This patch provides lower latency in case there is a BATCH_SIZE of events in the event buffer. Suggested-by: Narender Vangati Signed-off-by: Nikhil Rao Cc: stable@dpdk.org --- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 53a3788..3a70058 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -490,7 +490,7 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b) * the hypervisor's switching layer where adjustments can be made to deal with * it. */ -static inline uint32_t +static inline void eth_rx_poll(struct rte_event_eth_rx_adapter *rx_adapter) { uint32_t num_queue; @@ -519,7 +519,7 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b) flush_event_buffer(rx_adapter); if (BATCH_SIZE > (ETH_EVENT_BUFFER_SIZE - buf->count)) { rx_adapter->wrr_pos = wrr_pos; - break; + return; } stats->rx_poll_count++; @@ -535,7 +535,7 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b) if (nb_rx > max_nb_rx) { rx_adapter->wrr_pos = (wrr_pos + 1) % rx_adapter->wrr_len; - return nb_rx; + break; } } @@ -543,20 +543,18 @@ static uint16_t gcd_u16(uint16_t a, uint16_t b) wrr_pos = 0; } - return nb_rx; + if (buf->count >= BATCH_SIZE) + flush_event_buffer(rx_adapter); } static int event_eth_rx_adapter_service_func(void *args) { struct rte_event_eth_rx_adapter *rx_adapter = args; - struct rte_eth_event_enqueue_buffer *buf; - buf = &rx_adapter->event_enqueue_buffer; if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0) return 0; - if (eth_rx_poll(rx_adapter) == 0 && buf->count) - flush_event_buffer(rx_adapter); + eth_rx_poll(rx_adapter); rte_spinlock_unlock(&rx_adapter->rx_lock); return 0; } -- 1.8.3.1