From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com
 [209.85.128.180]) by dpdk.org (Postfix) with ESMTP id 14A6ED1A2
 for <dev@dpdk.org>; Fri, 24 Mar 2017 14:38:27 +0100 (CET)
Received: by mail-wr0-f180.google.com with SMTP id l43so1931266wre.1
 for <dev@dpdk.org>; Fri, 24 Mar 2017 06:38:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=vulhPx4L5HyPy6+l9+YYSdwP0/iXYlXCTZen6JPhz84=;
 b=q4T3r0u5FyDsYWs6LcYFkqCNlPYxvBHOTevBqqCZN0duQVIZ/f65mz7gWmV0+tzdVL
 qHpWCojOoKOR0g/xSqWEQ6rFt++14u8zM0WehsKXTGpLLaDAUYdVENRF4aIxDi+357v/
 jmoCFLl8NLMm7gsHQuwKFGmgJNWcHPdIJ8uGutwGDu7OkOHuv4C2ktvpcnKRjPSRiYun
 ym28I0nBHs5YffbTldTxm5aHXOEf2vryOGuU66XpyTferzoyPaUsRxkFZiV99USkPfYj
 CyVNi+A7I5kMxGRyViFPqlBH1YkHeGx6FDtpuhTPlOf9c87Dzi4xBH/oTo6Jk52rnNX7
 TcrQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=vulhPx4L5HyPy6+l9+YYSdwP0/iXYlXCTZen6JPhz84=;
 b=Ogcu884VtfQL2n/Y4lAgGnusVmCTH5PjXtL8hm3G/u4/75rq/P8BL62xrdF7sU0ZIH
 q26z15qxEQGgFWCnOqJ/Xyd9BIYSVq+Ibhs/XwWqZnuTr4fKh9Q5GeFcyNHjZmBb8Ul9
 7sCQiJwPrlws/8ZTPtvE92RYTz9vvEl+rzzmyteaguBkLWFZ4Oaef8X+V1L2d5nF7kj3
 nhb4G8whhhPlR3bgApbmVLgreS0Ylp/1SADOUXERzB7SuJLlTsLXRmWQ2jFObb5RLgs1
 81wPtzyELXOGd5mIG/+oXUWsdb5AhjDnoGJX92ecAD39b0B8/OrmJN1YRDDfJ4e+s2nH
 b9xA==
X-Gm-Message-State: AFeK/H0HrifdYjl5upFc1sSbn6GpXXZ4enXs9zFMZNP/tjlvakSgGJ46kX/vL3vyhdjshLkD
X-Received: by 10.223.176.250 with SMTP id j55mr7521916wra.11.1490362260252;
 Fri, 24 Mar 2017 06:31:00 -0700 (PDT)
Received: from platinum (2a01cb0c03c651000226b0fffeed02fc.ipv6.abo.wanadoo.fr.
 [2a01:cb0c:3c6:5100:226:b0ff:feed:2fc])
 by smtp.gmail.com with ESMTPSA id 11sm2910392wrb.10.2017.03.24.06.30.59
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 24 Mar 2017 06:31:00 -0700 (PDT)
Date: Fri, 24 Mar 2017 14:30:57 +0100
From: Olivier Matz <olivier.matz@6wind.com>
To: Billy McFall <bmcfall@redhat.com>
Cc: thomas.monjalon@6wind.com, wenzhuo.lu@intel.com, dev@dpdk.org
Message-ID: <20170324143057.75e2143f@platinum>
In-Reply-To: <CAKLkqD4t3R4w4MC+rw8TDraDC=gP8uf-gu3jmch-6aCbw1nooA@mail.gmail.com>
References: <20170309205119.28170-1-bmcfall@redhat.com>
 <20170315180226.5999-1-bmcfall@redhat.com>
 <20170315180226.5999-2-bmcfall@redhat.com>
 <20170323113716.57e27591@glumotte.dev.6wind.com>
 <CAKLkqD7WffB9t14wQ9vyphGsL2-mpMhNdMa2Ss7aeKyK8odyKg@mail.gmail.com>
 <20170324134634.3e764423@platinum>
 <CAKLkqD4t3R4w4MC+rw8TDraDC=gP8uf-gu3jmch-6aCbw1nooA@mail.gmail.com>
X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v7 1/3] ethdev: new API to free consumed
 buffers in Tx ring
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Mar 2017 13:38:28 -0000

On Fri, 24 Mar 2017 09:18:54 -0400, Billy McFall <bmcfall@redhat.com> wrote:
> On Fri, Mar 24, 2017 at 8:46 AM, Olivier Matz <olivier.matz@6wind.com>
> wrote:

[...]

> > > I read through this patch. This API doesn't indicate if the packet was  
> > > transmitted or dropped (I think that is what you were asking). This API
> > > could be used by the application to determine if the mbuf has been
> > > freed, as opposed to polling the rte_mbuf_refcnt_read() for a change
> > > in value. Did I miss your point?  
> >
> > Maybe my question was not clear :)
> > Let me try to reword it.
> >
> > For a traffic generator use-case, a dummy algorithm may be:
> >
> > 1/ send packets in a loop until a condition is met (ex: packet count
> > reached)
> > 2/ call rte_eth_tx_done_cleanup()
> > 3/ read stats for report
> >
> > I think there is something missing between 1/ and 2/, to ensure that
> > all packets that were in the tx queue are processed (either transmitted
> > or dropped). If that's not the case, both steps 2/ and 3/ will not
> > behave as expected:
> > - all mbufs won't be returned to the pool
> > - statistics may be wrong
> >
> > Maybe a simple wait() could do the job.
> > Using a combination of rte_eth_tx_done_cleanup() +
> > rte_eth_tx_descriptor_status()
> > is probably also a solution.
> >
> > Do you confirm rte_eth_tx_done_cleanup() does not check that?
> >
> Confirm.  rte_eth_tx_done_cleanup() does not check that. In the flooding  
> case,
> the applications is expected to poll rte_eth_tx_done_cleanup() until some
> condition
> is met, like ref_count of given packet is decremented. So on the packetGen
> case, the
> application would need to wait some time and/or call
> rte_eth_tx_descriptor_status()
> as you suggested.
> 
> My original patch returned RTE_DONE (no more packets pending),
> RTE_PROCESSING (freed what I could but there are still packets in the queue)
> or -ERRNO for error. Then packets freed count was returned via a pointer in
> the param list.
> That would have solved what you are asking, but that was shot down as being
> overkill.
> 
> Should I add another sentence to the packet generator bullet indicating
> that it is the
> application's job to make sure no more packets are pending? Like:
> 
>   In this case, it can call the ``rte_eth_tx_done_cleanup()`` API for each
> destination interface it has been using
>   to request it to release of all its used mbufs.
> + It is the application's responsibility to ensure all packets have been
> processed by the destination interface.
> + Use rte_eth_tx_descriptor_status() to obtain the status of the transmit
> queue,

Thanks for the clarification.
Not sure the sentence is required, since rte_eth_tx_descriptor_status()
is not included yet.

Regards,
Olivier