Pārlūkot izejas kodu

core: Add trace point for gso verification

This patch adds trace events to help with debug for gso feature
by identifying the packets (and their lengths) that are using
the segmentation offload feature.

Adding source and destination port number info
in the gso trace events to differentiate between
the flows.

CRs-Fixed: 2697145
Change-Id: I4f9786afa799cb1589bd07393c0922913037390d
Signed-off-by: Subash Abhinov Kasiviswanathan <[email protected]>
Subash Abhinov Kasiviswanathan 5 gadi atpakaļ
vecāks
revīzija
17190b7e11
2 mainītis faili ar 49 papildinājumiem un 1 dzēšanām
  1. 28 1
      core/rmnet_trace.h
  2. 21 0
      core/rmnet_vnd.c

+ 28 - 1
core/rmnet_trace.h

@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -101,6 +101,33 @@ DEFINE_EVENT
 
 );
 
+TRACE_EVENT(print_skb_gso,
+
+	TP_PROTO(struct sk_buff *skb, __be16 src, __be16 dest),
+
+	TP_ARGS(skb, src, dest),
+
+	TP_STRUCT__entry(
+		__field(void *,	skbaddr)
+		__field(int, len)
+		__field(int, data_len)
+		__field(__be16, src)
+		__field(__be16, dest)
+	),
+
+	TP_fast_assign(
+		__entry->skbaddr = skb;
+		__entry->len = skb->len;
+		__entry->data_len = skb->data_len;
+		__entry->src = src;
+		__entry->dest = dest;
+	),
+
+	TP_printk("GSO: skbaddr=%pK, len=%d, data_len=%d, src=%u, dest=%u",
+		__entry->skbaddr, __entry->len, __entry->data_len,
+		be16_to_cpu(__entry->src), be16_to_cpu(__entry->dest))
+);
+
 /*****************************************************************************/
 /* Trace events for rmnet_perf module */
 /*****************************************************************************/

+ 21 - 0
core/rmnet_vnd.c

@@ -17,6 +17,8 @@
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <linux/ip.h>
+#include <linux/ipv6.h>
+#include <linux/tcp.h>
 #include <net/pkt_sched.h>
 #include "rmnet_config.h"
 #include "rmnet_handlers.h"
@@ -171,6 +173,25 @@ static u16 rmnet_vnd_select_queue(struct net_device *dev,
 	int boost_trigger = 0;
 	int txq = 0;
 
+	if (trace_print_skb_gso_enabled()) {
+		if (!skb_shinfo(skb)->gso_size)
+			goto skip_trace;
+
+		if (skb->protocol == htons(ETH_P_IP)) {
+			if (ip_hdr(skb)->protocol != IPPROTO_TCP)
+				goto skip_trace;
+		}
+
+		if (skb->protocol == htons(ETH_P_IPV6)) {
+			if (ipv6_hdr(skb)->nexthdr != IPPROTO_TCP)
+				goto skip_trace;
+		}
+
+		trace_print_skb_gso(skb, tcp_hdr(skb)->source,
+				    tcp_hdr(skb)->dest);
+	}
+
+skip_trace:
 	if (priv->real_dev)
 		txq = qmi_rmnet_get_queue(dev, skb);