* [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path
@ 2024-04-02 13:13 Oleksij Rempel
2024-04-02 13:13 ` [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table() Oleksij Rempel
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
Refactor FDB dump code path for Microchip KSZ8xxx series. This series
mostly makes some cosmetic reworks and allows to forward errors detected
by the regmap.
Oleksij Rempel (8):
net: dsa: microchip: Remove unused FDB timestamp support in
ksz8_r_dyn_mac_table()
net: dsa: microchip: Make ksz8_r_dyn_mac_table() static
net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump()
net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for
readability
net: dsa: microchip: ksz8: Unify variable naming in
ksz8_r_dyn_mac_table()
net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN
on timeout
net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error
if we got any
net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to
signal 0 entries
drivers/net/dsa/microchip/ksz8.h | 2 -
drivers/net/dsa/microchip/ksz8795.c | 144 ++++++++++++------------
drivers/net/dsa/microchip/ksz8795_reg.h | 1 +
3 files changed, 75 insertions(+), 72 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table()
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:28 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static Oleksij Rempel
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
The FDB timestamps are not being utilized. This commit removes the
unused timestamp support from ksz8_r_dyn_mac_table() function.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8.h | 2 +-
drivers/net/dsa/microchip/ksz8795.c | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8.h b/drivers/net/dsa/microchip/ksz8.h
index 1a5225264e6a3..5b38cbb7b058b 100644
--- a/drivers/net/dsa/microchip/ksz8.h
+++ b/drivers/net/dsa/microchip/ksz8.h
@@ -20,7 +20,7 @@ void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port);
int ksz8_r_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
int ksz8_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val);
int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
- u8 *fid, u8 *src_port, u8 *timestamp, u16 *entries);
+ u8 *fid, u8 *src_port, u16 *entries);
void ksz8_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt);
void ksz8_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
u64 *dropped, u64 *cnt);
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 14923535ca7e8..f59a03e6981d2 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -409,7 +409,7 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
}
int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
- u8 *fid, u8 *src_port, u8 *timestamp, u16 *entries)
+ u8 *fid, u8 *src_port, u16 *entries)
{
u32 data_hi, data_lo;
const u8 *shifts;
@@ -454,8 +454,6 @@ int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
shifts[DYNAMIC_MAC_FID];
*src_port = (data_hi & masks[DYNAMIC_MAC_TABLE_SRC_PORT]) >>
shifts[DYNAMIC_MAC_SRC_PORT];
- *timestamp = (data_hi & masks[DYNAMIC_MAC_TABLE_TIMESTAMP]) >>
- shifts[DYNAMIC_MAC_TIMESTAMP];
mac_addr[5] = (u8)data_lo;
mac_addr[4] = (u8)(data_lo >> 8);
@@ -1196,14 +1194,13 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port,
int ret = 0;
u16 i = 0;
u16 entries = 0;
- u8 timestamp = 0;
u8 fid;
u8 src_port;
u8 mac[ETH_ALEN];
do {
ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port,
- ×tamp, &entries);
+ &entries);
if (!ret && port == src_port) {
ret = cb(mac, fid, false, data);
if (ret)
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
2024-04-02 13:13 ` [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table() Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:29 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump() Oleksij Rempel
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
ksz8_r_dyn_mac_table() is not used outside the source file. Make it
static.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8.h | 2 --
drivers/net/dsa/microchip/ksz8795.c | 4 ++--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8.h b/drivers/net/dsa/microchip/ksz8.h
index 5b38cbb7b058b..571c26ce71e47 100644
--- a/drivers/net/dsa/microchip/ksz8.h
+++ b/drivers/net/dsa/microchip/ksz8.h
@@ -19,8 +19,6 @@ void ksz8_flush_dyn_mac_table(struct ksz_device *dev, int port);
void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port);
int ksz8_r_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
int ksz8_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val);
-int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
- u8 *fid, u8 *src_port, u16 *entries);
void ksz8_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt);
void ksz8_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
u64 *dropped, u64 *cnt);
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index f59a03e6981d2..e407111db6637 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -408,8 +408,8 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
return 0;
}
-int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
- u8 *fid, u8 *src_port, u16 *entries)
+static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
+ u8 *fid, u8 *src_port, u16 *entries)
{
u32 data_hi, data_lo;
const u8 *shifts;
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump()
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
2024-04-02 13:13 ` [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table() Oleksij Rempel
2024-04-02 13:13 ` [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:37 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability Oleksij Rempel
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
Refactor ksz8_fdb_dump() to address potential issues:
- Limit the number of iterations to avoid endless loops.
- Handle error codes returned by ksz8_r_dyn_mac_table(), with
an exception for -ENXIO when no more dynamic entries are detected.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 38 ++++++++++++++-----------
drivers/net/dsa/microchip/ksz8795_reg.h | 1 +
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index e407111db6637..b70aa2c0a85ec 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1191,27 +1191,33 @@ void ksz8_flush_dyn_mac_table(struct ksz_device *dev, int port)
int ksz8_fdb_dump(struct ksz_device *dev, int port,
dsa_fdb_dump_cb_t *cb, void *data)
{
- int ret = 0;
- u16 i = 0;
u16 entries = 0;
- u8 fid;
- u8 src_port;
- u8 mac[ETH_ALEN];
+ int ret, i;
+
+ for (i = 0; i < KSZ8_DYN_MAC_ENTRIES; i++) {
+ u8 mac[ETH_ALEN];
+ u8 src_port;
+ u8 fid;
- do {
ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port,
&entries);
- if (!ret && port == src_port) {
- ret = cb(mac, fid, false, data);
- if (ret)
- break;
- }
- i++;
- } while (i < entries);
- if (i >= entries)
- ret = 0;
+ if (ret == -ENXIO)
+ return 0;
+ if (ret)
+ return ret;
- return ret;
+ if (i >= entries)
+ return 0;
+
+ if (port != src_port)
+ continue;
+
+ ret = cb(mac, fid, false, data);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
static int ksz8_add_sta_mac(struct ksz_device *dev, int port,
diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
index 7c9341ef73b03..0d13a6e29b0e6 100644
--- a/drivers/net/dsa/microchip/ksz8795_reg.h
+++ b/drivers/net/dsa/microchip/ksz8795_reg.h
@@ -794,5 +794,6 @@
#define TAIL_TAG_LOOKUP BIT(7)
#define FID_ENTRIES 128
+#define KSZ8_DYN_MAC_ENTRIES 1024
#endif
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (2 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump() Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:44 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table() Oleksij Rempel
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
Move the code out of a long if statement scope in ksz8_r_dyn_mac_table()
to improve code readability.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 60 +++++++++++++++--------------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index b70aa2c0a85ec..1962195e16a6f 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -416,7 +416,9 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
const u32 *masks;
const u16 *regs;
u16 ctrl_addr;
+ u64 buf = 0;
u8 data;
+ int cnt;
int rc;
shifts = dev->info->shifts;
@@ -432,38 +434,38 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
if (rc == -EAGAIN) {
if (addr == 0)
*entries = 0;
+ goto unlock_alu;
} else if (rc == -ENXIO) {
*entries = 0;
- /* At least one valid entry in the table. */
- } else {
- u64 buf = 0;
- int cnt;
-
- ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
- data_hi = (u32)(buf >> 32);
- data_lo = (u32)buf;
-
- /* Check out how many valid entry in the table. */
- cnt = data & masks[DYNAMIC_MAC_TABLE_ENTRIES_H];
- cnt <<= shifts[DYNAMIC_MAC_ENTRIES_H];
- cnt |= (data_hi & masks[DYNAMIC_MAC_TABLE_ENTRIES]) >>
- shifts[DYNAMIC_MAC_ENTRIES];
- *entries = cnt + 1;
-
- *fid = (data_hi & masks[DYNAMIC_MAC_TABLE_FID]) >>
- shifts[DYNAMIC_MAC_FID];
- *src_port = (data_hi & masks[DYNAMIC_MAC_TABLE_SRC_PORT]) >>
- shifts[DYNAMIC_MAC_SRC_PORT];
-
- mac_addr[5] = (u8)data_lo;
- mac_addr[4] = (u8)(data_lo >> 8);
- mac_addr[3] = (u8)(data_lo >> 16);
- mac_addr[2] = (u8)(data_lo >> 24);
-
- mac_addr[1] = (u8)data_hi;
- mac_addr[0] = (u8)(data_hi >> 8);
- rc = 0;
+ goto unlock_alu;
}
+
+ ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
+ data_hi = (u32)(buf >> 32);
+ data_lo = (u32)buf;
+
+ /* Check out how many valid entry in the table. */
+ cnt = data & masks[DYNAMIC_MAC_TABLE_ENTRIES_H];
+ cnt <<= shifts[DYNAMIC_MAC_ENTRIES_H];
+ cnt |= (data_hi & masks[DYNAMIC_MAC_TABLE_ENTRIES]) >>
+ shifts[DYNAMIC_MAC_ENTRIES];
+ *entries = cnt + 1;
+
+ *fid = (data_hi & masks[DYNAMIC_MAC_TABLE_FID]) >>
+ shifts[DYNAMIC_MAC_FID];
+ *src_port = (data_hi & masks[DYNAMIC_MAC_TABLE_SRC_PORT]) >>
+ shifts[DYNAMIC_MAC_SRC_PORT];
+
+ mac_addr[5] = (u8)data_lo;
+ mac_addr[4] = (u8)(data_lo >> 8);
+ mac_addr[3] = (u8)(data_lo >> 16);
+ mac_addr[2] = (u8)(data_lo >> 24);
+
+ mac_addr[1] = (u8)data_hi;
+ mac_addr[0] = (u8)(data_hi >> 8);
+ rc = 0;
+
+unlock_alu:
mutex_unlock(&dev->alu_mutex);
return rc;
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table()
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (3 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:45 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout Oleksij Rempel
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
Use 'ret' instead of 'rc' in ksz8_r_dyn_mac_table() to maintain
consistency with the rest of the file.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 1962195e16a6f..d5ec4b9772752 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -419,7 +419,7 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
u64 buf = 0;
u8 data;
int cnt;
- int rc;
+ int ret;
shifts = dev->info->shifts;
masks = dev->info->masks;
@@ -430,12 +430,12 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
mutex_lock(&dev->alu_mutex);
ksz_write16(dev, regs[REG_IND_CTRL_0], ctrl_addr);
- rc = ksz8_valid_dyn_entry(dev, &data);
- if (rc == -EAGAIN) {
+ ret = ksz8_valid_dyn_entry(dev, &data);
+ if (ret == -EAGAIN) {
if (addr == 0)
*entries = 0;
goto unlock_alu;
- } else if (rc == -ENXIO) {
+ } else if (ret == -ENXIO) {
*entries = 0;
goto unlock_alu;
}
@@ -463,12 +463,12 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
mac_addr[1] = (u8)data_hi;
mac_addr[0] = (u8)(data_hi >> 8);
- rc = 0;
+ ret = 0;
unlock_alu:
mutex_unlock(&dev->alu_mutex);
- return rc;
+ return ret;
}
static int ksz8_r_sta_mac_table(struct ksz_device *dev, u16 addr,
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (4 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table() Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-03 8:21 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any Oleksij Rempel
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
EAGAIN was not used by previous code and not used by current code. So,
remove it and use proper error value.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index d5ec4b9772752..401f77055cc27 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -396,7 +396,7 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
/* Entry is not ready for accessing. */
if (*data & masks[DYNAMIC_MAC_TABLE_NOT_READY]) {
- return -EAGAIN;
+ return -ETIMEDOUT;
/* Entry is ready for accessing. */
} else {
ksz_read8(dev, regs[REG_IND_DATA_8], data);
@@ -431,15 +431,14 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
ksz_write16(dev, regs[REG_IND_CTRL_0], ctrl_addr);
ret = ksz8_valid_dyn_entry(dev, &data);
- if (ret == -EAGAIN) {
- if (addr == 0)
- *entries = 0;
- goto unlock_alu;
- } else if (ret == -ENXIO) {
+ if (ret == -ENXIO) {
*entries = 0;
goto unlock_alu;
}
+ if (ret)
+ goto unlock_alu;
+
ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
data_hi = (u32)(buf >> 32);
data_lo = (u32)buf;
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (5 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-02 15:59 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries Oleksij Rempel
2024-04-03 11:21 ` [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Vladimir Oltean
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
The read/write path may fail. So, return error if we got it.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 401f77055cc27..27dfcc645567d 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -385,12 +385,16 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
int timeout = 100;
const u32 *masks;
const u16 *regs;
+ int ret;
masks = dev->info->masks;
regs = dev->info->regs;
do {
- ksz_read8(dev, regs[REG_IND_DATA_CHECK], data);
+ ret = ksz_read8(dev, regs[REG_IND_DATA_CHECK], data);
+ if (ret)
+ return ret;
+
timeout--;
} while ((*data & masks[DYNAMIC_MAC_TABLE_NOT_READY]) && timeout);
@@ -399,7 +403,9 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
return -ETIMEDOUT;
/* Entry is ready for accessing. */
} else {
- ksz_read8(dev, regs[REG_IND_DATA_8], data);
+ ret = ksz_read8(dev, regs[REG_IND_DATA_8], data);
+ if (ret)
+ return ret;
/* There is no valid entry in the table. */
if (*data & masks[DYNAMIC_MAC_TABLE_MAC_EMPTY])
@@ -428,7 +434,9 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
ctrl_addr = IND_ACC_TABLE(TABLE_DYNAMIC_MAC | TABLE_READ) | addr;
mutex_lock(&dev->alu_mutex);
- ksz_write16(dev, regs[REG_IND_CTRL_0], ctrl_addr);
+ ret = ksz_write16(dev, regs[REG_IND_CTRL_0], ctrl_addr);
+ if (ret)
+ goto unlock_alu;
ret = ksz8_valid_dyn_entry(dev, &data);
if (ret == -ENXIO) {
@@ -439,7 +447,10 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
if (ret)
goto unlock_alu;
- ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
+ ret = ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
+ if (ret)
+ goto unlock_alu;
+
data_hi = (u32)(buf >> 32);
data_lo = (u32)buf;
@@ -462,7 +473,6 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
mac_addr[1] = (u8)data_hi;
mac_addr[0] = (u8)(data_hi >> 8);
- ret = 0;
unlock_alu:
mutex_unlock(&dev->alu_mutex);
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (6 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any Oleksij Rempel
@ 2024-04-02 13:13 ` Oleksij Rempel
2024-04-03 8:18 ` Arun.Ramadoss
2024-04-03 11:21 ` [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Vladimir Oltean
8 siblings, 1 reply; 19+ messages in thread
From: Oleksij Rempel @ 2024-04-02 13:13 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh,
Arun Ramadoss
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver,
Søren Andersen
We already have a variable to provide number of entries. So use it,
instead of using error number.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8795.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 27dfcc645567d..813c701b71180 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -399,19 +399,11 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
} while ((*data & masks[DYNAMIC_MAC_TABLE_NOT_READY]) && timeout);
/* Entry is not ready for accessing. */
- if (*data & masks[DYNAMIC_MAC_TABLE_NOT_READY]) {
+ if (*data & masks[DYNAMIC_MAC_TABLE_NOT_READY])
return -ETIMEDOUT;
- /* Entry is ready for accessing. */
- } else {
- ret = ksz_read8(dev, regs[REG_IND_DATA_8], data);
- if (ret)
- return ret;
- /* There is no valid entry in the table. */
- if (*data & masks[DYNAMIC_MAC_TABLE_MAC_EMPTY])
- return -ENXIO;
- }
- return 0;
+ /* Entry is ready for accessing. */
+ return ksz_read8(dev, regs[REG_IND_DATA_8], data);
}
static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
@@ -439,13 +431,13 @@ static int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
goto unlock_alu;
ret = ksz8_valid_dyn_entry(dev, &data);
- if (ret == -ENXIO) {
- *entries = 0;
+ if (ret)
goto unlock_alu;
- }
- if (ret)
+ if (data & masks[DYNAMIC_MAC_TABLE_MAC_EMPTY]) {
+ *entries = 0;
goto unlock_alu;
+ }
ret = ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
if (ret)
@@ -1212,8 +1204,6 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port,
ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port,
&entries);
- if (ret == -ENXIO)
- return 0;
if (ret)
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table()
2024-04-02 13:13 ` [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table() Oleksij Rempel
@ 2024-04-02 15:28 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:28 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
Hi Oleksij,
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> The FDB timestamps are not being utilized. This commit removes the
> unused timestamp support from ksz8_r_dyn_mac_table() function.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static
2024-04-02 13:13 ` [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static Oleksij Rempel
@ 2024-04-02 15:29 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:29 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> ksz8_r_dyn_mac_table() is not used outside the source file. Make it
> static.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump()
2024-04-02 13:13 ` [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump() Oleksij Rempel
@ 2024-04-02 15:37 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:37 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
Hi Oleksij,
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Refactor ksz8_fdb_dump() to address potential issues:
> - Limit the number of iterations to avoid endless loops.
> - Handle error codes returned by ksz8_r_dyn_mac_table(), with
> an exception for -ENXIO when no more dynamic entries are detected.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/dsa/microchip/ksz8795.c | 38 ++++++++++++++---------
> --
> drivers/net/dsa/microchip/ksz8795_reg.h | 1 +
> 2 files changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz8795.c
> b/drivers/net/dsa/microchip/ksz8795.c
> index e407111db6637..b70aa2c0a85ec 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -1191,27 +1191,33 @@ void ksz8_flush_dyn_mac_table(struct
> ksz_device *dev, int port)
> int ksz8_fdb_dump(struct ksz_device *dev, int port,
> dsa_fdb_dump_cb_t *cb, void *data)
> {
> - int ret = 0;
> - u16 i = 0;
> u16 entries = 0;
> - u8 fid;
> - u8 src_port;
> - u8 mac[ETH_ALEN];
> + int ret, i;
> +
> + for (i = 0; i < KSZ8_DYN_MAC_ENTRIES; i++) {
> + u8 mac[ETH_ALEN];
> + u8 src_port;
> + u8 fid;
IMO:Since there is no code other than for loop in this function,
variable declaraion can be as before.
>
> - do {
> ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid,
> &src_port,
> &entries);
> - if (!ret && port == src_port) {
> - ret = cb(mac, fid, false, data);
> - if (ret)
> - break;
> - }
> - i++;
> - } while (i < entries);
> - if (i >= entries)
> - ret = 0;
> + if (ret == -ENXIO)
> + return 0;
> + if (ret)
> + return ret;
>
> - return ret;
> + if (i >= entries)
> + return 0;
> +
> + if (port != src_port)
> + continue;
IMO: since already many returns in function, if above statement
replaced as below will increase readability.
if (port == src_port) {
ret = cb(mac, fid, false, data);
if (ret)
return ret;
}
> +
> + ret = cb(mac, fid, false, data);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> }
>
> static int ksz8_add_sta_mac(struct ksz_device *dev, int port,
> diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h
> b/drivers/net/dsa/microchip/ksz8795_reg.h
> index 7c9341ef73b03..0d13a6e29b0e6 100644
> --- a/drivers/net/dsa/microchip/ksz8795_reg.h
> +++ b/drivers/net/dsa/microchip/ksz8795_reg.h
> @@ -794,5 +794,6 @@
> #define TAIL_TAG_LOOKUP BIT(7)
>
> #define FID_ENTRIES 128
> +#define KSZ8_DYN_MAC_ENTRIES 1024
>
> #endif
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability
2024-04-02 13:13 ` [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability Oleksij Rempel
@ 2024-04-02 15:44 ` Arun.Ramadoss
2024-04-02 17:07 ` Jakub Kicinski
0 siblings, 1 reply; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:44 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
Hi Oleksij,
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Move the code out of a long if statement scope in
> ksz8_r_dyn_mac_table()
> to improve code readability.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/dsa/microchip/ksz8795.c | 60 +++++++++++++++----------
> ----
> 1 file changed, 31 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz8795.c
> b/drivers/net/dsa/microchip/ksz8795.c
> index b70aa2c0a85ec..1962195e16a6f 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -416,7 +416,9 @@ static int ksz8_r_dyn_mac_table(struct ksz_device
> *dev, u16 addr, u8 *mac_addr,
> const u32 *masks;
> const u16 *regs;
> u16 ctrl_addr;
> + u64 buf = 0;
> u8 data;
> + int cnt;
> int rc;
If rc is initialized with 0, we don't need to assign rc = 0 in the
success path.
But otherwise
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
>
> shifts = dev->info->shifts;
> @@ -432,38 +434,38 @@ static int ksz8_r_dyn_mac_table(struct
> ksz_device *dev, u16 addr, u8 *mac_addr,
> if (rc == -EAGAIN) {
> if (addr == 0)
> *entries = 0;
> + goto unlock_alu;
> } else if (rc == -ENXIO) {
> *entries = 0;
> - /* At least one valid entry in the table. */
> - } else {
> - u64 buf = 0;
> - int cnt;
> -
> - ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
> - data_hi = (u32)(buf >> 32);
> - data_lo = (u32)buf;
> -
> - /* Check out how many valid entry in the table. */
> - cnt = data & masks[DYNAMIC_MAC_TABLE_ENTRIES_H];
> - cnt <<= shifts[DYNAMIC_MAC_ENTRIES_H];
> - cnt |= (data_hi & masks[DYNAMIC_MAC_TABLE_ENTRIES])
> >>
> - shifts[DYNAMIC_MAC_ENTRIES];
> - *entries = cnt + 1;
> -
> - *fid = (data_hi & masks[DYNAMIC_MAC_TABLE_FID]) >>
> - shifts[DYNAMIC_MAC_FID];
> - *src_port = (data_hi &
> masks[DYNAMIC_MAC_TABLE_SRC_PORT]) >>
> - shifts[DYNAMIC_MAC_SRC_PORT];
> -
> - mac_addr[5] = (u8)data_lo;
> - mac_addr[4] = (u8)(data_lo >> 8);
> - mac_addr[3] = (u8)(data_lo >> 16);
> - mac_addr[2] = (u8)(data_lo >> 24);
> -
> - mac_addr[1] = (u8)data_hi;
> - mac_addr[0] = (u8)(data_hi >> 8);
> - rc = 0;
> + goto unlock_alu;
> }
> +
> + ksz_read64(dev, regs[REG_IND_DATA_HI], &buf);
> + data_hi = (u32)(buf >> 32);
> + data_lo = (u32)buf;
> +
> + /* Check out how many valid entry in the table. */
> + cnt = data & masks[DYNAMIC_MAC_TABLE_ENTRIES_H];
> + cnt <<= shifts[DYNAMIC_MAC_ENTRIES_H];
> + cnt |= (data_hi & masks[DYNAMIC_MAC_TABLE_ENTRIES]) >>
> + shifts[DYNAMIC_MAC_ENTRIES];
> + *entries = cnt + 1;
> +
> + *fid = (data_hi & masks[DYNAMIC_MAC_TABLE_FID]) >>
> + shifts[DYNAMIC_MAC_FID];
> + *src_port = (data_hi & masks[DYNAMIC_MAC_TABLE_SRC_PORT]) >>
> + shifts[DYNAMIC_MAC_SRC_PORT];
> +
> + mac_addr[5] = (u8)data_lo;
> + mac_addr[4] = (u8)(data_lo >> 8);
> + mac_addr[3] = (u8)(data_lo >> 16);
> + mac_addr[2] = (u8)(data_lo >> 24);
> +
> + mac_addr[1] = (u8)data_hi;
> + mac_addr[0] = (u8)(data_hi >> 8);
> + rc = 0;
> +
> +unlock_alu:
> mutex_unlock(&dev->alu_mutex);
>
> return rc;
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table()
2024-04-02 13:13 ` [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table() Oleksij Rempel
@ 2024-04-02 15:45 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:45 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Use 'ret' instead of 'rc' in ksz8_r_dyn_mac_table() to maintain
> consistency with the rest of the file.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any
2024-04-02 13:13 ` [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any Oleksij Rempel
@ 2024-04-02 15:59 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-02 15:59 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> The read/write path may fail. So, return error if we got it.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability
2024-04-02 15:44 ` Arun.Ramadoss
@ 2024-04-02 17:07 ` Jakub Kicinski
0 siblings, 0 replies; 19+ messages in thread
From: Jakub Kicinski @ 2024-04-02 17:07 UTC (permalink / raw)
To: Arun.Ramadoss
Cc: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2 Apr 2024 15:44:30 +0000 Arun.Ramadoss@microchip.com wrote:
> > int rc;
>
> If rc is initialized with 0, we don't need to assign rc = 0 in the
> success path.
Not so sure -- it's easier for the compiler to catch uninitialized
variables than "accidentally stale" values.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries
2024-04-02 13:13 ` [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries Oleksij Rempel
@ 2024-04-03 8:18 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-03 8:18 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> We already have a variable to provide number of entries. So use it,
> instead of using error number.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout
2024-04-02 13:13 ` [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout Oleksij Rempel
@ 2024-04-03 8:21 ` Arun.Ramadoss
0 siblings, 0 replies; 19+ messages in thread
From: Arun.Ramadoss @ 2024-04-03 8:21 UTC (permalink / raw)
To: andrew, olteanv, davem, Woojung.Huh, pabeni, o.rempel, edumazet,
f.fainelli, kuba
Cc: kernel, san, linux-kernel, netdev, UNGLinuxDriver
On Tue, 2024-04-02 at 15:13 +0200, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> EAGAIN was not used by previous code and not used by current code.
> So,
> remove it and use proper error value.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
` (7 preceding siblings ...)
2024-04-02 13:13 ` [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries Oleksij Rempel
@ 2024-04-03 11:21 ` Vladimir Oltean
8 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2024-04-03 11:21 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Woojung Huh, Arun Ramadoss, kernel,
linux-kernel, netdev, UNGLinuxDriver, Søren Andersen
On Tue, Apr 02, 2024 at 03:13:31PM +0200, Oleksij Rempel wrote:
> Refactor FDB dump code path for Microchip KSZ8xxx series. This series
> mostly makes some cosmetic reworks and allows to forward errors detected
> by the regmap.
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-04-03 11:21 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 13:13 [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Oleksij Rempel
2024-04-02 13:13 ` [PATCH net-next v1 1/8] net: dsa: microchip: Remove unused FDB timestamp support in ksz8_r_dyn_mac_table() Oleksij Rempel
2024-04-02 15:28 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 2/8] net: dsa: microchip: Make ksz8_r_dyn_mac_table() static Oleksij Rempel
2024-04-02 15:29 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 3/8] net: dsa: microchip: ksz8: Refactor ksz8_fdb_dump() Oleksij Rempel
2024-04-02 15:37 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 4/8] net: dsa: microchip: ksz8: Refactor ksz8_r_dyn_mac_table() for readability Oleksij Rempel
2024-04-02 15:44 ` Arun.Ramadoss
2024-04-02 17:07 ` Jakub Kicinski
2024-04-02 13:13 ` [PATCH net-next v1 5/8] net: dsa: microchip: ksz8: Unify variable naming in ksz8_r_dyn_mac_table() Oleksij Rempel
2024-04-02 15:45 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 6/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): ksz: do not return EAGAIN on timeout Oleksij Rempel
2024-04-03 8:21 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 7/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): return read/write error if we got any Oleksij Rempel
2024-04-02 15:59 ` Arun.Ramadoss
2024-04-02 13:13 ` [PATCH net-next v1 8/8] net: dsa: microchip: ksz8_r_dyn_mac_table(): use entries variable to signal 0 entries Oleksij Rempel
2024-04-03 8:18 ` Arun.Ramadoss
2024-04-03 11:21 ` [PATCH net-next v1 0/8] net: dsa: microchip: ksz8: refactor FDB dump path Vladimir Oltean
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.