All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	vivien.didelot@savoirfairelinux.com
Subject: Re: [PATCH net-next 1/4] net: dsa: Pass a port to get_tag_protocol()
Date: Sat, 11 Nov 2017 16:41:11 +0100	[thread overview]
Message-ID: <20171111154111.GB8685@lunn.ch> (raw)
In-Reply-To: <20171110232255.2462-2-f.fainelli@gmail.com>

On Fri, Nov 10, 2017 at 03:22:52PM -0800, Florian Fainelli wrote:
> A number of drivers want to check whether the configured CPU port is a
> possible configuration for enabling tagging, pass down the CPU port
> number so they verify that.
> 
> -static bool b53_can_enable_brcm_tags(struct dsa_switch *ds)
> +static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port)
>  {
> -	unsigned int brcm_tag_mask;
> -	unsigned int i;
> -
>  	/* Broadcom switches will accept enabling Broadcom tags on the
>  	 * following ports: 5, 7 and 8, any other port is not supported
>  	 */
> -	brcm_tag_mask = BIT(B53_CPU_PORT_25) | BIT(7) | BIT(B53_CPU_PORT);
> -
> -	for (i = 0; i < ds->num_ports; i++) {
> -		if (dsa_is_cpu_port(ds, i)) {
> -			if (!(BIT(i) & brcm_tag_mask)) {
> -				dev_warn(ds->dev,
> -					 "Port %d is not Broadcom tag capable\n",
> -					 i);
> -				return false;
> -			}
> -		}
> +	switch (port) {
> +	case B53_CPU_PORT_25:
> +	case 7:
> +	case B53_CPU_PORT:
> +		return true;
>  	}
>  
> -	return true;
> +	dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", port);
> +	return false;
>  }

Hi Florian

This looks a lot better than the previous implementation.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

  parent reply	other threads:[~2017-11-11 15:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 23:22 [PATCH net-next 0/4] net: dsa: b53: Support prepended Broadcom tags Florian Fainelli
2017-11-10 23:22 ` [PATCH net-next 1/4] net: dsa: Pass a port to get_tag_protocol() Florian Fainelli
2017-11-10 23:35   ` Vivien Didelot
2017-11-11 15:41   ` Andrew Lunn [this message]
2017-11-10 23:22 ` [PATCH net-next 2/4] net: dsa: tag_brcm: Prepare for supporting prepended tag Florian Fainelli
2017-11-11 15:50   ` Andrew Lunn
2017-11-10 23:22 ` [PATCH net-next 3/4] net: dsa: Support prepended Broadcom tag Florian Fainelli
2017-11-11 15:51   ` Andrew Lunn
2017-11-10 23:22 ` [PATCH net-next 4/4] net: dsa: b53: Support prepended Broadcom tags Florian Fainelli
2017-11-11 15:53   ` Andrew Lunn
2017-11-13  1:35 ` [PATCH net-next 0/4] " David Miller

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=20171111154111.GB8685@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.