From patchwork Fri Apr 17 17:43:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shirshov X-Patchwork-Id: 11495823 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4802D912 for ; Fri, 17 Apr 2020 17:43:55 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1370E2063A for ; Fri, 17 Apr 2020 17:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1370E2063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 5116464861B6; Fri, 17 Apr 2020 17:43:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 5116464861B6 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 3D2585DE9925C; Fri, 17 Apr 2020 17:43:54 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id EB9535DE9925A; Fri, 17 Apr 2020 17:43:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id CECEE5DE99240 for ; Fri, 17 Apr 2020 17:43:49 +0000 (UTC) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 67FFA6085698 for ; Fri, 17 Apr 2020 17:43:49 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id w11so1432566pga.12 for ; Fri, 17 Apr 2020 10:43:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pnMtH7TQ0F4VdvriTtQOD0y4kLjcwVxWE5j+8WiGW/c=; b=o2Fhju9iYdO5m7N+5AkxjcN3oQvJpMZkQiTbOFN31C3kloJwjOUDlKUIF+Bfif5z8f 7g2Rk4Nji8sOCZupvp592tOQ93yurj9+JVYq90TAec9iFXYNjQs0TLyY/yrhCG8YbRKf DZx47ewlCpZXyu0GFDlT426VN5FvnFgW3gvpiote0C/0OXW7E3T1OpWEH1ft++y+hKRH EAoxmlCj/tCIFFDUTDV8TSvATY+HChWJOdNks7CJd84YDXh6sW6oWNmIOQdSJZGfJx2Z 4hd5NUzNMeCRVOEuCw1I7ZQT8+vKMMB3zCUUMBsvJe8iez8EgKzK8C/dE1ocbYQMnnos pyuw== X-Gm-Message-State: AGi0PubPZU/+chmKA64XrqkTp2OtvWtrdcdmxut5JV+ekRumXARYGZzn YyFdTJA9NzdC/K/bWSbb5PETej9P X-Google-Smtp-Source: APiQypKtHCtAS6h0K4SeLXuEFfLTJWgC1Q0iigG7EIN4YJ9DitF5ILWn7qh23uuITE5Jd1SxTpZS2A== X-Received: by 2002:a62:fccf:: with SMTP id e198mr4106480pfh.119.1587145428213; Fri, 17 Apr 2020 10:43:48 -0700 (PDT) Received: from localhost.localdomain (50-47-139-32.evrt.wa.frontiernet.net. [50.47.139.32]) by smtp.gmail.com with ESMTPSA id j32sm7320789pgb.55.2020.04.17.10.43.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2020 10:43:47 -0700 (PDT) From: Pavel Shirshov To: libteam@lists.fedorahosted.org Subject: [PATCH] Skip setting the same hwaddr to a lag port if not needed Date: Fri, 17 Apr 2020 10:43:35 -0700 Message-Id: <1587145415-16372-1-git-send-email-pavel.contrib@gmail.com> X-Mailer: git-send-email 2.7.4 Message-ID-Hash: RACLYCNM773AR5NCDD76BRVETLAIGQ3T X-Message-ID-Hash: RACLYCNM773AR5NCDD76BRVETLAIGQ3T X-MailFrom: pavel.contrib@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jiri@resnulli.us X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Avoid setting the same mac address to a LAG port, if the LAG port already has the right one. Signed-off-by: Pavel Shirshov --- teamd/teamd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/teamd/teamd.c b/teamd/teamd.c index 8cdc16d..f955b19 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -837,7 +837,14 @@ static int teamd_set_hwaddr(struct teamd_context *ctx) err = -EINVAL; goto free_hwaddr; } - err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); + + if (memcmp(hwaddr, ctx->hwaddr, hwaddr_len)) + err = team_hwaddr_set(ctx->th, ctx->ifindex, hwaddr, hwaddr_len); + else { + err = 0; + teamd_log_dbg(ctx, "Skip setting same hwaddr string: \"%s\".", hwaddr_str); + } + if (!err) ctx->hwaddr_explicit = true; free_hwaddr: