net/net_pkt: Fully separate struct net_pkt from struct net_buf

- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/include/net/arp.h b/include/net/arp.h
index a746675..e31a97e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -17,7 +17,7 @@
 
 #include <net/ethernet.h>
 
-#define NET_ARP_BUF(buf) ((struct net_arp_hdr *)net_pkt_ip_data(buf))
+#define NET_ARP_BUF(pkt) ((struct net_arp_hdr *)net_pkt_ip_data(pkt))
 
 struct net_arp_hdr {
 	uint16_t hwtype;		/* HTYPE */
@@ -36,8 +36,8 @@
 #define NET_ARP_REQUEST 1
 #define NET_ARP_REPLY   2
 
-struct net_buf *net_arp_prepare(struct net_buf *buf);
-enum net_verdict net_arp_input(struct net_buf *buf);
+struct net_pkt *net_arp_prepare(struct net_pkt *pkt);
+enum net_verdict net_arp_input(struct net_pkt *pkt);
 
 void net_arp_init(void);
 
diff --git a/include/net/buf.h b/include/net/buf.h
index 55db785..7a65e97 100644
--- a/include/net/buf.h
+++ b/include/net/buf.h
@@ -401,11 +401,6 @@
 		struct net_buf *frags;
 	};
 
-#if defined(CONFIG_NET_TCP)
-	/** List pointer used for TCP retransmit buffering */
-	sys_snode_t sent_list;
-#endif /* CONFIG_NET_TCP */
-
 	/** Reference count. */
 	uint8_t ref;
 
diff --git a/include/net/ethernet.h b/include/net/ethernet.h
index ea1e644..2d46c1f 100644
--- a/include/net/ethernet.h
+++ b/include/net/ethernet.h
@@ -20,7 +20,7 @@
 #include <net/net_pkt.h>
 #include <misc/util.h>
 
-#define NET_ETH_BUF(buf) ((struct net_eth_hdr *)net_pkt_ll(buf))
+#define NET_ETH_BUF(pkt) ((struct net_eth_hdr *)net_pkt_ll(pkt))
 
 #define NET_ETH_PTYPE_ARP		0x0806
 #define NET_ETH_PTYPE_IP		0x0800
diff --git a/include/net/ieee802154_radio.h b/include/net/ieee802154_radio.h
index ee7966e..6d29ccd 100644
--- a/include/net/ieee802154_radio.h
+++ b/include/net/ieee802154_radio.h
@@ -42,9 +42,9 @@
 	/** Set TX power level in dbm */
 	int (*set_txpower)(struct device *dev, int16_t dbm);
 
-	/** Transmit a buffer fragment */
+	/** Transmit a packet fragment */
 	int (*tx)(struct device *dev,
-		  struct net_buf *buf,
+		  struct net_pkt *pkt,
 		  struct net_buf *frag);
 
 	/** Start the device */
@@ -63,12 +63,12 @@
  * @details This function should be used to fill in struct net_if's send pointer.
  *
  * @param iface A valid pointer on a network interface to send from
- * @param buf A valid pointer on a buffer to send
+ * @param pkt A valid pointer on a packet to send
  *
  * @return 0 on success, negative value otherwise
  */
 extern int ieee802154_radio_send(struct net_if *iface,
-				 struct net_buf *buf);
+				 struct net_pkt *pkt);
 
 /**
  * @brief Radio driver ACK handling function that hw drivers should use
@@ -77,12 +77,12 @@
  *          helps to hook direcly the hw drivers to the radio driver.
  *
  * @param iface A valid pointer on a network interface that received the packet
- * @param buf A valid pointer on a buffer to check
+ * @param pkt A valid pointer on a packet to check
  *
  * @return NET_OK if it was handled, NET_CONTINUE otherwise
  */
 extern enum net_verdict ieee802154_radio_handle_ack(struct net_if *iface,
-						    struct net_buf *buf);
+						    struct net_pkt *pkt);
 
 /**
  * @brief Initialize L2 stack for a given interface
diff --git a/include/net/mqtt.h b/include/net/mqtt.h
index d7d55e6..4dd1cd6 100644
--- a/include/net/mqtt.h
+++ b/include/net/mqtt.h
@@ -148,7 +148,7 @@
 	void (*malformed)(struct mqtt_ctx *ctx, uint16_t pkt_type);
 
 	/* Internal use only */
-	int (*rcv)(struct mqtt_ctx *ctx, struct net_buf *);
+	int (*rcv)(struct mqtt_ctx *ctx, struct net_pkt *);
 
 	/** Application type, see: enum mqtt_app */
 	uint8_t app_type;
diff --git a/include/net/net_context.h b/include/net/net_context.h
index 6d02054..927a12a 100644
--- a/include/net/net_context.h
+++ b/include/net/net_context.h
@@ -70,16 +70,16 @@
  * received.
  *
  * @param context The context to use.
- * @param buf Network buffer that is received. If the buf is not NULL,
- * then the callback will own the buffer and it needs to to unref the buf
- * as soon as it has finished working with it.  On EOF, buf will be NULL.
+ * @param pkt Network buffer that is received. If the pkt is not NULL,
+ * then the callback will own the buffer and it needs to to unref the pkt
+ * as soon as it has finished working with it.  On EOF, pkt will be NULL.
  * @param status Value is set to 0 if some data or the connection is
  * at EOF, <0 if there was an error receiving data, in this case the
- * buf parameter is set to NULL.
+ * pkt parameter is set to NULL.
  * @param user_data The user data given in net_recv() call.
  */
 typedef void (*net_context_recv_cb_t)(struct net_context *context,
-				      struct net_buf *buf,
+				      struct net_pkt *pkt,
 				      int status,
 				      void *user_data);
 
@@ -139,6 +139,19 @@
 					 int status,
 					 void *user_data);
 
+/* The net_pkt_get_slab_func_t is here in order to avoid circular
+ * dependency between net_pkt.h and net_context.h
+ */
+/**
+ * @typedef net_pkt_get_slab_func_t
+ *
+ * @brief Function that is called to get the slab that is used
+ * for net_pkt allocations.
+ *
+ * @return Pointer to valid struct k_mem_slab instance.
+ */
+typedef struct k_mem_slab *(*net_pkt_get_slab_func_t)(void);
+
 /* The net_pkt_get_pool_func_t is here in order to avoid circular
  * dependency between net_pkt.h and net_context.h
  */
@@ -200,7 +213,7 @@
 #if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
 	/** Get TX net_buf pool for this context.
 	 */
-	net_pkt_get_pool_func_t tx_pool;
+	net_pkt_get_slab_func_t tx_slab;
 
 	/** Get DATA net_buf pool for this context.
 	 */
@@ -611,7 +624,7 @@
  * net_context_connect().
  * This is similar as BSD send() function.
  *
- * @param buf The network buffer to send.
+ * @param pkt The network buffer to send.
  * @param cb Caller supplied callback function.
  * @param timeout Timeout for the connection. Possible values
  * are K_FOREVER, K_NO_WAIT, >0.
@@ -620,7 +633,7 @@
  *
  * @return 0 if ok, < 0 if error
  */
