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.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 96565ff0de6a..7b3d6b856946 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -40,7 +40,6 @@
40#ifndef _SOCK_H 40#ifndef _SOCK_H
41#define _SOCK_H 41#define _SOCK_H
42 42
43#include <linux/config.h>
44#include <linux/list.h> 43#include <linux/list.h>
45#include <linux/timer.h> 44#include <linux/timer.h>
46#include <linux/cache.h> 45#include <linux/cache.h>
@@ -141,6 +140,7 @@ struct sock_common {
141 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings 140 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings
142 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 141 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
143 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 142 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
143 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
144 * @sk_lingertime: %SO_LINGER l_linger setting 144 * @sk_lingertime: %SO_LINGER l_linger setting
145 * @sk_backlog: always used with the per-socket spinlock held 145 * @sk_backlog: always used with the per-socket spinlock held
146 * @sk_callback_lock: used with the callbacks in the end of this struct 146 * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -212,6 +212,7 @@ struct sock {
212 gfp_t sk_allocation; 212 gfp_t sk_allocation;
213 int sk_sndbuf; 213 int sk_sndbuf;
214 int sk_route_caps; 214 int sk_route_caps;
215 int sk_gso_type;
215 int sk_rcvlowat; 216 int sk_rcvlowat;
216 unsigned long sk_flags; 217 unsigned long sk_flags;
217 unsigned long sk_lingertime; 218 unsigned long sk_lingertime;
@@ -384,7 +385,6 @@ enum sock_flags {
384 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ 385 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
385 SOCK_DBG, /* %SO_DEBUG setting */ 386 SOCK_DBG, /* %SO_DEBUG setting */
386 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ 387 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
387 SOCK_NO_LARGESEND, /* whether to sent large segments or not */
388 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 388 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
389 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 389 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
390}; 390};
@@ -1027,13 +1027,22 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1027 1027
1028extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1028extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1029 1029
1030static inline int sk_can_gso(const struct sock *sk)
1031{
1032 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1033}
1034
1030static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1035static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1031{ 1036{
1032 __sk_dst_set(sk, dst); 1037 __sk_dst_set(sk, dst);
1033 sk->sk_route_caps = dst->dev->features; 1038 sk->sk_route_caps = dst->dev->features;
1034 if (sk->sk_route_caps & NETIF_F_TSO) { 1039 if (sk->sk_route_caps & NETIF_F_GSO)
1035 if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len) 1040 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1036 sk->sk_route_caps &= ~NETIF_F_TSO; 1041 if (sk_can_gso(sk)) {
1042 if (dst->header_len)
1043 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1044 else
1045 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1037 } 1046 }
1038} 1047}
1039 1048
@@ -1266,6 +1275,7 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1266 * sk_eat_skb - Release a skb if it is no longer needed 1275 * sk_eat_skb - Release a skb if it is no longer needed
1267 * @sk: socket to eat this skb from 1276 * @sk: socket to eat this skb from
1268 * @skb: socket buffer to eat 1277 * @skb: socket buffer to eat
1278 * @copied_early: flag indicating whether DMA operations copied this data early
1269 * 1279 *
1270 * This routine must be called with interrupts disabled or with the socket 1280 * This routine must be called with interrupts disabled or with the socket
1271 * locked so that the sk_buff queue operation is ok. 1281 * locked so that the sk_buff queue operation is ok.