diff mbox series

[net-next,1/2] net: dsa: mv88e6xxx: Require ops be implemented to claim STU support

Message ID 20220318201321.4010543-2-tobias@waldekranz.com (mailing list archive)
State Accepted
Commit afaed2b142a1ab896764b03d8d26dc8778ea887c
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: mv88e6xxx: MST Fixes | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Tobias Waldekranz March 18, 2022, 8:13 p.m. UTC
Simply having a physical STU table in the device doesn't do us any
good if there's no implementation of the relevant ops to access that
table. So ensure that chips that claim STU support can also talk to
the hardware.

This fixes an issue where chips that had a their ->info->max_sid
set (due to their family membership), but no implementation (due to
their chip-specific ops struct) would fail to probe.

Fixes: 49c98c1dc7d9 ("net: dsa: mv88e6xxx: Disentangle STU from VTU")
Reported-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 drivers/net/dsa/mv88e6xxx/chip.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Vladimir Oltean March 18, 2022, 8:40 p.m. UTC | #1
On Fri, Mar 18, 2022 at 09:13:20PM +0100, Tobias Waldekranz wrote:
> Simply having a physical STU table in the device doesn't do us any
> good if there's no implementation of the relevant ops to access that
> table. So ensure that chips that claim STU support can also talk to
> the hardware.
> 
> This fixes an issue where chips that had a their ->info->max_sid
> set (due to their family membership), but no implementation (due to
> their chip-specific ops struct) would fail to probe.
> 
> Fixes: 49c98c1dc7d9 ("net: dsa: mv88e6xxx: Disentangle STU from VTU")
> Reported-by: Marek Behún <kabel@kernel.org>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

(with the mention that Marek's problem is probably still not solved)

>  drivers/net/dsa/mv88e6xxx/chip.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
> index 6a0b66354e1d..5e03cfe50156 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.h
> +++ b/drivers/net/dsa/mv88e6xxx/chip.h
> @@ -730,7 +730,9 @@ struct mv88e6xxx_hw_stat {
>  
>  static inline bool mv88e6xxx_has_stu(struct mv88e6xxx_chip *chip)
>  {
> -	return chip->info->max_sid > 0;
> +	return chip->info->max_sid > 0 &&
> +		chip->info->ops->stu_loadpurge &&
> +		chip->info->ops->stu_getnext;
>  }
>  
>  static inline bool mv88e6xxx_has_pvt(struct mv88e6xxx_chip *chip)
> -- 
> 2.25.1
>
Florian Fainelli March 18, 2022, 9:23 p.m. UTC | #2
On 3/18/22 1:13 PM, Tobias Waldekranz wrote:
> Simply having a physical STU table in the device doesn't do us any
> good if there's no implementation of the relevant ops to access that
> table. So ensure that chips that claim STU support can also talk to
> the hardware.
> 
> This fixes an issue where chips that had a their ->info->max_sid
> set (due to their family membership), but no implementation (due to
> their chip-specific ops struct) would fail to probe.
> 
> Fixes: 49c98c1dc7d9 ("net: dsa: mv88e6xxx: Disentangle STU from VTU")
> Reported-by: Marek Behún <kabel@kernel.org>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Marek Behún March 19, 2022, 7 p.m. UTC | #3
On Fri, 18 Mar 2022 21:13:20 +0100
Tobias Waldekranz <tobias@waldekranz.com> wrote:

> Simply having a physical STU table in the device doesn't do us any
> good if there's no implementation of the relevant ops to access that
> table. So ensure that chips that claim STU support can also talk to
> the hardware.
> 
> This fixes an issue where chips that had a their ->info->max_sid
> set (due to their family membership), but no implementation (due to
> their chip-specific ops struct) would fail to probe.
> 
> Fixes: 49c98c1dc7d9 ("net: dsa: mv88e6xxx: Disentangle STU from VTU")
> Reported-by: Marek Behún <kabel@kernel.org>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>

Tested-by: Marek Behún <kabel@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index 6a0b66354e1d..5e03cfe50156 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -730,7 +730,9 @@  struct mv88e6xxx_hw_stat {
 
 static inline bool mv88e6xxx_has_stu(struct mv88e6xxx_chip *chip)
 {
-	return chip->info->max_sid > 0;
+	return chip->info->max_sid > 0 &&
+		chip->info->ops->stu_loadpurge &&
+		chip->info->ops->stu_getnext;
 }
 
 static inline bool mv88e6xxx_has_pvt(struct mv88e6xxx_chip *chip)