summaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2016-08-24 23:10:43 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-31 01:27:18 -0400
commit14972cbd34ff668c390cbd2e6497323484c9e812 (patch)
tree2931fb8d4a03a3ecf457f9789abd802cecdc4fbb /net/mpls
parent41852497a9205964b958a245a9526040b980926f (diff)
net: lwtunnel: Handle fragmentation
Today mpls iptunnel lwtunnel_output redirect expects the tunnel output function to handle fragmentation. This is ok but can be avoided if we did not do the mpls output redirect too early. ie we could wait until ip fragmentation is done and then call mpls output for each ip fragment. To make this work we will need, 1) the lwtunnel state to carry encap headroom 2) and do the redirect to the encap output handler on the ip fragment (essentially do the output redirect after fragmentation) This patch adds tunnel headroom in lwtstate to make sure we account for tunnel data in mtu calculations during fragmentation and adds new xmit redirect handler to redirect to lwtunnel xmit func after ip fragmentation. This includes IPV6 and some mtu fixes and testing from David Ahern. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls')
-rw-r--r--net/mpls/mpls_iptunnel.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 644a8da6d4bd..aed872cc05a6 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -37,7 +37,7 @@ static unsigned int mpls_encap_size(struct mpls_iptunnel_encap *en)
37 return en->labels * sizeof(struct mpls_shim_hdr); 37 return en->labels * sizeof(struct mpls_shim_hdr);
38} 38}
39 39
40static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb) 40static int mpls_xmit(struct sk_buff *skb)
41{ 41{
42 struct mpls_iptunnel_encap *tun_encap_info; 42 struct mpls_iptunnel_encap *tun_encap_info;
43 struct mpls_shim_hdr *hdr; 43 struct mpls_shim_hdr *hdr;
@@ -115,7 +115,7 @@ static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb)
115 net_dbg_ratelimited("%s: packet transmission failed: %d\n", 115 net_dbg_ratelimited("%s: packet transmission failed: %d\n",
116 __func__, err); 116 __func__, err);
117 117
118 return 0; 118 return LWTUNNEL_XMIT_DONE;
119 119
120drop: 120drop:
121 kfree_skb(skb); 121 kfree_skb(skb);
@@ -153,7 +153,8 @@ static int mpls_build_state(struct net_device *dev, struct nlattr *nla,
153 if (ret) 153 if (ret)
154 goto errout; 154 goto errout;
155 newts->type = LWTUNNEL_ENCAP_MPLS; 155 newts->type = LWTUNNEL_ENCAP_MPLS;
156 newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT; 156 newts->flags |= LWTUNNEL_STATE_XMIT_REDIRECT;
157 newts->headroom = mpls_encap_size(tun_encap_info);
157 158
158 *ts = newts; 159 *ts = newts;
159 160
@@ -209,7 +210,7 @@ static int mpls_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
209 210
210static const struct lwtunnel_encap_ops mpls_iptun_ops = { 211static const struct lwtunnel_encap_ops mpls_iptun_ops = {
211 .build_state = mpls_build_state, 212 .build_state = mpls_build_state,
212 .output = mpls_output, 213 .xmit = mpls_xmit,
213 .fill_encap = mpls_fill_encap_info, 214 .fill_encap = mpls_fill_encap_info,
214 .get_encap_size = mpls_encap_nlsize, 215 .get_encap_size = mpls_encap_nlsize,
215 .cmp_encap = mpls_encap_cmp, 216 .cmp_encap = mpls_encap_cmp,