From patchwork Wed Jan 13 15:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12017183 X-Patchwork-Delegate: kuba@kernel.org 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 2A9E9C433E9 for ; Wed, 13 Jan 2021 15:42:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E494523715 for ; Wed, 13 Jan 2021 15:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727041AbhAMPmc (ORCPT ); Wed, 13 Jan 2021 10:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbhAMPmb (ORCPT ); Wed, 13 Jan 2021 10:42:31 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF7CC061795 for ; Wed, 13 Jan 2021 07:41:50 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id jx16so3676210ejb.10 for ; Wed, 13 Jan 2021 07:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TvkS6i4Fyjzn1ikKAEuAkoStATy8hbPW+VQB7jOQ0kU=; b=eCNUIkpcJv/737U2dz6PTiX88o5c4NodTvoL51QO6SD7kTUvu68Ir+SQUpOBUKEZ7D YQUvukIwJM5ACHUFuyxUCk2F/zm9ikp726cHaAlP+Nl/eo03afsy46EFIDQ6iQQyhOJv 5XSLAiof1flW7zIjMK2weC3sCZffwsaLkD5mbo3Y0yKEq6cTkr157Net01IURjb+6X5o R+au1X/grs3tjpritL44+UhCqeybCZAFxL4w16VESvdWtJfydbospVe/9dwhasAEdpar 8Y+H5QAcRdIQHxby1Q/T5ceM8WW+Snw0pKGIPFHreBEbb3B4UlnRO49/AL7fwulO8mxi OZjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TvkS6i4Fyjzn1ikKAEuAkoStATy8hbPW+VQB7jOQ0kU=; b=FdDaukT2kZBwhVCzpncN6UHpfBeUWtsRlMBh50p9bRBjv72cTjrxHp5zHC042JYc9h BU5RHlqZ1k+lBvWEaKtbwmb9q/lLcufJIYW4sk+Qd/cfLGutXIkCgIvNAOKZ+u6iS2sw Wp0gc24lZjq49Yp1UzZdmyODjwC9sjQgxwQSc9Pp4qLpdU9rZBLXliHnc/bk519k2NHX ZK3ppRJYaDo7gpyT/gjqW1lIZ/vEpw+7hhtawlHAhJ27qlL765c8iCHinME/RoHs+2AX VLu7YJweBwAcE+LB2Mn5/urhvqUJi3xndb1jxMbZYeO8V3r9tE4hFeCC4/gvPpQ8RdRl HX4w== X-Gm-Message-State: AOAM530Exjo4Bs4bFOeAEKEu5NCS/9Pjb3ecNDfQidbaY7GocuCDwX23 C+NfBQHtf+g2rpwZDIvSZcI= X-Google-Smtp-Source: ABdhPJzr1L1qtW1R6kbxMBI81mEKKmU6RYdQMhvrAjTox4rtFrBElokwLq7TKZHHvDJU4WsqJnPOJg== X-Received: by 2002:a17:907:3d90:: with SMTP id he16mr2076443ejc.235.1610552509569; Wed, 13 Jan 2021 07:41:49 -0800 (PST) Received: from localhost.localdomain (5-12-227-87.residential.rdsnet.ro. [5.12.227.87]) by smtp.gmail.com with ESMTPSA id bn21sm852499ejb.47.2021.01.13.07.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 07:41:48 -0800 (PST) From: Vladimir Oltean To: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Ido Schimmel , Petr Machata , Alexander Duyck , Jamal Hadi Salim , Cong Wang , Jiri Pirko , andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com Subject: [RFC PATCH net-next 2/2] net: dsa: felix: offload port priority Date: Wed, 13 Jan 2021 17:41:39 +0200 Message-Id: <20210113154139.1803705-3-olteanv@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210113154139.1803705-1-olteanv@gmail.com> References: <20210113154139.1803705-1-olteanv@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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), + ANA_PORT_QOS_CFG_QOS_DEFAULT_VAL_M, + ANA_PORT_QOS_CFG, + port); + + return 0; +} + static int felix_port_setup_tc(struct dsa_switch *ds, int port, enum tc_setup_type type, void *type_data) @@ -786,6 +800,7 @@ const struct dsa_switch_ops felix_switch_ops = { .port_max_mtu = felix_get_max_mtu, .port_policer_add = felix_port_policer_add, .port_policer_del = felix_port_policer_del, + .port_priority_set = felix_port_priority_set, .cls_flower_add = felix_cls_flower_add, .cls_flower_del = felix_cls_flower_del, .cls_flower_stats = felix_cls_flower_stats,