net: l2: dummy: Update sent statistics
Update dummy interface sent statistics as that was missing. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
5076f5eee0
commit
82b43d50ea
2 changed files with 12 additions and 1 deletions
|
@ -5,6 +5,8 @@ zephyr_library_compile_definitions_ifdef(
|
|||
CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__
|
||||
)
|
||||
|
||||
zephyr_library_include_directories(. ${ZEPHYR_BASE}/subsys/net/ip)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_NET_L2_DUMMY dummy.c)
|
||||
|
||||
if(CONFIG_NET_PSEUDO_IFACE)
|
||||
|
|
|
@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(net_l2_dummy, LOG_LEVEL_NONE);
|
|||
|
||||
#include <zephyr/net/dummy.h>
|
||||
|
||||
#include "net_stats.h"
|
||||
|
||||
static inline enum net_verdict dummy_recv(struct net_if *iface,
|
||||
struct net_pkt *pkt)
|
||||
{
|
||||
|
@ -41,7 +43,14 @@ static inline int dummy_send(struct net_if *iface, struct net_pkt *pkt)
|
|||
|
||||
ret = net_l2_send(api->send, net_if_get_device(iface), iface, pkt);
|
||||
if (!ret) {
|
||||
ret = net_pkt_get_len(pkt);
|
||||
size_t pkt_len = net_pkt_get_len(pkt);
|
||||
|
||||
if (IS_ENABLED(CONFIG_NET_STATISTICS)) {
|
||||
NET_DBG("Sending pkt %p len %zu", pkt, pkt_len);
|
||||
net_stats_update_bytes_sent(iface, pkt_len);
|
||||
}
|
||||
|
||||
ret = (int)pkt_len;
|
||||
net_pkt_unref(pkt);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue