net:Support jumbo frame prealloc the iob for the ICMP/UDP/TCP.

For the ICMP, UDP and TCP, pre-alloc an iob for a jumbo frame.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
liqinhui
2024-05-09 15:55:24 +08:00
committed by Alan Carvalho de Assis
parent 45fc68e904
commit 05b101134a
9 changed files with 107 additions and 1 deletions
+4
View File
@@ -546,7 +546,11 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_timedalloc(unsigned int timeout);
****************************************************************************/
#ifdef CONFIG_NET_UDP_WRITE_BUFFERS
#ifdef CONFIG_NET_JUMBO_FRAME
FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(int len);
#else
FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(void);
#endif
#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */
/****************************************************************************
+8
View File
@@ -720,6 +720,13 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
* unlocked here.
*/
#ifdef CONFIG_NET_JUMBO_FRAME
/* alloc iob of gso pkt for udp data */
wrb = udp_wrbuffer_tryalloc(len + udpip_hdrsize(conn) +
CONFIG_NET_LL_GUARDSIZE);
#else
if (nonblock)
{
wrb = udp_wrbuffer_tryalloc();
@@ -729,6 +736,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
wrb = udp_wrbuffer_timedalloc(udp_send_gettimeout(start,
timeout));
}
#endif
if (wrb == NULL)
{
+10 -1
View File
@@ -235,7 +235,11 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_timedalloc(unsigned int timeout)
*
****************************************************************************/
#ifdef CONFIG_NET_JUMBO_FRAME
FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(int len)
#else
FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(void)
#endif
{
FAR struct udp_wrbuffer_s *wrb;
@@ -262,7 +266,12 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(void)
/* Now get the first I/O buffer for the write buffer structure */
wrb->wb_iob = iob_tryalloc(false);
wrb->wb_iob =
#ifdef CONFIG_NET_JUMBO_FRAME
iob_alloc_dynamic(len);
#else
iob_tryalloc(false);
#endif
if (!wrb->wb_iob)
{
nerr("ERROR: Failed to allocate I/O buffer\n");