Skip to content

Commit ba3c5de

Browse files
jukkarjhedberg
authored andcommitted
net: stats: Add RX time statistics for packet sockets
If CONFIG_NET_PKT_RXTIME_STATS is set, then update the received packet RX time for packet sockets (SOCK_RAW). This was already working for normal sockets but the statistics update was missing from SOCK_RAW. Fixes #22489 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent f2e2b66 commit ba3c5de

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

subsys/net/lib/sockets/sockets_packet.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ LOG_MODULE_REGISTER(net_sock_packet, CONFIG_NET_SOCKETS_LOG_LEVEL);
2020
#include <syscall_handler.h>
2121
#include <sys/fdtable.h>
2222

23+
#include "../../ip/net_stats.h"
24+
2325
#include "sockets_internal.h"
2426

2527
extern const struct socket_op_vtable sock_fd_op_vtable;
@@ -222,6 +224,11 @@ ssize_t zpacket_recvfrom_ctx(struct net_context *ctx, void *buf, size_t max_len,
222224
return -1;
223225
}
224226

227+
net_stats_update_tc_rx_time(net_pkt_iface(pkt),
228+
net_pkt_priority(pkt),
229+
net_pkt_timestamp(pkt)->nanosecond,
230+
k_cycle_get_32());
231+
225232
if (!(flags & ZSOCK_MSG_PEEK)) {
226233
net_pkt_unref(pkt);
227234
} else {

0 commit comments

Comments
 (0)