public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: David Miller <davem@davemloft•net>
Cc: "Jiri Pirko" <jpirko@redhat•com>,
	"Nicolas de Pesloüan" <nicolas.2p.debian@gmail•com>,
	"Changli Gao" <xiaosuo@gmail•com>,
	netdev@vger•kernel.org, shemminger@linux-foundation•org,
	kaber@trash•net, fubar@us•ibm.com, eric.dumazet@gmail•com,
	andy@greyhouse•net, "Jesse Gross" <jesse@nicira•com>
Subject: [PATCH 3/3] vlan: Simplify the code now that VLAN_FLAG_REORDER_HDR is always set
Date: Sun, 22 May 2011 12:42:20 -0700	[thread overview]
Message-ID: <m1y61yiktf.fsf_-_@fess.ebiederm.org> (raw)
In-Reply-To: <m14o4mjzh3.fsf_-_@fess.ebiederm.org> (Eric W. Biederman's message of "Sun, 22 May 2011 12:40:24 -0700")


Now that we no longer support clearing VLAN_FLAG_REORDER_HDR remove the
code that was needed to cope with the case when it was cleared.

Signed-off-by: Eric W. Biederman <ebiederm@xmission•com>
---
 net/8021q/vlan_dev.c |   45 +++++----------------------------------------
 1 files changed, 5 insertions(+), 40 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 20629fe..2b3ca1e 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -96,63 +96,28 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
 				const void *daddr, const void *saddr,
 				unsigned int len)
 {
-	struct vlan_hdr *vhdr;
-	unsigned int vhdrlen = 0;
-	u16 vlan_tci = 0;
 	int rc;
 
-	if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
-		vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
-
-		vlan_tci = vlan_dev_info(dev)->vlan_id;
-		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
-		vhdr->h_vlan_TCI = htons(vlan_tci);
-
-		/*
-		 *  Set the protocol type. For a packet of type ETH_P_802_3/2 we
-		 *  put the length in here instead.
-		 */
-		if (type != ETH_P_802_3 && type != ETH_P_802_2)
-			vhdr->h_vlan_encapsulated_proto = htons(type);
-		else
-			vhdr->h_vlan_encapsulated_proto = htons(len);
-
-		skb->protocol = htons(ETH_P_8021Q);
-		type = ETH_P_8021Q;
-		vhdrlen = VLAN_HLEN;
-	}
-
 	/* Before delegating work to the lower layer, enter our MAC-address */
 	if (saddr == NULL)
 		saddr = dev->dev_addr;
 
 	/* Now make the underlying real hard header */
 	dev = vlan_dev_info(dev)->real_dev;
-	rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
-	if (rc > 0)
-		rc += vhdrlen;
+	rc = dev_hard_header(skb, dev, type, daddr, saddr, len);
 	return rc;
 }
 
 static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 					    struct net_device *dev)
 {
-	struct vlan_ethhdr *veth = (struct vlan_ethhdr *)(skb->data);
 	unsigned int len;
+	u16 vlan_tci;
 	int ret;
 
-	/* Handle non-VLAN frames if they are sent to us, for example by DHCP.
-	 *
-	 * NOTE: THIS ASSUMES DIX ETHERNET, SPECIFICALLY NOT SUPPORTING
-	 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
-	 */
-	if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
-	    vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) {
-		u16 vlan_tci;
-		vlan_tci = vlan_dev_info(dev)->vlan_id;
-		vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
-		skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
-	}
+	vlan_tci = vlan_dev_info(dev)->vlan_id;
+	vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
+	skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
 
 	skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
 	len = skb->len;
