-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: ethernet: eth_stm32_hal: fix API_V2 multicast #88361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I experience the multicast problem on main on an stm32h573i_dk.
I have the intention to test this patch. Thank you for it.
drivers/ethernet/eth_stm32_hal.c
Outdated
| return -EINVAL; | ||
| } | ||
|
|
||
| setup_mac_filter(heth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this not result in calling it twice on api v1 devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eth_init_api_v2() is only called on API_V2 devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
how about moving |
Seems like it would make it a bit neater, yes. |
Except |
I had the same thought. It is not clear to me, why |
I traced the call to the api init. Its here zephyr/subsys/net/ip/net_core.c Line 647 in d0fdd38
Calls go through |
|
I tested the patch in this state including: diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c
index 1ec5bb1f05a..bec5dae50ac 100644
--- a/drivers/ethernet/eth_stm32_hal.c
+++ b/drivers/ethernet/eth_stm32_hal.c
@@ -1192,6 +1192,7 @@ static void eth_iface_init(struct net_if *iface)
const struct device *dev;
struct eth_stm32_hal_dev_data *dev_data;
bool is_first_init = false;
+ ETH_HandleTypeDef *heth;
__ASSERT_NO_MSG(iface != NULL);
@@ -1201,6 +1202,9 @@ static void eth_iface_init(struct net_if *iface)
dev_data = dev->data;
__ASSERT_NO_MSG(dev_data != NULL);
+ heth = &dev_data->heth;
+ __ASSERT_NO_MSG(heth != NULL);
+
if (dev_data->iface == NULL) {
dev_data->iface = iface;
is_first_init = true;Which solved the problem for me. |
FYI @kevinior : undefined |
|
@clamattia
Thanks, I'll fix it in the morning. |
|
Rebased onto latest main to force a CI re-run, since this unrelated test had failed. |
|
Could we get another (relevant, mine unfortunately not :) ) review on this? |
It needs assignee approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update the commit message
Otherwise LGTM
After API_V2 auto-negotiation support was added by zephyrproject-rtos#86621 setup_mac_filter() was called before HAL_ETH_Init(), which resulted in received multicast packets being discarded. This moves the call to setup_mac_filter() to eth_iface_init(), after HAL_ETH_Init() for both API_V1 and API_V2. I've verified the problem and tested the fix on a Nucleo-H563ZI with a simple application that just starts up and makes an mDNS query (which depends on working multicast). Signed-off-by: Kevin ORourke <[email protected]>
Is the commit message OK now? |
After API_V2 auto-negotiation support was added by #86621 setup_mac_filter() was called before HAL_ETH_Init(), which resulted in received multicast packets being discarded.
This removes that call to setup_mac_filter() when API_V2 in enabled and calls it from eth_init_api_v2() instead, after HAL_ETH_Init().
I've verified the problem and tested the fix on a Nucleo-H563ZI with a simple application that just starts up and makes an mDNS query (which depends on working multicast).