Files
openwrt-R7800-nss/target/linux/ipq806x/patches-6.6/990-047-net-Enable-fast-path-support-for-6RD-DS-Lite.patch
SqTER-PL 21b3787542 Updated iptunnel patches. Switch to codelinaro.org source.
Minor fixes and patch sorting.
2025-08-04 18:52:30 +02:00

111 lines
3.7 KiB
Diff

From 365bac798ea16e3eb34d8c164b94bc3a4c1fcc51 Mon Sep 17 00:00:00 2001
From: Murat Sezgin <quic_msezgin@quicinc.com>
Date: Tue, 20 Jun 2023 13:19:29 -0700
Subject: [PATCH 274/500] net: Enable fast path support for 6RD, DS-Lite
1). Added stats update function
2). Added changes to set the skb->skb_iif to tunnel dev
Change-Id: I7f43746436b4f6483952997fdf91180096d3ed62
Signed-off-by: Shyam Sunder <ssunde@codeaurora.org>
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
Signed-off-by: John Sanli <quic_jsanli@quicinc.com>
Signed-off-by: Pavithra R <quic_pavir@quicinc.com>
---
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -100,6 +100,23 @@ static inline int ip6_tnl_mpls_supported
#define for_each_ip6_tunnel_rcu(start) \
for (t = rcu_dereference(start); t; t = rcu_dereference(t->next))
+/*
+ * Update offload stats
+ */
+void ip6_update_offload_stats(struct net_device *dev, void *ptr)
+{
+ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+ const struct pcpu_sw_netstats *offload_stats =
+ (struct pcpu_sw_netstats *)ptr;
+
+ u64_stats_update_begin(&tstats->syncp);
+ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets));
+ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes));
+ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets));
+ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes));
+ u64_stats_update_end(&tstats->syncp);
+}
+EXPORT_SYMBOL(ip6_update_offload_stats);
/**
* ip6_tnl_lookup - fetch tunnel matching the end-point addresses
* @net: network namespace
@@ -1024,6 +1041,9 @@ static int __ip6_tnl_rcv(struct ip6_tnl
if (tun_dst)
skb_dst_set(skb, (struct dst_entry *)tun_dst);
+ /* Reset the skb_iif to Tunnels interface index */
+ skb->skb_iif = tunnel->dev->ifindex;
+
gro_cells_receive(&tunnel->gro_cells, skb);
return 0;
@@ -1105,7 +1125,6 @@ static int ipxip6_rcv(struct sk_buff *sk
rcu_read_unlock();
return ret;
-
drop:
rcu_read_unlock();
kfree_skb(skb);
@@ -1424,6 +1443,9 @@ route_lookup:
ipv6h->nexthdr = proto;
ipv6h->saddr = fl6->saddr;
ipv6h->daddr = fl6->daddr;
+
+ /* Reset the skb_iif to Tunnels interface index */
+ skb->skb_iif = dev->ifindex;
ip6tunnel_xmit(NULL, skb, dev);
return 0;
tx_err_link_failure:
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -90,6 +90,20 @@ static inline struct sit_net *dev_to_sit
return net_generic(t->net, sit_net_id);
}
+void ipip6_update_offload_stats(struct net_device *dev, void *ptr)
+{
+ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+ const struct pcpu_sw_netstats *offload_stats =
+ (struct pcpu_sw_netstats *)ptr;
+
+ u64_stats_update_begin(&tstats->syncp);
+ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets));
+ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes));
+ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets));
+ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes));
+ u64_stats_update_end(&tstats->syncp);
+}
+EXPORT_SYMBOL(ipip6_update_offload_stats);
/*
* Must be invoked with rcu_read_lock
*/
@@ -722,6 +736,8 @@ static int ipip6_rcv(struct sk_buff *skb
dev_sw_netstats_rx_add(tunnel->dev, skb->len);
+ /* Reset the skb_iif to Tunnels interface index */
+ skb->skb_iif = tunnel->dev->ifindex;
netif_rx(skb);
return 0;
@@ -1031,6 +1047,8 @@ static netdev_tx_t ipip6_tunnel_xmit(str
skb_set_inner_ipproto(skb, IPPROTO_IPV6);
+ /* Reset the skb_iif to Tunnels interface index */
+ skb->skb_iif = tunnel->dev->ifindex;
iptunnel_xmit(NULL, rt, skb, fl4.saddr, fl4.daddr, protocol, tos, ttl,
df, !net_eq(tunnel->net, dev_net(dev)));
return NETDEV_TX_OK;