public inbox for netdev@vger.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

[-- 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: 41+ 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 [this message]
     [not found]   ` <20080430130049.359549000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-05-06 16:12     ` [RFC/RFT 2/4] GSO: generalize for mac80211 Johannes Berg
2008-04-30 12:40 ` [RFC/RFT 3/4] mac80211: use GSO for fragmentation Johannes Berg
2008-05-07  7:10   ` Herbert Xu
2008-05-07  8:50     ` Johannes Berg
2008-05-07  9:00       ` Herbert Xu
     [not found]         ` <20080507090040.GA25186-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2008-05-07 11:22           ` [PATCH] mac80211: rewrite fragmentation code Johannes Berg
     [not found]             ` <1210159339.5642.13.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-07 11:41               ` Herbert Xu
2008-05-07 11:52                 ` Johannes Berg
     [not found]                   ` <1210161133.5642.19.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-05-07 13:05                     ` Herbert Xu
     [not found]                       ` <20080507130548.GA26977-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2008-05-07 13:48                         ` Michael Buesch
2008-05-08  3:22                           ` Herbert Xu
     [not found]                             ` <20080508032208.GA401-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2008-05-08  3:26                               ` David Miller
     [not found]                                 ` <20080507.202606.242037993.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-08  9:00                                   ` Johannes Berg
2008-05-16  2:01                                   ` Rusty Russell
2008-05-16  3:28                                     ` Herbert Xu
2008-05-16  4:58                                     ` David Miller
     [not found]                                       ` <20080515.215823.28841530.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-16 10:32                                         ` Rusty Russell
     [not found]                                           ` <200805162032.48469.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-05-16 10:38                                             ` Johannes Berg
2008-05-16 12:15                                           ` Herbert Xu
2008-05-16 19:40                                           ` David Miller
     [not found]                                             ` <20080516.124039.253626477.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-05-19  3:08                                               ` Rusty Russell
2008-05-19  7:03                                                 ` David Miller
2008-05-08 13:00                             ` Michael Buesch
     [not found]                               ` <200805081500.00682.mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
2008-05-08 13:08                                 ` Herbert Xu
2008-05-08 13:13                                   ` Michael Buesch
2008-05-08 13:15                                     ` Michael Buesch
     [not found]                                     ` <200805081513.56521.mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
2008-05-08 13:32                                       ` Herbert Xu
2008-05-07 19:19                         ` Johannes Berg
2008-04-30 12:40 ` [RFC/RFT 4/4] mac80211: use multi-queue master netdevice Johannes Berg
     [not found]   ` <20080430130051.397094000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-04-30 14:37     ` Ivo van Doorn
     [not found]       ` <200804301637.35170.IvDoorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-04-30 14:45         ` Johannes Berg
     [not found]           ` <1209566743.18659.30.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-04-30 15:00             ` Johannes Berg
     [not found]               ` <1209567609.18659.33.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-04-30 15:34                 ` Ivo van Doorn
2008-04-30 15:38                   ` Johannes Berg
2008-05-01  8:21                 ` Ivo van Doorn
     [not found]                   ` <200805011021.04435.IvDoorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-05-01  8:54                     ` Johannes Berg
2008-04-30 19:39     ` Waskiewicz Jr, Peter P
     [not found]       ` <D5C1322C3E673F459512FB59E0DDC32904FE144F-O6kdQIuPh0Q64kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2008-04-30 20:07         ` Johannes Berg

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$(echo .)net \
    --cc=herbert@gondor$(echo .)apana.org.au \
    --cc=ivdoorn@gmail$(echo .)com \
    --cc=linux-wireless@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peter.p.waskiewicz.jr@intel$(echo .)com \
    --cc=ron.rindjunsky@intel$(echo .)com \
    --cc=tomasw@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