netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/1] af_iucv: don't use paged skbs for TX on HiperSockets
@ 2017-01-10 16:10 Ursula Braun
  2017-01-10 16:10 ` [PATCH net 1/1] net/af_iucv: " Ursula Braun
  0 siblings, 1 reply; 3+ messages in thread
From: Ursula Braun @ 2017-01-10 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, stable, ubraun

Dave,

here is an af_iucv patch built for the net-tree.

Thanks, Ursula

Julian Wiedmann (1):
  net/af_iucv: don't use paged skbs for TX on HiperSockets

 net/iucv/af_iucv.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

-- 
2.8.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net 1/1] net/af_iucv: don't use paged skbs for TX on HiperSockets
  2017-01-10 16:10 [PATCH net 0/1] af_iucv: don't use paged skbs for TX on HiperSockets Ursula Braun
@ 2017-01-10 16:10 ` Ursula Braun
  2017-01-11  2:07   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Ursula Braun @ 2017-01-10 16:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, stable, ubraun

From: Julian Wiedmann <jwi@linux.vnet.ibm.com>

With commit e53743994e21
("af_iucv: use paged SKBs for big outbound messages"),
we transmit paged skbs for both of AF_IUCV's transport modes
(IUCV or HiperSockets).
The qeth driver for Layer 3 HiperSockets currently doesn't
support NETIF_F_SG, so these skbs would just be linearized again
by the stack.
Avoid that overhead by using paged skbs only for IUCV transport.

cc stable, since this also circumvents a significant skb leak when
sending large messages (where the skb then needs to be linearized).

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org> # v4.8+
Fixes: e53743994e21 ("af_iucv: use paged SKBs for big outbound messages")
---
 net/iucv/af_iucv.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index cfb9e5f..13190b3 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1044,7 +1044,8 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 {
 	struct sock *sk = sock->sk;
 	struct iucv_sock *iucv = iucv_sk(sk);
-	size_t headroom, linear;
+	size_t headroom = 0;
+	size_t linear;
 	struct sk_buff *skb;
 	struct iucv_message txmsg = {0};
 	struct cmsghdr *cmsg;
@@ -1122,18 +1123,20 @@ static int iucv_sock_sendmsg(struct socket *sock, struct msghdr *msg,
 	 * this is fine for SOCK_SEQPACKET (unless we want to support
 	 * segmented records using the MSG_EOR flag), but
 	 * for SOCK_STREAM we might want to improve it in future */
-	headroom = (iucv->transport == AF_IUCV_TRANS_HIPER)
-		   ? sizeof(struct af_iucv_trans_hdr) + ETH_HLEN : 0;
-	if (headroom + len < PAGE_SIZE) {
+	if (iucv->transport == AF_IUCV_TRANS_HIPER) {
+		headroom = sizeof(struct af_iucv_trans_hdr) + ETH_HLEN;
 		linear = len;
 	} else {
-		/* In nonlinear "classic" iucv skb,
-		 * reserve space for iucv_array
-		 */
-		if (iucv->transport != AF_IUCV_TRANS_HIPER)
-			headroom += sizeof(struct iucv_array) *
-				    (MAX_SKB_FRAGS + 1);
-		linear = PAGE_SIZE - headroom;
+		if (len < PAGE_SIZE) {
+			linear = len;
+		} else {
+			/* In nonlinear "classic" iucv skb,
+			 * reserve space for iucv_array
+			 */
+			headroom = sizeof(struct iucv_array) *
+				   (MAX_SKB_FRAGS + 1);
+			linear = PAGE_SIZE - headroom;
+		}
 	}
 	skb = sock_alloc_send_pskb(sk, headroom + linear, len - linear,
 				   noblock, &err, 0);
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net 1/1] net/af_iucv: don't use paged skbs for TX on HiperSockets
  2017-01-10 16:10 ` [PATCH net 1/1] net/af_iucv: " Ursula Braun
@ 2017-01-11  2:07   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2017-01-11  2:07 UTC (permalink / raw)
  To: ubraun; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, stable

From: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date: Tue, 10 Jan 2017 17:10:34 +0100

> From: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> 
> With commit e53743994e21
> ("af_iucv: use paged SKBs for big outbound messages"),
> we transmit paged skbs for both of AF_IUCV's transport modes
> (IUCV or HiperSockets).
> The qeth driver for Layer 3 HiperSockets currently doesn't
> support NETIF_F_SG, so these skbs would just be linearized again
> by the stack.
> Avoid that overhead by using paged skbs only for IUCV transport.
> 
> cc stable, since this also circumvents a significant skb leak when
> sending large messages (where the skb then needs to be linearized).
> 
> Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Cc: <stable@vger.kernel.org> # v4.8+
> Fixes: e53743994e21 ("af_iucv: use paged SKBs for big outbound messages")

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-11  2:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-10 16:10 [PATCH net 0/1] af_iucv: don't use paged skbs for TX on HiperSockets Ursula Braun
2017-01-10 16:10 ` [PATCH net 1/1] net/af_iucv: " Ursula Braun
2017-01-11  2:07   ` 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).