Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5091823img; Wed, 27 Mar 2019 01:46:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQqG5ZArIMGaz0fuEeIDTUTJ8tr2ppnZR/5gGHFJpu7sTrktjLLc3fKtaX6RgV4eBtjV2K X-Received: by 2002:a63:360c:: with SMTP id d12mr24298902pga.404.1553676411821; Wed, 27 Mar 2019 01:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553676411; cv=none; d=google.com; s=arc-20160816; b=kKEK67nWr13G49crAr2tUuao4aAVkELOWojXa2njuPZBlDkbrurBDYHhs8/Me9P5a9 Xt4p2Zfg59Kv/fdRoVpIisljEGE6zPCHLVtHimnospVYVXOuZzpmRE3MzpD8EXutS7mG kE+/rvbCqOvS/TZxyX42WCpWn9lX9oF4GM1RGtr3ordnN+K5ivKoAuF7RnjEURFAoljG ZZr6JyJ+jvkSjx9RpBydj2ESqO9mL+F0KnFKk9V4XV6Ix3FDCNhb8qDk/AHbvVnSGc8n F38HqpotxfWqyoy6JgVlTUz5gWdjE9RUbdHT4EUdNiHRLK2S21YhHmFNKOp1GQ5PDqsM s/9A== 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=mhCgAuDrQhsTOP0VaORxNc4fZ739Vx36yKdAs7QqRyE=; b=YAK6/2uy1SFz8EXYnvATJ+907wvuvzTsCb9BhDxorXlnvZ2J9xcRuV30sDAiBcgz2J J1BlucYcw1cwxiZCWzxVWOpsOqSWA1nmdd1l2mzR4yCvUY+R6+97FpJJx8vbS+Dj7fSW XRD0Zv+8PL1sRggLH/lKes9kOl02qf1nWumbF2GPI3myTBoFgEPKY69wWaEZxDG46DrT VWL5h8lSXYn5vcBPSG6ImLZr9Vk6WCT3sBEJgFWuRaBxTY1MspOlvhx3CuSCIfZFWsrF mm2aCZUwP2OfqhRD6wxg5yQdwxCPli1lREuF3zu7xxEFICk9dZfwct5Te2ytLiyl4x7/ M5LQ== 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 a9si4812409pfc.46.2019.03.27.01.46.36; Wed, 27 Mar 2019 01:46:51 -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 S1733220AbfC0Ipi (ORCPT + 99 others); Wed, 27 Mar 2019 04:45:38 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:39807 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733076AbfC0IpT (ORCPT ); Wed, 27 Mar 2019 04:45:19 -0400 X-Originating-IP: 90.88.32.136 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-91-136.w90-88.abo.wanadoo.fr [90.88.32.136]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 2BCA240002; Wed, 27 Mar 2019 08:45:14 +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, ymarkman@marvell.com, mw@semihalf.com, Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 17/18] net: mvpp2: cls: Initialize lookup priorities for all entries in the flow Date: Wed, 27 Mar 2019 09:44:21 +0100 Message-Id: <20190327084422.4209-18-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190327084422.4209-1-maxime.chevallier@bootlin.com> References: <20190327084422.4209-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 When classifying a packet pertaining to a given flow, the classifier will issue multiple lookup commands until it finds one with the 'last' bit set. It expects all prorities to be assign continuously (although not necessarily in an ordered fashion) from 0 to the number of lookups. We can initialize this once, and make sure unused lookups are given an empty port map. This avoids having to maintain priorities and the information of which lookup is the last. Signed-off-by: Maxime Chevallier --- .../net/ethernet/marvell/mvpp2/mvpp2_cls.c | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c index 7a889a925714..1087974d3b98 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c @@ -544,16 +544,27 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv, const struct mvpp2_cls_flow *flow) { struct mvpp2_cls_flow_entry fe; - int i; + int i, pri = 0; + + /* Assign default values to all entries in the flow */ + for (i = MVPP2_CLS_FLT_FIRST(flow->flow_id); + i <= MVPP2_CLS_FLT_LAST(flow->flow_id); i++) { + memset(&fe, 0, sizeof(fe)); + fe.index = i; + mvpp2_cls_flow_pri_set(&fe, pri++); - /* C2 lookup */ - memset(&fe, 0, sizeof(fe)); - fe.index = MVPP2_CLS_FLT_C2_RSS_ENTRY(flow->flow_id); + if (i == MVPP2_CLS_FLT_LAST(flow->flow_id)) + mvpp2_cls_flow_last_set(&fe, 1); + + mvpp2_cls_flow_write(priv, &fe); + } + + /* RSS config C2 lookup */ + mvpp2_cls_flow_read(priv, MVPP2_CLS_FLT_C2_RSS_ENTRY(flow->flow_id), + &fe); mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C2); mvpp2_cls_flow_port_id_sel(&fe, true); - mvpp2_cls_flow_last_set(&fe, 0); - mvpp2_cls_flow_pri_set(&fe, 0); mvpp2_cls_flow_lu_type_set(&fe, MVPP2_CLS_LU_ALL); /* Add all ports */ @@ -564,19 +575,19 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv, /* C3Hx lookups */ for (i = 0; i < MVPP2_MAX_PORTS; i++) { - memset(&fe, 0, sizeof(fe)); - fe.index = MVPP2_CLS_FLT_HASH_ENTRY(i, flow->flow_id); + mvpp2_cls_flow_read(priv, + MVPP2_CLS_FLT_HASH_ENTRY(i, flow->flow_id), + &fe); + /* Set a default engine. Will be overwritten when setting the + * real HEK parameters + */ + mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C3HA); mvpp2_cls_flow_port_id_sel(&fe, true); - mvpp2_cls_flow_pri_set(&fe, i + 1); mvpp2_cls_flow_port_add(&fe, BIT(i)); mvpp2_cls_flow_write(priv, &fe); } - - /* Update the last entry */ - mvpp2_cls_flow_last_set(&fe, 1); - mvpp2_cls_flow_write(priv, &fe); } /* Adds a field to the Header Extracted Key generation parameters*/ -- 2.20.1