Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1732487ybj; Wed, 6 May 2020 04:24:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLS/qCZzgcow2p2xTRenzCavhTkMdbGOlMSXXC9uZkeZjy0jjZI86jUW/7+6xjyNt2ViUcZ X-Received: by 2002:a17:906:9518:: with SMTP id u24mr6919938ejx.320.1588764243783; Wed, 06 May 2020 04:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588764243; cv=none; d=google.com; s=arc-20160816; b=uDONpYv4EzMWhtSBA2tNI4zfFxievS0XbWIwbFszrt1hUhSFF4px9XRD3cQlHthkqz 5TiNxS9nFAMIpgOTZga/KX07rX9AYJhXvI+mzeSMTF8AVDaQODjv3oraXaScHmaNXCVp QyaUVm9FVhgK4DzRqX0LKQlHeSR12l+OXrTmHH832fUBVz2avJAIEEKySJNoZz/LarKG KK21Bpgh277AP0byUk53c7mKP+3nVl/hMMr31BcZNlI2gaaivoD2UNeAsTNhaLEjncA8 ahuDK6bgpNZ2JTpqGbUNC8BK2stGIKH1o8N5m31aMrBA/D6ANshizJH4LxZuzZ36VKgG i7Cw== 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=CR+hEnYWDDrlZolPY3IzdIIQbV5sbr9xpKj8jpwTajE=; b=tnPlCtviDXSg8tRbJ+j+7/b4h/odfBX5cWsBfAKBTlrr1rPcfGzHs6UqFq3Zrw0AI1 P+lv7g+zVg7trhDcPBohULka1Z5BlReJ2ml3UIC6hZlp3ezAbVpD14UnTxS7GcUK1FJY gaLSHV5ri+EZDJqTDJr/EuWI3ZH1ESP+SXgxySPIFHigKg2IXe4F/gkIpXhbZr9ed47Y to39Z7niuycnGN9AxgXLkD5Tf7OLsn3P1nrc3KFkfczU5RTkaQUfUFOz2ntA1ufhfdMm +LnK6Jv/8D2nDTtUWqqUnw9Fh62q+OYUUf1lHELdUyqMgt1lMsw2JNQ/LKzPlCHNhNJV v5nQ== 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 d4si848872edp.87.2020.05.06.04.23.41; Wed, 06 May 2020 04:24:03 -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 S1728564AbgEFHx6 (ORCPT + 99 others); Wed, 6 May 2020 03:53:58 -0400 Received: from inva021.nxp.com ([92.121.34.21]:49758 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbgEFHx4 (ORCPT ); Wed, 6 May 2020 03:53:56 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 573E3200B0F; Wed, 6 May 2020 09:53:54 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2C63F200B2E; Wed, 6 May 2020 09:53:45 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 4E7AA402C7; Wed, 6 May 2020 15:53:33 +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, nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com, linux-devel@linux.nxdi.nxp.com Subject: [PATCH v1 net-next 3/6] net: mscc: ocelot: change vcap to be compatible with full and quad entry Date: Wed, 6 May 2020 15:48:57 +0800 Message-Id: <20200506074900.28529-4-xiaoliang.yang_1@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506074900.28529-1-xiaoliang.yang_1@nxp.com> References: <20200506074900.28529-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 When calculating vcap data offset, the function only supports half key entry. This patch modify vcap_data_offset_get function to calculate a correct data offset when setting VCAP Type-Group to VCAP_TG_FULL or VCAP_TG_QUARTER. Signed-off-by: Xiaoliang Yang --- drivers/net/ethernet/mscc/ocelot_ace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_ace.c b/drivers/net/ethernet/mscc/ocelot_ace.c index 8a9c4515bb3b..29d61b89b73a 100644 --- a/drivers/net/ethernet/mscc/ocelot_ace.c +++ b/drivers/net/ethernet/mscc/ocelot_ace.c @@ -175,8 +175,8 @@ static void vcap_data_offset_get(const struct vcap_props *vcap, u32 i, col, offset, count, cnt, base; u32 width = vcap->tg_width; - count = (data->tg_sw == VCAP_TG_HALF ? 2 : 4); - col = (ix % 2); + count = (1 << (data->tg_sw - 1)); + col = (ix % count); cnt = (vcap->sw_count / count); base = (vcap->sw_count - col * cnt - cnt); data->tg_value = 0; -- 2.17.1