-- 
1.7.5.1.217.g4e3aa


  reply	other threads:[~2011-05-22 19:42 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08  5:48 [patch net-next-2.6 v2] net: vlan: make non-hw-accel rx path similar to hw-accel Jiri Pirko
2011-04-12 21:16 ` David Miller
2011-05-21  1:11   ` Changli Gao
2011-05-21  7:29     ` Jiri Pirko
2011-05-21 10:43       ` Changli Gao
2011-05-21 13:17         ` Nicolas de Pesloüan
2011-05-21 17:54           ` Jesse Gross
2011-05-21 22:15             ` Stephen Hemminger
2011-05-22  2:59             ` Nicolas de Pesloüan
2011-05-22  6:29               ` Jiri Pirko
2011-05-22  6:34                 ` Eric W. Biederman
2011-05-22  8:34                   ` Nicolas de Pesloüan
2011-05-22  8:52                     ` Michał Mirosław
2011-05-22  9:10                       ` Nicolas de Pesloüan
2011-05-22  9:20                         ` Michał Mirosław
2011-05-22  9:36                           ` Jiri Pirko
2011-05-22  9:53                             ` Nicolas de Pesloüan
2011-05-22 10:04                               ` Michał Mirosław
2011-05-22 16:11                   ` Jesse Gross
2011-05-22 18:24                     ` Eric W. Biederman
2011-05-22 19:33                       ` Eric W. Biederman
2011-05-22 19:39                     ` [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR Eric W. Biederman
2011-05-22 19:40                       ` [PATCH 2/3] vlan: Always strip the vlan header in vlan_untag Eric W. Biederman
2011-05-22 19:42                         ` Eric W. Biederman [this message]
2011-06-09 10:59                           ` [PATCH 3/3] vlan: Simplify the code now that VLAN_FLAG_REORDER_HDR is always set Jiri Pirko
2011-06-12  6:17                             ` Eric W. Biederman
2011-05-22 21:04                       ` [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR Ben Greear
2011-05-22 22:38                         ` Eric W. Biederman
2011-05-23  0:38                           ` Changli Gao
2011-05-23  1:26                             ` Changli Gao
2011-05-23  1:45                               ` Eric W. Biederman
2011-05-23  2:14                                 ` Changli Gao
2011-05-23  9:41                                   ` Eric W. Biederman
2011-05-23 10:43                                     ` Jiri Pirko
2011-05-23 19:48                                       ` Nicolas de Pesloüan
2011-05-24  5:58                                         ` Jiri Pirko
2011-05-24  7:19                                           ` Nicolas de Pesloüan
2011-05-23  1:39                             ` Eric W. Biederman
2011-05-23  6:01                           ` Ben Greear
2011-05-23  9:00                             ` Eric W. Biederman
2011-05-23 16:33                               ` Ben Greear
2011-05-23 19:36                                 ` Nicolas de Pesloüan
2011-05-23 20:24                                   ` Ben Greear
2011-05-23 21:00                                     ` Stephen Hemminger
2011-05-23 21:20                                       ` David Miller
2011-05-23 22:05                                         ` Eric W. Biederman
2011-05-23 22:16                                           ` Stephen Hemminger
2011-05-23 22:48                                             ` Eric W. Biederman
2011-05-23 22:23                                           ` Ben Greear
2011-05-23 23:02                                             ` Eric W. Biederman
2011-05-24  4:20                                               ` Ben Greear
2011-05-24  7:11                                                 ` Nicolas de Pesloüan
2011-05-24  7:44                                                   ` Michał Mirosław
2011-05-24 15:17                                                   ` Ben Greear
2011-05-24  5:19                                           ` David Miller
2011-05-24  7:56                                             ` Eric W. Biederman
2011-05-24 15:44                                             ` Ben Greear
2011-05-24  0:11                                         ` [PATCH] vlan: Fix the b0rked ingress VLAN_FLAG_REORDER_HDR check Eric W. Biederman
2011-05-24  4:54                                           ` David Miller
2011-05-24  6:18                                             ` Eric W. Biederman
2011-05-24  6:24                                               ` David Miller
2011-05-24  7:38                                                 ` Eric W. Biederman
2011-06-02  3:59                                                   ` David Miller
2011-06-02 13:03                                                     ` [PATCH] vlan: Fix the ingress VLAN_FLAG_REORDER_HDR check v2 Eric W. Biederman
2011-06-02 13:15                                                       ` Jiri Pirko
2011-06-02 14:54                                                       ` Changli Gao
2011-06-02 15:26                                                         ` Eric W. Biederman
2011-06-02 23:18                                                           ` Changli Gao
2011-06-06 14:48                                                           ` Jiri Pirko
2011-06-03  3:34                                                       ` padmanabh ratnakar
2011-06-03  3:59                                                         ` Changli Gao
2011-06-05 21:14                                                           ` David Miller
2011-06-10  8:35                                                             ` [PATCH v3] vlan: Fix the ingress VLAN_FLAG_REORDER_HDR check Jiri Pirko
2011-06-10  9:26                                                               ` Changli Gao
2011-06-10  9:34                                                                 ` Jiri Pirko
2011-06-10  9:49                                                                   ` Changli Gao
2011-06-10 10:35                                                                     ` Jiri Pirko
2011-06-10 11:20                                                                       ` Changli Gao
2011-06-10 12:12                                                                         ` Jiri Pirko
2011-06-10 16:56                                                                         ` Jiri Pirko
2011-06-11  0:05                                                                           ` Changli Gao
2011-06-11 23:16                                                                             ` David Miller
2011-06-08 16:28                                                       ` [PATCH] vlan: Fix the ingress VLAN_FLAG_REORDER_HDR check v2 Jiri Pirko
2011-06-08 23:08                                                         ` Changli Gao
2011-06-09  6:01                                                           ` Jiri Pirko
2011-06-09 11:00                       ` [PATCH 1/3] vlan: Do not support clearing VLAN_FLAG_REORDER_HDR Jiri Pirko
2011-05-22  8:38                 ` [patch net-next-2.6 v2] net: vlan: make non-hw-accel rx path similar to hw-accel Changli Gao
2011-05-22  9:37                   ` Jiri Pirko
2011-05-22 10:17                     ` Changli Gao
2011-05-22 10:26                       ` Eric W. Biederman
2011-05-22 10:40                         ` Changli Gao
2011-05-22 13:16                       ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1y61yiktf.fsf_-_@fess.ebiederm.org \
    --to=ebiederm@xmission$(echo .)com \
    --cc=andy@greyhouse$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=eric.dumazet@gmail$(echo .)com \
    --cc=fubar@us$(echo .)ibm.com \
    --cc=jesse@nicira$(echo .)com \
    --cc=jpirko@redhat$(echo .)com \
    --cc=kaber@trash$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nicolas.2p.debian@gmail$(echo .)com \
    --cc=shemminger@linux-foundation$(echo .)org \
    --cc=xiaosuo@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox