From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn 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 Message-ID: <20171111154111.GB8685@lunn.ch> References: <20171110232255.2462-1-f.fainelli@gmail.com> <20171110232255.2462-2-f.fainelli@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, vivien.didelot@savoirfairelinux.com To: Florian Fainelli Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:52715 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750929AbdKKPlP (ORCPT ); Sat, 11 Nov 2017 10:41:15 -0500 Content-Disposition: inline In-Reply-To: <20171110232255.2462-2-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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