From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by dpdk.org (Postfix) with ESMTP id 66C04137C for ; Fri, 20 Jan 2017 17:00:32 +0100 (CET) Received: by mail-oi0-f50.google.com with SMTP id m124so45388830oif.1 for ; Fri, 20 Jan 2017 08:00:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EnOl88L8txNtIxUhdaUXxqnzGDmWQ7IzSa39C+bGFhE=; b=pEUIVZyQ0WIaXCNEUEdUX1xReJXDIJ3sUJrwDm6iuBUe0Ebf784gVIwAL1u25DJidk dbBv+BDCsHsHE2MEZAQtdDAUESb3vkwP6xhlKpt0YO5ge5W9CRk+U5J+yxgB4qa9JUCp jBP4GKRa1SEL78fK9hqTqkCk8DoQaDTrlX3tB6VdnTGSw5UM1M4NUf/cY3tcatjhDPbd dAJ7IVZV6XF+BcJ+p6gzuknkQsm/Xn4LExJOfYE0add+sJZOBpOHN1XjA6YAnjFYxacR tDl8gq5sZ39dQrgMlXIMnvekYJyAgF1EGR8gYohQuzqTMYuY6G3Z6tWEjrGp2b6F6ovX Ag3w== X-Gm-Message-State: AIkVDXID8FTFTsk50r5xot3M55qD1cjlxOIhIeuHM87ijcUIn/IDz9gBehy7f7/wIkir+dmnwtcN7H5Cn9U6Q691 X-Received: by 10.202.78.214 with SMTP id c205mr7508951oib.65.1484928031743; Fri, 20 Jan 2017 08:00:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.198.211 with HTTP; Fri, 20 Jan 2017 08:00:31 -0800 (PST) In-Reply-To: <20170111173950.4e2c87ae@xeon-e3> References: <20170111200323.12938-1-bmcfall@redhat.com> <20170111200323.12938-4-bmcfall@redhat.com> <20170111173950.4e2c87ae@xeon-e3> From: Billy McFall Date: Fri, 20 Jan 2017 11:00:31 -0500 Message-ID: To: Stephen Hemminger Cc: thomas.monjalon@6wind.com, wenzhuo.lu@intel.com, dev@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/vhost: vHost support to free consumed buffers 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: , X-List-Received-Date: Fri, 20 Jan 2017 16:00:32 -0000 rte_eth_tx_done_cleanup(..) checks to see if .tx_done_cleanup is set, so in that since it is optional. The reason for this function does no work and returns 0 is to indicate to the application calling it that the mbufs are free and the application can continue. The application needs to know if the driver is attempting to the free the mbufs (return value >= 0) or not implemented (return value < 0). If return value is < 0, the application needs to take alternative action, like make a copy of the packet in the flooding case, because the mbuf is not going to be returned anytime soon. If return value is >= 0, keep polling until the desired mbuf is returned (reference count decremented). Let me know if this doesn't answer the question or I am missing your point. Thanks, Billy McFall On Wed, Jan 11, 2017 at 8:39 PM, Stephen Hemminger < stephen@networkplumber.org> wrote: > On Wed, 11 Jan 2017 15:03:23 -0500 > Billy McFall wrote: > > > Add support to the vHostdriver for the new API to force free consumed > > buffers on Tx ring. vHost does not cache the mbufs so there is no work > > to do. > > > > Signed-off-by: Billy McFall > > --- > > drivers/net/vhost/rte_eth_vhost.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/net/vhost/rte_eth_vhost.c > b/drivers/net/vhost/rte_eth_vhost.c > > index 766d4ef..6493d56 100644 > > --- a/drivers/net/vhost/rte_eth_vhost.c > > +++ b/drivers/net/vhost/rte_eth_vhost.c > > @@ -939,6 +939,16 @@ eth_queue_release(void *q) > > } > > > > static int > > +eth_tx_done_cleanup(void *txq __rte_unused, uint32_t free_cnt > __rte_unused) > > +{ > > + /* > > + * vHost does not hang onto mbuf. eth_vhost_tx() copies packet data > > + * and releases mbuf, so nothing to cleanup. > > + */ > > + return 0; > > +} > > + > > +static int > > eth_link_update(struct rte_eth_dev *dev __rte_unused, > > int wait_to_complete __rte_unused) > > { > > @@ -979,6 +989,7 @@ static const struct eth_dev_ops ops = { > > .tx_queue_setup = eth_tx_queue_setup, > > .rx_queue_release = eth_queue_release, > > .tx_queue_release = eth_queue_release, > > + .tx_done_cleanup = eth_tx_done_cleanup, > > .link_update = eth_link_update, > > .stats_get = eth_stats_get, > > .stats_reset = eth_stats_reset, > > Rather than change drivers, since this is not critical path, make > it optional to have tx_done_cleanup. >