netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: netdev@vger.kernel.org
Cc: "Rémi Denis-Courmont" <remi.denis-courmont@nokia.com>
Subject: [PATCH 1/3] Phonet: zero-copy aligned GPRS RX
Date: Mon,  4 Jan 2010 14:02:47 +0200	[thread overview]
Message-ID: <1262606569-3021-1-git-send-email-remi@remlab.net> (raw)

From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Newer Nokia cellular modems can use aligned payload for their GPRS pipe.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
 include/net/phonet/pep.h |    1 +
 net/phonet/pep-gprs.c    |    4 ++--
 net/phonet/pep.c         |    3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index 4c61cdc..c371625 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -77,6 +77,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
 
 enum {
 	PNS_PIPE_DATA = 0x20,
+	PNS_PIPE_ALIGNED_DATA,
 
 	PNS_PEP_CONNECT_REQ = 0x40,
 	PNS_PEP_CONNECT_RESP,
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index d183509..d012089 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -96,11 +96,11 @@ static int gprs_recv(struct gprs_dev *gp, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (likely(skb_headroom(skb) & 3)) {
+	if (skb_headroom(skb) & 3) {
 		struct sk_buff *rskb, *fs;
 		int flen = 0;
 
-		/* Phonet Pipe data header is misaligned (3 bytes),
+		/* Phonet Pipe data header may be misaligned (3 bytes),
 		 * so wrap the IP packet as a single fragment of an head-less
 		 * socket buffer. The network stack will pull what it needs,
 		 * but at least, the whole IP payload is not memcpy'd. */
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index b6356f3..e23e309 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -354,6 +354,9 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
 		queue = &pn->ctrlreq_queue;
 		goto queue;
 
+	case PNS_PIPE_ALIGNED_DATA:
+		__skb_pull(skb, 1);
+		/* fall through */
 	case PNS_PIPE_DATA:
 		__skb_pull(skb, 3); /* Pipe data header */
 		if (!pn_flow_safe(pn->rx_fc)) {
-- 
1.6.3.3


             reply	other threads:[~2010-01-04 12:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 12:02 Rémi Denis-Courmont [this message]
2010-01-04 12:02 ` [PATCH 2/3] Phonet: zero-copy GPRS TX Rémi Denis-Courmont
2010-01-04 12:02   ` [PATCH 3/3] Phonet: reject unsupported sendmsg/recvmsg flags Rémi Denis-Courmont
2010-01-07  8:25     ` David Miller
2010-01-07  8:25   ` [PATCH 2/3] Phonet: zero-copy GPRS TX David Miller
2010-01-07  8:25 ` [PATCH 1/3] Phonet: zero-copy aligned GPRS RX David Miller

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=1262606569-3021-1-git-send-email-remi@remlab.net \
    --to=remi@remlab.net \
    --cc=netdev@vger.kernel.org \
    --cc=remi.denis-courmont@nokia.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 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).