net/wrb: add tcp/udp_inqueue_wrb_size() interface
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
011c938116
commit
f52757f90a
@ -94,6 +94,44 @@
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tcp_inqueue_wrb_size
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Get the in-queued write buffer size from connection
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* conn - The TCP connection of interest
|
||||||
|
*
|
||||||
|
* Assumptions:
|
||||||
|
* Called from user logic with the network locked.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static uint32_t tcp_inqueue_wrb_size(FAR struct tcp_conn_s *conn)
|
||||||
|
{
|
||||||
|
FAR struct tcp_wrbuffer_s *wrb;
|
||||||
|
FAR sq_entry_t *entry;
|
||||||
|
uint32_t total = 0;
|
||||||
|
|
||||||
|
if (conn)
|
||||||
|
{
|
||||||
|
for (entry = sq_peek(&conn->unacked_q); entry; entry = sq_next(entry))
|
||||||
|
{
|
||||||
|
wrb = (FAR struct tcp_wrbuffer_s *)entry;
|
||||||
|
total += TCP_WBPKTLEN(wrb);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (entry = sq_peek(&conn->write_q); entry; entry = sq_next(entry))
|
||||||
|
{
|
||||||
|
wrb = (FAR struct tcp_wrbuffer_s *)entry;
|
||||||
|
total += TCP_WBPKTLEN(wrb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: psock_insert_segment
|
* Name: psock_insert_segment
|
||||||
*
|
*
|
||||||
|
@ -105,6 +105,38 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: udp_inqueue_wrb_size
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Get the in-queued write buffer size from connection
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* conn - The UDP connection of interest
|
||||||
|
*
|
||||||
|
* Assumptions:
|
||||||
|
* Called from user logic with the network locked.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static uint32_t udp_inqueue_wrb_size(FAR struct udp_conn_s *conn)
|
||||||
|
{
|
||||||
|
FAR struct udp_wrbuffer_s *wrb;
|
||||||
|
FAR sq_entry_t *entry;
|
||||||
|
uint32_t total = 0;
|
||||||
|
|
||||||
|
if (conn)
|
||||||
|
{
|
||||||
|
for (entry = sq_peek(&conn->write_q); entry; entry = sq_next(entry))
|
||||||
|
{
|
||||||
|
wrb = (FAR struct udp_wrbuffer_s *)entry;
|
||||||
|
total += wrb->wb_iob->io_pktlen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: sendto_writebuffer_release
|
* Name: sendto_writebuffer_release
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user