Skip to content

Commit 9e3d9ae

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: mv88e6xxx: replace VTU violation prints with trace points
It is possible to trigger these VTU violation messages very easily, it's only necessary to send packets with an unknown VLAN ID to a port that belongs to a VLAN-aware bridge. Do a similar thing as for ATU violation messages, and hide them in the kernel's trace buffer. New usage model: $ trace-cmd list | grep mv88e6xxx mv88e6xxx mv88e6xxx:mv88e6xxx_vtu_miss_violation mv88e6xxx:mv88e6xxx_vtu_member_violation $ trace-cmd report Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Saeed Mahameed <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8646384 commit 9e3d9ae

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

drivers/net/dsa/mv88e6xxx/global1_vtu.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "chip.h"
1515
#include "global1.h"
16+
#include "trace.h"
1617

1718
/* Offset 0x02: VTU FID Register */
1819

@@ -628,14 +629,12 @@ static irqreturn_t mv88e6xxx_g1_vtu_prob_irq_thread_fn(int irq, void *dev_id)
628629
spid = val & MV88E6XXX_G1_VTU_OP_SPID_MASK;
629630

630631
if (val & MV88E6XXX_G1_VTU_OP_MEMBER_VIOLATION) {
631-
dev_err_ratelimited(chip->dev, "VTU member violation for vid %d, source port %d\n",
632-
vid, spid);
632+
trace_mv88e6xxx_vtu_member_violation(chip->dev, spid, vid);
633633
chip->ports[spid].vtu_member_violation++;
634634
}
635635

636636
if (val & MV88E6XXX_G1_VTU_OP_MISS_VIOLATION) {
637-
dev_dbg_ratelimited(chip->dev, "VTU miss violation for vid %d, source port %d\n",
638-
vid, spid);
637+
trace_mv88e6xxx_vtu_miss_violation(chip->dev, spid, vid);
639638
chip->ports[spid].vtu_miss_violation++;
640639
}
641640

drivers/net/dsa/mv88e6xxx/trace.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,36 @@ DEFINE_EVENT(mv88e6xxx_atu_violation, mv88e6xxx_atu_full_violation,
5555
const unsigned char *addr, u16 fid),
5656
TP_ARGS(dev, spid, portvec, addr, fid));
5757

58+
DECLARE_EVENT_CLASS(mv88e6xxx_vtu_violation,
59+
60+
TP_PROTO(const struct device *dev, int spid, u16 vid),
61+
62+
TP_ARGS(dev, spid, vid),
63+
64+
TP_STRUCT__entry(
65+
__string(name, dev_name(dev))
66+
__field(int, spid)
67+
__field(u16, vid)
68+
),
69+
70+
TP_fast_assign(
71+
__assign_str(name, dev_name(dev));
72+
__entry->spid = spid;
73+
__entry->vid = vid;
74+
),
75+
76+
TP_printk("dev %s spid %d vid %u",
77+
__get_str(name), __entry->spid, __entry->vid)
78+
);
79+
80+
DEFINE_EVENT(mv88e6xxx_vtu_violation, mv88e6xxx_vtu_member_violation,
81+
TP_PROTO(const struct device *dev, int spid, u16 vid),
82+
TP_ARGS(dev, spid, vid));
83+
84+
DEFINE_EVENT(mv88e6xxx_vtu_violation, mv88e6xxx_vtu_miss_violation,
85+
TP_PROTO(const struct device *dev, int spid, u16 vid),
86+
TP_ARGS(dev, spid, vid));
87+
5888
#endif /* _MV88E6XXX_TRACE_H */
5989

6090
/* We don't want to use include/trace/events */

0 commit comments

Comments
 (0)