* [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump()
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-24 4:20 ` Arun.Ramadoss
2023-03-22 14:31 ` [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries Oleksij Rempel
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
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 <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 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,
×tamp, &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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump()
2023-03-22 14:31 ` [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() Oleksij Rempel
@ 2023-03-24 4:20 ` Arun.Ramadoss
0 siblings, 0 replies; 16+ messages in thread
From: Arun.Ramadoss @ 2023-03-24 4:20 UTC (permalink / raw)
To: olteanv, andrew, f.fainelli, kuba, edumazet, pabeni, o.rempel,
Woojung.Huh, davem
Cc: linux-kernel, netdev, UNGLinuxDriver, kernel
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 <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 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,
> ×tamp, &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 <arun.ramadoss@microchip.com>
> + ret = cb(mac, fid, false, data);
> if (ret)
> break;
> }
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
2023-03-22 14:31 ` [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-23 22:41 ` Jakub Kicinski
2023-03-24 3:51 ` Arun.Ramadoss
2023-03-22 14:31 ` [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed Oleksij Rempel
` (3 subsequent siblings)
5 siblings, 2 replies; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
Current ksz8_fdb_dump() is able to extract only max 249 entries on
the ksz8863/ksz8873 series of switches. This happened due to wrong
bit mask and offset calculation.
This commit corrects the issue and allows for the complete extraction of
all 1024 entries.
Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz_common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 7fc2155d93d6..3a1afc9f4621 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -407,10 +407,10 @@ static const u32 ksz8863_masks[] = {
[STATIC_MAC_TABLE_FID] = GENMASK(29, 26),
[STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
[STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
- [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(5, 0),
+ [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
[DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(7),
[DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7),
- [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 28),
+ [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 24),
[DYNAMIC_MAC_TABLE_FID] = GENMASK(19, 16),
[DYNAMIC_MAC_TABLE_SRC_PORT] = GENMASK(21, 20),
[DYNAMIC_MAC_TABLE_TIMESTAMP] = GENMASK(23, 22),
@@ -420,7 +420,7 @@ static u8 ksz8863_shifts[] = {
[VLAN_TABLE_MEMBERSHIP_S] = 16,
[STATIC_MAC_FWD_PORTS] = 16,
[STATIC_MAC_FID] = 22,
- [DYNAMIC_MAC_ENTRIES_H] = 3,
+ [DYNAMIC_MAC_ENTRIES_H] = 8,
[DYNAMIC_MAC_ENTRIES] = 24,
[DYNAMIC_MAC_FID] = 16,
[DYNAMIC_MAC_TIMESTAMP] = 24,
--
2.30.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries
2023-03-22 14:31 ` [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries Oleksij Rempel
@ 2023-03-23 22:41 ` Jakub Kicinski
2023-03-24 5:35 ` Oleksij Rempel
2023-03-24 3:51 ` Arun.Ramadoss
1 sibling, 1 reply; 16+ messages in thread
From: Jakub Kicinski @ 2023-03-23 22:41 UTC (permalink / raw)
To: Oleksij Rempel, Arun Ramadoss
Cc: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Paolo Abeni, Vladimir Oltean, Woojung Huh, kernel, linux-kernel,
netdev, UNGLinuxDriver
On Wed, 22 Mar 2023 15:31:26 +0100 Oleksij Rempel wrote:
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
The code move broke it? Looks like it was 5,0 before and 5,0 after
the change? We need a real tag, pointing to where the code was first
added.
Any reason you didn't CC Arun, just an omission or they're no longer
@microchip?
Arun, would you be able to review this series?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries
2023-03-23 22:41 ` Jakub Kicinski
@ 2023-03-24 5:35 ` Oleksij Rempel
2023-03-24 16:38 ` Jakub Kicinski
0 siblings, 1 reply; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-24 5:35 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Arun Ramadoss, Woojung Huh, Andrew Lunn, Florian Fainelli,
netdev, linux-kernel, UNGLinuxDriver, Eric Dumazet,
Vladimir Oltean, kernel, Paolo Abeni, David S. Miller
On Thu, Mar 23, 2023 at 03:41:01PM -0700, Jakub Kicinski wrote:
> On Wed, 22 Mar 2023 15:31:26 +0100 Oleksij Rempel wrote:
> > Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
>
> The code move broke it? Looks like it was 5,0 before and 5,0 after
> the change? We need a real tag, pointing to where the code was first
> added.
ack. will fix it.
> Any reason you didn't CC Arun, just an omission or they're no longer
> @microchip?
He is not in MAINTAINERS for drivers/net/dsa/microchip/* even if he is
practically maintaining it .. :)
> Arun, would you be able to review this series?
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries
2023-03-24 5:35 ` Oleksij Rempel
@ 2023-03-24 16:38 ` Jakub Kicinski
0 siblings, 0 replies; 16+ messages in thread
From: Jakub Kicinski @ 2023-03-24 16:38 UTC (permalink / raw)
To: Oleksij Rempel
Cc: Arun Ramadoss, Woojung Huh, Andrew Lunn, Florian Fainelli,
netdev, linux-kernel, UNGLinuxDriver, Eric Dumazet,
Vladimir Oltean, kernel, Paolo Abeni, David S. Miller
On Fri, 24 Mar 2023 06:35:12 +0100 Oleksij Rempel wrote:
> > Any reason you didn't CC Arun, just an omission or they're no longer
> > @microchip?
>
> He is not in MAINTAINERS for drivers/net/dsa/microchip/* even if he is
> practically maintaining it .. :)
get_maintainer is occasionally useful in pointing out people who wrote
the code but mostly the authors of code under Fixes. I use this little
script usually:
#!/usr/bin/env python3
import argparse
import fileinput
import subprocess
import tempfile
import sys
import os
import re
emailpat = re.compile(r'([^ <"]*@[^ >"]*)')
skip = {'kuba@kernel.org',
'davem@davemloft.net',
'pabeni@redhat.com',
'edumazet@google.com',
'netdev@vger.kernel.org',
'linux-kernel@vger.kernel.org'}
def do(lines):
ret = ['---']
for line in lines:
line = line.strip()
if not line:
continue
ret.append('# ' + line)
if "moderated" in line:
ret.append('# skip, moderated')
continue
match = emailpat.search(line)
if match:
addr = match.group(1)
if addr in skip:
ret.append('# skip, always-cc')
else:
ret.append('CC: ' + addr)
else:
ret.append('# Bad line')
return ret
def run(cmd):
p = subprocess.run(cmd, capture_output=True, check=True)
return p.stdout.decode("utf-8").strip()
def git_commit_msg():
return run(["git", "show", "--format=%B", "--no-patch"])
def git_commit(filename):
return run(["git", "commit", "--amend", "-F", filename])
def git_patch_format():
return run(["git", "format-patch", "HEAD~", "-o", "/tmp/"])
def get_maint(patch_file):
return run(["./scripts/get_maintainer.pl",
"--git-min-percent", "30", patch_file])
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--stdin',
help="Read the get_maintainer output from stdin",
action='store_true')
parser.add_argument('--inline', help="Amend HEAD directly",
action='store_true')
args = parser.parse_args()
if args.stdin:
out = do(sys.stdin.readlines())
elif args.inline:
msg = git_commit_msg()
patch_file = git_patch_format()
maint = get_maint(patch_file)
os.unlink(patch_file)
out = do(maint.split("\n"))
out = [l for l in out if l[0] != '#']
tmpf = tempfile.NamedTemporaryFile(mode='w+', encoding="utf-8")
tmpf.write(msg + '\n')
tmpf.write('\n'.join(out))
tmpf.flush()
git_commit(tmpf.name)
tmpf.close()
out = ["Updated inline: " + msg.split("\n")[0]]
else:
patch_file = git_patch_format()
maint = get_maint(patch_file)
os.remove(patch_file)
out = do(maint.split("\n"))
print('\n'.join(out))
if __name__ == '__main__':
sys.exit(main())
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries
2023-03-22 14:31 ` [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries Oleksij Rempel
2023-03-23 22:41 ` Jakub Kicinski
@ 2023-03-24 3:51 ` Arun.Ramadoss
1 sibling, 0 replies; 16+ messages in thread
From: Arun.Ramadoss @ 2023-03-24 3:51 UTC (permalink / raw)
To: olteanv, andrew, f.fainelli, kuba, edumazet, pabeni, o.rempel,
Woojung.Huh, davem
Cc: linux-kernel, netdev, UNGLinuxDriver, kernel
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
>
> Current ksz8_fdb_dump() is able to extract only max 249 entries on
> the ksz8863/ksz8873 series of switches. This happened due to wrong
> bit mask and offset calculation.
>
> This commit corrects the issue and allows for the complete extraction
> of
> all 1024 entries.
>
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to
> ksz_common")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/dsa/microchip/ksz_common.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c
> index 7fc2155d93d6..3a1afc9f4621 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -407,10 +407,10 @@ static const u32 ksz8863_masks[] = {
> [STATIC_MAC_TABLE_FID] = GENMASK(29, 26),
> [STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
> [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
> - [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(5, 0),
> + [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
> [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(7),
> [DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7),
> - [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 28),
> + [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 24),
> [DYNAMIC_MAC_TABLE_FID] = GENMASK(19, 16),
> [DYNAMIC_MAC_TABLE_SRC_PORT] = GENMASK(21, 20),
> [DYNAMIC_MAC_TABLE_TIMESTAMP] = GENMASK(23, 22),
> @@ -420,7 +420,7 @@ static u8 ksz8863_shifts[] = {
> [VLAN_TABLE_MEMBERSHIP_S] = 16,
> [STATIC_MAC_FWD_PORTS] = 16,
> [STATIC_MAC_FID] = 22,
> - [DYNAMIC_MAC_ENTRIES_H] = 3,
> + [DYNAMIC_MAC_ENTRIES_H] = 8,
> [DYNAMIC_MAC_ENTRIES] = 24,
> [DYNAMIC_MAC_FID] = 16,
> [DYNAMIC_MAC_TIMESTAMP] = 24,
Cross verified the above entries with datasheet.
As Jakub mentioned, above fix commit is just code movement from
ksz8795.c to ksz_common.
Other than Fix commit, patch Looks good to me.
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
2023-03-22 14:31 ` [PATCH net v1 1/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() Oleksij Rempel
2023-03-22 14:31 ` [PATCH net v1 2/6] net: dsa: microchip: ksz8: fix ksz8_fdb_dump() to extract all 1024 entries Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-24 3:58 ` Arun.Ramadoss
2023-03-22 14:31 ` [PATCH net v1 4/6] net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table Oleksij Rempel
` (2 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
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 <o.rempel@pengutronix.de>
---
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed
2023-03-22 14:31 ` [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed Oleksij Rempel
@ 2023-03-24 3:58 ` Arun.Ramadoss
0 siblings, 0 replies; 16+ messages in thread
From: Arun.Ramadoss @ 2023-03-24 3:58 UTC (permalink / raw)
To: olteanv, andrew, f.fainelli, kuba, edumazet, pabeni, o.rempel,
Woojung.Huh, davem
Cc: linux-kernel, netdev, UNGLinuxDriver, kernel
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 <o.rempel@pengutronix.de>
> ---
> 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 <arun.ramadoss@microchip.com>
> [DYNAMIC_MAC_SRC_PORT] = 20,
> };
>
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net v1 4/6] net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table.
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
` (2 preceding siblings ...)
2023-03-22 14:31 ` [PATCH net v1 3/6] net: dsa: microchip: ksz8: fix offset for the timestamp filed Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-24 4:04 ` Arun.Ramadoss
2023-03-22 14:31 ` [PATCH net v1 5/6] net: dsa: microchip: ksz8863_smi: fix bulk access Oleksij Rempel
2023-03-22 14:31 ` [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID Oleksij Rempel
5 siblings, 1 reply; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
If the dynamic MAC table is empty, we will still extract one outdated
entry. Fix it by using correct bit offset.
Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
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 c914449645ca..4929fb29ed06 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -408,7 +408,7 @@ static const u32 ksz8863_masks[] = {
[STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
[STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
[DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
- [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(7),
+ [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(2),
[DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7),
[DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 24),
[DYNAMIC_MAC_TABLE_FID] = GENMASK(19, 16),
--
2.30.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 4/6] net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table.
2023-03-22 14:31 ` [PATCH net v1 4/6] net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table Oleksij Rempel
@ 2023-03-24 4:04 ` Arun.Ramadoss
0 siblings, 0 replies; 16+ messages in thread
From: Arun.Ramadoss @ 2023-03-24 4:04 UTC (permalink / raw)
To: olteanv, andrew, f.fainelli, kuba, edumazet, pabeni, o.rempel,
Woojung.Huh, davem
Cc: linux-kernel, netdev, UNGLinuxDriver, kernel
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
>
> If the dynamic MAC table is empty, we will still extract one outdated
> entry. Fix it by using correct bit offset.
>
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to
> ksz_common")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> 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 c914449645ca..4929fb29ed06 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -408,7 +408,7 @@ static const u32 ksz8863_masks[] = {
> [STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
> [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
> [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
> - [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(7),
> + [DYNAMIC_MAC_TABLE_MAC_EMPTY] = BIT(2),
Cross verified the bit mask with datasheet.
Patch Looks good to me.
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> [DYNAMIC_MAC_TABLE_NOT_READY] = BIT(7),
> [DYNAMIC_MAC_TABLE_ENTRIES] = GENMASK(31, 24),
> [DYNAMIC_MAC_TABLE_FID] = GENMASK(19, 16),
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net v1 5/6] net: dsa: microchip: ksz8863_smi: fix bulk access
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
` (3 preceding siblings ...)
2023-03-22 14:31 ` [PATCH net v1 4/6] net: dsa: microchip: ksz8: ksz8_fdb_dump: avoid extracting ghost entry from empty dynamic MAC table Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-22 14:31 ` [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID Oleksij Rempel
5 siblings, 0 replies; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
Current regmap bulk access is broken, resulting to wrong reads/writes
if ksz_read64/ksz_write64 functions are used.
Mostly this issue was visible by using ksz8_fdb_dump(), which returned
corrupt MAC address.
The reason is that regmap was configured to have max_raw_read/write,
even if ksz8863_mdio_read/write functions are able to handle unlimited
read/write accesses. On ksz_read64 function we are using multiple 32bit
accesses by incrementing each access by 1 instead of 4. Resulting buffer
had 01234567.12345678 instead of 01234567.89abcdef.
We have multiple ways to fix it:
- enable 4 byte alignment for 32bit accesses. Since the HW do not have
this requirement. It will break driver.
- disable max_raw_* limit.
This patch is removing max_raw_* limit for regmap accesses in ksz8863_smi.
Fixes: 60a364760002 ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/dsa/microchip/ksz8863_smi.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c
index 2f4623f3bd85..2516c9db7fec 100644
--- a/drivers/net/dsa/microchip/ksz8863_smi.c
+++ b/drivers/net/dsa/microchip/ksz8863_smi.c
@@ -70,6 +70,7 @@ static int ksz8863_mdio_write(void *ctx, const void *data, size_t count)
tmp, val[i]);
if (ret < 0)
goto out;
+
}
out:
@@ -82,22 +83,16 @@ static const struct regmap_bus regmap_smi[] = {
{
.read = ksz8863_mdio_read,
.write = ksz8863_mdio_write,
- .max_raw_read = 1,
- .max_raw_write = 1,
},
{
.read = ksz8863_mdio_read,
.write = ksz8863_mdio_write,
.val_format_endian_default = REGMAP_ENDIAN_BIG,
- .max_raw_read = 2,
- .max_raw_write = 2,
},
{
.read = ksz8863_mdio_read,
.write = ksz8863_mdio_write,
.val_format_endian_default = REGMAP_ENDIAN_BIG,
- .max_raw_read = 4,
- .max_raw_write = 4,
}
};
@@ -108,7 +103,6 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.pad_bits = 24,
.val_bits = 8,
.cache_type = REGCACHE_NONE,
- .use_single_read = 1,
.lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock,
},
@@ -118,7 +112,6 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.pad_bits = 24,
.val_bits = 16,
.cache_type = REGCACHE_NONE,
- .use_single_read = 1,
.lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock,
},
@@ -128,7 +121,6 @@ static const struct regmap_config ksz8863_regmap_config[] = {
.pad_bits = 24,
.val_bits = 32,
.cache_type = REGCACHE_NONE,
- .use_single_read = 1,
.lock = ksz_regmap_lock,
.unlock = ksz_regmap_unlock,
}
--
2.30.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID
2023-03-22 14:31 [PATCH net v1 0/6] net: dsa: microchip: ksz8: fixes for stable Oleksij Rempel
` (4 preceding siblings ...)
2023-03-22 14:31 ` [PATCH net v1 5/6] net: dsa: microchip: ksz8863_smi: fix bulk access Oleksij Rempel
@ 2023-03-22 14:31 ` Oleksij Rempel
2023-03-23 6:00 ` Oleksij Rempel
2023-03-24 4:08 ` Arun.Ramadoss
5 siblings, 2 replies; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-22 14:31 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: Oleksij Rempel, kernel, linux-kernel, netdev, UNGLinuxDriver
FID is directly mapped to VID. However, configuring a MAC address with a
VID != 0 resulted in incorrect configuration due to an incorrect bit
mask. This kernel commit fixed the issue by correcting the bit mask and
ensuring proper configuration of MAC addresses with non-zero VID.
Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
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 4929fb29ed06..74c56d05ab0b 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -404,7 +404,7 @@ static const u32 ksz8863_masks[] = {
[VLAN_TABLE_VALID] = BIT(19),
[STATIC_MAC_TABLE_VALID] = BIT(19),
[STATIC_MAC_TABLE_USE_FID] = BIT(21),
- [STATIC_MAC_TABLE_FID] = GENMASK(29, 26),
+ [STATIC_MAC_TABLE_FID] = GENMASK(25, 22),
[STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
[STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
[DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
--
2.30.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID
2023-03-22 14:31 ` [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID Oleksij Rempel
@ 2023-03-23 6:00 ` Oleksij Rempel
2023-03-24 4:08 ` Arun.Ramadoss
1 sibling, 0 replies; 16+ messages in thread
From: Oleksij Rempel @ 2023-03-23 6:00 UTC (permalink / raw)
To: David S. Miller, Andrew Lunn, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Paolo Abeni, Vladimir Oltean, Woojung Huh
Cc: UNGLinuxDriver, linux-kernel, kernel, netdev
A typo in subject s/MDF/MDB
On Wed, Mar 22, 2023 at 03:31:30PM +0100, Oleksij Rempel wrote:
> FID is directly mapped to VID. However, configuring a MAC address with a
> VID != 0 resulted in incorrect configuration due to an incorrect bit
> mask. This kernel commit fixed the issue by correcting the bit mask and
> ensuring proper configuration of MAC addresses with non-zero VID.
>
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to ksz_common")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> 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 4929fb29ed06..74c56d05ab0b 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -404,7 +404,7 @@ static const u32 ksz8863_masks[] = {
> [VLAN_TABLE_VALID] = BIT(19),
> [STATIC_MAC_TABLE_VALID] = BIT(19),
> [STATIC_MAC_TABLE_USE_FID] = BIT(21),
> - [STATIC_MAC_TABLE_FID] = GENMASK(29, 26),
> + [STATIC_MAC_TABLE_FID] = GENMASK(25, 22),
> [STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
> [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
> [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
> --
> 2.30.2
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID
2023-03-22 14:31 ` [PATCH net v1 6/6] net: dsa: microchip: ksz8: fix MDF configuration with non-zero VID Oleksij Rempel
2023-03-23 6:00 ` Oleksij Rempel
@ 2023-03-24 4:08 ` Arun.Ramadoss
1 sibling, 0 replies; 16+ messages in thread
From: Arun.Ramadoss @ 2023-03-24 4:08 UTC (permalink / raw)
To: olteanv, andrew, f.fainelli, kuba, edumazet, pabeni, o.rempel,
Woojung.Huh, davem
Cc: linux-kernel, netdev, UNGLinuxDriver, kernel
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
>
> FID is directly mapped to VID. However, configuring a MAC address
> with a
> VID != 0 resulted in incorrect configuration due to an incorrect bit
> mask. This kernel commit fixed the issue by correcting the bit mask
> and
> ensuring proper configuration of MAC addresses with non-zero VID.
>
> Fixes: d23a5e18606c ("net: dsa: microchip: move ksz8->masks to
> ksz_common")
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> 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 4929fb29ed06..74c56d05ab0b 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -404,7 +404,7 @@ static const u32 ksz8863_masks[] = {
> [VLAN_TABLE_VALID] = BIT(19),
> [STATIC_MAC_TABLE_VALID] = BIT(19),
> [STATIC_MAC_TABLE_USE_FID] = BIT(21),
> - [STATIC_MAC_TABLE_FID] = GENMASK(29, 26),
> + [STATIC_MAC_TABLE_FID] = GENMASK(25, 22),
Cross verified the bit mask with datasheet.
Patch Looks good to me.
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> [STATIC_MAC_TABLE_OVERRIDE] = BIT(20),
> [STATIC_MAC_TABLE_FWD_PORTS] = GENMASK(18, 16),
> [DYNAMIC_MAC_TABLE_ENTRIES_H] = GENMASK(1, 0),
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 16+ messages in thread