Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp879105pxk; Thu, 17 Sep 2020 20:08:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO/WT6EAAmuoYsQX2CULFLJCE75hjSMDqOe1fCBKdqRnvMs3adhfZXmMi4VYVSfbD7G0uR X-Received: by 2002:a17:906:5008:: with SMTP id s8mr35651494ejj.408.1600398527521; Thu, 17 Sep 2020 20:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398527; cv=none; d=google.com; s=arc-20160816; b=veKnvBj4Fq0kfkMn1lpBzBSTMq6G0Jeirqj0j/FeCJ+pKUkfksA3+uJL2u8R6jh9l1 wuQRGaS1kNOdNvLoZCgYvi1cPVGfTf83ZlgTgPBoVaOLEb3e07xHqC+Aw12U0pXP9ksf xcYmolx2lEvDlNVWqsi4TOSoZ3rYMDJ+boBo2HlzU2sUEcdfeLSjXq4rZJC5cE3soJQl 9EdVKT4VJVVHR/eXxasqbJXJXF8JSqggXiAbFJXvHcOInSh+Bdr5bfRzg98j3f8m+hc6 +H5T1AgiQ2tyLgdL7+gM8YvpphYaJr+0HXV98lNnXzyObI0MxscUyi7n8jK+6KXxtXfr m3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y9wsBHoipEns7qSA2CY8yBaBI/101e5YGYXn7qAb5Cg=; b=bx2IflYVJI5q8Ma90iqg+jQ7jMVwI/R05l6iVzMBFATdGld/IYa+kgoqpIwEv7IlL0 Yb4Hl7LM3DHwLrC+c7DRIGg8dH7K6zRr9JOlxJdHLsDtKPwNsY+RO3FJuAQ7w5ORwK22 EBJbhZ1H9k9zbzSHSQR/GEzvL7VUJNJfl08a+bhx2OiQrYeakkCXqnFmYsmr8zfHHOKC RRQyy1EQlSWSEhec4ZJgF+JZr429gHqbZoGvUcypGI5Xnczf8i9xHUwVjnqiGjKctcR9 CP11kO+9hvp7Lp6ATYPdPyt/eMVv4iDDJA5Qfhrg+WyfjP/9B9ceSAJJVmhIX73QJ141 iI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MLpT9IkS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si1295720eje.284.2020.09.17.20.08.24; Thu, 17 Sep 2020 20:08:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=MLpT9IkS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730504AbgIRDGQ (ORCPT + 99 others); Thu, 17 Sep 2020 23:06:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:51182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbgIRCEJ (ORCPT ); Thu, 17 Sep 2020 22:04:09 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 68E672344C; Fri, 18 Sep 2020 02:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394648; bh=9LHSlaA2Hm05YczGqeSAK5+Erp4ymMiNdM7KFdW++2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLpT9IkSiHjLxC/QmknJWWtREiFHe0hiSAM3zmT8MN3J35DiXOracPp+eHL1dPUHc y/xeLnyuRmFdxnJwNhhpTKjP/ho4axqq0Wf726ZNbNn+ec/30oQ982rtlNp+tyuk0p 2Bql6sMS/zHfQNyMHLOkwLiTKqv7cui6YuvsIblY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jiri Pirko , "David S . Miller" , Sasha Levin , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 145/330] iavf: use tc_cls_can_offload_and_chain0() instead of chain check Date: Thu, 17 Sep 2020 21:58:05 -0400 Message-Id: <20200918020110.2063155-145-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Pirko [ Upstream commit bb0858d8bc828ebc3eaa90be02a0f32bca3c2351 ] Looks like the iavf code actually experienced a race condition, when a developer took code before the check for chain 0 was put to helper. So use tc_cls_can_offload_and_chain0() helper instead of direct check and move the check to _cb() so this is similar to i40e code. Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 34124c213d27c..222ae76809aa1 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3077,9 +3077,6 @@ static int iavf_delete_clsflower(struct iavf_adapter *adapter, static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter, struct flow_cls_offload *cls_flower) { - if (cls_flower->common.chain_index) - return -EOPNOTSUPP; - switch (cls_flower->command) { case FLOW_CLS_REPLACE: return iavf_configure_clsflower(adapter, cls_flower); @@ -3103,6 +3100,11 @@ static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter, static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv) { + struct iavf_adapter *adapter = cb_priv; + + if (!tc_cls_can_offload_and_chain0(adapter->netdev, type_data)) + return -EOPNOTSUPP; + switch (type) { case TC_SETUP_CLSFLOWER: return iavf_setup_tc_cls_flower(cb_priv, type_data); -- 2.25.1