Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1941972imn; Mon, 1 Aug 2022 05:52:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gPFXz2XPkZpM6Sr+dxyg/dbgMTMArANRwgXxeMNDnOJSzFs1xxQP3SWVySGRXtkK3fmBY X-Received: by 2002:a17:902:f101:b0:16d:c0ae:acd5 with SMTP id e1-20020a170902f10100b0016dc0aeacd5mr16272977plb.70.1659358331777; Mon, 01 Aug 2022 05:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358331; cv=none; d=google.com; s=arc-20160816; b=t5NIv9Sef6q7woJ+VfPJeIdHu/IyxGK8Ap2TZoTfM0glqVaHoUtBuMhCUDNpnQT57o d8LiVPt4xzCJwT07+0p47JWTcVI4yuzEg/zF8zfA2OGUCkz3noxXeOf7O7nF88jZvnXr R9GK4VJW1x9Mzo/nqF0On+imdlkcVcU82/ZH6+HiVhCcLr1uepGMkKS9ZoHkczfjTGl8 Km7VMiethw6y9GQYsAkXcX7943AuR7gLviHUCWyOUK/EgYq6oKOhTXwZym+4ZIyC4mzD OCjDS5kQa4S+MHEpVQKjazhDr7BopfOsbDB3d0R4WRKXovZmLF2ErpRK4bCdx+eFNflD Vv8g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6uXMRsDb0hiWgTaEKhaxGey1+XjBDm8s4Nh5EOHi1dE=; b=QQV5OgALSwko2hGe4UqZf9mhIh0CWocuh3EsPljHIXRQaeNJvtGO2NsDdyj+OFB3t5 dDZNKUVhfKBfakHJnd8qLhKd1P8QwQVaA06tC/Sqcc4p56Qldjtk1PlqAn8/uLrn2yxm ipXZF7Jk1F56Rr112XTJzr//36XqleRL3lia1vORWEem0lMDXfcfautzR9aKlLScKr4D +pJW0bEFRzG61URXq0/hOCAXXWFd41WQ0JNdxAjG328lJAkEtMUUP2FsoARleLY1nFdN cQzv52E6qB89et0VwHA0ChMUBFyyNorbELd7azq0KjxqDXk1kZqcpjdt8UA+AEw48p+s GglA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fImbhH9L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a63fb05000000b00419fc0f56a3si11415817pgh.89.2022.08.01.05.51.52; Mon, 01 Aug 2022 05:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fImbhH9L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234247AbiHAMQ2 (ORCPT + 99 others); Mon, 1 Aug 2022 08:16:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234212AbiHAMPN (ORCPT ); Mon, 1 Aug 2022 08:15:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2301978DD1; Mon, 1 Aug 2022 04:58:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD5A4601BD; Mon, 1 Aug 2022 11:58:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAF1CC433C1; Mon, 1 Aug 2022 11:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659355094; bh=kylcY1j2D2eTbNQf+jHP542bF54FMmv/+lnUvabInZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fImbhH9LZGCKCSmWF6zoGGYoFTkk16QLGZLo2wesqUVpcPgEvIrWmt8fEtUl2lqNu XUwro3y5hXkCwhLECqHrMqlNEovqz8DupNUyVUGSjFKTvWnZREOfUae9d/qw5406tq USmh51oX4YhrNxjp6M0b8D1j6V6ZHHPpg7aM3lQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anirudh Venkataramanan , Sylwester Dziedziuch , Mateusz Palczewski , Jedrzej Jagielski , Marek Szlosek , Tony Nguyen Subject: [PATCH 5.18 30/88] ice: Fix VSIs unable to share unicast MAC Date: Mon, 1 Aug 2022 13:46:44 +0200 Message-Id: <20220801114139.402674669@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114138.041018499@linuxfoundation.org> References: <20220801114138.041018499@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anirudh Venkataramanan commit 5c8e3c7ff3e7bd7b938659be704f75cc746b697f upstream. The driver currently does not allow two VSIs in the same PF domain to have the same unicast MAC address. This is incorrect in the sense that a policy decision is being made in the driver when it must be left to the user. This approach was causing issues when rebooting the system with VFs spawned not being able to change their MAC addresses. Such errors were present in dmesg: [ 7921.068237] ice 0000:b6:00.2 ens2f2: Unicast MAC 6a:0d:e4:70:ca:d1 already exists on this PF. Preventing setting VF 7 unicast MAC address to 6a:0d:e4:70:ca:d1 Fix that by removing this restriction. Doing this also allows us to remove some additional code that's checking if a unicast MAC filter already exists. Fixes: 47ebc7b02485 ("ice: Check if unicast MAC exists before setting VF MAC") Signed-off-by: Anirudh Venkataramanan Signed-off-by: Sylwester Dziedziuch Signed-off-by: Mateusz Palczewski Signed-off-by: Jedrzej Jagielski Tested-by: Marek Szlosek Signed-off-by: Tony Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ice/ice_main.c | 2 + drivers/net/ethernet/intel/ice/ice_sriov.c | 40 ----------------------------- 2 files changed, 2 insertions(+), 40 deletions(-) --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -4640,6 +4640,8 @@ ice_probe(struct pci_dev *pdev, const st ice_set_safe_mode_caps(hw); } + hw->ucast_shared = true; + err = ice_init_pf(pf); if (err) { dev_err(dev, "ice_init_pf failed: %d\n", err); --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -1310,39 +1310,6 @@ out_put_vf: } /** - * ice_unicast_mac_exists - check if the unicast MAC exists on the PF's switch - * @pf: PF used to reference the switch's rules - * @umac: unicast MAC to compare against existing switch rules - * - * Return true on the first/any match, else return false - */ -static bool ice_unicast_mac_exists(struct ice_pf *pf, u8 *umac) -{ - struct ice_sw_recipe *mac_recipe_list = - &pf->hw.switch_info->recp_list[ICE_SW_LKUP_MAC]; - struct ice_fltr_mgmt_list_entry *list_itr; - struct list_head *rule_head; - struct mutex *rule_lock; /* protect MAC filter list access */ - - rule_head = &mac_recipe_list->filt_rules; - rule_lock = &mac_recipe_list->filt_rule_lock; - - mutex_lock(rule_lock); - list_for_each_entry(list_itr, rule_head, list_entry) { - u8 *existing_mac = &list_itr->fltr_info.l_data.mac.mac_addr[0]; - - if (ether_addr_equal(existing_mac, umac)) { - mutex_unlock(rule_lock); - return true; - } - } - - mutex_unlock(rule_lock); - - return false; -} - -/** * ice_set_vf_mac * @netdev: network interface device structure * @vf_id: VF identifier @@ -1376,13 +1343,6 @@ int ice_set_vf_mac(struct net_device *ne if (ret) goto out_put_vf; - if (ice_unicast_mac_exists(pf, mac)) { - netdev_err(netdev, "Unicast MAC %pM already exists on this PF. Preventing setting VF %u unicast MAC address to %pM\n", - mac, vf_id, mac); - ret = -EINVAL; - goto out_put_vf; - } - mutex_lock(&vf->cfg_lock); /* VF is notified of its new MAC via the PF's response to the