Skip to contentSkip to conversation

net: several cleanups

PATCH RESEND In review Zhi Yong Wu 2 participants 7 messages Nov 28, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: several cleanups

From: Zhi Yong Wu <[email protected]>

Per David's request, it's time to resend them now.

Zhi Yong Wu (4):
vhost: remove the dead branch
vhost: adjust vhost_dev_init() to be void
macvtap: remove the dead branch
macvtap: adjust macvtap_skb_to_vnet_hdr() to be void

 drivers/net/macvtap.c |    8 ++------
 drivers/vhost/net.c   |    9 ++-------
 drivers/vhost/scsi.c  |    7 +------
 drivers/vhost/test.c  |    8 +-------
 drivers/vhost/vhost.c |    4 +---
 drivers/vhost/vhost.h |    2 +-
 6 files changed, 8 insertions(+), 30 deletions(-)
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH RESEND 1/4 vhost: remove the dead branch

From: Zhi Yong Wu <[email protected]>

Since vhost_dev_init() forever return 0, some branches are never run, therefore need to be removed.

---
 drivers/vhost/net.c  |    5 -----
 drivers/vhost/scsi.c |    5 -----
 drivers/vhost/test.c |    5 -----
 3 files changed, 0 insertions(+), 15 deletions(-)
drivers/vhost/net.c +0 -5
index 831eb4f..0554785 100644
@@ -707,11 +707,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
 		n->vqs[i].sock_hlen = 0;
 	}
 	r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
-	if (r < 0) {
-		kfree(n);
-		kfree(vqs);
-		return r;
-	}
 
 	vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
 	vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
drivers/vhost/scsi.c +0 -5
index f175629..3164680 100644
@@ -1421,14 +1421,9 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
 
 	tcm_vhost_init_inflight(vs, NULL);
 
-	if (r < 0)
-		goto err_init;
-
 	f->private_data = vs;
 	return 0;
 
-err_init:
-	kfree(vqs);
 err_vqs:
 	vhost_scsi_free(vs);
 err_vs:
drivers/vhost/test.c +0 -5
index 339eae8..99cb960 100644
@@ -118,11 +118,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
 	vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
 	n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
 	r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
-	if (r < 0) {
-		kfree(vqs);
-		kfree(n);
-		return r;
-	}
 
 	f->private_data = n;
 
Signature · 1 line
1.7.6.5
#2 lore raw

PATCH RESEND 2/4 vhost: adjust vhost_dev_init() to be void

In reply to Zhi Yong Wu

From: Zhi Yong Wu <[email protected]>

---
 drivers/vhost/net.c   |    4 ++--
 drivers/vhost/scsi.c  |    2 +-
 drivers/vhost/test.c  |    3 +--
 drivers/vhost/vhost.c |    4 +---
 drivers/vhost/vhost.h |    2 +-
 5 files changed, 6 insertions(+), 9 deletions(-)
drivers/vhost/net.c +2 -2
index 0554785..9a68409 100644
@@ -683,7 +683,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
 	struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
 	struct vhost_dev *dev;
 	struct vhost_virtqueue **vqs;
-	int r, i;
+	int i;
 
 	if (!n)
 		return -ENOMEM;
@@ -706,7 +706,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
 		n->vqs[i].vhost_hlen = 0;
 		n->vqs[i].sock_hlen = 0;
 	}
-	r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
+	vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
 
 	vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
 	vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
drivers/vhost/scsi.c +1 -1
index 3164680..1e4c75c 100644
@@ -1417,7 +1417,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
 		vqs[i] = &vs->vqs[i].vq;
 		vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick;
 	}
-	r = vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
+	vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
 
 	tcm_vhost_init_inflight(vs, NULL);
 
drivers/vhost/test.c +1 -2
index 99cb960..c2a54fb 100644
@@ -104,7 +104,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
 	struct vhost_test *n = kmalloc(sizeof *n, GFP_KERNEL);
 	struct vhost_dev *dev;
 	struct vhost_virtqueue **vqs;
-	int r;
 
 	if (!n)
 		return -ENOMEM;
