Skip to content

HOW TO USE LWIP_HOOK_UNKNOWN_ETH_PROTOCOL (IDFGH-1224) #3526

@yanzixiang

Description

@yanzixiang

HOW TO USE THIS ?

https://github.com/espressif/esp-lwip/blob/2.0.3-esp/src/netif/ethernet.c

#ifdef LWIP_HOOK_UNKNOWN_ETH_PROTOCOL
      if(LWIP_HOOK_UNKNOWN_ETH_PROTOCOL(p, netif) == ERR_OK) {
        break;
      }
#endif

https://www.nongnu.org/lwip/2_1_x/group__lwip__opts__hooks.html#ga6cc92f5101dd7a0420e18e1f2101abf4

Can this be done by modify the eth_config_t defined here ?
https://github.com/espressif/arduino-esp32/blob/010a7c60f7000eb17c6333309c87156769848a0e/tools/sdk/include/ethernet/esp_eth.h

/**
 * @brief ethernet configuration
 *
 */
typedef struct {
    eth_phy_base_t phy_addr;                                            /*!< PHY address (0~31) */
    eth_mode_t mac_mode;                                                /*!< MAC mode: only support RMII now */
    eth_clock_mode_t clock_mode;                                        /*!< external/internal clock mode selection */
    eth_tcpip_input_func tcpip_input;                                   /*!< tcpip input func */
    eth_phy_func phy_init;                                              /*!< phy init func */
    eth_phy_check_link_func phy_check_link;                             /*!< phy check link func */
    eth_phy_check_init_func phy_check_init;                             /*!< phy check init func */
    eth_phy_get_speed_mode_func phy_get_speed_mode;                     /*!< phy check init func */
    eth_phy_get_duplex_mode_func phy_get_duplex_mode;                   /*!< phy check init func */
    eth_gpio_config_func gpio_config;                                   /*!< gpio config func  */
    bool flow_ctrl_enable;                                              /*!< flag of flow ctrl enable */
    eth_phy_get_partner_pause_enable_func phy_get_partner_pause_enable; /*!< get partner pause enable */
    eth_phy_power_enable_func phy_power_enable;                         /*!< enable or disable phy power */
    uint32_t reset_timeout_ms;                                          /*!< timeout value for reset emac */
} eth_config_t;

And
https://github.com/espressif/esp-idf/blob/6fd535c985f0019ffe8a924e62a57e29a9007a28/components/ethernet/emac_common.h

struct emac_config_data {
    eth_phy_base_t phy_addr;
    eth_mode_t mac_mode;
    eth_clock_mode_t clock_mode;
    struct dma_extended_desc *dma_etx;
    uint32_t cur_tx;
    uint32_t dirty_tx;
    int32_t cnt_tx;
    struct dma_extended_desc *dma_erx;
    uint32_t cur_rx;
    uint32_t dirty_rx;
    int32_t cnt_rx;
    uint32_t rx_need_poll;
    bool phy_link_up;
    enum emac_runtime_status emac_status;
    uint8_t macaddr[6];
    eth_phy_func phy_init;
    eth_tcpip_input_func emac_tcpip_input;
    eth_gpio_config_func emac_gpio_config;
    eth_phy_check_link_func emac_phy_check_link;
    eth_phy_check_init_func emac_phy_check_init;
    eth_phy_get_speed_mode_func emac_phy_get_speed_mode;
    eth_phy_get_duplex_mode_func emac_phy_get_duplex_mode;
    bool emac_flow_ctrl_enable;
    bool emac_flow_ctrl_partner_support;
    eth_phy_get_partner_pause_enable_func emac_phy_get_partner_pause_enable;
    eth_phy_power_enable_func emac_phy_power_enable;
    uint32_t reset_timeout_ms;
    bool promiscuous_enable;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions