Usage of gnrc_pktbuf_mark

Hello community!

I’m implementing a PPP stack for communication with a GPRS module.

Each PPP frame is different, can carry control data or IP data, and each one has a lot of options and sub options (nested headers, etc). For example, a control frame looks like this:

–HDLC frame–|--LCP header–|LCP_option_1|LCP_option_2|…

Each LCP option have it’s own header too, so you could have 8-9 pktsnips per PPP frame if every LCP option is treated as a pktsnip. I’m using gnrc_pktbuf_mark to mark the HDLC header, the LCP header and each LCP options.

The LCP_options header have “type” and “length” header, so I was thinking in manually parse each option without using gnrc_pktbuf_mark.

As gnrc_pktbuf_mark reallocates memory with each call, which approach do you think is better?


Hi Jose, I think the best approach is to call `gnrc_pktbuf_mark()` as little as possible. Parsing the headers "manually" (you need to do it either way) and mark the whole of the PPP headers as one pktsnip seems to me the better solution. In 6LoWPAN, where the headers are of variable length and nested too we do the same.

Cheers, Martine