Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4026035ybl; Mon, 3 Feb 2020 11:06:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxs2DqDLQRShTXQHKk97FHJ5juy0UZXmvY+hyYbX3xi5tktFN24ZE6P2tX4LeSVSw7jcObb X-Received: by 2002:a9d:472:: with SMTP id 105mr17523031otc.150.1580756768808; Mon, 03 Feb 2020 11:06:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580756768; cv=none; d=google.com; s=arc-20160816; b=XFZxBO13PU3HA+zDTRfb7kumdZu0SNXt8seyFbymwxC81BgNlvJM4eDn5rFsOv9iah I38k8v9B8ZbzkRC9CwDqhjU9irJTCQie9f7T3pSq37YZgI59ZQFxOFuPuoXylPvzVj+8 f06T2pjDRtI0Z85PrX7yawkplhsH0/PUAR2oQ2lymiOfi7aUKPpr6n1qClNlbNQbahXw lMvJWsbSK4AaKyIIZCZxXOlow6xxA8lFER7pkSNx1RGmM81qbHaPJgqyY7i3ltYii+Vf eXNMrEYYvA0I84Ec4k3796BbY5uCPC7Snw/mXB/axxSY1QEdw47Z8hS7ZZb3WHJsTPxW ou9A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4IjvbTiyG4SaaRAHwUcExZN+4dn20G8/1S6DUDY/9wk=; b=VuUZaNZEdzgTYI5VFn6ViN6snkF4Idmr7zNnh2E2lcSXQcJCALNQ3guN2S5tz3d5SS gbKLVwdt5vTxpByL8FiH0c2zr6mNWfboreNoylRLoZuT7154M/RiKk/QWDYIJY+z3yYx byJ9p/iiunM1X3wD+YHLIEcHQWwiRYstcQGvZaMb0O9QGqNnzzcqkJ1+Kx8GIjgI9POb v+2Mb8/K+Tpl9H6Lmc/geno7JpExhff6F7aoW88VEUUQVgfx1r0VIb4lLKc/jdT17/JS PN5ys+89xWjNmLbsgGh3bbotAlQUTAt+qeFtc5EbYHwv8dObGIibdSQESLUNQdKqCpFn wwCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yPtINkRR; 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 38si10471665otu.166.2020.02.03.11.05.48; Mon, 03 Feb 2020 11:06:08 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=yPtINkRR; 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 S1730958AbgBCQfU (ORCPT + 99 others); Mon, 3 Feb 2020 11:35:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:50042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730952AbgBCQfS (ORCPT ); Mon, 3 Feb 2020 11:35:18 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 278B9217BA; Mon, 3 Feb 2020 16:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747717; bh=TRkIAPgaqZ7uGRpl7w8gDUwEr9fKVYqbQyFe7pM8l3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yPtINkRRgVKrBH7q28ZuPLN19vsV1ZdH3L8b3cn7cukme03ws9Tg6jKofQwTe9bv+ v63OfkyjsSXjt3ME8jVXcEdSDRbxGEyg/vCDni4/nsR+zTtLbkg/a44/pNjdtn1/Va oiL+7FzTYg6ApD2OaYmJhiNVVyj1VoM9wyCIspeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cambda Zhu , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 5.4 40/90] ixgbe: Fix calculation of queue with VFs and flow director on interface flap Date: Mon, 3 Feb 2020 16:19:43 +0000 Message-Id: <20200203161922.965356959@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161917.612554987@linuxfoundation.org> References: <20200203161917.612554987@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cambda Zhu [ Upstream commit 4fad78ad6422d9bca62135bbed8b6abc4cbb85b8 ] This patch fixes the calculation of queue when we restore flow director filters after resetting adapter. In ixgbe_fdir_filter_restore(), filter's vf may be zero which makes the queue outside of the rx_ring array. The calculation is changed to the same as ixgbe_add_ethtool_fdir_entry(). Signed-off-by: Cambda Zhu Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index c6404abf2dd18..a26f9fb95ac0a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) struct ixgbe_hw *hw = &adapter->hw; struct hlist_node *node2; struct ixgbe_fdir_filter *filter; - u64 action; + u8 queue; spin_lock(&adapter->fdir_perfect_lock); @@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) hlist_for_each_entry_safe(filter, node2, &adapter->fdir_filter_list, fdir_node) { - action = filter->action; - if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) - action = - (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; + if (filter->action == IXGBE_FDIR_DROP_QUEUE) { + queue = IXGBE_FDIR_DROP_QUEUE; + } else { + u32 ring = ethtool_get_flow_spec_ring(filter->action); + u8 vf = ethtool_get_flow_spec_ring_vf(filter->action); + + if (!vf && (ring >= adapter->num_rx_queues)) { + e_err(drv, "FDIR restore failed without VF, ring: %u\n", + ring); + continue; + } else if (vf && + ((vf > adapter->num_vfs) || + ring >= adapter->num_rx_queues_per_pool)) { + e_err(drv, "FDIR restore failed with VF, vf: %hhu, ring: %u\n", + vf, ring); + continue; + } + + /* Map the ring onto the absolute queue index */ + if (!vf) + queue = adapter->rx_ring[ring]->reg_idx; + else + queue = ((vf - 1) * + adapter->num_rx_queues_per_pool) + ring; + } ixgbe_fdir_write_perfect_filter_82599(hw, - &filter->filter, - filter->sw_idx, - (action == IXGBE_FDIR_DROP_QUEUE) ? - IXGBE_FDIR_DROP_QUEUE : - adapter->rx_ring[action]->reg_idx); + &filter->filter, filter->sw_idx, queue); } spin_unlock(&adapter->fdir_perfect_lock); -- 2.20.1