From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 94BF8A00E6 for ; Thu, 8 Aug 2019 13:17:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 71A641BDF1; Thu, 8 Aug 2019 13:17:15 +0200 (CEST) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by dpdk.org (Postfix) with ESMTP id B31021BDEC for ; Thu, 8 Aug 2019 13:17:13 +0200 (CEST) Received: from WTL-EXCHSV2-1.sandvine.com (192.168.194.58) by WTL-EXCHSV2-2.sandvine.com (192.168.194.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1034.26; Thu, 8 Aug 2019 07:17:11 -0400 Received: from blr-exchsv1-1.sandvine.com (10.30.4.73) by WTL-EXCHSV2-1.sandvine.com (192.168.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1034.26 via Frontend Transport; Thu, 8 Aug 2019 07:17:11 -0400 Received: from blr-exchsv1-1.sandvine.com (10.30.4.73) by blr-exchsv1-1.sandvine.com (10.30.4.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1034.26; Thu, 8 Aug 2019 16:47:06 +0530 Received: from blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6]) by blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6%23]) with mapi id 15.01.1034.026; Thu, 8 Aug 2019 16:47:06 +0530 From: Nilanjan Sarkar To: "dev@dpdk.org" Thread-Topic: [PATCH] eal: added new api to only enqueue a packet in tx buffer Thread-Index: AdVN2elYiFxTqghoQz+VDLrW8b4Z6Q== Date: Thu, 8 Aug 2019 11:17:06 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.30.18.59] x-c2processedorg: b2f06e69-072f-40ee-90c5-80a34e700794 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] eal: added new api to only enqueue a packet in tx buffer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This api is similar like api `rte_eth_tx_buffer` except it does not attempt to flush the buffer in case buffer is full. The advantage is that, this api does not need port id and queue id. In case port id and queue id are shared within threads then application can not buffer a packet until it gets access to port and queue. So this function segregate buffering job from flushing job and thus removes dependency on port and queue. Signed-off-by: Nilanjan Sarkar --- lib/librte_ethdev/rte_ethdev.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.= h index dc6596b..8055928 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -4569,6 +4569,37 @@ rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_i= d, return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); } +/** + * Buffer a single packet for future transmission on Tx buffer. This buffe= r + * can be sent to a port and queue of a NIC using rte_eth_tx_buffer_flush = () + * call. + * + * This function enqueues a packet to Tx buffer. In case there is no space + * in Tx buffer, this function fails. + * Tx buffer will be flushed using rte_eth_tx_buffer_flush () call. It is + * application's responsibility to flush the Tx buffer in regular interval= . + * + * @param buffer + * Buffer used to collect packets to be sent. + * @param tx_pkt + * Pointer to the packet mbuf to be sent. + * @return + * 0 =3D packet has been buffered for later transmission + * -1 =3D Packet can not be buffered since it reached limit + */ + +static __rte_always_inline int8_t +rte_eth_tx_enqueue(struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *= tx_pkt) +{ + if (buffer->length < buffer->size) + { + buffer->pkts[buffer->length++] =3D tx_pkt; + return 0; + } + + return -1; +} + #ifdef __cplusplus } #endif -- 2.7.4 Disclaimer: This communication (including any attachments) is intended for the use of t= he intended recipient(s) only and may contain information that is considere= d confidential, proprietary, sensitive and/or otherwise legally protected. = Any unauthorized use or dissemination of this communication is strictly pro= hibited. If you have received this communication in error, please immediate= ly notify the sender by return e-mail message and delete all copies of the = original communication. Thank you for your cooperation.