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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5065EC04A95 for ; Wed, 28 Sep 2022 09:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233129AbiI1Js3 (ORCPT ); Wed, 28 Sep 2022 05:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232112AbiI1JsG (ORCPT ); Wed, 28 Sep 2022 05:48:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF1F95E73 for ; Wed, 28 Sep 2022 02:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664358484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JojnlB8YwuHw3WaiLCvm1GIVn0nTelV1daLnuoHKCyY=; b=Mx9c2nlzEWKowpdjGkgKUuswZUVPNhkUzv24ZHLxQ2p9vsTKkGkm9ikJp3AJAVbmN7ZTW6 tJalnRoy+ZLJqyvWxl8U4ny4VdX3ySt3v0TsV6Hh7AppX+YXjR0xMLwXcJiLrKGjDB+4FY 2FdEmvvJqi3WsmV/lBeRycmADlOyrP4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-519-OHLjMDyNOTuxUOcMFmX-jA-1; Wed, 28 Sep 2022 05:48:03 -0400 X-MC-Unique: OHLjMDyNOTuxUOcMFmX-jA-1 Received: by mail-wm1-f70.google.com with SMTP id fc12-20020a05600c524c00b003b5054c70d3so6871507wmb.5 for ; Wed, 28 Sep 2022 02:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=JojnlB8YwuHw3WaiLCvm1GIVn0nTelV1daLnuoHKCyY=; b=Rc0JYeZnEV/n7BsQ7GD2cQANrn1BKYfX5Niv6K+nZndTKK/98/O7jV9voHSVhVbnfR PyoqWo8ZcY1+3biP9IxmDsPbzUd3kDOtcPlMB2HJYPzKFbrCSAFsjr3o5V5J6DISMa20 xN8iFRg4yioj/YRoyYDNwKEc+nODrlnS+uIOJQfUrOP7RtT+Q4CysJNB2CEl3YcZLrZe v5HoGLs8/z+L3yxz4ogJthn4Y6RXzIMNEG+U1J6zf1TLmpy3uhnxZnhj7X0Gv946zpj2 +eb05LYbr1y3hhd7Iov2wCxzyzs/Dw3AEfxv51FPHHHsPCZ/+Zyd7y31lo8ZEjfSU7WG 40tw== X-Gm-Message-State: ACrzQf13o3EyUwQ0Xt5eJqIVxBXgu1sGhISB+nlT0WOFK2AkRaFLgdWs 0qweMiTS0XJ2gapQojswosMbWAIuBEV7uRJnF1+7YDNRgmkVc6eo3qxr14GcvKioc7kkSVKp7Qq MtyHnTQ7GXK1PA/7T X-Received: by 2002:a5d:654e:0:b0:22c:b7aa:e4fa with SMTP id z14-20020a5d654e000000b0022cb7aae4famr5493513wrv.101.1664358481173; Wed, 28 Sep 2022 02:48:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sV63veDAO9nIrevgWqqTNG1gLAz5ICNKaSovdrzGA8b0QKqCCuHPjuiJYaitrH+OgoUhZaw== X-Received: by 2002:a5d:654e:0:b0:22c:b7aa:e4fa with SMTP id z14-20020a5d654e000000b0022cb7aae4famr5493498wrv.101.1664358480987; Wed, 28 Sep 2022 02:48:00 -0700 (PDT) Received: from localhost.localdomain ([92.62.32.42]) by smtp.gmail.com with ESMTPSA id m35-20020a05600c3b2300b003b47b913901sm5989314wms.1.2022.09.28.02.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 02:48:00 -0700 (PDT) Date: Wed, 28 Sep 2022 11:47:57 +0200 From: Guillaume Nault To: Hangbin Liu Cc: Jakub Kicinski , netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Ido Schimmel , Petr Machata , Florent Fourcot , Nikolay Aleksandrov , Nicolas Dichtel , David Ahern Subject: Re: [PATCHv3 net-next] rtnetlink: Honour NLM_F_ECHO flag in rtnl_{new, set, del}link Message-ID: <20220928094757.GA3081@localhost.localdomain> References: <20220927041303.152877-1-liuhangbin@gmail.com> <20220927072130.6d5204a3@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Sep 28, 2022 at 10:39:49AM +0800, Hangbin Liu wrote: > On Tue, Sep 27, 2022 at 07:21:30AM -0700, Jakub Kicinski wrote: > > On Tue, 27 Sep 2022 12:13:03 +0800 Hangbin Liu wrote: > > > @@ -3382,6 +3401,12 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm, > > > if (err) > > > goto out_unregister; > > > } > > > + > > > + nskb = rtmsg_ifinfo_build_skb(RTM_NEWLINK, dev, 0, 0, GFP_KERNEL, NULL, > > > + 0, pid, nlh->nlmsg_seq); > > > + if (nskb) > > > + rtnl_notify(nskb, dev_net(dev), pid, RTNLGRP_LINK, nlh, GFP_KERNEL); > > > + > > > out: > > > if (link_net) > > > put_net(link_net); > > > > I'm surprised you're adding new notifications. Does the kernel not > > already notify about new links? I thought rtnl_newlink_create() -> > > rtnl_configure_link() -> __dev_notify_flags() sends a notification, > > already. > > I think __dev_notify_flags() only sends notification when dev flag changed. > On the other hand, the notification is sent via multicast, while this patch > is intend to unicast the notification to the user space. In rntl_configure_link(), dev->rtnl_link_state is RTNL_LINK_INITIALIZING on device cretation, so __dev_notify_flags() is called with gchanges=~0 and notification should be always sent. It's just a matter of passing the portid and the nlmsghdr down the call chain to make rtnl_notify() send the unicast message together with the multicast ones. Now for device modification, I'm not sure there's a use case for unicast notifications. The caller already knows which values it asked to modify, so ECHO doesn't bring much value compared to a simple ACK. > Thanks > Hangbin >