-int net_context_send(struct net_buf *buf,
+int net_context_send(struct net_pkt *pkt,
 		     net_context_send_cb_t cb,
 		     int32_t timeout,
 		     void *token,
@@ -641,7 +654,7 @@
  * timeout expires.
  * This is similar as BSD sendto() function.
  *
- * @param buf The network buffer to send.
+ * @param pkt The network buffer to send.
  * @param dst_addr Destination address. This will override the address
  * already set in network buffer.
  * @param addrlen Length of the address.
@@ -653,7 +666,7 @@
  *
  * @return 0 if ok, < 0 if error
  */
-int net_context_sendto(struct net_buf *buf,
+int net_context_sendto(struct net_pkt *pkt,
 		       const struct sockaddr *dst_addr,
 		       socklen_t addrlen,
 		       net_context_send_cb_t cb,
@@ -728,21 +741,21 @@
  * @param context Context that will use the given net_buf pools.
  * @param tx_pool Pointer to the function that will return TX pool
  * to the caller. The TX pool is used when sending data to network.
- * There is one TX net_buf for each network packet that is sent.
+ * There is one TX net_pkt for each network packet that is sent.
  * @param data_pool Pointer to the function that will return DATA pool
  * to the caller. The DATA pool is used to store data that is sent to
  * the network.
  */
 #if defined(CONFIG_NET_CONTEXT_NET_PKT_POOL)
 static inline void net_context_setup_pools(struct net_context *context,
-					   net_pkt_get_pool_func_t tx_pool,
+					   net_pkt_get_slab_func_t tx_slab,
 					   net_pkt_get_pool_func_t data_pool)
 {
 	NET_ASSERT(context);
-	NET_ASSERT(tx_pool);
+	NET_ASSERT(tx_slab);
 	NET_ASSERT(data_pool);
 
-	context->tx_pool = tx_pool;
+	context->tx_slab = tx_slab;
 	context->data_pool = data_pool;
 }
 #else
diff --git a/include/net/net_core.h b/include/net/net_core.h
index 8f7beca..f074e34 100644
--- a/include/net/net_core.h
+++ b/include/net/net_core.h
@@ -57,6 +57,7 @@
 #include <kernel.h>
 
 struct net_buf;
+struct net_pkt;
 struct net_context;
 struct net_if;
 
@@ -71,21 +72,21 @@
 };
 
 /* Called by lower network stack when a network packet has been received */
-int net_recv_data(struct net_if *iface, struct net_buf *buf);
+int net_recv_data(struct net_if *iface, struct net_pkt *pkt);
 
 /**
  * @brief Send data to network.
  *
  * @details Send data to network. This should not be used normally by
- * applications as it requires that the buffer and fragments are properly
+ * applications as it requires that the pktfer and fragments are properly
  * constructed.
  *
- * @param buf Network buffer.
+ * @param pkt Network packet.
  *
  * @return 0 if ok, <0 if error. If <0 is returned, then the caller needs
- * to unref the buf in order to avoid buffer leak.
+ * to unref the pkt in order to avoid memory leak.
  */
-int net_send_data(struct net_buf *buf);
+int net_send_data(struct net_pkt *pkt);
 
 struct net_stack_info {
 	char *stack;
diff --git a/include/net/net_if.h b/include/net/net_if.h
index 02046c5..eddffa8 100644
--- a/include/net/net_if.h
+++ b/include/net/net_if.h
@@ -22,7 +22,6 @@
 #include <misc/slist.h>
 
 #include <net/net_core.h>
-#include <net/buf.h>
 #include <net/net_linkaddr.h>
 #include <net/net_ip.h>
 #include <net/net_l2.h>
@@ -315,27 +314,27 @@
 } __net_if_align;
 
 /**
- * @brief Send a buffer through a net iface
+ * @brief Send a packet through a net iface
  *
  * @param iface Pointer to a network interface structure
- * @param buf Pointer on a net buffer to send
+ * @param pkt Pointer on a net packet to send
  *
  * return verdict about the packet
  */
-enum net_verdict net_if_send_data(struct net_if *iface, struct net_buf *buf);
+enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt);
 
 /**
- * @brief Input a buffer through a net iface
+ * @brief Input a packet through a net iface
  *
  * @param iface Pointer to a network interface structure
- * @param buf Pointer on a net buffer to input
+ * @param pkt Pointer on a net packet to input
  *
  * @return verdict about the packet
  */
 static inline enum net_verdict net_if_recv_data(struct net_if *iface,
-						struct net_buf *buf)
+						struct net_pkt *pkt)
 {
-	return iface->l2->recv(iface, buf);
+	return iface->l2->recv(iface, pkt);
 }
 
 /**
@@ -380,11 +379,11 @@
  * @brief Queue a packet into net if's TX queue
  *
  * @param iface Pointer to a network interface structure
- * @param buf Pointer on a net buffer to queue
+ * @param pkt Pointer on a net pktfer to queue
  */
-static inline void net_if_queue_tx(struct net_if *iface, struct net_buf *buf)
+static inline void net_if_queue_tx(struct net_if *iface, struct net_pkt *pkt)
 {
-	net_buf_put(&iface->tx_queue, buf);
+	k_fifo_put(&iface->tx_queue, pkt);
 }
 
 #if defined(CONFIG_NET_OFFLOAD)
@@ -1087,7 +1086,7 @@
  * @brief Define callback that is called after a network packet
  *        has been sent.
  * @param "struct net_if *iface" A pointer on a struct net_if to which the
- *        the net_buf was sent to.
+ *        the net_pkt was sent to.
  * @param "struct net_linkaddr *dst" Link layer address of the destination
  *        where the network packet was sent.
  * @param "int status" Send status, 0 is ok, < 0 error.
@@ -1194,7 +1193,7 @@
 
 struct net_if_api {
 	void (*init)(struct net_if *iface);
-	int (*send)(struct net_if *iface, struct net_buf *buf);
+	int (*send)(struct net_if *iface, struct net_pkt *pkt);
 };
 
 #if defined(CONFIG_NET_DHCPV4)
diff --git a/include/net/net_l2.h b/include/net/net_l2.h
index 236cf71..7a73422 100644
--- a/include/net/net_l2.h
+++ b/include/net/net_l2.h
@@ -25,18 +25,18 @@
 	 * This function is used by net core to get iface's L2 layer parsing
 	 * what's relevant to itself.
 	 */
-	enum net_verdict (*recv)(struct net_if *iface, struct net_buf *buf);
+	enum net_verdict (*recv)(struct net_if *iface, struct net_pkt *pkt);
 
 	/**
-	 * This function is used by net core to push a buffer to lower layer
-	 * (interface's L2), which in turn might work on the buffer relevantly.
+	 * This function is used by net core to push a packet to lower layer
+	 * (interface's L2), which in turn might work on the packet relevantly.
 	 * (adding proper header etc...)
 	 */
-	enum net_verdict (*send)(struct net_if *iface, struct net_buf *buf);
+	enum net_verdict (*send)(struct net_if *iface, struct net_pkt *pkt);
 
 	/**
 	 * This function is used to get the amount of bytes the net core should
-	 * reserve as headroom in a net buffer. Such space is relevant to L2
+	 * reserve as headroom in a net packet. Such space is relevant to L2
 	 * layer only.
 	 */
 	uint16_t (*reserve)(struct net_if *iface, void *data);
diff --git a/include/net/net_offload.h b/include/net/net_offload.h
index d50793a..c957f29 100644
--- a/include/net/net_offload.h
+++ b/include/net/net_offload.h
@@ -70,7 +70,7 @@
 	/**
 	 * This function is called when user wants to send data to peer host.
 	 */
-	int (*send)(struct net_buf *buf,
+	int (*send)(struct net_pkt *pkt,
 		    net_context_send_cb_t cb,
 		    int32_t timeout,
 		    void *token,
@@ -79,7 +79,7 @@
 	/**
 	 * This function is called when user wants to send data to peer host.
 	 */
-	int (*sendto)(struct net_buf *buf,
+	int (*sendto)(struct net_pkt *pkt,
 		      const struct sockaddr *dst_addr,
 		      socklen_t addrlen,
 		      net_context_send_cb_t cb,
@@ -266,13 +266,13 @@
 }
 
 /**
- * @brief Send a network buffer to a peer.
+ * @brief Send a network packet to a peer.
  *
  * @details This function can be used to send network data to a peer
  * connection. This function will return immediately if the timeout
  * is set to K_NO_WAIT. If the timeout is set to K_FOREVER, the function
- * will wait until the network buffer is sent. Timeout value > 0 will
- * wait as many ms. After the network buffer is sent,
+ * will wait until the network packet is sent. Timeout value > 0 will
+ * wait as many ms. After the network packet is sent,
  * a caller supplied callback is called. The callback is called even
  * if timeout was set to K_FOREVER, the callback is called
  * before this function will return in this case. The callback is not
@@ -283,7 +283,7 @@
  *
  * @param iface Network interface where the offloaded IP stack can be
  * reached.
- * @param buf The network buffer to send.
+ * @param pkt The network packet to send.
  * @param cb Caller supplied callback function.
  * @param timeout Timeout for the connection. Possible values
  * are K_FOREVER, K_NO_WAIT, >0.
@@ -293,7 +293,7 @@
  * @return 0 if ok, < 0 if error
  */
 static inline int net_offload_send(struct net_if *iface,
-					 struct net_buf *buf,
+					 struct net_pkt *pkt,
 					 net_context_send_cb_t cb,
 					 int32_t timeout,
 					 void *token,
@@ -303,18 +303,18 @@
 	NET_ASSERT(iface->offload);
 	NET_ASSERT(iface->offload->send);
 
-	return iface->offload->send(buf, cb, timeout, token, user_data);
+	return iface->offload->send(pkt, cb, timeout, token, user_data);
 }
 
 /**
- * @brief Send a network buffer to a peer specified by address.
+ * @brief Send a network packet to a peer specified by address.
  *
  * @details This function can be used to send network data to a peer
  * specified by address. This variant can only be used for datagram
  * connections of type SOCK_DGRAM. This function will return immediately
  * if the timeout is set to K_NO_WAIT. If the timeout is set to K_FOREVER,
- * the function will wait until the network buffer is sent. Timeout
- * value > 0 will wait as many ms. After the network buffer
+ * the function will wait until the network packet is sent. Timeout
+ * value > 0 will wait as many ms. After the network packet
  * is sent, a caller supplied callback is called. The callback is called
  * even if timeout was set to K_FOREVER, the callback is called
  * before this function will return. The callback is not called if the
@@ -323,9 +323,9 @@
  *
  * @param iface Network interface where the offloaded IP stack can be
  * reached.
- * @param buf The network buffer to send.
+ * @param pkt The network packet to send.
  * @param dst_addr Destination address. This will override the address
- * already set in network buffer.
+ * already set in network packet.
  * @param addrlen Length of the address.
  * @param cb Caller supplied callback function.
  * @param timeout Timeout for the connection. Possible values
@@ -336,7 +336,7 @@
  * @return 0 if ok, < 0 if error
  */
 static inline int net_offload_sendto(struct net_if *iface,
-					   struct net_buf *buf,
+					   struct net_pkt *pkt,
 					   const struct sockaddr *dst_addr,
 					   socklen_t addrlen,
 					   net_context_send_cb_t cb,
@@ -348,7 +348,7 @@
 	NET_ASSERT(iface->offload);
 	NET_ASSERT(iface->offload->sendto);
 
-	return iface->offload->sendto(buf, dst_addr, addrlen, cb,
+	return iface->offload->sendto(pkt, dst_addr, addrlen, cb,
 					     timeout, token, user_data);
 }
 
@@ -364,8 +364,8 @@
  * multiple times to register new values.
  * This function will return immediately if the timeout is set to K_NO_WAIT.
  * If the timeout is set to K_FOREVER, the function will wait until the
- * network buffer is received. Timeout value > 0 will wait as many ms.
- * After the network buffer is received, a caller supplied callback is
+ * network packet is received. Timeout value > 0 will wait as many ms.
+ * After the network packet is received, a caller supplied callback is
  * called. The callback is called even if timeout was set to K_FOREVER,
  * the callback is called before this function will return in this case.
  * The callback is not called if the timeout expires. The timeout functionality
diff --git a/include/net/net_pkt.h b/include/net/net_pkt.h
index 877af2b..c33c5a9 100644
--- a/include/net/net_pkt.h
+++ b/include/net/net_pkt.h
@@ -42,6 +42,15 @@
 };
 
 struct net_pkt {
+	/** FIFO uses first 4 bytes itself, reserve space */
+	int _unused;
+
+	/** Slab pointer from where it belongs to */
+	struct k_mem_slab *slab;
+
+	/** List of buffer fragments holding the packet */
+	struct net_buf *frags;
+
 	/** Network connection context */
 	struct net_context *context;
 
@@ -91,387 +100,367 @@
 	uint8_t ip_hdr_len;	/* pre-filled in order to avoid func call */
 	uint8_t ext_len;	/* length of extension headers */
 	uint8_t ext_bitmap;
-	uint8_t net_dir;	/* is this RX or TX buf */
+	uint8_t net_dir;	/* is this RX or TX pkt */
 
 #if defined(CONFIG_NET_IPV6)
 	uint8_t ext_opt_len; /* IPv6 ND option length */
 #endif
 
 #if defined(CONFIG_NET_TCP)
-	bool buf_sent; /* Is this net_buf sent or not */
+	sys_snode_t sent_list;
+	bool sent; /* Is this net_pkt sent or not */
 #endif
 
 #if defined(CONFIG_NET_ROUTE)
-	bool forwarding; /* Are we forwarding this buf */
+	bool forwarding; /* Are we forwarding this pkt */
 #endif
 
 #if defined(CONFIG_NET_L2_IEEE802154)
 	uint8_t ieee802154_rssi;
 #endif
 	/* @endcond */
+
+	/** Reference counter */
+	uint8_t ref;
 };
 
 /** @cond ignore */
 
 
 /* The interface real ll address */
-static inline struct net_linkaddr *net_pkt_ll_if(struct net_buf *buf)
+static inline struct net_linkaddr *net_pkt_ll_if(struct net_pkt *pkt)
 {
-	return net_if_get_link_addr(
-		((struct net_pkt *)net_buf_user_data(buf))->iface);
+	return net_if_get_link_addr(pkt->iface);
 }
 
-static inline struct net_context *net_pkt_context(struct net_buf *buf)
+static inline struct net_context *net_pkt_context(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->context;
+	return pkt->context;
 }
 
-static inline void net_pkt_set_context(struct net_buf *buf,
+static inline void net_pkt_set_context(struct net_pkt *pkt,
 					struct net_context *ctx)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->context = ctx;
+	pkt->context = ctx;
 }
 
-static inline void *net_pkt_token(struct net_buf *buf)
+static inline void *net_pkt_token(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->token;
+	return pkt->token;
 }
 
-static inline void net_pkt_set_token(struct net_buf *buf, void *token)
+static inline void net_pkt_set_token(struct net_pkt *pkt, void *token)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->token = token;
+	pkt->token = token;
 }
 
-static inline struct net_if *net_pkt_iface(struct net_buf *buf)
+static inline struct net_if *net_pkt_iface(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->iface;
+	return pkt->iface;
 }
 
-static inline void net_pkt_set_iface(struct net_buf *buf, struct net_if *iface)
+static inline void net_pkt_set_iface(struct net_pkt *pkt, struct net_if *iface)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->iface = iface;
+	pkt->iface = iface;
 
 	/* If the network interface is set in pkt, then also set the type of
 	 * the network address that is stored in pkt. This is done here so
 	 * that the address type is properly set and is not forgotten.
 	 */
-	((struct net_pkt *)net_buf_user_data(buf))->lladdr_src.type =
-		iface->link_addr.type;
-	((struct net_pkt *)net_buf_user_data(buf))->lladdr_dst.type =
-		iface->link_addr.type;
+	pkt->lladdr_src.type = iface->link_addr.type;
+	pkt->lladdr_dst.type = iface->link_addr.type;
 }
 
-static inline uint8_t net_pkt_family(struct net_buf *buf)
+static inline uint8_t net_pkt_family(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->family;
+	return pkt->family;
 }
 
-static inline void net_pkt_set_family(struct net_buf *buf, uint8_t family)
+static inline void net_pkt_set_family(struct net_pkt *pkt, uint8_t family)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->family = family;
+	pkt->family = family;
 }
 
-static inline uint8_t net_pkt_ip_hdr_len(struct net_buf *buf)
+static inline uint8_t net_pkt_ip_hdr_len(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *) net_buf_user_data(buf))->ip_hdr_len;
+	return pkt->ip_hdr_len;
 }
 
