diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2010-08-30 08:57:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-31 16:04:32 -0400 |
commit | 1a98214feef2221cd7c24b17cd688a5a9d85b2ea (patch) | |
tree | c642a58c833554d57f4f38ae0d346ddb5c2f051d /net/phonet | |
parent | 1f0f63885658889b3bcb8a08fbcb9532f8e536c9 (diff) |
Phonet: restore flow control credits when sending fails
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet')
-rw-r--r-- | net/phonet/pep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index b2a3ae6cad78..5034f0f62bdb 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -834,6 +834,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) | |||
834 | { | 834 | { |
835 | struct pep_sock *pn = pep_sk(sk); | 835 | struct pep_sock *pn = pep_sk(sk); |
836 | struct pnpipehdr *ph; | 836 | struct pnpipehdr *ph; |
837 | int err; | ||
837 | 838 | ||
838 | if (pn_flow_safe(pn->tx_fc) && | 839 | if (pn_flow_safe(pn->tx_fc) && |
839 | !atomic_add_unless(&pn->tx_credits, -1, 0)) { | 840 | !atomic_add_unless(&pn->tx_credits, -1, 0)) { |
@@ -852,7 +853,10 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) | |||
852 | ph->message_id = PNS_PIPE_DATA; | 853 | ph->message_id = PNS_PIPE_DATA; |
853 | ph->pipe_handle = pn->pipe_handle; | 854 | ph->pipe_handle = pn->pipe_handle; |
854 | 855 | ||
855 | return pn_skb_send(sk, skb, &pipe_srv); | 856 | err = pn_skb_send(sk, skb, &pipe_srv); |
857 | if (err && pn_flow_safe(pn->tx_fc)) | ||
858 | atomic_inc(&pn->tx_credits); | ||
859 | return err; | ||
856 | } | 860 | } |
857 | 861 | ||
858 | static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | 862 | static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, |