Skip to content

Commit 911f6b1

Browse files
committed
Merge branch 'GREoIPV6'
Tom Herbert says: ==================== ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling This patch set: - Fixes GRE6 to process translate flags correctly from configuration - Adds support for GSO and GRO for ip6ip6 and ip4ip6 - Add support for FOU and GUE in IPv6 - Support GRE, ip6ip6 and ip4ip6 over FOU/GUE - Fixes ip6_input to deal with UDP encapsulations - Some other minor fixes v2: - Removed a check of GSO types in MPLS - Define GSO type SKB_GSO_IPXIP6 and SKB_GSO_IPXIP4 (based on input from Alexander) - Don't define GSO types specifically for IP6IP6 and IP4IP6, above fix makes that unnecessary - Don't bother clearing encapsulation flag in UDP tunnel segment (another item suggested by Alexander). v3: - Address some minor comments from Alexander v4: - Rebase on changes to fix IP TX tunnels - Fix MTU issues in ip4ip6, ip6ip6 - Add test data for above v5: - Address feedback from Shmulik Ladkani regarding extension header code that does not return next header but in instead relies on returning value via nhoff. Solution here is to fix EH processing to return nexthdr value. - Refactored IPv4 encaps so that we won't need to create a ip6_tunnel_core.c when adding encap support IPv6. v6: - Fix build issues with regard to new GSO constants - FIx MTU calculation issues ip6_tunnel.c pointed out byt ALex - Add encap_hlen into headroom for GREv6 to work with FOU/GUE v7: - Added skb_set_inner_ipproto to ip4ip6 and ip6ip6 - Clarified max_headroom in ip6_tnl_xmit - Set features for IPv6 tunnels - Other cleanup suggested by Alexander - Above fixes throughput performance issues in ip4ip6 and ip6ip6, updated test results to reflect that Tested: Various cases of IP tunnels with netperf TCP_STREAM and TCP_RR. - IPv4/GRE/GUE/IPv6 with RCO 1 TCP_STREAM 6616 Mbps 200 TCP_RR 1244043 tps 141/243/446 90/95/99% latencies 86.61% CPU utilization - IPv6/GRE/GUE/IPv6 with RCO 1 TCP_STREAM 6940 Mbps 200 TCP_RR 1270903 tps 138/236/440 90/95/99% latencies 87.51% CPU utilization - IP6IP6 1 TCP_STREAM 5307 Mbps 200 TCP_RR 498981 tps 388/498/631 90/95/99% latencies 19.75% CPU utilization (1 CPU saturated) - IP6IP6/GUE with RCO 1 TCP_STREAM 5575 Mbps 200 TCP_RR 1233818 tps 143/244/451 90/95/99% latencies 87.57 CPU utilization - IP4IP6 1 TCP_STREAM 5235 Mbps 200 TCP_RR 763774 tps 250/318/466 90/95/99% latencies 35.25% CPU utilization (1 CPU saturated) - IP4IP6/GUE with RCO 1 TCP_STREAM 5337 Mbps 200 TCP_RR 1196385 tps 148/251/460 90/95/99% latencies 87.56 CPU utilization - GRE with keyid 200 TCP_RR 744173 tps 258/332/461 90/95/99% latencies 34.59% CPU utilization (1 CPU saturated) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 9483501 + 3ee93ea commit 911f6b1

36 files changed