-static inline void net_pkt_set_ip_hdr_len(struct net_buf *buf, uint8_t len)
+static inline void net_pkt_set_ip_hdr_len(struct net_pkt *pkt, uint8_t len)
 {
-	((struct net_pkt *) net_buf_user_data(buf))->ip_hdr_len = len;
+	pkt->ip_hdr_len = len;
 }
 
-static inline uint8_t net_pkt_ext_len(struct net_buf *buf)
+static inline uint8_t net_pkt_ext_len(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->ext_len;
+	return pkt->ext_len;
 }
 
-static inline void net_pkt_set_ext_len(struct net_buf *buf, uint8_t len)
+static inline void net_pkt_set_ext_len(struct net_pkt *pkt, uint8_t len)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ext_len = len;
+	pkt->ext_len = len;
 }
 
-static inline uint8_t net_pkt_ext_bitmap(struct net_buf *buf)
+static inline uint8_t net_pkt_ext_bitmap(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->ext_bitmap;
+	return pkt->ext_bitmap;
 }
 
-static inline void net_pkt_set_ext_bitmap(struct net_buf *buf, uint8_t bm)
+static inline void net_pkt_set_ext_bitmap(struct net_pkt *pkt, uint8_t bm)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ext_bitmap = bm;
+	pkt->ext_bitmap = bm;
 }
 
-static inline void net_pkt_add_ext_bitmap(struct net_buf *buf, uint8_t bm)
+static inline void net_pkt_add_ext_bitmap(struct net_pkt *pkt, uint8_t bm)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ext_bitmap |= bm;
+	pkt->ext_bitmap |= bm;
 }
 
-static inline uint8_t net_pkt_dir(struct net_buf *buf)
+static inline uint8_t net_pkt_dir(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->net_dir;
+	return pkt->net_dir;
 }
 
-static inline void net_pkt_set_dir(struct net_buf *buf, enum net_dir dir)
+static inline void net_pkt_set_dir(struct net_pkt *pkt, enum net_dir dir)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->net_dir = dir;
+	pkt->net_dir = dir;
 }
 
-static inline uint8_t *net_pkt_next_hdr(struct net_buf *buf)
+static inline uint8_t *net_pkt_next_hdr(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->next_hdr;
+	return pkt->next_hdr;
 }
 
-static inline void net_pkt_set_next_hdr(struct net_buf *buf, uint8_t *hdr)
+static inline void net_pkt_set_next_hdr(struct net_pkt *pkt, uint8_t *hdr)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->next_hdr = hdr;
+	pkt->next_hdr = hdr;
 }
 
 #if defined(CONFIG_NET_IPV6)
-static inline uint8_t net_pkt_ext_opt_len(struct net_buf *buf)
+static inline uint8_t net_pkt_ext_opt_len(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->ext_opt_len;
+	return pkt->ext_opt_len;
 }
 
-static inline void net_pkt_set_ext_opt_len(struct net_buf *buf, uint8_t len)
+static inline void net_pkt_set_ext_opt_len(struct net_pkt *pkt, uint8_t len)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ext_opt_len = len;
+	pkt->ext_opt_len = len;
 }
 #endif
 
 #if defined(CONFIG_NET_TCP)
-static inline uint8_t net_pkt_buf_sent(struct net_buf *buf)
+static inline uint8_t net_pkt_sent(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->buf_sent;
+	return pkt->sent;
 }
 
-static inline void net_pkt_set_buf_sent(struct net_buf *buf, bool sent)
+static inline void net_pkt_set_sent(struct net_pkt *pkt, bool sent)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->buf_sent = sent;
+	pkt->sent = sent;
 }
 #endif
 
 #if defined(CONFIG_NET_ROUTE)
-static inline bool net_pkt_forwarding(struct net_buf *buf)
+static inline bool net_pkt_forwarding(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->forwarding;
+	return pkt->forwarding;
 }
 
-static inline void net_pkt_set_forwarding(struct net_buf *buf, bool forward)
+static inline void net_pkt_set_forwarding(struct net_pkt *pkt, bool forward)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->forwarding = forward;
+	pkt->forwarding = forward;
 }
 #else
-static inline bool net_pkt_forwarding(struct net_buf *buf)
+static inline bool net_pkt_forwarding(struct net_pkt *pkt)
 {
 	return false;
 }
 #endif
 
-static inline uint16_t net_pkt_get_len(struct net_buf *buf)
+static inline size_t net_pkt_get_len(struct net_pkt *pkt)
 {
-	return buf->len;
+	return net_buf_frags_len(pkt->frags);
 }
 
-static inline void net_pkt_set_len(struct net_buf *buf, uint16_t len)
+static inline uint8_t *net_pkt_ip_data(struct net_pkt *pkt)
 {
-	buf->len = len;
+	return pkt->frags->data;
 }
 
-static inline uint8_t *net_pkt_ip_data(struct net_buf *buf)
+static inline uint8_t *net_pkt_udp_data(struct net_pkt *pkt)
 {
-	return buf->frags->data;
+	return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
+				 net_pkt_ext_len(pkt)];
 }
 
-static inline uint8_t *net_pkt_udp_data(struct net_buf *buf)
+static inline uint8_t *net_pkt_tcp_data(struct net_pkt *pkt)
 {
-	return &buf->frags->data[net_pkt_ip_hdr_len(buf) +
-				 net_pkt_ext_len(buf)];
+	return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
+				 net_pkt_ext_len(pkt)];
 }
 
-static inline uint8_t *net_pkt_tcp_data(struct net_buf *buf)
+static inline uint8_t *net_pkt_icmp_data(struct net_pkt *pkt)
 {
-	return &buf->frags->data[net_pkt_ip_hdr_len(buf) +
-				 net_pkt_ext_len(buf)];
+	return &pkt->frags->data[net_pkt_ip_hdr_len(pkt) +
+				 net_pkt_ext_len(pkt)];
 }
 
-static inline uint8_t *net_pkt_icmp_data(struct net_buf *buf)
+static inline uint8_t *net_pkt_appdata(struct net_pkt *pkt)
 {
-	return &buf->frags->data[net_pkt_ip_hdr_len(buf) +
-				 net_pkt_ext_len(buf)];
+	return pkt->appdata;
 }
 
-static inline uint8_t *net_pkt_appdata(struct net_buf *buf)
+static inline void net_pkt_set_appdata(struct net_pkt *pkt, uint8_t *data)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->appdata;
+	pkt->appdata = data;
 }
 
-static inline void net_pkt_set_appdata(struct net_buf *buf, uint8_t *data)
+static inline uint16_t net_pkt_appdatalen(struct net_pkt *pkt)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->appdata = data;
+	return pkt->appdatalen;
 }
 
-static inline uint16_t net_pkt_appdatalen(struct net_buf *buf)
+static inline void net_pkt_set_appdatalen(struct net_pkt *pkt, uint16_t len)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->appdatalen;
+	pkt->appdatalen = len;
 }
 
-static inline void net_pkt_set_appdatalen(struct net_buf *buf, uint16_t len)
+static inline uint8_t net_pkt_ll_reserve(struct net_pkt *pkt)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->appdatalen = len;
+	return pkt->ll_reserve;
 }
 
-static inline uint8_t net_pkt_ll_reserve(struct net_buf *buf)
+static inline void net_pkt_set_ll_reserve(struct net_pkt *pkt, uint8_t len)
 {
-	return ((struct net_pkt *) net_buf_user_data(buf))->ll_reserve;
+	pkt->ll_reserve = len;
 }
 
-static inline void net_pkt_set_ll_reserve(struct net_buf *buf, uint8_t len)
+static inline uint8_t *net_pkt_ll(struct net_pkt *pkt)
 {
-	((struct net_pkt *) net_buf_user_data(buf))->ll_reserve = len;
+	return net_pkt_ip_data(pkt) - net_pkt_ll_reserve(pkt);
 }
 
-static inline uint8_t *net_pkt_ll(struct net_buf *buf)
+static inline struct net_linkaddr *net_pkt_ll_src(struct net_pkt *pkt)
 {
-	return net_pkt_ip_data(buf) - net_pkt_ll_reserve(buf);
+	return &pkt->lladdr_src;
 }
 
-static inline struct net_linkaddr *net_pkt_ll_src(struct net_buf *buf)
+static inline struct net_linkaddr *net_pkt_ll_dst(struct net_pkt *pkt)
 {
-	return &((struct net_pkt *)net_buf_user_data(buf))->lladdr_src;
+	return &pkt->lladdr_dst;
 }
 
-static inline struct net_linkaddr *net_pkt_ll_dst(struct net_buf *buf)
+static inline void net_pkt_ll_clear(struct net_pkt *pkt)
 {
-	return &((struct net_pkt *)net_buf_user_data(buf))->lladdr_dst;
+	memset(net_pkt_ll(pkt), 0, net_pkt_ll_reserve(pkt));
+	net_pkt_ll_src(pkt)->addr = NULL;
+	net_pkt_ll_src(pkt)->len = 0;
 }
 
