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
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

Reply via email to