Skip to content

Commit

Permalink
[I/OAT]: Make sk_eat_skb I/OAT aware.
Browse files Browse the repository at this point in the history
Add an extra argument to sk_eat_skb, and make it move early copied
packets to the async_wait_queue instead of freeing them.

Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chris Leech authored and David S. Miller committed Jun 18, 2006
1 parent 0e4b499 commit 624d116
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
13 changes: 12 additions & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1273,11 +1273,22 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
* This routine must be called with interrupts disabled or with the socket
* locked so that the sk_buff queue operation is ok.
*/
static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_NET_DMA
static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
{
__skb_unlink(skb, &sk->sk_receive_queue);
if (!copied_early)
__kfree_skb(skb);
else
__skb_queue_tail(&sk->sk_async_wait_queue, skb);
}
#else
static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
{
__skb_unlink(skb, &sk->sk_receive_queue);
__kfree_skb(skb);
}
#endif

extern void sock_enable_timestamp(struct sock *sk);
extern int sock_get_timestamp(struct sock *, struct timeval __user *);
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
}
dccp_pr_debug("packet_type=%s\n",
dccp_packet_name(dh->dccph_type));
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
verify_sock_status:
if (sock_flag(sk, SOCK_DONE)) {
len = 0;
Expand Down Expand Up @@ -773,7 +773,7 @@ int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
}
found_fin_ok:
if (!(flags & MSG_PEEK))
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
break;
} while (1);
out:
Expand Down
8 changes: 4 additions & 4 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,11 +1072,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
break;
}
if (skb->h.th->fin) {
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
++seq;
break;
}
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
if (!desc->count)
break;
}
Expand Down Expand Up @@ -1356,14 +1356,14 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (skb->h.th->fin)
goto found_fin_ok;
if (!(flags & MSG_PEEK))
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
continue;

found_fin_ok:
/* Process the FIN. */
++*seq;
if (!(flags & MSG_PEEK))
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
break;
} while (len > 0);

Expand Down
2 changes: 1 addition & 1 deletion net/llc/af_llc.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
continue;

if (!(flags & MSG_PEEK)) {
sk_eat_skb(sk, skb);
sk_eat_skb(sk, skb, 0);
*seq = 0;
}
} while (len > 0);
Expand Down

0 comments on commit 624d116

Please sign in to comment.