Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp181284ybk; Tue, 12 May 2020 19:32:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya6UWAvSaAIc8HeBgN1HwNp9MN6VWlw4An6bo0FEK/tZMUkm4iO2oyHTAthV6UigInr34m X-Received: by 2002:a17:906:2bc1:: with SMTP id n1mr4285164ejg.34.1589337129173; Tue, 12 May 2020 19:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589337129; cv=none; d=google.com; s=arc-20160816; b=tTXsoNLDldCfswn1ccnlXUpr6F8BHXwdfmojMBJq2JxVGR3eMjQTngkSS94lB8ciWA rcjJfBXa1W16lWdulhCRsql7L5xcn+f6kEVVNeKqL5K+pNQAohAswn4GltbdCuPqij5d rULdRTwakycxKYUlutULdQVBiypKdlNmFmySJH8Necp7iXjGP3y4/UESWitp/P/nEhMp QABBM0T5Iy0ipsmje5qJZ+xkT2bKaFwP2X0kidjHV2+06dWWyqKAvL3Af/whjmG7SeUh CQ1TuJPsnr56tTm3rpTtWuWHQiduzq+gZACCzf7vzenMFV2CO4i4p0IIutlROizKHv2e Kl3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=24p4h0+dCE851H6vPKm27VXA0yt0N+rwpVYnfou0qR0=; b=Qk9TOhKyg3y8yObcVABjuS5xDrdxa2olxqnOaLYGmlSy37VEjd1zSOmTad260xJrak JgKxX84engmikwStfCos/whRxshUcOB/pF+R79xfXenms4+OPd84yJ3PrjEYd8NxvOww 48srniUUd6/Wxh2wKHprNqngGDWY0ZN2wak3E1WlLczLjqPa3MqTX2k8z4RXLycVeq22 7JYyyONvCYE7oYCx6SIcj7sJ7ZdREizxbMDvzW88maE2C7ppq23c1IpYRFl+eH8ONArG 9LLFEmY0P46T95BRglNB5x8WMaR18CpGFYvSZ1WU1h7q2DcmR4V3au/fCMuvNsbW6TzA L/oA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si5005591edj.455.2020.05.12.19.31.46; Tue, 12 May 2020 19:32:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbgEMCaQ (ORCPT + 99 others); Tue, 12 May 2020 22:30:16 -0400 Received: from inva020.nxp.com ([92.121.34.13]:40920 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728590AbgEMCaM (ORCPT ); Tue, 12 May 2020 22:30:12 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3A9E31A130A; Wed, 13 May 2020 04:30:10 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id AC9491A132C; Wed, 13 May 2020 04:30:00 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 4054F402BC; Wed, 13 May 2020 10:29:48 +0800 (SGT) From: Xiaoliang Yang To: xiaoliang.yang_1@nxp.com, po.liu@nxp.com, claudiu.manoil@nxp.com, alexandru.marginean@nxp.com, vladimir.oltean@nxp.com, leoyang.li@nxp.com, mingkai.hu@nxp.com, andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, davem@davemloft.net, jiri@resnulli.us, idosch@idosch.org, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horatiu.vultur@microchip.com, alexandre.belloni@bootlin.com, allan.nielsen@microchip.com, joergen.andreasen@microchip.com, UNGLinuxDriver@microchip.com, vinicius.gomes@intel.com, nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com, linux-devel@linux.nxdi.nxp.com Subject: [PATCH v2 net-next 1/3] net: dsa: felix: qos classified based on pcp Date: Wed, 13 May 2020 10:25:08 +0800 Message-Id: <20200513022510.18457-2-xiaoliang.yang_1@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513022510.18457-1-xiaoliang.yang_1@nxp.com> References: <20200513022510.18457-1-xiaoliang.yang_1@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/dsa/ocelot/felix.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index a2dfd73f8a1a..58d6b0f454e5 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -289,6 +289,27 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, QSYS_SWITCH_PORT_MODE, port); } +static void felix_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_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); + } +} + static void felix_get_strings(struct dsa_switch *ds, int port, u32 stringset, u8 *data) { @@ -547,6 +568,11 @@ 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. + */ + felix_port_qos_map_init(ocelot, port); } /* Include the CPU port module in the forwarding mask for unknown -- 2.17.1