diff options
Diffstat (limited to 'include/net/sock.h')
| -rw-r--r-- | include/net/sock.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index c9fad6fb629b..96565ff0de6a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -132,6 +132,7 @@ struct sock_common { | |||
| 132 | * @sk_receive_queue: incoming packets | 132 | * @sk_receive_queue: incoming packets |
| 133 | * @sk_wmem_alloc: transmit queue bytes committed | 133 | * @sk_wmem_alloc: transmit queue bytes committed |
| 134 | * @sk_write_queue: Packet sending queue | 134 | * @sk_write_queue: Packet sending queue |
| 135 | * @sk_async_wait_queue: DMA copied packets | ||
| 135 | * @sk_omem_alloc: "o" is "option" or "other" | 136 | * @sk_omem_alloc: "o" is "option" or "other" |
| 136 | * @sk_wmem_queued: persistent queue size | 137 | * @sk_wmem_queued: persistent queue size |
| 137 | * @sk_forward_alloc: space allocated forward | 138 | * @sk_forward_alloc: space allocated forward |
| @@ -205,6 +206,7 @@ struct sock { | |||
| 205 | atomic_t sk_omem_alloc; | 206 | atomic_t sk_omem_alloc; |
| 206 | struct sk_buff_head sk_receive_queue; | 207 | struct sk_buff_head sk_receive_queue; |
| 207 | struct sk_buff_head sk_write_queue; | 208 | struct sk_buff_head sk_write_queue; |
| 209 | struct sk_buff_head sk_async_wait_queue; | ||
| 208 | int sk_wmem_queued; | 210 | int sk_wmem_queued; |
| 209 | int sk_forward_alloc; | 211 | int sk_forward_alloc; |
| 210 | gfp_t sk_allocation; | 212 | gfp_t sk_allocation; |
| @@ -871,10 +873,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock) | |||
| 871 | if (filter) { | 873 | if (filter) { |
| 872 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, | 874 | unsigned int pkt_len = sk_run_filter(skb, filter->insns, |
| 873 | filter->len); | 875 | filter->len); |
| 874 | if (!pkt_len) | 876 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; |
| 875 | err = -EPERM; | ||
| 876 | else | ||
| 877 | skb_trim(skb, pkt_len); | ||
| 878 | } | 877 | } |
| 879 | 878 | ||
| 880 | if (needlock) | 879 | if (needlock) |
| @@ -1271,11 +1270,22 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
| 1271 | * This routine must be called with interrupts disabled or with the socket | 1270 | * This routine must be called with interrupts disabled or with the socket |
| 1272 | * locked so that the sk_buff queue operation is ok. | 1271 | * locked so that the sk_buff queue operation is ok. |
| 1273 | */ | 1272 | */ |
| 1274 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) | 1273 | #ifdef CONFIG_NET_DMA |
| 1274 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) | ||
| 1275 | { | ||
| 1276 | __skb_unlink(skb, &sk->sk_receive_queue); | ||
| 1277 | if (!copied_early) | ||
| 1278 | __kfree_skb(skb); | ||
| 1279 | else | ||
| 1280 | __skb_queue_tail(&sk->sk_async_wait_queue, skb); | ||
| 1281 | } | ||
| 1282 | #else | ||
| 1283 | static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) | ||
| 1275 | { | 1284 | { |
| 1276 | __skb_unlink(skb, &sk->sk_receive_queue); | 1285 | __skb_unlink(skb, &sk->sk_receive_queue); |
| 1277 | __kfree_skb(skb); | 1286 | __kfree_skb(skb); |
| 1278 | } | 1287 | } |
| 1288 | #endif | ||
| 1279 | 1289 | ||
| 1280 | extern void sock_enable_timestamp(struct sock *sk); | 1290 | extern void sock_enable_timestamp(struct sock *sk); |
| 1281 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1291 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
