Skip to contentSkip to conversation

Move airoha in a dedicated folder

DISCUSSION Lorenzo Bianconi 4 participants 8 messages Feb 1, 2025 – Feb 4, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

Since more features are on the way for airoha_eth driver (support for flowtable hw offloading, 10g phy support, ..), I was wondering if it is neater to move the driver in a dedicated folder (e.g. drivers/net/ethernet/airoha or drivers/net/ethernet/mediatek/airoha) or if you prefer to keep current approach. Thanks.

Regards,
Lorenzo

#1 lore raw
Quoted 7 lines · Lorenzo Bianconi

Hi all,

Since more features are on the way for airoha_eth driver (support for flowtable hw offloading, 10g phy support, ..), I was wondering if it is neater to move the driver in a dedicated folder (e.g. drivers/net/ethernet/airoha or drivers/net/ethernet/mediatek/airoha) or if you prefer to keep current approach. Thanks.

Hi Lorenzo

Moving it into a subdirectoruy of mediatek is fine. Maybe also consider moving mtk_eth and mtk_wed into subdirectories.

Andrew

reviewer
#2 lore raw
In reply to Lorenzo Bianconi
Quoted 7 lines · Lorenzo Bianconi

Hi all,

Since more features are on the way for airoha_eth driver (support for flowtable hw offloading, 10g phy support, ..), I was wondering if it is neater to move the driver in a dedicated folder (e.g. drivers/net/ethernet/airoha or drivers/net/ethernet/mediatek/airoha) or if you prefer to keep current approach. Thanks.

<2c>

Hi Lorenzo,

There already seem drivers to be drivers under drivers/net/ethernet/mediatek/ which are built from more than once .c file. So I think it is fine to leave Airoha's source there. But, OTOH, I do think it would
be neater to move it into it's own directory. Which is to say,
I for one am happy either way.

If you do chose to go for a new directory, I would suggest drivers/net/ethernet/mediatek/airoha assuming as it is a Mediatek device.

</2c>

#3 lore raw

Il giorno sab 1 feb 2025 alle ore 16:50 Simon Horman <[email protected]> ha scritto:

Quoted 14 lines · Lorenzo Bianconi
Quoted 7 lines

Hi all,

Since more features are on the way for airoha_eth driver (support for flowtable hw offloading, 10g phy support, ..), I was wondering if it is neater to move the driver in a dedicated folder (e.g. drivers/net/ethernet/airoha or drivers/net/ethernet/mediatek/airoha) or if you prefer to keep current approach. Thanks.

<2c>

Hi Lorenzo,

Quoted 9 lines

There already seem drivers to be drivers under drivers/net/ethernet/mediatek/ which are built from more than once .c file. So I think it is fine to leave Airoha's source there. But, OTOH, I do think it would
be neater to move it into it's own directory. Which is to say,
I for one am happy either way.

If you do chose to go for a new directory, I would suggest drivers/net/ethernet/mediatek/airoha assuming as it is a Mediatek device.

Hi,
may I push for a dedicated Airoha directory? (/net/ethernet/airoha ?)

With new SoC it seems Airoha is progressively detaching from Mediatek.

There are some similarities but for example for the PPE only the logical entry table is similar but rest of the stuff is handled by a coprocessor with dedicated
firmware. My big concern is that we will start to bloat the mediatek directory with very different kind of code.

Putting stuff in ethernet/mediatek/airoha would imply starting to use format like
#include "../stuff.h" and maybe we would start to import stuff from mediatek that
should not be used by airoha.

Keeping the 2 thing split might make the similarities even more evident and easier
to handle as we will have to rework the header to use the generic include/linux.

Hope all of this makes sense, it's really to prevent situation and keep things organized from the start.

#4 lore raw
Quoted 4 lines

Hi,
may I push for a dedicated Airoha directory? (/net/ethernet/airoha ?)

With new SoC it seems Airoha is progressively detaching from Mediatek.

The vendor name is actually not very relevant. Linux has a much longer life than most vendors. Assets get bought and sold, but they keep the same name in Linux simply to make Maintenance simpler. FEC has not been part of Freescale for a long time. Microsemi and micrel are part of microchip, but we still call them microsemi and micrel, because who knows, microchip might soon be eaten by somebody bigger, or broken up?

Quoted 3 lines

Putting stuff in ethernet/mediatek/airoha would imply starting to use format like #include "../stuff.h" and maybe we would start to import stuff from mediatek that should not be used by airoha.

obj-$(CONFIG_NET_AIROHA) += airoha_eth.o

#include <linux/etherdevice.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
#include <net/dsa.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <uapi/linux/ppp_defs.h>

I don't see anything being shared. Maybe that is just because those features are not implemented yet? But if there is sharing, we do want code to be shared, rather than copy/paste bugs and code between drivers.

Maybe drivers/net/ethernet/wangxun is a good model to follow, although i might put the headers in include/linux/net/mediatek rather than do relative #includes.

Andrew

#5 lore raw

Il giorno dom 2 feb 2025 alle ore 17:49 Andrew Lunn <[email protected]> ha scritto:

Quoted 4 lines
Quoted 4 lines

Hi,
may I push for a dedicated Airoha directory? (/net/ethernet/airoha ?)

Quoted 9 lines
Quoted 1 line

With new SoC it seems Airoha is progressively detaching from Mediatek.

The vendor name is actually not very relevant. Linux has a much longer life than most vendors. Assets get bought and sold, but they keep the same name in Linux simply to make Maintenance simpler. FEC has not been part of Freescale for a long time. Microsemi and micrel are part of microchip, but we still call them microsemi and micrel, because who knows, microchip might soon be eaten by somebody bigger, or broken up?

