net: pkt: Add flag for telling if this is 1st TCP packet
TCP code needs to know whether the pkt is sent the first time or is it a resent one. This information is used when deciding if the pkt ref count needs to be increased or not. The packet does not need to increase ref count when sent first time, as the ref count is already 1 when the pkt is created. But for the 2nd time the packet is sent, we will need to increase the ref count in order to avoid buffer leak. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
08c8dc7e27
commit
78234833a7
|
@ -178,6 +178,13 @@ struct net_pkt {
|
|||
* AF_UNSPEC.
|
||||
*/
|
||||
u8_t ppp_msg : 1; /* This is a PPP message */
|
||||
|
||||
u8_t tcp_first_msg : 1; /* Is this the first time this
|
||||
* pkt is sent, or is this resend
|
||||
* of a TCP message.
|
||||
* Used only if
|
||||
* defined(CONFIG_NET_TCP)
|
||||
*/
|
||||
};
|
||||
|
||||
union {
|
||||
|
@ -354,6 +361,16 @@ static inline void net_pkt_set_queued(struct net_pkt *pkt, bool send)
|
|||
pkt->pkt_queued = send;
|
||||
}
|
||||
|
||||
static inline u8_t net_pkt_tcp_1st_msg(struct net_pkt *pkt)
|
||||
{
|
||||
return pkt->tcp_first_msg;
|
||||
}
|
||||
|
||||
static inline void net_pkt_set_tcp_1st_msg(struct net_pkt *pkt, bool is_1st)
|
||||
{
|
||||
pkt->tcp_first_msg = is_1st;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NET_SOCKETS)
|
||||
static inline u8_t net_pkt_eof(struct net_pkt *pkt)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue