This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

VLAN not working in AM3358 evm

Other Parts Discussed in Thread: AM3358

Hi,

I am using the ti-sdk-am335x-evm-05.05.01.00 and testing VLAN on AM3358evm. I have enabled the VLAN support in the kernel (CONFIG_VLAN_8021Q).

I have seen the cpsw.c driver file, the VLAN_SUPPORT flag is NOT enabled if CONFIG_TI_CPSW_DUAL_EMAC is enabled, so the VLAN doesnt work. CONFIG_TI_CPSW_DUAL_EMAC is by default enabled in the default configuration "tisdk_am335x-evm_defconfig". Since the AM3358evm is having only one ethernet port, can i disable the CONFIG_TI_CPSW_DUAL_EMAC?

Thanks

  • Hi chaitanya,

    I'm using the latest SDK - version 05.06.00.00 (newer than yours). Looking at the 8021q Kconfig file, there is nothing said about VLAN not working if CONFIG_TI_CPSW_DUAL_EMAC is enabled:

    #
    # Configuration for 802.1Q VLAN support
    #

    config VLAN_8021Q
        tristate "802.1Q VLAN Support"
        ---help---
          Select this and you will be able to create 802.1Q VLAN interfaces
          on your ethernet interfaces.  802.1Q VLAN supports almost
          everything a regular ethernet interface does, including
          firewalling, bridging, and of course IP traffic.  You will need
          the 'vconfig' tool from the VLAN project in order to effectively
          use VLANs.  See the VLAN web page for more information:
          <http://www.candelatech.com/~greear/vlan.html>

          To compile this code as a module, choose M here: the module
          will be called 8021q.

          If unsure, say N.

    Also, looking at the cpsw.c driver file I can't see where the VLAN_SUPPORT and the CONFIG_TI_CPSW_DUAL_EMAC are in conflict. There is even a usecase where both flags are set. Perhaps the cpsw driver has changed with the new version of the SDK. I suggest always using the latest version since there are improvements and bugfixes. Other than that, it should be no issue to disable CONFIG_TI_CPSW_DUAL_EMAC since there isn't a second ethernet port.

    Best regards,
    Miroslav

  • Hi Miroslav,

    The VLAN_SUPPORT flag is enabled only in the #else part of "CONFIG_TI_CPSW_DUAL_EMAC". so when i enable "CONFIG_TI_CPSW_DUAL_EMAC" the VLAN_SUPPORT is not available. please see the below code (in bold) for your reference. This code is taken from ti-sdk-am335x-evm-05.06.00.00.


    #ifdef CONFIG_TI_CPSW_DUAL_EMAC

    /* Enable VLAN aware mode to add VLAN for induvudual interface */
    #define CPSW_VLAN_AWARE_MODE

    #define cpsw_get_slave_ndev(priv, __slave_no__)        \
        (priv->slaves[__slave_no__].ndev)
    #define cpsw_get_slave_priv(priv, __slave_no__)        \
        netdev_priv(priv->slaves[__slave_no__].ndev)
    #define for_each_slave(priv, func, arg...)            \
        do {                            \
            (func)((priv)->slaves + priv->emac_port, ##arg);\
        } while (0)
    #define cpsw_dual_emac_source_port_detect(status, priv, ndev, skb)    \
        do {                                \
            if (CPDMA_RX_SOURCE_PORT(status) == 1) {        \
                ndev = cpsw_get_slave_ndev(priv, 0);        \
                priv = netdev_priv(ndev);            \
                skb->dev = ndev;                \
            } else if (CPDMA_RX_SOURCE_PORT(status) == 2) {        \
                ndev = cpsw_get_slave_ndev(priv, 1);        \
                priv = netdev_priv(ndev);            \
                skb->dev = ndev;                \
            }                            \
        } while (0)
    #define cpsw_add_switch_mode_bcast_ale_entries(priv, slave_port)
    #define cpsw_update_slave_open_state(priv, state)        \
        priv->slaves[priv->emac_port].open_stat = state;
    #define cpsw_slave_phy_index(priv)    ((priv)->emac_port)

    #else    /* CONFIG_TI_CPSW_DUAL_EMAC */

    #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
    #define VLAN_SUPPORT
    #define CPSW_VLAN_AWARE_MODE
    #endif

    #define cpsw_get_slave_ndev(priv, __slave_no__)        NULL
    #define cpsw_get_slave_priv(priv, __slave_no__)        NULL
    #define for_each_slave(priv, func, arg...)            \
        do {                            \
            int idx;                    \
            for (idx = 0; idx < (priv)->data.slaves; idx++)    \
                (func)((priv)->slaves + idx, ##arg);    \
        } while (0)
    #define cpsw_dual_emac_source_port_detect(status, priv, ndev, skb)
    #define cpsw_add_switch_mode_bcast_ale_entries(priv, slave_port)    \
        cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,        \
                   1 << slave_port, 0, 0)
    #define cpsw_update_slave_open_state(priv, state)
    #define cpsw_slave_phy_index(priv)    ((priv)->data.ethtool_slave)

    #endif    /* CONFIG_TI_CPSW_DUAL_EMAC */

    Thanks

  • Hi chaitanya,

    I'm sorry, I have missed this #else statement while looking at the code. This conflict between the two configs should be documented in the appropriate Kconfig files.
    Anyway, did you try disabling the CONFIG_TI_CPSW_DUAL_EMAC? It should not cause any issues on the AM3358 EVM.

    Best regards,
    Miroslav

  • Hi Miroslav,

    I have disabled CONFIG_TI_CPSW_DUAL_EMAC and tested VLAN, its working fine. However i wonder why the CONFIG_TI_CPSW_DUAL_EMAC has been enabled by default (Am3358evm has only one Ethernet port)  and the VLAN_SUPPORT not added to it.

    Thanks

  • Hi chaitanya,

    All of the supported Sitara AM335x platforms (the EVM, the Starter Kit and the BeagleBone) use the same default kernel configuration (refer to this page). The EVM and the BeagleBone have only one Ethernet port each, but the Starter Kit has two. I suppose this is the reason why the CONFIG_TI_CPSW_DUAL_EMAC is enabled in the default config.

    Best regards,
    Miroslav