Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp787637ybi; Wed, 19 Jun 2019 07:54:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxR5Q3l6AG0eQdjublkAxvg+Pin+Ob1z/irCkkLmItW9UsPDKW3cX1tp+/D1gDQXcrQAMzZ X-Received: by 2002:a17:90a:8984:: with SMTP id v4mr11598213pjn.133.1560956080656; Wed, 19 Jun 2019 07:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560956080; cv=none; d=google.com; s=arc-20160816; b=SkojSoowNB/7hiBXouPsUTwTWYzINdgGHUqOykXmthXZcBGIIYd2o/Lcgmckj52CGD HpkARbEkLeio1JYnqrx82WNgFbymzYXyFLEU2hFn5HiTfPngZ0ylaT11euxhypDOMdpg rcxPhNmCqMJuf8bOdDFeolrcS0FhBz8IP3jviW2Gkcdaxf+0+7B0TH+GZjtpRUlJDuHy IsJhDrkeSpkWjaIQn9XaPfC1ZcTR+ZMEZab11yarinbEMWst+lX26Rq4aK+pBybHto7E RMIGgkcK/lTv6AUM5RAGSK7dBma1ec+uoxa0/0qLkucks37YvPT9rKYrm65snf5WF3o5 vPqw== 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 :message-id:date:subject:cc:to:from; bh=HwfwiM7wiKq81G1Yf8CVpzfu3/UcLKthMdbXHBEYUWE=; b=LxBIL0AlqGPeLCcGmbfOoWf3xxoKVRDHnjFzWh1Af2HWGyiadMopDnKOCLZxuqV1dx Sq/PiCLHRBQoSQzY8X87+RE9kMuh0O9ar7y34V034NNF5ev69D1AvbjqH68jY+Uo1/Bb Mzvm7OutZPrYTuHryBeulyGLs1EPhfaRzxOIHSI/ZjWF59KM2TbD2JFk6T5202xq/BEy L287tWI9v29GxxMd5pxYRCfTdFSY/vfgX+TI2GRHU1OvrJ8k4yLbwbPs2aub8Ud+477D 6bzRAzOAxLLIl59j/12ZSQ3I6AvfZDqzb6uv4bDW175hbKJntvGaUKpRdwwR7r9KgNzw ccuA== 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 k1si3076947pgq.175.2019.06.19.07.54.23; Wed, 19 Jun 2019 07:54:40 -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 S1727198AbfFSOyS (ORCPT + 99 others); Wed, 19 Jun 2019 10:54:18 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:49013 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfFSOyS (ORCPT ); Wed, 19 Jun 2019 10:54:18 -0400 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-81-150.w90-88.abo.wanadoo.fr [90.88.23.150]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 7875A240003; Wed, 19 Jun 2019 14:54:10 +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, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com, Alan Winkowski Subject: [PATCH net] net: mvpp2: prs: Don't override the sign bit in SRAM parser shift Date: Wed, 19 Jun 2019 16:54:13 +0200 Message-Id: <20190619145413.21852-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 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 The Header Parser allows identifying various fields in the packet headers, used for for various kind of filtering and classification steps. This is a re-entrant process, where the offset in the packet header depends on the previous lookup results. This offset is represented in the SRAM results of the TCAM, as a shift to be operated. This shift can be negative in some cases, such as in IPv6 parsing. This commit prevents overriding the sign bit when setting the shift value, which could cause instabilities when parsing IPv6 flows. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Suggested-by: Alan Winkowski Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c index ae2240074d8e..5692c6087bbb 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c @@ -312,7 +312,8 @@ static void mvpp2_prs_sram_shift_set(struct mvpp2_prs_entry *pe, int shift, } /* Set value */ - pe->sram[MVPP2_BIT_TO_WORD(MVPP2_PRS_SRAM_SHIFT_OFFS)] = shift & MVPP2_PRS_SRAM_SHIFT_MASK; + pe->sram[MVPP2_BIT_TO_WORD(MVPP2_PRS_SRAM_SHIFT_OFFS)] |= + shift & MVPP2_PRS_SRAM_SHIFT_MASK; /* Reset and set operation */ mvpp2_prs_sram_bits_clear(pe, MVPP2_PRS_SRAM_OP_SEL_SHIFT_OFFS, -- 2.20.1