* [PATCH 1/3] Phonet: zero-copy aligned GPRS RX @ 2010-01-04 12:02 Rémi Denis-Courmont 2010-01-04 12:02 ` [PATCH 2/3] Phonet: zero-copy GPRS TX Rémi Denis-Courmont 2010-01-07 8:25 ` [PATCH 1/3] Phonet: zero-copy aligned GPRS RX David Miller 0 siblings, 2 replies; 6+ messages in thread From: Rémi Denis-Courmont @ 2010-01-04 12:02 UTC (permalink / raw) To: netdev; +Cc: Rémi Denis-Courmont 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] Phonet: zero-copy GPRS TX 2010-01-04 12:02 [PATCH 1/3] Phonet: zero-copy aligned GPRS RX Rémi Denis-Courmont @ 2010-01-04 12:02 ` 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 ` [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 1 sibling, 2 replies; 6+ messages in thread From: Rémi Denis-Courmont @ 2010-01-04 12:02 UTC (permalink / raw) To: netdev; +Cc: Rémi Denis-Courmont From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Send aligned pipe payload if requested to do so. Then, the socket buffer needs not be fragmented anymore. Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> --- include/net/phonet/pep.h | 2 ++ net/phonet/pep.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h index c371625..35672b1 100644 --- a/include/net/phonet/pep.h +++ b/include/net/phonet/pep.h @@ -44,6 +44,7 @@ struct pep_sock { u8 rx_fc; /* RX flow control */ u8 tx_fc; /* TX flow control */ u8 init_enable; /* auto-enable at creation */ + u8 aligned; }; static inline struct pep_sock *pep_sk(struct sock *sk) @@ -139,6 +140,7 @@ enum { PN_PIPE_SB_NEGOTIATED_FC, PN_PIPE_SB_REQUIRED_FC_TX, PN_PIPE_SB_PREFERRED_FC_RX, + PN_PIPE_SB_ALIGNED_DATA, }; /* Phonet pipe flow control models */ diff --git a/net/phonet/pep.c b/net/phonet/pep.c index e23e309..72db27e 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -444,6 +444,7 @@ static int pep_connreq_rcv(struct sock *sk, struct sk_buff *skb) struct sockaddr_pn dst; u16 peer_type; u8 pipe_handle, enabled, n_sb; + u8 aligned = 0; if (!pskb_pull(skb, sizeof(*hdr) + 4)) return -EINVAL; @@ -482,6 +483,9 @@ static int pep_connreq_rcv(struct sock *sk, struct sk_buff *skb) return -EINVAL; peer_type = (peer_type & 0xff00) | data[0]; break; + case PN_PIPE_SB_ALIGNED_DATA: + aligned = data[0] != 0; + break; } n_sb--; } @@ -513,6 +517,7 @@ static int pep_connreq_rcv(struct sock *sk, struct sk_buff *skb) newpn->rx_credits = 0; newpn->rx_fc = newpn->tx_fc = PN_LEGACY_FLOW_CONTROL; newpn->init_enable = enabled; + newpn->aligned = aligned; BUG_ON(!skb_queue_empty(&newsk->sk_receive_queue)); skb_queue_head(&newsk->sk_receive_queue, skb); @@ -832,11 +837,15 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) return -ENOBUFS; } - skb_push(skb, 3); + skb_push(skb, 3 + pn->aligned); skb_reset_transport_header(skb); ph = pnp_hdr(skb); ph->utid = 0; - ph->message_id = PNS_PIPE_DATA; + if (pn->aligned) { + ph->message_id = PNS_PIPE_ALIGNED_DATA; + ph->data[0] = 0; /* padding */ + } else + ph->message_id = PNS_PIPE_DATA; ph->pipe_handle = pn->pipe_handle; return pn_skb_send(sk, skb, &pipe_srv); @@ -930,6 +939,9 @@ int pep_write(struct sock *sk, struct sk_buff *skb) struct sk_buff *rskb, *fs; int flen = 0; + if (pep_sk(sk)->aligned) + return pipe_skb_send(sk, skb); + rskb = alloc_skb(MAX_PNPIPE_HEADER, GFP_ATOMIC); if (!rskb) { kfree_skb(skb); -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] Phonet: reject unsupported sendmsg/recvmsg flags 2010-01-04 12:02 ` [PATCH 2/3] Phonet: zero-copy GPRS TX Rémi Denis-Courmont @ 2010-01-04 12:02 ` 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 1 sibling, 1 reply; 6+ messages in thread From: Rémi Denis-Courmont @ 2010-01-04 12:02 UTC (permalink / raw) To: netdev; +Cc: Rémi Denis-Courmont From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> --- net/phonet/datagram.c | 6 ++++-- net/phonet/pep.c | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 67f072e..387197b 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c @@ -75,7 +75,8 @@ static int pn_sendmsg(struct kiocb *iocb, struct sock *sk, struct sk_buff *skb; int err; - if (msg->msg_flags & MSG_OOB) + if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| + MSG_CMSG_COMPAT)) return -EOPNOTSUPP; if (msg->msg_name == NULL) @@ -119,7 +120,8 @@ static int pn_recvmsg(struct kiocb *iocb, struct sock *sk, int rval = -EOPNOTSUPP; int copylen; - if (flags & MSG_OOB) + if (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL| + MSG_CMSG_COMPAT)) goto out_nofree; if (addr_len) diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 72db27e..360cf37 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -860,7 +860,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, int flags = msg->msg_flags; int err, done; - if (msg->msg_flags & MSG_OOB || !(msg->msg_flags & MSG_EOR)) + if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| + MSG_CMSG_COMPAT)) || + !(msg->msg_flags & MSG_EOR)) return -EOPNOTSUPP; skb = sock_alloc_send_skb(sk, MAX_PNPIPE_HEADER + len, @@ -981,6 +983,10 @@ static int pep_recvmsg(struct kiocb *iocb, struct sock *sk, struct sk_buff *skb; int err; + if (flags & ~(MSG_OOB|MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_WAITALL| + MSG_NOSIGNAL|MSG_CMSG_COMPAT)) + return -EOPNOTSUPP; + if (unlikely(1 << sk->sk_state & (TCPF_LISTEN | TCPF_CLOSE))) return -ENOTCONN; @@ -988,6 +994,8 @@ static int pep_recvmsg(struct kiocb *iocb, struct sock *sk, /* Dequeue and acknowledge control request */ struct pep_sock *pn = pep_sk(sk); + if (flags & MSG_PEEK) + return -EOPNOTSUPP; skb = skb_dequeue(&pn->ctrlreq_queue); if (skb) { pep_ctrlreq_error(sk, skb, PN_PIPE_NO_ERROR, -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] Phonet: reject unsupported sendmsg/recvmsg flags 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 0 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2010-01-07 8:25 UTC (permalink / raw) To: remi; +Cc: netdev, remi.denis-courmont From: Rémi Denis-Courmont <remi@remlab.net> Date: Mon, 4 Jan 2010 14:02:49 +0200 > From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> > > Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Applied to net-next-2.6 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] Phonet: zero-copy GPRS TX 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 1 sibling, 0 replies; 6+ messages in thread From: David Miller @ 2010-01-07 8:25 UTC (permalink / raw) To: remi; +Cc: netdev, remi.denis-courmont From: Rémi Denis-Courmont <remi@remlab.net> Date: Mon, 4 Jan 2010 14:02:48 +0200 > From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> > > Send aligned pipe payload if requested to do so. Then, the socket buffer > needs not be fragmented anymore. > > Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Applied to net-next-2.6 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] Phonet: zero-copy aligned GPRS RX 2010-01-04 12:02 [PATCH 1/3] Phonet: zero-copy aligned GPRS RX Rémi Denis-Courmont 2010-01-04 12:02 ` [PATCH 2/3] Phonet: zero-copy GPRS TX Rémi Denis-Courmont @ 2010-01-07 8:25 ` David Miller 1 sibling, 0 replies; 6+ messages in thread From: David Miller @ 2010-01-07 8:25 UTC (permalink / raw) To: remi; +Cc: netdev, remi.denis-courmont From: Rémi Denis-Courmont <remi@remlab.net> Date: Mon, 4 Jan 2010 14:02:47 +0200 > 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> Applied to net-next-2.6 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-07 8:25 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-01-04 12:02 [PATCH 1/3] Phonet: zero-copy aligned GPRS RX Rémi Denis-Courmont 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
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).