From e1a5964f0c32a75b17360cfc565d25aaedbff747 Mon Sep 17 00:00:00 2001 From: Rémi Denis-Courmont Date: Wed, 29 Sep 2010 22:33:50 +0000 Subject: Phonet: restore flow control credits when sending fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch restores the below flow control patch submitted by Rémi Denis-Courmont, which accidentaly got lost due to Pipe controller patch on Phonet. commit 1a98214feef2221cd7c24b17cd688a5a9d85b2ea Author: Rémi Denis-Courmont Date: Mon Aug 30 12:57:03 2010 +0000 Phonet: restore flow control credits when sending fails Signed-off-by: Rémi Denis-Courmont Signed-off-by: David S. Miller Signed-off-by: Kumar Sanghvi Acked-by: Linus Walleij Signed-off-by: David S. Miller --- net/phonet/pep.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'net/phonet') diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 7bf23cf36b02..552fb665645f 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -1288,6 +1288,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) { struct pep_sock *pn = pep_sk(sk); struct pnpipehdr *ph; + int err; #ifdef CONFIG_PHONET_PIPECTRLR struct sockaddr_pn spn = { .spn_family = AF_PHONET, @@ -1314,10 +1315,15 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) ph->message_id = PNS_PIPE_DATA; ph->pipe_handle = pn->pipe_handle; #ifdef CONFIG_PHONET_PIPECTRLR - return pn_skb_send(sk, skb, &spn); + err = pn_skb_send(sk, skb, &spn); #else - return pn_skb_send(sk, skb, &pipe_srv); + err = pn_skb_send(sk, skb, &pipe_srv); #endif + + if (err && pn_flow_safe(pn->tx_fc)) + atomic_inc(&pn->tx_credits); + return err; + } static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, -- cgit v1.2.3-70-g09d2