Merge branch 'trace-points-for-mv88e6xxx'
Vladimir Oltean says: ==================== Trace points for mv88e6xxx While testing Hans Schultz' attempt at offloading MAB on mv88e6xxx: https://patchwork.kernel.org/project/netdevbpf/cover/20221205185908.217520-1-netdev@kapio-technology.com/ I noticed that he still didn't get rid of the huge log spam caused by ATU and VTU violations, even if we discussed about this: https://patchwork.kernel.org/project/netdevbpf/cover/20221112203748.68995-1-netdev@kapio-technology.com/#25091076 It seems unlikely he's going to ever do this, so here is my own stab at converting those messages to trace points. This is IMO an improvement regardless of whether Hans' work with MAB lands or not, especially the VTU violations which were quite annoying to me as well. A small sample of before: $ ./bridge_locked_port.sh lan1 lan2 lan3 lan4 [ 114.465272] mv88e6085 d0032004.mdio-mii:10: VTU member violation for vid 100, source port 9 [ 119.550508] mv88e6xxx_g1_vtu_prob_irq_thread_fn: 34 callbacks suppressed [ 120.369586] mv88e6085 d0032004.mdio-mii:10: VTU member violation for vid 100, source port 9 [ 120.473658] mv88e6085 d0032004.mdio-mii:10: VTU member violation for vid 100, source port 9 [ 125.535209] mv88e6xxx_g1_vtu_prob_irq_thread_fn: 21 callbacks suppressed [ 125.535243] mv88e6085 d0032004.mdio-mii:10: VTU member violation for vid 100, source port 9 [ 126.174558] mv88e6085 d0032004.mdio-mii:10: VTU member violation for vid 100, source port 9 [ 130.234055] mv88e6085 d0032004.mdio-mii:10: ATU miss violation for 00:01:02:03:04:01 fid 3 portvec 4 spid 2 [ 130.338193] mv88e6085 d0032004.mdio-mii:10: ATU miss violation for 00:01:02:03:04:01 fid 3 portvec 4 spid 2 [ 134.626099] mv88e6xxx_g1_atu_prob_irq_thread_fn: 38 callbacks suppressed [ 134.626132] mv88e6085 d0032004.mdio-mii:10: ATU miss violation for 00:01:02:03:04:01 fid 3 portvec 4 spid 2 and after: $ trace-cmd record -e mv88e6xxx ./bridge_locked_port.sh lan1 lan2 lan3 lan4 $ trace-cmd report irq/35-moxtet-60 [001] 93.929734: mv88e6xxx_vtu_miss_violation: dev d0032004.mdio-mii:10 spid 9 vid 100 irq/35-moxtet-60 [001] 94.183209: mv88e6xxx_vtu_miss_violation: dev d0032004.mdio-mii:10 spid 9 vid 100 irq/35-moxtet-60 [001] 101.865545: mv88e6xxx_vtu_miss_violation: dev d0032004.mdio-mii:10 spid 9 vid 100 irq/35-moxtet-60 [001] 121.831261: mv88e6xxx_vtu_member_violation: dev d0032004.mdio-mii:10 spid 9 vid 100 irq/35-moxtet-60 [001] 122.371238: mv88e6xxx_vtu_member_violation: dev d0032004.mdio-mii:10 spid 9 vid 100 irq/35-moxtet-60 [001] 148.452932: mv88e6xxx_atu_miss_violation: dev d0032004.mdio-mii:10 spid 2 portvec 0x4 addr 00:01:02:03:04:01 fid 0 v1 at: https://patchwork.kernel.org/project/netdevbpf/cover/20221207233954.3619276-1-vladimir.oltean@nxp.com/ ==================== Link: https://lore.kernel.org/r/20221209172817.371434-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
cd2aafa25b
|
@ -15,3 +15,7 @@ mv88e6xxx-objs += port_hidden.o
|
|||
mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_PTP) += ptp.o
|
||||
mv88e6xxx-objs += serdes.o
|
||||
mv88e6xxx-objs += smi.o
|
||||
mv88e6xxx-objs += trace.o
|
||||
|
||||
# for tracing framework to find trace.h
|
||||
CFLAGS_trace.o := -I$(src)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "chip.h"
|
||||
#include "global1.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* Offset 0x01: ATU FID Register */
|
||||
|
||||
|
@ -114,6 +115,19 @@ static int mv88e6xxx_g1_atu_op_wait(struct mv88e6xxx_chip *chip)
|
|||
return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_ATU_OP, bit, 0);
|
||||
}
|
||||
|
||||
static int mv88e6xxx_g1_read_atu_violation(struct mv88e6xxx_chip *chip)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_ATU_OP,
|
||||
MV88E6XXX_G1_ATU_OP_BUSY |
|
||||
MV88E6XXX_G1_ATU_OP_GET_CLR_VIOLATION);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return mv88e6xxx_g1_atu_op_wait(chip);
|
||||
}
|
||||
|
||||
static int mv88e6xxx_g1_atu_op(struct mv88e6xxx_chip *chip, u16 fid, u16 op)
|
||||
{
|
||||
u16 val;
|
||||
|
@ -159,6 +173,41 @@ int mv88e6xxx_g1_atu_get_next(struct mv88e6xxx_chip *chip, u16 fid)
|
|||
return mv88e6xxx_g1_atu_op(chip, fid, MV88E6XXX_G1_ATU_OP_GET_NEXT_DB);
|
||||
}
|
||||
|
||||
static int mv88e6xxx_g1_atu_fid_read(struct mv88e6xxx_chip *chip, u16 *fid)
|
||||
{
|
||||
u16 val = 0, upper = 0, op = 0;
|
||||
int err = -EOPNOTSUPP;
|
||||
|
||||
if (mv88e6xxx_num_databases(chip) > 256) {
|
||||
err = mv88e6xxx_g1_read(chip, MV88E6352_G1_ATU_FID, &val);
|
||||
val &= 0xfff;
|
||||
if (err)
|
||||
return err;
|
||||
} else {
|
||||
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_OP, &op);
|
||||
if (err)
|
||||
return err;
|
||||
if (mv88e6xxx_num_databases(chip) > 64) {
|
||||
/* ATU DBNum[7:4] are located in ATU Control 15:12 */
|
||||
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_ATU_CTL,
|
||||
&upper);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
upper = (upper >> 8) & 0x00f0;
|
||||
} else if (mv88e6xxx_num_databases(chip) > 16) {
|
||||
/* ATU DBNum[5:4] are located in ATU Operation 9:8 */
|
||||
upper = (op >> 4) & 0x30;
|
||||
}
|
||||
|
||||
/* ATU DBNum[3:0] are located in ATU Operation 3:0 */
|
||||
val = (op & 0xf) | upper;
|
||||
}
|
||||
*fid = val;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Offset 0x0C: ATU Data Register */
|
||||
|
||||
static int mv88e6xxx_g1_atu_data_read(struct mv88e6xxx_chip *chip,
|
||||
|
@ -353,14 +402,12 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
|
|||
{
|
||||
struct mv88e6xxx_chip *chip = dev_id;
|
||||
struct mv88e6xxx_atu_entry entry;
|
||||
int spid;
|
||||
int err;
|
||||
u16 val;
|
||||
int err, spid;
|
||||
u16 val, fid;
|
||||
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
|
||||
err = mv88e6xxx_g1_atu_op(chip, 0,
|
||||
MV88E6XXX_G1_ATU_OP_GET_CLR_VIOLATION);
|
||||
err = mv88e6xxx_g1_read_atu_violation(chip);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
@ -368,6 +415,10 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
|
|||
if (err)
|
||||
goto out;
|
||||
|
||||
err = mv88e6xxx_g1_atu_fid_read(chip, &fid);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = mv88e6xxx_g1_atu_data_read(chip, &entry);
|
||||
if (err)
|
||||
goto out;
|
||||
|
@ -378,30 +429,24 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
|
|||
|
||||
spid = entry.state;
|
||||
|
||||
if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) {
|
||||
dev_err_ratelimited(chip->dev,
|
||||
"ATU age out violation for %pM\n",
|
||||
entry.mac);
|
||||
}
|
||||
|
||||
if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) {
|
||||
dev_err_ratelimited(chip->dev,
|
||||
"ATU member violation for %pM portvec %x spid %d\n",
|
||||
entry.mac, entry.portvec, spid);
|
||||
trace_mv88e6xxx_atu_member_violation(chip->dev, spid,
|
||||
entry.portvec, entry.mac,
|
||||
fid);
|
||||
chip->ports[spid].atu_member_violation++;
|
||||
}
|
||||
|
||||
if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) {
|
||||
dev_err_ratelimited(chip->dev,
|
||||
"ATU miss violation for %pM portvec %x spid %d\n",
|
||||
entry.mac, entry.portvec, spid);
|
||||
trace_mv88e6xxx_atu_miss_violation(chip->dev, spid,
|
||||
entry.portvec, entry.mac,
|
||||
fid);
|
||||
chip->ports[spid].atu_miss_violation++;
|
||||
}
|
||||
|
||||
if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) {
|
||||
dev_err_ratelimited(chip->dev,
|
||||
"ATU full violation for %pM portvec %x spid %d\n",
|
||||
entry.mac, entry.portvec, spid);
|
||||
trace_mv88e6xxx_atu_full_violation(chip->dev, spid,
|
||||
entry.portvec, entry.mac,
|
||||
fid);
|
||||
chip->ports[spid].atu_full_violation++;
|
||||
}
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "chip.h"
|
||||
#include "global1.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* Offset 0x02: VTU FID Register */
|
||||
|
||||
|
@ -628,14 +629,12 @@ static irqreturn_t mv88e6xxx_g1_vtu_prob_irq_thread_fn(int irq, void *dev_id)
|
|||
spid = val & MV88E6XXX_G1_VTU_OP_SPID_MASK;
|
||||
|
||||
if (val & MV88E6XXX_G1_VTU_OP_MEMBER_VIOLATION) {
|
||||
dev_err_ratelimited(chip->dev, "VTU member violation for vid %d, source port %d\n",
|
||||
vid, spid);
|
||||
trace_mv88e6xxx_vtu_member_violation(chip->dev, spid, vid);
|
||||
chip->ports[spid].vtu_member_violation++;
|
||||
}
|
||||
|
||||
if (val & MV88E6XXX_G1_VTU_OP_MISS_VIOLATION) {
|
||||
dev_dbg_ratelimited(chip->dev, "VTU miss violation for vid %d, source port %d\n",
|
||||
vid, spid);
|
||||
trace_mv88e6xxx_vtu_miss_violation(chip->dev, spid, vid);
|
||||
chip->ports[spid].vtu_miss_violation++;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Copyright 2022 NXP
|
||||
*/
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace.h"
|
|
@ -0,0 +1,96 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/* Copyright 2022 NXP
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM mv88e6xxx
|
||||
|
||||
#if !defined(_MV88E6XXX_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _MV88E6XXX_TRACE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(mv88e6xxx_atu_violation,
|
||||
|
||||
TP_PROTO(const struct device *dev, int spid, u16 portvec,
|
||||
const unsigned char *addr, u16 fid),
|
||||
|
||||
TP_ARGS(dev, spid, portvec, addr, fid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, dev_name(dev))
|
||||
__field(int, spid)
|
||||
__field(u16, portvec)
|
||||
__array(unsigned char, addr, ETH_ALEN)
|
||||
__field(u16, fid)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, dev_name(dev));
|
||||
__entry->spid = spid;
|
||||
__entry->portvec = portvec;
|
||||
memcpy(__entry->addr, addr, ETH_ALEN);
|
||||
__entry->fid = fid;
|
||||
),
|
||||
|
||||
TP_printk("dev %s spid %d portvec 0x%x addr %pM fid %u",
|
||||
__get_str(name), __entry->spid, __entry->portvec,
|
||||
__entry->addr, __entry->fid)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(mv88e6xxx_atu_violation, mv88e6xxx_atu_member_violation,
|
||||
TP_PROTO(const struct device *dev, int spid, u16 portvec,
|
||||
const unsigned char *addr, u16 fid),
|
||||
TP_ARGS(dev, spid, portvec, addr, fid));
|
||||
|
||||
DEFINE_EVENT(mv88e6xxx_atu_violation, mv88e6xxx_atu_miss_violation,
|
||||
TP_PROTO(const struct device *dev, int spid, u16 portvec,
|
||||
const unsigned char *addr, u16 fid),
|
||||
TP_ARGS(dev, spid, portvec, addr, fid));
|
||||
|
||||
DEFINE_EVENT(mv88e6xxx_atu_violation, mv88e6xxx_atu_full_violation,
|
||||
TP_PROTO(const struct device *dev, int spid, u16 portvec,
|
||||
const unsigned char *addr, u16 fid),
|
||||
TP_ARGS(dev, spid, portvec, addr, fid));
|
||||
|
||||
DECLARE_EVENT_CLASS(mv88e6xxx_vtu_violation,
|
||||
|
||||
TP_PROTO(const struct device *dev, int spid, u16 vid),
|
||||
|
||||
TP_ARGS(dev, spid, vid),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string(name, dev_name(dev))
|
||||
__field(int, spid)
|
||||
__field(u16, vid)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, dev_name(dev));
|
||||
__entry->spid = spid;
|
||||
__entry->vid = vid;
|
||||
),
|
||||
|
||||
TP_printk("dev %s spid %d vid %u",
|
||||
__get_str(name), __entry->spid, __entry->vid)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(mv88e6xxx_vtu_violation, mv88e6xxx_vtu_member_violation,
|
||||
TP_PROTO(const struct device *dev, int spid, u16 vid),
|
||||
TP_ARGS(dev, spid, vid));
|
||||
|
||||
DEFINE_EVENT(mv88e6xxx_vtu_violation, mv88e6xxx_vtu_miss_violation,
|
||||
TP_PROTO(const struct device *dev, int spid, u16 vid),
|
||||
TP_ARGS(dev, spid, vid));
|
||||
|
||||
#endif /* _MV88E6XXX_TRACE_H */
|
||||
|
||||
/* We don't want to use include/trace/events */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
#define TRACE_INCLUDE_FILE trace
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
Loading…
Reference in New Issue