-static inline void net_pkt_ll_clear(struct net_buf *buf)
+static inline void net_pkt_ll_swap(struct net_pkt *pkt)
 {
-	memset(net_pkt_ll(buf), 0, net_pkt_ll_reserve(buf));
-	net_pkt_ll_src(buf)->addr = NULL;
-	net_pkt_ll_src(buf)->len = 0;
-}
+	uint8_t *addr = net_pkt_ll_src(pkt)->addr;
 
-static inline void net_pkt_ll_swap(struct net_buf *buf)
-{
-	uint8_t *addr = net_pkt_ll_src(buf)->addr;
-
-	net_pkt_ll_src(buf)->addr = net_pkt_ll_dst(buf)->addr;
-	net_pkt_ll_dst(buf)->addr = addr;
-}
-
-static inline void net_pkt_copy_user_data(struct net_buf *new,
-					  struct net_buf *orig)
-{
-	memcpy((struct net_pkt *)net_buf_user_data(new),
-	       (struct net_pkt *)net_buf_user_data(orig),
-	       sizeof(struct net_pkt));
+	net_pkt_ll_src(pkt)->addr = net_pkt_ll_dst(pkt)->addr;
+	net_pkt_ll_dst(pkt)->addr = addr;
 }
 
 #if defined(CONFIG_NET_IPV6)
-static inline uint16_t net_pkt_ipv6_hdr_prev(struct net_buf *buf)
+static inline uint16_t net_pkt_ipv6_hdr_prev(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)
-		net_buf_user_data(buf))->ipv6_prev_hdr_start;
+	return pkt->ipv6_prev_hdr_start;
 }
 
-static inline void net_pkt_set_ipv6_hdr_prev(struct net_buf *buf,
+static inline void net_pkt_set_ipv6_hdr_prev(struct net_pkt *pkt,
 					     uint16_t offset)
 {
-	((struct net_pkt *)
-	 net_buf_user_data(buf))->ipv6_prev_hdr_start = offset;
+	pkt->ipv6_prev_hdr_start = offset;
 }
 
-static inline uint8_t net_pkt_ipv6_hop_limit(struct net_buf *buf)
+static inline uint8_t net_pkt_ipv6_hop_limit(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)
-		net_buf_user_data(buf))->ipv6_hop_limit;
+	return pkt->ipv6_hop_limit;
 }
 
-static inline void net_pkt_set_ipv6_hop_limit(struct net_buf *buf,
+static inline void net_pkt_set_ipv6_hop_limit(struct net_pkt *pkt,
 					      uint8_t hop_limit)
 {
-	((struct net_pkt *)
-	 net_buf_user_data(buf))->ipv6_hop_limit = hop_limit;
+	pkt->ipv6_hop_limit = hop_limit;
 }
 #endif
 
 #if defined(CONFIG_NET_IPV6_FRAGMENT)
-static inline uint8_t *net_pkt_ipv6_fragment_start(struct net_buf *buf)
+static inline uint8_t *net_pkt_ipv6_fragment_start(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)
-		net_buf_user_data(buf))->ipv6_frag_hdr_start;
+	return pkt->ipv6_frag_hdr_start;
 }
 
-static inline void net_pkt_set_ipv6_fragment_start(struct net_buf *buf,
+static inline void net_pkt_set_ipv6_fragment_start(struct net_pkt *pkt,
 						   uint8_t *start)
 {
-	((struct net_pkt *)
-	 net_buf_user_data(buf))->ipv6_frag_hdr_start = start;
+	pkt->ipv6_frag_hdr_start = start;
 }
 
-static inline uint16_t net_pkt_ipv6_fragment_offset(struct net_buf *buf)
+static inline uint16_t net_pkt_ipv6_fragment_offset(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)
-		net_buf_user_data(buf))->ipv6_fragment_offset;
+	return pkt->ipv6_fragment_offset;
 }
 
-static inline void net_pkt_set_ipv6_fragment_offset(struct net_buf *buf,
+static inline void net_pkt_set_ipv6_fragment_offset(struct net_pkt *pkt,
 						    uint16_t offset)
 {
-	((struct net_pkt *)
-	 net_buf_user_data(buf))->ipv6_fragment_offset = offset;
+	pkt->ipv6_fragment_offset = offset;
 }
 
-static inline uint32_t net_pkt_ipv6_fragment_id(struct net_buf *buf)
+static inline uint32_t net_pkt_ipv6_fragment_id(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->ipv6_fragment_id;
+	return pkt->ipv6_fragment_id;
 }
 
-static inline void net_pkt_set_ipv6_fragment_id(struct net_buf *buf,
+static inline void net_pkt_set_ipv6_fragment_id(struct net_pkt *pkt,
 						uint32_t id)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ipv6_fragment_id = id;
+	pkt->ipv6_fragment_id = id;
 }
 #endif
 
 #if defined(CONFIG_NET_L2_IEEE802154)
-static inline uint8_t net_pkt_ieee802154_rssi(struct net_buf *buf)
+static inline uint8_t net_pkt_ieee802154_rssi(struct net_pkt *pkt)
 {
-	return ((struct net_pkt *)net_buf_user_data(buf))->ieee802154_rssi;
+	return pkt->ieee802154_rssi;
 }
 
-static inline void net_pkt_set_ieee802154_rssi(struct net_buf *buf,
+static inline void net_pkt_set_ieee802154_rssi(struct net_pkt *pkt,
 						uint8_t rssi)
 {
-	((struct net_pkt *)net_buf_user_data(buf))->ieee802154_rssi = rssi;
+	pkt->ieee802154_rssi = rssi;
 }
 #endif
 
-#define NET_IPV6_BUF(buf) ((struct net_ipv6_hdr *)net_pkt_ip_data(buf))
-#define NET_IPV4_BUF(buf) ((struct net_ipv4_hdr *)net_pkt_ip_data(buf))
-#define NET_ICMP_BUF(buf) ((struct net_icmp_hdr *)net_pkt_icmp_data(buf))
-#define NET_UDP_BUF(buf)  ((struct net_udp_hdr *)(net_pkt_udp_data(buf)))
-#define NET_TCP_BUF(buf)  ((struct net_tcp_hdr *)(net_pkt_tcp_data(buf)))
+#define NET_IPV6_BUF(pkt) ((struct net_ipv6_hdr *)net_pkt_ip_data(pkt))
+#define NET_IPV4_BUF(pkt) ((struct net_ipv4_hdr *)net_pkt_ip_data(pkt))
+#define NET_ICMP_BUF(pkt) ((struct net_icmp_hdr *)net_pkt_icmp_data(pkt))
+#define NET_UDP_BUF(pkt)  ((struct net_udp_hdr *)(net_pkt_udp_data(pkt)))
+#define NET_TCP_BUF(pkt)  ((struct net_tcp_hdr *)(net_pkt_tcp_data(pkt)))
 
-static inline void net_pkt_set_src_ipv6_addr(struct net_buf *buf)
+static inline void net_pkt_set_src_ipv6_addr(struct net_pkt *pkt)
 {
 	net_if_ipv6_select_src_addr(net_context_get_iface(
-					    net_pkt_context(buf)),
-				    &NET_IPV6_BUF(buf)->src);
+					    net_pkt_context(pkt)),
+				    &NET_IPV6_BUF(pkt)->src);
 }
 
 /* @endcond */
 
 /**
- * @brief Create a TX net_buf pool that is used when sending user
+ * @brief Create a TX net_pkt slab that is used when sending user
  * specified data to network.
  *
  * @param name Name of the pool.
- * @param count Number of net_buf in this pool.
+ * @param count Number of net_pkt in this slab.
  */
-#define NET_PKT_TX_POOL_DEFINE(name, count)				\
-	NET_BUF_POOL_DEFINE(name, count, 0, sizeof(struct net_pkt), NULL)
+#define NET_PKT_TX_SLAB_DEFINE(name, count)				\
+	K_MEM_SLAB_DEFINE(name, sizeof(struct net_pkt), count, 4)
 
 /**
  * @brief Create a DATA net_buf pool that is used when sending user
@@ -490,22 +479,32 @@
  * buffer usage.
  */
 
