Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7303853rwb; Tue, 15 Nov 2022 10:13:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Hcd4G3RQj9itmvWbjSzfvW9DG2ey/rTr6HvoBr5NzqWCwiBGCw3rZ8N/C/HFqEZAp/7bz X-Received: by 2002:a17:907:2168:b0:78d:48ac:9041 with SMTP id rl8-20020a170907216800b0078d48ac9041mr14836339ejb.361.1668535986243; Tue, 15 Nov 2022 10:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668535986; cv=none; d=google.com; s=arc-20160816; b=sSzk0rYzG6Ux4vjxTfYvBG1NaOTAi9L66/dklAuAh4WiFqsVDCCgVgp+ScsLPlMp5k m4OA2UYE3/fEjnc1WTc/XUFiqGHNoXctqpaqGunBjg2z5trePvyMQhQtloM774riisfF N3ZhrZdm0TMReKAt9aT8Muc+4Ps6lcVumHbWIxms2vNcHZyh7Uo3wz/wNZ0Q5mLjYZe3 8qKCAR/NM/jmZEBIRJ7XAPX2Bar7RpUZQ5E4HaxC8zPvQZkQTe+3DmAEkFRxO0gHeSZa dT9FOTsLQLdlcmeB+dvpVih4Tf98PVA9HxSG5oO/Rk0v6Gcndqv5jujlciDpJLAULvmx DwHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EjU9bcCXjwveYmZh/YpPwg4A3p0yA659OLTANrMlLc0=; b=JusMLYpbQIJcB6kEJ4tqf/rVSRpPxSGrEkNFErr+etpIx8GNK3qRBjjqydE8KHXPkr tG5x9RI49BiAor5iciGd7Y8W5Gb0czTIjHcwTZNVDLRevBkG7sJu/KAIB4HQFFQ1tJmz 9t7SuTdPYEM1i7ihew679Y5TEyPNbAThxbtXTTVHwvuJLd0cnD5rq3aalC+miGuocGFC 4zwc0NmSzsivVHVGiUdE5InVxX5Eih1tLoRMCCdk18M0UHL2+SaYI8KGsSCFyjH4x8vx crSKDlFMUGgxyjeNCAxwZF3cFMkZ/i5yf3zeWax2LxSwFYjdNGqqerE5Se6RT+BL4frj PhBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=trt0jheK; 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=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch12-20020a0564021bcc00b004630d0c280esi12003044edb.539.2022.11.15.10.12.42; Tue, 15 Nov 2022 10:13:06 -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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=trt0jheK; 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=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231968AbiKORn2 (ORCPT + 91 others); Tue, 15 Nov 2022 12:43:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiKORn0 (ORCPT ); Tue, 15 Nov 2022 12:43:26 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED09BF2; Tue, 15 Nov 2022 09:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=EjU9bcCXjwveYmZh/YpPwg4A3p0yA659OLTANrMlLc0=; b=trt0jheKKFxW3nR60Ke+vo6T9d 1aQcpfJi7ZMCpc2GGJPQeJOyUzoAGTRPZLNLP6JUkh9d12s/2LkzvYwgfs6yMr56JEWiqDntwhqQu CW2DUmXd77xmhJq4gHizQ6GIqsXJbj8ZKa1vp8N6CriMPY5pNHEvoEf03h2jfqGEbdWc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ouzxh-002TzB-U1; Tue, 15 Nov 2022 18:43:05 +0100 Date: Tue, 15 Nov 2022 18:43:05 +0100 From: Andrew Lunn To: Shenwei Wang Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Alexei Starovoitov , Daniel Borkmann , John Fastabend , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "imx@lists.linux.dev" Subject: Re: [EXT] Re: [PATCH v4 1/2] net: page_pool: export page_pool_stats definition Message-ID: References: <20221115155744.193789-1-shenwei.wang@nxp.com> <20221115155744.193789-2-shenwei.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 > > I agree the API is broken, but i think there is a better fix. > > > > There should be a stub of page_pool_get_stats() for when > > CONFIG_PAGE_POOL_STATS is disabled. > > > > Nothing actually dereferences struct page_pool_stats when you have this stub. > > So it might be enough to simply have > > > > struct page_pool_stats{ > > }; > > > > As the structure is open when the CONFIG_PAGE_POOL_STATS is enabled, you can not > prevent a user to access its members. The empty stub will still have problems in this > kind of situations. The users, i.e. the driver, has no need to access its members. The members can change, new ones can be added, and it will not cause a problem, given the way this API is defined. Ideally, page_pool_stats would of been an opaque cookie, but that is not how it was implemented :-( Andrew