diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-10-07 17:48:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-08 07:27:01 -0400 |
commit | 57c4bf859cad9d6c4f73d8c98a95e00f156301e0 (patch) | |
tree | 7fc1b076a979efaf3516e678bc0db71541eab927 /drivers/net/ipvlan/ipvlan_core.c | |
parent | a7093fefa543afad2bf292bba163800e81a4ba33 (diff) |
ipvlan: Cache net in ipvlan_process_v4_outbound and ipvlan_process_v6_outbound
Compute net once in ipvlan_process_v4_outbound and
ipvlan_process_v6_outbound and store it in a variable so that net does
not need to be recomputed next time it is used.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipvlan/ipvlan_core.c')
-rw-r--r-- | drivers/net/ipvlan/ipvlan_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 75dcf36c0366..976f30b291f6 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c | |||
@@ -344,6 +344,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) | |||
344 | { | 344 | { |
345 | const struct iphdr *ip4h = ip_hdr(skb); | 345 | const struct iphdr *ip4h = ip_hdr(skb); |
346 | struct net_device *dev = skb->dev; | 346 | struct net_device *dev = skb->dev; |
347 | struct net *net = dev_net(dev); | ||
347 | struct rtable *rt; | 348 | struct rtable *rt; |
348 | int err, ret = NET_XMIT_DROP; | 349 | int err, ret = NET_XMIT_DROP; |
349 | struct flowi4 fl4 = { | 350 | struct flowi4 fl4 = { |
@@ -354,7 +355,7 @@ static int ipvlan_process_v4_outbound(struct sk_buff *skb) | |||
354 | .saddr = ip4h->saddr, | 355 | .saddr = ip4h->saddr, |
355 | }; | 356 | }; |
356 | 357 | ||
357 | rt = ip_route_output_flow(dev_net(dev), &fl4, NULL); | 358 | rt = ip_route_output_flow(net, &fl4, NULL); |
358 | if (IS_ERR(rt)) | 359 | if (IS_ERR(rt)) |
359 | goto err; | 360 | goto err; |
360 | 361 | ||
@@ -381,6 +382,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) | |||
381 | { | 382 | { |
382 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); | 383 | const struct ipv6hdr *ip6h = ipv6_hdr(skb); |
383 | struct net_device *dev = skb->dev; | 384 | struct net_device *dev = skb->dev; |
385 | struct net *net = dev_net(dev); | ||
384 | struct dst_entry *dst; | 386 | struct dst_entry *dst; |
385 | int err, ret = NET_XMIT_DROP; | 387 | int err, ret = NET_XMIT_DROP; |
386 | struct flowi6 fl6 = { | 388 | struct flowi6 fl6 = { |
@@ -393,7 +395,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb) | |||
393 | .flowi6_proto = ip6h->nexthdr, | 395 | .flowi6_proto = ip6h->nexthdr, |
394 | }; | 396 | }; |
395 | 397 | ||
396 | dst = ip6_route_output(dev_net(dev), NULL, &fl6); | 398 | dst = ip6_route_output(net, NULL, &fl6); |
397 | if (dst->error) { | 399 | if (dst->error) { |
398 | ret = dst->error; | 400 | ret = dst->error; |
399 | dst_release(dst); | 401 | dst_release(dst); |