[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220209073108.7f82306f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 9 Feb 2022 07:31:08 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: yajun.deng@...ux.dev
Cc: davem@...emloft.net, rostedt@...dmis.org, mingo@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: dev: introduce netdev_drop_inc()
On Wed, 09 Feb 2022 07:27:44 +0000 yajun.deng@...ux.dev wrote:
> February 9, 2022 11:53 AM, "Jakub Kicinski" <kuba@...nel.org> wrote:
> > IIRC perf support filters, I think with -f? We can't add a tracepoint
> > for every combination of attributes.
>
> Yes, we can use a command like this: " sudo perf record -g -a -e skb:kfree_skb --filter 'protocol == 0x0800' ",
> However, only the filter is defined in kfree_skb tracepoint are available.
>
> The purpose of this patch is record {rx_dropped, tx_dropped, rx_nohandler} in struct net_device, to distinguish
> with struct net_device_stats.
>
> We don't have any tracepoint records {rx_dropped, tx_dropped, rx_nohandler} in struct net_device now.
> Can we add {rx_dropped, tx_dropped, rx_nohandler} in kfree_skb tracepoint? like this:
>
> TP_STRUCT__entry(
> __field(void *, skbaddr)
> __field(void *, location)
> __field(unsigned short, protocol)
> __field(enum skb_drop_reason, reason)
> __field(unsigned long, rx_dropped)
> __field(unsigned long, tx_dropped)
> __field(unsigned long, rx_nohandler)
>
> ),
>
> TP_fast_assign(
> __entry->skbaddr = skb;
> __entry->location = location;
> __entry->protocol = ntohs(skb->protocol);
> __entry->reason = reason;
> __entry->rx_dropped = (unsigned long)atomic_long_read(&skb->dev->rx_dropped);
> __entry->tx_dropped = (unsigned long)atomic_long_read(&skb->dev->tx_dropped);
> __entry->rx_nohandler = (unsigned long)atomic_long_read(&skb->dev->rx_nohandler);
> ),
>
> If so, we can record this but not add a tracepoint.
You can use bpftrace to dereference extra information.
Powered by blists - more mailing lists