diff options
Diffstat (limited to 'drivers/net/xen-netback/xenbus.c')
| -rw-r--r-- | drivers/net/xen-netback/xenbus.c | 83 | 
1 files changed, 32 insertions, 51 deletions
| diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index bacf6e0c12b9..daf4c7867102 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -165,7 +165,7 @@ xenvif_write_io_ring(struct file *filp, const char __user *buf, size_t count,  	return count;  } -static int xenvif_io_ring_open(struct inode *inode, struct file *filp) +static int xenvif_dump_open(struct inode *inode, struct file *filp)  {  	int ret;  	void *queue = NULL; @@ -179,35 +179,13 @@ static int xenvif_io_ring_open(struct inode *inode, struct file *filp)  static const struct file_operations xenvif_dbg_io_ring_ops_fops = {  	.owner = THIS_MODULE, -	.open = xenvif_io_ring_open, +	.open = xenvif_dump_open,  	.read = seq_read,  	.llseek = seq_lseek,  	.release = single_release,  	.write = xenvif_write_io_ring,  }; -static int xenvif_read_ctrl(struct seq_file *m, void *v) -{ -	struct xenvif *vif = m->private; - -	xenvif_dump_hash_info(vif, m); - -	return 0; -} - -static int xenvif_ctrl_open(struct inode *inode, struct file *filp) -{ -	return single_open(filp, xenvif_read_ctrl, inode->i_private); -} - -static const struct file_operations xenvif_dbg_ctrl_ops_fops = { -	.owner = THIS_MODULE, -	.open = xenvif_ctrl_open, -	.read = seq_read, -	.llseek = seq_lseek, -	.release = single_release, -}; -  static void xenvif_debugfs_addif(struct xenvif *vif)  {  	struct dentry *pfile; @@ -232,17 +210,6 @@ static void xenvif_debugfs_addif(struct xenvif *vif)  				pr_warn("Creation of io_ring file returned %ld!\n",  					PTR_ERR(pfile));  		} - -		if (vif->ctrl_task) { -			pfile = debugfs_create_file("ctrl", -						    S_IRUSR, -						    vif->xenvif_dbg_root, -						    vif, -						    &xenvif_dbg_ctrl_ops_fops); -			if (IS_ERR_OR_NULL(pfile)) -				pr_warn("Creation of ctrl file returned %ld!\n", -					PTR_ERR(pfile)); -		}  	} else  		netdev_warn(vif->dev,  			    "Creation of vif debugfs dir returned %ld!\n", @@ -304,6 +271,11 @@ static int netback_probe(struct xenbus_device *dev,  	be->dev = dev;  	dev_set_drvdata(&dev->dev, be); +	be->state = XenbusStateInitialising; +	err = xenbus_switch_state(dev, XenbusStateInitialising); +	if (err) +		goto fail; +  	sg = 1;  	do { @@ -416,11 +388,6 @@ static int netback_probe(struct xenbus_device *dev,  	be->hotplug_script = script; -	err = xenbus_switch_state(dev, XenbusStateInitWait); -	if (err) -		goto fail; - -	be->state = XenbusStateInitWait;  	/* This kicks hotplug scripts, so do it immediately. */  	err = backend_create_xenvif(be); @@ -525,20 +492,20 @@ static inline void backend_switch_state(struct backend_info *be,  /* Handle backend state transitions:   * - * The backend state starts in InitWait and the following transitions are + * The backend state starts in Initialising and the following transitions are   * allowed.   * - * InitWait -> Connected - * - *    ^    \         | - *    |     \        | - *    |      \       | - *    |       \      | - *    |        \     | - *    |         \    | - *    |          V   V + * Initialising -> InitWait -> Connected + *          \ + *           \        ^    \         | + *            \       |     \        | + *             \      |      \       | + *              \     |       \      | + *               \    |        \     | + *                \   |         \    | + *                 V  |          V   V   * - *  Closed  <-> Closing + *                  Closed  <-> Closing   *   * The state argument specifies the eventual state of the backend and the   * function transitions to that state via the shortest path. @@ -548,6 +515,20 @@ static void set_backend_state(struct backend_info *be,  {  	while (be->state != state) {  		switch (be->state) { +		case XenbusStateInitialising: +			switch (state) { +			case XenbusStateInitWait: +			case XenbusStateConnected: +			case XenbusStateClosing: +				backend_switch_state(be, XenbusStateInitWait); +				break; +			case XenbusStateClosed: +				backend_switch_state(be, XenbusStateClosed); +				break; +			default: +				BUG(); +			} +			break;  		case XenbusStateClosed:  			switch (state) {  			case XenbusStateInitWait: | 
