From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 447562BE2 for ; Thu, 10 Mar 2016 12:31:44 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 10 Mar 2016 03:31:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,315,1455004800"; d="scan'208";a="761580856" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga003.jf.intel.com with ESMTP; 10 Mar 2016 03:31:42 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.35]) by IRSMSX102.ger.corp.intel.com ([169.254.2.19]) with mapi id 14.03.0248.002; Thu, 10 Mar 2016 11:31:41 +0000 From: "Ananyev, Konstantin" To: "Kulasek, TomaszX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 0/2] add support for buffered tx to ethdev Thread-Index: AQHRervmduOgPT3F5U6sgKWGBrwBZJ9SitsA Date: Thu, 10 Mar 2016 11:31:41 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B1ADC1@irsmsx105.ger.corp.intel.com> References: <1456333729-3804-1-git-send-email-tomaszx.kulasek@intel.com> <1457607478-2184-1-git-send-email-tomaszx.kulasek@intel.com> In-Reply-To: <1457607478-2184-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2RmYmRmZjMtNDI5Zi00MzdmLTllOWEtMWExZjQwZjA2MTlmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImJPNW15bUdNM3dlWHAzcjFwSWZVSU1XSWxiajJvbXZHZ1wveU5HKzZINnc0PSJ9 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 v3 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, 10 Mar 2016 11:31:44 -0000 > 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 callbacks are provided, which > frees the packets: >=20 > * rte_eth_tx_buffer_drop_callback - silently drop packets (default > behavior) > * rte_eth_tx_buffer_count_callback - drop and update user-provided counte= r > to track the number of dropped packets >=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 > v3 changes: > - error counter removed from tx buffer structure, now default behavior i= s > silent drop of unsent packets > - some names was changed in tx buffer structure to be more descriptive > - two default calbacks are provided: rte_eth_tx_buffer_drop_callback and > rte_eth_tx_buffer_count_callback >=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 > 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 | 46 +++++ > lib/librte_ether/rte_ethdev.h | 205 ++++++++++++++= +++++- > lib/librte_ether/rte_ether_version.map | 10 + > 13 files changed, 696 insertions(+), 542 deletions(-) >=20 > -- Acked-by: Konstantin Ananyev > 1.7.9.5