2023-03-22 14:37:37

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable

These fixes address issues such as incomplete FDB extraction, incorrect
FID extraction and configuration, incorrect timestamp extraction, and
ghost entry extraction from an empty dynamic MAC table. These updates
ensure proper functioning of the FDB/MDB functionality for the
ksz8863/ksz8873 series of chips.

Oleksij Rempel (6):
net: dsa: microchip: ksz8: fix ksz8_fdb_dump()
net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024
entries
net: dsa: microchip: ksz8: fix offset for the timestamp filed
net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry
from empty dynamic MAC table.
net: dsa: microchip: ksz8863_smi: fix bulk access
net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID

drivers/net/dsa/microchip/ksz8795.c | 11 +++++------
drivers/net/dsa/microchip/ksz8863_smi.c | 10 +---------
drivers/net/dsa/microchip/ksz_common.c | 12 ++++++------
3 files changed, 12 insertions(+), 21 deletions(-)

--
2.30.2


2023-03-22 14:38:12

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump()

Before this patch, the ksz8_fdb_dump() function had several issues, such
as uninitialized variables and incorrect usage of source port as a bit
mask. These problems caused inaccurate reporting of vid information and
port assignment in the bridge fdb.

Fixes: e587be759e6e ("net: dsa: microchip: update fdb add/del/dump in ksz_common")
Signed-off-by: Oleksij Rempel <[email protected]>
---
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 003b0ac2854c..3fffd5da8d3b 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -958,15 +958,14 @@ int ksz8_fdb_dump(struct ksz_device *dev, int port,
u16 entries = 0;
u8 timestamp = 0;
u8 fid;
- u8 member;
- struct alu_struct alu;
+ u8 src_port;
+ u8 mac[ETH_ALEN];

do {
- alu.is_static = false;
- ret = ksz8_r_dyn_mac_table(dev, i, alu.mac, &fid, &member,
+ ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid, &src_port,
&timestamp, &entries);
- if (!ret && (member & BIT(port))) {
- ret = cb(alu.mac, alu.fid, alu.is_static, data);
+ if (!ret && port == src_port) {
+ ret = cb(mac, fid, false, data);
if (ret)
break;
}
--
2.30.2

2023-03-22 14:38:41

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed

We are using wrong offset, so we will get not a timestamp.

Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
Signed-off-by: Oleksij Rempel <[email protected]>
---
drivers/net/dsa/microchip/ksz_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 3a1afc9f4621..c914449645ca 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -423,7 +423,7 @@ static u8 ksz8863_shifts[] = {
[DYNAMIC_MAC_ENTRIES_H] = 8,
[DYNAMIC_MAC_ENTRIES] = 24,
[DYNAMIC_MAC_FID] = 16,
- [DYNAMIC_MAC_TIMESTAMP] = 24,
+ [DYNAMIC_MAC_TIMESTAMP] = 22,
[DYNAMIC_MAC_SRC_PORT] = 20,
};

--
2.30.2

2023-03-24 04:06:28

by Arun Ramadoss

[permalink] [raw]
Subject: Re: [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed

Hi Oleksij,

On Wed, 2023-03-22 at 15:31 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> We are using wrong offset, so we will get not a timestamp.
>
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to
> ksz_common")
> Signed-off-by: Oleksij Rempel <[email protected]>
> ---
> drivers/net/dsa/microchip/ksz_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c
> index 3a1afc9f4621..c914449645ca 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -423,7 +423,7 @@ static u8 ksz8863_shifts[] = {
> [DYNAMIC_MAC_ENTRIES_H] = 8,
> [DYNAMIC_MAC_ENTRIES] = 24,
> [DYNAMIC_MAC_FID] = 16,
> - [DYNAMIC_MAC_TIMESTAMP] = 24,
> + [DYNAMIC_MAC_TIMESTAMP] = 22,

Cross verified the bit mask with datasheet.
Patch looks good to me.

Acked-by: Arun Ramadoss <[email protected]>

> [DYNAMIC_MAC_SRC_PORT] = 20,
> };
>
> --
> 2.30.2
>

2023-03-24 04:25:25

by Arun Ramadoss

[permalink] [raw]
Subject: Re: [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump()

Hi Oleksij,

On Wed, 2023-03-22 at 15:31 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Before this patch, the ksz8_fdb_dump() function had several issues,
> such
> as uninitialized variables and incorrect usage of source port as a
> bit
> mask. These problems caused inaccurate reporting of vid information
> and
> port assignment in the bridge fdb.
>
> Fixes: e587be759e6e ("net: dsa: microchip: update fdb add/del/dump in
> ksz_common")
> Signed-off-by: Oleksij Rempel <[email protected]>
> ---
> 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 003b0ac2854c..3fffd5da8d3b 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -958,15 +958,14 @@ int ksz8_fdb_dump(struct ksz_device *dev, int
> port,
> u16 entries = 0;
> u8 timestamp = 0;
> u8 fid;
> - u8 member;
> - struct alu_struct alu;
> + u8 src_port;
> + u8 mac[ETH_ALEN];
>
> do {
> - alu.is_static = false;
> - ret = ksz8_r_dyn_mac_table(dev, i, alu.mac, &fid,
> &member,
> + ret = ksz8_r_dyn_mac_table(dev, i, mac, &fid,
> &src_port,
> &timestamp, &entries);
> - if (!ret && (member & BIT(port))) {
> - ret = cb(alu.mac, alu.fid, alu.is_static,
> data);
> + if (!ret && port == src_port) {

Only in KSZ9477 series, it is BIT(port). For the KSZ87xx and KSZ88xx,
it is like logic table. i.e
00 = port 0
01 = port 1
02 = port 2

Cross Verified with the Datasheet.

Acked-by: Arun Ramadoss <[email protected]>


> + ret = cb(mac, fid, false, data);
> if (ret)
> break;
> }
> --
> 2.30.2
>