Skip to content

Commit

Permalink
net: wrap sk->sk_backlog_rcv()
Browse files Browse the repository at this point in the history
Wrap calling sk->sk_backlog_rcv() in a function. This will allow extending the
generic sk_backlog_rcv behaviour.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Peter Zijlstra authored and David S. Miller committed Oct 7, 2008
1 parent b339a47 commit c57943a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,11 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
skb->next = NULL;
}

static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
{
return sk->sk_backlog_rcv(sk, skb);
}

#define sk_wait_event(__sk, __timeo, __condition) \
({ int __rc; \
release_sock(__sk); \
Expand Down
2 changes: 1 addition & 1 deletion include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
BUG_ON(sock_owned_by_user(sk));

while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
sk->sk_backlog_rcv(sk, skb1);
sk_backlog_rcv(sk, skb1);
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED);
}

Expand Down
4 changes: 2 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested)
*/
mutex_acquire(&sk->sk_lock.dep_map, 0, 1, _RET_IP_);

rc = sk->sk_backlog_rcv(sk, skb);
rc = sk_backlog_rcv(sk, skb);

mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_);
} else
Expand Down Expand Up @@ -1374,7 +1374,7 @@ static void __release_sock(struct sock *sk)
struct sk_buff *next = skb->next;

skb->next = NULL;
sk->sk_backlog_rcv(sk, skb);
sk_backlog_rcv(sk, skb);

/*
* We are in process context here with softirqs
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ static void tcp_prequeue_process(struct sock *sk)
* necessary */
local_bh_disable();
while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL)
sk->sk_backlog_rcv(sk, skb);
sk_backlog_rcv(sk, skb);
local_bh_enable();

/* Clear memory counter. */
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void tcp_delack_timer(unsigned long data)
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSCHEDULERFAILED);

while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL)
sk->sk_backlog_rcv(sk, skb);
sk_backlog_rcv(sk, skb);

tp->ucopy.memory = 0;
}
Expand Down

0 comments on commit c57943a

Please sign in to comment.