Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1672549ybk; Mon, 11 May 2020 01:21:26 -0700 (PDT) X-Google-Smtp-Source: APiQypLSqDGGXoKUc+HkMw85Gh+zV8AzbudQLYj2wkLZA1qEiF0vMXHHkaFAoWAFsoLWOQjr+gV2 X-Received: by 2002:aa7:c5cf:: with SMTP id h15mr12713595eds.213.1589185286452; Mon, 11 May 2020 01:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589185286; cv=none; d=google.com; s=arc-20160816; b=eXGx78l/3pxJebvIQiSMxbCkd77cXU7P2fbeUnW+RRvzgRmHjjU6jGYmyglxiciDGT D1iorDVajTaJM+LYxIHAGKFKNkxjHHqsvB+YAMXfO1zGP9gh1Wz1sdHQUnspEY7RHMfE GGNSP9Ufcs2PvIYuWy0cR5FkNdAuzJ7lC2UXQqUc7y1p2gNTvQWo2+VJBKZUNXx2m/2o WMr3XdUbVX8WJXmhC25doJ7lZsyNXRktpwzu7D1LClMZYscbPmss8TjKqZw5BKsIr2q0 1RZlyhEyc/khek5KK3KAXkotioV1j2VFr1c0dNWJ68HQX6yJtylQwZKGJLarkJatYVV/ d43w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=od2u5BNJcS+h2O2BE/eOiO0deB7ahR5tMprD43wG3iw=; b=U55MvwJMBrul7eq2qHxqNe9MMiwyJZu+KnuWE6Hn8L9FqQ1aKPHaHnz+PDfMUlH+oF c65r+6XgmEeCy6OR/zOA1dgV20WLpL3j1a6Ca44LaTGWOSKrlUNFA7x75JXmCIbl+dVv zODz/DFZeMmqB7BRbMH/dwp7kFqEuDoTaZZt1BerqpGeAgNMqQeh9XVj+Ia6K5S+91pC m3NfF7Fo2X2OK/HdtZmlzLsWIJM0ohfXzZ2Tssi2ETk9SY38F7VHNzy/sR02Kw8NG3LE jmMPgjSCYdnonNS9Q4k/sPeIkMEAZAP90BEPH5EE3eNhpLWH/M7NNxwuSgRhhmPFMLD6 zybg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rAWgP9fi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si173896edm.289.2020.05.11.01.21.03; Mon, 11 May 2020 01:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rAWgP9fi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728777AbgEKITl (ORCPT + 99 others); Mon, 11 May 2020 04:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728556AbgEKITl (ORCPT ); Mon, 11 May 2020 04:19:41 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF221C061A0C; Mon, 11 May 2020 01:19:40 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id l3so7158430edq.13; Mon, 11 May 2020 01:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=od2u5BNJcS+h2O2BE/eOiO0deB7ahR5tMprD43wG3iw=; b=rAWgP9fiDAv2HMbHqP9KKB6AN0eQpPm1jsQLEMPi5zhONstNR0G6qm0JfciHgRIV3S 6dtahAJ0m0GVKFYGSRAUmIVvhcBZEf9fM3DU5v+TIUNW+cVpSxP+KZdE9c5phAP0hGyt fxvuqJHy5CHwQDUIniWMq/uwlaXtq08+TTaX5e3miciprbsAEQgLfJgM6wMdXq0dP4eT XtWBgYS+jaOniJ6ph1tmZkfliiH30+z4egJd1exykbo6/40GaGFLUjFh6+4jneubt/Ag EQuNdhcmBIZir4QjanLkCIOh/HkU2vxKFPP3zeURUfu11eUcWzYYbE+rfEG+bgAQxJ3P c02g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=od2u5BNJcS+h2O2BE/eOiO0deB7ahR5tMprD43wG3iw=; b=Dffmu/OxjZ8pvKd7HwqH/y7f3gUltKANf+dee5GKitrDbx1ddMmdrYSevJmHbvuKGw xoZtadb0hJVacILfjsr1b3OuqpvoWEwi5qrrrn+EOmUX7G2tY5Bz5GxU5E/bX1BNUYHl baC9a7FzDPNVEcxDqMHpNDnajTbuBUxeBg+6GeUkjy6+Q8jDSmXZ+tXCM5Oc5+Sl/TMM ky4T9gpchyZBtapaqWnMLujEOob+WY7TKFlu/SjhY/dm+Ka5MlTUd7j9+txX1ctjFDF5 QwpRcUUOc61HLZdu+Dw3PO/fLj7aUMEChC8sxMN1ed51Ogd0koMGf+kEAvxpx9fds1eM it5A== X-Gm-Message-State: AGi0PubxMNi0HRB+M7io2b2zUKyXoY0vPIuSreAD5X0IVhcHhhCQcYWK M8ES6sCvEWHnoFDjcyBV0WTF6KPs8u6sEEtByHG6uW/B X-Received: by 2002:a50:8dc2:: with SMTP id s2mr12853223edh.318.1589185179228; Mon, 11 May 2020 01:19:39 -0700 (PDT) MIME-Version: 1.0 References: <20200511054332.37690-1-xiaoliang.yang_1@nxp.com> <20200511054332.37690-2-xiaoliang.yang_1@nxp.com> In-Reply-To: <20200511054332.37690-2-xiaoliang.yang_1@nxp.com> From: Vladimir Oltean Date: Mon, 11 May 2020 11:19:28 +0300 Message-ID: Subject: Re: [PATCH v1 net-next 1/3] net: dsa: felix: qos classified based on pcp To: Xiaoliang Yang Cc: Po Liu , Claudiu Manoil , Alexandru Marginean , Vladimir Oltean , Li Yang , Mingkai Hu , Andrew Lunn , Florian Fainelli , Vivien Didelot , "David S. Miller" , Jiri Pirko , Ido Schimmel , Jakub Kicinski , netdev , lkml , Horatiu Vultur , Alexandre Belloni , "Allan W. Nielsen" , Joergen Andreasen , Microchip Linux Driver Support , Vinicius Costa Gomes , Nikolay Aleksandrov , Roopa Prabhu , linux-devel@linux.nxdi.nxp.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, Jakub, Ido, On Mon, 11 May 2020 at 08:50, Xiaoliang Yang wrote: > > Set the default QoS Classification based on PCP and DEI of vlan tag, > after that, frames can be Classified to different Qos based on PCP tag. > If there is no vlan tag or vlan ignored, use port default Qos. > > Signed-off-by: Xiaoliang Yang > --- The new skbedit priority offload action looks interesting to me. But it also raises the question of what to do in the default case where such rules are not installed. I think it is ok to support a 1-to-1 VLAN PCP to TC mapping by default? This should also be needed for features such as Priority Flow Control. > drivers/net/dsa/ocelot/felix.c | 6 ++++++ > drivers/net/dsa/ocelot/felix.h | 1 + > drivers/net/dsa/ocelot/felix_vsc9959.c | 23 +++++++++++++++++++++++ > 3 files changed, 30 insertions(+) > > diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c > index a2dfd73f8a1a..0afdc6fc3f57 100644 > --- a/drivers/net/dsa/ocelot/felix.c > +++ b/drivers/net/dsa/ocelot/felix.c > @@ -547,6 +547,12 @@ static int felix_setup(struct dsa_switch *ds) > ocelot_configure_cpu(ocelot, port, > OCELOT_TAG_PREFIX_NONE, > OCELOT_TAG_PREFIX_LONG); > + > + /* Set the default QoS Classification based on PCP and DEI > + * bits of vlan tag. > + */ > + if (felix->info->port_qos_map_init) > + felix->info->port_qos_map_init(ocelot, port); Xiaoliang, just a small comment in case you need to resend. The felix->info structure is intended to hold SoC-specific data that is likely to differ between chips (like for example if vsc7511 support ever appears in felix). But I see ANA:PORT:QOS_CFG and ANA:PORT:QOS_PCP_DEI_MAP_CFG are common registers, so are there any specific reasons why you put this in felix_vsc9959 and not in the common ocelot code? > } > > /* Include the CPU port module in the forwarding mask for unknown > diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h > index b94386fa8d63..0d4ec34309c7 100644 > --- a/drivers/net/dsa/ocelot/felix.h > +++ b/drivers/net/dsa/ocelot/felix.h > @@ -35,6 +35,7 @@ struct felix_info { > struct phylink_link_state *state); > int (*prevalidate_phy_mode)(struct ocelot *ocelot, int port, > phy_interface_t phy_mode); > + void (*port_qos_map_init)(struct ocelot *ocelot, int port); > }; > > extern struct felix_info felix_info_vsc9959; > diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c > index 1c56568d5aca..5c931fb3e4cd 100644 > --- a/drivers/net/dsa/ocelot/felix_vsc9959.c > +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c > @@ -4,6 +4,7 @@ > */ > #include > #include > +#include > #include > #include > #include > @@ -1209,6 +1210,27 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocelot) > mdiobus_unregister(felix->imdio); > } > > +static void vsc9959_port_qos_map_init(struct ocelot *ocelot, int port) > +{ > + int i; > + > + ocelot_rmw_gix(ocelot, > + ANA_PORT_QOS_CFG_QOS_PCP_ENA, > + ANA_PORT_QOS_CFG_QOS_PCP_ENA, > + ANA_PORT_QOS_CFG, > + port); > + > + for (i = 0; i < FELIX_NUM_TC * 2; i++) { > + ocelot_rmw_ix(ocelot, > + (ANA_PORT_PCP_DEI_MAP_DP_PCP_DEI_VAL & i) | ANA_PORT_PCP_DEI_MAP_DP_PCP_DEI_VAL is 1 bit. Are you sure this should be % i and not % 2? > + ANA_PORT_PCP_DEI_MAP_QOS_PCP_DEI_VAL(i), > + ANA_PORT_PCP_DEI_MAP_DP_PCP_DEI_VAL | > + ANA_PORT_PCP_DEI_MAP_QOS_PCP_DEI_VAL_M, > + ANA_PORT_PCP_DEI_MAP, > + port, i); > + } > +} > + > struct felix_info felix_info_vsc9959 = { > .target_io_res = vsc9959_target_io_res, > .port_io_res = vsc9959_port_io_res, > @@ -1232,4 +1254,5 @@ struct felix_info felix_info_vsc9959 = { > .pcs_an_restart = vsc9959_pcs_an_restart, > .pcs_link_state = vsc9959_pcs_link_state, > .prevalidate_phy_mode = vsc9959_prevalidate_phy_mode, > + .port_qos_map_init = vsc9959_port_qos_map_init, > }; > -- > 2.17.1 > Thanks, -Vladimir