diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-03-08 10:12:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-09 16:09:19 -0500 |
commit | 8344bfc6008d1c7b8b541bb25de7dfacb2188b95 (patch) | |
tree | bd3b346eee41d1517a07884e3a4112abf2b01d06 /net/ipv4/ipip.c | |
parent | 720a43efd30f04a0a492c85fb997361c44fbae05 (diff) |
ipip: Use tunnel_ip_select_ident() for tunnel IP-Identification.
tunnel_ip_select_ident() is more efficient when generating ip-header
id given inner packet is of ipv4 type.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r-- | net/ipv4/ipip.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 8f024d41eefa..18f535299ef9 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -478,6 +478,8 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
478 | __be32 dst = tiph->daddr; | 478 | __be32 dst = tiph->daddr; |
479 | struct flowi4 fl4; | 479 | struct flowi4 fl4; |
480 | int mtu; | 480 | int mtu; |
481 | int err; | ||
482 | int pkt_len; | ||
481 | 483 | ||
482 | if (skb->protocol != htons(ETH_P_IP)) | 484 | if (skb->protocol != htons(ETH_P_IP)) |
483 | goto tx_error; | 485 | goto tx_error; |
@@ -591,11 +593,28 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
591 | iph->tos = INET_ECN_encapsulate(tos, old_iph->tos); | 593 | iph->tos = INET_ECN_encapsulate(tos, old_iph->tos); |
592 | iph->daddr = fl4.daddr; | 594 | iph->daddr = fl4.daddr; |
593 | iph->saddr = fl4.saddr; | 595 | iph->saddr = fl4.saddr; |
596 | tunnel_ip_select_ident(skb, old_iph, &rt->dst); | ||
594 | 597 | ||
595 | if ((iph->ttl = tiph->ttl) == 0) | 598 | if ((iph->ttl = tiph->ttl) == 0) |
596 | iph->ttl = old_iph->ttl; | 599 | iph->ttl = old_iph->ttl; |
597 | 600 | ||
598 | iptunnel_xmit(skb, dev); | 601 | nf_reset(skb); |
602 | skb->ip_summed = CHECKSUM_NONE; | ||
603 | |||
604 | pkt_len = skb->len - skb_transport_offset(skb); | ||
605 | err = ip_local_out(skb); | ||
606 | if (likely(net_xmit_eval(err) == 0)) { | ||
607 | struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); | ||
608 | |||
609 | u64_stats_update_begin(&tstats->syncp); | ||
610 | tstats->tx_bytes += pkt_len; | ||
611 | tstats->tx_packets++; | ||
612 | u64_stats_update_end(&tstats->syncp); | ||
613 | } else { | ||
614 | dev->stats.tx_errors++; | ||
615 | dev->stats.tx_aborted_errors++; | ||
616 | } | ||
617 | |||
599 | return NETDEV_TX_OK; | 618 | return NETDEV_TX_OK; |
600 | 619 | ||
601 | tx_error_icmp: | 620 | tx_error_icmp: |