Skip to content

Commit 283c206

Browse files
committed
drivers/atwinc15x0: handle M2M errors of m2m_wifi_enable_mac_mcast
1 parent 4612e78 commit 283c206

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/atwinc15x0/atwinc15x0_netdev.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,15 @@ static int _atwinc15x0_set(netdev_t *netdev, netopt_t opt, const void *val,
768768
assert(max_len <= sizeof(netopt_state_t));
769769
return _set_state(dev, *((const netopt_state_t *)val));
770770
case NETOPT_L2_GROUP:
771-
if (m2m_wifi_enable_mac_mcast((void *)val, 1)) {
771+
/* sometimes m2m_wifi_enable_mac_mcast() fails with M2M_ERR_MEM_ALLOC */
772+
m2m_wifi_enable_mac_mcast((void *)val, 0);
773+
/* sometimes it fails with M2M_ERR_BUS_FAIL */
774+
int tries = 5;
775+
do {
776+
ret = m2m_wifi_enable_mac_mcast((void *)val, 1);
777+
DEBUG_PUTS("busy loop setting L2 multicast address on atwinc15x0");
778+
} while (--tries && ret == M2M_ERR_BUS_FAIL);
779+
if (ret) {
772780
return -EINVAL;
773781
} else {
774782
return max_len;

0 commit comments

Comments
 (0)