@@ -117,7 +116,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
 	dev = &n->dev;
 	vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
 	n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
-	r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
+	vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
 
 	f->private_data = n;
 
drivers/vhost/vhost.c +1 -3
index 69068e0..78987e4 100644
@@ -290,7 +290,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
 		vhost_vq_free_iovecs(dev->vqs[i]);
 }
 
-long vhost_dev_init(struct vhost_dev *dev,
+void vhost_dev_init(struct vhost_dev *dev,
 		    struct vhost_virtqueue **vqs, int nvqs)
 {
 	struct vhost_virtqueue *vq;
@@ -319,8 +319,6 @@ long vhost_dev_init(struct vhost_dev *dev,
 			vhost_poll_init(&vq->poll, vq->handle_kick,
 					POLLIN, dev);
 	}
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(vhost_dev_init);
 
drivers/vhost/vhost.h +1 -1
index 4465ed5..35eeb2a 100644
@@ -127,7 +127,7 @@ struct vhost_dev {
 	struct task_struct *worker;
 };
 
-long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
+void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
 long vhost_dev_set_owner(struct vhost_dev *dev);
 bool vhost_dev_has_owner(struct vhost_dev *dev);
 long vhost_dev_check_owner(struct vhost_dev *);
Signature · 1 line
1.7.6.5
#3 lore raw

PATCH RESEND 3/4 macvtap: remove the dead branch

In reply to Zhi Yong Wu

From: Zhi Yong Wu <[email protected]>

---
 drivers/net/macvtap.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/macvtap.c +0 -2
index dc76670..eeb1a97 100644
@@ -780,8 +780,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
 			return -EINVAL;
 
 		ret = macvtap_skb_to_vnet_hdr(skb, &vnet_hdr);
-		if (ret)
-			return ret;
 
 		if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr)))
 			return -EFAULT;
Signature · 1 line
1.7.6.5
#4 lore raw

PATCH RESEND 4/4 macvtap: adjust macvtap_skb_to_vnet_hdr() to be void

In reply to Zhi Yong Wu

From: Zhi Yong Wu <[email protected]>

---
 drivers/net/macvtap.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/macvtap.c +2 -4
index eeb1a97..155d60e 100644
@@ -588,7 +588,7 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb,
 	return 0;
 }
 
-static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
+static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
 				   struct virtio_net_hdr *vnet_hdr)
 {
 	memset(vnet_hdr, 0, sizeof(*vnet_hdr));
@@ -619,8 +619,6 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
 	} else if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
 		vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
 	} /* else everything is zero */
-
-	return 0;
 }
 
 /* Get packet from user space buffer */
@@ -779,7 +777,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
 		if ((len -= vnet_hdr_len) < 0)
 			return -EINVAL;
 
-		ret = macvtap_skb_to_vnet_hdr(skb, &vnet_hdr);
+		macvtap_skb_to_vnet_hdr(skb, &vnet_hdr);
 
 		if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr)))
 			return -EFAULT;
Signature · 1 line
1.7.6.5
maintainer
#5 lore raw
In reply to Zhi Yong Wu

From: Zhi Yong Wu <[email protected]>
Date: Thu, 28 Nov 2013 09:31:29 +0800

Quoted 1 line

Per David's request, it's time to resend them now.

No, it is not the time.

You should not submit these kinds of patches until the net-next tree is open again, and I make an announcement here when that is the case. I have yet to make such an announcement, and I do not plan to do so for several days as I am travelling and will be busy dealing with my backlog of patches once I get home.

#6 lore raw
Quoted 5 lines · David Miller

From: Zhi Yong Wu <[email protected]>
Date: Thu, 28 Nov 2013 09:31:29 +0800

Quoted 1 line

Per David's request, it's time to resend them now.

Quoted 8 lines

No, it is not the time.

You should not submit these kinds of patches until the net-next tree is open again, and I make an announcement here when that is the case. I have yet to make such an announcement, and I do not plan to do so for several days as I am travelling and will be busy dealing with my backlog of patches once I get home.

ok, will wait for your announcement to be out.

Signature · 3 lines
Regards,

Zhi Yong Wu