Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4214988ybi; Tue, 11 Jun 2019 02:57:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyly+tOMzdbbhz5xKWqvkUi0YyeXIsqVOtHLpFGUTB7PsRQ3G7PegK89XIOLvHHf2HkrZDr X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr25938418pjx.52.1560247043779; Tue, 11 Jun 2019 02:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560247043; cv=none; d=google.com; s=arc-20160816; b=KlknTTvm+bonUXMVeN5g6tSI8WFnvQOGZun5TOemqaOKf67Pzr36b80ZB9K/ASkglZ 5gUt7arpKbSid2iydsq0U6O7UqYyWiKkWw5V3G0Hyb3+pgwacxv/JvA9BCl+iFRJ+WfD 2/VukTVOG1nXs4nvGqX01oGY6PtO0QUa3fuZ7hirWzurYwyrOtfg5S1YlPwBKFW0LV2h iNMH3NhujduQEgk7GVFD1uygFimSgEs7zQxhMqnwHRHRTmClEWayaFrfXv+KE/Y2OfJI zWE4w/oSaZ4km9HaXQuJEYhvhIx29S4GJhX0UrnCprmVXMvGxHcwvFQ+TJ5X6boqieXr hEmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FlEiLw/hyrfbracwWXZ8+rxWXuMwCtHb3WSLJJXMw9M=; b=M8AgoLEbvkild/2pfGxZ+98X+z6pT3ZxBUVuzz6vuf84bGKKln73AFb6/y66soyScP f9q1SNsj6aChKC9S2ME0JtMRfO3gzoS/JHas9zUYRT+4BoXf55GiE0xyJNh7CrmAFYPy EY3ZHxjM7JzHxpJ4o07yYR/FWCmWkG734lb9IvQI8w5ShWLbDIm/u+7vWGD7ioLtB92h PyUuvJoG4dzzu6LGqW2dkC5KCqQnJT3LJH9tx/y70R4a5QHBao53jqDOgZMYrweahpEh bBGSgd2dWLfz31IKmoJY1UMu0hbG0Av/OKQF6E1bI32cygvzyQEt25bhOgApWTqgQvvD leEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si8237811pgq.194.2019.06.11.02.57.08; Tue, 11 Jun 2019 02:57:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405071AbfFKJvs (ORCPT + 99 others); Tue, 11 Jun 2019 05:51:48 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:47139 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404963AbfFKJvq (ORCPT ); Tue, 11 Jun 2019 05:51:46 -0400 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-40-246.w90-88.abo.wanadoo.fr [90.88.159.246]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 79DA2200012; Tue, 11 Jun 2019 09:51:43 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com, Yuri Chipchev Subject: [PATCH net 1/2] net: mvpp2: prs: Fix parser range for VID filtering Date: Tue, 11 Jun 2019 11:51:42 +0200 Message-Id: <20190611095143.2810-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611095143.2810-1-maxime.chevallier@bootlin.com> References: <20190611095143.2810-1-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VID filtering is implemented in the Header Parser, with one range of 11 vids being assigned for each no-loopback port. Make sure we use the per-port range when looking for existing entries in the Parser. Since we used a global range instead of a per-port one, this causes VIDs to be removed from the whitelist from all ports of the same PPv2 instance. Fixes: 56beda3db602 ("net: mvpp2: Add hardware offloading for VLAN filtering") Suggested-by: Yuri Chipchev Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c index 392fd895f278..e0da4db3bf56 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c @@ -1905,8 +1905,7 @@ static int mvpp2_prs_ip6_init(struct mvpp2 *priv) } /* Find tcam entry with matched pair */ -static int mvpp2_prs_vid_range_find(struct mvpp2 *priv, int pmap, u16 vid, - u16 mask) +static int mvpp2_prs_vid_range_find(struct mvpp2_port *port, u16 vid, u16 mask) { unsigned char byte[2], enable[2]; struct mvpp2_prs_entry pe; @@ -1914,13 +1913,13 @@ static int mvpp2_prs_vid_range_find(struct mvpp2 *priv, int pmap, u16 vid, int tid; /* Go through the all entries with MVPP2_PRS_LU_VID */ - for (tid = MVPP2_PE_VID_FILT_RANGE_START; - tid <= MVPP2_PE_VID_FILT_RANGE_END; tid++) { - if (!priv->prs_shadow[tid].valid || - priv->prs_shadow[tid].lu != MVPP2_PRS_LU_VID) + for (tid = MVPP2_PRS_VID_PORT_FIRST(port->id); + tid <= MVPP2_PRS_VID_PORT_LAST(port->id); tid++) { + if (!port->priv->prs_shadow[tid].valid || + port->priv->prs_shadow[tid].lu != MVPP2_PRS_LU_VID) continue; - mvpp2_prs_init_from_hw(priv, &pe, tid); + mvpp2_prs_init_from_hw(port->priv, &pe, tid); mvpp2_prs_tcam_data_byte_get(&pe, 2, &byte[0], &enable[0]); mvpp2_prs_tcam_data_byte_get(&pe, 3, &byte[1], &enable[1]); @@ -1950,7 +1949,7 @@ int mvpp2_prs_vid_entry_add(struct mvpp2_port *port, u16 vid) memset(&pe, 0, sizeof(pe)); /* Scan TCAM and see if entry with this already exist */ - tid = mvpp2_prs_vid_range_find(priv, (1 << port->id), vid, mask); + tid = mvpp2_prs_vid_range_find(port, vid, mask); reg_val = mvpp2_read(priv, MVPP2_MH_REG(port->id)); if (reg_val & MVPP2_DSA_EXTENDED) @@ -2008,7 +2007,7 @@ void mvpp2_prs_vid_entry_remove(struct mvpp2_port *port, u16 vid) int tid; /* Scan TCAM and see if entry with this already exist */ - tid = mvpp2_prs_vid_range_find(priv, (1 << port->id), vid, 0xfff); + tid = mvpp2_prs_vid_range_find(port, vid, 0xfff); /* No such entry */ if (tid < 0) -- 2.20.1