Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612650

Re: [PATCH 4/6] virtio_net: allow specifying context for rx

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!78.46.240.70.MISMATCH!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Cornelia Huck <cornelia.huck@de.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/6] virtio_net: allow specifying context for rx
Date Thu, 30 Mar 2017 09:30:01 +0200
Message-ID <tqCGR-2MS-1@gated-at.bofh.it> (permalink)
References <tqsRb-3S4-7@gated-at.bofh.it> <tqsRc-3S4-35@gated-at.bofh.it>
Organization IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen 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-0020-0000-0000-000003344723
X-Ibm-Av-Detection SAVI=unused REMOTE=unused XFE=unused
X-Cbparentid 17033007-0021-0000-0000-0000410832EF
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 robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 63
X-Original-Cc linux-kernel@vger.kernel.org, netdev@vger.kernel.org, John Fastabend <john.fastabend@gmail.com>, virtualization@lists.linux-foundation.org
X-Original-Date Thu, 30 Mar 2017 09:26:51 +0200
X-Original-Message-ID <20170330092651.7767dfac.cornelia.huck@de.ibm.com>
X-Original-References <1490820507-8005-1-git-send-email-mst@redhat.com> <1490820507-8005-5-git-send-email-mst@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1612650

Show key headers only | View raw


On Wed, 29 Mar 2017 23:48:54 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> With mergeable buffers we never use s/g for rx,
> so allow specifying context in that case.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  drivers/net/virtio_net.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 6802169..340f737 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2044,6 +2044,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
>  	int ret = -ENOMEM;
>  	int i, total_vqs;
>  	const char **names;
> +	const bool *ctx;
>  
>  	/* We expect 1 RX virtqueue followed by 1 TX virtqueue, followed by
>  	 * possible N-1 RX/TX queue pairs used in multiqueue mode, followed by
> @@ -2062,6 +2063,13 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
>  	names = kmalloc(total_vqs * sizeof(*names), GFP_KERNEL);
>  	if (!names)
>  		goto err_names;
> +	if (vi->mergeable_rx_bufs) {
> +		ctx = kzalloc(total_vqs * sizeof(*ctx), GFP_KERNEL);
> +		if (!ctx)
> +			goto err_ctx;
> +	} else {
> +		ctx = NULL;
> +	}
>  
>  	/* Parameters for control virtqueue, if any */
>  	if (vi->has_cvq) {
> @@ -2077,9 +2085,12 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
>  		sprintf(vi->sq[i].name, "output.%d", i);
>  		names[rxq2vq(i)] = vi->rq[i].name;
>  		names[txq2vq(i)] = vi->sq[i].name;
> +		if (ctx)
> +			ctx[rxq2vq(i)] = true;
>  	}
>  
> -	ret = virtio_find_vqs(vi->vdev, total_vqs, vqs, callbacks, names, NULL);
> +	ret = vi->vdev->config->find_vqs(vi->vdev, total_vqs, vqs, callbacks,
> +					 names, ctx, NULL);

virtio_find_vqs_ctx()? (Needs to be exported, obviously.)

>  	if (ret)
>  		goto err_find;
>  
> @@ -2101,6 +2112,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
>  	return 0;
>  
>  err_find:
> +	kfree(ctx);
> +err_ctx:
>  	kfree(names);
>  err_names:
>  	kfree(callbacks);

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] virtio: support extra per-buffer context "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
  [PATCH 3/6] virtio: allow extra context per descriptor "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
    Re: [PATCH 3/6] virtio: allow extra context per descriptor Cornelia Huck <cornelia.huck@de.ibm.com> - 2017-03-30 09:30 +0200
      Re: [PATCH 3/6] virtio: allow extra context per descriptor "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 16:40 +0200
  [PATCH 2/6] virtio: add context flag to find vqs "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
    Re: [PATCH 2/6] virtio: add context flag to find vqs Cornelia Huck <cornelia.huck@de.ibm.com> - 2017-03-30 09:20 +0200
      Re: [PATCH 2/6] virtio: add context flag to find vqs "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 17:00 +0200
  [PATCH 1/6] virtio: wrap find_vqs "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
    RE: [PATCH 1/6] virtio: wrap find_vqs "Gonglei (Arei)" <arei.gonglei@huawei.com> - 2017-03-30 03:00 +0200
    Re: [PATCH 1/6] virtio: wrap find_vqs Jason Wang <jasowang@redhat.com> - 2017-03-30 08:10 +0200
      Re: [PATCH 1/6] virtio: wrap find_vqs "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 16:40 +0200
        Re: [PATCH 1/6] virtio: wrap find_vqs Jason Wang <jasowang@redhat.com> - 2017-03-31 06:10 +0200
          Re: [PATCH 1/6] virtio: wrap find_vqs "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-31 18:30 +0200
    Re: [PATCH 1/6] virtio: wrap find_vqs Cornelia Huck <cornelia.huck@de.ibm.com> - 2017-03-30 09:20 +0200
    Re: [PATCH 1/6] virtio: wrap find_vqs Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-04-01 18:20 +0200
  [PATCH 5/6] virtio_net: rework mergeable buffer handling "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
  [PATCH 4/6] virtio_net: allow specifying context for rx "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-29 23:00 +0200
    Re: [PATCH 4/6] virtio_net: allow specifying context for rx Cornelia Huck <cornelia.huck@de.ibm.com> - 2017-03-30 09:30 +0200
      Re: [PATCH 4/6] virtio_net: allow specifying context for rx "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-30 16:40 +0200
        Re: [PATCH 4/6] virtio_net: allow specifying context for rx Cornelia Huck <cornelia.huck@de.ibm.com> - 2017-03-30 16:50 +0200

csiph-web