net: Kernel changes for Generic Software Bridge(GSB)

Changes are made to let GSB intercept network packets and consume them
when possible. The goal is to bridge the packets directly to backhaul
without letting packet do a round trip through the network stack.

Acked-by: Vinisha Varre <vvarre@qti.qualcomm.com>
Signed-off-by: Justin Tee <justint@codeaurora.org>
Change-Id: I274da3196b4488f80ff9fc223d1f6ba0d04d3832
diff --git a/net/core/dev.c b/net/core/dev.c
index 5685744..49f17ff 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4171,6 +4171,9 @@
 	return 0;
 }
 
+int (*gsb_nw_stack_recv)(struct sk_buff *skb) __rcu __read_mostly;
+EXPORT_SYMBOL(gsb_nw_stack_recv);
+
 int (*athrs_fast_nat_recv)(struct sk_buff *skb) __rcu __read_mostly;
 EXPORT_SYMBOL(athrs_fast_nat_recv);
 
@@ -4185,6 +4188,7 @@
 	bool deliver_exact = false;
 	int ret = NET_RX_DROP;
 	__be16 type;
+	int (*gsb_ns_recv)(struct sk_buff *skb);
 	int (*fast_recv)(struct sk_buff *skb);
 	int (*embms_recv)(struct sk_buff *skb);
 
@@ -4246,6 +4250,13 @@
 			goto out;
 	}
 #endif
+	gsb_ns_recv = rcu_dereference(gsb_nw_stack_recv);
+		if (gsb_ns_recv) {
+			if (gsb_ns_recv(skb)) {
+				ret = NET_RX_SUCCESS;
+				goto out;
+		}
+	}
 	fast_recv = rcu_dereference(athrs_fast_nat_recv);
 	if (fast_recv) {
 		if (fast_recv(skb)) {