Netif traffic indicator

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Netif traffic indicator

Postby DrMickeyLauer » Sat Mar 09, 2024 12:56 pm

My design uses a W5500 and the builtin WiFi to provide a bridge. I'd like to indicate the network traffic via one LED. In our hardware design, we didn't want to hardwire the signalling, hence my task is to do it in software. While I get events for link up and link down, I wonder where to hook best to build a custom IP_EVENT_TRAFFIC event that I can listen for in my higher layers.

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: Netif traffic indicator

Postby DrMickeyLauer » Sat Mar 09, 2024 5:48 pm

Ok, I guess I found the relevant parts in components/esp_netif/lwip/esp_netif_lwip.c, esp_netif_transmit & esp_netif_receive. I'll patch those function to send events over the default event loop. I will test with ipperf to check whether this will lead to a performance degration or not.

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: Netif traffic indicator

Postby DrMickeyLauer » Mon Mar 11, 2024 11:13 am

Seems to be fine, so in case anyone else needs something like that, here's my pull request: https://github.com/espressif/esp-idf/pull/13348

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

Re: Netif traffic indicator

Postby dmitrij999 » Thu Sep 05, 2024 7:46 am

Thanks for traffic reporting feature! With this, I'll try to implement traffic counters
But I cannot find it neither in IDF v5.2.2 nor in IDF v5.3.1.
Could you please remind me which IDF version has network traffic reporting?
I consider connecting my device thru GSM modem and I'd like to account incoming and outgoing internet traffic

DrMickeyLauer
Posts: 168
Joined: Sun May 22, 2022 2:42 pm

Re: Netif traffic indicator

Postby DrMickeyLauer » Thu Sep 05, 2024 1:57 pm

I don't know. The PR has been merged back in April, so it's in master by now, but I don't know when they will backport it to the next release. Perhaps try asking on https://github.com/espressif/esp-idf/pull/13348

dmitrij999
Posts: 71
Joined: Sat Mar 02, 2019 8:06 pm

Re: Netif traffic indicator

Postby dmitrij999 » Thu Sep 12, 2024 10:51 pm

I made a netif traffic counter for GSM modem, but I needed to pull unstable esp-idf from master.
I guess it's needed an example for esp-idf to be able to add the traffic counter to future release.

Here are some logs from my GSM modem project which connects to Telegram bot:

Code: Select all

