Skip to content

Commit c2f8f98

Browse files
silabs-SwamidasNnashif
authored andcommitted
drivers: wifi: siwx91x: Drop the loop back packets
Added a MAC-layer filter to discard frames whose source MAC address matches the devices own MAC address. These packets are looped-back frames that do not need to be processed again by the network stack. Dropping such frames early improves correctness, avoids redundant RX processing, and reduces load on the IPv4/IPv6 protocol handlers. This patch is a workaround for a bug in the NWP Signed-off-by: Swamidas Nampalli <[email protected]>
1 parent c828f5d commit c2f8f98

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/wifi/siwx91x/siwx91x_wifi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,18 @@ sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface,
267267
sl_wifi_buffer_t *buffer)
268268
{
269269
sl_si91x_packet_t *si_pkt = sl_si91x_host_get_buffer_data(buffer, 0, NULL);
270+
const struct net_eth_hdr *eth = (const struct net_eth_hdr *)si_pkt->data;
270271
struct net_if *iface = net_if_get_first_wifi();
272+
const struct net_linkaddr *ll = net_if_get_link_addr(iface);
271273
struct net_pkt *pkt;
272274
int ret;
273275

276+
/* NWP sometime echoes the Tx frames */
277+
if (memcmp(eth->src.addr, ll->addr, sizeof(eth->src.addr)) == 0) {
278+
LOG_DBG("Dropped packet (source MAC matches our MAC)");
279+
return SL_STATUS_OK;
280+
}
281+
274282
pkt = net_pkt_rx_alloc_with_buffer(iface, buffer->length, AF_UNSPEC, 0, K_NO_WAIT);
275283
if (!pkt) {
276284
LOG_ERR("net_pkt_rx_alloc_with_buffer() failed");

0 commit comments

Comments
 (0)