[Linux-stm32] stmmac bridge issue

Clark Wang xiaoning.wang at nxp.com
Thu Jul 28 10:07:34 UTC 2022


Hi,

I'm just starting to learn to use the ENET module. I met a problem related with bridge, vlan and promiscuous mode.
I don't quite understand the relationship between them for now and feel that my solution was not good. Therefore, I hope to seek help in the community.
Thank you all in advance!

Here is the issue.
When I try to add stmmac eqos ethernet module to a bridge on i.mx8mp. An error log will be shown.

root at imx8mp-lpddr4-evk:~# brctl addbr br0

root at imx8mp-lpddr4-evk:~# brctl addif br0 eth1

[ 748.394901] br0: port 1(eth1) entered blocking state

[ 748.399940] br0: port 1(eth1) entered disabled state

[ 748.405738] device eth1 entered promiscuous mode

[ 748.410716] audit: type=1700 audit(1637343112.796:5): dev=eth1 prom=256 old_prom=0 auid=4294967295 uid=0 gid=0 ses=4294967295

[ 748.411373] imx-dwmac 30bf0000.ethernet eth1: Adding VLAN in promisc mode not supported

[ 748.454575] imx-dwmac 30bf0000.ethernet eth1: failed to initialize vlan filtering on this port

[ 748.464156] audit: type=1300 audit(1637343112.796:5): arch=c00000b7 syscall=29 success=no exit=-1 a0=3 a1=89a2 a2=ffffd4626e40 a3=0 items=0 ppid)

[ 748.464177] br0: port 1(eth1) entered blocking state

[ 748.492156] audit: type=1327 audit(1637343112.796:5): proctitle=627263746C006164646966006272300065746831

[ 748.497085] br0: port 1(eth1) entered disabled state

[ 748.511814] imx-dwmac 30bf0000.ethernet eth1: Adding VLAN in promisc mode not supported

[ 748.537982] imx-dwmac 30bf0000.ethernet eth1: failed to initialize vlan filtering on this port

can't add eth1 to bridge br0: Operation not permitted

I noticed that this error log came from these patches:
ed64639bc1e089 net: stmmac: Add support for VLAN Rx filtering
c89f44ff10fd4c net: stmmac: Add support for VLAN promiscuous mode


If I remove these error path directly, the eth1 can be added and bridge works.

+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

@@ -450,6 +450,12 @@ static int dwmac4_add_hw_vlan_rx_fltr(struct net_device *dev,

        if (vid > 4095)

                return -EINVAL;



+       if (hw->promisc) {

+               netdev_err(dev,

+                          "Adding VLAN in promisc mode not supported\n");

+               return -EPERM;

+       }

+

        /* Single Rx VLAN Filter */

        if (hw->num_vlan == 1) {

                /* For single VLAN filter, VID 0 means VLAN promiscuous */

@@ -499,6 +505,12 @@ static int dwmac4_del_hw_vlan_rx_fltr(struct net_device *dev,

{

        int i, ret = 0;



+       if (hw->promisc) {

+               netdev_err(dev,

+                          "Deleting VLAN in promisc mode not supported\n");

+               return -EPERM;

+       }

Or, I saw those patches above enable vlan_fail_q_en in the dwmac-intel.c.
If I enable this function in dwmac-imx.c, this issue gone.

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

index 8c251db1c6ab..de6b5fddf6d9 100644

--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

@@ -291,6 +291,8 @@ static int imx_dwmac_probe(struct platform_device *pdev)

        plat_dat->clks_config = imx_dwmac_clks_config;

        plat_dat->fix_mac_speed = imx_dwmac_fix_speed;

        plat_dat->bsp_priv = dwmac;

+       plat_dat->vlan_fail_q_en = true;

+       plat_dat->vlan_fail_q = 0;

        dwmac->plat_dat = plat_dat;



        ret = imx_dwmac_clks_config(dwmac, true);

I only found this problem so far. I'm still learning about the connection between VLAN, promiscuous mode and bridge.
I don't think the two workarounds I've found so far are good solutions to this problem.
Can someone give some ideas to fix this issue?

Thanks again!


Best Regards,
Clark Wang

NXP Semiconductor Suzhou
Mobile: +86-188-6223-0436
Addr: 288 Zhuyuan Road, Suzhou New District, Suzhou, Jiansu 215011, PRC
[cid:image001.png at 01D8A290.287A6590]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20220728/22452f7a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 22041 bytes
Desc: image001.png
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20220728/22452f7a/attachment.png>


More information about the Linux-stm32 mailing list