diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 1621935aad5b..3f1a4804bb3f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -105,14 +105,17 @@ struct net; | |||
105 | /** | 105 | /** |
106 | * struct sock_common - minimal network layer representation of sockets | 106 | * struct sock_common - minimal network layer representation of sockets |
107 | * @skc_node: main hash linkage for various protocol lookup tables | 107 | * @skc_node: main hash linkage for various protocol lookup tables |
108 | * @skc_nulls_node: main hash linkage for UDP/UDP-Lite protocol | 108 | * @skc_nulls_node: main hash linkage for TCP/UDP/UDP-Lite protocol |
109 | * @skc_refcnt: reference count | 109 | * @skc_refcnt: reference count |
110 | * @skc_tx_queue_mapping: tx queue number for this connection | ||
110 | * @skc_hash: hash value used with various protocol lookup tables | 111 | * @skc_hash: hash value used with various protocol lookup tables |
112 | * @skc_u16hashes: two u16 hash values used by UDP lookup tables | ||
111 | * @skc_family: network address family | 113 | * @skc_family: network address family |
112 | * @skc_state: Connection state | 114 | * @skc_state: Connection state |
113 | * @skc_reuse: %SO_REUSEADDR setting | 115 | * @skc_reuse: %SO_REUSEADDR setting |
114 | * @skc_bound_dev_if: bound device index if != 0 | 116 | * @skc_bound_dev_if: bound device index if != 0 |
115 | * @skc_bind_node: bind hash linkage for various protocol lookup tables | 117 | * @skc_bind_node: bind hash linkage for various protocol lookup tables |
118 | * @skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol | ||
116 | * @skc_prot: protocol handlers inside a network family | 119 | * @skc_prot: protocol handlers inside a network family |
117 | * @skc_net: reference to the network namespace of this socket | 120 | * @skc_net: reference to the network namespace of this socket |
118 | * | 121 | * |
@@ -128,13 +131,20 @@ struct sock_common { | |||
128 | struct hlist_nulls_node skc_nulls_node; | 131 | struct hlist_nulls_node skc_nulls_node; |
129 | }; | 132 | }; |
130 | atomic_t skc_refcnt; | 133 | atomic_t skc_refcnt; |
134 | int skc_tx_queue_mapping; | ||
131 | 135 | ||
132 | unsigned int skc_hash; | 136 | union { |
137 | unsigned int skc_hash; | ||
138 | __u16 skc_u16hashes[2]; | ||
139 | }; | ||
133 | unsigned short skc_family; | 140 | unsigned short skc_family; |
134 | volatile unsigned char skc_state; | 141 | volatile unsigned char skc_state; |
135 | unsigned char skc_reuse; | 142 | unsigned char skc_reuse; |
136 | int skc_bound_dev_if; | 143 | int skc_bound_dev_if; |
137 | struct hlist_node skc_bind_node; | 144 | union { |
145 | struct hlist_node skc_bind_node; | ||
146 | struct hlist_nulls_node skc_portaddr_node; | ||
147 | }; | ||
138 | struct proto *skc_prot; | 148 | struct proto *skc_prot; |
139 | #ifdef CONFIG_NET_NS | 149 | #ifdef CONFIG_NET_NS |
140 | struct net *skc_net; | 150 | struct net *skc_net; |
@@ -215,6 +225,7 @@ struct sock { | |||
215 | #define sk_node __sk_common.skc_node | 225 | #define sk_node __sk_common.skc_node |
216 | #define sk_nulls_node __sk_common.skc_nulls_node | 226 | #define sk_nulls_node __sk_common.skc_nulls_node |
217 | #define sk_refcnt __sk_common.skc_refcnt | 227 | #define sk_refcnt __sk_common.skc_refcnt |
228 | #define sk_tx_queue_mapping __sk_common.skc_tx_queue_mapping | ||
218 | 229 | ||
219 | #define sk_copy_start __sk_common.skc_hash | 230 | #define sk_copy_start __sk_common.skc_hash |
220 | #define sk_hash __sk_common.skc_hash | 231 | #define sk_hash __sk_common.skc_hash |
@@ -226,12 +237,12 @@ struct sock { | |||
226 | #define sk_prot __sk_common.skc_prot | 237 | #define sk_prot __sk_common.skc_prot |
227 | #define sk_net __sk_common.skc_net | 238 | #define sk_net __sk_common.skc_net |
228 | kmemcheck_bitfield_begin(flags); | 239 | kmemcheck_bitfield_begin(flags); |
229 | unsigned char sk_shutdown : 2, | 240 | unsigned int sk_shutdown : 2, |
230 | sk_no_check : 2, | 241 | sk_no_check : 2, |
231 | sk_userlocks : 4; | 242 | sk_userlocks : 4, |
243 | sk_protocol : 8, | ||
244 | sk_type : 16; | ||
232 | kmemcheck_bitfield_end(flags); | 245 | kmemcheck_bitfield_end(flags); |
233 | unsigned char sk_protocol; | ||
234 | unsigned short sk_type; | ||
235 | int sk_rcvbuf; | 246 | int sk_rcvbuf; |
236 | socket_lock_t sk_lock; | 247 | socket_lock_t sk_lock; |
237 | /* | 248 | /* |
@@ -504,6 +515,8 @@ enum sock_flags { | |||
504 | SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ | 515 | SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ |
505 | SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ | 516 | SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ |
506 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ | 517 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ |
518 | SOCK_FASYNC, /* fasync() active */ | ||
519 | SOCK_RXQ_OVFL, | ||
507 | }; | 520 | }; |
508 | 521 | ||
509 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 522 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
@@ -1092,8 +1105,29 @@ static inline void sock_put(struct sock *sk) | |||
1092 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, | 1105 | extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, |
1093 | const int nested); | 1106 | const int nested); |
1094 | 1107 | ||
1108 | static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) | ||
1109 | { | ||
1110 | sk->sk_tx_queue_mapping = tx_queue; | ||
1111 | } | ||
1112 | |||
1113 | static inline void sk_tx_queue_clear(struct sock *sk) | ||
1114 | { | ||
1115 | sk->sk_tx_queue_mapping = -1; | ||
1116 | } | ||
1117 | |||
1118 | static inline int sk_tx_queue_get(const struct sock *sk) | ||
1119 | { | ||
1120 | return sk->sk_tx_queue_mapping; | ||
1121 | } | ||
1122 | |||
1123 | static inline bool sk_tx_queue_recorded(const struct sock *sk) | ||
1124 | { | ||
1125 | return (sk && sk->sk_tx_queue_mapping >= 0); | ||
1126 | } | ||
1127 | |||
1095 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) | 1128 | static inline void sk_set_socket(struct sock *sk, struct socket *sock) |
1096 | { | 1129 | { |
1130 | sk_tx_queue_clear(sk); | ||
1097 | sk->sk_socket = sock; | 1131 | sk->sk_socket = sock; |
1098 | } | 1132 | } |
1099 | 1133 | ||
@@ -1150,6 +1184,7 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) | |||
1150 | { | 1184 | { |
1151 | struct dst_entry *old_dst; | 1185 | struct dst_entry *old_dst; |
1152 | 1186 | ||
1187 | sk_tx_queue_clear(sk); | ||
1153 | old_dst = sk->sk_dst_cache; | 1188 | old_dst = sk->sk_dst_cache; |
1154 | sk->sk_dst_cache = dst; | 1189 | sk->sk_dst_cache = dst; |
1155 | dst_release(old_dst); | 1190 | dst_release(old_dst); |
@@ -1168,6 +1203,7 @@ __sk_dst_reset(struct sock *sk) | |||
1168 | { | 1203 | { |
1169 | struct dst_entry *old_dst; | 1204 | struct dst_entry *old_dst; |
1170 | 1205 | ||
1206 | sk_tx_queue_clear(sk); | ||
1171 | old_dst = sk->sk_dst_cache; | 1207 | old_dst = sk->sk_dst_cache; |
1172 | sk->sk_dst_cache = NULL; | 1208 | sk->sk_dst_cache = NULL; |
1173 | dst_release(old_dst); | 1209 | dst_release(old_dst); |
@@ -1396,7 +1432,7 @@ static inline unsigned long sock_wspace(struct sock *sk) | |||
1396 | 1432 | ||
1397 | static inline void sk_wake_async(struct sock *sk, int how, int band) | 1433 | static inline void sk_wake_async(struct sock *sk, int how, int band) |
1398 | { | 1434 | { |
1399 | if (sk->sk_socket && sk->sk_socket->fasync_list) | 1435 | if (sock_flag(sk, SOCK_FASYNC)) |
1400 | sock_wake_async(sk->sk_socket, how, band); | 1436 | sock_wake_async(sk->sk_socket, how, band); |
1401 | } | 1437 | } |
1402 | 1438 | ||
@@ -1492,6 +1528,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | |||
1492 | sk->sk_stamp = kt; | 1528 | sk->sk_stamp = kt; |
1493 | } | 1529 | } |
1494 | 1530 | ||
1531 | extern void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb); | ||
1532 | |||
1495 | /** | 1533 | /** |
1496 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | 1534 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped |
1497 | * @msg: outgoing packet | 1535 | * @msg: outgoing packet |