From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED97EC7EE2E for ; Tue, 13 Jun 2023 12:24:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B9F29416EC; Tue, 13 Jun 2023 12:24:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B9F29416EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1686659077; bh=dXIB7kg1MRUR92Ggk+p3AlpwEzeBsHuVuEfWtDtqm4M=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=6IqMHgOTK9WGYc5dQWLU3CVcQmHz8v08tk/AexPvg9C4sKxolE309yEJLmq+vKw9K RB33khZWqfpu92C8YN4y0lmW7Wrn03WMHYpH2sDcOFqX/Xes+U0lNutQFs/aYU/1Ax 9SHqmUYykdDngVh/dlo7cn4SRCWoYIMDvssqnN4uU3qYVRx+OBqZ8e6ban0TpaRLZi Tah/aZsMVhSezQxieIq7e85Mr8rU3HZHjIyGMwPFhLMdFsQs9/t2mlDiPYqXFSEV4v /RDdnb5k0nRO9QP5xbifzkPSIQWKV0Ra8Y2A1FJhnSdj5sD4amdQ+4ChZ/tqCbR6Xc eQKurMQftOKGA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SaSirspmQqag; Tue, 13 Jun 2023 12:24:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id C534C416F0; Tue, 13 Jun 2023 12:24:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C534C416F0 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id E04AE1BF352 for ; Tue, 13 Jun 2023 12:24:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C7EBD8231E for ; Tue, 13 Jun 2023 12:24:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C7EBD8231E X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YT3iPOPD40s9 for ; Tue, 13 Jun 2023 12:24:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 350CC822C7 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by smtp1.osuosl.org (Postfix) with ESMTPS id 350CC822C7 for ; Tue, 13 Jun 2023 12:24:32 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="337951215" X-IronPort-AV: E=Sophos;i="6.00,239,1681196400"; d="scan'208";a="337951215" 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 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> MIME-Version: 1.0 X-Mailman-Original-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-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Qxdd9G06 Subject: [Intel-wired-lan] [PATCH net-next v2 1/3] net: add check for current MAC address in dev_set_mac_address X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pmenzel@molgen.mpg.de, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, intel-wired-lan@lists.osuosl.org, simon.horman@corigine.com, kuba@kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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; -- 2.34.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan