net/pkt: Remove legacy net_pkt_insert functions
These were based on the former allocation scheme and are no longer used.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/include/net/net_pkt.h b/include/net/net_pkt.h
index 180bb54..c453874 100644
--- a/include/net/net_pkt.h
+++ b/include/net/net_pkt.h
@@ -1588,173 +1588,6 @@
u16_t *pos, u32_t *value);
/**
- * @brief Insert data at an arbitrary offset in a series of fragments.
- *
- * @details Insert data at an arbitrary offset in a series of fragments. Offset
- * is based on fragment length (only user written data length, any tailroom
- * in fragments does not come to consideration unlike net_pkt_write()) and
- * calculates from input fragment starting position.
- * If the data pointer is NULL, insert a sequence of zeros with the given
- * length.
- *
- * Offset examples can be considered from net_pkt_write() api.
- * If the offset is more than already allocated fragments length then it is an
- * error case.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param len Length of the data to be inserted.
- * @param data Data to be inserted, can be NULL.
- * @param timeout Affects the action taken should the net buf pool be empty.
- * If K_NO_WAIT, then return immediately. If K_FOREVER, then
- * wait as long as necessary. Otherwise, wait up to the specified
- * number of milliseconds before timing out.
- *
- * @return True on success, False otherwise.
- */
-bool net_pkt_insert(struct net_pkt *pkt, struct net_buf *frag,
- u16_t offset, u16_t len, u8_t *data,
- s32_t timeout);
-
-/**
- * @brief Insert u8_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_u8(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u8_t data)
-{
- return net_pkt_insert(pkt, frag, offset, sizeof(u8_t), &data,
- K_FOREVER);
-}
-
-/**
- * @brief Insert u16_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_be16(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u16_t data)
-{
- u16_t value = htons(data);
-
- return net_pkt_insert(pkt, frag, offset, sizeof(u16_t),
- (u8_t *)&value, K_FOREVER);
-}
-
-/**
- * @brief Insert u32_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_be32(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u32_t data)
-{
- u32_t value = htonl(data);
-
- return net_pkt_insert(pkt, frag, offset, sizeof(u32_t),
- (u8_t *)&value, K_FOREVER);
-}
-
-/**
- * @brief Insert u8_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- * @param timeout Affects the action taken should the net buf pool be empty.
- * If K_NO_WAIT, then return immediately. If K_FOREVER, then
- * wait as long as necessary. Otherwise, wait up to the specified
- * number of milliseconds before timing out.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_u8_timeout(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u8_t data,
- s32_t timeout)
-{
- return net_pkt_insert(pkt, frag, offset, sizeof(u8_t), &data,
- timeout);
-}
-
-/**
- * @brief Insert u16_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- * @param timeout Affects the action taken should the net buf pool be empty.
- * If K_NO_WAIT, then return immediately. If K_FOREVER, then
- * wait as long as necessary. Otherwise, wait up to the specified
- * number of milliseconds before timing out.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_be16_timeout(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u16_t data,
- s32_t timeout)
-{
- u16_t value = htons(data);
-
- return net_pkt_insert(pkt, frag, offset, sizeof(u16_t),
- (u8_t *)&value, timeout);
-}
-
-/**
- * @brief Insert u32_t data at an arbitrary offset in a series of fragments.
- *
- * @param pkt Network packet.
- * @param frag Network buffer fragment.
- * @param offset Offset of fragment where insertion will start.
- * @param data Data to be inserted, can be NULL.
- * @param timeout Affects the action taken should the net buf pool be empty.
- * If K_NO_WAIT, then return immediately. If K_FOREVER, then
- * wait as long as necessary. Otherwise, wait up to the specified
- * number of milliseconds before timing out.
- *
- * @return True on success, False otherwise.
- */
-static inline bool net_pkt_insert_be32_timeout(struct net_pkt *pkt,
- struct net_buf *frag,
- u16_t offset,
- u32_t data,
- s32_t timeout)
-{
- u32_t value = htonl(data);
-
- return net_pkt_insert(pkt, frag, offset, sizeof(u32_t),
- (u8_t *)&value, timeout);
-}
-
-/**
* @brief Return the fragment and offset within it according to network
* packet offset.
*
diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c
index 1fb3538..789532b 100644
--- a/subsys/net/ip/net_pkt.c
+++ b/subsys/net/ip/net_pkt.c
@@ -1217,135 +1217,6 @@
return ret_frag;
}
-static inline bool insert_data(struct net_pkt *pkt, struct net_buf *frag,
- struct net_buf *temp, u16_t offset,
- u16_t len, u8_t *data,
- s32_t timeout)
-{
- struct net_buf *insert;
-
- do {
- u16_t count = MIN(len, net_buf_tailroom(frag));
-
- if (data) {
- /* Copy insert data */
- memcpy(frag->data + offset, data, count);
- } else {
- /* If there is no data, just clear the area */
- (void)memset(frag->data + offset, 0, count);
- }
-
- net_buf_add(frag, count);
-
- len -= count;
- if (len == 0) {
- /* Once insertion is done, then add the data if
- * there is anything after original insertion
- * offset.
- */
- if (temp) {
- net_buf_frag_insert(frag, temp);
- }
-
- /* As we are creating temporary buffers to cache,
- * compact the fragments to save space.
- */
- net_pkt_compact(pkt);
-
- return true;
- }
-
- if (data) {
- data += count;
- }
-
- offset = 0U;
-
- insert = net_pkt_get_frag(pkt, timeout);
- if (!insert) {
- return false;
- }
-
- net_buf_frag_insert(frag, insert);
- frag = insert;
-
- } while (1);
-
- return false;
-}
-
-static inline struct net_buf *adjust_insert_offset(struct net_buf *frag,
- u16_t offset,
- u16_t *pos)
-{
- if (!frag) {
- NET_ERR("Invalid fragment");
- return NULL;
- }
-
- while (frag) {
- if (offset == frag->len) {
- *pos = 0U;
-
- return frag->frags;
- }
-
- if (offset < frag->len) {
- *pos = offset;
-
- return frag;
- }
-
- if (offset > frag->len) {
- if (frag->frags) {
- offset -= frag->len;
- frag = frag->frags;
- } else {
- return NULL;
- }
- }
- }
-
- NET_ERR("Invalid offset, failed to adjust");
-
- return NULL;
-}
-
-bool net_pkt_insert(struct net_pkt *pkt, struct net_buf *frag,
- u16_t offset, u16_t len, u8_t *data,
- s32_t timeout)
-{
- struct net_buf *temp = NULL;
- u16_t bytes;
-
- if (!pkt) {
- return false;
- }
-
- frag = adjust_insert_offset(frag, offset, &offset);
- if (!frag) {
- return false;
- }
-
- /* If there is any data after offset, store in temp fragment and
- * add it after insertion is completed.
- */
- bytes = frag->len - offset;
- if (bytes) {
- temp = net_pkt_get_frag(pkt, timeout);
- if (!temp) {
- return false;
- }
-
- memcpy(net_buf_add(temp, bytes), frag->data + offset, bytes);
-
- frag->len -= bytes;
- }
-
- /* Insert data into current(frag) fragment from "offset". */
- return insert_data(pkt, frag, temp, offset, len, data, timeout);
-}
-
void net_pkt_get_info(struct k_mem_slab **rx,
struct k_mem_slab **tx,
struct net_buf_pool **rx_data,