[qca-nss-sfe] Fix UDP socket handling.
- __udp4_lib_lookup matches parameter "daddr" with local socket address.
Hence, need to pass local address as the destination.
- UDP checksum should be skipped for zero checksum value.
- UDP socket can be used for control packets that need to be passed to userspace.
Hence, SFE can't drop those packets and has to resubmit them into Linux stack.
Change-Id: Ia51e95791afe33078d9ba8001a05686892aab0a7
Signed-off-by: Hardik S. Panchal <quic_hpanchal@quicinc.com>
diff --git a/sfe_ipv4_esp.c b/sfe_ipv4_esp.c
index c21d6a7..f0b4941 100644
--- a/sfe_ipv4_esp.c
+++ b/sfe_ipv4_esp.c
@@ -257,6 +257,19 @@
skb->mark = cm->mark;
}
+ /*
+ * For the first packets, check if it could got fast xmit.
+ */
+ if (unlikely(!(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_FAST_XMIT_FLOW_CHECKED)
+ && (cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_FAST_XMIT_DEV_ADMISSION))){
+ cm->features = netif_skb_features(skb);
+ if (likely(sfe_fast_xmit_check(skb, cm->features))) {
+ cm->flags |= SFE_IPV4_CONNECTION_MATCH_FLAG_FAST_XMIT;
+ }
+ cm->flags |= SFE_IPV4_CONNECTION_MATCH_FLAG_FAST_XMIT_FLOW_CHECKED;
+ }
+
+ features = cm->features;
fast_xmit = !!(cm->flags & SFE_IPV4_CONNECTION_MATCH_FLAG_FAST_XMIT);
rcu_read_unlock();