public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Tristram Ha <Tristram.Ha@microchip.com>
Subject: Re: [Patch net] net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry
Date: Sun, 14 Aug 2022 10:56:24 +0300	[thread overview]
Message-ID: <20220814075624.us3ru5f45hsw6phb@skbuf> (raw)
In-Reply-To: <20220812093411.5879-1-arun.ramadoss@microchip.com> <20220812093411.5879-1-arun.ramadoss@microchip.com>

On Fri, Aug 12, 2022 at 03:04:11PM +0530, Arun Ramadoss wrote:
> In the ksz9477_fdb_dump function it reads the ALU control register and
> exit from the timeout loop if there is valid entry or search is
> complete. After exiting the loop, it reads the alu entry and report to
> the user space irrespective of entry is valid. It works till the valid
> entry. If the loop exited when search is complete, it reads the alu
> table. The table returns all ones and it is reported to user space. So
> bridge fdb show gives ff:ff:ff:ff:ff:ff as last entry for every port.
> To fix it, after exiting the loop the entry is reported only if it is
> valid one.
> 
> Fixes: c2e866911e25 ("net: dsa: microchip: break KSZ9477 DSA driver into two files")

I think this should be:
Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477")
since that's when ksz9477_port_fdb_dump() was introduced, with identical
logic.

> Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> ---
>  drivers/net/dsa/microchip/ksz9477.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 4b14d80d27ed..aa961dc03ddf 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -613,15 +613,17 @@ int ksz9477_fdb_dump(struct ksz_device *dev, int port,
>  			goto exit;
>  		}
>  
> -		/* read ALU table */
> -		ksz9477_read_table(dev, alu_table);
> +		if (ksz_data & ALU_VALID) {

I wonder if you could avoid increasing the indentation level using:

		if (!(ksz_data & ALU_VALID))
			continue;

> +			/* read ALU table */
> +			ksz9477_read_table(dev, alu_table);
>  
> -		ksz9477_convert_alu(&alu, alu_table);
> +			ksz9477_convert_alu(&alu, alu_table);
>  
> -		if (alu.port_forward & BIT(port)) {
> -			ret = cb(alu.mac, alu.fid, alu.is_static, data);
> -			if (ret)
> -				goto exit;
> +			if (alu.port_forward & BIT(port)) {
> +				ret = cb(alu.mac, alu.fid, alu.is_static, data);
> +				if (ret)
> +					goto exit;
> +			}
>  		}
>  	} while (ksz_data & ALU_START);
>  
> 
> base-commit: f86d1fbbe7858884d6754534a0afbb74fc30bc26
> -- 
> 2.36.1
> 


      reply	other threads:[~2022-08-14  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12  9:34 [Patch net] net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry Arun Ramadoss
2022-08-14  7:56 ` Vladimir Oltean [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220814075624.us3ru5f45hsw6phb@skbuf \
    --to=olteanv@gmail.com \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox