diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 5a3a151bd730..4bb1ff9fd15b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -158,7 +158,7 @@ struct sock_common { | |||
158 | * @sk_allocation: allocation mode | 158 | * @sk_allocation: allocation mode |
159 | * @sk_sndbuf: size of send buffer in bytes | 159 | * @sk_sndbuf: size of send buffer in bytes |
160 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, | 160 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, |
161 | * %SO_OOBINLINE settings | 161 | * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings |
162 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 162 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
163 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 163 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
164 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | 164 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
@@ -488,6 +488,13 @@ enum sock_flags { | |||
488 | SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ | 488 | SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ |
489 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ | 489 | SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ |
490 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ | 490 | SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ |
491 | SOCK_TIMESTAMPING_TX_HARDWARE, /* %SOF_TIMESTAMPING_TX_HARDWARE */ | ||
492 | SOCK_TIMESTAMPING_TX_SOFTWARE, /* %SOF_TIMESTAMPING_TX_SOFTWARE */ | ||
493 | SOCK_TIMESTAMPING_RX_HARDWARE, /* %SOF_TIMESTAMPING_RX_HARDWARE */ | ||
494 | SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */ | ||
495 | SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */ | ||
496 | SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */ | ||
497 | SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */ | ||
491 | }; | 498 | }; |
492 | 499 | ||
493 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 500 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
@@ -860,7 +867,6 @@ static inline void sk_mem_uncharge(struct sock *sk, int size) | |||
860 | 867 | ||
861 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | 868 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) |
862 | { | 869 | { |
863 | skb_truesize_check(skb); | ||
864 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | 870 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); |
865 | sk->sk_wmem_queued -= skb->truesize; | 871 | sk->sk_wmem_queued -= skb->truesize; |
866 | sk_mem_uncharge(sk, skb->truesize); | 872 | sk_mem_uncharge(sk, skb->truesize); |
@@ -945,6 +951,11 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, | |||
945 | unsigned long size, | 951 | unsigned long size, |
946 | int noblock, | 952 | int noblock, |
947 | int *errcode); | 953 | int *errcode); |
954 | extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk, | ||
955 | unsigned long header_len, | ||
956 | unsigned long data_len, | ||
957 | int noblock, | ||
958 | int *errcode); | ||
948 | extern void *sock_kmalloc(struct sock *sk, int size, | 959 | extern void *sock_kmalloc(struct sock *sk, int size, |
949 | gfp_t priority); | 960 | gfp_t priority); |
950 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); | 961 | extern void sock_kfree_s(struct sock *sk, void *mem, int size); |
@@ -1308,7 +1319,7 @@ static inline int sock_writeable(const struct sock *sk) | |||
1308 | 1319 | ||
1309 | static inline gfp_t gfp_any(void) | 1320 | static inline gfp_t gfp_any(void) |
1310 | { | 1321 | { |
1311 | return in_atomic() ? GFP_ATOMIC : GFP_KERNEL; | 1322 | return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; |
1312 | } | 1323 | } |
1313 | 1324 | ||
1314 | static inline long sock_rcvtimeo(const struct sock *sk, int noblock) | 1325 | static inline long sock_rcvtimeo(const struct sock *sk, int noblock) |
@@ -1341,14 +1352,45 @@ static __inline__ void | |||
1341 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 1352 | sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) |
1342 | { | 1353 | { |
1343 | ktime_t kt = skb->tstamp; | 1354 | ktime_t kt = skb->tstamp; |
1355 | struct skb_shared_hwtstamps *hwtstamps = skb_hwtstamps(skb); | ||
1344 | 1356 | ||
1345 | if (sock_flag(sk, SOCK_RCVTSTAMP)) | 1357 | /* |
1358 | * generate control messages if | ||
1359 | * - receive time stamping in software requested (SOCK_RCVTSTAMP | ||
1360 | * or SOCK_TIMESTAMPING_RX_SOFTWARE) | ||
1361 | * - software time stamp available and wanted | ||
1362 | * (SOCK_TIMESTAMPING_SOFTWARE) | ||
1363 | * - hardware time stamps available and wanted | ||
1364 | * (SOCK_TIMESTAMPING_SYS_HARDWARE or | ||
1365 | * SOCK_TIMESTAMPING_RAW_HARDWARE) | ||
1366 | */ | ||
1367 | if (sock_flag(sk, SOCK_RCVTSTAMP) || | ||
1368 | sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) || | ||
1369 | (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) || | ||
1370 | (hwtstamps->hwtstamp.tv64 && | ||
1371 | sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) || | ||
1372 | (hwtstamps->syststamp.tv64 && | ||
1373 | sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE))) | ||
1346 | __sock_recv_timestamp(msg, sk, skb); | 1374 | __sock_recv_timestamp(msg, sk, skb); |
1347 | else | 1375 | else |
1348 | sk->sk_stamp = kt; | 1376 | sk->sk_stamp = kt; |
1349 | } | 1377 | } |
1350 | 1378 | ||
1351 | /** | 1379 | /** |
1380 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | ||
1381 | * @msg: outgoing packet | ||
1382 | * @sk: socket sending this packet | ||
1383 | * @shtx: filled with instructions for time stamping | ||
1384 | * | ||
1385 | * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if | ||
1386 | * parameters are invalid. | ||
1387 | */ | ||
1388 | extern int sock_tx_timestamp(struct msghdr *msg, | ||
1389 | struct sock *sk, | ||
1390 | union skb_shared_tx *shtx); | ||
1391 | |||
1392 | |||
1393 | /** | ||
1352 | * sk_eat_skb - Release a skb if it is no longer needed | 1394 | * sk_eat_skb - Release a skb if it is no longer needed |
1353 | * @sk: socket to eat this skb from | 1395 | * @sk: socket to eat this skb from |
1354 | * @skb: socket buffer to eat | 1396 | * @skb: socket buffer to eat |
@@ -1416,7 +1458,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb) | |||
1416 | return NULL; | 1458 | return NULL; |
1417 | } | 1459 | } |
1418 | 1460 | ||
1419 | extern void sock_enable_timestamp(struct sock *sk); | 1461 | extern void sock_enable_timestamp(struct sock *sk, int flag); |
1420 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1462 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
1421 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); | 1463 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); |
1422 | 1464 | ||