Commit 6a536f9f authored by Marcin Gasiorek's avatar Marcin Gasiorek Committed by Carles Cufi
Browse files

net: Deprecated and unused flags cleanup.

In net_pkt structure couple of flags are no longer used.
Flag pkt_queued can be removed permanently togeter with setter
and getter functions.
Second flag sent_or_eof has been renamed because it is still
used partially only for indicating EOF. Additionally unused setter
and getter for 'sent_' part of this flag are removed.

Signed-off-by: default avatarMarcin Gasiorek <marcin.gasiorek@nordicsemi.no>
parent 646ef0b3
Loading
Loading
Loading
Loading
+3 −32
Changes for include/zephyr/net/net_pkt.h: 3 added lines, 32 removed lines.
Original line number Diff line number Diff line
@@ -151,16 +151,7 @@ struct net_pkt {
#endif

	uint8_t overwrite : 1;	 /* Is packet content being overwritten? */
	uint8_t sent_or_eof : 1; /* For outgoing packet: is this sent or not
				  * For incoming packet of a socket: last
				  * packet before EOF
				  * Used only if defined(CONFIG_NET_TCP)
				  */
	uint8_t pkt_queued : 1;	 /* For outgoing packet: is this packet
				  * queued to be sent but has not reached
				  * the driver yet.
				  * Used only if defined(CONFIG_NET_TCP)
				  */
	uint8_t eof : 1;	 /* Last packet before EOF */
	uint8_t ptp_pkt : 1;	 /* For outgoing packet: is this packet
				  * a L2 PTP packet.
				  * Used only if defined (CONFIG_NET_L2_PTP)
@@ -455,26 +446,6 @@ static inline void net_pkt_set_ip_ecn(struct net_pkt *pkt, uint8_t ecn)
#endif
}

static inline uint8_t net_pkt_sent(struct net_pkt *pkt)
{
	return pkt->sent_or_eof;
}

static inline void net_pkt_set_sent(struct net_pkt *pkt, bool sent)
{
	pkt->sent_or_eof = sent;
}

static inline uint8_t net_pkt_queued(struct net_pkt *pkt)
{
	return pkt->pkt_queued;
}

static inline void net_pkt_set_queued(struct net_pkt *pkt, bool send)
{
	pkt->pkt_queued = send;
}

static inline uint8_t net_pkt_tcp_1st_msg(struct net_pkt *pkt)
{
#if defined(CONFIG_NET_TCP)
@@ -497,12 +468,12 @@ static inline void net_pkt_set_tcp_1st_msg(struct net_pkt *pkt, bool is_1st)
#if defined(CONFIG_NET_SOCKETS)
static inline uint8_t net_pkt_eof(struct net_pkt *pkt)
{
	return pkt->sent_or_eof;
	return pkt->eof;
}

static inline void net_pkt_set_eof(struct net_pkt *pkt, bool eof)
{
	pkt->sent_or_eof = eof;
	pkt->eof = eof;
}
#endif

+0 −9
Changes for subsys/net/ip/ipv4_fragment.c: 0 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -613,15 +613,6 @@ enum net_verdict net_ipv4_prepare_for_send(struct net_pkt *pkt)
				}
			}

			/* We "fake" the sending of the packet here so that
			 * tcp.c:tcp_retry_expired() will increase the ref count when re-sending
			 * the packet. This is crucial to do here and will cause free memory
			 * access if not done.
			 */
			if (IS_ENABLED(CONFIG_NET_TCP)) {
				net_pkt_set_sent(pkt, true);
			}

			/* We need to unref here because we simulate the packet being sent. */
			net_pkt_unref(pkt);

+0 −10
Changes for subsys/net/ip/ipv6_nbr.c: 0 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -807,16 +807,6 @@ enum net_verdict net_ipv6_prepare_for_send(struct net_pkt *pkt)
				}
			}

			/* We "fake" the sending of the packet here so that
			 * tcp.c:tcp_retry_expired() will increase the ref
			 * count when re-sending the packet. This is crucial
			 * thing to do here and will cause free memory access
			 * if not done.
			 */
			if (IS_ENABLED(CONFIG_NET_TCP)) {
				net_pkt_set_sent(pkt, true);
			}

			/* We need to unref here because we simulate the packet
			 * sending.
			 */
+0 −5
Changes for subsys/net/ip/net_if.c: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -249,11 +249,6 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
	context = net_pkt_context(pkt);

	if (net_if_flag_is_set(iface, NET_IF_LOWER_UP)) {
		if (IS_ENABLED(CONFIG_NET_TCP) &&
		    net_pkt_family(pkt) != AF_UNSPEC) {
			net_pkt_set_queued(pkt, false);
		}

		if (IS_ENABLED(CONFIG_NET_PKT_TXTIME_STATS)) {
			pkt_priority = net_pkt_priority(pkt);