19#ifndef ZEPHYR_INCLUDE_NET_NET_PKT_H_
20#define ZEPHYR_INCLUDE_NET_NET_PKT_H_
27#if defined(CONFIG_IEEE802154)
75#define NET_PKT_FRAG_FOR_EACH(_pkt, _var) \
76 for (struct net_buf *_var = (_pkt)->frags; _var != NULL; \
81#if defined(CONFIG_NET_PKT_ALLOC_STATS)
82struct net_pkt_alloc_stats {
88struct net_pkt_alloc_stats_slab {
89 struct net_pkt_alloc_stats ok;
90 struct net_pkt_alloc_stats fail;
91 struct k_mem_slab *slab;
94#define NET_PKT_ALLOC_STATS_DEFINE(alloc_name, slab_name) \
95 STRUCT_SECTION_ITERABLE(net_pkt_alloc_stats_slab, alloc_name) = { \
100#define NET_PKT_ALLOC_STATS_DEFINE(name, slab)
104struct net_pkt_cursor {
146#if defined(CONFIG_NET_TCP)
150#if defined(CONFIG_NET_IPV4_ROUTING) || defined(CONFIG_NET_IPV6_ROUTING) || \
151 defined(CONFIG_NET_ETHERNET_BRIDGE)
152 struct net_if *orig_iface;
155#if defined(CONFIG_NET_VPN)
160 union net_ip_header ip_hdr;
162 union net_proto_header proto_hdr;
168#if defined(CONFIG_NET_PKT_TIMESTAMP) || defined(CONFIG_NET_PKT_TXTIME)
190#if defined(CONFIG_NET_PKT_RXTIME_STATS) || defined(CONFIG_NET_PKT_TXTIME_STATS) || \
191 defined(CONFIG_TRACING_NET_CORE)
196#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) || \
197 defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
212#if defined(CONFIG_NET_PKT_ALLOC_STATS)
213 struct net_pkt_alloc_stats_slab *alloc_stats;
220 struct net_linkaddr lladdr_src;
221 struct net_linkaddr lladdr_dst;
224#if defined(CONFIG_NET_IP)
241#if defined(CONFIG_NET_IPV4_ACD)
248#if defined(CONFIG_NET_LLDP)
270#if defined(CONFIG_NET_IP_FRAGMENT)
273#if defined(CONFIG_NET_PKT_TIMESTAMP)
279#if defined(CONFIG_NET_IP)
284#if defined(CONFIG_NET_IPV6)
287#if defined(CONFIG_NET_IPV4)
293#if defined(CONFIG_NET_IPV4)
296#if defined(CONFIG_NET_IPV6)
301#if defined(CONFIG_NET_IPV4_ROUTE)
306 struct net_in_addr ipv4_ll_resolve_addr;
309#if defined(CONFIG_NET_IP_FRAGMENT)
311#if defined(CONFIG_NET_IPV4_FRAGMENT)
317#if defined(CONFIG_NET_IPV6_FRAGMENT)
327#if defined(CONFIG_NET_IPV6)
339#if defined(CONFIG_NET_IP_DSCP_ECN)
348#if defined(CONFIG_NET_VLAN)
357#if defined(CONFIG_NET_PKT_CONTROL_BLOCK)
360 uint8_t cb[CONFIG_NET_PKT_CONTROL_BLOCK_SIZE];
361#if defined(CONFIG_IEEE802154)
365 struct net_pkt_cb_ieee802154 cb_ieee802154;
375#if defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_L2_IPIP)
381 struct net_sockaddr remote;
387 struct net_sockaddr_storage remote_storage;
391#if defined(CONFIG_NET_CAPTURE_COOKED_MODE)
396#if defined(CONFIG_NET_IPV4_PMTU)
400#if defined(CONFIG_NET_IPV4_ROUTE)
401 uint8_t ipv4_ll_resolve_addr_set : 1;
420static inline void net_pkt_set_context(
struct net_pkt *pkt,
426static inline struct net_if *net_pkt_iface(
struct net_pkt *pkt)
431static inline void net_pkt_set_iface(
struct net_pkt *pkt,
struct net_if *iface)
442 pkt->lladdr_src.type = type;
443 pkt->lladdr_dst.type = type;
447static inline struct net_if *net_pkt_orig_iface(
struct net_pkt *pkt)
449#if defined(CONFIG_NET_IPV4_ROUTING) || defined(CONFIG_NET_IPV6_ROUTING) || \
450 defined(CONFIG_NET_ETHERNET_BRIDGE)
451 return pkt->orig_iface;
457static inline void net_pkt_set_orig_iface(
struct net_pkt *pkt,
460#if defined(CONFIG_NET_IPV4_ROUTING) || defined(CONFIG_NET_IPV6_ROUTING) || \
461 defined(CONFIG_NET_ETHERNET_BRIDGE)
462 pkt->orig_iface = iface;
469#if defined(CONFIG_NET_VPN)
470static inline struct net_if *net_pkt_vpn_iface(
struct net_pkt *pkt)
472 return pkt->vpn.
iface;
475static inline void net_pkt_set_vpn_iface(
struct net_pkt *pkt,
478 pkt->vpn.
iface = iface;
481static inline union net_ip_header *net_pkt_vpn_ip_hdr(
struct net_pkt *pkt)
483 return &pkt->vpn.ip_hdr;
486static inline void net_pkt_set_vpn_ip_hdr(
struct net_pkt *pkt,
487 union net_ip_header *ip_hdr)
489 pkt->vpn.ip_hdr = *ip_hdr;
492static inline union net_proto_header *net_pkt_vpn_udp_hdr(
struct net_pkt *pkt)
494 return &pkt->vpn.proto_hdr;
497static inline void net_pkt_set_vpn_udp_hdr(
struct net_pkt *pkt,
498 union net_proto_header *proto_hdr)
500 pkt->vpn.proto_hdr = *proto_hdr;
503static inline int net_pkt_vpn_peer_id(
struct net_pkt *pkt)
505 return pkt->vpn.peer_id;
508static inline void net_pkt_set_vpn_peer_id(
struct net_pkt *pkt,
511 pkt->vpn.peer_id = peer_id;
520static inline void net_pkt_set_family(
struct net_pkt *pkt,
uint8_t family)
522 pkt->family = family;
525static inline bool net_pkt_is_ptp(
struct net_pkt *pkt)
527 return !!(pkt->ptp_pkt);
530static inline void net_pkt_set_ptp(
struct net_pkt *pkt,
bool is_ptp)
532 pkt->ptp_pkt = is_ptp;
535static inline bool net_pkt_is_tx_timestamping(
struct net_pkt *pkt)
537#if defined(CONFIG_NET_PKT_TIMESTAMP)
538 return !!(pkt->tx_timestamping);
546static inline void net_pkt_set_tx_timestamping(
struct net_pkt *pkt,
bool is_timestamping)
548#if defined(CONFIG_NET_PKT_TIMESTAMP)
549 pkt->tx_timestamping = is_timestamping;
552 ARG_UNUSED(is_timestamping);
556static inline bool net_pkt_is_rx_timestamping(
struct net_pkt *pkt)
558#if defined(CONFIG_NET_PKT_TIMESTAMP)
559 return !!(pkt->rx_timestamping);
567static inline void net_pkt_set_rx_timestamping(
struct net_pkt *pkt,
bool is_timestamping)
569#if defined(CONFIG_NET_PKT_TIMESTAMP)
570 pkt->rx_timestamping = is_timestamping;
573 ARG_UNUSED(is_timestamping);
577static inline bool net_pkt_is_captured(
struct net_pkt *pkt)
579 return !!(pkt->captured);
582static inline void net_pkt_set_captured(
struct net_pkt *pkt,
bool is_captured)
584 pkt->captured = is_captured;
587static inline bool net_pkt_is_l2_bridged(
struct net_pkt *pkt)
589 return IS_ENABLED(CONFIG_NET_ETHERNET_BRIDGE) ? !!(pkt->l2_bridged) : 0;
592static inline void net_pkt_set_l2_bridged(
struct net_pkt *pkt,
bool is_l2_bridged)
595 pkt->l2_bridged = is_l2_bridged;
599static inline bool net_pkt_is_l2_processed(
struct net_pkt *pkt)
601 return !!(pkt->l2_processed);
604static inline void net_pkt_set_l2_processed(
struct net_pkt *pkt,
605 bool is_l2_processed)
607 pkt->l2_processed = is_l2_processed;
610static inline bool net_pkt_is_chksum_done(
struct net_pkt *pkt)
612 return !!(pkt->chksum_done);
615static inline void net_pkt_set_chksum_done(
struct net_pkt *pkt,
618 pkt->chksum_done = is_chksum_done;
623#if defined(CONFIG_NET_IP)
624 return pkt->ip_hdr_len;
632static inline void net_pkt_set_ip_hdr_len(
struct net_pkt *pkt,
uint8_t len)
634#if defined(CONFIG_NET_IP)
635 pkt->ip_hdr_len = len;
644#if defined(CONFIG_NET_IP_DSCP_ECN)
653static inline void net_pkt_set_ip_dscp(
struct net_pkt *pkt,
uint8_t dscp)
655#if defined(CONFIG_NET_IP_DSCP_ECN)
665#if defined(CONFIG_NET_IP_DSCP_ECN)
674static inline void net_pkt_set_ip_ecn(
struct net_pkt *pkt,
uint8_t ecn)
676#if defined(CONFIG_NET_IP_DSCP_ECN)
689static inline void net_pkt_set_eof(
struct net_pkt *pkt,
bool eof)
694static inline bool net_pkt_forwarding(
struct net_pkt *pkt)
696 return !!(pkt->forwarding);
699static inline void net_pkt_set_forwarding(
struct net_pkt *pkt,
bool forward)
701 pkt->forwarding = forward;
704#if defined(CONFIG_NET_IPV4)
707 return pkt->ipv4_ttl;
710static inline void net_pkt_set_ipv4_ttl(
struct net_pkt *pkt,
718 return pkt->ipv4_opts_len;
721static inline void net_pkt_set_ipv4_opts_len(
struct net_pkt *pkt,
724 pkt->ipv4_opts_len = opts_len;
734static inline void net_pkt_set_ipv4_ttl(
struct net_pkt *pkt,
747static inline void net_pkt_set_ipv4_opts_len(
struct net_pkt *pkt,
751 ARG_UNUSED(opts_len);
755#if defined(CONFIG_NET_IPV6)
756static inline uint8_t net_pkt_ipv6_ext_opt_len(
struct net_pkt *pkt)
758 return pkt->ipv6_ext_opt_len;
761static inline void net_pkt_set_ipv6_ext_opt_len(
struct net_pkt *pkt,
764 pkt->ipv6_ext_opt_len = len;
769 return pkt->ipv6_next_hdr;
772static inline void net_pkt_set_ipv6_next_hdr(
struct net_pkt *pkt,
775 pkt->ipv6_next_hdr = next_hdr;
780 return pkt->ipv6_ext_len;
783static inline void net_pkt_set_ipv6_ext_len(
struct net_pkt *pkt,
uint16_t len)
785 pkt->ipv6_ext_len = len;
790 return pkt->ipv6_prev_hdr_start;
793static inline void net_pkt_set_ipv6_hdr_prev(
struct net_pkt *pkt,
796 pkt->ipv6_prev_hdr_start = offset;
801 return pkt->ipv6_hop_limit;
804static inline void net_pkt_set_ipv6_hop_limit(
struct net_pkt *pkt,
807 pkt->ipv6_hop_limit = hop_limit;
810static inline uint8_t net_pkt_ipv6_ext_opt_len(
struct net_pkt *pkt)
817static inline void net_pkt_set_ipv6_ext_opt_len(
struct net_pkt *pkt,
831static inline void net_pkt_set_ipv6_next_hdr(
struct net_pkt *pkt,
835 ARG_UNUSED(next_hdr);
845static inline void net_pkt_set_ipv6_ext_len(
struct net_pkt *pkt,
uint16_t len)
858static inline void net_pkt_set_ipv6_hdr_prev(
struct net_pkt *pkt,
872static inline void net_pkt_set_ipv6_hop_limit(
struct net_pkt *pkt,
876 ARG_UNUSED(hop_limit);
882#if defined(CONFIG_NET_IPV6)
883 return pkt->ipv6_ext_len;
884#elif defined(CONFIG_NET_IPV4)
885 return pkt->ipv4_opts_len;
893#if defined(CONFIG_NET_IPV4_PMTU)
894static inline bool net_pkt_ipv4_pmtu(
struct net_pkt *pkt)
896 return !!pkt->ipv4_pmtu;
899static inline void net_pkt_set_ipv4_pmtu(
struct net_pkt *pkt,
bool value)
901 pkt->ipv4_pmtu = value;
904static inline bool net_pkt_ipv4_pmtu(
struct net_pkt *pkt)
911static inline void net_pkt_set_ipv4_pmtu(
struct net_pkt *pkt,
bool value)
918#if defined(CONFIG_NET_IPV4_ROUTE)
919static inline const struct net_in_addr *net_pkt_ipv4_ll_resolve_addr(
struct net_pkt *pkt)
921 return pkt->ipv4_ll_resolve_addr_set ? &pkt->ipv4_ll_resolve_addr :
NULL;
924static inline void net_pkt_set_ipv4_ll_resolve_addr(
struct net_pkt *pkt,
929 pkt->ipv4_ll_resolve_addr_set = 1U;
931 pkt->ipv4_ll_resolve_addr_set = 0U;
935static inline const struct net_in_addr *net_pkt_ipv4_ll_resolve_addr(
struct net_pkt *pkt)
942static inline void net_pkt_set_ipv4_ll_resolve_addr(
struct net_pkt *pkt,
950#if defined(CONFIG_NET_IPV4_FRAGMENT)
951static inline uint16_t net_pkt_ipv4_fragment_offset(
struct net_pkt *pkt)
953 return (pkt->ipv4_fragment.flags & NET_IPV4_FRAGH_OFFSET_MASK) * 8;
956static inline bool net_pkt_ipv4_fragment_more(
struct net_pkt *pkt)
958 return (pkt->ipv4_fragment.flags & NET_IPV4_MORE_FRAG_MASK) != 0;
963 pkt->ipv4_fragment.flags =
flags;
968 return pkt->ipv4_fragment.id;
971static inline void net_pkt_set_ipv4_fragment_id(
struct net_pkt *pkt,
uint32_t id)
973 pkt->ipv4_fragment.id = id;
976static inline uint16_t net_pkt_ipv4_fragment_offset(
struct net_pkt *pkt)
983static inline bool net_pkt_ipv4_fragment_more(
struct net_pkt *pkt)
1003static inline void net_pkt_set_ipv4_fragment_id(
struct net_pkt *pkt,
uint32_t id)
1010#if defined(CONFIG_NET_IPV6_FRAGMENT)
1011static inline uint16_t net_pkt_ipv6_fragment_start(
struct net_pkt *pkt)
1013 return pkt->ipv6_fragment.hdr_start;
1016static inline void net_pkt_set_ipv6_fragment_start(
struct net_pkt *pkt,
1019 pkt->ipv6_fragment.hdr_start = start;
1022static inline uint16_t net_pkt_ipv6_fragment_offset(
struct net_pkt *pkt)
1024 return pkt->ipv6_fragment.flags & NET_IPV6_FRAGH_OFFSET_MASK;
1026static inline bool net_pkt_ipv6_fragment_more(
struct net_pkt *pkt)
1028 return (pkt->ipv6_fragment.flags & 0x01) != 0;
1031static inline void net_pkt_set_ipv6_fragment_flags(
struct net_pkt *pkt,
1034 pkt->ipv6_fragment.flags =
flags;
1039 return pkt->ipv6_fragment.id;
1042static inline void net_pkt_set_ipv6_fragment_id(
struct net_pkt *pkt,
1045 pkt->ipv6_fragment.id = id;
1048static inline uint16_t net_pkt_ipv6_fragment_start(
struct net_pkt *pkt)
1055static inline void net_pkt_set_ipv6_fragment_start(
struct net_pkt *pkt,
1062static inline uint16_t net_pkt_ipv6_fragment_offset(
struct net_pkt *pkt)
1069static inline bool net_pkt_ipv6_fragment_more(
struct net_pkt *pkt)
1076static inline void net_pkt_set_ipv6_fragment_flags(
struct net_pkt *pkt,
1090static inline void net_pkt_set_ipv6_fragment_id(
struct net_pkt *pkt,
1098static inline bool net_pkt_is_loopback(
struct net_pkt *pkt)
1100 return !!(pkt->loopback);
1103static inline void net_pkt_set_loopback(
struct net_pkt *pkt,
1106 pkt->loopback = loopback;
1109#if defined(CONFIG_NET_IP_FRAGMENT)
1110static inline bool net_pkt_is_ip_reassembled(
struct net_pkt *pkt)
1112 return !!(pkt->ip_reassembled);
1115static inline void net_pkt_set_ip_reassembled(
struct net_pkt *pkt,
1118 pkt->ip_reassembled = reassembled;
1121static inline bool net_pkt_is_ip_reassembled(
struct net_pkt *pkt)
1128static inline void net_pkt_set_ip_reassembled(
struct net_pkt *pkt,
1132 ARG_UNUSED(reassembled);
1138 return pkt->priority;
1141static inline void net_pkt_set_priority(
struct net_pkt *pkt,
1144 pkt->priority = priority;
1147#if defined(CONFIG_NET_CAPTURE_COOKED_MODE)
1148static inline bool net_pkt_is_cooked_mode(
struct net_pkt *pkt)
1150 return pkt->cooked_mode_pkt;
1153static inline void net_pkt_set_cooked_mode(
struct net_pkt *pkt,
bool value)
1155 pkt->cooked_mode_pkt = value;
1158static inline bool net_pkt_is_cooked_mode(
struct net_pkt *pkt)
1165static inline void net_pkt_set_cooked_mode(
struct net_pkt *pkt,
bool value)
1172#if defined(CONFIG_NET_VLAN)
1178static inline void net_pkt_set_vlan_tag(
struct net_pkt *pkt,
uint16_t tag)
1188static inline void net_pkt_set_vlan_priority(
struct net_pkt *pkt,
1194static inline bool net_pkt_vlan_dei(
struct net_pkt *pkt)
1199static inline void net_pkt_set_vlan_dei(
struct net_pkt *pkt,
bool dei)
1204static inline void net_pkt_set_vlan_tci(
struct net_pkt *pkt,
uint16_t tci)
1206 pkt->vlan_tci = tci;
1211 return pkt->vlan_tci;
1221static inline void net_pkt_set_vlan_tag(
struct net_pkt *pkt,
uint16_t tag)
1234static inline bool net_pkt_vlan_dei(
struct net_pkt *pkt)
1241static inline void net_pkt_set_vlan_dei(
struct net_pkt *pkt,
bool dei)
1254static inline void net_pkt_set_vlan_tci(
struct net_pkt *pkt,
uint16_t tci)
1261#if defined(CONFIG_NET_PKT_TIMESTAMP) || defined(CONFIG_NET_PKT_TXTIME)
1264 return &pkt->timestamp;
1267static inline void net_pkt_set_timestamp(
struct net_pkt *pkt,
1270 pkt->timestamp.second = timestamp->
second;
1271 pkt->timestamp.nanosecond = timestamp->
nanosecond;
1279static inline void net_pkt_set_timestamp_ns(
struct net_pkt *pkt,
net_time_t timestamp)
1291static inline void net_pkt_set_timestamp(
struct net_pkt *pkt,
1295 ARG_UNUSED(timestamp);
1305static inline void net_pkt_set_timestamp_ns(
struct net_pkt *pkt,
net_time_t timestamp)
1308 ARG_UNUSED(timestamp);
1312#if defined(CONFIG_NET_PKT_RXTIME_STATS) || defined(CONFIG_NET_PKT_TXTIME_STATS) || \
1313 defined(CONFIG_TRACING_NET_CORE)
1317 return pkt->create_time;
1320static inline void net_pkt_set_create_time(
struct net_pkt *pkt,
1323 pkt->create_time = create_time;
1333static inline void net_pkt_set_create_time(
struct net_pkt *pkt,
1337 ARG_UNUSED(create_time);
1343#if defined(CONFIG_NET_PKT_TXTIME_STATS_DETAIL) || \
1344 defined(CONFIG_NET_PKT_RXTIME_STATS_DETAIL)
1347 return pkt->detail.stat;
1350static inline int net_pkt_stats_tick_count(
struct net_pkt *pkt)
1352 return pkt->detail.count;
1355static inline void net_pkt_stats_tick_reset(
struct net_pkt *pkt)
1357 memset(&pkt->detail, 0,
sizeof(pkt->detail));
1363 if (pkt->detail.count >= NET_PKT_DETAIL_STATS_COUNT) {
1364 printk(
"ERROR: Detail stats count overflow (%d >= %d)",
1365 pkt->detail.count, NET_PKT_DETAIL_STATS_COUNT);
1369 pkt->detail.stat[pkt->detail.count++] = tick;
1372#define net_pkt_set_tx_stats_tick(pkt, tick) net_pkt_set_stats_tick(pkt, tick)
1373#define net_pkt_set_rx_stats_tick(pkt, tick) net_pkt_set_stats_tick(pkt, tick)
1382static inline int net_pkt_stats_tick_count(
struct net_pkt *pkt)
1389static inline void net_pkt_stats_tick_reset(
struct net_pkt *pkt)
1394static inline void net_pkt_set_stats_tick(
struct net_pkt *pkt,
uint32_t tick)
1400#define net_pkt_set_tx_stats_tick(pkt, tick)
1401#define net_pkt_set_rx_stats_tick(pkt, tick)
1415static inline bool net_pkt_is_empty(
struct net_pkt *pkt)
1422 return &pkt->lladdr_src;
1427 return &pkt->lladdr_dst;
1430static inline void net_pkt_lladdr_swap(
struct net_pkt *pkt)
1435 net_pkt_lladdr_src(pkt)->
addr,
1436 net_pkt_lladdr_src(pkt)->
len);
1438 net_pkt_lladdr_dst(pkt)->
addr,
1439 net_pkt_lladdr_dst(pkt)->
len);
1442 net_pkt_lladdr_src(pkt)->
len);
1445static inline void net_pkt_lladdr_clear(
struct net_pkt *pkt)
1453 return pkt->ll_proto_type;
1458 pkt->ll_proto_type =
type;
1461#if defined(CONFIG_NET_IPV4_ACD)
1462static inline bool net_pkt_ipv4_acd(
struct net_pkt *pkt)
1464 return !!(pkt->ipv4_acd_arp_msg);
1467static inline void net_pkt_set_ipv4_acd(
struct net_pkt *pkt,
1468 bool is_acd_arp_msg)
1470 pkt->ipv4_acd_arp_msg = is_acd_arp_msg;
1473static inline bool net_pkt_ipv4_acd(
struct net_pkt *pkt)
1480static inline void net_pkt_set_ipv4_acd(
struct net_pkt *pkt,
1481 bool is_acd_arp_msg)
1484 ARG_UNUSED(is_acd_arp_msg);
1488#if defined(CONFIG_NET_LLDP)
1489static inline bool net_pkt_is_lldp(
struct net_pkt *pkt)
1491 return !!(pkt->lldp_pkt);
1494static inline void net_pkt_set_lldp(
struct net_pkt *pkt,
bool is_lldp)
1496 pkt->lldp_pkt = is_lldp;
1499static inline bool net_pkt_is_lldp(
struct net_pkt *pkt)
1506static inline void net_pkt_set_lldp(
struct net_pkt *pkt,
bool is_lldp)
1509 ARG_UNUSED(is_lldp);
1513#if defined(CONFIG_NET_L2_PPP)
1514static inline bool net_pkt_is_ppp(
struct net_pkt *pkt)
1516 return !!(pkt->ppp_msg);
1519static inline void net_pkt_set_ppp(
struct net_pkt *pkt,
1522 pkt->ppp_msg = is_ppp_msg;
1525static inline bool net_pkt_is_ppp(
struct net_pkt *pkt)
1532static inline void net_pkt_set_ppp(
struct net_pkt *pkt,
1536 ARG_UNUSED(is_ppp_msg);
1540#if defined(CONFIG_NET_PKT_CONTROL_BLOCK)
1541static inline void *net_pkt_cb(
struct net_pkt *pkt)
1546static inline void *net_pkt_cb(
struct net_pkt *pkt)
1554#define NET_IPV6_HDR(pkt) ((struct net_ipv6_hdr *)net_pkt_ip_data(pkt))
1555#define NET_IPV4_HDR(pkt) ((struct net_ipv4_hdr *)net_pkt_ip_data(pkt))
1557static inline void net_pkt_set_src_ipv6_addr(
struct net_pkt *pkt)
1560 net_pkt_context(pkt)),
1564static inline void net_pkt_set_overwrite(
struct net_pkt *pkt,
bool overwrite)
1566 pkt->overwrite = overwrite;
1569static inline bool net_pkt_is_being_overwritten(
struct net_pkt *pkt)
1571 return !!(pkt->overwrite);
1574#ifdef CONFIG_NET_PKT_FILTER
1576bool net_pkt_filter_send_ok(
struct net_pkt *pkt);
1577bool net_pkt_filter_recv_ok(
struct net_pkt *pkt);
1581static inline bool net_pkt_filter_send_ok(
struct net_pkt *pkt)
1588static inline bool net_pkt_filter_recv_ok(
struct net_pkt *pkt)
1597#if defined(CONFIG_NET_PKT_FILTER) && \
1598 (defined(CONFIG_NET_PKT_FILTER_IPV4_HOOK) || defined(CONFIG_NET_PKT_FILTER_IPV6_HOOK))
1600bool net_pkt_filter_ip_recv_ok(
struct net_pkt *pkt);
1604static inline bool net_pkt_filter_ip_recv_ok(
struct net_pkt *pkt)
1613#if defined(CONFIG_NET_PKT_FILTER) && defined(CONFIG_NET_PKT_FILTER_LOCAL_IN_HOOK)
1615bool net_pkt_filter_local_in_recv_ok(
struct net_pkt *pkt);
1619static inline bool net_pkt_filter_local_in_recv_ok(
struct net_pkt *pkt)
1628#if defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_L2_IPIP)
1631 return &pkt->remote;
1634static inline void net_pkt_set_remote_address(
struct net_pkt *pkt,
1638 memcpy(&pkt->remote, address, len);
1657#define NET_PKT_SLAB_DEFINE(name, count) \
1658 K_MEM_SLAB_DEFINE_TYPE(name, struct net_pkt, count); \
1659 NET_PKT_ALLOC_STATS_DEFINE(pkt_alloc_stats_##name, name)
1664#define NET_PKT_TX_SLAB_DEFINE(name, count) NET_PKT_SLAB_DEFINE(name, count)
1681#define NET_PKT_DATA_POOL_DEFINE(name, count) \
1682 NET_BUF_POOL_DEFINE(name, count, CONFIG_NET_BUF_DATA_SIZE, \
1687#if defined(CONFIG_NET_DEBUG_NET_PKT_ALLOC) || \
1688 (CONFIG_NET_PKT_LOG_LEVEL >= LOG_LEVEL_DBG)
1689#define NET_PKT_DEBUG_ENABLED
1692#if defined(NET_PKT_DEBUG_ENABLED)
1704#define net_pkt_get_reserve_data(pool, min_len, timeout) \
1705 net_pkt_get_reserve_data_debug(pool, min_len, timeout, __func__, __LINE__)
1707struct net_buf *net_pkt_get_reserve_rx_data_debug(
size_t min_len,
1711#define net_pkt_get_reserve_rx_data(min_len, timeout) \
1712 net_pkt_get_reserve_rx_data_debug(min_len, timeout, __func__, __LINE__)
1714struct net_buf *net_pkt_get_reserve_tx_data_debug(
size_t min_len,
1718#define net_pkt_get_reserve_tx_data(min_len, timeout) \
1719 net_pkt_get_reserve_tx_data_debug(min_len, timeout, __func__, __LINE__)
1721struct net_buf *net_pkt_get_frag_debug(
struct net_pkt *pkt,
size_t min_len,
1723 const char *caller,
int line);
1724#define net_pkt_get_frag(pkt, min_len, timeout) \
1725 net_pkt_get_frag_debug(pkt, min_len, timeout, __func__, __LINE__)
1727void net_pkt_unref_debug(
struct net_pkt *pkt,
const char *caller,
int line);
1728#define net_pkt_unref(pkt) net_pkt_unref_debug(pkt, __func__, __LINE__)
1730struct net_pkt *net_pkt_ref_debug(
struct net_pkt *pkt,
const char *caller,
1732#define net_pkt_ref(pkt) net_pkt_ref_debug(pkt, __func__, __LINE__)
1735 const char *caller,
int line);
1736#define net_pkt_frag_ref(frag) net_pkt_frag_ref_debug(frag, __func__, __LINE__)
1738void net_pkt_frag_unref_debug(
struct net_buf *frag,
1739 const char *caller,
int line);
1740#define net_pkt_frag_unref(frag) \
1741 net_pkt_frag_unref_debug(frag, __func__, __LINE__)
1746 const char *caller,
int line);
1747#define net_pkt_frag_del(pkt, parent, frag) \
1748 net_pkt_frag_del_debug(pkt, parent, frag, __func__, __LINE__)
1750void net_pkt_frag_add_debug(
struct net_pkt *pkt,
struct net_buf *frag,
1751 const char *caller,
int line);
1752#define net_pkt_frag_add(pkt, frag) \
1753 net_pkt_frag_add_debug(pkt, frag, __func__, __LINE__)
1755void net_pkt_frag_insert_debug(
struct net_pkt *pkt,
struct net_buf *frag,
1756 const char *caller,
int line);
1757#define net_pkt_frag_insert(pkt, frag) \
1758 net_pkt_frag_insert_debug(pkt, frag, __func__, __LINE__)
1764#if defined(NET_PKT_DEBUG_ENABLED)
1774#define net_pkt_print_frags(pkt)
1777#if !defined(NET_PKT_DEBUG_ENABLED)
1796#if !defined(NET_PKT_DEBUG_ENABLED)
1814#if !defined(NET_PKT_DEBUG_ENABLED)
1832#if !defined(NET_PKT_DEBUG_ENABLED)
1849#if !defined(NET_PKT_DEBUG_ENABLED)
1862#if !defined(NET_PKT_DEBUG_ENABLED)
1875#if !defined(NET_PKT_DEBUG_ENABLED)
1888#if !defined(NET_PKT_DEBUG_ENABLED)
1897#if !defined(NET_PKT_DEBUG_ENABLED)
1913#if !defined(NET_PKT_DEBUG_ENABLED)
1923#if !defined(NET_PKT_DEBUG_ENABLED)
1950 struct k_mem_slab **tx,
1956#if defined(CONFIG_NET_DEBUG_NET_PKT_ALLOC)
1960void net_pkt_print(
void);
1962typedef void (*net_pkt_allocs_cb_t)(
struct net_pkt *pkt,
1964 const char *func_alloc,
1966 const char *func_free,
1971void net_pkt_allocs_foreach(net_pkt_allocs_cb_t cb,
void *
user_data);
1973const char *net_pkt_slab2str(
struct k_mem_slab *slab);
1974const char *net_pkt_pool2str(
struct net_buf_pool *pool);
1977#define net_pkt_print(...)
1983#if defined(NET_PKT_DEBUG_ENABLED)
1986 const char *caller,
int line);
1987#define net_pkt_alloc(_timeout) \
1988 net_pkt_alloc_debug(_timeout, __func__, __LINE__)
1990struct net_pkt *net_pkt_alloc_from_slab_debug(
struct k_mem_slab *
slab,
1992 const char *caller,
int line);
1993#define net_pkt_alloc_from_slab(_slab, _timeout) \
1994 net_pkt_alloc_from_slab_debug(_slab, _timeout, __func__, __LINE__)
1997 const char *caller,
int line);
1998#define net_pkt_rx_alloc(_timeout) \
1999 net_pkt_rx_alloc_debug(_timeout, __func__, __LINE__)
2005#define net_pkt_alloc_on_iface(_iface, _timeout) \
2006 net_pkt_alloc_on_iface_debug(_iface, _timeout, __func__, __LINE__)
2012#define net_pkt_rx_alloc_on_iface(_iface, _timeout) \
2013 net_pkt_rx_alloc_on_iface_debug(_iface, _timeout, \
2016int net_pkt_alloc_buffer_debug(
struct net_pkt *pkt,
2020 const char *caller,
int line);
2021#define net_pkt_alloc_buffer(_pkt, _size, _proto, _timeout) \
2022 net_pkt_alloc_buffer_debug(_pkt, _size, _proto, _timeout, \
2025int net_pkt_alloc_buffer_raw_debug(
struct net_pkt *pkt,
size_t size,
2027 const char *caller,
int line);
2028#define net_pkt_alloc_buffer_raw(_pkt, _size, _timeout) \
2029 net_pkt_alloc_buffer_raw_debug(_pkt, _size, _timeout, \
2039#define net_pkt_alloc_with_buffer(_iface, _size, _family, \
2041 net_pkt_alloc_with_buffer_debug(_iface, _size, _family, \
2052#define net_pkt_rx_alloc_with_buffer(_iface, _size, _family, \
2054 net_pkt_rx_alloc_with_buffer_debug(_iface, _size, _family, \
2058int net_pkt_alloc_buffer_with_reserve_debug(
struct net_pkt *pkt,
2065#define net_pkt_alloc_buffer_with_reserve(_pkt, _size, _reserve, _proto, _timeout) \
2066 net_pkt_alloc_buffer_with_reserve_debug(_pkt, _size, _reserve, _proto, \
2067 _timeout, __func__, __LINE__)
2072#if !defined(NET_PKT_DEBUG_ENABLED)
2086#if !defined(NET_PKT_DEBUG_ENABLED)
2105#if !defined(NET_PKT_DEBUG_ENABLED)
2119#if !defined(NET_PKT_DEBUG_ENABLED)
2140#if !defined(NET_PKT_DEBUG_ENABLED)
2162#if !defined(NET_PKT_DEBUG_ENABLED)
2180#if !defined(NET_PKT_DEBUG_ENABLED)
2205#if !defined(NET_PKT_DEBUG_ENABLED)
2316 struct net_pkt_cursor *backup)
2318 backup->buf = pkt->
cursor.buf;
2319 backup->pos = pkt->
cursor.pos;
2329 struct net_pkt_cursor *backup)
2331 pkt->
cursor.buf = backup->buf;
2332 pkt->
cursor.pos = backup->pos;
2741struct net_pkt_data_access {
2742#if !defined(CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS)
2748#if defined(CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS)
2749#define NET_PKT_DATA_ACCESS_DEFINE(_name, _type) \
2750 struct net_pkt_data_access _name = { \
2751 .size = sizeof(_type), \
2754#define NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(_name, _type) \
2755 NET_PKT_DATA_ACCESS_DEFINE(_name, _type)
2758#define NET_PKT_DATA_ACCESS_DEFINE(_name, _type) \
2759 _type _hdr_##_name; \
2760 struct net_pkt_data_access _name = { \
2761 .data = &_hdr_##_name, \
2762 .size = sizeof(_type), \
2765#define NET_PKT_DATA_ACCESS_CONTIGUOUS_DEFINE(_name, _type) \
2766 struct net_pkt_data_access _name = { \
2768 .size = sizeof(_type), \
2789 struct net_pkt_data_access *access);
2805 struct net_pkt_data_access *access);
2812 struct net_pkt_data_access *access)
long atomic_t
Definition atomic_types.h:15
VLAN specific definitions.
uint32_t net_socklen_t
Length of a socket address.
Definition net_ip.h:172
#define net_htonl(x)
Convert 32-bit value from host to network byte order.
Definition net_ip.h:133
#define net_ipaddr_copy(dest, src)
Copy an IPv4 or IPv6 address.
Definition net_ip.h:1064
unsigned short int net_sa_family_t
Socket address family type.
Definition net_ip.h:169
#define net_htons(x)
Convert 16-bit value from host to network byte order.
Definition net_ip.h:125
net_ip_protocol
Protocol numbers from IANA/BSD.
Definition net_ip.h:64
static size_t net_buf_frags_len(const struct net_buf *buf)
Calculate amount of bytes stored in fragments.
Definition net_buf.h:2819
static struct net_if * net_context_get_iface(struct net_context *context)
Get network interface for this context.
Definition net_context.h:752
static struct net_linkaddr * net_if_get_link_addr(struct net_if *iface)
Get an network interface's link address.
Definition net_if.h:1271
static const struct net_in6_addr * net_if_ipv6_select_src_addr(struct net_if *iface, const struct net_in6_addr *dst)
Get a IPv6 source address that should be used when sending network data to destination.
Definition net_if.h:2271
static int net_linkaddr_clear(struct net_linkaddr *lladdr)
Clear link address.
Definition net_linkaddr.h:209
void net_pkt_frag_add(struct net_pkt *pkt, struct net_buf *frag)
Add a fragment to a packet at the end of its fragment list.
static int net_pkt_write_be32(struct net_pkt *pkt, uint32_t data)
Write a uint32_t big endian data to a net_pkt.
Definition net_pkt.h:2611
int net_pkt_alloc_buffer_with_reserve(struct net_pkt *pkt, size_t size, size_t reserve, enum net_ip_protocol proto, k_timeout_t timeout)
Allocate buffer for a net_pkt and reserve some space in the first net_buf.
void net_pkt_cursor_init(struct net_pkt *pkt)
Initialize net_pkt cursor.
int net_pkt_read_le32(struct net_pkt *pkt, uint32_t *data)
Read uint32_t little endian data from a net_pkt.
int net_pkt_skip(struct net_pkt *pkt, size_t length)
Skip some data from a net_pkt.
struct net_pkt * net_pkt_shallow_clone(struct net_pkt *pkt, k_timeout_t timeout)
Clone pkt and increase the refcount of its buffer.
void net_pkt_append_buffer(struct net_pkt *pkt, struct net_buf *buffer)
Append a buffer in packet.
#define net_pkt_print_frags(pkt)
Definition net_pkt.h:1774
int net_pkt_update_length(struct net_pkt *pkt, size_t length)
Update the overall length of a packet.
int net_pkt_pull(struct net_pkt *pkt, size_t length)
Remove data from the start of the packet.
int net_pkt_copy(struct net_pkt *pkt_dst, struct net_pkt *pkt_src, size_t length)
Copy data from a packet into another one.
struct net_pkt * net_pkt_rx_alloc(k_timeout_t timeout)
Allocate an initialized net_pkt for RX.
struct net_pkt * net_pkt_ref(struct net_pkt *pkt)
Increase the packet ref count.
struct net_pkt * net_pkt_alloc_with_buffer(struct net_if *iface, size_t size, net_sa_family_t family, enum net_ip_protocol proto, k_timeout_t timeout)
Allocate a network packet and buffer at once.
int net_pkt_read_be16(struct net_pkt *pkt, uint16_t *data)
Read uint16_t big endian data from a net_pkt.
int net_pkt_alloc_buffer_raw(struct net_pkt *pkt, size_t size, k_timeout_t timeout)
Allocate buffer for a net_pkt, of specified size, w/o any additional preconditions.
void net_pkt_frag_unref(struct net_buf *frag)
Decrease the packet fragment ref count.
struct net_pkt * net_pkt_rx_clone(struct net_pkt *pkt, k_timeout_t timeout)
Clone pkt and its buffer.
struct net_buf * net_pkt_get_reserve_data(struct net_buf_pool *pool, size_t min_len, k_timeout_t timeout)
Get a data buffer from a given pool.
void net_pkt_trim_buffer(struct net_pkt *pkt)
Trim net_pkt buffer.
struct net_pkt * net_pkt_alloc_on_iface(struct net_if *iface, k_timeout_t timeout)
Allocate a network packet for a specific network interface.
void net_pkt_get_info(struct k_mem_slab **rx, struct k_mem_slab **tx, struct net_buf_pool **rx_data, struct net_buf_pool **tx_data)
Get information about predefined RX, TX and DATA pools.
void net_pkt_unref(struct net_pkt *pkt)
Place packet back into the available packets slab.
static int net_pkt_write_be16(struct net_pkt *pkt, uint16_t data)
Write a uint16_t big endian data to a net_pkt.
Definition net_pkt.h:2592
struct net_pkt * net_pkt_alloc(k_timeout_t timeout)
Allocate an initialized net_pkt.
int net_pkt_read(struct net_pkt *pkt, void *data, size_t length)
Read some data from a net_pkt.
static size_t net_pkt_get_len(struct net_pkt *pkt)
Get the total amount of bytes stored in a packet.
Definition net_pkt.h:2672
struct net_buf * net_pkt_frag_del(struct net_pkt *pkt, struct net_buf *parent, struct net_buf *frag)
Delete existing fragment from a packet.
int net_pkt_set_data(struct net_pkt *pkt, struct net_pkt_data_access *access)
Set contiguous data into a network packet.
int net_pkt_read_le64(struct net_pkt *pkt, uint64_t *data)
Read uint64_t little endian data from a net_pkt.
void * net_pkt_get_data(struct net_pkt *pkt, struct net_pkt_data_access *access)
Get data from a network packet in a contiguous way.
static int net_pkt_write_u8(struct net_pkt *pkt, uint8_t data)
Write a byte (uint8_t) data to a net_pkt.
Definition net_pkt.h:2575
size_t net_pkt_available_payload_buffer(struct net_pkt *pkt, enum net_ip_protocol proto)
Get available buffer space for payload from a pkt.
int net_pkt_read_le16(struct net_pkt *pkt, uint16_t *data)
Read uint16_t little endian data from a net_pkt.
int net_pkt_read_be32(struct net_pkt *pkt, uint32_t *data)
Read uint32_t big endian data from a net_pkt.
int net_pkt_remove_tail(struct net_pkt *pkt, size_t length)
Remove length bytes from tail of packet.
struct net_buf * net_pkt_get_reserve_tx_data(size_t min_len, k_timeout_t timeout)
Get TX DATA buffer from pool.
static void * net_pkt_cursor_get_pos(struct net_pkt *pkt)
Returns current position of the cursor.
Definition net_pkt.h:2342
void net_pkt_frag_insert(struct net_pkt *pkt, struct net_buf *frag)
Insert a fragment to a packet at the beginning of its fragment list.
int net_pkt_memset(struct net_pkt *pkt, int byte, size_t length)
Memset some data in a net_pkt.
static void net_pkt_cursor_backup(struct net_pkt *pkt, struct net_pkt_cursor *backup)
Backup net_pkt cursor.
Definition net_pkt.h:2315
void net_pkt_compact(struct net_pkt *pkt)
Compact the fragment list of a packet.
static int net_pkt_acknowledge_data(struct net_pkt *pkt, struct net_pkt_data_access *access)
Acknowledge previously contiguous data taken from a network packet Packet needs to be set to overwrit...
Definition net_pkt.h:2811
static int net_pkt_write_le16(struct net_pkt *pkt, uint16_t data)
Write a uint16_t little endian data to a net_pkt.
Definition net_pkt.h:2649
static void net_pkt_cursor_restore(struct net_pkt *pkt, struct net_pkt_cursor *backup)
Restore net_pkt cursor from a backup.
Definition net_pkt.h:2328
uint16_t net_pkt_get_current_offset(struct net_pkt *pkt)
Get the actual offset in the packet from its cursor.
size_t net_pkt_remaining_data(struct net_pkt *pkt)
Get the amount of data which can be read from current cursor position.
int net_pkt_alloc_buffer(struct net_pkt *pkt, size_t size, enum net_ip_protocol proto, k_timeout_t timeout)
Allocate buffer for a net_pkt.
int net_pkt_write(struct net_pkt *pkt, const void *data, size_t length)
Write data into a net_pkt.
struct net_buf * net_pkt_frag_ref(struct net_buf *frag)
Increase the packet fragment ref count.
size_t net_pkt_available_buffer(struct net_pkt *pkt)
Get available buffer space from a pkt.
struct net_pkt * net_pkt_clone(struct net_pkt *pkt, k_timeout_t timeout)
Clone pkt and its buffer.
struct net_pkt * net_pkt_alloc_from_slab(struct k_mem_slab *slab, k_timeout_t timeout)
Allocate an initialized net_pkt from a specific slab.
static int net_pkt_write_le32(struct net_pkt *pkt, uint32_t data)
Write a uint32_t little endian data to a net_pkt.
Definition net_pkt.h:2630
int net_pkt_read_be64(struct net_pkt *pkt, uint64_t *data)
Read uint64_t big endian data from a net_pkt.
struct net_buf * net_pkt_get_reserve_rx_data(size_t min_len, k_timeout_t timeout)
Get RX DATA buffer from pool.
bool net_pkt_is_contiguous(struct net_pkt *pkt, size_t size)
Check if a data size could fit contiguously.
static int net_pkt_read_u8(struct net_pkt *pkt, uint8_t *data)
Read a byte (uint8_t) from a net_pkt.
Definition net_pkt.h:2459
struct net_buf * net_pkt_get_frag(struct net_pkt *pkt, size_t min_len, k_timeout_t timeout)
Get a data fragment that might be from user specific buffer pool or from global DATA pool.
size_t net_pkt_get_contiguous_len(struct net_pkt *pkt)
Get the contiguous buffer space.
int64_t net_time_t
Any occurrence of net_time_t specifies a concept of nanosecond resolution scalar time span,...
Definition net_time.h:103
static net_time_t net_ptp_time_to_ns(struct net_ptp_time *ts)
Convert a PTP timestamp to a nanosecond precision timestamp, both related to the local network refere...
Definition ptp_time.h:210
static struct net_ptp_time ns_to_net_ptp_time(net_time_t nsec)
Convert a nanosecond precision timestamp to a PTP timestamp, both related to the local network refere...
Definition ptp_time.h:231
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
static uint16_t net_eth_vlan_set_vid(uint16_t tci, uint16_t vid)
Set VLAN identifier to TCI.
Definition ethernet_vlan.h:81
static uint8_t net_eth_vlan_get_dei(uint16_t tci)
Get Drop Eligible Indicator from TCI.
Definition ethernet_vlan.h:56
#define NET_VLAN_TAG_UNSPEC
Unspecified VLAN tag value.
Definition ethernet_vlan.h:32
static uint16_t net_eth_vlan_set_dei(uint16_t tci, bool dei)
Set Drop Eligible Indicator to TCI.
Definition ethernet_vlan.h:94
static uint16_t net_eth_vlan_get_vid(uint16_t tci)
Get VLAN identifier from TCI.
Definition ethernet_vlan.h:44
static uint16_t net_eth_vlan_set_pcp(uint16_t tci, uint8_t pcp)
Set Priority Code Point to TCI.
Definition ethernet_vlan.h:107
static uint8_t net_eth_vlan_get_pcp(uint16_t tci)
Get Priority Code Point from TCI.
Definition ethernet_vlan.h:68
#define NULL
Definition iar_missing_defs.h:20
Packet data common to all IEEE 802.15.4 L2 layers.
Network context definitions.
Network core definitions.
Public API for network interface.
IPv6 and IPv4 definitions.
Public API for network link address.
Representation of nanosecond resolution elapsed time and timestamps in the network stack.
flags
Definition parser.h:97
static void printk(const char *fmt,...)
Print kernel debugging message.
Definition printk.h:51
Public functions for the Precision Time Protocol time specification.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INTPTR_TYPE__ intptr_t
Definition stdint.h:104
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
void * memset(void *buf, int c, size_t n)
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
Kernel timeout type.
Definition clock.h:65
Network buffer pool representation.
Definition net_buf.h:1151
Network buffer representation.
Definition net_buf.h:1015
uint8_t * data
Pointer to the start of data in the buffer.
Definition net_buf.h:1104
uint8_t user_data[]
System metadata for this buffer.
Definition net_buf.h:1125
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1107
Note that we do not store the actual source IP address in the context because the address is already ...
Definition net_context.h:209
Network Interface structure.
Definition net_if.h:735
IPv6 address struct.
Definition net_ip.h:144
IPv4 address struct.
Definition net_ip.h:156
Hardware link address structure.
Definition net_linkaddr.h:83
uint8_t addr[6]
The array of bytes representing the address.
Definition net_linkaddr.h:91
uint8_t type
What kind of address is this for.
Definition net_linkaddr.h:85
uint8_t len
The real length of the ll address.
Definition net_linkaddr.h:88
Network packet.
Definition net_pkt.h:119
struct net_buf * frags
buffer fragment
Definition net_pkt.h:131
struct net_context * context
Network connection context.
Definition net_pkt.h:139
struct net_pkt_cursor cursor
Internal buffer iterator used for reading/writing.
Definition net_pkt.h:136
struct net_if * iface
Network interface.
Definition net_pkt.h:142
intptr_t fifo
The fifo is used by RX/TX threads and by socket layer.
Definition net_pkt.h:124
struct net_buf * buffer
alias to a buffer fragment
Definition net_pkt.h:132
struct k_mem_slab * slab
Slab pointer from where it belongs to.
Definition net_pkt.h:127
(Generalized) Precision Time Protocol Timestamp format.
Definition ptp_time.h:111
uint32_t nanosecond
Nanoseconds.
Definition ptp_time.h:134
uint64_t second
Second value.
Definition ptp_time.h:130
Generic sockaddr struct.
Definition net_ip.h:449
#define sys_cpu_to_le32(val)
Convert 32-bit integer from host endianness to little-endian.
Definition byteorder.h:272
#define sys_cpu_to_le16(val)
Convert 16-bit integer from host endianness to little-endian.
Definition byteorder.h:268