From: Yajun Deng <yajun.deng@linux.dev>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
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
Subject: Re: [PATCH] net/core: Export dev_core_stats_rx_dropped_inc sets
Date: Thu, 14 Sep 2023 10:44:14 +0800 [thread overview]
Message-ID: <dfe6cf9b-7cf9-f938-8ab1-a2d4c7741c64@linux.dev> (raw)
In-Reply-To: <e6de7c0b-97cc-090e-a331-dc566019f54e@intel.com>
On 2023/9/13 17:58, Alexander Lobakin wrote:
> From: Yajun Deng <yajun.deng@linux.dev>
> Date: Wed, 13 Sep 2023 10:08:08 +0800
>
>> On 2023/9/13 00:22, Alexander Lobakin wrote:
>>> From: Yajun Deng <yajun.deng@linux.dev>
>>> 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
next prev parent reply other threads:[~2023-09-14 2:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 8:20 [PATCH] net/core: Export dev_core_stats_rx_dropped_inc sets Yajun Deng
2023-09-11 16:15 ` Stephen Hemminger
2023-09-12 1:42 ` Yajun Deng
2023-09-12 4:23 ` Eric Dumazet
2023-09-12 15:57 ` Alexander Lobakin
2023-09-12 16:04 ` Eric Dumazet
2023-09-12 17:15 ` Alexander Lobakin
2023-09-12 17:28 ` Eric Dumazet
2023-09-12 17:43 ` Alexander Lobakin
2023-09-12 18:03 ` Eric Dumazet
2023-09-12 18:05 ` Eric Dumazet
2023-09-13 2:20 ` Yajun Deng
2023-09-12 16:22 ` Alexander Lobakin
[not found] ` <599cdff8-4865-3ade-0439-36e337891ca0@linux.dev>
2023-09-13 9:58 ` Alexander Lobakin
2023-09-14 2:44 ` Yajun Deng [this message]
2023-09-14 14:10 ` Alexander Lobakin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfe6cf9b-7cf9-f938-8ab1-a2d4c7741c64@linux.dev \
--to=yajun.deng@linux.dev \
--cc=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox