From patchwork Thu Aug 20 11:01:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Kundu X-Patchwork-Id: 1348327 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=chelsio.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BXMDc0hTzz9sRK for ; Thu, 20 Aug 2020 21:02:23 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727843AbgHTLCM (ORCPT ); Thu, 20 Aug 2020 07:02:12 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:32686 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728922AbgHTLB5 (ORCPT ); Thu, 20 Aug 2020 07:01:57 -0400 Received: from pluto.blr.asicdesigners.com (pluto.asicdesigners.com [10.193.186.16] (may be forged)) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id 07KB1elE029748; Thu, 20 Aug 2020 04:01:41 -0700 From: Rahul Kundu To: netdev@vger.kernel.org, davem@davemloft.net Cc: vishal@chelsio.com, rahul.lakkireddy@chelsio.com, dt@chelsio.com, rahul.kundu@chelsio.com Subject: [PATCH net-next] cxgb4: insert IPv6 filter rules in next free region Date: Thu, 20 Aug 2020 16:31:36 +0530 Message-Id: <0b35dad8bf171816a20ca6b8ba1c38aa96aeeaeb.1597919928.git.rahul.kundu@chelsio.com> X-Mailer: git-send-email 2.18.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPv6 filters can occupy up to 4 slots and will exhaust HPFILTER region much sooner. So, continue searching for free slots in the HASH or NORMAL filter regions, as long as the rule's priority does not conflict with existing rules in those regions. Signed-off-by: Rahul Kundu --- .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c index 650db92cb11c..f6c1ec140e09 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c @@ -604,17 +604,14 @@ int cxgb4_get_free_ftid(struct net_device *dev, u8 family, bool hash_en, /* If the new rule wants to get inserted into * HPFILTER region, but its prio is greater * than the rule with the highest prio in HASH - * region, then reject the rule. - */ - if (t->tc_hash_tids_max_prio && - tc_prio > t->tc_hash_tids_max_prio) - break; - - /* If there's not enough slots available - * in HPFILTER region, then move on to - * normal FILTER region immediately. + * region, or if there's not enough slots + * available in HPFILTER region, then skip + * trying to insert this rule into HPFILTER + * region and directly go to the next region. */ - if (ftid + n > t->nhpftids) { + if ((t->tc_hash_tids_max_prio && + tc_prio > t->tc_hash_tids_max_prio) || + (ftid + n) > t->nhpftids) { ftid = t->nhpftids; continue; }