Re: [PATCH v8 net-next 2/2] net: dsa: mv88e6xxx: mac-auth/MAB implementation

From: netdev
Date: Sun Dec 04 2022 - 08:26:52 EST


On 2022-11-15 23:23, Vladimir Oltean wrote:

Is it beneficial in any way to pass the violation type to
mv88e6xxx_handle_violation(), considering that we only call it from the
"miss" code path, and if we were to call it with something else ("member"),
it would return a strange error code (1)?

I don't necessarily see any way in which we'll need to handle the
"member" (migration, right?) violation any different in the future,
except ignore it, either.


MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION will also be handled, and it could be
that MV88E6XXX_G1_ATU_OP_FULL_VIOLATION would want handling, though I don't
know of plans for that.

The MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION interrupt can be suppressed if we
want.

I think a switch on the type is the most readable code form.


p.s. I have changed it, so that global1_atu.c reads:

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);
chip->ports[spid].atu_miss_violation++;

if (!fid) {
err = -EINVAL;
goto out;
}

if (chip->ports[spid].mab)
err = mv88e6xxx_handle_violation(chip, spid, &entry,
fid, MV88E6XXX_G1_ATU_OP_MISS_VIOLATION);
if (err)
goto out;
}

with the use of out_unlock in the chip mutex locked case.