Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4883004pjb; Mon, 27 Jul 2020 07:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0XCuT/i3G8PUtUn5DUThFi/qdjup0UUJgBPUz2Ihi9NFJcS6E+H742kYQ6s1EQp5RKkCm X-Received: by 2002:a17:906:774d:: with SMTP id o13mr20924964ejn.373.1595860325592; Mon, 27 Jul 2020 07:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860325; cv=none; d=google.com; s=arc-20160816; b=HmpU08fgr+9lzP4MMsTmxyJ9kRLxFL3HK1NuA0zWL5cCw89DuMCTre89p5EPNaVU1t JeP1EUrohsVyiM2JMls+RF/JCEPbSLl04A1ryfnL5TaePrLhkvVl5iAPHw5Uv6ZY4Wgr YTcZWjEN8OTegPwMfoLW4Bkl7a2LtbD5cP1ZlDF/aFP9rPJoKhfIwYncgs6b2CkGJGwV eKiKXZEi39dN1KwhrmSPpNb4A4gACopUAVSjxG8r+c1JhVissmxz8E0oM/5P5htmNAFt vglNmqdAVIOJoENninGgsFdSBdZ6bxpOb4TbfymDWBedCAIEA7e32rzxXhh08zhYszuS yy0w== 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=Y/Y5Scxvp/JK5lA13NGI+JA0+jKDvcr6By/sHdma/GA=; b=Pu9/AzfqxDNj+Ew4V5tJUZ4qIRPkAjuoh3rw4L27VkLpZmvpwTn5AogopR+zTIYMER 2wWyIko01qcbeh4RJSGMbL1T9PzbB1wpLPW+0bZ4cNBd4v5s6JQh+47o4dSB8aw31DMy iIfSnlO8iNbB9bZqxVBcJ7O2qRdZjEmmQfZnZJ1rWNO7BJo94aJm74+i0YEywbb1n6nm SOwsvr/I3Gzj/fHWYGehzugeZLBYS6o4Hbv8mzq96UARmlR240n6cYpmMyYMQvnwBS1Y U4DdI8dztn+4WxnXKOVxc3s7+dALg/pTCDYP5Cqlae6s/60e5NZbT2PbwWCePGEXAa01 wDXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GCPJoEkq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si6239538ejf.492.2020.07.27.07.31.43; Mon, 27 Jul 2020 07:32:05 -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=GCPJoEkq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731778AbgG0OVp (ORCPT + 99 others); Mon, 27 Jul 2020 10:21:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:50462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730258AbgG0OVo (ORCPT ); Mon, 27 Jul 2020 10:21:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 170EA2070B; Mon, 27 Jul 2020 14:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859703; bh=OdLkRB2xOGe8mEdYlFzHbiS2fJS4dERxvM6LXLy6FXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GCPJoEkqNZ+32x9Kkxi7djg9E0d6gIsxRDCAwl9qBO3Pn+aLBkVmjno+cXr769LU3 9p/ILJkahKZSgAfnl/QBVAhTpONGKwLqnGJ7os/dFrlWyQApGK/xDa48la5fnHvftB V1NYUMtXrxBOnxIeKu5kML+BvpHd3y0+cDfPo5uA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shannon Nelson , "David S. Miller" , Sasha Levin Subject: [PATCH 5.7 072/179] ionic: update filter id after replay Date: Mon, 27 Jul 2020 16:04:07 +0200 Message-Id: <20200727134936.194813700@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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: Shannon Nelson [ Upstream commit cc4428c4de8c31f12e4690d0409e0432fe05702f ] When we replay the rx filters after a fw-upgrade we get new filter_id values from the FW, which we need to save and update in our local filter list. This allows us to delete the filters with the correct filter_id when we're done. Fixes: 7e4d47596b68 ("ionic: replay filters after fw upgrade") Signed-off-by: Shannon Nelson Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../ethernet/pensando/ionic/ionic_rx_filter.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index fb9d828812bd2..cd0076fc3044e 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -21,13 +21,16 @@ void ionic_rx_filter_free(struct ionic_lif *lif, struct ionic_rx_filter *f) void ionic_rx_filter_replay(struct ionic_lif *lif) { struct ionic_rx_filter_add_cmd *ac; + struct hlist_head new_id_list; struct ionic_admin_ctx ctx; struct ionic_rx_filter *f; struct hlist_head *head; struct hlist_node *tmp; + unsigned int key; unsigned int i; int err; + INIT_HLIST_HEAD(&new_id_list); ac = &ctx.cmd.rx_filter_add; for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { @@ -58,9 +61,30 @@ void ionic_rx_filter_replay(struct ionic_lif *lif) ac->mac.addr); break; } + spin_lock_bh(&lif->rx_filters.lock); + ionic_rx_filter_free(lif, f); + spin_unlock_bh(&lif->rx_filters.lock); + + continue; } + + /* remove from old id list, save new id in tmp list */ + spin_lock_bh(&lif->rx_filters.lock); + hlist_del(&f->by_id); + spin_unlock_bh(&lif->rx_filters.lock); + f->filter_id = le32_to_cpu(ctx.comp.rx_filter_add.filter_id); + hlist_add_head(&f->by_id, &new_id_list); } } + + /* rebuild the by_id hash lists with the new filter ids */ + spin_lock_bh(&lif->rx_filters.lock); + hlist_for_each_entry_safe(f, tmp, &new_id_list, by_id) { + key = f->filter_id & IONIC_RX_FILTER_HLISTS_MASK; + head = &lif->rx_filters.by_id[key]; + hlist_add_head(&f->by_id, head); + } + spin_unlock_bh(&lif->rx_filters.lock); } int ionic_rx_filters_init(struct ionic_lif *lif) -- 2.25.1