]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Phonet: zero-copy aligned GPRS RX
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Mon, 4 Jan 2010 02:02:47 +0000 (02:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Jan 2010 08:24:54 +0000 (00:24 -0800)
Newer Nokia cellular modems can use aligned payload for their GPRS pipe.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/phonet/pep.h
net/phonet/pep-gprs.c
net/phonet/pep.c

index 4c61cdce4e5fc3827af2d0d3064bf1bfd55718f6..c37162547a939ec0af49546e34bf9a261ac21880 100644 (file)
@@ -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,
index d183509d3fa65f6de5035af387319ac1575f3240..d01208968c830c5fa7a7484ea15ae059fc7015d6 100644 (file)
@@ -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. */
index b6356f3832f6e69cdc3fc7c2a076fab9f22efcd1..e23e30907d346fb084bc8890cbf5f8dee55ca2d7 100644 (file)
@@ -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)) {