From 2e331de69089535066e7028d534e30c47c709817 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Fri, 7 Apr 2017 11:46:34 +0200 Subject: [PATCH] net_pkt: Removing legacy net_dir This is actually useless as there is only 1 RX memory slab, and thus can be removed to reduce net_pkt structure size. Change-Id: I62d716515120e7356ee1e2d75bbe1ec32e22c35d Signed-off-by: Tomasz Bursztyka --- include/net/net_pkt.h | 19 ------------------- subsys/net/ip/net_pkt.c | 6 +----- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/include/net/net_pkt.h b/include/net/net_pkt.h index c33c5a9d27f..a06a7e78781 100644 --- a/include/net/net_pkt.h +++ b/include/net/net_pkt.h @@ -33,14 +33,6 @@ extern "C" { struct net_context; -enum net_dir { - /* TX must be first and must have value 0 so that it is selected - * by default. - */ - NET_TX = 0, - NET_RX = 1, -}; - struct net_pkt { /** FIFO uses first 4 bytes itself, reserve space */ int _unused; @@ -100,7 +92,6 @@ struct net_pkt { 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 pkt */ #if defined(CONFIG_NET_IPV6) uint8_t ext_opt_len; /* IPv6 ND option length */ @@ -216,16 +207,6 @@ static inline void net_pkt_add_ext_bitmap(struct net_pkt *pkt, uint8_t bm) pkt->ext_bitmap |= bm; } -static inline uint8_t net_pkt_dir(struct net_pkt *pkt) -{ - return pkt->net_dir; -} - -static inline void net_pkt_set_dir(struct net_pkt *pkt, enum net_dir dir) -{ - pkt->net_dir = dir; -} - static inline uint8_t *net_pkt_next_hdr(struct net_pkt *pkt) { return pkt->next_hdr; diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index de6dfceee1d..53a4bdda011 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -316,10 +316,6 @@ struct net_pkt *net_pkt_get_reserve(struct k_mem_slab *slab, net_pkt_set_ll_reserve(pkt, reserve_head); - if (slab == &rx_pkts) { - net_pkt_set_dir(pkt, NET_RX); - } - pkt->ref = 1; pkt->slab = slab; @@ -406,7 +402,7 @@ struct net_buf *net_pkt_get_frag(struct net_pkt *pkt, } #endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */ - if (net_pkt_dir(pkt) == NET_RX) { + if (pkt->slab == &rx_pkts) { #if defined(CONFIG_NET_DEBUG_NET_PKT) return net_pkt_get_reserve_rx_data_debug( net_pkt_ll_reserve(pkt), timeout, caller, line);