sock.h (f2f872f9272a79a1048877ea14c15576f46c225e) sock.h (e0d1095ae3405404d247afb00233ef837d58da83)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the AF_INET socket handler.
7 *
8 * Version: @(#)sock.h 1.0.4 05/13/93

--- 313 unchanged lines hidden (view full) ---

322 struct sk_buff *head;
323 struct sk_buff *tail;
324 } sk_backlog;
325#define sk_rmem_alloc sk_backlog.rmem_alloc
326 int sk_forward_alloc;
327#ifdef CONFIG_RPS
328 __u32 sk_rxhash;
329#endif
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the AF_INET socket handler.
7 *
8 * Version: @(#)sock.h 1.0.4 05/13/93

--- 313 unchanged lines hidden (view full) ---

322 struct sk_buff *head;
323 struct sk_buff *tail;
324 } sk_backlog;
325#define sk_rmem_alloc sk_backlog.rmem_alloc
326 int sk_forward_alloc;
327#ifdef CONFIG_RPS
328 __u32 sk_rxhash;
329#endif
330#ifdef CONFIG_NET_LL_RX_POLL
330#ifdef CONFIG_NET_RX_BUSY_POLL
331 unsigned int sk_napi_id;
332 unsigned int sk_ll_usec;
333#endif
334 atomic_t sk_drops;
335 int sk_rcvbuf;
336
337 struct sk_filter __rcu *sk_filter;
338 struct socket_wq __rcu *sk_wq;

--- 402 unchanged lines hidden (view full) ---

741
742static inline int sk_stream_wspace(const struct sock *sk)
743{
744 return sk->sk_sndbuf - sk->sk_wmem_queued;
745}
746
747extern void sk_stream_write_space(struct sock *sk);
748
331 unsigned int sk_napi_id;
332 unsigned int sk_ll_usec;
333#endif
334 atomic_t sk_drops;
335 int sk_rcvbuf;
336
337 struct sk_filter __rcu *sk_filter;
338 struct socket_wq __rcu *sk_wq;

--- 402 unchanged lines hidden (view full) ---