-struct net_buf *net_pkt_get_reserve_debug(struct net_buf_pool *pool,
+struct net_pkt *net_pkt_get_reserve_debug(struct k_mem_slab *slab,
 					  uint16_t reserve_head,
 					  int32_t timeout,
 					  const char *caller,
 					  int line);
-#define net_pkt_get_reserve(pool, reserve_head, timeout)		\
+#define net_pkt_get_reserve(slab, reserve_head, timeout)		\
+	net_pkt_get_reserve_debug(slab, reserve_head, timeout,		\
+				  __func__, __LINE__)
+
+struct net_buf *net_pkt_get_reserve_data_debug(struct net_buf_pool *pool,
+					       uint16_t reserve_head,
+					       int32_t timeout,
+					       const char *caller,
+					       int line);
+
+#define net_pkt_get_reserve_data(pool, reserve_head, timeout)		\
 	net_pkt_get_reserve_debug(pool, reserve_head, timeout,		\
 				  __func__, __LINE__)
 
-struct net_buf *net_pkt_get_rx_debug(struct net_context *context,
+struct net_pkt *net_pkt_get_rx_debug(struct net_context *context,
 				     int32_t timeout,
 				     const char *caller, int line);
 #define net_pkt_get_rx(context, timeout)				\
 	net_pkt_get_rx_debug(context, timeout, __func__, __LINE__)
 
-struct net_buf *net_pkt_get_tx_debug(struct net_context *context,
+struct net_pkt *net_pkt_get_tx_debug(struct net_context *context,
 				     int32_t timeout,
 				     const char *caller, int line);
 #define net_pkt_get_tx(context, timeout)				\
@@ -517,13 +516,13 @@
 #define net_pkt_get_data(context, timeout)				\
 	net_pkt_get_data_debug(context, timeout, __func__, __LINE__)
 
-struct net_buf *net_pkt_get_reserve_rx_debug(uint16_t reserve_head,
+struct net_pkt *net_pkt_get_reserve_rx_debug(uint16_t reserve_head,
 					     int32_t timeout,
 					     const char *caller, int line);
 #define net_pkt_get_reserve_rx(res, timeout)				\
 	net_pkt_get_reserve_rx_debug(res, timeout, __func__, __LINE__)
 
-struct net_buf *net_pkt_get_reserve_tx_debug(uint16_t reserve_head,
+struct net_pkt *net_pkt_get_reserve_tx_debug(uint16_t reserve_head,
 					     int32_t timeout,
 					     const char *caller, int line);
 #define net_pkt_get_reserve_tx(res, timeout)				\
@@ -543,91 +542,109 @@
 #define net_pkt_get_reserve_tx_data(res, timeout)			\
 	net_pkt_get_reserve_tx_data_debug(res, timeout, __func__, __LINE__)
 
-struct net_buf *net_pkt_get_frag_debug(struct net_buf *buf,
+struct net_buf *net_pkt_get_frag_debug(struct net_pkt *pkt,
 				       int32_t timeout,
 				       const char *caller, int line);
-#define net_pkt_get_frag(buf, timeout)					\
-	net_pkt_get_frag_debug(buf, timeout, __func__, __LINE__)
+#define net_pkt_get_frag(pkt, timeout)					\
+	net_pkt_get_frag_debug(pkt, timeout, __func__, __LINE__)
 
-void net_pkt_unref_debug(struct net_buf *buf, const char *caller, int line);
-#define net_pkt_unref(buf) net_pkt_unref_debug(buf, __func__, __LINE__)
+void net_pkt_unref_debug(struct net_pkt *pkt, const char *caller, int line);
+#define net_pkt_unref(pkt) net_pkt_unref_debug(pkt, __func__, __LINE__)
 
-struct net_buf *net_pkt_ref_debug(struct net_buf *buf, const char *caller,
+struct net_pkt *net_pkt_ref_debug(struct net_pkt *pkt, const char *caller,
 				  int line);
-#define net_pkt_ref(buf) net_pkt_ref_debug(buf, __func__, __LINE__)
+#define net_pkt_ref(pkt) net_pkt_ref_debug(pkt, __func__, __LINE__)
 
-struct net_buf *net_pkt_frag_del_debug(struct net_buf *parent,
+struct net_buf *net_pkt_frag_ref_debug(struct net_buf *frag,
+				       const char *caller, int line);
+#define net_pkt_frag_ref(frag) net_pkt_frag_ref_debug(frag, __func__, __LINE__)
+
+void net_pkt_frag_unref_debug(struct net_buf *frag,
+			      const char *caller, int line);
+#define net_pkt_frag_unref(frag)				\
+	net_pkt_frag_unref_debug(frag, __func__, __LINE__)
+
+struct net_buf *net_pkt_frag_del_debug(struct net_pkt *pkt,
+				       struct net_buf *parent,
 				       struct net_buf *frag,
 				       const char *caller, int line);
-#define net_pkt_frag_del(parent, frag)					\
-	net_pkt_frag_del_debug(parent, frag, __func__, __LINE__)
+#define net_pkt_frag_del(pkt, parent, frag)				\
+	net_pkt_frag_del_debug(pkt, parent, frag, __func__, __LINE__)
+
+void net_pkt_frag_add_debug(struct net_pkt *pkt, struct net_buf *frag,
+			    const char *caller, int line);
+#define net_pkt_frag_add(pkt, frag)				\
+	net_pkt_frag_add_debug(pkt, frag, __func__, __LINE__)
+
+void net_pkt_frag_insert_debug(struct net_pkt *pkt, struct net_buf *frag,
+			       const char *caller, int line);
+#define net_pkt_frag_insert(pkt, frag)					\
+	net_pkt_frag_insert_debug(pkt, frag, __func__, __LINE__)
 
 /**
  * @brief Print fragment list and the fragment sizes
  *
  * @details Only available if debugging is activated.
  *
- * @param buf Network buffer fragment. This should be the first fragment (data)
- * in the fragment list.
+ * @param pkt Network pkt.
  */
-void net_pkt_print_frags(struct net_buf *buf);
+void net_pkt_print_frags(struct net_pkt *pkt);
 
 #else /* CONFIG_NET_DEBUG_NET_PKT */
 
 #define net_pkt_print_frags(...)
 
 /**
- * @brief Get buffer from the given buffer pool.
+ * @brief Get packet from the given packet slab.
  *
- * @details Get network buffer from the specific buffer pool.
+ * @details Get network packet from the specific packet slab.
  *
- * @param pool Network buffer pool.
+ * @param slab Network packet slab.
  * @param reserve_head How many bytes to reserve for headroom.
- * @param timeout Affects the action taken should the net buf pool be empty.
+ * @param timeout Affects the action taken should the net pkt slab 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 Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_reserve(struct net_buf_pool *pool,
+struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab,
 				    uint16_t reserve_head,
 				    int32_t timeout);
 
 /**
- * @brief Get buffer from the RX buffers pool.
+ * @brief Get packet from the RX packet slab.
  *
- * @details Get network buffer from RX buffer pool. You must have
+ * @details Get network packet from RX packet slab. You must have
  * network context before able to use this function.
  *
- * @param context Network context that will be related to
- * this buffer.
- * @param timeout Affects the action taken should the net buf pool be empty.
+ * @param context Network context that will be related to this packet.
+ * @param timeout Affects the action taken should the net pkt slab 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 Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_rx(struct net_context *context,
+struct net_pkt *net_pkt_get_rx(struct net_context *context,
 			       int32_t timeout);
 
 /**
- * @brief Get buffer from the TX buffers pool.
+ * @brief Get packet from the TX packets slab.
  *
- * @details Get network buffer from TX buffer pool. You must have
+ * @details Get network packet from TX packet slab. You must have
  * network context before able to use this function.
  *
  * @param context Network context that will be related to
- * this buffer.
- * @param timeout Affects the action taken should the net buf pool be empty.
+ * this packet.
+ * @param timeout Affects the action taken should the net pkt slab 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 Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_tx(struct net_context *context,
+struct net_pkt *net_pkt_get_tx(struct net_context *context,
 			       int32_t timeout);
 
 /**
@@ -649,39 +666,39 @@
 				 int32_t timeout);
 
 /**
- * @brief Get RX buffer from pool but also reserve headroom for
+ * @brief Get RX packet from slab but also reserve headroom for
  * potential headers.
  *
  * @details Normally this version is not useful for applications
  * but is mainly used by network fragmentation code.
  *
  * @param reserve_head How many bytes to reserve for headroom.
- * @param timeout Affects the action taken should the net buf pool be empty.
+ * @param timeout Affects the action taken should the net pkt slab 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 Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_reserve_rx(uint16_t reserve_head,
+struct net_pkt *net_pkt_get_reserve_rx(uint16_t reserve_head,
 				       int32_t timeout);
 
 /**
- * @brief Get TX buffer from pool but also reserve headroom for
+ * @brief Get TX packet from slab but also reserve headroom for
  * potential headers.
  *
  * @details Normally this version is not useful for applications
  * but is mainly used by network fragmentation code.
  *
  * @param reserve_head How many bytes to reserve for headroom.
- * @param timeout Affects the action taken should the net buf pool be empty.
+ * @param timeout Affects the action taken should the net pkt slab 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 Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_reserve_tx(uint16_t reserve_head,
+struct net_pkt *net_pkt_get_reserve_tx(uint16_t reserve_head,
 				       int32_t timeout);
 
 /**
@@ -724,8 +741,7 @@
  * @brief Get a data fragment that might be from user specific
  * buffer pool or from global DATA pool.
  *
- * @param buf Network buffer. This must be the first buffer of the
- *        buffer chain with user data part in it.
+ * @param pkt Network packet.
  * @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
@@ -733,48 +749,85 @@
  *
  * @return Network buffer if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_get_frag(struct net_buf *buf, int32_t timeout);
+struct net_buf *net_pkt_get_frag(struct net_pkt *pkt, int32_t timeout);
 
 /**
- * @brief Place buffer back into the available buffers pool.
+ * @brief Place packet back into the available packets slab
  *
- * @details Releases the buffer to other use. This needs to be
- * called by application after it has finished with
- * the buffer.
+ * @details Releases the packet to other use. This needs to be
+ * called by application after it has finished with the packet.
  *
- * @param buf Network buffer to release.
+ * @param pkt Network packet to release.
  *
  */
-void net_pkt_unref(struct net_buf *buf);
+void net_pkt_unref(struct net_pkt *pkt);
 
 /**
- * @brief Increase the ref count
+ * @brief Increase the packet ref count
  *
- * @details Mark the buffer to be used still.
+ * @details Mark the packet to be used still.
  *
- * @param buf Network buffer to ref.
+ * @param pkt Network packet to ref.
  *
- * @return Network buffer if successful, NULL otherwise.
+ * @return Network packet if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_ref(struct net_buf *buf);
+struct net_pkt *net_pkt_ref(struct net_pkt *pkt);
 
-/** @brief Delete existing fragment from a chain of bufs.
+/**
+ * @brief Increase the packet fragment ref count
  *
- *  @param parent Parent buffer/fragment, or NULL if there is no parent.
- *  @param frag Fragment to delete.
+ * @details Mark the fragment to be used still.
  *
- *  @return Pointer to the buffer following the fragment, or NULL if it
- *          had no further fragments.
+ * @param frag Network fragment to ref.
+ *
+ * @return a pointer on the referenced Network fragment.
  */
-struct net_buf *net_pkt_frag_del(struct net_buf *parent, struct net_buf *frag);
+struct net_buf *net_pkt_frag_ref(struct net_buf *frag);
+
+/**
+ * @brief Decrease the packet fragment ref count
+ *
+ * @param frag Network fragment to unref.
+ */
+void net_pkt_frag_unref(struct net_buf *frag);
+
+/**
+ * @brief Delete existing fragment from a packet
+ *
+ * @param pkt Network packet from which frag belongs to.
+ * @param parent parent fragment of frag, or NULL if none.
+ * @param frag Fragment to delete.
+ *
+ * @return Pointer to the following fragment, or NULL if it had no
+ *         further fragments.
+ */
+struct net_buf *net_pkt_frag_del(struct net_pkt *pkt,
+				 struct net_buf *parent,
+				 struct net_buf *frag);
+
+/**
+ * @brief Add a fragment to a packet at the end of its fragment list
+ *
+ * @param pkt pkt Network packet where to add the fragment
+ * @param frag Fragment to add
+ */
+void net_pkt_frag_add(struct net_pkt *pkt, struct net_buf *frag);
+
+/**
+ * @brief Insert a fragment to a packet at the beginning of its framgment list
+ *
+ * @param pkt pkt Network packet where to insert the fragment
+ * @param frag Fragment to insert
+ */
+void net_pkt_frag_insert(struct net_pkt *pkt, struct net_buf *frag);
 
 #endif /* CONFIG_NET_DEBUG_NET_PKT */
 
 /**
- * @brief Copy a buffer with fragments while reserving some extra space
+ * @brief Copy a packet fragment list while reserving some extra space
  * in destination buffer before a copy.
  *
- * @param buf Network buffer. This should be the head of the buffer chain.
+ * @param pkt Network packet.
  * @param amount Max amount of data to be copied.
  * @param reserve Amount of extra data (this is not link layer header) in the
  * first data fragment that is returned. The function will copy the original
@@ -786,15 +839,14 @@
  *
  * @return New fragment list if successful, NULL otherwise.
  */
-struct net_buf *net_pkt_copy(struct net_buf *buf, size_t amount,
+struct net_buf *net_pkt_copy(struct net_pkt *pkt, size_t amount,
 			     size_t reserve, int32_t timeout);
 
 /**
- * @brief Copy a buffer with fragments while reserving some extra space
+ * @brief Copy a packet fragment list while reserving some extra space
  * in destination buffer before a copy.
  *
- * @param buf Network buffer fragment. This should be the head of the buffer
- * chain.
+ * @param pkt Network packet.
  * @param reserve Amount of extra data (this is not link layer header) in the
  * first data fragment that is returned. The function will copy the original
  * buffer right after the reserved bytes in the first destination fragment.
@@ -805,11 +857,12 @@
  *
  * @return New fragment list if successful, NULL otherwise.
  */
-static inline struct net_buf *net_pkt_copy_all(struct net_buf *buf,
+static inline struct net_buf *net_pkt_copy_all(struct net_pkt *pkt,
 					       size_t reserve,
 					       int32_t timeout)
 {
-	return net_pkt_copy(buf, net_buf_frags_len(buf), reserve, timeout);
+	return net_pkt_copy(pkt, net_buf_frags_len(pkt->frags),
+			    reserve, timeout);
 }
 
 /**
@@ -825,56 +878,27 @@
  * @return 0 on success
  * @return -ENOMEM on error
  */
-int net_pkt_linear_copy(struct net_buf *dst, struct net_buf *src,
-			uint16_t offset, uint16_t len);
+int net_frag_linear_copy(struct net_buf *dst, struct net_buf *src,
+			 uint16_t offset, uint16_t len);
 
 /**
- * @brief Compact the fragment list.
+ * @brief Compact the fragment list of a packet.
  *
  * @details After this there is no more any free space in individual fragments.
- * @param buf Network buffer fragment. This should be the Tx/Rx buffer.
+ * @param pkt Network packet.
  *
- * @return True if compact success, False otherwise. (Note that it fails only
- *         when input is data fragment)
- *
+ * @return True if compact success, False otherwise.
  */
-bool net_pkt_compact(struct net_buf *buf);
+bool net_pkt_compact(struct net_pkt *pkt);
 
 /**
- * @brief Check if the buffer chain is compact or not.
- *
- * @details The compact here means that is there any free space in the
- * fragments. Only the last fragment can have some free space if the fragment
- * list is compact.
- *
- * @param buf Network buffer.
- *
- * @return True if there is no free space in the fragment list,
- * false otherwise.
- */
-bool net_pkt_is_compact(struct net_buf *buf);
-
-/**
- * @brief Remove given amount of data from the beginning of fragment list.
- * This is similar thing to do as in net_buf_pull() but this function changes
- * the fragment list instead of one fragment.
- *
- * @param buf Network buffer fragment list.
- * @param amount Max amount of data to be remove.
- *
- * @return Pointer to start of the fragment list if successful. NULL can be
- * returned if all fragments were removed from the list.
- */
-struct net_buf *net_pkt_pull(struct net_buf *buf, size_t amount);
-
-/**
- * @brief Append data to last fragment in fragment list
+ * @brief Append data to last fragment in fragment list of a packet
  *
  * @details Append data to last fragment. If there is not enough space in
  * last fragment then new data fragment will be created and will be added to
  * fragment list. Caller has to take care of endianness if needed.
  *
- * @param buf Network buffer fragment list.
+ * @param pkt Network packet.
  * @param len Total length of input data
  * @param data Data to be added
  * @param timeout Affects the action taken should the net buf pool be empty.
@@ -883,72 +907,72 @@
  *        number of milliseconds before timing out.
  *
  * @return True if all the data is placed at end of fragment list,
- *         False otherwise (In-case of false buf might contain input
+ *         False otherwise (In-case of false pkt might contain input
  *         data in the process of placing into fragments).
  */
-bool net_pkt_append(struct net_buf *buf, uint16_t len, const uint8_t *data,
+bool net_pkt_append(struct net_pkt *pkt, uint16_t len, const uint8_t *data,
 		    int32_t timeout);
 
 /**
- * @brief Append uint8_t data to last fragment in fragment list
+ * @brief Append uint8_t data to last fragment in fragment list of a packet
  *
  * @details Append data to last fragment. If there is not enough space in last
  * fragment then new data fragment will be created and will be added to
  * fragment list. Caller has to take care of endianness if needed.
  *
- * @param buf Network buffer fragment list.
+ * @param pkt Network packet.
  * @param data Data to be added
  *
  * @return True if all the data is placed at end of fragment list,
- *         False otherwise (In-case of false buf might contain input
+ *         False otherwise (In-case of false pkt might contain input
  *         data in the process of placing into fragments).
  */
-static inline bool net_pkt_append_u8(struct net_buf *buf, uint8_t data)
+static inline bool net_pkt_append_u8(struct net_pkt *pkt, uint8_t data)
 {
-	return net_pkt_append(buf, 1, &data, K_FOREVER);
+	return net_pkt_append(pkt, 1, &data, K_FOREVER);
 }
 
 /**
- * @brief Append uint16_t data to last fragment in fragment list
+ * @brief Append uint16_t data to last fragment in fragment list of a packet
  *
  * @details Append data to last fragment. If there is not enough space in last
  * fragment then new data fragment will be created and will be added to
  * fragment list. Caller has to take care of endianness if needed.
  *
- * @param buf Network buffer fragment list.
+ * @param pkt Network packet.
  * @param data Data to be added
  *
  * @return True if all the data is placed at end of fragment list,
- *         False otherwise (In-case of false buf might contain input data
+ *         False otherwise (In-case of false pkt might contain input data
  *         in the process of placing into fragments).
  */
-static inline bool net_pkt_append_be16(struct net_buf *buf, uint16_t data)
+static inline bool net_pkt_append_be16(struct net_pkt *pkt, uint16_t data)
 {
 	uint16_t value = sys_cpu_to_be16(data);
 
-	return net_pkt_append(buf, sizeof(uint16_t), (uint8_t *)&value,
+	return net_pkt_append(pkt, sizeof(uint16_t), (uint8_t *)&value,
 			      K_FOREVER);
 }
 
 /**
- * @brief Append uint32_t data to last fragment in fragment list
+ * @brief Append uint32_t data to last fragment in fragment list of a packet
  *
  * @details Append data to last fragment. If there is not enough space in last
  * fragment then new data fragment will be created and will be added to
  * fragment list. Caller has to take care of endianness if needed.
  *
- * @param buf Network buffer fragment list.
+ * @param pkt Network packet.
  * @param data Data to be added
  *
  * @return True if all the data is placed at end of fragment list,
- *         False otherwise (In-case of false buf might contain input data
+ *         False otherwise (In-case of false pkt might contain input data
  *         in the process of placing into fragments).
  */
-static inline bool net_pkt_append_be32(struct net_buf *buf, uint32_t data)
+static inline bool net_pkt_append_be32(struct net_pkt *pkt, uint32_t data)
 {
 	uint32_t value = sys_cpu_to_be32(data);
 
-	return net_pkt_append(buf, sizeof(uint32_t), (uint8_t *)&value,
+	return net_pkt_append(pkt, sizeof(uint32_t), (uint8_t *)&value,
 			      K_FOREVER);
 }
 
@@ -959,18 +983,18 @@
  * fragment then new data fragment will be created and will be added to
  * fragment list. Convert data to LE.
  *
- * @param buf Network buffer fragment list.
+ * @param pkt Network packet fragment list.
  * @param data Data to be added
  *
  * @return True if all the data is placed at end of fragment list,
- *         False otherwise (In-case of false buf might contain input data
+ *         False otherwise (In-case of false pkt might contain input data
  *         in the process of placing into fragments).
  */
-static inline bool net_pkt_append_le32(struct net_buf *buf, uint32_t data)
+static inline bool net_pkt_append_le32(struct net_pkt *pkt, uint32_t data)
 {
 	uint32_t value = sys_cpu_to_le32(data);
 
-	return net_pkt_append(buf, sizeof(uint32_t), (uint8_t *)&value,
+	return net_pkt_append(pkt, sizeof(uint32_t), (uint8_t *)&value,
 			      K_FOREVER);
 }
 
@@ -982,7 +1006,7 @@
  * all fragments until it reaches N number of bytes. Caller has to take care of
  * endianness if needed.
  *
- * @param buf Network buffer fragment.
+ * @param frag Network buffer fragment.
  * @param offset Offset of input buffer.
  * @param pos Pointer to position of offset after reading n number of bytes,
  *            this is with respect to return buffer(fragment).
@@ -993,8 +1017,8 @@
  *         NULL and pos is 0 after successful read,
  *         NULL and pos is 0xffff otherwise.
  */
-struct net_buf *net_pkt_read(struct net_buf *buf, uint16_t offset,
-			     uint16_t *pos, uint16_t len, uint8_t *data);
+struct net_buf *net_frag_read(struct net_buf *frag, uint16_t offset,
+			      uint16_t *pos, uint16_t len, uint8_t *data);
 
 /**
  * @brief Skip N number of bytes while reading buffer
@@ -1005,7 +1029,7 @@
  * when unwanted data (e.g. reserved or not supported data in message) is part
  * of fragment and want to skip it.
  *
- * @param buf Network buffer fragment.
+ * @param frag Network buffer fragment.
  * @param offset Offset of input buffer.
  * @param pos Pointer to position of offset after reading n number of bytes,
  *            this is with respect to return buffer(fragment).
@@ -1015,17 +1039,17 @@
  *         NULL and pos is 0 after successful skip,
  *         NULL and pos is 0xffff otherwise.
  */
-static inline struct net_buf *net_pkt_skip(struct net_buf *buf,
-					   uint16_t offset,
-					   uint16_t *pos, uint16_t len)
+static inline struct net_buf *net_frag_skip(struct net_buf *frag,
+					    uint16_t offset,
+					    uint16_t *pos, uint16_t len)
 {
-	return net_pkt_read(buf, offset, pos, len, NULL);
+	return net_frag_read(frag, offset, pos, len, NULL);
 }
 
 /**
  * @brief Get a byte value from fragmented buffer
  *
- * @param buf Network buffer fragment.
+ * @param frag Network buffer fragment.
  * @param offset Offset of input buffer.
  * @param pos Pointer to position of offset after reading 2 bytes,
  *            this is with respect to return buffer(fragment).
@@ -1034,18 +1058,18 @@
  * @return Pointer to fragment after successful read,
  *         NULL otherwise (if pos is 0, NULL is not a failure case).
  */
-static inline struct net_buf *net_pkt_read_u8(struct net_buf *buf,
+static inline struct net_buf *net_frag_read_u8(struct net_buf *frag,
 					      uint16_t offset,
 					      uint16_t *pos,
 					      uint8_t *value)
 {
-	return net_pkt_read(buf, offset, pos, 1, value);
+	return net_frag_read(frag, offset, pos, 1, value);
 }
 
 /**
  * @brief Get 16 bit big endian value from fragmented buffer
  *
- * @param buf Network buffer fragment.
+ * @param frag Network buffer fragment.
  * @param offset Offset of input buffer.
  * @param pos Pointer to position of offset after reading 2 bytes,
  *            this is with respect to return buffer(fragment).
@@ -1054,13 +1078,13 @@
  * @return Pointer to fragment after successful read,
  *         NULL otherwise (if pos is 0, NULL is not a failure case).
  */
-struct net_buf *net_pkt_read_be16(struct net_buf *buf, uint16_t offset,
-				  uint16_t *pos, uint16_t *value);
+struct net_buf *net_frag_read_be16(struct net_buf *frag, uint16_t offset,
+				   uint16_t *pos, uint16_t *value);
 
 /**
  * @brief Get 32 bit big endian value from fragmented buffer
  *
- * @param buf Network buffer fragment.
+ * @param frag Network buffer fragment.
  * @param offset Offset of input buffer.
  * @param pos Pointer to position of offset after reading 4 bytes,
  *            this is with respect to return buffer(fragment).
@@ -1069,11 +1093,11 @@
  * @return Pointer to fragment after successful read,
  *         NULL otherwise (if pos is 0, NULL is not a failure case).
  */
-struct net_buf *net_pkt_read_be32(struct net_buf *buf, uint16_t offset,
-				  uint16_t *pos, uint32_t *value);
+struct net_buf *net_frag_read_be32(struct net_buf *frag, uint16_t offset,
+				   uint16_t *pos, uint32_t *value);
 
 /**
- * @brief Write data to an arbitrary offset in a series of fragments.
+ * @brief Write data to an arbitrary offset in fragments list of a packet.
  *
  * @details Write data to an arbitrary offset in a series of fragments.
  * Offset is based on fragment 'size' and calculates from input fragment
@@ -1090,26 +1114,26 @@
  * 'overwritten'. Use net_pkt_insert() api if you don't want to overwrite.
  *
  * Offset is calculated from starting point of data area in input fragment.
- * e.g. Buf(Tx/Rx) - Frag1 - Frag2 - Frag3 - Frag4
+ * e.g. Pkt(Tx/Rx) - Frag1 - Frag2 - Frag3 - Frag4
  *      (Assume FRAG DATA SIZE is 100 bytes after link layer header)
  *
- *      1) net_pkt_write(buf, frag2, 20, &pos, 20, data, K_FOREVER)
+ *      1) net_pkt_write(pkt, frag2, 20, &pos, 20, data, K_FOREVER)
  *         In this case write starts from "frag2->data + 20",
  *         returns frag2, pos = 40
  *
- *      2) net_pkt_write(buf, frag1, 150, &pos, 60, data, K_FOREVER)
+ *      2) net_pkt_write(pkt, frag1, 150, &pos, 60, data, K_FOREVER)
  *         In this case write starts from "frag2->data + 50"
  *         returns frag3, pos = 10
  *
- *      3) net_pkt_write(buf, frag1, 350, &pos, 30, data, K_FOREVER)
+ *      3) net_pkt_write(pkt, frag1, 350, &pos, 30, data, K_FOREVER)
  *         In this case write starts from "frag4->data + 50"
  *         returns frag4, pos = 80
  *
- *      4) net_pkt_write(buf, frag2, 110, &pos, 90, data, K_FOREVER)
+ *      4) net_pkt_write(pkt, frag2, 110, &pos, 90, data, K_FOREVER)
  *         In this case write starts from "frag3->data + 10"
  *         returns frag4, pos = 0
  *
- *      5) net_pkt_write(buf, frag4, 110, &pos, 20, data, K_FOREVER)
+ *      5) net_pkt_write(pkt, frag4, 110, &pos, 20, data, K_FOREVER)
  *         In this case write creates new data fragment and starts from
  *         "frag5->data + 10"
  *         returns frag5, pos = 30
@@ -1117,7 +1141,7 @@
  * If input argument frag is NULL, it will create new data fragment
  * and append at the end of fragment list.
  *
- * @param buf    Network buffer fragment list.
+ * @param pkt    Network packet.
  * @param frag   Network buffer fragment.
  * @param offset Offset
  * @param pos    Position of offset after write completed (this will be
@@ -1132,23 +1156,23 @@
  * @return Pointer to the fragment and position (*pos) where write ended,
  *         NULL and pos is 0xffff otherwise.
  */
-struct net_buf *net_pkt_write(struct net_buf *buf, struct net_buf *frag,
+struct net_buf *net_pkt_write(struct net_pkt *pkt, struct net_buf *frag,
 			      uint16_t offset, uint16_t *pos, uint16_t len,
 			      uint8_t *data, int32_t timeout);
 
 /* Write uint8_t data to an arbitrary offset in fragment. */
-static inline struct net_buf *net_pkt_write_u8(struct net_buf *buf,
+static inline struct net_buf *net_pkt_write_u8(struct net_pkt *pkt,
 					       struct net_buf *frag,
 					       uint16_t offset,
 					       uint16_t *pos,
 					       uint8_t data)
 {
-	return net_pkt_write(buf, frag, offset, pos, sizeof(uint8_t),
+	return net_pkt_write(pkt, frag, offset, pos, sizeof(uint8_t),
 			     &data, K_FOREVER);
 }
 
 /* Write uint16_t big endian value to an arbitrary offset in fragment. */
-static inline struct net_buf *net_pkt_write_be16(struct net_buf *buf,
+static inline struct net_buf *net_pkt_write_be16(struct net_pkt *pkt,
 						 struct net_buf *frag,
 						 uint16_t offset,
 						 uint16_t *pos,
@@ -1156,12 +1180,12 @@
 {
 	uint16_t value = htons(data);
 
-	return net_pkt_write(buf, frag, offset, pos, sizeof(uint16_t),
+	return net_pkt_write(pkt, frag, offset, pos, sizeof(uint16_t),
 			     (uint8_t *)&value, K_FOREVER);
 }
 
 /* Write uint32_t big endian value to an arbitrary offset in fragment. */
-static inline struct net_buf *net_pkt_write_be32(struct net_buf *buf,
+static inline struct net_buf *net_pkt_write_be32(struct net_pkt *pkt,
 						 struct net_buf *frag,
 						 uint16_t offset,
 						 uint16_t *pos,
@@ -1169,7 +1193,7 @@
 {
 	uint32_t value = htonl(data);
 
-	return net_pkt_write(buf, frag, offset, pos, sizeof(uint32_t),
+	return net_pkt_write(pkt, frag, offset, pos, sizeof(uint32_t),
 			     (uint8_t *)&value, K_FOREVER);
 }
 
@@ -1185,7 +1209,7 @@
  * If the offset is more than already allocated fragments length then it is an
  * error case.
  *
- * @param buf    Network buffer fragment list.
+ * @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.
@@ -1195,48 +1219,47 @@
  *        wait as long as necessary. Otherwise, wait up to the specified
  *        number of milliseconds before timing out.
  *
- * @return True on success,
- *         False otherwise.
+ * @return True on success, False otherwise.
  */
-bool net_pkt_insert(struct net_buf *buf, struct net_buf *frag,
+bool net_pkt_insert(struct net_pkt *pkt, struct net_buf *frag,
 		    uint16_t offset, uint16_t len, uint8_t *data,
 		    int32_t timeout);
 
 /* Insert uint8_t data at an arbitrary offset in a series of fragments. */
-static inline bool net_pkt_insert_u8(struct net_buf *buf,
+static inline bool net_pkt_insert_u8(struct net_pkt *pkt,
 				     struct net_buf *frag,
 				     uint16_t offset,
 				     uint8_t data)
 {
-	return net_pkt_insert(buf, frag, offset, sizeof(uint8_t), &data,
+	return net_pkt_insert(pkt, frag, offset, sizeof(uint8_t), &data,
 			      K_FOREVER);
 }
 
 /* Insert uint16_t big endian value at an arbitrary offset in a series of
  * fragments.
  */
-static inline bool net_pkt_insert_be16(struct net_buf *buf,
+static inline bool net_pkt_insert_be16(struct net_pkt *pkt,
 				       struct net_buf *frag,
 				       uint16_t offset,
 				       uint16_t data)
 {
 	uint16_t value = htons(data);
 
-	return net_pkt_insert(buf, frag, offset, sizeof(uint16_t),
+	return net_pkt_insert(pkt, frag, offset, sizeof(uint16_t),
 			      (uint8_t *)&value, K_FOREVER);
 }
 
 /* Insert uint32_t big endian value at an arbitrary offset in a series of
  * fragments.
  */
-static inline bool net_pkt_insert_be32(struct net_buf *buf,
+static inline bool net_pkt_insert_be32(struct net_pkt *pkt,
 				       struct net_buf *frag,
 				       uint16_t offset,
 				       uint32_t data)
 {
 	uint32_t value = htonl(data);
 
-	return net_pkt_insert(buf, frag, offset, sizeof(uint32_t),
+	return net_pkt_insert(pkt, frag, offset, sizeof(uint32_t),
 			      (uint8_t *)&value, K_FOREVER);
 }
 
@@ -1246,11 +1269,11 @@
  * @details This will generate two new fragments (fragA and fragB) from
  * one (orig_frag). The original fragment is not modified but two new
  * fragments are allocated and returned to the caller. The original fragment
- * must be part of the chain pointed by the buf parameter. If the len parameter
+ * must be part of the packet pointed by the pkt parameter. If the len parameter
  * is larger than the amount of data in the orig fragment, then the fragA will
  * contain all the data and fragB will be empty.
  *
- * @param buf Head of the network buffer fragment list.
+ * @param pkt Network packet
  * @param orig_frag Original network buffer fragment which is to be split.
  * @param len Amount of data in the first returned fragment.
  * @param fragA A fragment is returned. This will contain len bytes that
@@ -1265,7 +1288,7 @@
  *
  * @return 0 on success, <0 otherwise.
  */
-int net_pkt_split(struct net_buf *buf, struct net_buf *orig_frag,
+int net_pkt_split(struct net_pkt *pkt, struct net_buf *orig_frag,
 		  uint16_t len, struct net_buf **fragA,
 		  struct net_buf **fragB, int32_t timeout);
 
@@ -1277,8 +1300,8 @@
  * @param rx_data Pointer to RX DATA pool is returned.
  * @param tx_data Pointer to TX DATA pool is returned.
  */
-void net_pkt_get_info(struct net_buf_pool **rx,
-		      struct net_buf_pool **tx,
+void net_pkt_get_info(struct k_mem_slab **rx,
+		      struct k_mem_slab **tx,
 		      struct net_buf_pool **rx_data,
 		      struct net_buf_pool **tx_data);
 
@@ -1288,7 +1311,8 @@
  */
 void net_pkt_print(void);
 
-typedef void (*net_pkt_allocs_cb_t)(struct net_buf *buf,
+typedef void (*net_pkt_allocs_cb_t)(struct net_pkt *pkt,
+				    struct net_buf *buf,
 				    const char *func_alloc,
 				    int line_alloc,
 				    const char *func_free,
@@ -1298,6 +1322,7 @@
 
 void net_pkt_allocs_foreach(net_pkt_allocs_cb_t cb, void *user_data);
 
+const char *net_pkt_slab2str(struct k_mem_slab *slab);
 const char *net_pkt_pool2str(struct net_buf_pool *pool);
 
 #else
diff --git a/include/net/zoap.h b/include/net/zoap.h
index 472143f..9cc0953 100644
--- a/include/net/zoap.h
+++ b/include/net/zoap.h
@@ -193,7 +193,7 @@
  * @brief Representation of a CoAP packet.
  */
 struct zoap_packet {
-	struct net_buf *buf;
+	struct net_pkt *pkt;
 	uint8_t *start; /* Start of the payload */
 	uint16_t total_size;
 };
@@ -211,7 +211,7 @@
  * @brief Represents a request awaiting for an acknowledgment (ACK).
  */
 struct zoap_pending {
-	struct net_buf *buf;
+	struct net_pkt *pkt;
 	struct sockaddr addr;
 	int32_t timeout;
 	uint16_t id;
@@ -309,35 +309,35 @@
 };
 
 /**
- * @brief Parses the CoAP packet in @a buf, validating it and
- * initializing @a pkt. @a buf must remain valid while @a pkt is used.
+ * @brief Parses the CoAP packet in @a pkt, validating it and
+ * initializing @a zpkt. @a pkt must remain valid while @a zpkt is used.
  *
- * @param pkt Packet to be initialized from received @a buf.
- * @param buf Buffer containing a CoAP packet, its @a data pointer is
+ * @param zpkt Packet to be initialized from received @a pkt.
+ * @param pkt Network Packet containing a CoAP packet, its @a data pointer is
  * positioned on the start of the CoAP packet.
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_packet_parse(struct zoap_packet *pkt, struct net_buf *buf);
+int zoap_packet_parse(struct zoap_packet *zpkt, struct net_pkt *pkt);
 
 /**
- * @brief Creates a new CoAP packet from a net_buf. @a buf must remain
- * valid while @a pkt is used.
+ * @brief Creates a new CoAP packet from a net_pkt. @a pkt must remain
+ * valid while @a zpkt is used.
  *
- * @param pkt New packet to be initialized using the storage from @a
- * buf.
- * @param buf Buffer that will contain a CoAP packet
+ * @param zpkt New packet to be initialized using the storage from @a
+ * pkt.
+ * @param pkt Network Packet that will contain a CoAP packet
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_packet_init(struct zoap_packet *pkt, struct net_buf *buf);
+int zoap_packet_init(struct zoap_packet *zpkt, struct net_pkt *pkt);
 
 /**
  * @brief Initialize a pending request with a request.
  *
  * The request's fields are copied into the pending struct, so @a
  * request doesn't have to live for as long as the pending struct
- * lives, but net_buf needs to live for at least that long.
+ * lives, but net_pkt needs to live for at least that long.
  *
  * @param pending Structure representing the waiting for a
  * confirmation message, initialized with data from @a request
@@ -451,13 +451,13 @@
  * @brief When a request is received, call the appropriate methods of
  * the matching resources.
  *
- * @param pkt Packet received
+ * @param zpkt Packet received
  * @param resources Array of known resources
  * @param from Address from which the packet was received
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_handle_request(struct zoap_packet *pkt,
+int zoap_handle_request(struct zoap_packet *zpkt,
 			struct zoap_resource *resources,
 			const struct sockaddr *from);
 
@@ -487,12 +487,12 @@
  * It will insert the COAP_MARKER (0xFF), if its not set, and return the
  * available size for the payload.
  *
- * @param pkt Packet to get (or insert) the payload
+ * @param zpkt Packet to get (or insert) the payload
  * @param len Amount of space for the payload
  *
  * @return pointer to the start of the payload, NULL in case of error.
  */
-uint8_t *zoap_packet_get_payload(struct zoap_packet *pkt, uint16_t *len);
+uint8_t *zoap_packet_get_payload(struct zoap_packet *zpkt, uint16_t *len);
 
 /**
  * @brief Sets how much space was used by the payload.
@@ -501,26 +501,26 @@
  * update the internal representation with the amount of data that was
  * added to the packet.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param len Amount of data that was added to the payload
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_packet_set_used(struct zoap_packet *pkt, uint16_t len);
+int zoap_packet_set_used(struct zoap_packet *zpkt, uint16_t len);
 
 /**
  * @brief Adds an option to the packet.
  *
  * Note: ptions must be added in numeric order of their codes.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param code Option code to add to the packet, see #zoap_option_num
  * @param value Pointer to the value of the option, will be copied to the packet
  * @param len Size of the data to be added
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_option(struct zoap_packet *pkt, uint16_t code,
+int zoap_add_option(struct zoap_packet *zpkt, uint16_t code,
 		    const void *value, uint16_t len);
 
 /**
@@ -542,20 +542,20 @@
  * The option must be added in numeric order of their codes, and the
  * least amount of bytes will be used to encode the value.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param code Option code to add to the packet, see #zoap_option_num
  * @param val Integer value to be added
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_option_int(struct zoap_packet *pkt, uint16_t code,
+int zoap_add_option_int(struct zoap_packet *zpkt, uint16_t code,
 			unsigned int val);
 
 /**
  * @brief Return the values associated with the option of value @a
  * code.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param code Option number to look for
  * @param options Array of #zoap_option where to store the value
  * of the options found
@@ -564,7 +564,7 @@
  * @return The number of options found in packet matching code,
  * negative on error.
  */
-int zoap_find_options(const struct zoap_packet *pkt, uint16_t code,
+int zoap_find_options(const struct zoap_packet *zpkt, uint16_t code,
 		      struct zoap_option *options, uint16_t veclen);
 
 /**
@@ -624,61 +624,61 @@
 /**
  * @brief Add BLOCK1 option to the packet.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param ctx Block context from which to retrieve the
  * information for the Block1 option
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_block1_option(struct zoap_packet *pkt,
+int zoap_add_block1_option(struct zoap_packet *zpkt,
 			   struct zoap_block_context *ctx);
 
 /**
  * @brief Add BLOCK2 option to the packet.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param ctx Block context from which to retrieve the
  * information for the Block2 option
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_block2_option(struct zoap_packet *pkt,
+int zoap_add_block2_option(struct zoap_packet *zpkt,
 			   struct zoap_block_context *ctx);
 
 /**
  * @brief Add SIZE1 option to the packet.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param ctx Block context from which to retrieve the
  * information for the Size1 option
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_size1_option(struct zoap_packet *pkt,
+int zoap_add_size1_option(struct zoap_packet *zpkt,
 			 struct zoap_block_context *ctx);
 
 /**
  * @brief Add SIZE2 option to the packet.
  *
- * @param pkt Packet to be updated
+ * @param zpkt Packet to be updated
  * @param ctx Block context from which to retrieve the
  * information for the Size2 option
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_add_size2_option(struct zoap_packet *pkt,
+int zoap_add_size2_option(struct zoap_packet *zpkt,
 			 struct zoap_block_context *ctx);
 
 /**
- * @brief Retrieves BLOCK{1,2} and SIZE{1,2} from @a pkt and updates
+ * @brief Retrieves BLOCK{1,2} and SIZE{1,2} from @a zpkt and updates
  * @a ctx accordingly.
  *
- * @param pkt Packet in which to look for block-wise transfers options
+ * @param zpkt Packet in which to look for block-wise transfers options
  * @param ctx Block context to be updated
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_update_from_block(const struct zoap_packet *pkt,
+int zoap_update_from_block(const struct zoap_packet *zpkt,
 			   struct zoap_block_context *ctx);
 
 /**
@@ -696,93 +696,93 @@
 /**
  * @brief Returns the version present in a CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  *
  * @return the CoAP version in packet
  */
-uint8_t zoap_header_get_version(const struct zoap_packet *pkt);
+uint8_t zoap_header_get_version(const struct zoap_packet *zpkt);
 
 /**
  * @brief Returns the type of the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  *
  * @return the type of the packet
  */
-uint8_t zoap_header_get_type(const struct zoap_packet *pkt);
+uint8_t zoap_header_get_type(const struct zoap_packet *zpkt);
 
 /**
  * @brief Returns the token (if any) in the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param len Where to store the length of the token
  *
  * @return pointer to the start of the token in the CoAP packet.
  */
-const uint8_t *zoap_header_get_token(const struct zoap_packet *pkt,
+const uint8_t *zoap_header_get_token(const struct zoap_packet *zpkt,
 				     uint8_t *len);
 
 /**
  * @brief Returns the code of the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  *
  * @return the code present in the packet
  */
-uint8_t zoap_header_get_code(const struct zoap_packet *pkt);
+uint8_t zoap_header_get_code(const struct zoap_packet *zpkt);
 
 /**
  * @brief Returns the message id associated with the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  *
  * @return the message id present in the packet
  */
-uint16_t zoap_header_get_id(const struct zoap_packet *pkt);
+uint16_t zoap_header_get_id(const struct zoap_packet *zpkt);
 
 /**
  * @brief Sets the version of the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param ver The CoAP version to set in the packet
  */
-void zoap_header_set_version(struct zoap_packet *pkt, uint8_t ver);
+void zoap_header_set_version(struct zoap_packet *zpkt, uint8_t ver);
 
 /**
  * @brief Sets the type of the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param type The packet type to set
  */
-void zoap_header_set_type(struct zoap_packet *pkt, uint8_t type);
+void zoap_header_set_type(struct zoap_packet *zpkt, uint8_t type);
 
 /**
  * @brief Sets the token in the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param token Token to set in the packet, will be copied
  * @param tokenlen Size of the token to be set, 8 bytes maximum
  *
  * @return 0 in case of success or negative in case of error.
  */
-int zoap_header_set_token(struct zoap_packet *pkt, const uint8_t *token,
+int zoap_header_set_token(struct zoap_packet *zpkt, const uint8_t *token,
 			  uint8_t tokenlen);
 
 /**
  * @brief Sets the code present in the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param code The code set in the packet
  */
-void zoap_header_set_code(struct zoap_packet *pkt, uint8_t code);
+void zoap_header_set_code(struct zoap_packet *zpkt, uint8_t code);
 
 /**
  * @brief Sets the message id present in the CoAP packet.
  *
- * @param pkt CoAP packet representation
+ * @param zpkt CoAP packet representation
  * @param id The message id to set in the packet
  */
-void zoap_header_set_id(struct zoap_packet *pkt, uint16_t id);
+void zoap_header_set_id(struct zoap_packet *zpkt, uint16_t id);
 
 /**
  * @brief Helper to generate message ids