Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755654AbdCLCSJ (ORCPT ); Sat, 11 Mar 2017 21:18:09 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33135 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755049AbdCLCSB (ORCPT ); Sat, 11 Mar 2017 21:18:01 -0500 Subject: Re: [PATCH net-next v2 12/17] net: dsa: add dsa_is_normal_port helper To: Vivien Didelot , netdev@vger.kernel.org References: <20170311211303.24560-1-vivien.didelot@savoirfairelinux.com> <20170311211303.24560-13-vivien.didelot@savoirfairelinux.com> Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn From: Florian Fainelli Message-ID: Date: Sat, 11 Mar 2017 18:17:58 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170311211303.24560-13-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1013 Lines: 34 Le 03/11/17 à 13:12, Vivien Didelot a écrit : > Introduce a dsa_is_normal_port helper to check if a given port is a > normal user port as opposed to a CPU port or DSA link. net/dsa/dsa2.c uses the "user" terminology should we use something like that here? > > Signed-off-by: Vivien Didelot > --- > include/net/dsa.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/net/dsa.h b/include/net/dsa.h > index 4e13e695f025..bf0e42c2a6f7 100644 > --- a/include/net/dsa.h > +++ b/include/net/dsa.h > @@ -248,6 +248,11 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) > return !!((ds->dsa_port_mask) & (1 << p)); > } > > +static inline bool dsa_is_normal_port(struct dsa_switch *ds, int p) > +{ > + return !dsa_is_cpu_port(ds, p) && !dsa_is_dsa_port(ds, p); > +} > + > static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p) > { > return ds->enabled_port_mask & (1 << p) && ds->ports[p].netdev; > -- Florian