741
742static inline int sk_stream_wspace(const struct sock *sk)
743{
744 return sk->sk_sndbuf - sk->sk_wmem_queued;
745}
746
747extern void sk_stream_write_space(struct sock *sk);
748
749static inline bool sk_stream_memory_free(const struct sock *sk)
750{
751 return sk->sk_wmem_queued < sk->sk_sndbuf;
752}
753
749/* OOB backlog add */
750static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
751{
752 /* dont let skb dst not refcounted, we are going to leave rcu lock */
753 skb_dst_force(skb);
754
755 if (!sk->sk_backlog.tail)
756 sk->sk_backlog.head = skb;

--- 183 unchanged lines hidden (view full) ---

940 int (*get_port)(struct sock *sk, unsigned short snum);
941 void (*clear_sk)(struct sock *sk, int size);
942
943 /* Keeping track of sockets in use */
944#ifdef CONFIG_PROC_FS
945 unsigned int inuse_idx;
946#endif
947
754/* OOB backlog add */
755static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
756{
757 /* dont let skb dst not refcounted, we are going to leave rcu lock */
758 skb_dst_force(skb);
759
760 if (!sk->sk_backlog.tail)
761 sk->sk_backlog.head = skb;

--- 183 unchanged lines hidden (view full) ---

945 int (*get_port)(struct sock *sk, unsigned short snum);
946 void (*clear_sk)(struct sock *sk, int size);
947
948 /* Keeping track of sockets in use */
949#ifdef CONFIG_PROC_FS
950 unsigned int inuse_idx;
951#endif
952
948 bool (*stream_memory_free)(const struct sock *sk);
949 /* Memory pressure */
950 void (*enter_memory_pressure)(struct sock *sk);
951 atomic_long_t *memory_allocated; /* Current allocated memory. */
952 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
953 /*
954 * Pressure flag: try to collapse.
955 * Technical note: it is used by multiple contexts non atomically.
956 * All the __sk_mem_schedule() is of this nature: accounting

--- 122 unchanged lines hidden (view full) ---

1079#define mem_cgroup_sockets_enabled 0
1080static inline struct cg_proto *parent_cg_proto(struct proto *proto,
1081 struct cg_proto *cg_proto)
1082{
1083 return NULL;
1084}
1085#endif
1086
953 /* Memory pressure */
954 void (*enter_memory_pressure)(struct sock *sk);
955 atomic_long_t *memory_allocated; /* Current allocated memory. */
956 struct percpu_counter *sockets_allocated; /* Current number of sockets. */
957 /*
958 * Pressure flag: try to collapse.
959 * Technical note: it is used by multiple contexts non atomically.
960 * All the __sk_mem_schedule() is of this nature: accounting

--- 122 unchanged lines hidden (view full) ---

1083#define mem_cgroup_sockets_enabled 0
1084static inline struct cg_proto *parent_cg_proto(struct proto *proto,
1085 struct cg_proto *cg_proto)
1086{
1087 return NULL;
1088}
1089#endif
1090
1087static inline bool sk_stream_memory_free(const struct sock *sk)
1088{
1089 if (sk->sk_wmem_queued >= sk->sk_sndbuf)
1090 return false;
1091
1091
1092 return sk->sk_prot->stream_memory_free ?
1093 sk->sk_prot->stream_memory_free(sk) : true;
1094}
1095
1096static inline bool sk_stream_is_writeable(const struct sock *sk)
1097{
1098 return sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) &&
1099 sk_stream_memory_free(sk);
1100}
1101
1102
1103static inline bool sk_has_memory_pressure(const struct sock *sk)
1104{
1105 return sk->sk_prot->memory_pressure != NULL;
1106}
1107
1108static inline bool sk_under_memory_pressure(const struct sock *sk)
1109{
1110 if (!sk->sk_prot->memory_pressure)

--- 404 unchanged lines hidden (view full) ---

1515
1516extern struct sk_buff *sock_wmalloc(struct sock *sk,
1517 unsigned long size, int force,
1518 gfp_t priority);
1519extern struct sk_buff *sock_rmalloc(struct sock *sk,
1520 unsigned long size, int force,
1521 gfp_t priority);
1522extern void sock_wfree(struct sk_buff *skb);
1092static inline bool sk_has_memory_pressure(const struct sock *sk)
1093{
1094 return sk->sk_prot->memory_pressure != NULL;
1095}
1096
1097static inline bool sk_under_memory_pressure(const struct sock *sk)
1098{
1099 if (!sk->sk_prot->memory_pressure)

--- 404 unchanged lines hidden (view full) ---

1504
1505extern struct sk_buff *sock_wmalloc(struct sock *sk,
1506 unsigned long size, int force,
1507 gfp_t priority);
1508extern struct sk_buff *sock_rmalloc(struct sock *sk,
1509 unsigned long size, int force,
1510 gfp_t priority);
1511extern void sock_wfree(struct sk_buff *skb);
1523extern void skb_orphan_partial(struct sk_buff *skb);
1524extern void sock_rfree(struct sk_buff *skb);
1525extern void sock_edemux(struct sk_buff *skb);
1526
1527extern int sock_setsockopt(struct socket *sock, int level,
1528 int op, char __user *optval,
1529 unsigned int optlen);
1530
1531extern int sock_getsockopt(struct socket *sock, int level,

--- 724 unchanged lines hidden (view full) ---

2256 return sk;
2257 }
2258 return NULL;
2259}
2260
2261extern void sock_enable_timestamp(struct sock *sk, int flag);
2262extern int sock_get_timestamp(struct sock *, struct timeval __user *);
2263extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1512extern void sock_rfree(struct sk_buff *skb);
1513extern void sock_edemux(struct sk_buff *skb);
1514
1515extern int sock_setsockopt(struct socket *sock, int level,
1516 int op, char __user *optval,
1517 unsigned int optlen);
1518
1519extern int sock_getsockopt(struct socket *sock, int level,

--- 724 unchanged lines hidden (view full) ---

2244 return sk;
2245 }
2246 return NULL;
2247}
2248
2249extern void sock_enable_timestamp(struct sock *sk, int flag);
2250extern int sock_get_timestamp(struct sock *, struct timeval __user *);
2251extern int sock_get_timestampns(struct sock *, struct timespec __user *);
2264extern int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len,
2265 int level, int type);
2266
2267/*
2268 * Enable debug/info messages
2269 */
2270extern int net_msg_warn;
2271#define NETDEBUG(fmt, args...) \
2272 do { if (net_msg_warn) printk(fmt,##args); } while (0)
2273

--- 12 unchanged lines hidden ---
2252
2253/*
2254 * Enable debug/info messages
2255 */
2256extern int net_msg_warn;
2257#define NETDEBUG(fmt, args...) \
2258 do { if (net_msg_warn) printk(fmt,##args); } while (0)
2259

--- 12 unchanged lines hidden ---