Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e474e4ec authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan Committed by Gerrit - the friendly Code Review server
Browse files

dfc: TCP pure acks



Detects TCP pure acks so they can be put in the dedicated TX queues
even if they contain various options.

Change-Id: I6a9b714ccb58616ff49a150467d33a348d88ec64
Acked-by: default avatarWeiyi Chen <weiyic@qti.qualcomm.com>
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 17aa9d79
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/rtnetlink.h>
#include <uapi/linux/rtnetlink.h>
#include <net/pkt_sched.h>
#include <net/tcp.h>
#include "qmi_rmnet_i.h"
#include <trace/events/dfc.h>
#include <linux/ip.h>
@@ -868,16 +869,14 @@ void qmi_rmnet_burst_fc_check(struct net_device *dev,
}
EXPORT_SYMBOL(qmi_rmnet_burst_fc_check);

static bool qmi_rmnet_is_tcp_ack(struct sk_buff *skb)
static bool _qmi_rmnet_is_tcp_ack(struct sk_buff *skb)
{
	unsigned int len = skb->len;

	switch (skb->protocol) {
	/* TCPv4 ACKs */
	case htons(ETH_P_IP):
		if ((ip_hdr(skb)->protocol == IPPROTO_TCP) &&
		    (ip_hdr(skb)->ihl == 5) &&
		    (len == 40 || len == 52) &&
		    (ntohs(ip_hdr(skb)->tot_len) - (ip_hdr(skb)->ihl << 2) ==
		      tcp_hdr(skb)->doff << 2) &&
		    ((tcp_flag_word(tcp_hdr(skb)) &
		      cpu_to_be32(0x00FF0000)) == TCP_FLAG_ACK))
			return true;
@@ -886,7 +885,8 @@ static bool qmi_rmnet_is_tcp_ack(struct sk_buff *skb)
	/* TCPv6 ACKs */
	case htons(ETH_P_IPV6):
		if ((ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) &&
		    (len == 60 || len == 72) &&
		    (ntohs(ipv6_hdr(skb)->payload_len) ==
		      (tcp_hdr(skb)->doff) << 2) &&
		    ((tcp_flag_word(tcp_hdr(skb)) &
		      cpu_to_be32(0x00FF0000)) == TCP_FLAG_ACK))
			return true;
@@ -896,6 +896,19 @@ static bool qmi_rmnet_is_tcp_ack(struct sk_buff *skb)
	return false;
}

static inline bool qmi_rmnet_is_tcp_ack(struct sk_buff *skb)
{
	/* Locally generated TCP acks */
	if (skb_is_tcp_pure_ack(skb))
		return true;

	/* Forwarded */
	if (unlikely(_qmi_rmnet_is_tcp_ack(skb)))
		return true;

	return false;
}

static int qmi_rmnet_get_queue_sa(struct qos_info *qos, struct sk_buff *skb)
{
	struct rmnet_flow_map *itm;