From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amit Shah Subject: Re: [RFC PATCH 8/8] virtio: net: Add freeze, restore handlers to support S4 Date: Fri, 29 Jul 2011 10:38:21 +0530 Message-ID: <20110729050145.GE24868@amit-x200.redhat.com> References: <3d2fd91237cfb3ff1e05e464e305df2711b45885.1311863438.git.amit.shah@redhat.com> <20110729041335.GD31888@redhat.com> <20110729042802.GD24868@amit-x200.redhat.com> <20110729043116.GG31888@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20110729043116.GG31888@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: "Michael S. Tsirkin" Cc: Virtualization List List-Id: virtualization@lists.linuxfoundation.org On (Fri) 29 Jul 2011 [07:31:16], Michael S. Tsirkin wrote: > On Fri, Jul 29, 2011 at 09:58:02AM +0530, Amit Shah wrote: > > On (Fri) 29 Jul 2011 [07:13:35], Michael S. Tsirkin wrote: > > > > +static int virtnet_restore(struct virtio_device *vdev) > > > > +{ > > > > + struct virtnet_info *vi = vdev->priv; > > > > + struct virtqueue *vqs[3]; > > > > + vq_callback_t *callbacks[] = { skb_recv_done, skb_xmit_done, NULL}; > > > > + const char *names[] = { "input", "output", "control" }; > > > > + int nvqs, err; > > > > + > > > > + /* We expect two virtqueues, receive then send, > > > > + * and optionally control. */ > > > > + nvqs = virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ? 3 : 2; > > > > + > > > > + err = vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names); > > > > + if (err) > > > > + return err; > > > > + > > > > + vi->rvq = vqs[0]; > > > > + vi->svq = vqs[1]; > > > > + > > > > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) { > > > > + vi->cvq = vqs[2]; > > > > + } > > > > + > > > > + /* Last of all, set up some receive buffers. */ > > > > + try_fill_recv(vi, GFP_KERNEL); > > I guess we should schedule work on failure, as well. > > > > > > > should probably update carrier status too. > > > > Will add that. > > > > I think most of these restore routines are incomplete; I just pulled > > in the most important things from the probe routines, but before the > > final submission I'll do a thorough walk-through and ensure I get all > > the bits necessary. > > In some cases, it might be a good idea to use common > code for that. Absolutely. Amit