19538ebceSVladimir Oltean /* SPDX-License-Identifier: GPL-2.0 29538ebceSVladimir Oltean * Copyright 2022-2023 NXP 39538ebceSVladimir Oltean */ 49538ebceSVladimir Oltean 59538ebceSVladimir Oltean #undef TRACE_SYSTEM 69538ebceSVladimir Oltean #define TRACE_SYSTEM dsa 79538ebceSVladimir Oltean 89538ebceSVladimir Oltean #if !defined(_NET_DSA_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 99538ebceSVladimir Oltean #define _NET_DSA_TRACE_H 109538ebceSVladimir Oltean 119538ebceSVladimir Oltean #include <net/dsa.h> 12*02020bd7SVladimir Oltean #include <net/switchdev.h> 139538ebceSVladimir Oltean #include <linux/etherdevice.h> 14*02020bd7SVladimir Oltean #include <linux/if_bridge.h> 159538ebceSVladimir Oltean #include <linux/refcount.h> 169538ebceSVladimir Oltean #include <linux/tracepoint.h> 179538ebceSVladimir Oltean 189538ebceSVladimir Oltean /* Enough to fit "bridge %s num %d" where num has 3 digits */ 199538ebceSVladimir Oltean #define DSA_DB_BUFSIZ (IFNAMSIZ + 16) 209538ebceSVladimir Oltean 219538ebceSVladimir Oltean void dsa_db_print(const struct dsa_db *db, char buf[DSA_DB_BUFSIZ]); 229538ebceSVladimir Oltean const char *dsa_port_kind(const struct dsa_port *dp); 239538ebceSVladimir Oltean 249538ebceSVladimir Oltean DECLARE_EVENT_CLASS(dsa_port_addr_op_hw, 259538ebceSVladimir Oltean 269538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, u16 vid, 279538ebceSVladimir Oltean const struct dsa_db *db, int err), 289538ebceSVladimir Oltean 299538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, err), 309538ebceSVladimir Oltean 319538ebceSVladimir Oltean TP_STRUCT__entry( 329538ebceSVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 339538ebceSVladimir Oltean __string(kind, dsa_port_kind(dp)) 349538ebceSVladimir Oltean __field(int, port) 359538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 369538ebceSVladimir Oltean __field(u16, vid) 379538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 389538ebceSVladimir Oltean __field(int, err) 399538ebceSVladimir Oltean ), 409538ebceSVladimir Oltean 419538ebceSVladimir Oltean TP_fast_assign( 429538ebceSVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 439538ebceSVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 449538ebceSVladimir Oltean __entry->port = dp->index; 459538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 469538ebceSVladimir Oltean __entry->vid = vid; 479538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 489538ebceSVladimir Oltean __entry->err = err; 499538ebceSVladimir Oltean ), 509538ebceSVladimir Oltean 519538ebceSVladimir Oltean TP_printk("%s %s port %d addr %pM vid %u db \"%s\" err %d", 529538ebceSVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, __entry->addr, 539538ebceSVladimir Oltean __entry->vid, __entry->db_buf, __entry->err) 549538ebceSVladimir Oltean ); 559538ebceSVladimir Oltean 569538ebceSVladimir Oltean /* Add unicast/multicast address to hardware, either on user ports 579538ebceSVladimir Oltean * (where no refcounting is kept), or on shared ports when the entry 589538ebceSVladimir Oltean * is first seen and its refcount is 1. 599538ebceSVladimir Oltean */ 609538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_hw, dsa_fdb_add_hw, 619538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 629538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 639538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, err)); 649538ebceSVladimir Oltean 659538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_hw, dsa_mdb_add_hw, 669538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 679538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 689538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, err)); 699538ebceSVladimir Oltean 709538ebceSVladimir Oltean /* Delete unicast/multicast address from hardware, either on user ports or 719538ebceSVladimir Oltean * when the refcount on shared ports reaches 0 729538ebceSVladimir Oltean */ 739538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_hw, dsa_fdb_del_hw, 749538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 759538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 769538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, err)); 779538ebceSVladimir Oltean 789538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_hw, dsa_mdb_del_hw, 799538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 809538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 819538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, err)); 829538ebceSVladimir Oltean 839538ebceSVladimir Oltean DECLARE_EVENT_CLASS(dsa_port_addr_op_refcount, 849538ebceSVladimir Oltean 859538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, u16 vid, 869538ebceSVladimir Oltean const struct dsa_db *db, const refcount_t *refcount), 879538ebceSVladimir Oltean 889538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, refcount), 899538ebceSVladimir Oltean 909538ebceSVladimir Oltean TP_STRUCT__entry( 919538ebceSVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 929538ebceSVladimir Oltean __string(kind, dsa_port_kind(dp)) 939538ebceSVladimir Oltean __field(int, port) 949538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 959538ebceSVladimir Oltean __field(u16, vid) 969538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 979538ebceSVladimir Oltean __field(unsigned int, refcount) 989538ebceSVladimir Oltean ), 999538ebceSVladimir Oltean 1009538ebceSVladimir Oltean TP_fast_assign( 1019538ebceSVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 1029538ebceSVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 1039538ebceSVladimir Oltean __entry->port = dp->index; 1049538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 1059538ebceSVladimir Oltean __entry->vid = vid; 1069538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 1079538ebceSVladimir Oltean __entry->refcount = refcount_read(refcount); 1089538ebceSVladimir Oltean ), 1099538ebceSVladimir Oltean 1109538ebceSVladimir Oltean TP_printk("%s %s port %d addr %pM vid %u db \"%s\" refcount %u", 1119538ebceSVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, __entry->addr, 1129538ebceSVladimir Oltean __entry->vid, __entry->db_buf, __entry->refcount) 1139538ebceSVladimir Oltean ); 1149538ebceSVladimir Oltean 1159538ebceSVladimir Oltean /* Bump the refcount of an existing unicast/multicast address on shared ports */ 1169538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_refcount, dsa_fdb_add_bump, 1179538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1189538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, 1199538ebceSVladimir Oltean const refcount_t *refcount), 1209538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, refcount)); 1219538ebceSVladimir Oltean 1229538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_refcount, dsa_mdb_add_bump, 1239538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1249538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, 1259538ebceSVladimir Oltean const refcount_t *refcount), 1269538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, refcount)); 1279538ebceSVladimir Oltean 1289538ebceSVladimir Oltean /* Drop the refcount of a multicast address that we still keep on 1299538ebceSVladimir Oltean * shared ports 1309538ebceSVladimir Oltean */ 1319538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_refcount, dsa_fdb_del_drop, 1329538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1339538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, 1349538ebceSVladimir Oltean const refcount_t *refcount), 1359538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, refcount)); 1369538ebceSVladimir Oltean 1379538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_op_refcount, dsa_mdb_del_drop, 1389538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1399538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, 1409538ebceSVladimir Oltean const refcount_t *refcount), 1419538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db, refcount)); 1429538ebceSVladimir Oltean 1439538ebceSVladimir Oltean DECLARE_EVENT_CLASS(dsa_port_addr_del_not_found, 1449538ebceSVladimir Oltean 1459538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, u16 vid, 1469538ebceSVladimir Oltean const struct dsa_db *db), 1479538ebceSVladimir Oltean 1489538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db), 1499538ebceSVladimir Oltean 1509538ebceSVladimir Oltean TP_STRUCT__entry( 1519538ebceSVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 1529538ebceSVladimir Oltean __string(kind, dsa_port_kind(dp)) 1539538ebceSVladimir Oltean __field(int, port) 1549538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 1559538ebceSVladimir Oltean __field(u16, vid) 1569538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 1579538ebceSVladimir Oltean ), 1589538ebceSVladimir Oltean 1599538ebceSVladimir Oltean TP_fast_assign( 1609538ebceSVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 1619538ebceSVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 1629538ebceSVladimir Oltean __entry->port = dp->index; 1639538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 1649538ebceSVladimir Oltean __entry->vid = vid; 1659538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 1669538ebceSVladimir Oltean ), 1679538ebceSVladimir Oltean 1689538ebceSVladimir Oltean TP_printk("%s %s port %d addr %pM vid %u db \"%s\"", 1699538ebceSVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, 1709538ebceSVladimir Oltean __entry->addr, __entry->vid, __entry->db_buf) 1719538ebceSVladimir Oltean ); 1729538ebceSVladimir Oltean 1739538ebceSVladimir Oltean /* Attempt to delete a unicast/multicast address on shared ports for which 1749538ebceSVladimir Oltean * the delete operation was called more times than the addition 1759538ebceSVladimir Oltean */ 1769538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_del_not_found, dsa_fdb_del_not_found, 1779538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1789538ebceSVladimir Oltean u16 vid, const struct dsa_db *db), 1799538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db)); 1809538ebceSVladimir Oltean 1819538ebceSVladimir Oltean DEFINE_EVENT(dsa_port_addr_del_not_found, dsa_mdb_del_not_found, 1829538ebceSVladimir Oltean TP_PROTO(const struct dsa_port *dp, const unsigned char *addr, 1839538ebceSVladimir Oltean u16 vid, const struct dsa_db *db), 1849538ebceSVladimir Oltean TP_ARGS(dp, addr, vid, db)); 1859538ebceSVladimir Oltean 1869538ebceSVladimir Oltean TRACE_EVENT(dsa_lag_fdb_add_hw, 1879538ebceSVladimir Oltean 1889538ebceSVladimir Oltean TP_PROTO(const struct net_device *lag_dev, const unsigned char *addr, 1899538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 1909538ebceSVladimir Oltean 1919538ebceSVladimir Oltean TP_ARGS(lag_dev, addr, vid, db, err), 1929538ebceSVladimir Oltean 1939538ebceSVladimir Oltean TP_STRUCT__entry( 1949538ebceSVladimir Oltean __string(dev, lag_dev->name) 1959538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 1969538ebceSVladimir Oltean __field(u16, vid) 1979538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 1989538ebceSVladimir Oltean __field(int, err) 1999538ebceSVladimir Oltean ), 2009538ebceSVladimir Oltean 2019538ebceSVladimir Oltean TP_fast_assign( 2029538ebceSVladimir Oltean __assign_str(dev, lag_dev->name); 2039538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 2049538ebceSVladimir Oltean __entry->vid = vid; 2059538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 2069538ebceSVladimir Oltean __entry->err = err; 2079538ebceSVladimir Oltean ), 2089538ebceSVladimir Oltean 2099538ebceSVladimir Oltean TP_printk("%s addr %pM vid %u db \"%s\" err %d", 2109538ebceSVladimir Oltean __get_str(dev), __entry->addr, __entry->vid, 2119538ebceSVladimir Oltean __entry->db_buf, __entry->err) 2129538ebceSVladimir Oltean ); 2139538ebceSVladimir Oltean 2149538ebceSVladimir Oltean TRACE_EVENT(dsa_lag_fdb_add_bump, 2159538ebceSVladimir Oltean 2169538ebceSVladimir Oltean TP_PROTO(const struct net_device *lag_dev, const unsigned char *addr, 2179538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, const refcount_t *refcount), 2189538ebceSVladimir Oltean 2199538ebceSVladimir Oltean TP_ARGS(lag_dev, addr, vid, db, refcount), 2209538ebceSVladimir Oltean 2219538ebceSVladimir Oltean TP_STRUCT__entry( 2229538ebceSVladimir Oltean __string(dev, lag_dev->name) 2239538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 2249538ebceSVladimir Oltean __field(u16, vid) 2259538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 2269538ebceSVladimir Oltean __field(unsigned int, refcount) 2279538ebceSVladimir Oltean ), 2289538ebceSVladimir Oltean 2299538ebceSVladimir Oltean TP_fast_assign( 2309538ebceSVladimir Oltean __assign_str(dev, lag_dev->name); 2319538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 2329538ebceSVladimir Oltean __entry->vid = vid; 2339538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 2349538ebceSVladimir Oltean __entry->refcount = refcount_read(refcount); 2359538ebceSVladimir Oltean ), 2369538ebceSVladimir Oltean 2379538ebceSVladimir Oltean TP_printk("%s addr %pM vid %u db \"%s\" refcount %u", 2389538ebceSVladimir Oltean __get_str(dev), __entry->addr, __entry->vid, 2399538ebceSVladimir Oltean __entry->db_buf, __entry->refcount) 2409538ebceSVladimir Oltean ); 2419538ebceSVladimir Oltean 2429538ebceSVladimir Oltean TRACE_EVENT(dsa_lag_fdb_del_hw, 2439538ebceSVladimir Oltean 2449538ebceSVladimir Oltean TP_PROTO(const struct net_device *lag_dev, const unsigned char *addr, 2459538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, int err), 2469538ebceSVladimir Oltean 2479538ebceSVladimir Oltean TP_ARGS(lag_dev, addr, vid, db, err), 2489538ebceSVladimir Oltean 2499538ebceSVladimir Oltean TP_STRUCT__entry( 2509538ebceSVladimir Oltean __string(dev, lag_dev->name) 2519538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 2529538ebceSVladimir Oltean __field(u16, vid) 2539538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 2549538ebceSVladimir Oltean __field(int, err) 2559538ebceSVladimir Oltean ), 2569538ebceSVladimir Oltean 2579538ebceSVladimir Oltean TP_fast_assign( 2589538ebceSVladimir Oltean __assign_str(dev, lag_dev->name); 2599538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 2609538ebceSVladimir Oltean __entry->vid = vid; 2619538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 2629538ebceSVladimir Oltean __entry->err = err; 2639538ebceSVladimir Oltean ), 2649538ebceSVladimir Oltean 2659538ebceSVladimir Oltean TP_printk("%s addr %pM vid %u db \"%s\" err %d", 2669538ebceSVladimir Oltean __get_str(dev), __entry->addr, __entry->vid, 2679538ebceSVladimir Oltean __entry->db_buf, __entry->err) 2689538ebceSVladimir Oltean ); 2699538ebceSVladimir Oltean 2709538ebceSVladimir Oltean TRACE_EVENT(dsa_lag_fdb_del_drop, 2719538ebceSVladimir Oltean 2729538ebceSVladimir Oltean TP_PROTO(const struct net_device *lag_dev, const unsigned char *addr, 2739538ebceSVladimir Oltean u16 vid, const struct dsa_db *db, const refcount_t *refcount), 2749538ebceSVladimir Oltean 2759538ebceSVladimir Oltean TP_ARGS(lag_dev, addr, vid, db, refcount), 2769538ebceSVladimir Oltean 2779538ebceSVladimir Oltean TP_STRUCT__entry( 2789538ebceSVladimir Oltean __string(dev, lag_dev->name) 2799538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 2809538ebceSVladimir Oltean __field(u16, vid) 2819538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 2829538ebceSVladimir Oltean __field(unsigned int, refcount) 2839538ebceSVladimir Oltean ), 2849538ebceSVladimir Oltean 2859538ebceSVladimir Oltean TP_fast_assign( 2869538ebceSVladimir Oltean __assign_str(dev, lag_dev->name); 2879538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 2889538ebceSVladimir Oltean __entry->vid = vid; 2899538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 2909538ebceSVladimir Oltean __entry->refcount = refcount_read(refcount); 2919538ebceSVladimir Oltean ), 2929538ebceSVladimir Oltean 2939538ebceSVladimir Oltean TP_printk("%s addr %pM vid %u db \"%s\" refcount %u", 2949538ebceSVladimir Oltean __get_str(dev), __entry->addr, __entry->vid, 2959538ebceSVladimir Oltean __entry->db_buf, __entry->refcount) 2969538ebceSVladimir Oltean ); 2979538ebceSVladimir Oltean 2989538ebceSVladimir Oltean TRACE_EVENT(dsa_lag_fdb_del_not_found, 2999538ebceSVladimir Oltean 3009538ebceSVladimir Oltean TP_PROTO(const struct net_device *lag_dev, const unsigned char *addr, 3019538ebceSVladimir Oltean u16 vid, const struct dsa_db *db), 3029538ebceSVladimir Oltean 3039538ebceSVladimir Oltean TP_ARGS(lag_dev, addr, vid, db), 3049538ebceSVladimir Oltean 3059538ebceSVladimir Oltean TP_STRUCT__entry( 3069538ebceSVladimir Oltean __string(dev, lag_dev->name) 3079538ebceSVladimir Oltean __array(unsigned char, addr, ETH_ALEN) 3089538ebceSVladimir Oltean __field(u16, vid) 3099538ebceSVladimir Oltean __array(char, db_buf, DSA_DB_BUFSIZ) 3109538ebceSVladimir Oltean ), 3119538ebceSVladimir Oltean 3129538ebceSVladimir Oltean TP_fast_assign( 3139538ebceSVladimir Oltean __assign_str(dev, lag_dev->name); 3149538ebceSVladimir Oltean ether_addr_copy(__entry->addr, addr); 3159538ebceSVladimir Oltean __entry->vid = vid; 3169538ebceSVladimir Oltean dsa_db_print(db, __entry->db_buf); 3179538ebceSVladimir Oltean ), 3189538ebceSVladimir Oltean 3199538ebceSVladimir Oltean TP_printk("%s addr %pM vid %u db \"%s\"", 3209538ebceSVladimir Oltean __get_str(dev), __entry->addr, __entry->vid, __entry->db_buf) 3219538ebceSVladimir Oltean ); 3229538ebceSVladimir Oltean 323*02020bd7SVladimir Oltean DECLARE_EVENT_CLASS(dsa_vlan_op_hw, 324*02020bd7SVladimir Oltean 325*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 326*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, int err), 327*02020bd7SVladimir Oltean 328*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, err), 329*02020bd7SVladimir Oltean 330*02020bd7SVladimir Oltean TP_STRUCT__entry( 331*02020bd7SVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 332*02020bd7SVladimir Oltean __string(kind, dsa_port_kind(dp)) 333*02020bd7SVladimir Oltean __field(int, port) 334*02020bd7SVladimir Oltean __field(u16, vid) 335*02020bd7SVladimir Oltean __field(u16, flags) 336*02020bd7SVladimir Oltean __field(bool, changed) 337*02020bd7SVladimir Oltean __field(int, err) 338*02020bd7SVladimir Oltean ), 339*02020bd7SVladimir Oltean 340*02020bd7SVladimir Oltean TP_fast_assign( 341*02020bd7SVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 342*02020bd7SVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 343*02020bd7SVladimir Oltean __entry->port = dp->index; 344*02020bd7SVladimir Oltean __entry->vid = vlan->vid; 345*02020bd7SVladimir Oltean __entry->flags = vlan->flags; 346*02020bd7SVladimir Oltean __entry->changed = vlan->changed; 347*02020bd7SVladimir Oltean __entry->err = err; 348*02020bd7SVladimir Oltean ), 349*02020bd7SVladimir Oltean 350*02020bd7SVladimir Oltean TP_printk("%s %s port %d vid %u%s%s%s", 351*02020bd7SVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, __entry->vid, 352*02020bd7SVladimir Oltean __entry->flags & BRIDGE_VLAN_INFO_PVID ? " pvid" : "", 353*02020bd7SVladimir Oltean __entry->flags & BRIDGE_VLAN_INFO_UNTAGGED ? " untagged" : "", 354*02020bd7SVladimir Oltean __entry->changed ? " (changed)" : "") 355*02020bd7SVladimir Oltean ); 356*02020bd7SVladimir Oltean 357*02020bd7SVladimir Oltean DEFINE_EVENT(dsa_vlan_op_hw, dsa_vlan_add_hw, 358*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 359*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, int err), 360*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, err)); 361*02020bd7SVladimir Oltean 362*02020bd7SVladimir Oltean DEFINE_EVENT(dsa_vlan_op_hw, dsa_vlan_del_hw, 363*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 364*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, int err), 365*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, err)); 366*02020bd7SVladimir Oltean 367*02020bd7SVladimir Oltean DECLARE_EVENT_CLASS(dsa_vlan_op_refcount, 368*02020bd7SVladimir Oltean 369*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 370*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, 371*02020bd7SVladimir Oltean const refcount_t *refcount), 372*02020bd7SVladimir Oltean 373*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, refcount), 374*02020bd7SVladimir Oltean 375*02020bd7SVladimir Oltean TP_STRUCT__entry( 376*02020bd7SVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 377*02020bd7SVladimir Oltean __string(kind, dsa_port_kind(dp)) 378*02020bd7SVladimir Oltean __field(int, port) 379*02020bd7SVladimir Oltean __field(u16, vid) 380*02020bd7SVladimir Oltean __field(u16, flags) 381*02020bd7SVladimir Oltean __field(bool, changed) 382*02020bd7SVladimir Oltean __field(unsigned int, refcount) 383*02020bd7SVladimir Oltean ), 384*02020bd7SVladimir Oltean 385*02020bd7SVladimir Oltean TP_fast_assign( 386*02020bd7SVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 387*02020bd7SVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 388*02020bd7SVladimir Oltean __entry->port = dp->index; 389*02020bd7SVladimir Oltean __entry->vid = vlan->vid; 390*02020bd7SVladimir Oltean __entry->flags = vlan->flags; 391*02020bd7SVladimir Oltean __entry->changed = vlan->changed; 392*02020bd7SVladimir Oltean __entry->refcount = refcount_read(refcount); 393*02020bd7SVladimir Oltean ), 394*02020bd7SVladimir Oltean 395*02020bd7SVladimir Oltean TP_printk("%s %s port %d vid %u%s%s%s refcount %u", 396*02020bd7SVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, __entry->vid, 397*02020bd7SVladimir Oltean __entry->flags & BRIDGE_VLAN_INFO_PVID ? " pvid" : "", 398*02020bd7SVladimir Oltean __entry->flags & BRIDGE_VLAN_INFO_UNTAGGED ? " untagged" : "", 399*02020bd7SVladimir Oltean __entry->changed ? " (changed)" : "", __entry->refcount) 400*02020bd7SVladimir Oltean ); 401*02020bd7SVladimir Oltean 402*02020bd7SVladimir Oltean DEFINE_EVENT(dsa_vlan_op_refcount, dsa_vlan_add_bump, 403*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 404*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, 405*02020bd7SVladimir Oltean const refcount_t *refcount), 406*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, refcount)); 407*02020bd7SVladimir Oltean 408*02020bd7SVladimir Oltean DEFINE_EVENT(dsa_vlan_op_refcount, dsa_vlan_del_drop, 409*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 410*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan, 411*02020bd7SVladimir Oltean const refcount_t *refcount), 412*02020bd7SVladimir Oltean TP_ARGS(dp, vlan, refcount)); 413*02020bd7SVladimir Oltean 414*02020bd7SVladimir Oltean TRACE_EVENT(dsa_vlan_del_not_found, 415*02020bd7SVladimir Oltean 416*02020bd7SVladimir Oltean TP_PROTO(const struct dsa_port *dp, 417*02020bd7SVladimir Oltean const struct switchdev_obj_port_vlan *vlan), 418*02020bd7SVladimir Oltean 419*02020bd7SVladimir Oltean TP_ARGS(dp, vlan), 420*02020bd7SVladimir Oltean 421*02020bd7SVladimir Oltean TP_STRUCT__entry( 422*02020bd7SVladimir Oltean __string(dev, dev_name(dp->ds->dev)) 423*02020bd7SVladimir Oltean __string(kind, dsa_port_kind(dp)) 424*02020bd7SVladimir Oltean __field(int, port) 425*02020bd7SVladimir Oltean __field(u16, vid) 426*02020bd7SVladimir Oltean ), 427*02020bd7SVladimir Oltean 428*02020bd7SVladimir Oltean TP_fast_assign( 429*02020bd7SVladimir Oltean __assign_str(dev, dev_name(dp->ds->dev)); 430*02020bd7SVladimir Oltean __assign_str(kind, dsa_port_kind(dp)); 431*02020bd7SVladimir Oltean __entry->port = dp->index; 432*02020bd7SVladimir Oltean __entry->vid = vlan->vid; 433*02020bd7SVladimir Oltean ), 434*02020bd7SVladimir Oltean 435*02020bd7SVladimir Oltean TP_printk("%s %s port %d vid %u", 436*02020bd7SVladimir Oltean __get_str(dev), __get_str(kind), __entry->port, __entry->vid) 437*02020bd7SVladimir Oltean ); 438*02020bd7SVladimir Oltean 4399538ebceSVladimir Oltean #endif /* _NET_DSA_TRACE_H */ 4409538ebceSVladimir Oltean 4419538ebceSVladimir Oltean /* We don't want to use include/trace/events */ 4429538ebceSVladimir Oltean #undef TRACE_INCLUDE_PATH 4439538ebceSVladimir Oltean #define TRACE_INCLUDE_PATH . 4449538ebceSVladimir Oltean #undef TRACE_INCLUDE_FILE 4459538ebceSVladimir Oltean #define TRACE_INCLUDE_FILE trace 4469538ebceSVladimir Oltean /* This part must be outside protection */ 4479538ebceSVladimir Oltean #include <trace/define_trace.h> 448