All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, Ron Rindjunsky <ron.rindjunsky@intel.com>,
	Tomas Winkler <tomasw@gmail.com>,
	Ivo van Doorn <ivdoorn@gmail.com>,
	Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [RFC/RFT 2/4] GSO: generalize for mac80211
Date: Wed, 30 Apr 2008 14:40:57 +0200	[thread overview]
Message-ID: <20080430130049.359549000@sipsolutions.net> (raw)
In-Reply-To: 20080430124055.091382000@sipsolutions.net

This patch adds a new function dev_skb_segment() that generalises
the existing dev_gso_segment() by allowing to give a segmentation
function. mac80211 will use that function using the segmentation
function skb_segment().

This patch also changes dev_gso_skb_destructor() to be safe when
the skb no longer has any segments, this will happen when mac80211
has internally passed off all the fragments to the driver instead
of asking dev_hard_start_xmit() to do it (which protects against
this by resetting the destructor if it has sent all fragments.)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 include/linux/netdevice.h |    1 +
 net/core/dev.c            |   38 ++++++++++++++++++++++++++++++--------
 2 files changed, 31 insertions(+), 8 deletions(-)

--- everything.orig/net/core/dev.c	2008-04-30 01:52:23.000000000 +0200
+++ everything/net/core/dev.c	2008-04-30 03:46:33.000000000 +0200
@@ -1491,13 +1491,13 @@ static void dev_gso_skb_destructor(struc
 {
 	struct dev_gso_cb *cb;
 
-	do {
+	while (skb->next) {
 		struct sk_buff *nskb = skb->next;
 
 		skb->next = nskb->next;
 		nskb->next = NULL;
 		kfree_skb(nskb);
-	} while (skb->next);
+	}
 
 	cb = DEV_GSO_CB(skb);
 	if (cb->destructor)
@@ -1505,22 +1505,31 @@ static void dev_gso_skb_destructor(struc
 }
 
 /**
- *	dev_gso_segment - Perform emulated hardware segmentation on skb.
+ *	dev_skb_segment - Perform segmentation on skb.
  *	@skb: buffer to segment
+ *	@segmfn: function that does the actual segmentation
  *
- *	This function segments the given skb and stores the list of segments
- *	in skb->next.
+ *	This function segments the given skb and stores the list
+ *	of segments in skb->next. The segmentation function is
+ *	used to do the actual segmentation, it must return the
+ *	list of segments as chained via the returned skb's @next
+ *	pointer. The segmentation function is given the skb to
+ *	segment and the features of the device the skb is going
+ *	to. The segmentation function needs to return an ERR_PTR
+ *	or a valid sk_buff pointer (or NULL for no segments.)
+ *
+ *	Note that segmentation needs the skbs @cb data.
  */
-static int dev_gso_segment(struct sk_buff *skb)
+int dev_skb_segment(struct sk_buff *skb, struct sk_buff *(segmfn)(struct sk_buff *skb, int feat))
 {
 	struct net_device *dev = skb->dev;
 	struct sk_buff *segs;
 	int features = dev->features & ~(illegal_highdma(dev, skb) ?
 					 NETIF_F_SG : 0);
 
-	segs = skb_gso_segment(skb, features);
+	segs = segmfn(skb, features);
 
-	/* Verifying header integrity only. */
+	/* Verifying header integrity only/no segments required. */
 	if (!segs)
 		return 0;
 
@@ -1533,6 +1542,19 @@ static int dev_gso_segment(struct sk_buf
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(dev_skb_segment);
+
+/**
+ *	dev_gso_segment - Perform emulated hardware segmentation on skb.
+ *	@skb: buffer to segment
+ *
+ *	This function segments the given skb and stores the list of segments
+ *	in skb->next.
+ */
+static int dev_gso_segment(struct sk_buff *skb)
+{
+	return dev_skb_segment(skb, skb_gso_segment);
+}
 
 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
--- everything.orig/include/linux/netdevice.h	2008-04-30 01:52:23.000000000 +0200
+++ everything/include/linux/netdevice.h	2008-04-30 01:52:26.000000000 +0200
@@ -1454,6 +1454,7 @@ extern int		weight_p;
 extern int		netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb);
 extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
+extern int dev_skb_segment(struct sk_buff *skb, struct sk_buff *(segmfn)(struct sk_buff *skb, int feat));
 #ifdef CONFIG_BUG
 extern void netdev_rx_csum_fault(struct net_device *dev);
 #else

-- 


WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, Ron Rindjunsky <ron.rindjunsky@intel.com>,
	Tomas Winkler <tomasw@gmail.com>,
	Ivo van Doorn <ivdoorn@gmail.com>,
	Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [RFC/RFT 2/4] GSO: generalize for mac80211
Date: Wed, 30 Apr 2008 14:40:57 +0200	[thread overview]
Message-ID: <20080430130049.359549000@sipsolutions.net> (raw)
In-Reply-To: 20080430124055.091382000@sipsolutions.net

[-- Attachment #1: 037-generalize-gso-functions.patch --]
[-- Type: text/plain, Size: 3793 bytes --]

This patch adds a new function dev_skb_segment() that generalises
the existing dev_gso_segment() by allowing to give a segmentation
function. mac80211 will use that function using the segmentation
function skb_segment().

This patch also changes dev_gso_skb_destructor() to be safe when
the skb no longer has any segments, this will happen when mac80211
has internally passed off all the fragments to the driver instead
of asking dev_hard_start_xmit() to do it (which protects against
this by resetting the destructor if it has sent all fragments.)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 include/linux/netdevice.h |    1 +
 net/core/dev.c            |   38 ++++++++++++++++++++++++++++++--------
 2 files changed, 31 insertions(+), 8 deletions(-)

--- everything.orig/net/core/dev.c	2008-04-30 01:52:23.000000000 +0200
+++ everything/net/core/dev.c	2008-04-30 03:46:33.000000000 +0200
@@ -1491,13 +1491,13 @@ static void dev_gso_skb_destructor(struc
 {
 	struct dev_gso_cb *cb;
 
-	do {
+	while (skb->next) {
 		struct sk_buff *nskb = skb->next;
 
 		skb->next = nskb->next;
 		nskb->next = NULL;
 		kfree_skb(nskb);
-	} while (skb->next);
+	}
 
 	cb = DEV_GSO_CB(skb);
 	if (cb->destructor)
@@ -1505,22 +1505,31 @@ static void dev_gso_skb_destructor(struc
 }
 
 /**
- *	dev_gso_segment - Perform emulated hardware segmentation on skb.
+ *	dev_skb_segment - Perform segmentation on skb.
  *	@skb: buffer to segment
+ *	@segmfn: function that does the actual segmentation
  *
- *	This function segments the given skb and stores the list of segments
- *	in skb->next.
+ *	This function segments the given skb and stores the list
+ *	of segments in skb->next. The segmentation function is
+ *	used to do the actual segmentation, it must return the
+ *	list of segments as chained via the returned skb's @next
+ *	pointer. The segmentation function is given the skb to
+ *	segment and the features of the device the skb is going
+ *	to. The segmentation function needs to return an ERR_PTR
+ *	or a valid sk_buff pointer (or NULL for no segments.)
+ *
+ *	Note that segmentation needs the skbs @cb data.
  */
-static int dev_gso_segment(struct sk_buff *skb)
+int dev_skb_segment(struct sk_buff *skb, struct sk_buff *(segmfn)(struct sk_buff *skb, int feat))
 {
 	struct net_device *dev = skb->dev;
 	struct sk_buff *segs;
 	int features = dev->features & ~(illegal_highdma(dev, skb) ?
 					 NETIF_F_SG : 0);
 
-	segs = skb_gso_segment(skb, features);
+	segs = segmfn(skb, features);
 
-	/* Verifying header integrity only. */
+	/* Verifying header integrity only/no segments required. */
 	if (!segs)
 		return 0;
 
@@ -1533,6 +1542,19 @@ static int dev_gso_segment(struct sk_buf
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(dev_skb_segment);
+
+/**
+ *	dev_gso_segment - Perform emulated hardware segmentation on skb.
+ *	@skb: buffer to segment
+ *
+ *	This function segments the given skb and stores the list of segments
+ *	in skb->next.
+ */
+static int dev_gso_segment(struct sk_buff *skb)
+{
+	return dev_skb_segment(skb, skb_gso_segment);
+}
 
 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
--- everything.orig/include/linux/netdevice.h	2008-04-30 01:52:23.000000000 +0200
+++ everything/include/linux/netdevice.h	2008-04-30 01:52:26.000000000 +0200
@@ -1454,6 +1454,7 @@ extern int		weight_p;
 extern int		netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb);
 extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
+extern int dev_skb_segment(struct sk_buff *skb, struct sk_buff *(segmfn)(struct sk_buff *skb, int feat));
 #ifdef CONFIG_BUG
 extern void netdev_rx_csum_fault(struct net_device *dev);
 #else

-- 


  parent reply	other threads:[~2008-04-30 14:07 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 12:40 [RFC/RFT 0/4] mac80211 QoS-related enhancements Johannes Berg
2008-04-30 12:40 ` [RFC/RFT 1/4] mac80211: use rate index in TX control Johannes Berg
2008-04-30 12:40   ` Johannes Berg
2008-04-30 12:40 ` Johannes Berg [this message]
2008-04-30 12:40   ` [RFC/RFT 2/4] GSO: generalize for mac80211 Johannes Berg
2008-05-06 16:12   ` Johannes Berg
2008-05-06 16:12     ` Johannes Berg
2008-04-30 12:40 ` [RFC/RFT 3/4] mac80211: use GSO for fragmentation Johannes Berg
2008-04-30 12:40   ` Johannes Berg
2008-05-07  7:10   ` Herbert Xu
2008-05-07  8:50     ` Johannes Berg
2008-05-07  9:00       ` Herbert Xu
2008-05-07 11:22         ` [PATCH] mac80211: rewrite fragmentation code Johannes Berg
2008-05-07 11:22           ` Johannes Berg
2008-05-07 11:41           ` Herbert Xu
2008-05-07 11:41             ` Herbert Xu
2008-05-07 11:52             ` Johannes Berg
2008-05-07 13:05               ` Herbert Xu
2008-05-07 13:05                 ` Herbert Xu
2008-05-07 13:48                 ` Michael Buesch
2008-05-07 13:48                   ` Michael Buesch
2008-05-08  3:22                   ` Herbert Xu
2008-05-08  3:26                     ` David Miller
2008-05-08  3:26                       ` David Miller
2008-05-08  9:00                       ` Johannes Berg
2008-05-08  9:00                         ` Johannes Berg
2008-05-16  2:01                       ` Rusty Russell
2008-05-16  2:01                         ` Rusty Russell
2008-05-16  3:28                         ` Herbert Xu
2008-05-16  4:58                         ` David Miller
2008-05-16 10:32                           ` Rusty Russell
2008-05-16 10:32                             ` Rusty Russell
2008-05-16 10:38                             ` Johannes Berg
2008-05-16 10:38                               ` Johannes Berg
2008-05-16 12:15                             ` Herbert Xu
2008-05-16 19:40                             ` David Miller
2008-05-19  3:08                               ` Rusty Russell
2008-05-19  3:08                                 ` Rusty Russell
2008-05-19  7:03                                 ` David Miller
2008-05-08 13:00                     ` Michael Buesch
2008-05-08 13:08                       ` Herbert Xu
2008-05-08 13:08                         ` Herbert Xu
2008-05-08 13:13                         ` Michael Buesch
2008-05-08 13:15                           ` Michael Buesch
2008-05-08 13:32                           ` Herbert Xu
2008-05-08 13:32                             ` Herbert Xu
2008-05-07 19:19                 ` Johannes Berg
2008-05-07 19:19                   ` Johannes Berg
2008-04-30 12:40 ` [RFC/RFT 4/4] mac80211: use multi-queue master netdevice Johannes Berg
2008-04-30 12:40   ` Johannes Berg
2008-04-30 14:37   ` Ivo van Doorn
2008-04-30 14:37     ` Ivo van Doorn
2008-04-30 14:45     ` Johannes Berg
2008-04-30 14:45       ` Johannes Berg
2008-04-30 15:00       ` Johannes Berg
2008-04-30 15:00         ` Johannes Berg
2008-04-30 15:34         ` Ivo van Doorn
2008-04-30 15:34           ` Ivo van Doorn
2008-04-30 15:38           ` Johannes Berg
2008-05-01  8:21         ` Ivo van Doorn
2008-05-01  8:21           ` Ivo van Doorn
2008-05-01  8:54           ` Johannes Berg
2008-05-01  8:54             ` Johannes Berg
2008-04-30 19:39   ` Waskiewicz Jr, Peter P
2008-04-30 19:39     ` Waskiewicz Jr, Peter P
2008-04-30 20:07     ` Johannes Berg
2008-04-30 20:07       ` Johannes Berg
2008-04-30 13:07 ` [RFC/RFT 0/4] mac80211 QoS-related enhancements Johannes Berg
2008-04-30 20:59   ` Michael Buesch

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=20080430130049.359549000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    --cc=ron.rindjunsky@intel.com \
    --cc=tomasw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.