From nobody Mon Feb 9 09:32:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90756C7EE25 for ; Fri, 9 Jun 2023 14:18:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241044AbjFIOSZ (ORCPT ); Fri, 9 Jun 2023 10:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239945AbjFIOSU (ORCPT ); Fri, 9 Jun 2023 10:18:20 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6808135A9; Fri, 9 Jun 2023 07:18:16 -0700 (PDT) X-GND-Sasl: alexis.lothore@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686320295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W+Vlu9friBOCTMyp0uxc69MbnwzC+52I1B39QfhvQrM=; b=jzDyozm7zpvmi82J9hKpAKqzzqfwHe7ZYnDNt5Qb04+YhXrwFdn7HmQS/sD9/A3LKcjKoS 4ZdYB86q01msP2HC7CyBdh80PTT2G2bkFQZVISZ9Cg1NXqP6SsFZWVXbfLgkN50hDFI4zJ Uvxlqfrm9zvoiGSeTnRRWMINU+I3Pw6BzUNITpAOO750HHkE5BDgIYCYmzp8yL4l+1/iRC FOONZ93DpegAVftJWq1aXmpjbmbKfFauWc623kGMVn+uB9w43PNa+LYzXdWLzDh66THmkO rY4RyDeDVzblzTPrVBpAqnk3FpnDL9gZ53mCaP4Warrrj44joSt5x93s8/b9UA== X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com X-GND-Sasl: alexis.lothore@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 3C60120011; Fri, 9 Jun 2023 14:18:14 +0000 (UTC) From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Thomas Petazzoni , paul.arola@telus.com, scott.roberts@telus.com Subject: [PATCH net-next 1/2] net: dsa: mv88e6xxx: allow driver to hook TC callback Date: Fri, 9 Jun 2023 16:18:11 +0200 Message-ID: <20230609141812.297521-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230609141812.297521-1-alexis.lothore@bootlin.com> References: <20230609141812.297521-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexis Lothor=C3=A9 Marvell switches have some traffic control offloading capabilities, like for example per-port rate limiting. Allow driver to benefit from this offloading by hooking TC setup callback in DSA Signed-off-by: Alexis Lothor=C3=A9 --- drivers/net/dsa/mv88e6xxx/chip.c | 17 +++++++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/c= hip.c index 8b51756bd805..0f1ae2aeaf00 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -7091,6 +7091,22 @@ static int mv88e6xxx_crosschip_lag_leave(struct dsa_= switch *ds, int sw_index, return err_sync ? : err_pvt; } =20 +static int mv88e6xxx_port_setup_tc(struct dsa_switch *ds, int port, + enum tc_setup_type type, void *type_data) +{ + struct mv88e6xxx_chip *chip =3D ds->priv; + int err; + + if (!chip->info->ops->port_setup_tc) + return -EOPNOTSUPP; + + mv88e6xxx_reg_lock(chip); + err =3D chip->info->ops->port_setup_tc(ds, port, type, type_data); + mv88e6xxx_reg_unlock(chip); + + return err; +} + static const struct dsa_switch_ops mv88e6xxx_switch_ops =3D { .get_tag_protocol =3D mv88e6xxx_get_tag_protocol, .change_tag_protocol =3D mv88e6xxx_change_tag_protocol, @@ -7158,6 +7174,7 @@ static const struct dsa_switch_ops mv88e6xxx_switch_o= ps =3D { .crosschip_lag_change =3D mv88e6xxx_crosschip_lag_change, .crosschip_lag_join =3D mv88e6xxx_crosschip_lag_join, .crosschip_lag_leave =3D mv88e6xxx_crosschip_lag_leave, + .port_setup_tc =3D mv88e6xxx_port_setup_tc, }; =20 static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip) diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/c= hip.h index 0ad34b2d8913..b259671b2cd7 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -560,7 +560,8 @@ struct mv88e6xxx_ops { */ int (*port_set_upstream_port)(struct mv88e6xxx_chip *chip, int port, int upstream_port); - + int (*port_setup_tc)(struct dsa_switch *ds, int port, + enum tc_setup_type type, void *type_data); /* Snapshot the statistics for a port. The statistics can then * be read back a leisure but still with a consistent view. */ --=20 2.41.0