diff options
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 7136bae48c2f..7b3d6b856946 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -140,6 +140,7 @@ struct sock_common { | |||
140 | * @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 |
141 | * @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 |
142 | * @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) | ||
143 | * @sk_lingertime: %SO_LINGER l_linger setting | 144 | * @sk_lingertime: %SO_LINGER l_linger setting |
144 | * @sk_backlog: always used with the per-socket spinlock held | 145 | * @sk_backlog: always used with the per-socket spinlock held |
145 | * @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 |
@@ -211,6 +212,7 @@ struct sock { | |||
211 | gfp_t sk_allocation; | 212 | gfp_t sk_allocation; |
212 | int sk_sndbuf; | 213 | int sk_sndbuf; |
213 | int sk_route_caps; | 214 | int sk_route_caps; |
215 | int sk_gso_type; | ||
214 | int sk_rcvlowat; | 216 | int sk_rcvlowat; |
215 | unsigned long sk_flags; | 217 | unsigned long sk_flags; |
216 | unsigned long sk_lingertime; | 218 | unsigned long sk_lingertime; |
@@ -1025,15 +1027,20 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); | |||
1025 | 1027 | ||
1026 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); | 1028 | extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); |
1027 | 1029 | ||
1030 | static 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 | |||
1028 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) | 1035 | static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) |
1029 | { | 1036 | { |
1030 | __sk_dst_set(sk, dst); | 1037 | __sk_dst_set(sk, dst); |
1031 | sk->sk_route_caps = dst->dev->features; | 1038 | sk->sk_route_caps = dst->dev->features; |
1032 | if (sk->sk_route_caps & NETIF_F_GSO) | 1039 | if (sk->sk_route_caps & NETIF_F_GSO) |
1033 | sk->sk_route_caps |= NETIF_F_TSO; | 1040 | sk->sk_route_caps |= NETIF_F_GSO_MASK; |
1034 | if (sk->sk_route_caps & NETIF_F_TSO) { | 1041 | if (sk_can_gso(sk)) { |
1035 | if (dst->header_len) | 1042 | if (dst->header_len) |
1036 | sk->sk_route_caps &= ~NETIF_F_TSO; | 1043 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; |
1037 | else | 1044 | else |
1038 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; | 1045 | sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM; |
1039 | } | 1046 | } |