Skip to content

Commit

Permalink
Phonet: restore flow control credits when sending fails
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Aug 31, 2010
1 parent 1f0f638 commit 1a98214
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/phonet/pep.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,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;

if (pn_flow_safe(pn->tx_fc) &&
!atomic_add_unless(&pn->tx_credits, -1, 0)) {
Expand All @@ -852,7 +853,10 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
ph->message_id = PNS_PIPE_DATA;
ph->pipe_handle = pn->pipe_handle;

return pn_skb_send(sk, skb, &pipe_srv);
err = pn_skb_send(sk, skb, &pipe_srv);
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,
Expand Down

0 comments on commit 1a98214

Please sign in to comment.