From patchwork Tue Jun 13 12:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Gardocki X-Patchwork-Id: 13278682 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65F293C25 for ; Tue, 13 Jun 2023 12:24:33 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33EA3CE for ; Tue, 13 Jun 2023 05:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686659072; x=1718195072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E5mmwH2fSHfoDdpc2kQEZSS8TlOLkOc7UCmxYue/2Bc=; b=Qxdd9G06CYI+6zoO6TDneIbc8Agi8iKmuQCsQHLa6X5OQVi1Bx2uoQpD AFRCxgCZqj/wlNqOZ5GcN3gFdhR8Qn0hCechgtnr0oc+eaUGagnKDpQhS Du4yj1tk3ps3O2KshevCQmgPrZ4obN3ABErfYrpKJVfdeYKGNo7MALrhL CS5tfVHpMAsHwMQrsofKZYMco1SqqnwhBuYg5g8njHkrioVqUUb8tNSZj 6+Ie65WcjHXXwyqw3h4Xvx111o0ptFrFgNdvyE+pEkUWXzB+to0QCx3Sw v0itR0gQS0WYsQ96jwAFoblRdZqHEe6BERQNUlSMxJOCYRo1NIxFxdQlV Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="337951213" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="337951213" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835871998" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="835871998" Received: from pgardocx-mobl1.igk.intel.com ([10.237.95.41]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:29 -0700 From: Piotr Gardocki To: netdev@vger.kernel.org Cc: piotrx.gardocki@intel.com, intel-wired-lan@lists.osuosl.org, przemyslaw.kitszel@intel.com, michal.swiatkowski@linux.intel.com, pmenzel@molgen.mpg.de, kuba@kernel.org, maciej.fijalkowski@intel.com, anthony.l.nguyen@intel.com, simon.horman@corigine.com, aleksander.lobakin@intel.com Subject: [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address Date: Tue, 13 Jun 2023 14:24:18 +0200 Message-Id: <20230613122420.855486-2-piotrx.gardocki@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613122420.855486-1-piotrx.gardocki@intel.com> References: <20230613122420.855486-1-piotrx.gardocki@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org In some cases it is possible for kernel to come with request to change primary MAC address to the address that is already set on the given interface. This patch adds proper check to return fast from the function in these cases. An example of such case is adding an interface to bonding channel in balance-alb mode: modprobe bonding mode=balance-alb miimon=100 max_bonds=1 ip link set bond0 up ifenslave bond0 Signed-off-by: Piotr Gardocki --- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index c2456b3667fe..8f1c49ab17df 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -8754,6 +8754,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa, return -EINVAL; if (!netif_device_present(dev)) return -ENODEV; + if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) + return 0; err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack); if (err) return err; From patchwork Tue Jun 13 12:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Gardocki X-Patchwork-Id: 13278683 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80AAD3C25 for ; Tue, 13 Jun 2023 12:24:36 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2086E10CE for ; Tue, 13 Jun 2023 05:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686659075; x=1718195075; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m+4uwLRuZN9fn+hK45LCaKkaZvlTk7MrI9TFDI/rJdM=; b=ljaQ+6Yef/0oStIpwxpFhUMc0HlNS8Tq8dfP6Bs5yNrwtMPNdZq1ybwR +skJZEowSBnaui/67r4RbmTZ1jGn2oyk2K93GRT5VadWHyyKYoVd+agq8 T4pfd0Biw6+VkulSy2jIBASD0L3HOasI4ggMSwOxyf9uX+Zrtah7RCwKY lsIW75OcHifwN22hObjgAZ/sGfArRXf3LjMleRrAa+oO9iIcISlIg2S6j FdHyIRhlNeJRyExHCrvaOXDlumdv0/P3iwo7Ln20rNoFPqpYBK4SlDkS9 83dvHR0T4xn7ChP9ta8XdkDOusyx1Zzpi6JLzMVRmJ7e9+Umm0N1S5mE7 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="337951225" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="337951225" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835872003" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="835872003" Received: from pgardocx-mobl1.igk.intel.com ([10.237.95.41]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:32 -0700 From: Piotr Gardocki To: netdev@vger.kernel.org Cc: piotrx.gardocki@intel.com, intel-wired-lan@lists.osuosl.org, przemyslaw.kitszel@intel.com, michal.swiatkowski@linux.intel.com, pmenzel@molgen.mpg.de, kuba@kernel.org, maciej.fijalkowski@intel.com, anthony.l.nguyen@intel.com, simon.horman@corigine.com, aleksander.lobakin@intel.com Subject: [PATCH net-next v2 2/3] i40e: remove unnecessary check for old MAC == new MAC Date: Tue, 13 Jun 2023 14:24:19 +0200 Message-Id: <20230613122420.855486-3-piotrx.gardocki@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613122420.855486-1-piotrx.gardocki@intel.com> References: <20230613122420.855486-1-piotrx.gardocki@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The check has been moved to core. The ndo_set_mac_address callback is not being called with new MAC address equal to the old one anymore. Signed-off-by: Piotr Gardocki Reviewed-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index b847bd105b16..29ad1797adce 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -1788,12 +1788,6 @@ static int i40e_set_mac(struct net_device *netdev, void *p) if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - if (ether_addr_equal(netdev->dev_addr, addr->sa_data)) { - netdev_info(netdev, "already using mac address %pM\n", - addr->sa_data); - return 0; - } - if (test_bit(__I40E_DOWN, pf->state) || test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) return -EADDRNOTAVAIL; From patchwork Tue Jun 13 12:24:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Gardocki X-Patchwork-Id: 13278684 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FCA33C25 for ; Tue, 13 Jun 2023 12:24:39 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0663210EC for ; Tue, 13 Jun 2023 05:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686659078; x=1718195078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aiy2x7WzA9Zv0AUyWsyvj/l73+iJBj7g8yRezUPEHv4=; b=hWBaGFMmw4M/9dS7lFpRskhzH/xu3zkmbJQb3TevotJfZz0ZdCSaALpW ftZwMd7D4MkuBbD7DNwYXIo3lRO21MECvtTiqOOjT1Etca56RP4rPITJ+ mdrHX21swhZu3P8QhKBnc67TLQD1Es1Yv1C2pdN8vJJpF5uy+yrvyeCdp W5zzQpUs1uAyaIOB9oihExdmtzQKtmXv0jWjgSnUqo44ZQuhvo51wyDHg CrdjR97IjcxQua9QUntIsmPAtNamSQ5PloMTYoC8/g9lyaKQKHmch3RL7 vJ+S8uVesJSE8Euaz5zXRPO7asdX5Dvgy48unsIn9SY5Hzu+AdR1EBpHg Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="337951234" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="337951234" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835872008" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="835872008" Received: from pgardocx-mobl1.igk.intel.com ([10.237.95.41]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2023 05:24:34 -0700 From: Piotr Gardocki To: netdev@vger.kernel.org Cc: piotrx.gardocki@intel.com, intel-wired-lan@lists.osuosl.org, przemyslaw.kitszel@intel.com, michal.swiatkowski@linux.intel.com, pmenzel@molgen.mpg.de, kuba@kernel.org, maciej.fijalkowski@intel.com, anthony.l.nguyen@intel.com, simon.horman@corigine.com, aleksander.lobakin@intel.com Subject: [PATCH net-next v2 3/3] ice: remove unnecessary check for old MAC == new MAC Date: Tue, 13 Jun 2023 14:24:20 +0200 Message-Id: <20230613122420.855486-4-piotrx.gardocki@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613122420.855486-1-piotrx.gardocki@intel.com> References: <20230613122420.855486-1-piotrx.gardocki@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The check has been moved to core. The ndo_set_mac_address callback is not being called with new MAC address equal to the old one anymore. Signed-off-by: Piotr Gardocki Reviewed-by: Maciej Fijalkowski --- drivers/net/ethernet/intel/ice/ice_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index caafb12d9cc7..f0ba896a3f46 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5624,11 +5624,6 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi) if (!is_valid_ether_addr(mac)) return -EADDRNOTAVAIL; - if (ether_addr_equal(netdev->dev_addr, mac)) { - netdev_dbg(netdev, "already using mac %pM\n", mac); - return 0; - } - if (test_bit(ICE_DOWN, pf->state) || ice_is_reset_in_progress(pf->state)) { netdev_err(netdev, "can't set mac %pM. device not ready\n",