Skip to content

Commit c47c411

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 a7e63d5 commit c47c411

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/ethernet/eth_xmc4xxx.c

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

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

@@ -925,6 +929,20 @@ static int eth_xmc4xxx_set_config(const struct device *dev, enum ethernet_config
925929
net_if_set_link_addr(dev_data->iface, dev_data->mac_addr,
926930
sizeof(dev_data->mac_addr), NET_LINK_ETHERNET);
927931
return 0;
932+
#if defined(CONFIG_NET_PROMISCUOUS_MODE)
933+
case ETHERNET_CONFIG_TYPE_PROMISC_MODE: {
934+
uint32_t reg = dev_cfg->regs->MAC_FRAME_FILTER;
935+
936+
if (config->promisc_mode) {
937+
reg |= ETH_MAC_FRAME_FILTER_PR_Msk;
938+
} else {
939+
reg &= ~ETH_MAC_FRAME_FILTER_PR_Msk;
940+
}
941+
dev_cfg->regs->MAC_FRAME_FILTER = reg;
942+
943+
return 0;
944+
}
945+
#endif /* CONFIG_NET_PROMISCUOUS_MODE */
928946
default:
929947
break;
930948
}

0 commit comments

Comments
 (0)