Skip to content

Commit 1529240

Browse files
Tomasz Bursztykacarlescufi
authored andcommitted
net/pkt: Add a pointer to link-layer data in the structure
This is one of the first steps to get rid of ll_reserve attribute and the related L2 reserve() function. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent c6d5d09 commit 1529240

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

include/net/net_pkt.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct net_pkt {
8080
struct net_ptp_time timestamp;
8181
#endif
8282

83+
u8_t *ll; /* Link Layer Header */
8384
u8_t *appdata; /* application data starts here */
8485
u8_t *next_hdr; /* where is the next header */
8586

@@ -623,9 +624,18 @@ static inline void net_pkt_set_ll_reserve(struct net_pkt *pkt, u8_t len)
623624
pkt->ll_reserve = len;
624625
}
625626

627+
static inline void net_pkt_set_ll(struct net_pkt *pkt, u8_t *data)
628+
{
629+
pkt->ll = data;
630+
}
631+
626632
static inline u8_t *net_pkt_ll(struct net_pkt *pkt)
627633
{
628-
return net_pkt_ip_data(pkt) - net_pkt_ll_reserve(pkt);
634+
if (!pkt->ll) {
635+
return pkt->frags->data;
636+
}
637+
638+
return pkt->ll;
629639
}
630640

631641
static inline struct net_linkaddr *net_pkt_lladdr_src(struct net_pkt *pkt)

0 commit comments

Comments
 (0)