Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8431101rwb; Wed, 23 Nov 2022 22:23:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4bnLOjVdIMLNqsRVL8p4sqi1giRXtB1xNfBeuEkiWype0Kw0oKJKpDneA/I0Tf8dHMjGZ9 X-Received: by 2002:a63:dd16:0:b0:476:d2d9:5151 with SMTP id t22-20020a63dd16000000b00476d2d95151mr9797911pgg.487.1669271015696; Wed, 23 Nov 2022 22:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669271015; cv=none; d=google.com; s=arc-20160816; b=x7uTlmnCZ5ahe47P4Qoz9TMWBOXFif0HTYEW6+dNrbUP03DpfNRrO2ZT0UhXEYms6d zQ+8mi0AeExdKzc2RH5c2Whq7MMsXIbxsb6tn9yI6BVo612QtaRm65ZB/KmBzSpcUSJ4 C319v9x7pMPm4qH2mj/UMI+Ky+om/+fiq/SV6bNs9Oi2OvvP4mwwSN7a4Hc3wtgNgUvf +t8e4s4GC5cenkNaEmrxpmZxH8Oz41jnSqYkRZajC0GHXVEwbyQCVaBWn397b2gbnEQz OwVTt2wgGx2SDsys6h+EhFb8XVqjg8JS9+/U3ihPHdmFuxcOVud4CIiUAsySzmeVsL4K 9mCg== 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; bh=uspQkG6ObcV5KxUA/GAC67CunaYZcH72ZKB+ZacXY/4=; b=IpGU1ArqZNw2iiHU9pA/XZyznY96/gSHAIDQc3eFioUrq3XRglnzPxi+BcOB/P7Jn3 NhGpiVgFYnhkznPz4NnZ7hiBieJZp/ruKbR/ufze+m11v1BQ02pEwMOmNjAfb+MGnpqT yGu/1ndNtbcjzDaOXLWEyTitEBupIkeZ5xFlEwqIGN1Yk/3gtvKLLThmWAE1ctN8iyga o8hEHT4fGia4PEPRyPEsUv3iyY3SUZ4LnMnZniQWuoM7Qy8YqAm2UyW0NYtCJ4SR0Dyd lJA+sauW7RPVf6XEhEofX8F5VoX2sJ4F4K5zImrklt5Wo7ULm5m+c2DYup7FmLgdi98W HMww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170902c94900b00186b76f4655si135074pla.358.2022.11.23.22.23.24; Wed, 23 Nov 2022 22:23:35 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229525AbiKXFeO (ORCPT + 88 others); Thu, 24 Nov 2022 00:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiKXFeL (ORCPT ); Thu, 24 Nov 2022 00:34:11 -0500 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57643A658C; Wed, 23 Nov 2022 21:34:10 -0800 (PST) Received: by mail-pj1-f43.google.com with SMTP id o5-20020a17090a678500b00218cd5a21c9so673840pjj.4; Wed, 23 Nov 2022 21:34:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uspQkG6ObcV5KxUA/GAC67CunaYZcH72ZKB+ZacXY/4=; b=ZCPOFW8MZAjLFsjvterIBNBMd3QZOn+hba83TAaK9eqZycCN8+s6Z0dpbaUEs06hXC jNmH8G4GdAshgvH2zfotf/QT65raUBUmKUDa2FiBF7ivJjlYUvYeJvl4XXHXBqq0mJsE gOaFobyFGTnQjNZj4HCXGx6PxhJL8j5BV30WfXBTe/nbrmfSrIL0DvilSKsHscAy/Miv iKxu9pza99PzgIMUzOqCTAI0MbAG08UFY9VyF1/D4Hut7lWN+VBhafaGcbYcaj7LpkSc RnlPMdes0J5hKXTzGXOv7cSqNO9KDK4ZCyIhHihUB3Lp8o4bUaFShK2c0VxnmgW6BCm3 /2aQ== X-Gm-Message-State: ANoB5pmoqVweUFBt8yLhojXpC0ANFw1BH36/RTrRmUPuFyU2CLl+FRqA Snd2iSVCGSmbn4eKfT485JCwwT3tZkhG891oSVYGJCY6SDM= X-Received: by 2002:a17:90a:a60c:b0:213:2e97:5ea4 with SMTP id c12-20020a17090aa60c00b002132e975ea4mr39874574pjq.92.1669268049736; Wed, 23 Nov 2022 21:34:09 -0800 (PST) MIME-Version: 1.0 References: <20221122154934.13937-1-mailhol.vincent@wanadoo.fr> <20221122201246.0276680f@kernel.org> <20221123190649.6c35b93d@kernel.org> In-Reply-To: <20221123190649.6c35b93d@kernel.org> From: Vincent MAILHOL Date: Thu, 24 Nov 2022 14:33:58 +0900 Message-ID: Subject: Re: [RFC PATCH] net: devlink: devlink_nl_info_fill: populate default information To: Jakub Kicinski Cc: Jiri Pirko , netdev@vger.kernel.org, "David S . Miller" , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 On Thu. 24 Nov. 2022 at 12:06, Jakub Kicinski wrote: > On Wed, 23 Nov 2022 18:42:41 +0900 Vincent MAILHOL wrote: > > I see three solutions: > > > > 1/ Do it in the core, clean up all drivers using > > devlink_info_driver_name_put() and make the function static (i.e. > > forbid the drivers to set the driver name themselves). > > N.B. This first solution does not work for > > devlink_info_serial_number_put() because the core will not always be > > able to provide a default value (e.g. my code only covers USB > > devices). > > > > 2/ Keep track of which attribute is already set (as you suggested). > > > > 3/ Do a function devlink_nl_info_fill_default() and let the drivers > > choose to either call that function or set the attributes themselves. > > > > I would tend to go with a mix of 1/ and 2/. > > I think 2/ is best because it will generalize to serial numbers while > 1/ will likely not. 3/ is a smaller gain. > > Jiri already plumbed thru the struct devlink_info_req which is on the > stack of the caller, per request, so we can add the bool / bitmap for > already reported items there quite easily. Sorry, let me clarify the next actions. Are you meaning that Jiri is already working on the bitmap implementation and should I wait for his patches first? Or do you expect me to do it?