From 17190b7e11a50bfefd6c5bf6ca30cab605c384ef Mon Sep 17 00:00:00 2001 From: Subash Abhinov Kasiviswanathan Date: Thu, 28 May 2020 22:14:41 -0600 Subject: [PATCH] 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 --- core/rmnet_trace.h | 29 ++++++++++++++++++++++++++++- core/rmnet_vnd.c | 21 +++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/core/rmnet_trace.h b/core/rmnet_trace.h index b1ae59b30c6a..28a2a2c6003c 100644 --- a/core/rmnet_trace.h +++ b/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 */ /*****************************************************************************/ diff --git a/core/rmnet_vnd.c b/core/rmnet_vnd.c index 5b36fe88e764..55da35c684a8 100644 --- a/core/rmnet_vnd.c +++ b/core/rmnet_vnd.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #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);