mbox series

[net-next,v8,0/4] ethtool: provide the dim profile fine-tuning channel

Message ID 20240416122950.39046-1-hengqi@linux.alibaba.com (mailing list archive)
Headers show
Series ethtool: provide the dim profile fine-tuning channel | expand

Message

Heng Qi April 16, 2024, 12:29 p.m. UTC
The NetDIM library provides excellent acceleration for many modern
network cards. However, the default profiles of DIM limits its maximum
capabilities for different NICs, so providing a way which the NIC can
be custom configured is necessary.

Currently, interaction with the driver is still based on the commonly
used "ethtool -C".

Since the profile now exists in netdevice, adding a function similar
to net_dim_get_rx_moderation_dev() with netdevice as argument is
nice, but this would be better along with cleaning up the rest of
the drivers, which we can get to very soon after this set.

Please review, thank you very much!

Changelog
=====
v7->v8:
  - Use kmemdup() instead of kzalloc()/memcpy() in dev_dim_profile_init().

v6->v7:
  - A new wrapper struct pointer is used in struct net_device.
  - Add IS_ENABLED(CONFIG_DIMLIB) to avoid compiler warnings.
  - Profile fields changed from u16 to u32.

v5->v6:
  - Place the profile in netdevice to bypass the driver.
    The interaction code of ethtool <-> kernel has not changed at all,
    only the interaction part of kernel <-> driver has changed.

v4->v5:
  - Update some snippets from Kuba, Thanks.

v3->v4:
  - Some tiny updates and patch 1 only add a new comment.

v2->v3:
  - Break up the attributes to avoid the use of raw c structs.
  - Use per-device profile instead of global profile in the driver.

v1->v2:
  - Use ethtool tool instead of net-sysfs

Heng Qi (4):
  linux/dim: move useful macros to .h file
  ethtool: provide customized dim profile management
  virtio-net: refactor dim initialization/destruction
  virtio-net: support dim profile fine-tuning

 Documentation/netlink/specs/ethtool.yaml     |  33 +++
 Documentation/networking/ethtool-netlink.rst |   8 +
 drivers/net/virtio_net.c                     |  46 +++--
 include/linux/dim.h                          |  13 ++
 include/linux/ethtool.h                      |  11 +-
 include/linux/netdevice.h                    |  24 +++
 include/uapi/linux/ethtool_netlink.h         |  24 +++
 lib/dim/net_dim.c                            |  10 +-
 net/core/dev.c                               |  79 ++++++++
 net/ethtool/coalesce.c                       | 201 ++++++++++++++++++-
 10 files changed, 426 insertions(+), 23 deletions(-)

Comments

Jakub Kicinski April 17, 2024, 12:38 a.m. UTC | #1
On Tue, 16 Apr 2024 20:29:46 +0800 Heng Qi wrote:
> Please review, thank you very much!

Please stop posting code which does not compile.
The mailing list is for reviewing code, not build testing it.
Heng Qi April 17, 2024, 2:22 a.m. UTC | #2
在 2024/4/17 上午8:38, Jakub Kicinski 写道:
> On Tue, 16 Apr 2024 20:29:46 +0800 Heng Qi wrote:
>> Please review, thank you very much!
> Please stop posting code which does not compile.
> The mailing list is for reviewing code, not build testing it.

Sorry, three versions v7, RESEND v7, v8 in two days, this may have 
caused a mess.
RESEND v7 has addressed possible bot warnings, and v8 is a fix for 
Simon's comment.

Have you encountered compilation problems in v8?

Anyway, I'll bide my time on v8 to avoid another mess. ^^

Thanks.
Jakub Kicinski April 17, 2024, 2:29 a.m. UTC | #3
On Wed, 17 Apr 2024 10:22:52 +0800 Heng Qi wrote:
> Have you encountered compilation problems in v8?

Yes, please try building allmodconfig:

make allmodconfig
make ..

there's many drivers using this API, you gotta build the full kernel..
Jason Xing April 17, 2024, 2:53 a.m. UTC | #4
Hello Jakub,

On Wed, Apr 17, 2024 at 10:30 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed, 17 Apr 2024 10:22:52 +0800 Heng Qi wrote:
> > Have you encountered compilation problems in v8?
>
> Yes, please try building allmodconfig:
>
> make allmodconfig
> make ..
>
> there's many drivers using this API, you gotta build the full kernel..
>

About compiling the kernel, I would like to ask one question: what
parameters of 'make' do you recommend just like the netdev/build_32bit
[1] does?

If I run the normal 'make' command without parameters, there is no
warning even if the file is not compiled. If running with '-Oline -j
16 W=1 C=1', it will print lots of warnings which makes it very hard
to see the useful information related to the commits I just wrote.

