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

Commit 1eeb0723 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

net: qualcomm: rmnet: Call the GRO handler for TCP packets only



While running a UDP test using gro handler, there was a slight
increase in MIPS observed. This is because all UDP packets passed
through napi_gro_receive need to be checked if it is an encapsulated
UDP packet which could actually be coalesced and processed further.

As of now, clients of rmnet_data do not support this and we can
save MIPS on this by passing only TCP packets through the GRO
handler. All non TCP packets will directly be passed directly to
the network stack. This also helps us to avoid an atomic operation
unnecessarily when GRO path is not exercised.

There is 1% savings in MIPS observed when using a single stream
UDP DL connection at 300Mbps.

CRs-Fixed: 2156182
Change-Id: Ib10b3a28cf7193b1da65227cdb543b8da689dfdb
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent c9263320
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include <linux/netdevice.h>
#include <linux/netdev_features.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <net/sock.h>
#include "rmnet_private.h"
#include "rmnet_config.h"
@@ -28,6 +30,22 @@

/* Helper Functions */

static int rmnet_check_skb_can_gro(struct sk_buff *skb)
{
	switch(skb->protocol) {
	case htons(ETH_P_IP):
		if (ip_hdr(skb)->protocol == IPPROTO_TCP)
			return 0;
		break;
	case htons(ETH_P_IPV6):
		if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
			return 0;
		/* Fall through */
	}

	return -EPROTONOSUPPORT;
}

static void rmnet_set_skb_proto(struct sk_buff *skb)
{
	switch (skb->data[0] & 0xF0) {
@@ -56,7 +74,11 @@ rmnet_deliver_skb(struct sk_buff *skb)

	skb->pkt_type = PACKET_HOST;
	skb_set_mac_header(skb, 0);

	if (!rmnet_check_skb_can_gro(skb))
		gro_cells_receive(&priv->gro_cells, skb);
	else
		netif_receive_skb(skb);
}

/* MAP handler */