All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	John Fastabend <john.fastabend@gmail.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 4/6] virtio_net: allow specifying context for rx
Date: Thu, 30 Mar 2017 09:26:51 +0200	[thread overview]
Message-ID: <20170330092651.7767dfac.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1490820507-8005-5-git-send-email-mst@redhat.com>

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);

  reply	other threads:[~2017-03-30  7:27 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 20:48 [PATCH 0/6] virtio: support extra per-buffer context Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 1/6] virtio: wrap find_vqs Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  0:50   ` Gonglei (Arei)
2017-03-30  0:50   ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  0:50     ` Gonglei (Arei)
2017-03-30  6:00   ` Jason Wang
2017-03-30  6:00   ` Jason Wang
2017-03-30  6:00     ` Jason Wang
2017-03-30 14:32     ` Michael S. Tsirkin
2017-03-30 14:32       ` Michael S. Tsirkin
2017-03-31  4:04       ` Jason Wang
2017-03-31  4:04       ` Jason Wang
2017-03-31  4:04         ` Jason Wang
2017-03-31 16:21         ` Michael S. Tsirkin
2017-03-31 16:21           ` Michael S. Tsirkin
2017-03-31 16:21         ` Michael S. Tsirkin
2017-03-30 14:32     ` Michael S. Tsirkin
2017-03-30  7:18   ` Cornelia Huck
2017-03-30  7:18     ` Cornelia Huck
2017-03-30  7:18   ` Cornelia Huck
2017-04-01 16:13   ` Bjorn Andersson
2017-04-01 16:13     ` Bjorn Andersson
2017-03-29 20:48 ` [PATCH 2/6] virtio: add context flag to find vqs Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:17   ` Cornelia Huck
2017-03-30  7:17     ` Cornelia Huck
2017-03-30 14:57     ` Michael S. Tsirkin
2017-03-30 14:57       ` Michael S. Tsirkin
2017-03-30  7:17   ` Cornelia Huck
2017-03-29 20:48 ` [PATCH 3/6] virtio: allow extra context per descriptor Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:23   ` Cornelia Huck
2017-03-30  7:23     ` Cornelia Huck
2017-03-30 14:34     ` Michael S. Tsirkin
2017-03-30 14:34       ` Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 4/6] virtio_net: allow specifying context for rx Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-30  7:26   ` Cornelia Huck [this message]
2017-03-30 14:31     ` Michael S. Tsirkin
2017-03-30 14:46       ` Cornelia Huck
2017-03-30 14:46         ` Cornelia Huck
2017-03-30 14:31     ` Michael S. Tsirkin
2017-03-30  7:26   ` Cornelia Huck
2017-03-29 20:48 ` [PATCH 5/6] virtio_net: rework mergeable buffer handling Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin
2017-03-29 20:48 ` [PATCH 6/6] virtio_net: reduce alignment for buffers Michael S. Tsirkin
2017-03-29 20:48   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170330092651.7767dfac.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=john.fastabend@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.