netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>, mst@redhat.com
Cc: john.r.fastabend@intel.com, netdev@vger.kernel.org,
	alexei.starovoitov@gmail.com, daniel@iogearbox.net
Subject: Re: [net PATCH v5 6/6] virtio_net: XDP support for adjust_head
Date: Wed, 18 Jan 2017 11:35:58 +0800	[thread overview]
Message-ID: <5a587c8e-851c-9793-7f1f-8857cc00b2d7@redhat.com> (raw)
In-Reply-To: <20170117222259.20280.24625.stgit@john-Precision-Tower-5810>



On 2017年01月18日 06:22, John Fastabend wrote:
>   
> +static int virtnet_reset(struct virtnet_info *vi)
> +{
> +	struct virtio_device *dev = vi->vdev;
> +	int ret;
> +
> +	virtio_config_disable(dev);
> +	dev->failed = dev->config->get_status(dev) & VIRTIO_CONFIG_S_FAILED;
> +	virtnet_freeze_down(dev);
> +	_remove_vq_common(vi);
> +
> +	dev->config->reset(dev);
> +	virtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
> +	virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER);
> +
> +	ret = virtio_finalize_features(dev);
> +	if (ret)
> +		goto err;
> +
> +	ret = virtnet_restore_up(dev);
> +	if (ret)
> +		goto err;
> +	ret = _virtnet_set_queues(vi, vi->curr_queue_pairs);
> +	if (ret)
> +		goto err;
> +
> +	virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
> +	virtio_config_enable(dev);
> +	return 0;
> +err:
> +	virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
> +	return ret;
> +}
> +

Hi John:

I still prefer not open code (part of) virtio_device_freeze() and 
virtio_device_restore() here. How about:

1) introduce __virtio_device_freeze/__virtio_device_restore which 
accepts a function pointer of free/restore
2) for virtio_device_freeze/virtio_device_restore just pass 
drv->freeze/drv->restore (locked version)
3) for virtnet_reset(), we can pass unlocked version of freeze and restore

Just my preference, if both Michael and you stick to this, I'm also fine.

Thanks

  reply	other threads:[~2017-01-18  3:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 22:19 [net PATCH v5 0/6] virtio_net XDP fixes and adjust_header support John Fastabend
2017-01-17 22:19 ` [net PATCH v5 1/6] virtio_net: use dev_kfree_skb for small buffer XDP receive John Fastabend
2017-01-18 15:48   ` Michael S. Tsirkin
2017-01-23 21:08   ` Michael S. Tsirkin
2017-01-23 21:57     ` John Fastabend
2017-01-24 19:43     ` David Miller
2017-01-24 20:08       ` Michael S. Tsirkin
2017-01-24 20:11         ` David Miller
2017-01-24 20:54           ` Michael S. Tsirkin
2017-01-25  2:57         ` Jason Wang
2017-01-25  3:23           ` Michael S. Tsirkin
2017-01-25  4:02             ` John Fastabend
2017-01-25  5:46               ` Jason Wang
2017-01-25 14:47                 ` Michael S. Tsirkin
2017-01-25 14:45               ` Michael S. Tsirkin
2017-01-17 22:20 ` [net PATCH v5 2/6] virtio_net: wrap rtnl_lock in test for calling with lock already held John Fastabend
2017-01-17 22:21 ` [net PATCH v5 3/6] virtio_net: factor out xdp handler for readability John Fastabend
2017-01-18 15:48   ` Michael S. Tsirkin
2017-01-17 22:21 ` [net PATCH v5 4/6] virtio_net: remove duplicate queue pair binding in XDP John Fastabend
2017-01-18 15:49   ` Michael S. Tsirkin
2017-01-17 22:22 ` [net PATCH v5 5/6] virtio_net: refactor freeze/restore logic into virtnet reset logic John Fastabend
2017-01-18 15:50   ` Michael S. Tsirkin
2017-01-17 22:22 ` [net PATCH v5 6/6] virtio_net: XDP support for adjust_head John Fastabend
2017-01-18  3:35   ` Jason Wang [this message]
2017-01-18 15:15   ` Michael S. Tsirkin
2017-01-19  3:05     ` Jason Wang
2017-01-19 21:11       ` Michael S. Tsirkin
2017-01-20  3:26         ` Jason Wang
2017-01-20  3:39           ` John Fastabend
2017-01-20  3:38         ` John Fastabend
2017-01-20 16:59         ` David Laight
2017-01-20 17:48           ` Michael S. Tsirkin
2017-01-22  2:51             ` Jason Wang
2017-01-22  4:14               ` John Fastabend
2017-01-23 17:02                 ` Michael S. Tsirkin
2017-01-23 19:22   ` Michael S. Tsirkin
2017-01-23 20:09     ` Michael S. Tsirkin
2017-01-23 22:12       ` John Fastabend
2017-01-23 22:28         ` Michael S. Tsirkin
2017-01-18 15:48 ` [net PATCH v5 0/6] virtio_net XDP fixes and adjust_header support 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=5a587c8e-851c-9793-7f1f-8857cc00b2d7@redhat.com \
    --to=jasowang@redhat.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=john.r.fastabend@intel.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).