netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: davem@davemloft.net, kuba@kernel.org, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware
Date: Fri, 15 Jan 2021 13:15:23 +0200	[thread overview]
Message-ID: <20210115111523.64itmntrl2ykn43x@skbuf> (raw)
In-Reply-To: <20210115105834.559-3-tobias@waldekranz.com>

On Fri, Jan 15, 2021 at 11:58:34AM +0100, Tobias Waldekranz wrote:
> There are chips that do have Global 2 registers, and therefore trunk
                       ~~
                       do not
> mapping/mask tables are not available. Additionally Global 2 register
> support is build-time optional, so we have to make sure that it is
> compiled in.
> 
> Fixes: 57e661aae6a8 ("net: dsa: mv88e6xxx: Link aggregation support")
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 4 ++++
>  drivers/net/dsa/mv88e6xxx/chip.h | 9 +++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index dcb1726b68cc..c48d166c2a70 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -5385,9 +5385,13 @@ static bool mv88e6xxx_lag_can_offload(struct dsa_switch *ds,
>  				      struct net_device *lag,
>  				      struct netdev_lag_upper_info *info)
>  {
> +	struct mv88e6xxx_chip *chip = ds->priv;
>  	struct dsa_port *dp;
>  	int id, members = 0;
>  
> +	if (!mv88e6xxx_has_lag(chip))
> +		return false;
> +
>  	id = dsa_lag_id(ds->dst, lag);
>  	if (id < 0 || id >= ds->num_lag_ids)
>  		return false;
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
> index 3543055bcb51..333b4fab5aa2 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.h
> +++ b/drivers/net/dsa/mv88e6xxx/chip.h
> @@ -662,6 +662,15 @@ static inline bool mv88e6xxx_has_pvt(struct mv88e6xxx_chip *chip)
>  	return chip->info->pvt;
>  }
>  
> +static inline bool mv88e6xxx_has_lag(struct mv88e6xxx_chip *chip)
> +{
> +#if (defined(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2))
> +	return chip->info->global2_addr != 0;
> +#else
> +	return false;
> +#endif
> +}
> +

Should we also report ds->num_lag_ids = 0 if !mv88e6xxx_has_lag()?

>  static inline unsigned int mv88e6xxx_num_databases(struct mv88e6xxx_chip *chip)
>  {
>  	return chip->info->num_databases;
> -- 
> 2.17.1
> 

  reply	other threads:[~2021-01-15 11:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 10:58 [PATCH net-next 0/2] net: dsa: mv88e6xxx: LAG fixes Tobias Waldekranz
2021-01-15 10:58 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Provide dummy implementations for trunk setters Tobias Waldekranz
2021-01-15 11:10   ` Vladimir Oltean
2021-01-15 14:30   ` Andrew Lunn
2021-01-15 14:36     ` Vladimir Oltean
2021-01-15 14:48       ` Andrew Lunn
2021-01-15 14:53         ` Vladimir Oltean
2021-01-15 20:12         ` Tobias Waldekranz
2021-01-18 17:54           ` Andrew Lunn
2021-01-15 10:58 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware Tobias Waldekranz
2021-01-15 11:15   ` Vladimir Oltean [this message]
2021-01-15 11:29     ` Vladimir Oltean
2021-01-15 14:39   ` Andrew Lunn

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=20210115111523.64itmntrl2ykn43x@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tobias@waldekranz.com \
    --cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).