eth_vlan_utils.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Unlicense OR CC0-1.0
  5. */
  6. // Maximum number of interface that can be added
  7. #define MAX_ETH_NETIF_COUNT (10)
  8. typedef struct {
  9. esp_netif_t *esp_netif[MAX_ETH_NETIF_COUNT];
  10. uint8_t netif_count;
  11. } esp_vlan_netifs;
  12. /**
  13. * @brief This function gets invoked when Ethernet receive a new packets.
  14. *
  15. * @note This function is to be registered as a callback function which get invoked when Ethernet receive a new packets.
  16. *
  17. * @param eth_handle handle of Ethernet driver
  18. * @param buffer buffer of the received packet
  19. * @param length length of the received packet
  20. * @param priv private pointer
  21. *
  22. * @return
  23. * - ESP_OK: input frame buffer to upper stack successfully
  24. * - ESP_FAIL: error occurred when inputting buffer to upper stack
  25. */
  26. esp_err_t eth_input_to_netif(esp_eth_handle_t eth_handle, uint8_t *buffer, uint32_t length, void *priv);
  27. /**
  28. * @brief This function creates configuration for esp-netif Ethernet
  29. *
  30. * @param vlan_id handle of Ethernet driver, used to name the interface key.
  31. * @param vlan_eth_cfg_o output parameter returning the esp-netif ethernet configuration.
  32. *
  33. * @return ESP_OK or ESP_FAIL
  34. */
  35. esp_err_t get_vlan_netif_config(uint16_t vlan_id, esp_netif_config_t *vlan_eth_cfg_o);
  36. /**
  37. * @brief This function frees the memory allocated for configuration for esp-netif Ethernet
  38. *
  39. * @param vlan_eth_cfg configuration for esp-netif Ethernet
  40. */
  41. void free_vlan_config(esp_netif_config_t *vlan_eth_cfg);