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,URIBL_BLOCKED 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 62575C4332B for ; Thu, 14 Jan 2021 02:01:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2649623442 for ; Thu, 14 Jan 2021 02:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729766AbhANCAy (ORCPT ); Wed, 13 Jan 2021 21:00:54 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:39186 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729505AbhAMXhw (ORCPT ); Wed, 13 Jan 2021 18:37:52 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kzpgh-000Qlq-Hn; Thu, 14 Jan 2021 00:36:27 +0100 Date: Thu, 14 Jan 2021 00:36:27 +0100 From: Andrew Lunn To: Vladimir Oltean Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Alexander Duyck , Jamal Hadi Salim , Cong Wang , Jiri Pirko , f.fainelli@gmail.com, vivien.didelot@gmail.com Subject: Re: [RFC PATCH net-next 2/2] net: dsa: felix: offload port priority Message-ID: References: <20210113154139.1803705-1-olteanv@gmail.com> <20210113154139.1803705-3-olteanv@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210113154139.1803705-3-olteanv@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Archived-At: List-Archive: List-Post: On Wed, Jan 13, 2021 at 05:41:39PM +0200, Vladimir Oltean wrote: > From: Vladimir Oltean > > Even though we should really share the implementation with the ocelot > switchdev driver, that one needs a little bit of rework first, since its > struct ocelot_port_tc only supports one tc matchall action at a time, > which at the moment is used for port policers. Whereas DSA keeps a list > of port-based actions in struct dsa_slave_priv::mall_tc_list, so it is > much more easily extensible. It is too tempting to add the implementation > for the port priority directly in Felix at the moment, which is what we > do. > > Signed-off-by: Vladimir Oltean > --- > drivers/net/dsa/ocelot/felix.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c > index 768a74dc462a..5cc42c3aaf0d 100644 > --- a/drivers/net/dsa/ocelot/felix.c > +++ b/drivers/net/dsa/ocelot/felix.c > @@ -739,6 +739,20 @@ static void felix_port_policer_del(struct dsa_switch *ds, int port) > ocelot_port_policer_del(ocelot, port); > } > > +static int felix_port_priority_set(struct dsa_switch *ds, int port, > + struct dsa_mall_skbedit_tc_entry *skbedit) > +{ > + struct ocelot *ocelot = ds->priv; > + > + ocelot_rmw_gix(ocelot, > + ANA_PORT_QOS_CFG_QOS_DEFAULT_VAL(skbedit->priority), No range check? Seems like -ERANGE or similar would help avoid surprises when somebody asks for an unsupported priority and it gets masked to something much lower. Andrew