Skip to content

Commit

Permalink
drivers/atwinc15x0: handle M2M errors of m2m_wifi_enable_mac_mcast
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Aug 18, 2023
1 parent 4612e78 commit 283c206
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/atwinc15x0/atwinc15x0_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,15 @@ static int _atwinc15x0_set(netdev_t *netdev, netopt_t opt, const void *val,
assert(max_len <= sizeof(netopt_state_t));
return _set_state(dev, *((const netopt_state_t *)val));
case NETOPT_L2_GROUP:
if (m2m_wifi_enable_mac_mcast((void *)val, 1)) {
/* sometimes m2m_wifi_enable_mac_mcast() fails with M2M_ERR_MEM_ALLOC */
m2m_wifi_enable_mac_mcast((void *)val, 0);
/* sometimes it fails with M2M_ERR_BUS_FAIL */
int tries = 5;
do {
ret = m2m_wifi_enable_mac_mcast((void *)val, 1);
DEBUG_PUTS("busy loop setting L2 multicast address on atwinc15x0");
} while (--tries && ret == M2M_ERR_BUS_FAIL);
if (ret) {
return -EINVAL;
} else {
return max_len;
Expand Down

0 comments on commit 283c206

Please sign in to comment.