-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Description
Describe the bug
The NXP Ethernet driver (eth_nxp_enet.c) enables promiscuous mode during initialization when CONFIG_NET_PROMISCUOUS_MODE=y:
if (IS_ENABLED(CONFIG_NET_PROMISCUOUS_MODE)) {
enet_config.macSpecialConfig |= kENET_ControlPromiscuousEnable;
}This configuration is performed inside eth_nxp_enet_init().
However, the driver does not advertise ETHERNET_PROMISC_MODE in eth_nxp_enet_get_capabilities().
As a result, networking features that require promiscuous capability (for example, Ethernet bridge) do not work correctly because the interface does not report support for promiscuous mode, even though it is already enabled at hardware level.
This creates an inconsistency between actual hardware behavior and reported capabilities.
Expected behavior
When CONFIG_NET_PROMISCUOUS_MODE=y, the driver should:
- Advertise ETHERNET_PROMISC_MODE in eth_nxp_enet_get_capabilities()
- Accept ETHERNET_CONFIG_TYPE_PROMISC_MODE in eth_nxp_enet_set_config()
This aligns the reported capability with the existing initialization behavior.
Proposed fix
diff --git a/drivers/ethernet/eth_nxp_enet.c b/drivers/ethernet/eth_nxp_enet.c
index 0afbd15f053e..63f286a5234d 100644
--- a/drivers/ethernet/eth_nxp_enet.c
+++ b/drivers/ethernet/eth_nxp_enet.c
@@ -270,6 +270,9 @@ static enum ethernet_hw_caps eth_nxp_enet_get_capabilities(const struct device *
#if defined(CONFIG_ETH_NXP_ENET_HW_ACCELERATION)
ETHERNET_HW_TX_CHKSUM_OFFLOAD |
ETHERNET_HW_RX_CHKSUM_OFFLOAD |
+#endif
+#if defined(CONFIG_NET_PROMISCUOUS_MODE)
+ ETHERNET_PROMISC_MODE |
#endif
ETHERNET_LINK_100BASE;
@@ -312,6 +315,9 @@ static int eth_nxp_enet_set_config(const struct device *dev,
(uint8_t *)cfg->filter.mac_address.addr);
}
return 0;
+ case ETHERNET_CONFIG_TYPE_PROMISC_MODE:
+ /* Promiscuous mode is enabled during initialization */
+ return 0;
default:
break;
}
Regression
- This is a regression.
Steps to reproduce
The issue was observed on 'ubx_evk_iris_w1', but it is not board-specific and should affect any platform using this driver.
- Enable Ethernet on ubx_evk_iris_w1
Apply the following device tree patch to enable the onboard Ethernet interface.
diff --git a/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612.dts b/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612.dts
index 31240dcca86e..10fa893d1973 100644
--- a/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612.dts
+++ b/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612.dts
@@ -8,3 +8,27 @@
#include <nxp/rw/nxp_rw6xx.dtsi>
#include "ubx_evk_iris_w1_common.dtsi"
+
+&enet_mac {
+ status = "okay";
+ pinctrl-0 = <&pinmux_enet>;
+ pinctrl-names = "default";
+ phy-handle = <&phy>;
+ zephyr,random-mac-address;
+ phy-connection-type = "rmii";
+};
+
+&enet_mdio {
+ status = "okay";
+ pinctrl-0 = <&pinmux_mdio>;
+ pinctrl-names = "default";
+
+ phy: phy@2 {
+ compatible = "microchip,ksz8081";
+ reg = <2>;
+ status = "okay";
+ reset-gpios = <&hsgpio1 23 GPIO_ACTIVE_HIGH>;
+ int-gpios = <&hsgpio0 21 GPIO_ACTIVE_HIGH>;
+ microchip,interface-type = "rmii";
+ };
+};
diff --git a/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612-pinctrl.dtsi b/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612-pinctrl.dtsi
index 21569ea372b6..1fe1106b8b72 100644
--- a/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612-pinctrl.dtsi
+++ b/boards/u-blox/ubx_evk_iris_w1/ubx_evk_iris_w1_rw612-pinctrl.dtsi
@@ -101,4 +101,22 @@
slew-rate = "normal";
};
};
+
+ pinmux_enet: pinmux_enet {
+ group0 {
+ pinmux = <IO_MUX_ENET_CLK
+ IO_MUX_ENET_RX
+ IO_MUX_ENET_TX
+ IO_MUX_GPIO21
+ IO_MUX_GPIO55>;
+ slew-rate = "fast";
+ };
+ };
+
+ pinmux_mdio: pinmux_mdio {
+ group0 {
+ pinmux = <IO_MUX_ENET_MDIO>;
+ slew-rate = "fast";
+ };
+ };
};
- Add the following options to prj.conf
CONFIG_LOG=y
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_NET_ETHERNET_BRIDGE=y
CONFIG_NET_PROMISCUOUS_MODE=y
- Add the following code to main.c
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(MAIN);
#include <zephyr/net/ethernet_bridge.h>
int main(void)
{
struct net_if* pBrg = eth_bridge_get_by_index(1);
struct net_if* pEth = net_if_get_by_index(2);
if (eth_bridge_iface_add(pBrg, pEth) < 0) {
LOG_ERR("Failed to start bridge");
}
return 0;
}Without the proposed modification, eth_bridge_iface_add() fails because the Ethernet interface does not advertise promiscuous capability.
After applying the patch, the bridge attaches successfully.
Relevant log output
Impact
Functional Limitation – Some features not working as expected, but system usable.
Environment
No response
Additional Context
No response