Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2543363imm; Thu, 16 Aug 2018 11:11:36 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzx0VrW6UuE6GQtrSIF7tkt3u8LLkY5RJlEr7TZxlBZepUmAY6Tsb337pm1JV1uoWgiP5uN X-Received: by 2002:a62:5ec3:: with SMTP id s186-v6mr27919871pfb.146.1534443095954; Thu, 16 Aug 2018 11:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534443095; cv=none; d=google.com; s=arc-20160816; b=L4ObrdR6lxwZL517Fd5/HaGWOc5sWU7eSzC784bx8n5MoC5qiLU67MgK7ljnNrwaN+ M5Rv5FD1j6jI7QzK4ssbX9WEDzP15aHaNbgB22HOaj1Fl9nKGgbfwo3y/EgB254suNzV wHiVoesWTlLJ8aoFsCFqHlW74/nx3+aSPaQIJPV6gzJ2wSLXZxEaDeJ6oyyRJ5Qh/L/Q whXba7RKiWvEDLojL0AIHL3kBe46AXqMkLVGkN+5VRQ6L4JbpM9hc7Yy0erIQXgodQlU gEMlrVTlle3G2BceCHFXn31k77GY6Ks6FZPxOo+qWRQrdQIVQCQLRhVAW0x9XT9UsVie Jf+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=1g4W4DPaKo8EPB3Yox5xayg40Vuqf10sRmiBShKv2lk=; b=bVGKZntXDYEvYlmmRSiqKikHLDHOIopawUHu3NB0XXJDy+Ja22rghwqUsrET2S36t0 DtOZQnt3wby73iDcJpk0L+TuoOPK/EltZnpV7HxMNMv156HhKzKcXRWHvGCruz7J17py QKhYBQ9lCdR+VvnP13pDgKewsFunbNS4Zpaq9Z+fU1z54ys5wEQi3hFSVAHhhm9G/Dk7 5XXsrvtDlpwb6Hy1ZAWRhPOvbkka62kyEBi+KCoTquohUXS2uu6TXSHs+yhmQ6l4gAJK AEU1WTBqi86CULgqYzLlD5ho5VmK4ClWmixcwGAWRNB9HX2BxMsdwhEjHuzu2M19QTAD cGDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20150623.gappssmtp.com header.s=20150623 header.b=xnsgcI5h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si20667951plr.470.2018.08.16.11.11.21; Thu, 16 Aug 2018 11:11:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20150623.gappssmtp.com header.s=20150623 header.b=xnsgcI5h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390502AbeHPM2P (ORCPT + 99 others); Thu, 16 Aug 2018 08:28:15 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33232 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731376AbeHPM2P (ORCPT ); Thu, 16 Aug 2018 08:28:15 -0400 Received: by mail-lf1-f65.google.com with SMTP id u14-v6so2925403lfu.0 for ; Thu, 16 Aug 2018 02:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization; bh=1g4W4DPaKo8EPB3Yox5xayg40Vuqf10sRmiBShKv2lk=; b=xnsgcI5h2HGvV3WSHfrPncUurTtTTGHpaW/85eJfbzThiuBqIc39gt1j4GimLNdj51 QxnVaSwZGnaD14yNSEtvSxLVpBy8u+fDHApdxfEh+PY48OTHUbdrz7xhF/DfrwD2ztX8 j2hZ3wywf/wiInKe0lzkY2mj3js6hSXzxNu/PlBC/9rBcog83BOWasHXi4iNUB2PkXk5 tukrvTedg2xQGfLU/Bag6lku+i1j7vjaZ6TP81f9sYGMmLDJJCLmhGCuJmR5E6X1luGi DYYNILjA21UpipfjgzbCuNd3LV3Vhny+iU2bayV6zB0YQQzQfO3PiOlou3Jm4mpVrT1E SJTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization; bh=1g4W4DPaKo8EPB3Yox5xayg40Vuqf10sRmiBShKv2lk=; b=YPHBkmMs3OhEU0VC/YN08i3SWGnP051o3j/qo/jPpHUVxeOxX/3Bh6sOrLkRakcuDx DtCSrMll//uEQQHeLjBJdRHws4UHogzlxJgUnS+yOKDpjlVgvPUs6XRx2w+0C9uwDd5f DWIXXCti1riP/3jFHj4W6y44KLLY+wEB8w+ZKV+sqpqjAyuA/aRMphIaFnhgrdIecqS+ ZSyQR5mEZ/bFO8njKF0TscjBmKbqbkziJWzLrDRAz3shtYZ6T799sIb86lcDWUnijADs HCOvTKUjazh5axuFWxCsrhseFoC6iekmd0q16V7LSlD0FGEgqfB7ZP5d93DcBVQ3MHnc Gr3A== X-Gm-Message-State: AOUpUlHDetEftpi3SDqqN8bF0dIOKyeHxFC7xxBgrDuNA5HGF15+B3S2 FXLIHV0Eo2omV1PKuw3njgn1hyF2n1YTlQ== X-Received: by 2002:a19:c715:: with SMTP id x21-v6mr3629083lff.110.1534411857339; Thu, 16 Aug 2018 02:30:57 -0700 (PDT) Received: from wkz-wmo.labs.westermo.se (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id l78-v6sm4982854lfl.4.2018.08.16.02.30.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 02:30:56 -0700 (PDT) From: Tobias Waldekranz To: Tobias Waldekranz Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:ETHERNET PHY LIBRARY) Subject: [PATCH] net: phy: add tracepoints Date: Thu, 16 Aug 2018 11:30:53 +0200 Message-Id: <20180816093056.2485-1-tobias@waldekranz.com> X-Mailer: git-send-email 2.17.1 Organization: Westermo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Two tracepoints for now: * `phy_interrupt` Pretty self-explanatory. * `phy_state_change` Whenever the PHY's state machine is run, trace the old and the new state. Signed-off-by: Tobias Waldekranz --- drivers/net/phy/phy.c | 4 +++ include/trace/events/phy.h | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 include/trace/events/phy.h diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9aabfa1a455a..8d22926f3962 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -38,6 +38,9 @@ #include +#define CREATE_TRACE_POINTS +#include + #define PHY_STATE_STR(_state) \ case PHY_##_state: \ return __stringify(_state); \ @@ -1039,6 +1042,7 @@ void phy_state_machine(struct work_struct *work) if (err < 0) phy_error(phydev); + trace_phy_state_change(phydev, old_state); if (old_state != phydev->state) phydev_dbg(phydev, "PHY state change %s -> %s\n", phy_state_to_str(old_state), diff --git a/include/trace/events/phy.h b/include/trace/events/phy.h new file mode 100644 index 000000000000..7ba6c0dda47e --- /dev/null +++ b/include/trace/events/phy.h @@ -0,0 +1,68 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM phy + +#if !defined(_TRACE_PHY_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_PHY_H + +#include + +TRACE_EVENT(phy_interrupt, + TP_PROTO(int irq, struct phy_device *phydev), + TP_ARGS(irq, phydev), + TP_STRUCT__entry( + __field(int, irq) + __field(int, addr) + __field(int, state) + __array(char, ifname, IFNAMSIZ) + ), + TP_fast_assign( + __entry->irq = irq; + __entry->addr = phydev->mdio.addr; + __entry->state = phydev->state; + if (phydev->attached_dev) + memcpy(__entry->ifname, + netdev_name(phydev->attached_dev), + IFNAMSIZ); + else + memset(__entry->ifname, 0, IFNAMSIZ); + ), + TP_printk("phy-%d-irq irq=%d ifname=%16s state=%d", + __entry->addr, + __entry->irq, + __entry->ifname, + __entry->state + ) + ); + +TRACE_EVENT(phy_state_change, + TP_PROTO(struct phy_device *phydev, enum phy_state old_state), + TP_ARGS(phydev, old_state), + TP_STRUCT__entry( + __field(int, addr) + __field(int, state) + __field(int, old_state) + __array(char, ifname, IFNAMSIZ) + ), + TP_fast_assign( + __entry->addr = phydev->mdio.addr; + __entry->state = phydev->state; + __entry->old_state = old_state; + if (phydev->attached_dev) + memcpy(__entry->ifname, + netdev_name(phydev->attached_dev), + IFNAMSIZ); + else + memset(__entry->ifname, 0, IFNAMSIZ); + ), + TP_printk("phy-%d-change ifname=%16s old_state=%d state=%d", + __entry->addr, + __entry->ifname, + __entry->old_state, + __entry->state + ) + ); + +#endif /* _TRACE_PHY_H */ + +/* This part must be outside protection */ +#include -- 2.17.1