Skip to content

Commit

Permalink
Revert "fix(eppp_link): Per review comments"
Browse files Browse the repository at this point in the history
This reverts commit e97e4f8.
  • Loading branch information
david-cermak committed Jan 12, 2024
1 parent c0f4017 commit cba0160
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
8 changes: 4 additions & 4 deletions components/eppp_link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ Tested with WiFi-NAPT example, no IRAM optimizations

### UART @ 3Mbauds

* TCP - 2Mbits/s
* UDP - 2Mbits/s
* TCP - 2Mbits
* UDP - 2Mbits

### SPI @ 20MHz

* TCP - 6Mbits/s
* UDP - 10Mbits/s
* TCP - 6Mbits
* UDP - 10Mbits
23 changes: 16 additions & 7 deletions components/eppp_link/eppp_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct eppp_handle {
uart_port_t uart_port;
#endif
esp_netif_t *netif;
eppp_type_t role;
enum eppp_type role;
bool stop;
bool exited;
bool netif_stop;
Expand Down Expand Up @@ -130,7 +130,7 @@ static void netif_deinit(esp_netif_t *netif)
}
}

static esp_netif_t *netif_init(eppp_type_t role)
static esp_netif_t *netif_init(enum eppp_type role)
{
if (s_eppp_netif_count > 9) {
ESP_LOGE(TAG, "Cannot create more than 10 instances");
Expand Down Expand Up @@ -625,6 +625,15 @@ esp_err_t eppp_perform(esp_netif_t *netif)
return ESP_OK;
}

static void ppp_task(void *args)
{
esp_netif_t *netif = args;
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
struct eppp_handle *h = esp_netif_get_io_driver(netif);
h->exited = true;
vTaskDelete(NULL);
}

#elif CONFIG_EPPP_LINK_DEVICE_UART
#define BUF_SIZE (1024)

Expand Down Expand Up @@ -677,17 +686,17 @@ esp_err_t eppp_perform(esp_netif_t *netif)
return ESP_OK;
}

#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART

static void ppp_task(void *args)
{
esp_netif_t *netif = args;
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
while (eppp_perform(netif) == ESP_OK) {}
struct eppp_handle *h = esp_netif_get_io_driver(netif);
h->exited = true;
vTaskDelete(NULL);
}

#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART

static bool have_some_eppp_netif(esp_netif_t *netif, void *ctx)
{
return get_netif_num(netif) > 0;
Expand Down Expand Up @@ -720,7 +729,7 @@ void eppp_deinit(esp_netif_t *netif)
netif_deinit(netif);
}

esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config)
{
esp_netif_t *netif = netif_init(role);
if (!netif) {
Expand Down Expand Up @@ -751,7 +760,7 @@ esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
return netif;
}

esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, TickType_t connect_timeout)
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout)
{
#if CONFIG_EPPP_LINK_DEVICE_UART
if (config->transport != EPPP_TRANSPORT_UART) {
Expand Down
Empty file.
10 changes: 7 additions & 3 deletions components/eppp_link/examples/host/main/register_iperf.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
Expand Down Expand Up @@ -46,14 +46,18 @@ static struct {
static int ppp_cmd_iperf(int argc, char **argv)
{
int nerrors = arg_parse(argc, argv, (void **)&iperf_args);
// ethernet iperf only support IPV4 address
iperf_cfg_t cfg = {.type = IPERF_IP_TYPE_IPV4};
iperf_cfg_t cfg;

if (nerrors != 0) {
arg_print_errors(stderr, iperf_args.end, argv[0]);
return 0;
}

memset(&cfg, 0, sizeof(cfg));

// ethernet iperf only support IPV4 address
cfg.type = IPERF_IP_TYPE_IPV4;

/* iperf -a */
if (iperf_args.abort->count != 0) {
iperf_stop();
Expand Down
4 changes: 2 additions & 2 deletions components/eppp_link/include/eppp_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ esp_netif_t *eppp_listen(eppp_config_t *config);

void eppp_close(esp_netif_t *netif);

esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config);
esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config);

void eppp_deinit(esp_netif_t *netif);

esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, TickType_t connect_timeout);
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout);

esp_err_t eppp_netif_stop(esp_netif_t *netif, TickType_t stop_timeout);

Expand Down

0 comments on commit cba0160

Please sign in to comment.