Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933429AbdC3HX3 (ORCPT ); Thu, 30 Mar 2017 03:23:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49147 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932664AbdC3HXZ (ORCPT ); Thu, 30 Mar 2017 03:23:25 -0400 Date: Thu, 30 Mar 2017 09:23:16 +0200 From: Cornelia Huck To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, John Fastabend , virtualization@lists.linux-foundation.org Subject: Re: [PATCH 3/6] virtio: allow extra context per descriptor In-Reply-To: <1490820507-8005-4-git-send-email-mst@redhat.com> References: <1490820507-8005-1-git-send-email-mst@redhat.com> <1490820507-8005-4-git-send-email-mst@redhat.com> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17033007-0016-0000-0000-0000046A3E73 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17033007-0017-0000-0000-000027067502 Message-Id: <20170330092316.2a25e4f1.cornelia.huck@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-30_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703300067 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1406 Lines: 40 On Wed, 29 Mar 2017 23:48:53 +0300 "Michael S. Tsirkin" wrote: > Allow extra context per descriptor. To avoid slow down for data path, > this disables use of indirect descriptors for this vq. > > Signed-off-by: Michael S. Tsirkin > --- > drivers/virtio/virtio_ring.c | 70 ++++++++++++++++++++++++++++++++++++-------- > include/linux/virtio.h | 9 ++++++ > 2 files changed, 66 insertions(+), 13 deletions(-) > > /** > + * virtqueue_add_inbuf_ctx - expose input buffers to other end > + * @vq: the struct virtqueue we're talking about. > + * @sg: scatterlist (must be well-formed and terminated!) > + * @num: the number of entries in @sg writable by other side > + * @data: the token identifying the buffer. > + * @ctx: extra context for the token I think that needs do that ctx != NULL collides with indirect descriptors. > + * @gfp: how to do memory allocations (if necessary). > + * > + * Caller must ensure we don't call this with other virtqueue operations > + * at the same time (except where noted). > + * > + * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO). > + */ > +int virtqueue_add_inbuf_ctx(struct virtqueue *vq, > + struct scatterlist *sg, unsigned int num, > + void *data, > + void *ctx, > + gfp_t gfp) > +{ > + return virtqueue_add(vq, &sg, num, 0, 1, data, ctx, gfp); > +} > +EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);