+737
-310
lines changed

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13259,12 +13259,11 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
1325913259
NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
1326013260
if (!chip_is_e1x) {
1326113261
dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL |
13262-
NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT;
13262+
NETIF_F_GSO_IPXIP4;
1326313263
dev->hw_enc_features =
1326413264
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
1326513265
NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
13266-
NETIF_F_GSO_IPIP |
13267-
NETIF_F_GSO_SIT |
13266+
NETIF_F_GSO_IPXIP4 |
1326813267
NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL;
1326913268
}
1327013269

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6311,7 +6311,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
63116311
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
63126312
NETIF_F_TSO | NETIF_F_TSO6 |
63136313
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
6314-
NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT |
6314+
NETIF_F_GSO_IPXIP4 |
63156315
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
63166316
NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH |
63176317
NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO;
@@ -6321,8 +6321,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
63216321
NETIF_F_TSO | NETIF_F_TSO6 |
63226322
NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
63236323
NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
6324-
NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT |
6325-
NETIF_F_GSO_PARTIAL;
6324+
NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL;
63266325
dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM |
63276326
NETIF_F_GSO_GRE_CSUM;
63286327
dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9083,8 +9083,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
90839083
NETIF_F_TSO6 |
90849084
NETIF_F_GSO_GRE |
90859085
NETIF_F_GSO_GRE_CSUM |
9086-
NETIF_F_GSO_IPIP |
9087-
NETIF_F_GSO_SIT |
9086+
NETIF_F_GSO_IPXIP4 |
90889087
NETIF_F_GSO_UDP_TUNNEL |
90899088
NETIF_F_GSO_UDP_TUNNEL_CSUM |
90909089
NETIF_F_GSO_PARTIAL |

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,8 +2284,7 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
22842284

22852285
if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
22862286
SKB_GSO_GRE_CSUM |
2287-
SKB_GSO_IPIP |
2288-
SKB_GSO_SIT |
2287+
SKB_GSO_IPXIP4 |
22892288
SKB_GSO_UDP_TUNNEL |
22902289
SKB_GSO_UDP_TUNNEL_CSUM)) {
22912290
if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&

drivers/net/ethernet/intel/i40evf/i40e_txrx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,7 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
15591559

15601560
if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
15611561
SKB_GSO_GRE_CSUM |
1562-
SKB_GSO_IPIP |
1563-
SKB_GSO_SIT |
1562+
SKB_GSO_IPXIP4 |
15641563
SKB_GSO_UDP_TUNNEL |
15651564
SKB_GSO_UDP_TUNNEL_CSUM)) {
15661565
if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,8 +2230,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
22302230
NETIF_F_TSO6 |
22312231
NETIF_F_GSO_GRE |
22322232
NETIF_F_GSO_GRE_CSUM |
2233-
NETIF_F_GSO_IPIP |
2234-
NETIF_F_GSO_SIT |
2233+
NETIF_F_GSO_IPXIP4 |
22352234
NETIF_F_GSO_UDP_TUNNEL |
22362235
NETIF_F_GSO_UDP_TUNNEL_CSUM |
22372236
NETIF_F_GSO_PARTIAL |

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,8 +2418,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
24182418

24192419
#define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
24202420
NETIF_F_GSO_GRE_CSUM | \
2421-
NETIF_F_GSO_IPIP | \
2422-
NETIF_F_GSO_SIT | \
2421+
NETIF_F_GSO_IPXIP4 | \
24232422
NETIF_F_GSO_UDP_TUNNEL | \
24242423
NETIF_F_GSO_UDP_TUNNEL_CSUM)
24252424

drivers/net/ethernet/intel/igbvf/netdev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,8 +2763,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
27632763

27642764
#define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
27652765
NETIF_F_GSO_GRE_CSUM | \
2766-
NETIF_F_GSO_IPIP | \
2767-
NETIF_F_GSO_SIT | \
2766+
NETIF_F_GSO_IPXIP4 | \
27682767
NETIF_F_GSO_UDP_TUNNEL | \
27692768
NETIF_F_GSO_UDP_TUNNEL_CSUM)
27702769

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9482,8 +9482,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
94829482

94839483
#define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
94849484
NETIF_F_GSO_GRE_CSUM | \
9485-
NETIF_F_GSO_IPIP | \
9486-
NETIF_F_GSO_SIT | \
9485+
NETIF_F_GSO_IPXIP4 | \
94879486
NETIF_F_GSO_UDP_TUNNEL | \
94889487
NETIF_F_GSO_UDP_TUNNEL_CSUM)
94899488

drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,8 +4062,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
40624062

