Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4426066pxb; Mon, 21 Feb 2022 21:14:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJz51gKZJpdWo9kDhrtNSAYbdVdh1rKrIvz/G1Zdh4zmHPwGur2hK0gWiP9U/VJsNOibuo7J X-Received: by 2002:a63:3301:0:b0:36c:9009:ec9b with SMTP id z1-20020a633301000000b0036c9009ec9bmr18291445pgz.395.1645506875685; Mon, 21 Feb 2022 21:14:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645506875; cv=none; d=google.com; s=arc-20160816; b=rJfAfi4rjY+98Z9+SrLmyZYz2GEA48b6zmlKw6BRwp/+hdPGUsTj5SVrt7Vk28OvBp evZ6dQsEgtZtaqH+6Q3bcesL2sIU8mgaFG7OpzBH24s74rpsWgfx37OZpvcaWmu/aHT4 7OuGgMgNU0PWxYD5O9irSB7Djd96imj03EyNVX+Lme47LaF2XRxVGslQjELgeGcIxWwP l4iwdaKAvJ58gugRDvoiLQyqIL+bZdz6ZKdjhdFJ3A/3pUTtK11iaNDAL35eOo7TAg1H 5FE43vnww3HVSXiV4kYVGGyKLkJ09qc+Y2l+rXpzU0afaBRX/U5L/52/uk3kCg5898to xFQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8CiXW+ordTPvlB+u9HbUK6sbw1rc2hC0tPgjcuKVOVM=; b=cArroElP4ZElcotNJiMVbXuQVMzj39AVin/f1kbZtJdIqaEG7X05WDUn085tyeAMVJ MeWelVvUTSeO4OzVm9K782JwIZ40XMNZ5vNFPsqOW3nq66nAOS0lTdKFsx8n/3dBNtXo 24w3mmjKgbM6uRXvr2Sf1YM0mAb9OxWDTTIAhMPkOhOXNobWC5uWlLAGDlhqVnTH2477 a+CJUqPcaIq/eO82s9udMhv9B2yUHe4QbgY7kZq7n9zztgrkg9FKeH0jLgIQE+ndqmFn WTGt1fEdbdpUyWrb7mAAtq9c/wWSszlC+0HMDr1x6Ne7PrHh0qzx9MspfAYhddGt+/nS 1KYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qUcvoofk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q2si11107104pfk.174.2022.02.21.21.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:14:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qUcvoofk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F7513B3DA; Mon, 21 Feb 2022 20:46:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357448AbiBUPod (ORCPT + 99 others); Mon, 21 Feb 2022 10:44:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379459AbiBUPoH (ORCPT ); Mon, 21 Feb 2022 10:44:07 -0500 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7690D22B30 for ; Mon, 21 Feb 2022 07:43:30 -0800 (PST) Received: by mail-yb1-xb33.google.com with SMTP id b35so7436710ybi.13 for ; Mon, 21 Feb 2022 07:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8CiXW+ordTPvlB+u9HbUK6sbw1rc2hC0tPgjcuKVOVM=; b=qUcvoofk8rUJAf0+4Hif+JUd1A284UxMQ/JJk7kRQn93WTS/uI4J9O3QoDFcKalbXt rTfHx5TC1V040BXgKQJLZwfR+hK7Hh9QNfrYcSE2Y2EA7fCI3K3l4EDpoP3+lfmQR2xn t0zle6EricYu1Gpra8GkZspUtBsUrTKMmQ/GF2DCxqa/MGEVn4+JMIOvMxPgSf1huyxZ wc06SF+cnafh3OUrDhy2v7Wtl8iAiRdGjErskv8WTACS2psKUbm3QbNtYySpy8DnI+s8 B6/+4Gmsqk9qoaW05SOAnNf6fbG5+jKd+AEDVZE7g1XWKDtO4b53JP52RrJ9U8SqHZqs oouA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8CiXW+ordTPvlB+u9HbUK6sbw1rc2hC0tPgjcuKVOVM=; b=i1RygRN1FY/sOytsk8wY1GZp2g9nMI3n5EDOOdPY6ZYXY+a1UsUiSp2z+eJr8Ir7vS wAmq+UBk/J/AgN/4CuVY9Mk7gzrKvUgaH1P2YSesFCnzXAAja7WcTOUyULPuRWYn5JfD vwrLqEbM43grw9nSnQtMypkRTgQ5tGM8+zDF9RjfHLrS8ACpOrEsDP5AonPun/xNBRyf To49YR/QPLPzXSnQPOSXIs/NR+gY49bh5GGlfffL1SYOv8u65IGD0AXIWzkxpmXI1oE+ jzn+DC8j8W1KNCGwz4T6peOAItr37Vr0kGWjWs5D8yGuhzEKP/NI7UkgipymuLGik0eC Q6hg== X-Gm-Message-State: AOAM533YO8D1lNKqlrBs0QVdb5Bj8hdPxkzlQUygPNX02gnYvF3kwfLl kkd5rc4QkC8UNSUoc/+xmRZCCJaSHPxzEqDHk/qfYhoQxQjB9w== X-Received: by 2002:a25:d614:0:b0:61d:bb22:8759 with SMTP id n20-20020a25d614000000b0061dbb228759mr19289175ybg.231.1645458209249; Mon, 21 Feb 2022 07:43:29 -0800 (PST) MIME-Version: 1.0 References: <20220221124644.1146105-1-william.xuanziyang@huawei.com> In-Reply-To: <20220221124644.1146105-1-william.xuanziyang@huawei.com> From: Eric Dumazet Date: Mon, 21 Feb 2022 07:43:18 -0800 Message-ID: Subject: Re: [PATCH net] net: vlan: allow vlan device MTU change follow real device from smaller to bigger To: Ziyang Xuan , Herbert Xu Cc: David Miller , Jakub Kicinski , netdev , Vasily Averin , Kees Cook , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 CC Herbert Xu, author of blamed commit. On Mon, Feb 21, 2022 at 4:28 AM Ziyang Xuan wrote: > > vlan device MTU can only follow real device change from bigger to smaller > but from smaller to bigger under the premise of vlan device MTU not exceed > the real device MTU. > > This issue can be seen using the following commands: > > ip link add link eth1 dev eth1.100 type vlan id 100 > ip link set eth1 mtu 256 > ip link set eth1 mtu 1500 > ip link show > > Modify to allow vlan device follow real device MTU change from smaller > to bigger when user has not configured vlan device MTU which is not > equal to real device MTU. That also ensure user configuration has higher > priority. > > Fixes: 2e477c9bd2bb ("vlan: Propagate physical MTU changes") > Signed-off-by: Ziyang Xuan > --- > net/8021q/vlan.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c > index 788076b002b3..7de4f462525a 100644 > --- a/net/8021q/vlan.c > +++ b/net/8021q/vlan.c > @@ -361,6 +361,7 @@ static int __vlan_device_event(struct net_device *dev, unsigned long event) > static int vlan_device_event(struct notifier_block *unused, unsigned long event, > void *ptr) > { > + unsigned int orig_mtu = ((struct netdev_notifier_info_ext *)ptr)->ext.mtu; > struct netlink_ext_ack *extack = netdev_notifier_info_to_extack(ptr); > struct net_device *dev = netdev_notifier_info_to_dev(ptr); > struct vlan_group *grp; > @@ -419,7 +420,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, > > case NETDEV_CHANGEMTU: > vlan_group_for_each_dev(grp, i, vlandev) { > - if (vlandev->mtu <= dev->mtu) > + if (vlandev->mtu <= dev->mtu && vlandev->mtu != orig_mtu) > continue; > > dev_set_mtu(vlandev, dev->mtu); > -- > 2.25.1 > Herbert, do you recall why only a decrease was taken into consideration ? Thanks.