From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF2BCC43461 for ; Wed, 7 Apr 2021 00:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93588613C0 for ; Wed, 7 Apr 2021 00:16:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347521AbhDGARC (ORCPT ); Tue, 6 Apr 2021 20:17:02 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:37058 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347459AbhDGAQl (ORCPT ); Tue, 6 Apr 2021 20:16:41 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lTvrx-00FDZF-Oq; Wed, 07 Apr 2021 02:16:29 +0200 Date: Wed, 7 Apr 2021 02:16:29 +0200 From: Andrew Lunn To: Ansuel Smith Cc: Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] include: net: add dsa_cpu_ports function Message-ID: References: <20210406034903.14329-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210406034903.14329-1-ansuelsmth@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021 at 05:49:03AM +0200, Ansuel Smith wrote: > In preparation for the future when dsa will support multi cpu port, > dsa_cpu_ports can be useful for switch that has multiple cpu port to > retrieve the cpu mask for ACL and bridge table. > > Signed-off-by: Ansuel Smith > --- > include/net/dsa.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/include/net/dsa.h b/include/net/dsa.h > index 83a933e563fe..d71b1acd9c3e 100644 > --- a/include/net/dsa.h > +++ b/include/net/dsa.h > @@ -446,6 +446,18 @@ static inline u32 dsa_user_ports(struct dsa_switch *ds) > return mask; > } > > +static inline u32 dsa_cpu_ports(struct dsa_switch *ds) > +{ > + u32 mask = 0; > + int p; > + > + for (p = 0; p < ds->num_ports; p++) > + if (dsa_is_cpu_port(ds, p)) > + mask |= BIT(p); > + > + return mask; > +} Hi Ansuel We don't add a function unless it has a user. Please call it from somewhere. Andrew