aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index e593af5b1ecc..a1042d08becd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -684,16 +684,17 @@ extern void FASTCALL(release_sock(struct sock *sk));
684#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 684#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
685#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 685#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
686 686
687extern struct sock *sk_alloc(int family, int priority, 687extern struct sock *sk_alloc(int family,
688 unsigned int __nocast priority,
688 struct proto *prot, int zero_it); 689 struct proto *prot, int zero_it);
689extern void sk_free(struct sock *sk); 690extern void sk_free(struct sock *sk);
690 691
691extern struct sk_buff *sock_wmalloc(struct sock *sk, 692extern struct sk_buff *sock_wmalloc(struct sock *sk,
692 unsigned long size, int force, 693 unsigned long size, int force,
693 int priority); 694 unsigned int __nocast priority);
694extern struct sk_buff *sock_rmalloc(struct sock *sk, 695extern struct sk_buff *sock_rmalloc(struct sock *sk,
695 unsigned long size, int force, 696 unsigned long size, int force,
696 int priority); 697 unsigned int __nocast priority);
697extern void sock_wfree(struct sk_buff *skb); 698extern void sock_wfree(struct sk_buff *skb);
698extern void sock_rfree(struct sk_buff *skb); 699extern void sock_rfree(struct sk_buff *skb);
699 700
@@ -708,7 +709,8 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
708 unsigned long size, 709 unsigned long size,
709 int noblock, 710 int noblock,
710 int *errcode); 711 int *errcode);
711extern void *sock_kmalloc(struct sock *sk, int size, int priority); 712extern void *sock_kmalloc(struct sock *sk, int size,
713 unsigned int __nocast priority);
712extern void sock_kfree_s(struct sock *sk, void *mem, int size); 714extern void sock_kfree_s(struct sock *sk, void *mem, int size);
713extern void sk_send_sigurg(struct sock *sk); 715extern void sk_send_sigurg(struct sock *sk);
714 716
@@ -1132,15 +1134,19 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
1132} 1134}
1133 1135
1134static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, 1136static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1135 int size, int mem, int gfp) 1137 int size, int mem,
1138 unsigned int __nocast gfp)
1136{ 1139{
1137 struct sk_buff *skb = alloc_skb(size + sk->sk_prot->max_header, gfp); 1140 struct sk_buff *skb;
1141 int hdr_len;
1138 1142
1143 hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header);
1144 skb = alloc_skb(size + hdr_len, gfp);
1139 if (skb) { 1145 if (skb) {
1140 skb->truesize += mem; 1146 skb->truesize += mem;
1141 if (sk->sk_forward_alloc >= (int)skb->truesize || 1147 if (sk->sk_forward_alloc >= (int)skb->truesize ||
1142 sk_stream_mem_schedule(sk, skb->truesize, 0)) { 1148 sk_stream_mem_schedule(sk, skb->truesize, 0)) {
1143 skb_reserve(skb, sk->sk_prot->max_header); 1149 skb_reserve(skb, hdr_len);
1144 return skb; 1150 return skb;
1145 } 1151 }
1146 __kfree_skb(skb); 1152 __kfree_skb(skb);
@@ -1152,7 +1158,8 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk,
1152} 1158}
1153 1159
1154static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, 1160static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk,
1155 int size, int gfp) 1161 int size,
1162 unsigned int __nocast gfp)
1156{ 1163{
1157 return sk_stream_alloc_pskb(sk, size, 0, gfp); 1164 return sk_stream_alloc_pskb(sk, size, 0, gfp);
1158} 1165}
@@ -1185,7 +1192,7 @@ static inline int sock_writeable(const struct sock *sk)
1185 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); 1192 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2);
1186} 1193}
1187 1194
1188static inline int gfp_any(void) 1195static inline unsigned int __nocast gfp_any(void)
1189{ 1196{
1190 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1197 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
1191} 1198}