zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.66k stars 6.52k forks source link

Set default link address size to 8 bytes #55970

Open Hiihtaja77 opened 1 year ago

Hiihtaja77 commented 1 year ago

Hi !

https://github.com/zephyrproject-rtos/zephyr/blob/580d789cd0e923124cf81425a93e567631ba32ce/include/zephyr/net/net_linkaddr.h#L37

I have own out-of-tree device drivers and can't define your own ones:

/* Maximum length of the link address /

ifdef CONFIG_NET_L2_IEEE802154

define NET_LINK_ADDR_MAX_LENGTH 8

else

ifdef CONFIG_NET_L2_PPP

define NET_LINK_ADDR_MAX_LENGTH 8

else

define NET_LINK_ADDR_MAX_LENGTH 6

endif

endif

But I need NET_LINK_ADDR_MAX_LENGTH 8 bytes

Can default LINK address size to be set to 8 bytes or have independant configuration for avoid binding with limited set of L2 drivers.

jukkar commented 1 year ago

I would not change the default one, but you could propose a patch that allows application to define one. For example something like

diff --git a/include/zephyr/net/net_linkaddr.h b/include/zephyr/net/net_linkaddr.h
index 9e21e7dc9f..857df8f148 100644
--- a/include/zephyr/net/net_linkaddr.h
+++ b/include/zephyr/net/net_linkaddr.h
@@ -34,9 +34,11 @@ extern "C" {
 #ifdef CONFIG_NET_L2_PPP
 #define NET_LINK_ADDR_MAX_LENGTH 8
 #else
+#ifndef NET_LINK_ADDR_MAX_LENGTH
 #define NET_LINK_ADDR_MAX_LENGTH 6
 #endif
 #endif
+#endif

 /**
  * Type of the link address. This indicates the network technology that this
Hiihtaja77 commented 1 year ago

Yes I have own patch as well. But I'm implementing an out-of-tree driver/l2 radio driver CONFIG_NET_L2_XXX and looks like need to modify each zephyr release because the link address reserved max space is hard coded to the lowest value. Have it sense to improve configurability at some moment?

Hiihtaja77 commented 1 year ago

CONFIG_NET_LINK_ADDR_MAX_LENGTH ?

jukkar commented 1 year ago

If the patch I wrote few comments above is not enough, just propose a PR that adds the Kconfig option you want.

Hiihtaja77 commented 1 year ago

Overall idea is able to have support for several network interfaces with different length of link addresses. But length is used in hardcoded way https://elixir.bootlin.com/zephyr/v3.3.0/source/include/zephyr/net/net_linkaddr.h#L96 And some common solution need if several interfaces ( at list 3) with different lengths need to be used.

Hiihtaja77 commented 1 year ago

Overall idea is able to have support for several network interfaces with different length of link addresses. But length is used in hardcoded way https://elixir.bootlin.com/zephyr/v3.3.0/source/include/zephyr/net/net_linkaddr.h#L96 And some common solution need if several interfaces ( at list 3) with different lengths need to be used.

zephyrbot commented 8 months ago

Hi @rlubos, @jukkar,

This issue, marked as an Feature Request, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.

Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.

@Hiihtaja77 you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.

Thanks!