[qca-nss-sfe] Bridge acceleration support

 Support bridge acceleration

Change-Id: Id4305ccd42b1b343be9716c4e5f25f5a0f5aa024
Signed-off-by: Ratheesh Kannoth <quic_rkannoth@quicinc.com>
diff --git a/sfe_ipv6_tcp.c b/sfe_ipv6_tcp.c
index 8c2b0cc..f70fea5 100644
--- a/sfe_ipv6_tcp.c
+++ b/sfe_ipv6_tcp.c
@@ -128,6 +128,7 @@
 	struct net_device *xmit_dev;
 	bool ret;
 	bool hw_csum;
+	bool bridge_flow;
 
 	/*
 	 * Is our packet too short to contain a valid UDP header?
@@ -221,23 +222,27 @@
 	}
 #endif
 
+	bridge_flow = !!(cm->flags & SFE_IPV6_CONNECTION_MATCH_FLAG_BRIDGE_FLOW);
+
 	/*
 	 * Does our hop_limit allow forwarding?
 	 */
-	if (unlikely(iph->hop_limit < 2)) {
-		struct sfe_ipv6_connection *c = cm->connection;
-		spin_lock_bh(&si->lock);
-		ret = sfe_ipv6_remove_connection(si, c);
-		spin_unlock_bh(&si->lock);
+	if (likely(!bridge_flow)) {
+		if (unlikely(iph->hop_limit < 2)) {
+			struct sfe_ipv6_connection *c = cm->connection;
+			spin_lock_bh(&si->lock);
+			ret = sfe_ipv6_remove_connection(si, c);
+			spin_unlock_bh(&si->lock);
 
-		DEBUG_TRACE("hop_limit too low\n");
-		if (ret) {
-			sfe_ipv6_flush_connection(si, c, SFE_SYNC_REASON_FLUSH);
+			DEBUG_TRACE("hop_limit too low\n");
+			if (ret) {
+				sfe_ipv6_flush_connection(si, c, SFE_SYNC_REASON_FLUSH);
+			}
+			rcu_read_unlock();
+
+			sfe_ipv6_exception_stats_inc(si, SFE_IPV6_EXCEPTION_EVENT_TCP_SMALL_TTL);
+			return 0;
 		}
-		rcu_read_unlock();
-
-		sfe_ipv6_exception_stats_inc(si, SFE_IPV6_EXCEPTION_EVENT_TCP_SMALL_TTL);
-		return 0;
 	}
 
 	/*
@@ -556,7 +561,9 @@
 	/*
 	 * Decrement our hop_limit.
 	 */
-	iph->hop_limit -= 1;
+	if (likely(!bridge_flow)) {
+		iph->hop_limit -= 1;
+	}
 
 	/*
 	 * Enable HW csum if rx checksum is verified and xmit interface is CSUM offload capable.