Skip to content
Permalink
Browse files

net: pkt: Add net_pkt_write_le16() helper

We had a big endian helper but little endian one was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Mar 29, 2019
1 parent 7ccc47d commit ddac835ea78ef31ec56f29cae9b09caedc9e283b
Showing with 8 additions and 0 deletions.
  1. +8 −0 include/net/net_pkt.h
@@ -1639,6 +1639,14 @@ static inline int net_pkt_write_le32(struct net_pkt *pkt, u32_t data)
return net_pkt_write(pkt, &data_le32, sizeof(u32_t));
}

/* Write u16_t little endian data into a net_pkt. */
static inline int net_pkt_write_le16(struct net_pkt *pkt, u16_t data)
{
u16_t data_le16 = sys_cpu_to_le16(data);

return net_pkt_write(pkt, &data_le16, sizeof(u16_t));
}

/**
* @brief Get the amount of data which can be read from current cursor position
*

0 comments on commit ddac835

Please sign in to comment.
You can’t perform that action at this time.