[qca-nss-sfe] Support VLAN offload in SFE in Tun6rd
VLAN tagging(encapsulation) and untag(decapsulation)
can be accelerated in SFE for Tun6rd.
Signed-off-by: Tian Yang <quic_tiany@quicinc.com>
Change-Id: If79b930f8c4ff194e48f209bb63be639913093be
diff --git a/sfe_ipv4.c b/sfe_ipv4.c
index 107595a..b1c2cc4 100644
--- a/sfe_ipv4.c
+++ b/sfe_ipv4.c
@@ -530,6 +530,13 @@
}
/*
+ * dereference the decap direction top_interface_dev
+ */
+ if (c->reply_match->top_interface_dev) {
+ dev_put(c->reply_match->top_interface_dev);
+ }
+
+ /*
* Remove the connection match objects.
*/
sfe_ipv4_remove_connection_match(si, c->reply_match);
@@ -1612,6 +1619,8 @@
*/
original_cm->proto = NULL;
reply_cm->proto = NULL;
+ original_cm->top_interface_dev = NULL;
+ reply_cm->top_interface_dev = NULL;
#ifdef SFE_GRE_TUN_ENABLE
if ((IPPROTO_GRE == tuple->protocol) && !(reply_cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_PASSTHROUGH)) {
@@ -1636,6 +1645,20 @@
rcu_read_lock();
reply_cm->proto = rcu_dereference(inet_protos[IPPROTO_IPV6]);
rcu_read_unlock();
+ reply_cm->top_interface_dev = dev_get_by_index(&init_net, msg->conn_rule.return_top_interface_num);
+
+ if (unlikely(!reply_cm->top_interface_dev)) {
+ DEBUG_WARN("%px: Unable to find top_interface_dev corresponding to %d\n", msg,
+ msg->conn_rule.return_top_interface_num);
+ this_cpu_inc(si->stats_pcpu->connection_create_failures64);
+ spin_unlock_bh(&si->lock);
+ kfree(reply_cm);
+ kfree(original_cm);
+ kfree(c);
+ dev_put(src_dev);
+ dev_put(dest_dev);
+ return -EINVAL;
+ }
}
#ifdef CONFIG_NF_FLOW_COOKIE