Skip to content

Commit f68eefa

Browse files
keviniorkartben
authored andcommitted
drivers: ethernet: eth_stm32_hal: fix API_V2 multicast
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 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 <kevin.orourke@ferroamp.se>
1 parent 22e65b6 commit f68eefa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/ethernet/eth_stm32_hal.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,10 +967,8 @@ static int eth_initialize(const struct device *dev)
967967
&dma_tx_buffer[0][0], ETH_TXBUFNB);
968968
HAL_ETH_DMARxDescListInit(heth, dma_rx_desc_tab,
969969
&dma_rx_buffer[0][0], ETH_RXBUFNB);
970-
#endif /* !CONFIG_ETH_STM32_HAL_API_V1 */
971-
972-
setup_mac_filter(heth);
973970

971+
#endif /* !CONFIG_ETH_STM32_HAL_API_V1 */
974972

975973
LOG_DBG("MAC %02x:%02x:%02x:%02x:%02x:%02x",
976974
dev_data->mac_addr[0], dev_data->mac_addr[1],
@@ -1194,6 +1192,7 @@ static void eth_iface_init(struct net_if *iface)
11941192
const struct device *dev;
11951193
struct eth_stm32_hal_dev_data *dev_data;
11961194
bool is_first_init = false;
1195+
ETH_HandleTypeDef *heth;
11971196

11981197
__ASSERT_NO_MSG(iface != NULL);
11991198

@@ -1203,6 +1202,9 @@ static void eth_iface_init(struct net_if *iface)
12031202
dev_data = dev->data;
12041203
__ASSERT_NO_MSG(dev_data != NULL);
12051204

1205+
heth = &dev_data->heth;
1206+
__ASSERT_NO_MSG(heth != NULL);
1207+
12061208
if (dev_data->iface == NULL) {
12071209
dev_data->iface = iface;
12081210
is_first_init = true;
@@ -1227,6 +1229,8 @@ static void eth_iface_init(struct net_if *iface)
12271229
eth_init_api_v2(dev);
12281230
#endif
12291231

1232+
setup_mac_filter(heth);
1233+
12301234
net_if_carrier_off(iface);
12311235

12321236
net_lldp_set_lldpdu(iface);

0 commit comments

Comments
 (0)