Yep, with detaching I mean more with the fact that it seems they are stopping reusing Mediatek as a base for new HW.
Aka code sharing and registers are getting very different or no similarities at all.

Quoted 21 lines
Quoted 3 lines

Putting stuff in ethernet/mediatek/airoha would imply starting to use format like #include "../stuff.h" and maybe we would start to import stuff from mediatek that should not be used by airoha.

obj-$(CONFIG_NET_AIROHA) += airoha_eth.o

#include <linux/etherdevice.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
#include <net/dsa.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <uapi/linux/ppp_defs.h>

Quoted 4 lines

I don't see anything being shared. Maybe that is just because those features are not implemented yet? But if there is sharing, we do want code to be shared, rather than copy/paste bugs and code between drivers.

Yes this is really to understand how to move for the next drivers submission. It's mainly about PPE and firmware loading. Airoha_eth got quite big already and the code got split in multiple drivers. Also the header is planned to be split in a dedicated airoha_regs header.

Quoted 5 lines

Maybe drivers/net/ethernet/wangxun is a good model to follow, although i might put the headers in include/linux/net/mediatek rather than do relative #includes.

I personally prefer include/linux than relative includes, so if everyone is ok with that I would choose that path.

Again this is really to better organize and understand how to move with the new code. Thanks for the suggestions as always.

#6 lore raw
In reply to Andrew Lunn
Quoted 33 lines
Quoted 4 lines

Hi,
may I push for a dedicated Airoha directory? (/net/ethernet/airoha ?)

With new SoC it seems Airoha is progressively detaching from Mediatek.

The vendor name is actually not very relevant. Linux has a much longer life than most vendors. Assets get bought and sold, but they keep the same name in Linux simply to make Maintenance simpler. FEC has not been part of Freescale for a long time. Microsemi and micrel are part of microchip, but we still call them microsemi and micrel, because who knows, microchip might soon be eaten by somebody bigger, or broken up?

Quoted 3 lines

Putting stuff in ethernet/mediatek/airoha would imply starting to use format like #include "../stuff.h" and maybe we would start to import stuff from mediatek that should not be used by airoha.

obj-$(CONFIG_NET_AIROHA) += airoha_eth.o

#include <linux/etherdevice.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/tcp.h>
#include <linux/u64_stats_sync.h>
#include <net/dsa.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <uapi/linux/ppp_defs.h>

Quoted 8 lines

I don't see anything being shared. Maybe that is just because those features are not implemented yet? But if there is sharing, we do want code to be shared, rather than copy/paste bugs and code between drivers.

Maybe drivers/net/ethernet/wangxun is a good model to follow, although i might put the headers in include/linux/net/mediatek rather than do relative #includes.

I do not think we can reuse many code from MTK codebase since, even if the Packet Switch Engine (PSE)/Packet Processor Engine (PPE) architecture is similar to MTK one (you can find a diagram here [0]), Airoha SoC runs a NPU to configure the PPE module and we can't access the hw directly as we do for MTK. Moreover, the PPE entry layout is slightly different and we could reuse just some MTK definitions. For these reasons I guess it does not worth to have a structure similar to wangxun's one (lib + hw specific code), maybe just move the driver in a dedicated folder? (e.g. drivers/net/ethernet/airoha)

Regards,
Lorenzo

[0] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=23020f04932701d5c8363e60756f12b43b8ed752

Quoted 2 lines

Andrew

reviewer
#7 lore raw
In reply to Christian Marangi (Ansuel)
Quoted 43 lines · Christian Marangi (Ansuel)

Il giorno sab 1 feb 2025 alle ore 16:50 Simon Horman <[email protected]> ha scritto:

Quoted 14 lines · Lorenzo Bianconi
Quoted 7 lines

Hi all,

Since more features are on the way for airoha_eth driver (support for flowtable hw offloading, 10g phy support, ..), I was wondering if it is neater to move the driver in a dedicated folder (e.g. drivers/net/ethernet/airoha or drivers/net/ethernet/mediatek/airoha) or if you prefer to keep current approach. Thanks.

<2c>

Hi Lorenzo,

Quoted 9 lines

There already seem drivers to be drivers under drivers/net/ethernet/mediatek/ which are built from more than once .c file. So I think it is fine to leave Airoha's source there. But, OTOH, I do think it would
be neater to move it into it's own directory. Which is to say,
I for one am happy either way.

If you do chose to go for a new directory, I would suggest drivers/net/ethernet/mediatek/airoha assuming as it is a Mediatek device.

Hi,
may I push for a dedicated Airoha directory? (/net/ethernet/airoha ?)

With new SoC it seems Airoha is progressively detaching from Mediatek.

There are some similarities but for example for the PPE only the logical entry table is similar but rest of the stuff is handled by a coprocessor with dedicated
firmware. My big concern is that we will start to bloat the mediatek directory with very different kind of code.

Putting stuff in ethernet/mediatek/airoha would imply starting to use format like
#include "../stuff.h" and maybe we would start to import stuff from mediatek that
should not be used by airoha.

Quoted 6 lines

Keeping the 2 thing split might make the similarities even more evident and easier
to handle as we will have to rework the header to use the generic include/linux.

Hope all of this makes sense, it's really to prevent situation and keep things organized from the start.

Thanks Christian,

Given the above and the conversation thus far elsewhere in this thread I now agree that drivers/net/ethernet/airoha is a good option.