netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev)
@ 2013-08-03  0:22 Wang Sheng-Hui
  2013-08-03  0:33 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Sheng-Hui @ 2013-08-03  0:22 UTC (permalink / raw)
  To: Patrick McHardy, David S. Miller, netdev

This patch cleanup 2 points for the usage of vlan_dev_priv(dev):
	* In vlan_dev.c/vlan_dev_hard_header, we should use the var *vlan directly
	  after grabing the pointer at the beginning with
	      *vlan = vlan_dev_priv(dev);
       when we need to access the fields of *vlan.
	* In vlan.c/register_vlan_device, add the var *vlan pointer
	      struct vlan_dev_priv *vlan;
	  to cleanup the code to access the fields of vlan_dev_priv(new_dev).

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
  net/8021q/vlan.c     |   12 +++++++-----
  net/8021q/vlan_dev.c |    6 +++---
  2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2fb2d88..b9d3d7e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -210,6 +210,7 @@ out_vid_del:
  static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
  {
  	struct net_device *new_dev;
+	struct vlan_dev_priv *vlan;
  	struct net *net = dev_net(real_dev);
  	struct vlan_net *vn = net_generic(net, vlan_net_id);
  	char name[IFNAMSIZ];
@@ -260,11 +261,12 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
  	new_dev->mtu = real_dev->mtu;
  	new_dev->priv_flags |= (real_dev->priv_flags & IFF_UNICAST_FLT);

-	vlan_dev_priv(new_dev)->vlan_proto = htons(ETH_P_8021Q);
-	vlan_dev_priv(new_dev)->vlan_id = vlan_id;
-	vlan_dev_priv(new_dev)->real_dev = real_dev;
-	vlan_dev_priv(new_dev)->dent = NULL;
-	vlan_dev_priv(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
+	vlan = vlan_dev_priv(new_dev);
+	vlan->vlan_proto = htons(ETH_P_8021Q);
+	vlan->vlan_id = vlan_id;
+	vlan->real_dev = real_dev;
+	vlan->dent = NULL;
+	vlan->flags = VLAN_FLAG_REORDER_HDR;

  	new_dev->rtnl_link_ops = &vlan_link_ops;
  	err = register_vlan_dev(new_dev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1cd3d2a..9ab8a7e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -107,10 +107,10 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
  	u16 vlan_tci = 0;
  	int rc;

-	if (!(vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
+	if (!(vlan->flags & VLAN_FLAG_REORDER_HDR)) {
  		vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);

-		vlan_tci = vlan_dev_priv(dev)->vlan_id;
+		vlan_tci = vlan->vlan_id;
  		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
  		vhdr->h_vlan_TCI = htons(vlan_tci);

@@ -133,7 +133,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
  		saddr = dev->dev_addr;

  	/* Now make the underlying real hard header */
-	dev = vlan_dev_priv(dev)->real_dev;
+	dev = vlan->real_dev;
  	rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
  	if (rc > 0)
  		rc += vhdrlen;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev)
  2013-08-03  0:22 [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev) Wang Sheng-Hui
@ 2013-08-03  0:33 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-08-03  0:33 UTC (permalink / raw)
  To: shhuiw; +Cc: kaber, netdev

From: Wang Sheng-Hui <shhuiw@gmail.com>
Date: Sat, 03 Aug 2013 08:22:42 +0800

> This patch cleanup 2 points for the usage of vlan_dev_priv(dev):
> 	* In vlan_dev.c/vlan_dev_hard_header, we should use the var *vlan
> 	* directly
> 	  after grabing the pointer at the beginning with
> 	      *vlan = vlan_dev_priv(dev);
>       when we need to access the fields of *vlan.
> 	* In vlan.c/register_vlan_device, add the var *vlan pointer
> 	      struct vlan_dev_priv *vlan;
> 	  to cleanup the code to access the fields of vlan_dev_priv(new_dev).
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>

This patch doesn't even come close to applying to the net-next tree:

patching file net/8021q/vlan.c
Hunk #1 FAILED at 210.
Hunk #2 succeeded at 260 with fuzz 2.
1 out of 2 hunks FAILED -- saving rejects to file net/8021q/vlan.c.rej
patching file net/8021q/vlan_dev.c
Hunk #1 FAILED at 107.
Hunk #2 FAILED at 133.
2 out of 2 hunks FAILED -- saving rejects to file net/8021q/vlan_dev.c.rej

Please respin your changes and resubmit, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev)
@ 2013-08-03  8:54 Wang Sheng-Hui
  2013-08-03 17:33 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Sheng-Hui @ 2013-08-03  8:54 UTC (permalink / raw)
  To: Patrick McHardy, David S. Miller, netdev


This patch cleanup 2 points for the usage of vlan_dev_priv(dev):
* In vlan_dev.c/vlan_dev_hard_header, we should use the var *vlan directly
  after grabing the pointer at the beginning with
        *vlan = vlan_dev_priv(dev);
  when we need to access the fields of *vlan.
* In vlan.c/register_vlan_device, add the var *vlan pointer
        struct vlan_dev_priv *vlan;
to cleanup the code to access the fields of vlan_dev_priv(new_dev).

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
 net/8021q/vlan.c     |   12 +++++++-----
 net/8021q/vlan_dev.c |    6 +++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2fb2d88..b9d3d7e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -210,6 +210,7 @@ out_vid_del:
 static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
 {
 	struct net_device *new_dev;
+	struct vlan_dev_priv *vlan;
 	struct net *net = dev_net(real_dev);
 	struct vlan_net *vn = net_generic(net, vlan_net_id);
 	char name[IFNAMSIZ];
@@ -260,11 +261,12 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
 	new_dev->mtu = real_dev->mtu;
 	new_dev->priv_flags |= (real_dev->priv_flags & IFF_UNICAST_FLT);
 
-	vlan_dev_priv(new_dev)->vlan_proto = htons(ETH_P_8021Q);
-	vlan_dev_priv(new_dev)->vlan_id = vlan_id;
-	vlan_dev_priv(new_dev)->real_dev = real_dev;
-	vlan_dev_priv(new_dev)->dent = NULL;
-	vlan_dev_priv(new_dev)->flags = VLAN_FLAG_REORDER_HDR;
+	vlan = vlan_dev_priv(new_dev);
+	vlan->vlan_proto = htons(ETH_P_8021Q);
+	vlan->vlan_id = vlan_id;
+	vlan->real_dev = real_dev;
+	vlan->dent = NULL;
+	vlan->flags = VLAN_FLAG_REORDER_HDR;
 
 	new_dev->rtnl_link_ops = &vlan_link_ops;
 	err = register_vlan_dev(new_dev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 1cd3d2a..9ab8a7e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -107,10 +107,10 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
 	u16 vlan_tci = 0;
 	int rc;
 
-	if (!(vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
+	if (!(vlan->flags & VLAN_FLAG_REORDER_HDR)) {
 		vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
 
-		vlan_tci = vlan_dev_priv(dev)->vlan_id;
+		vlan_tci = vlan->vlan_id;
 		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
 		vhdr->h_vlan_TCI = htons(vlan_tci);
 
@@ -133,7 +133,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
 		saddr = dev->dev_addr;
 
 	/* Now make the underlying real hard header */
-	dev = vlan_dev_priv(dev)->real_dev;
+	dev = vlan->real_dev;
 	rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
 	if (rc > 0)
 		rc += vhdrlen;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev)
  2013-08-03  8:54 Wang Sheng-Hui
@ 2013-08-03 17:33 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-08-03 17:33 UTC (permalink / raw)
  To: shhuiw; +Cc: kaber, netdev

From: Wang Sheng-Hui <shhuiw@gmail.com>
Date: Sat, 03 Aug 2013 16:54:50 +0800

> 
> This patch cleanup 2 points for the usage of vlan_dev_priv(dev):
> * In vlan_dev.c/vlan_dev_hard_header, we should use the var *vlan directly
>   after grabing the pointer at the beginning with
>         *vlan = vlan_dev_priv(dev);
>   when we need to access the fields of *vlan.
> * In vlan.c/register_vlan_device, add the var *vlan pointer
>         struct vlan_dev_priv *vlan;
> to cleanup the code to access the fields of vlan_dev_priv(new_dev).
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-03 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-03  0:22 [PATCH] vlan: cleanup the usage of vlan_dev_priv(dev) Wang Sheng-Hui
2013-08-03  0:33 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2013-08-03  8:54 Wang Sheng-Hui
2013-08-03 17:33 ` David Miller

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).