Skip to content

Commit e97e4f8

Browse files
committed
fix(eppp_link): Per review comments
1 parent a5e91cf commit e97e4f8

File tree

5 files changed

+16
-29
lines changed

5 files changed

+16
-29
lines changed

components/eppp_link/README.md

Lines changed: 4 additions & 4 deletions
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
39-
* UDP - 2Mbits
38+
* TCP - 2Mbits/s
39+
* UDP - 2Mbits/s
4040

4141
### SPI @ 20MHz
4242

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

components/eppp_link/eppp_link.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct eppp_handle {
4343
uart_port_t uart_port;
4444
#endif
4545
esp_netif_t *netif;
46-
enum eppp_type role;
46+
eppp_type_t role;
4747
bool stop;
4848
bool exited;
4949
bool netif_stop;
@@ -109,7 +109,7 @@ static void netif_deinit(esp_netif_t *netif)
109109
}
110110
}
111111

112-
static esp_netif_t *netif_init(enum eppp_type role)
112+
static esp_netif_t *netif_init(eppp_type_t role)
113113
{
114114
if (s_eppp_netif_count > 9) {
115115
ESP_LOGE(TAG, "Cannot create more than 10 instances");
@@ -575,15 +575,6 @@ esp_err_t eppp_perform(esp_netif_t *netif)
575575
return ESP_OK;
576576
}
577577

578-
static void ppp_task(void *args)
579-
{
580-
esp_netif_t *netif = args;
581-
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
582-
struct eppp_handle *h = esp_netif_get_io_driver(netif);
583-
h->exited = true;
584-
vTaskDelete(NULL);
585-
}
586-
587578
#elif CONFIG_EPPP_LINK_DEVICE_UART
588579
#define BUF_SIZE (1024)
589580

@@ -636,17 +627,17 @@ esp_err_t eppp_perform(esp_netif_t *netif)
636627
return ESP_OK;
637628
}
638629

630+
#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART
631+
639632
static void ppp_task(void *args)
640633
{
641634
esp_netif_t *netif = args;
642-
while (eppp_perform(netif) == ESP_OK) {}
635+
while (eppp_perform(netif) != ESP_ERR_TIMEOUT) {}
643636
struct eppp_handle *h = esp_netif_get_io_driver(netif);
644637
h->exited = true;
645638
vTaskDelete(NULL);
646639
}
647640

648-
#endif // CONFIG_EPPP_LINK_DEVICE_SPI / UART
649-
650641
static bool have_some_eppp_netif(esp_netif_t *netif, void *ctx)
651642
{
652643
return get_netif_num(netif) > 0;
@@ -679,7 +670,7 @@ void eppp_deinit(esp_netif_t *netif)
679670
netif_deinit(netif);
680671
}
681672

682-
esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config)
673+
esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
683674
{
684675
esp_netif_t *netif = netif_init(role);
685676
if (!netif) {
@@ -710,7 +701,7 @@ esp_netif_t *eppp_init(enum eppp_type role, eppp_config_t *config)
710701
return netif;
711702
}
712703

713-
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout)
704+
esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, TickType_t connect_timeout)
714705
{
715706
#if CONFIG_EPPP_LINK_DEVICE_UART
716707
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

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

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

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

components/eppp_link/include/eppp_link.h

Lines changed: 2 additions & 2 deletions
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(enum eppp_type role, eppp_config_t *config);
95+
esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config);
9696

9797
void eppp_deinit(esp_netif_t *netif);
9898

99-
esp_netif_t *eppp_open(enum eppp_type role, eppp_config_t *config, TickType_t connect_timeout);
99+
esp_netif_t *eppp_open(eppp_type_t 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)