Received: by 2002:ac8:760c:0:b0:40f:fb00:664b with SMTP id t12csp921409qtq; Thu, 14 Sep 2023 22:29:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEcWenEQwBBoNvQLT4iN/aRdwSTTYML/M2UTOffowMU86TqpTI2fwV4x3YcturdBMo0Vxi X-Received: by 2002:a17:902:db10:b0:1c0:cbaf:6939 with SMTP id m16-20020a170902db1000b001c0cbaf6939mr727024plx.3.1694755797226; Thu, 14 Sep 2023 22:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694755797; cv=none; d=google.com; s=arc-20160816; b=xKxgxFB4xwUpLbpldkZYNxtdYTb+y/zkNT57cGNA09d+XWtuuR2cJjM69161y3brIN uWp2gnLwIxYtGcrypnjTbdypwtFvw2aYw4UU5lq+BLT5i6HMypvFmGVgeXk5maPdfxnx NWRR33lmvxowNiboJoaPyHjpKYBAUL5qKjmNrLTqKSPcFGCmyWzXQAklioPEwaes7efp mOHyA37Hrq6eU2fZuej2/v2LJu+KPpmAyYxF8pggguPU534pTMRS0itT2u7d5Cb0UrNI kuwxSmonMadtyaBwXAqltx+e9z3esuPBVQR2qKDc8IkhUtso+7TtWYbZNVeEgNvXcER4 t7Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=BGWpTABKSaIW7hxP7IMITxALKfibGVZu4WYwg1dXZeI=; fh=wQNt9bRhne1/1AmRKB6ZogxbjFMpR3QaJNXH1W6vMz8=; b=uro/n0MZk1BYcTz2NEp3NeZdrGGJZYKSm5NR8Bt3w+7HXq5ss+bl0GN/lCJ9jQ0of3 YqbGWMIlpSRHgJ58BW8cEZBlH30yv4YmgD6UZCqXXsTfM5+8IeWloBl4IAEMMEGm2RFv wDWAPiFwzTWHnsEcgNvXe/xgePIBzBANHOFW5OxCyOaVwWt+pDYLR3niZb36Hj1Am0H0 4g7jyjKeHi10yrHeOyXwTkhRt1/JBDfrFMl5xdZiY+orVUwsIl2o7FFsGlHzlthLPuCn lTkzItFSW2leffs4LcDpeQqnr/Dl2SiXLckgbxw6p09dXr/1PDwNg+Qpc/NqWIPCyOoY NyyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=VxedqEWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p12-20020a170902c70c00b001b8b7460620si2734149plp.181.2023.09.14.22.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 22:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=VxedqEWv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1BE0A81352B0; Wed, 13 Sep 2023 19:44:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233483AbjINCoa (ORCPT + 99 others); Wed, 13 Sep 2023 22:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbjINCo2 (ORCPT ); Wed, 13 Sep 2023 22:44:28 -0400 Received: from out-211.mta1.migadu.com (out-211.mta1.migadu.com [95.215.58.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97B810C3 for ; Wed, 13 Sep 2023 19:44:24 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1694659462; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BGWpTABKSaIW7hxP7IMITxALKfibGVZu4WYwg1dXZeI=; b=VxedqEWv4RYa3FnYvC2tK0gFvXFn5F1XNkpgw8TENyAlN9OvCmiRqCY9RseoMg17HIjNHD v7yuJel2dSFX42c0Pb5yeIOinuB1Yk00sOqiGC9WzsvqMTUKLrVXZ1VWUHI7icKsuHY4qk uKwaJUAMCjHhIgtf/Nz5KqE0FiBo0vc= Date: Thu, 14 Sep 2023 10:44:14 +0800 MIME-Version: 1.0 Subject: Re: [PATCH] net/core: Export dev_core_stats_rx_dropped_inc sets Content-Language: en-US To: Alexander Lobakin Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230911082016.3694700-1-yajun.deng@linux.dev> <9a1de9b3-b3cf-d26b-388e-c98294580bca@intel.com> <599cdff8-4865-3ade-0439-36e337891ca0@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yajun Deng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 19:44:30 -0700 (PDT) On 2023/9/13 17:58, Alexander Lobakin wrote: > From: Yajun Deng > Date: Wed, 13 Sep 2023 10:08:08 +0800 > >> On 2023/9/13 00:22, Alexander Lobakin wrote: >>> From: Yajun Deng >>> Date: Mon, 11 Sep 2023 16:20:16 +0800 > [...] > >>> EXPORT_SYMBOL_GPL(dev_core_stats_inc); // Why not GPL BTW? >> This may be a better option. >> >> Just because EXPORT_SYMBOL(netdev_core_stats_alloc) before,  but I think >> >> EXPORT_SYMBOL_GPL is better. > Ah I see. BTW, if you will still define increment functions as > externals, there will be no reason to export netdev_core_stats_alloc() > or even make it non-static at all. > >> >>> And then build inlines: >>> >>> #define DEV_CORE_STATS_INC(FIELD) \ >>> static inline void \ >>> dev_core_stats_##FIELD##_inc(struct net_device *dev) \ >>> { \ >>> dev_core_stats_inc(dev, \ >>> offsetof(struct net_device_core_stats, FIELD)); \ >>> } >>> >>> DEV_CORE_STATS_INC(rx_dropped); >>> ... >>> >>> OR even just make them macros >>> >>> #define __DEV_CORE_STATS_INC(dev, field) \ >>> dev_core_stats_inc(dev, \ >>> offsetof(struct net_device_core_stats, field)) >>> >>> #define dev_core_stats_rx_dropped_inc(dev) \ >>> __DEV_CORE_STATS_INC(dev, rx_dropped) >>> ... >> I would like the former.  Keep it the same as before. > By "the former" you mean to build static inlines or externals? Seems > like the first one, but I got confused by your "the same as before" :D > >> >>> Just don't copy that awful Thunderbird's line wrap and don't assume this >>> code builds and works and that is something finished/polished. >>> >>> You'll be able to trace functions and you'll be able to understand which >>> counter has been incremented by checking the second argument, i.e. the >>> field offset (IIRC tracing shows you arguments). >>> And that way you wouldn't geometrically increase the number of symbol >>> exports and deal with its consequences. >> I agree that. > Ok, after this one I guess you meant "I'd like to use your approach with > static inlines". Finally, I give up this approach. The new function dev_core_stats_inc() didn't called by external modules directly. So EXPORT_SYMBOL_GPL(dev_core_stats_inc) can be removed by anyone. >>>> >>>> /** >>>> * dev_get_stats - get network device statistics >>> Thanks, >>> Olek > Thanks, > Olek