40634063
#define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
40644064
NETIF_F_GSO_GRE_CSUM | \
4065-
NETIF_F_GSO_IPIP | \
4066-
NETIF_F_GSO_SIT | \
4065+
NETIF_F_GSO_IPXIP4 | \
40674066
NETIF_F_GSO_UDP_TUNNEL | \
40684067
NETIF_F_GSO_UDP_TUNNEL_CSUM)
40694068

include/linux/netdev_features.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ enum {
4444
NETIF_F_FSO_BIT, /* ... FCoE segmentation */
4545
NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
4646
NETIF_F_GSO_GRE_CSUM_BIT, /* ... GRE with csum with TSO */
47-
NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */
48-
NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
47+
NETIF_F_GSO_IPXIP4_BIT, /* ... IP4 or IP6 over IP4 with TSO */
48+
NETIF_F_GSO_IPXIP6_BIT, /* ... IP4 or IP6 over IP6 with TSO */
4949
NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
5050
NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
5151
NETIF_F_GSO_PARTIAL_BIT, /* ... Only segment inner-most L4
@@ -121,8 +121,8 @@ enum {
121121
#define NETIF_F_RXALL __NETIF_F(RXALL)
122122
#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
123123
#define NETIF_F_GSO_GRE_CSUM __NETIF_F(GSO_GRE_CSUM)
124-
#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP)
125-
#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
124+
#define NETIF_F_GSO_IPXIP4 __NETIF_F(GSO_IPXIP4)
125+
#define NETIF_F_GSO_IPXIP6 __NETIF_F(GSO_IPXIP6)
126126
#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
127127
#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
128128
#define NETIF_F_TSO_MANGLEID __NETIF_F(TSO_MANGLEID)
@@ -200,8 +200,8 @@ enum {
200200

201201
#define NETIF_F_GSO_ENCAP_ALL (NETIF_F_GSO_GRE | \
202202
NETIF_F_GSO_GRE_CSUM | \
203-
NETIF_F_GSO_IPIP | \
204-
NETIF_F_GSO_SIT | \
203+
NETIF_F_GSO_IPXIP4 | \
204+
NETIF_F_GSO_IPXIP6 | \
205205
NETIF_F_GSO_UDP_TUNNEL | \
206206
NETIF_F_GSO_UDP_TUNNEL_CSUM)
207207

include/linux/netdevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,8 +4006,8 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
40064006
BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
40074007
BUILD_BUG_ON(SKB_GSO_GRE != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
40084008
BUILD_BUG_ON(SKB_GSO_GRE_CSUM != (NETIF_F_GSO_GRE_CSUM >> NETIF_F_GSO_SHIFT));
4009-
BUILD_BUG_ON(SKB_GSO_IPIP != (NETIF_F_GSO_IPIP >> NETIF_F_GSO_SHIFT));
4010-
BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
4009+
BUILD_BUG_ON(SKB_GSO_IPXIP4 != (NETIF_F_GSO_IPXIP4 >> NETIF_F_GSO_SHIFT));
4010+
BUILD_BUG_ON(SKB_GSO_IPXIP6 != (NETIF_F_GSO_IPXIP6 >> NETIF_F_GSO_SHIFT));
40114011
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
40124012
BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
40134013
BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));

include/linux/skbuff.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,9 @@ enum {
471471

472472
SKB_GSO_GRE_CSUM = 1 << 8,
473473

474-
SKB_GSO_IPIP = 1 << 9,
474+
SKB_GSO_IPXIP4 = 1 << 9,
475475

476-
SKB_GSO_SIT = 1 << 10,
476+
SKB_GSO_IPXIP6 = 1 << 10,
477477

478478
SKB_GSO_UDP_TUNNEL = 1 << 11,
479479

include/net/fou.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include <net/udp.h>
1010

1111
size_t fou_encap_hlen(struct ip_tunnel_encap *e);
12-
static size_t gue_encap_hlen(struct ip_tunnel_encap *e);
12+
size_t gue_encap_hlen(struct ip_tunnel_encap *e);
1313

14-
int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
15-
u8 *protocol, struct flowi4 *fl4);
16-
int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
17-
u8 *protocol, struct flowi4 *fl4);
14+
int __fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
15+
u8 *protocol, __be16 *sport, int type);
16+
int __gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
17+
u8 *protocol, __be16 *sport, int type);
1818

1919
#endif

include/net/inet_common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family,
3939
int inet_recv_error(struct sock *sk, struct msghdr *msg, int len,
4040
int *addr_len);
4141

42+
struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff *skb);
43+
int inet_gro_complete(struct sk_buff *skb, int nhoff);
44+
struct sk_buff *inet_gso_segment(struct sk_buff *skb,
45+
netdev_features_t features);
46+
4247
static inline void inet_ctl_sock_destroy(struct sock *sk)
4348
{
4449
if (sk)

include/net/ip6_tunnel.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,68 @@ struct ip6_tnl {
5252
__u32 o_seqno; /* The last output seqno */
5353
int hlen; /* tun_hlen + encap_hlen */
5454
int tun_hlen; /* Precalculated header length */
55+
int encap_hlen; /* Encap header length (FOU,GUE) */
56+
struct ip_tunnel_encap encap;
5557
int mlink;
58+
};
5659

