net: pkt: introduce net_pkt_remove_tail()
Introduce a helper function for being able to remove any arbitrary length from tail of packet. This is handy in cases when removing unneeded data, like CRC once it was verified. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
parent
aedc51aca8
commit
1ce1d19bb5
3 changed files with 132 additions and 1 deletions
|
@ -1705,6 +1705,22 @@ size_t net_pkt_available_payload_buffer(struct net_pkt *pkt,
|
|||
*/
|
||||
void net_pkt_trim_buffer(struct net_pkt *pkt);
|
||||
|
||||
/**
|
||||
* @brief Remove @a length bytes from tail of packet
|
||||
*
|
||||
* @details This function does not take packet cursor into account. It is a
|
||||
* helper to remove unneeded bytes from tail of packet (like appended
|
||||
* CRC). It takes care of buffer deallocation if removed bytes span
|
||||
* whole buffer(s).
|
||||
*
|
||||
* @param pkt Network packet
|
||||
* @param length Number of bytes to be removed
|
||||
*
|
||||
* @retval 0 On success.
|
||||
* @retval -EINVAL If packet length is shorter than @a length.
|
||||
*/
|
||||
int net_pkt_remove_tail(struct net_pkt *pkt, size_t length);
|
||||
|
||||
/**
|
||||
* @brief Initialize net_pkt cursor
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue