From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2B6932BC9 for ; Thu, 25 Feb 2016 17:19:09 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 25 Feb 2016 08:19:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="894622269" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga001.jf.intel.com with ESMTP; 25 Feb 2016 08:19:08 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.237]) by IRSMSX103.ger.corp.intel.com ([169.254.3.239]) with mapi id 14.03.0248.002; Thu, 25 Feb 2016 16:17:19 +0000 From: "Ananyev, Konstantin" To: "Kulasek, TomaszX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 0/2] add support for buffered tx to ethdev Thread-Index: AQHRbyYwoHtVmAP85EKknFShxblxPJ888QwQ Date: Thu, 25 Feb 2016 16:17:19 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B0B549@irsmsx105.ger.corp.intel.com> References: <1452869038-9140-1-git-send-email-tomaszx.kulasek@intel.com> <1456333729-3804-1-git-send-email-tomaszx.kulasek@intel.com> In-Reply-To: <1456333729-3804-1-git-send-email-tomaszx.kulasek@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmFhYWRjM2UtYjdlMy00YTU3LWFiMGQtYzMxMzdjOWUxZDlkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InZBNEFlSTM0M1NaVnVvY0hOR2hqZkNKVDNnZlpcL0VNdmU2Tzd0MllQYnk4PSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 0/2] add support for buffered tx to ethdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 16:19:09 -0000 > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek > Sent: Wednesday, February 24, 2016 5:09 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2 0/2] add support for buffered tx to ethdev >=20 > Many sample apps include internal buffering for single-packet-at-a-time > operation. Since this is such a common paradigm, this functionality is > better suited to being implemented in the ethdev API. >=20 > The new APIs in the ethdev library are: > * rte_eth_tx_buffer_init - initialize buffer > * rte_eth_tx_buffer - buffer up a single packet for future transmission > * rte_eth_tx_buffer_flush - flush any unsent buffered packets > * rte_eth_tx_buffer_set_err_callback - set up a callback to be called in > case transmitting a buffered burst fails. By default, we just free the > unsent packets. >=20 > As well as these, an additional reference callback is provided, which > frees the packets (as the default callback does), as well as updating a > user-provided counter, so that the number of dropped packets can be > tracked. >=20 > Due to the feedback from mailing list, that buffer management facilities > in the user application are more preferable than API simplicity, we decid= ed > to move internal buffer table, as well as callback functions and user dat= a, > from rte_eth_dev/rte_eth_dev_data to the application space. > It prevents ABI breakage and gives some more flexibility in the buffer's > management such as allocation, dynamical size change, reuse buffers on ma= ny > ports or after fail, and so on. >=20 >=20 > The following steps illustrate how tx buffers can be used in application: >=20 > 1) Initialization >=20 > a) Allocate memory for a buffer >=20 > struct rte_eth_dev_tx_buffer *buffer =3D rte_zmalloc_socket("tx_buffer= ", > RTE_ETH_TX_BUFFER_SIZE(MAX_PKT_BURST), 0, socket_id); >=20 > RTE_ETH_TX_BUFFER_SIZE(size) macro computes memory required to store > "size" packets in buffer. >=20 > b) Initialize allocated memory and set up default values. Threshold level > must be lower than or equal to the MAX_PKT_BURST from 1a) >=20 > rte_eth_tx_buffer_init(buffer, threshold); >=20 >=20 > c) Set error callback (optional) >=20 > rte_eth_tx_buffer_set_err_callback(buffer, callback_fn, userdata); >=20 >=20 > 2) Store packet "pkt" in buffer and send them all to the queue_id on > port_id when number of packets reaches threshold level set up in 1b) >=20 > rte_eth_tx_buffer(port_id, queue_id, buffer, pkt); >=20 >=20 > 3) Send all stored packets to the queue_id on port_id >=20 > rte_eth_tx_buffer_flush(port_id, queue_id, buffer); >=20 >=20 > 4) Flush buffer and free memory >=20 > rte_eth_tx_buffer_flush(port_id, queue_id, buffer); > ... > rte_free(buffer); >=20 >=20 > v2 changes: > - reworked to use new buffer model > - buffer data and callbacks are removed from rte_eth_dev/rte_eth_dev_dat= a, > so this patch doesn't brake an ABI anymore > - introduced RTE_ETH_TX_BUFFER macro and rte_eth_tx_buffer_init > - buffers are not attached to the port-queue > - buffers can be allocated dynamically during application work > - size of buffer can be changed without port restart >=20 >=20 > Tomasz Kulasek (2): > ethdev: add buffered tx api > examples: rework to use buffered tx >=20 > examples/l2fwd-jobstats/main.c | 104 +++++------ > examples/l2fwd-keepalive/main.c | 100 ++++------- > examples/l2fwd/main.c | 104 +++++------ > examples/l3fwd-acl/main.c | 92 ++++------ > examples/l3fwd-power/main.c | 89 ++++------ > examples/link_status_interrupt/main.c | 107 +++++------- > .../client_server_mp/mp_client/client.c | 101 ++++++----- > examples/multi_process/l2fwd_fork/main.c | 97 +++++------ > examples/packet_ordering/main.c | 122 +++++++++---- > examples/qos_meter/main.c | 61 ++----- > lib/librte_ether/rte_ethdev.c | 36 ++++ > lib/librte_ether/rte_ethdev.h | 182 ++++++++++++++= +++++- > lib/librte_ether/rte_ether_version.map | 9 + > 13 files changed, 662 insertions(+), 542 deletions(-) >=20 Acked-by: Konstantin Ananyev > -- > 1.7.9.5