Skip to content

Commit a979090

Browse files
committed
drivers:ethernet: Add promiscuous mode to xmc4xxx
This patch adds promiscuos mode to the XMC4xxx SOC's ethernet driver. Signed-off-by: Marcelo Roberto Jimenez <[email protected]>
1 parent 57df5ab commit a979090

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/ethernet/eth_xmc4xxx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,10 @@ static enum ethernet_hw_caps eth_xmc4xxx_capabilities(const struct device *dev)
904904
caps |= ETHERNET_HW_VLAN;
905905
#endif
906906

907+
#if defined(CONFIG_NET_PROMISCUOUS_MODE)
908+
caps |= ETHERNET_PROMISC_MODE;
909+
#endif
910+
907911
return caps;
908912
}
909913

@@ -924,6 +928,17 @@ static int eth_xmc4xxx_set_config(const struct device *dev, enum ethernet_config
924928
net_if_set_link_addr(dev_data->iface, dev_data->mac_addr,
925929
sizeof(dev_data->mac_addr), NET_LINK_ETHERNET);
926930
return 0;
931+
#if defined(CONFIG_NET_PROMISCUOUS_MODE)
932+
case ETHERNET_CONFIG_TYPE_PROMISC_MODE:
933+
uint32_t reg = dev_cfg->regs->MAC_FRAME_FILTER;
934+
if (config->promisc_mode) {
935+
reg |= ETH_MAC_FRAME_FILTER_PR_Msk;
936+
} else {
937+
reg &= ~ETH_MAC_FRAME_FILTER_PR_Msk;
938+
}
939+
dev_cfg->regs->MAC_FRAME_FILTER = reg;
940+
return 0;
941+
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
927942
default:
928943
break;
929944
}

0 commit comments

Comments
 (0)