[PATCH RFC net-next 08/10] net: dsa: mv88e6xxx: Convert MAB to use bit flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert MAB (MacAuth Bypass) flag to use bitmap.

A new port flag will be added with a subsequent patch. Convert the
'mab' member to a bit in a bitmask to save space.

Signed-off-by: Joseph Huang <Joseph.Huang@xxxxxxxxxx>
---
 drivers/net/dsa/mv88e6xxx/chip.h        | 12 ++++++++----
 drivers/net/dsa/mv88e6xxx/global1_atu.c |  3 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index a32e4564eb3d..205f6777c2ac 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -272,6 +272,9 @@ struct mv88e6xxx_vlan {
 	bool	valid;
 };
 
+/* MacAuth Bypass Control Flag */
+#define MV88E6XXX_PORT_FLAG_MAB		BIT(0)
+
 struct mv88e6xxx_port {
 	struct mv88e6xxx_chip *chip;
 	int port;
@@ -288,9 +291,7 @@ struct mv88e6xxx_port {
 	bool mirror_egress;
 	struct devlink_region *region;
 	void *pcs_private;
-
-	/* MacAuth Bypass control flag */
-	bool mab;
+	unsigned int flags;
 };
 
 enum mv88e6xxx_region_id {
@@ -802,7 +803,10 @@ static inline bool mv88e6xxx_is_invalid_port(struct mv88e6xxx_chip *chip, int po
 static inline void mv88e6xxx_port_set_mab(struct mv88e6xxx_chip *chip,
 					  int port, bool mab)
 {
-	chip->ports[port].mab = mab;
+	if (mab)
+		chip->ports[port].flags |= MV88E6XXX_PORT_FLAG_MAB;
+	else
+		chip->ports[port].flags &= ~MV88E6XXX_PORT_FLAG_MAB;
 }
 
 int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val);
diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c
index ce3b3690c3c0..06d0c526e33d 100644
--- a/drivers/net/dsa/mv88e6xxx/global1_atu.c
+++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c
@@ -445,7 +445,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
 						   fid);
 		chip->ports[spid].atu_miss_violation++;
 
-		if (fid != MV88E6XXX_FID_STANDALONE && chip->ports[spid].mab) {
+		if (fid != MV88E6XXX_FID_STANDALONE &&
+		    !!(chip->ports[spid].flags & MV88E6XXX_PORT_FLAG_MAB)) {
 			err = mv88e6xxx_handle_miss_violation(chip, spid,
 							      &entry, fid);
 			if (err)
-- 
2.17.1





[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux