netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
@ 2004-01-22 15:57 Shmuel Hen
  2004-01-22 18:06 ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Shmuel Hen @ 2004-01-22 15:57 UTC (permalink / raw)
  To: netdev, bonding-devel

Make the regular/HW accelerated xmit functions in the 8021q module
use the new set VLAN tag functionality to reduce code duplication.


diff -Nuarp a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
--- a/net/8021q/vlan_dev.c	Wed Jan 21 16:55:02 2004
+++ b/net/8021q/vlan_dev.c	Wed Jan 21 16:55:04 2004
@@ -446,6 +446,7 @@ int vlan_dev_hard_start_xmit(struct sk_b
 	 */
 
 	if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) {
+		int orig_headroom = skb_headroom(skb);
 		unsigned short veth_TCI;
 
 		/* This is not a VLAN frame...but we can fix that! */
@@ -455,33 +456,7 @@ int vlan_dev_hard_start_xmit(struct sk_b
 		printk(VLAN_DBG "%s: proto to encap: 0x%hx (hbo)\n",
 			__FUNCTION__, htons(veth->h_vlan_proto));
 #endif
-
-		if (skb_headroom(skb) < VLAN_HLEN) {
-			struct sk_buff *sk_tmp = skb;
-			skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN);
-			kfree_skb(sk_tmp);
-			if (skb == NULL) {
-				stats->tx_dropped++;
-				return 0;
-			}
-			VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
-		} else {
-			if (!(skb = skb_unshare(skb, GFP_ATOMIC))) {
-				printk(KERN_ERR "vlan: failed to unshare skbuff\n");
-				stats->tx_dropped++;
-				return 0;
-			}
-		}
-		veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
-
-		/* Move the mac addresses to the beginning of the new header. */
-		memmove(skb->data, skb->data + VLAN_HLEN, 12);
-
-		/* first, the ethernet type */
-		/* put_unaligned(__constant_htons(ETH_P_8021Q), &veth->h_vlan_proto); */
-		veth->h_vlan_proto = __constant_htons(ETH_P_8021Q);
-
-		/* Now, construct the second two bytes. This field looks something
+		/* Construct the second two bytes. This field looks something
 		 * like:
 		 * usr_priority: 3 bits	 (high bits)
 		 * CFI		 1 bit
@@ -490,10 +465,16 @@ int vlan_dev_hard_start_xmit(struct sk_b
 		veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
 		veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
 
-		veth->h_vlan_TCI = htons(veth_TCI);
-	}
+		skb = __vlan_put_tag(skb, veth_TCI);
+		if (!skb) {
+			stats->tx_dropped++;
+			return 0;
+		}
 
-	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
+		if (orig_headroom < VLAN_HLEN) {
+			VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++;
+		}
+	}
 
 #ifdef VLAN_DEBUG
 	printk(VLAN_DBG "%s: about to send skb: %p to dev: %s\n",
@@ -507,6 +488,7 @@ int vlan_dev_hard_start_xmit(struct sk_b
 	stats->tx_packets++; /* for statics only */
 	stats->tx_bytes += skb->len;
 
+	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
 	dev_queue_xmit(skb);
 
 	return 0;
@@ -515,17 +497,22 @@ int vlan_dev_hard_start_xmit(struct sk_b
 int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct net_device_stats *stats = vlan_dev_get_stats(dev);
-	struct vlan_skb_tx_cookie *cookie;
+	unsigned short veth_TCI;
+
+	/* Construct the second two bytes. This field looks something
+	 * like:
+	 * usr_priority: 3 bits	 (high bits)
+	 * CFI		 1 bit
+	 * VLAN ID	 12 bits (low bits)
+	 */
+	veth_TCI = VLAN_DEV_INFO(dev)->vlan_id;
+	veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb);
+	skb = __vlan_hwaccel_put_tag(skb, veth_TCI);
 
 	stats->tx_packets++;
 	stats->tx_bytes += skb->len;
 
 	skb->dev = VLAN_DEV_INFO(dev)->real_dev;
-	cookie = VLAN_TX_SKB_CB(skb);
-	cookie->magic = VLAN_TX_COOKIE_MAGIC;
-	cookie->vlan_tag = (VLAN_DEV_INFO(dev)->vlan_id |
-			    vlan_dev_get_egress_qos_mask(dev, skb));
-
 	dev_queue_xmit(skb);
 
 	return 0;

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
  2004-01-22 15:57 Shmuel Hen
@ 2004-01-22 18:06 ` David S. Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David S. Miller @ 2004-01-22 18:06 UTC (permalink / raw)
  To: Shmuel Hen; +Cc: netdev, bonding-devel

On Thu, 22 Jan 2004 17:57:19 +0200
Shmuel Hen <shmulik.hen@intel.com> wrote:

> Make the regular/HW accelerated xmit functions in the 8021q module
> use the new set VLAN tag functionality to reduce code duplication.

I'm fine with this and the ARP change, I am pretty sure.

But we have way too much stuff pending for the next 2.6.x release,
so I'm going to defer adding these changes until Linus puts something
final out.

Please resend these two changes after he does a release.

Thanks.

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

* RE: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
@ 2004-01-25 12:28 Hen, Shmulik
  2004-01-26  5:34 ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Hen, Shmulik @ 2004-01-25 12:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, bonding-devel

-----Original Message-----
From: David S. Miller [mailto:davem@redhat.com]
Sent: Thursday, January 22, 2004 8:07 PM
To: Hen, Shmulik
Cc: netdev@oss.sgi.com; bonding-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module

> On Thu, 22 Jan 2004 17:57:19 +0200
> Shmuel Hen <shmulik.hen@intel.com> wrote:
> 
> > Make the regular/HW accelerated xmit functions in the 8021q module
> > use the new set VLAN tag functionality to reduce code duplication.
> 
> I'm fine with this and the ARP change, I am pretty sure.
> 
> But we have way too much stuff pending for the next 2.6.x release,
> so I'm going to defer adding these changes until Linus puts something
> final out.
> 
> Please resend these two changes after he does a release.

Fair enough. What about 2.4 ?

Thanks,
Shmulik.

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
  2004-01-25 12:28 Hen, Shmulik
@ 2004-01-26  5:34 ` David S. Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David S. Miller @ 2004-01-26  5:34 UTC (permalink / raw)
  To: shmulik.hen; +Cc: netdev, bonding-devel

   From: "Hen, Shmulik" <shmulik.hen@intel.com>
   Date: Sun, 25 Jan 2004 14:28:51 +0200

   > Please resend these two changes after he does a release.
   
   Fair enough. What about 2.4 ?

Sure, send it once 2.4.26-preX starts up.

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
       [not found] <E791C176A6139242A988ABA8B3D9B38A02A46612@hasmsx403.iil.intel.com>
@ 2004-01-26 13:22 ` Shmuel Hen
  2004-01-26 17:42   ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: Shmuel Hen @ 2004-01-26 13:22 UTC (permalink / raw)
  To: Jeff Garzik, David S. Miller; +Cc: netdev, bonding-devel

On Thursday 22 January 2004 20:06, David S. Miller wrote:
> > > On Thu, 22 Jan 2004 Shmuel Hen <shmulik.hen@intel.com> wrote:
> > > > Make the regular/HW accelerated xmit functions in the 8021q
> > > > module use the new set VLAN tag functionality to reduce code
> > > > duplication.
> > >
> > > I'm fine with this and the ARP change, I am pretty sure.
> > >
> > > But we have way too much stuff pending for the next 2.6.x release,
> > > so I'm going to defer adding these changes until Linus puts
> > > something final out.
> > >
> > > Please resend these two changes after he does a release.
> >
> > Fair enough. What about 2.4 ?
>
> Sure, send it once 2.4.26-preX starts up.

Jeff,

Since the last 3 patches from this set depend on the acceptance of
the first 3, and because they are also based on previous changes in
bonding that are queued in the netdev-2.4/2.6 BK trees, do you have
a problem accepting all 6 patches into the netdev trees?

Also, speaking of the bonding changes queued in netdev-2.4, some of
those have been queued there since 2.4.23 came out. Will those be
pushed to Marcelo during 2.4.25 or do you intend to hold them until
2.4.26-preX starts?

-- 
| Shmulik Hen   Advanced Network Services  |
| Israel Design Center, Jerusalem          |
| LAN Access Division, Platform Networking |
| Intel Communications Group, Intel corp.  |

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
  2004-01-26 13:22 ` Shmuel Hen
@ 2004-01-26 17:42   ` Jeff Garzik
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Garzik @ 2004-01-26 17:42 UTC (permalink / raw)
  To: Shmuel Hen; +Cc: David S. Miller, netdev, bonding-devel

Shmuel Hen wrote:
> Also, speaking of the bonding changes queued in netdev-2.4, some of
> those have been queued there since 2.4.23 came out. Will those be
> pushed to Marcelo during 2.4.25 or do you intend to hold them until
> 2.4.26-preX starts?


Sounds like DaveM and I will need to coordinate a bit, then.

Queued bonding stuff for 2.4:  Marcelo wanted to wait until 2.4.25 
release, so they will go to Marcelo for 2.4.26-pre1.

Queued bonding stuff for 2.6:  Similar picture.  Waiting for 2.6.2 
release, then it goes to Andrew/Linus.

Note that at some point, IMO you need to plan on 2.6-only development, 
since keeping bonding the same in 2.4 and 2.6 -through ABI changes- may 
not be feasible past the short term.  2.4 developmnent is intentionally 
slowing down on Marcelo's side, even though vendors are still shipping 
2.4.x stuff.

	Jeff

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
       [not found] <E791C176A6139242A988ABA8B3D9B38A03A9CCD5@hasmsx403.iil.intel.com>
@ 2004-01-28 16:57 ` Shmuel Hen
  2004-01-28 19:40   ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Shmuel Hen @ 2004-01-28 16:57 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, bonding-devel

On Monday 26 January 2004 19:42, Jeff Garzik wrote:
> Shmuel Hen wrote:
> > Also, speaking of the bonding changes queued in netdev-2.4, some
> > of those have been queued there since 2.4.23 came out. Will those
> > be pushed to Marcelo during 2.4.25 or do you intend to hold them
> > until 2.4.26-preX starts?
>
> Sounds like DaveM and I will need to coordinate a bit, then.

By coordinate, do you mean that you'll take in all of our patches and 
forward them to Dave at the appropriate time, or instead wait for 
Dave to take in the first half (which is not bonding specific) and 
only then take the last half ?

> Note that at some point, IMO you need to plan on 2.6-only
> development, since keeping bonding the same in 2.4 and 2.6 -through
> ABI changes- may not be feasible past the short term.  2.4
> developmnent is intentionally slowing down on Marcelo's side, even
> though vendors are still shipping 2.4.x stuff.

That is our intention. The VLAN enhancements and dynamic configuration 
are the last features we wanted to get into 2.4 before closing (maybe 
zero copy too, since it is trivial). The only thing we do intend to 
keep sending for both 2.4 and 2.6 are bug fixes.

-- 
| Shmulik Hen   Advanced Network Services  |
| Israel Design Center, Jerusalem          |
| LAN Access Division, Platform Networking |
| Intel Communications Group, Intel corp.  |

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

* Re: [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module
  2004-01-28 16:57 ` [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module Shmuel Hen
@ 2004-01-28 19:40   ` David S. Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David S. Miller @ 2004-01-28 19:40 UTC (permalink / raw)
  To: Shmuel Hen; +Cc: jgarzik, netdev, bonding-devel

On Wed, 28 Jan 2004 18:57:25 +0200
Shmuel Hen <shmulik.hen@intel.com> wrote:

> On Monday 26 January 2004 19:42, Jeff Garzik wrote:
> > Shmuel Hen wrote:
> > > Also, speaking of the bonding changes queued in netdev-2.4, some
> > > of those have been queued there since 2.4.23 came out. Will those
> > > be pushed to Marcelo during 2.4.25 or do you intend to hold them
> > > until 2.4.26-preX starts?
> >
> > Sounds like DaveM and I will need to coordinate a bit, then.
> 
> By coordinate, do you mean that you'll take in all of our patches and 
> forward them to Dave at the appropriate time, or instead wait for 
> Dave to take in the first half (which is not bonding specific) and 
> only then take the last half ?

I think the best is to have me push the infrastructure into 2.6.3-pre1
and then Jeff can add the bonding bits to his tree.

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

end of thread, other threads:[~2004-01-28 19:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E791C176A6139242A988ABA8B3D9B38A03A9CCD5@hasmsx403.iil.intel.com>
2004-01-28 16:57 ` [PATCH 3/6][8021q][2.4] Use VLAN tag set functionality in 8021q module Shmuel Hen
2004-01-28 19:40   ` David S. Miller
     [not found] <E791C176A6139242A988ABA8B3D9B38A02A46612@hasmsx403.iil.intel.com>
2004-01-26 13:22 ` Shmuel Hen
2004-01-26 17:42   ` Jeff Garzik
2004-01-25 12:28 Hen, Shmulik
2004-01-26  5:34 ` David S. Miller
  -- strict thread matches above, loose matches on Subject: below --
2004-01-22 15:57 Shmuel Hen
2004-01-22 18:06 ` David S. 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).