Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1021571ybg; Mon, 1 Jun 2020 22:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzQguh8c+kkwEn7+lI/WDSQ7qyDSRSf4ujSnZu9XF1V4nYjjFhJPBQynoSRfbNn/wmEFAK X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr7538107ejb.127.1591075599752; Mon, 01 Jun 2020 22:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591075599; cv=none; d=google.com; s=arc-20160816; b=hSgqEZgHwJ/eN7wN6PiicBGOYe8xBltKqHtmsvtim1NK2CsQ5xrS5bsQNWrCL2i6hr GuAFqHfbURqCJfkioI1xw3mgnqbO4O2+neZUTFnHwIro5KRaCxlzC/nxpkc3Y+7gtmC/ UuPJSU2fIySWc0e2d2he1Sec9gExvKQI64lbdGmCCEuhSfXP4W/EJJf/s4jlrl08ynY/ hdMTj5jmh/enW6l3E8ZAq7lCTtdM2LPcuRLME/+8l9Sp3iMuggeQCty2L5VJmFxYUkl0 tIez1VWSlDT6ScfaZfkhZMylrPcc+DRvIAvKwkwL/KhthFCbOaWA8sDLsszNVcrT3vIK rGJA== 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=yV5raqznXEqrHTG8bfYD8o3IxdFlL5WlsrogsqYHwpk=; b=o2+6cX0eGDSbHNBRVVrG+FF0g699+FfzfWAJ+/jE2SWc59O1rcB30ecNc5idMvx8GW AEt5v7YqnTPugtstpF/7rNbbNxYr8cZQ4C8OpWilmeW6zH6D1qVHj11wpvlz9zMZIgf9 y8ICEknGxzGnTzjTNeQCipAOxoB9FT9uU+KnDy5apX3Ltu7uDMNtm0g8KQvnnEBk41CL je6fYqI4C0xTskwJ2onGSeseanjP7n/GDcIzyts/flvB7ovBn+rbbqM4EZoH0yXesyJ7 g+QkMilvGVIakaKQRnkusl0kEQfyvQctCOE3lVAauf0IimR0a77kUI1l1KHjaUsw97do vXWg== 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 r26si869794eja.652.2020.06.01.22.26.16; Mon, 01 Jun 2020 22:26:39 -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 S1726917AbgFBFYN (ORCPT + 99 others); Tue, 2 Jun 2020 01:24:13 -0400 Received: from inva020.nxp.com ([92.121.34.13]:44434 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgFBFYH (ORCPT ); Tue, 2 Jun 2020 01:24:07 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 05BB31A00EC; Tue, 2 Jun 2020 07:24:06 +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 778A21A0B71; Tue, 2 Jun 2020 07:23:56 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 6FA7D402E8; Tue, 2 Jun 2020 13:23:44 +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, vinicius.gomes@intel.com, nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com, 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, linux-devel@linux.nxdi.nxp.com Subject: [PATCH v2 net-next 04/10] net: mscc: ocelot: change vcap to be compatible with full and quad entry Date: Tue, 2 Jun 2020 13:18:22 +0800 Message-Id: <20200602051828.5734-5-xiaoliang.yang_1@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602051828.5734-1-xiaoliang.yang_1@nxp.com> References: <20200602051828.5734-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 b76593b40097..8c384b0771bb 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