aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h14
-rw-r--r--net/core/sock.c15
2 files changed, 16 insertions, 13 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 390c04700590..25c37e34bfdc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1075,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk)
1075 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1075 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1076} 1076}
1077 1077
1078static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1078extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1079{
1080 __sk_dst_set(sk, dst);
1081 sk->sk_route_caps = dst->dev->features;
1082 if (sk->sk_route_caps & NETIF_F_GSO)
1083 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1084 if (sk_can_gso(sk)) {
1085 if (dst->header_len)
1086 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1087 else
1088 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1089 }
1090}
1091 1079
1092static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1080static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
1093{ 1081{
diff --git a/net/core/sock.c b/net/core/sock.c
index 73a8018029a8..043bdc05d211 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -979,6 +979,21 @@ out:
979 979
980EXPORT_SYMBOL_GPL(sk_clone); 980EXPORT_SYMBOL_GPL(sk_clone);
981 981
982void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
983{
984 __sk_dst_set(sk, dst);
985 sk->sk_route_caps = dst->dev->features;
986 if (sk->sk_route_caps & NETIF_F_GSO)
987 sk->sk_route_caps |= NETIF_F_GSO_MASK;
988 if (sk_can_gso(sk)) {
989 if (dst->header_len)
990 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
991 else
992 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
993 }
994}
995EXPORT_SYMBOL_GPL(sk_setup_caps);
996
982void __init sk_init(void) 997void __init sk_init(void)
983{ 998{
984 if (num_physpages <= 4096) { 999 if (num_physpages <= 4096) {