I want to build and then print all the warnings which are only related
to my patches locally, but I cannot find a good way :(

[1]: https://netdev.bots.linux.dev/static/nipa/845020/13631720/build_32bit/stderr

Thanks,
Jason
Heng Qi April 17, 2024, 6:35 a.m. UTC | #5
在 2024/4/17 上午10:53, Jason Xing 写道:
> Hello Jakub,
>
> On Wed, Apr 17, 2024 at 10:30 AM Jakub Kicinski <kuba@kernel.org> wrote:
>> On Wed, 17 Apr 2024 10:22:52 +0800 Heng Qi wrote:
>>> Have you encountered compilation problems in v8?
>> Yes, please try building allmodconfig:
>>
>> make allmodconfig
>> make ..
>>
>> there's many drivers using this API, you gotta build the full kernel..
>>
> About compiling the kernel, I would like to ask one question: what
> parameters of 'make' do you recommend just like the netdev/build_32bit
> [1] does?

Hi Jason,

I founded and checked the use of nipa[1] made from Kuba today. I used 
run.sh in the ./nipa/docker
directory locally to run full compilation.
If there are additional errors or warnings after applying our own 
patches than before, we will be given
information in the results directory.

[1] https://github.com/linux-netdev/nipa/tree/main

Thanks.

>
> If I run the normal 'make' command without parameters, there is no
> warning even if the file is not compiled. If running with '-Oline -j
> 16 W=1 C=1', it will print lots of warnings which makes it very hard
> to see the useful information related to the commits I just wrote.
>
> I want to build and then print all the warnings which are only related
> to my patches locally, but I cannot find a good way :(
>
> [1]: https://netdev.bots.linux.dev/static/nipa/845020/13631720/build_32bit/stderr
>
> Thanks,
> Jason
Jason Xing April 17, 2024, 6:52 a.m. UTC | #6
On Wed, Apr 17, 2024 at 2:35 PM Heng Qi <hengqi@linux.alibaba.com> wrote:
>
>
>
> 在 2024/4/17 上午10:53, Jason Xing 写道:
> > Hello Jakub,
> >
> > On Wed, Apr 17, 2024 at 10:30 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >> On Wed, 17 Apr 2024 10:22:52 +0800 Heng Qi wrote:
> >>> Have you encountered compilation problems in v8?
> >> Yes, please try building allmodconfig:
> >>
> >> make allmodconfig
> >> make ..
> >>
> >> there's many drivers using this API, you gotta build the full kernel..
> >>
> > About compiling the kernel, I would like to ask one question: what
> > parameters of 'make' do you recommend just like the netdev/build_32bit
> > [1] does?
>
> Hi Jason,
>
> I founded and checked the use of nipa[1] made from Kuba today. I used
> run.sh in the ./nipa/docker
> directory locally to run full compilation.
> If there are additional errors or warnings after applying our own
> patches than before, we will be given
> information in the results directory.
>
> [1] https://github.com/linux-netdev/nipa/tree/main

Great! Thanks for the information:) I'll try it locally.

Thanks,
Jason

>
> Thanks.
>
> >
> > If I run the normal 'make' command without parameters, there is no
> > warning even if the file is not compiled. If running with '-Oline -j
> > 16 W=1 C=1', it will print lots of warnings which makes it very hard
> > to see the useful information related to the commits I just wrote.
> >
> > I want to build and then print all the warnings which are only related
> > to my patches locally, but I cannot find a good way :(
> >
> > [1]: https://netdev.bots.linux.dev/static/nipa/845020/13631720/build_32bit/stderr
> >
> > Thanks,
> > Jason
>
Heng Qi April 17, 2024, 8:04 a.m. UTC | #7
在 2024/4/17 下午2:52, Jason Xing 写道:
> On Wed, Apr 17, 2024 at 2:35 PM Heng Qi <hengqi@linux.alibaba.com> wrote:
>>
>>
>> 在 2024/4/17 上午10:53, Jason Xing 写道:
>>> Hello Jakub,
>>>
>>> On Wed, Apr 17, 2024 at 10:30 AM Jakub Kicinski <kuba@kernel.org> wrote:
>>>> On Wed, 17 Apr 2024 10:22:52 +0800 Heng Qi wrote:
>>>>> Have you encountered compilation problems in v8?
>>>> Yes, please try building allmodconfig:
>>>>
>>>> make allmodconfig
>>>> make ..
>>>>
>>>> there's many drivers using this API, you gotta build the full kernel..
>>>>
>>> About compiling the kernel, I would like to ask one question: what
>>> parameters of 'make' do you recommend just like the netdev/build_32bit
>>> [1] does?
>> Hi Jason,
>>
>> I founded and checked the use of nipa[1] made from Kuba today. I used
>> run.sh in the ./nipa/docker
>> directory locally to run full compilation.
>> If there are additional errors or warnings after applying our own
>> patches than before, we will be given
>> information in the results directory.
>>
>> [1] https://github.com/linux-netdev/nipa/tree/main
> Great! Thanks for the information:) I'll try it locally.

To update more information, I checked the source code of nipa.
All its test items are located at:

   1. nipa/tests/patch, such as build_32bit, build_allmodconfig_war
   2. nipa/tests/series, such as fixes_present

We can edit the "include" and "exclude" items of [tests] section
in the nipa/docker/nipa.config file to specify the specific items we 
want to test.

Regards,
Heng

>
> Thanks,
> Jason
>
>> Thanks.
>>
>>> If I run the normal 'make' command without parameters, there is no
>>> warning even if the file is not compiled. If running with '-Oline -j
>>> 16 W=1 C=1', it will print lots of warnings which makes it very hard
>>> to see the useful information related to the commits I just wrote.
>>>
>>> I want to build and then print all the warnings which are only related
>>> to my patches locally, but I cannot find a good way :(
>>>
>>> [1]: https://netdev.bots.linux.dev/static/nipa/845020/13631720/build_32bit/stderr
>>>
>>> Thanks,
>>> Jason