Skip to content

Commit cba0160

Browse files
committed
Revert "fix(eppp_link): Per review comments"
This reverts commit e97e4f8.
1 parent c0f4017 commit cba0160

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

components/eppp_link/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Tested with WiFi-NAPT example, no IRAM optimizations
3535

3636
### UART @ 3Mbauds
3737

38-
* TCP - 2Mbits/s
39-
* UDP - 2Mbits/s
38+
* TCP - 2Mbits
39+
* UDP - 2Mbits
4040

4141
### SPI @ 20MHz
4242

43-
* TCP - 6Mbits/s
44-
* UDP - 10Mbits/s
43+
* TCP - 6Mbits
44+
* UDP - 10Mbits

components/eppp_link/eppp_link.c

+16-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct eppp_handle {
4444
uart_port_t uart_port;
4545
#endif
4646
esp_netif_t *netif;
47-
eppp_type_t role;
47+
enum eppp_type role;
4848
bool stop;
4949
bool exited;
5050
bool netif_stop;
@@ -130,7 +130,7 @@ static void netif_deinit(esp_netif_t *netif)
130130
}
131131
}
132132

133-
static esp_netif_t *netif_init(eppp_type_t role)
133+
static esp_netif_t *netif_init(enum eppp_type role)
134134
{
135135
if (s_eppp_netif_count > 9) {
136136
ESP_LOGE(TAG, "Cannot create more than 10 instances");
@@ -625,6 +625,15 @@ esp_err_t eppp_perform(esp_netif_t *netif)
625625
return ESP_OK;
626626
}
627627

628+
static void ppp_task(void *args)
629+
{
630+
esp_netif_t *netif = args;
631+
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
632+
struct eppp_handle *h = esp_netif_get_io_driver(netif);
633+
h->exited = true;
634+
vTaskDelete(NULL);
635+
}
636+
628637
#elif CONFIG_EPPP_LINK_DEVICE_UART
629638
#define BUF_SIZE (1024)
630639

@@ -677,17 +686,17 @@ esp_err_t eppp_perform(esp_netif_t *netif)
677686
return ESP_OK;
678687
}
679688

680-
#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART
681-
682689
static void ppp_task(void *args)
683690
{
684691
esp_netif_t *netif = args;
685-
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
692+
while (eppp_perform(netif) == ESP_OK) {}
686693
struct eppp_handle *h = esp_netif_get_io_driver(netif);
687694
h->exited = true;
688695
vTaskDelete(NULL);
689696
}
690697

698+
#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART
699+
691700
static bool have_some_eppp_netif(esp_netif_t *netif, void *ctx)
692701
{
693702
return get_netif_num(netif) > 0;
@@ -720,7 +729,7 @@ void eppp_deinit(esp_netif_t *netif)
720729
netif_deinit(netif);
721730
}
722731

723-
esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
732+
esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config)
724733
{
725734
esp_netif_t *netif = netif_init(role);
726735
if (!netif) {
@@ -751,7 +760,7 @@ esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
751760
return netif;
752761
}
753762

754-
esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, TickType_t connect_timeout)
763+
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout)
755764
{
756765
#if CONFIG_EPPP_LINK_DEVICE_UART
757766
if (config->transport != EPPP_TRANSPORT_UART) {

components/eppp_link/eppp_link_types.h

Whitespace-only changes.

components/eppp_link/examples/host/main/register_iperf.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -46,14 +46,18 @@ static struct {
4646
static int ppp_cmd_iperf(int argc, char **argv)
4747
{
4848
int nerrors = arg_parse(argc, argv, (void **)&iperf_args);
49-
// ethernet iperf only support IPV4 address
50-
iperf_cfg_t cfg = {.type = IPERF_IP_TYPE_IPV4};
49+
iperf_cfg_t cfg;
5150

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

56+
memset(&cfg, 0, sizeof(cfg));
57+
58+
// ethernet iperf only support IPV4 address
59+
cfg.type = IPERF_IP_TYPE_IPV4;
60+
5761
/* iperf -a */
5862
if (iperf_args.abort->count != 0) {
5963
iperf_stop();

components/eppp_link/include/eppp_link.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ esp_netif_t *eppp_listen(eppp_config_t *config);
9292

9393
void eppp_close(esp_netif_t *netif);
9494

95-
esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config);
95+
esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config);
9696

9797
void eppp_deinit(esp_netif_t *netif);
9898

99-
esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, TickType_t connect_timeout);
99+
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout);
100100

101101
esp_err_t eppp_netif_stop(esp_netif_t *netif, TickType_t stop_timeout);
102102

0 commit comments

Comments
 (0)