I (244526) MAIN: VBUS:4913.00 mV 0.00 mA ,BATTERY: 4131.60, charging state 0, Battery percent -4, GSM RSSI 16, GSM BER 0
I (245526) MAIN: Free heap size: 4367184, GSM bytes RX 130491, GSM bytes TX 16008
I (245536) MAIN: Network status 1
I (245536) MAIN: GSM RSSI 16, BER 0
I (245546) MAIN: VBUS:4889.20 mV 0.00 mA ,BATTERY: 4131.60, charging state 0, Battery percent -4, GSM RSSI 16, GSM BER 0
I (246546) MAIN: Free heap size: 4336744, GSM bytes RX 130540, GSM bytes TX 16399
I (246556) MAIN: Network status 1
I (246566) MAIN: GSM RSSI 18, BER 0
I (246566) MAIN: VBUS:4848.40 mV 0.00 mA ,BATTERY: 4129.40, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
I (247576) MAIN: Free heap size: 4336728, GSM bytes RX 133030, GSM bytes TX 16399
I (247826) MAIN: Network status 1
I (247866) MAIN: GSM RSSI 18, BER 0
I (247866) MAIN: VBUS:4839.90 mV 0.38 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (247916) MAIN: Some interruption came from AXP192: 0
I (247926) MAIN: Free heap size: 4336728, GSM bytes RX 135060, GSM bytes TX 16581
I (248056) MAIN: Network status 1
I (248066) MAIN: GSM RSSI 18, BER 0
I (248076) MAIN: VBUS:4797.40 mV 0.00 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (248076) MAIN: Some interruption came from AXP192: 0
I (248186) MAIN: Free heap size: 4327368, GSM bytes RX 137777, GSM bytes TX 16672
I (248326) MAIN: Network status 1
I (248336) MAIN: GSM RSSI 18, BER 0
I (248346) MAIN: VBUS:4868.80 mV 0.00 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (248646) MAIN: Some interruption came from AXP192: 0
I (248656) MAIN: Free heap size: 4322392, GSM bytes RX 141711, GSM bytes TX 16897
I (248716) MAIN: Network status 1
I (248726) MAIN: GSM RSSI 18, BER 0
I (248736) MAIN: VBUS:4819.50 mV 0.00 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (248736) MAIN: Some interruption came from AXP192: 0
I (248746) MAIN: Free heap size: 4325448, GSM bytes RX 142410, GSM bytes TX 17084
I (248766) MAIN: Network status 1
I (248776) MAIN: GSM RSSI 18, BER 0
I (248786) MAIN: VBUS:4773.60 mV 0.00 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (248956) MAIN: Some interruption came from AXP192: 0
I (248956) MAIN: Free heap size: 4325448, GSM bytes RX 142410, GSM bytes TX 17084
I (248976) MAIN: Network status 1
I (248986) MAIN: GSM RSSI 18, BER 0
I (248986) MAIN: VBUS:4397.90 mV 197.62 mA ,BATTERY: 4118.40, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (249016) MAIN: Some interruption came from AXP192: 0
I (249016) MAIN: Free heap size: 4326964, GSM bytes RX 142455, GSM bytes TX 17084
I (249046) MAIN: Network status 1
I (249076) MAIN: GSM RSSI 18, BER 0
I (249076) MAIN: VBUS:4822.90 mV 0.00 mA ,BATTERY: 4118.40, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (249126) MAIN: Some interruption came from AXP192: 0
I (249126) MAIN: Free heap size: 4326356, GSM bytes RX 142779, GSM bytes TX 17318
I (249146) MAIN: Network status 1
I (249146) MAIN: GSM RSSI 18, BER 0
I (249156) MAIN: VBUS:4817.80 mV 0.00 mA ,BATTERY: 4118.40, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
I (249426) Sending getMe: HTTPS Status = 200, content_length = 23
W (249436) Sending getMe: Got telegram answer: {"ok":true,"result":[]}
W (249436) Sending getMe: Connection closing
I (249436) TelegramBotManagement: HTTP_EVENT_DISCONNECTED
W (249446) TelegramBotManagement: Telegram poll end
I (249446) TelegramBotManagement: HTTP_EVENT_DISCONNECTED
W (249536) MAIN: Some interruption came from AXP192: 0
I (249536) MAIN: Free heap size: 4366856, GSM bytes RX 143272, GSM bytes TX 17366
I (249556) MAIN: Network status 1
I (249566) MAIN: GSM RSSI 18, BER 0
I (249566) MAIN: VBUS:4824.60 mV 0.00 mA ,BATTERY: 4118.40, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
W (250446) MAIN: Some interruption came from AXP192: 0
I (250446) MAIN: Free heap size: 4366972, GSM bytes RX 143318, GSM bytes TX 17413
I (250466) MAIN: Network status 1
I (250466) MAIN: GSM RSSI 18, BER 0
I (250476) MAIN: VBUS:4877.30 mV 0.00 mA ,BATTERY: 4122.80, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
I (251476) MAIN: Free heap size: 4366972, GSM bytes RX 143318, GSM bytes TX 17413
I (251486) MAIN: Network status 1
I (251496) MAIN: GSM RSSI 18, BER 0
I (251496) MAIN: VBUS:4913.00 mV 0.00 mA ,BATTERY: 4125.00, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0
I (252496) MAIN: Free heap size: 4366972, GSM bytes RX 143318, GSM bytes TX 17413
I (252506) MAIN: Network status 1
I (252516) MAIN: GSM RSSI 18, BER 0
I (252516) MAIN: VBUS:4899.40 mV 0.00 mA ,BATTERY: 4125.00, charging state 0, Battery percent -4, GSM RSSI 18, GSM BER 0

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 106 guests