Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1779603ybt; Mon, 15 Jun 2020 09:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuHUOOAd86O62d8Z0V9vXSq8WFB+OU0Oga84Z0W6zaaGbT1zAW88BiLlYTb01px1SPewHd X-Received: by 2002:a05:6402:1d82:: with SMTP id dk2mr23869728edb.75.1592237498779; Mon, 15 Jun 2020 09:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592237498; cv=none; d=google.com; s=arc-20160816; b=TGW3lEQl0AA2HdwdKBGnXYDhPVnjG66sERPP7V87JDDnU5noAdDhvNea0oDbXcdOw/ Duj8ghlqyROmGS9bFe1lFRBrdd28qk2ciq3DRKn1dltAx0RUbpg4z6/bZLv5ibII9CZ7 PKgbFTljPZLx9kvHa7fgZqEZtU6lZ3OQWT1nhC8pPEHwFwkHhBzKED3JqUXqyfdSBwRS lnE7vLHnvr3cXEPN1P/OTbmfn83Gcq+ffm6hFqKd8KuhIgMc7kaLSR0rrWWSoKAsanM9 qjgDliYXymO0aYF4/2jO9avzKJ9QPb06TFOuTCm1SGS5RCgsd6jQ2V5cL95WIT19Q32Q TvmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dD7tNXdGDRCEoYSmAc4X5T9NYduNoAow0i5S91tnK3o=; b=h6asf8Q28hwh0qEdj8I5kghlCpgPNStPF+IEgr5mAQd2ZJoycM+8XH+I+1+iGSqEEP tJYhHpQagzxdnadt1H+b/CGVy0OtP22zJjpa16DpdBuH0ZFkybMrTRuU0ybYBbbXyPdV rQt78EbT0OgheYW3N5fNM7xCjzJSjyoh7N+/SlT1SdFONrPLOWwNzEwYMPPGiL2N1Hpm 0SUwscjz8IJBCm/mYapcbLAB0rqmMKv6heqxRuGeipKweXIGOqAcQTzkKF7rfDcGGxq/ S3X8/R0RfD84MkIzsK72nblGA4REjl6/pIJb6gGlyGeuVoVlygY9r3bLREoj3lEv4xfc S6aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f7H+W48d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv16si9675982ejb.437.2020.06.15.09.11.15; Mon, 15 Jun 2020 09:11:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f7H+W48d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730687AbgFOQJO (ORCPT + 99 others); Mon, 15 Jun 2020 12:09:14 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29381 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729792AbgFOQJJ (ORCPT ); Mon, 15 Jun 2020 12:09:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592237348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dD7tNXdGDRCEoYSmAc4X5T9NYduNoAow0i5S91tnK3o=; b=f7H+W48dk67BAukukr+aClHHub2aCqZ+ZzOyKrQ4fwibDZ+CgN/EXshdnydy4z7hvY71V3 TqxF/k0XX7Nq8h2VBtUpf76R7nMZMhQxchMkEi+z61z9/beqd+IsU7UFoYXHBEj9n/tf4q aGyUSNPMi/pmFnUz6/CBseYA633OHLA= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-92-21EltOsCVW8PiTsCaqw-1; Mon, 15 Jun 2020 12:09:05 -0400 X-MC-Unique: 92-21EltOsCVW8PiTsCaqw-1 Received: by mail-qt1-f200.google.com with SMTP id y7so14381014qti.8 for ; Mon, 15 Jun 2020 09:09:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dD7tNXdGDRCEoYSmAc4X5T9NYduNoAow0i5S91tnK3o=; b=Rog/07wZPQlsz+35zCkO0pSbXsGaYhV1Sj5sqYVHV9k6+3ecXnNOSoD55UcTTJ57pB s7vsCNv3nc8hr974iE3ePuEKBHgBcSFf1YefTB8Z2YxyWcXwe5VouUQl1ZhF3BcuR0Np cWD+TIOCNfq95Vug8KfLRF2Zd2v3bhpft2qeruBMCneX+hRUnTRagLPUYWAvufz/lWPv 1yO5Fl2m5dhNrm5e1nnoA3t55whrkXc3Bhy+9LW60B79G0VG8WE2XkSGif1OTxYMZHrm dYIwGt3yAjdqrhf7ARKgAxdE6lq06SBuK/YJwKI375rgK2z09QIShhani28UGTPTBu6x /Z4g== X-Gm-Message-State: AOAM533gY1GUYcpeycc/qJ7kq4O3x2LJWphUAEHsEZakag7VXHQiCiFt NthOtgkznbUE26qhxTGgHnbQM4kGKQuFZNZLZIuZ2yAdnA7ki1EhSdbR594WnJdnQiZl3YQmBCC J9kji1a5KRuJ4zfqETxpJNg2AL813lqeswQiH7bl0 X-Received: by 2002:ac8:3f14:: with SMTP id c20mr16738146qtk.22.1592237344852; Mon, 15 Jun 2020 09:09:04 -0700 (PDT) X-Received: by 2002:ac8:3f14:: with SMTP id c20mr16738019qtk.22.1592237343340; Mon, 15 Jun 2020 09:09:03 -0700 (PDT) MIME-Version: 1.0 References: <20200611113404.17810-1-mst@redhat.com> <20200611113404.17810-4-mst@redhat.com> In-Reply-To: <20200611113404.17810-4-mst@redhat.com> From: Eugenio Perez Martin Date: Mon, 15 Jun 2020 18:08:27 +0200 Message-ID: Subject: Re: [PATCH RFC v8 03/11] vhost/net: pass net specific struct pointer To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, kvm list , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Jason Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2020 at 1:34 PM Michael S. Tsirkin wrote: > > In preparation for further cleanup, pass net specific pointer > to ubuf callbacks so we can move net specific fields > out to net structures. > > Signed-off-by: Michael S. Tsirkin > --- > drivers/vhost/net.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index bf5e1d81ae25..ff594eec8ae3 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -94,7 +94,7 @@ struct vhost_net_ubuf_ref { > */ > atomic_t refcount; > wait_queue_head_t wait; > - struct vhost_virtqueue *vq; > + struct vhost_net_virtqueue *nvq; > }; > > #define VHOST_NET_BATCH 64 > @@ -231,7 +231,7 @@ static void vhost_net_enable_zcopy(int vq) > } > > static struct vhost_net_ubuf_ref * > -vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) > +vhost_net_ubuf_alloc(struct vhost_net_virtqueue *nvq, bool zcopy) > { > struct vhost_net_ubuf_ref *ubufs; > /* No zero copy backend? Nothing to count. */ > @@ -242,7 +242,7 @@ vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) > return ERR_PTR(-ENOMEM); > atomic_set(&ubufs->refcount, 1); > init_waitqueue_head(&ubufs->wait); > - ubufs->vq = vq; > + ubufs->nvq = nvq; > return ubufs; > } > > @@ -384,13 +384,13 @@ static void vhost_zerocopy_signal_used(struct vhost_net *net, > static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) > { > struct vhost_net_ubuf_ref *ubufs = ubuf->ctx; > - struct vhost_virtqueue *vq = ubufs->vq; > + struct vhost_net_virtqueue *nvq = ubufs->nvq; > int cnt; > > rcu_read_lock_bh(); > > /* set len to mark this desc buffers done DMA */ > - vq->heads[ubuf->desc].len = success ? > + nvq->vq.heads[ubuf->desc].in_len = success ? This change should access .len, not .in_len, until patch 6 (net: convert to new API) in this series. Not very important, but make easier to debug these intermediate commits. Thanks! > VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN; > cnt = vhost_net_ubuf_put(ubufs); > > @@ -402,7 +402,7 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) > * less than 10% of times). > */ > if (cnt <= 1 || !(cnt % 16)) > - vhost_poll_queue(&vq->poll); > + vhost_poll_queue(&nvq->vq.poll); > > rcu_read_unlock_bh(); > } > @@ -1525,7 +1525,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) > /* start polling new socket */ > oldsock = vhost_vq_get_backend(vq); > if (sock != oldsock) { > - ubufs = vhost_net_ubuf_alloc(vq, > + ubufs = vhost_net_ubuf_alloc(nvq, > sock && vhost_sock_zcopy(sock)); > if (IS_ERR(ubufs)) { > r = PTR_ERR(ubufs); > -- > MST >