Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp713368rwb; Sat, 17 Sep 2022 13:26:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59caPmnll7F4xxPbn0gV0StFq0mOrkgtmF69QStwCFxSgv+yggFabLiCcLESMuDffhsSil X-Received: by 2002:a17:907:6d0f:b0:773:353e:6502 with SMTP id sa15-20020a1709076d0f00b00773353e6502mr7586393ejc.615.1663446392689; Sat, 17 Sep 2022 13:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663446392; cv=none; d=google.com; s=arc-20160816; b=dhHZr86FCEw+WkRdTxSiKQoFq96KS6eVTYdKCt7fkWUiIdf6bnEzDG6whhyGQyw9jX duaNSRjM6ALbklycNJw+Oz2JtfG3OlIrLYCQCNZziyikqNunMH3p9zGiE6Aolt2kqTKN NN1UU+0FvEvPq5oZNkmt1avGH52xOONErk4cccplNL87QEOFTUFTB9UY4hD7l0ycFVMP SIp8lnn2ARoFzloJTj/a7va1mrQgK4OW141xsM05slNWcUstpTeo52Wcwzn/3hfUqCmH 1PfnaY9h4HkEcq+ai9G64WMY963kz7GukXDo3bkPg62TQE4I/+JwFqejuAbwvLl+p6Ds hEVw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KD38OQmgSaziFwz483qpbZ1Z/wABtZJQ/6K4DXA6e78=; b=AdLZJ0QFRsdodMqf2eCz+Je7CQkpxvIaXITjZe/ikagW+0HMNj2cXeJcrcqsBZtak5 uM57iAWOLtC+csG1ryCSulGshZsrTqgfs1YWrEE/HuJGQt4cyh/rYnjID5UovKD15pnx r60FpWO56HnTvojV08Xk6drxzsga93P1Vev8zAqG20ARFBtfj3fsGAugSOdS3OigIBc5 x7m/kSgg94dGWDDOsNrOqRprjtkxoJCwaT7Y32W+EEBxVfLni9MnsIRSR/yDd3DDCIQx K8+vRqgYzuzMszXWYwp6IUN5zCBZeWuOMo2DPb+rRKKx4PP2dW7nKPTubEj8PYTyz5A2 ogIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gs9ODi1S; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a056402061800b0043acee93208si4944310edv.319.2022.09.17.13.26.05; Sat, 17 Sep 2022 13:26:32 -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=@gmail.com header.s=20210112 header.b=gs9ODi1S; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbiIQUSa (ORCPT + 99 others); Sat, 17 Sep 2022 16:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiIQUSR (ORCPT ); Sat, 17 Sep 2022 16:18:17 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85C542ED4C; Sat, 17 Sep 2022 13:18:16 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id g2so15288286qkk.1; Sat, 17 Sep 2022 13:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=KD38OQmgSaziFwz483qpbZ1Z/wABtZJQ/6K4DXA6e78=; b=gs9ODi1SU9Kl9RMZdfPPVTL92g9U582A3QyiLLRHk0DP7aMRekW1vpxaCY0DuFyIy4 Gmc4JC2MEREo4YrkmPICVj1cRladnhz9FRB9fiEK9D3+BIlyLccZYLnCIxuHqHwdrsGD dW8uzY5Nr3tOyjePNVIUQBANY0ZAZjFX1So6C4mK1nQlfAAJBFmtz6jCoNsXy7zttZND jKfX1evavoNcmyB5HmuMkKAb5ycpNjp8o+OKvklksejBqwuCTi0YqGk2/+C1AXLVvmLd o8ma7WJJpQUuFiae7662YPBheSg92Qu7bruwrCCM5boqvzkYdsq1aBWq0QBXeiPfQ6Js 14Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=KD38OQmgSaziFwz483qpbZ1Z/wABtZJQ/6K4DXA6e78=; b=d296d2ejuUjMHgNskUsDjSaet5STLOVCEJhdn1+6UYCng6RB7IRHBpg7DWhSul6Utr LkJrdZYXUB8qtv+2iENLpAkVYC/3k0shl1qgHxrzKVf9DgHYCRX1+No+qKcYldR5NeBG bDwC++VBP3x0M4oHOshbne9lflIt2sstLpYT6x4RIgtRjg6zzSSrfiZwzv/22jwv0lzX a9KpUAAzoj3tJi3cq7TqvWV2xe5KlV9oKiBcrel+TdlSvUunP60TC+KhdVQNq4ZfAPwL d4abinUpPWb4C77ZygqoR7kl2kj9H8cnWVoRfGW3SFtNECk7EQ+29T94RXJBb7z3+pEy qAiw== X-Gm-Message-State: ACrzQf01lk10JtAbIV7dcUX+hRo7OvTFUw9PvspJBZwSAAMVszUDydnB jELo/Kvf/8WnOwchgoK1fAm9X/FaDUEHTyxF X-Received: by 2002:a05:620a:254f:b0:6bc:5763:de4b with SMTP id s15-20020a05620a254f00b006bc5763de4bmr8083968qko.207.1663445895626; Sat, 17 Sep 2022 13:18:15 -0700 (PDT) Received: from euclid ([71.58.109.160]) by smtp.gmail.com with ESMTPSA id q13-20020a37f70d000000b006b8e63dfffbsm8769539qkj.58.2022.09.17.13.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Sep 2022 13:18:15 -0700 (PDT) From: Sevinj Aghayeva To: netdev@vger.kernel.org Cc: "David S. Miller" , aroulin@nvidia.com, sbrivio@redhat.com, roopa@nvidia.com, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nikolay Aleksandrov , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Sevinj Aghayeva Subject: [PATCH RFC net-next 3/5] net: 8021q: notify bridge module of bridge-binding flag change Date: Sat, 17 Sep 2022 16:17:59 -0400 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Notify the bridge module when a user changes the bridge-binding flag of a VLAN interface using "ip link set ... vlan bridge_binding on" command, so that the bridge module can take the appropriate action for this change. Signed-off-by: Sevinj Aghayeva --- net/8021q/vlan.h | 2 +- net/8021q/vlan_dev.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 5eaf38875554..71947cdcfaaa 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -130,7 +130,7 @@ void vlan_dev_set_ingress_priority(const struct net_device *dev, int vlan_dev_set_egress_priority(const struct net_device *dev, u32 skb_prio, u16 vlan_prio); void vlan_dev_free_egress_priority(const struct net_device *dev); -int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask); +int vlan_dev_change_flags(struct net_device *dev, u32 flag, u32 mask); void vlan_dev_get_realdev_name(const struct net_device *dev, char *result, size_t size); diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index e1bb41a443c4..7c61b813e654 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -211,8 +212,9 @@ int vlan_dev_set_egress_priority(const struct net_device *dev, /* Flags are defined in the vlan_flags enum in * include/uapi/linux/if_vlan.h file. */ -int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) +int vlan_dev_change_flags(struct net_device *dev, u32 flags, u32 mask) { + struct netdev_notifier_change_details_info details; struct vlan_dev_priv *vlan = vlan_dev_priv(dev); u32 old_flags = vlan->flags; @@ -223,19 +225,31 @@ int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) vlan->flags = (old_flags & ~mask) | (flags & mask); - if (netif_running(dev) && (vlan->flags ^ old_flags) & VLAN_FLAG_GVRP) { + if (!netif_running(dev)) + return 0; + + if ((vlan->flags ^ old_flags) & VLAN_FLAG_GVRP) { if (vlan->flags & VLAN_FLAG_GVRP) vlan_gvrp_request_join(dev); else vlan_gvrp_request_leave(dev); } - if (netif_running(dev) && (vlan->flags ^ old_flags) & VLAN_FLAG_MVRP) { + if ((vlan->flags ^ old_flags) & VLAN_FLAG_MVRP) { if (vlan->flags & VLAN_FLAG_MVRP) vlan_mvrp_request_join(dev); else vlan_mvrp_request_leave(dev); } + + if ((vlan->flags ^ old_flags) & VLAN_FLAG_BRIDGE_BINDING && + netif_is_bridge_master(vlan->real_dev)) { + details.info.dev = dev; + details.vlan.bridge_binding = + !!(vlan->flags & VLAN_FLAG_BRIDGE_BINDING); + call_netdevice_notifiers_info(NETDEV_CHANGE_DETAILS, &details.info); + } + return 0; } -- 2.34.1