60+
struct ip6_tnl_encap_ops {
61+
size_t (*encap_hlen)(struct ip_tunnel_encap *e);
62+
int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
63+
u8 *protocol, struct flowi6 *fl6);
5764
};
5865

66+
extern const struct ip6_tnl_encap_ops __rcu *
67+
ip6tun_encaps[MAX_IPTUN_ENCAP_OPS];
68+
69+
int ip6_tnl_encap_add_ops(const struct ip6_tnl_encap_ops *ops,
70+
unsigned int num);
71+
int ip6_tnl_encap_del_ops(const struct ip6_tnl_encap_ops *ops,
72+
unsigned int num);
73+
int ip6_tnl_encap_setup(struct ip6_tnl *t,
74+
struct ip_tunnel_encap *ipencap);
75+
76+
static inline int ip6_encap_hlen(struct ip_tunnel_encap *e)
77+
{
78+
const struct ip6_tnl_encap_ops *ops;
79+
int hlen = -EINVAL;
80+
81+
if (e->type == TUNNEL_ENCAP_NONE)
82+
return 0;
83+
84+
if (e->type >= MAX_IPTUN_ENCAP_OPS)
85+
return -EINVAL;
86+
87+
rcu_read_lock();
88+
ops = rcu_dereference(ip6tun_encaps[e->type]);
89+
if (likely(ops && ops->encap_hlen))
90+
hlen = ops->encap_hlen(e);
91+
rcu_read_unlock();
92+
93+
return hlen;
94+
}
95+
96+
static inline int ip6_tnl_encap(struct sk_buff *skb, struct ip6_tnl *t,
97+
u8 *protocol, struct flowi6 *fl6)
98+
{
99+
const struct ip6_tnl_encap_ops *ops;
100+
int ret = -EINVAL;
101+
102+
if (t->encap.type == TUNNEL_ENCAP_NONE)
103+
return 0;
104+
105+
if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
106+
return -EINVAL;
107+
108+
rcu_read_lock();
109+
ops = rcu_dereference(ip6tun_encaps[t->encap.type]);
110+
if (likely(ops && ops->build_header))
111+
ret = ops->build_header(skb, &t->encap, protocol, fl6);
112+
rcu_read_unlock();
113+
114+
return ret;
115+
}
116+
59117
/* Tunnel encapsulation limit destination sub-option */
60118

61119
struct ipv6_tlv_tnl_enc_lim {

include/net/ip_tunnels.h

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,6 @@ struct ip_tunnel_net {
171171
struct ip_tunnel __rcu *collect_md_tun;
172172
};
173173

174-
struct ip_tunnel_encap_ops {
175-
size_t (*encap_hlen)(struct ip_tunnel_encap *e);
176-
int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
177-
u8 *protocol, struct flowi4 *fl4);
178-
};
179-
180-
#define MAX_IPTUN_ENCAP_OPS 8
181-
182-
extern const struct ip_tunnel_encap_ops __rcu *
183-
iptun_encaps[MAX_IPTUN_ENCAP_OPS];
184-
185-
int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,
186-
unsigned int num);
187-
int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
188-
unsigned int num);
189-
190174
static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
191175
__be32 saddr, __be32 daddr,
192176
u8 tos, u8 ttl, __be32 label,
@@ -251,8 +235,6 @@ void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops);
251235
void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
252236
const struct iphdr *tnl_params, const u8 protocol);
253237
int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
254-
int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
255-
u8 *protocol, struct flowi4 *fl4);
256238
int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
257239
int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
258240

@@ -271,9 +253,67 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
271253
int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
272254
struct ip_tunnel_parm *p);
273255
void ip_tunnel_setup(struct net_device *dev, int net_id);
256+
257+
struct ip_tunnel_encap_ops {
258+
size_t (*encap_hlen)(struct ip_tunnel_encap *e);
259+
int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
260+
u8 *protocol, struct flowi4 *fl4);
261+
};
262+
263+
#define MAX_IPTUN_ENCAP_OPS 8
264+
265+
extern const struct ip_tunnel_encap_ops __rcu *
266+
iptun_encaps[MAX_IPTUN_ENCAP_OPS];
267+
268+
int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,
269+
unsigned int num);
270+
int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
271+
unsigned int num);
272+
274273
int ip_tunnel_encap_setup(struct ip_tunnel *t,
275274
struct ip_tunnel_encap *ipencap);
276275

276+
static inline int ip_encap_hlen(struct ip_tunnel_encap *e)
277+
{
278+
const struct ip_tunnel_encap_ops *ops;
279+
int hlen = -EINVAL;
280+
281+
if (e->type == TUNNEL_ENCAP_NONE)
282+
return 0;
283+
284+
if (e->type >= MAX_IPTUN_ENCAP_OPS)
285+
return -EINVAL;
286+
287+
rcu_read_lock();
288+
ops = rcu_dereference(iptun_encaps[e->type]);
289+
if (likely(ops && ops->encap_hlen))
290+
hlen = ops->encap_hlen(e);
291+
rcu_read_unlock();
292+
293+
return hlen;
294+
}
295+
296+
static inline int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
297+
u8 *protocol, struct flowi4 *fl4)
298+
{
299+
const struct ip_tunnel_encap_ops *ops;
300+
int ret = -EINVAL;
301+
302+
if (t->encap.type == TUNNEL_ENCAP_NONE)
303+
return 0;
304+
305+
if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
306+
return -EINVAL;
307+
308+
rcu_read_lock();
309+
ops = rcu_dereference(iptun_encaps[t->encap.type]);
310+
if (likely(ops && ops->build_header))
311+
ret = ops->build_header(skb, &t->encap, protocol, fl4);
312+
rcu_read_unlock();
313+
314+
return ret;
315+
}
316+
277317
/* Extract dsfield from inner protocol */
278318
static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
279319
const struct sk_buff *skb)

net/core/ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
8484
[NETIF_F_FSO_BIT] = "tx-fcoe-segmentation",
8585
[NETIF_F_GSO_GRE_BIT] = "tx-gre-segmentation",
8686
[NETIF_F_GSO_GRE_CSUM_BIT] = "tx-gre-csum-segmentation",
87-
[NETIF_F_GSO_IPIP_BIT] = "tx-ipip-segmentation",
88-
[NETIF_F_GSO_SIT_BIT] = "tx-sit-segmentation",
87+
[NETIF_F_GSO_IPXIP4_BIT] = "tx-ipxip4-segmentation",
88+
[NETIF_F_GSO_IPXIP6_BIT] = "tx-ipxip6-segmentation",
8989
[NETIF_F_GSO_UDP_TUNNEL_BIT] = "tx-udp_tnl-segmentation",
9090
[NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
9191
[NETIF_F_GSO_PARTIAL_BIT] = "tx-gso-partial",

0 commit comments

Comments
 (0)