1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** NetX Component */ 16 /** */ 17 /** Transmission Control Protocol (TCP) */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 #define NX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "nx_api.h" 28 #include "nx_tcp.h" 29 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _nx_tcp_socket_receive_queue_max_set PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Yuxin Zhou, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function sets the maximum receive queue depth of a TCP socket. */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* socket_ptr Pointer to socket */ 48 /* receive_queue_maximum Maximum receive queue */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* status Completion status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* CALLED BY */ 57 /* */ 58 /* Application Code */ 59 /* */ 60 /* RELEASE HISTORY */ 61 /* */ 62 /* DATE NAME DESCRIPTION */ 63 /* */ 64 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 65 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 66 /* resulting in version 6.1 */ 67 /* */ 68 /**************************************************************************/ _nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET * socket_ptr,UINT receive_queue_maximum)69UINT _nx_tcp_socket_receive_queue_max_set(NX_TCP_SOCKET *socket_ptr, UINT receive_queue_maximum) 70 { 71 #ifdef NX_ENABLE_LOW_WATERMARK 72 73 TX_INTERRUPT_SAVE_AREA 74 75 /* Get mutex protection. */ 76 tx_mutex_get(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); 77 78 /* Disable interrupts to get a packet from the pool. */ 79 TX_DISABLE 80 81 /* Set maximum receive queue of socket. */ 82 socket_ptr -> nx_tcp_socket_receive_queue_maximum = receive_queue_maximum; 83 84 /* Restore interrupts. */ 85 TX_RESTORE 86 87 /* Release protection. */ 88 tx_mutex_put(&(socket_ptr -> nx_tcp_socket_ip_ptr -> nx_ip_protection)); 89 90 /* Return completion status. */ 91 return(NX_SUCCESS); 92 93 #else /* !NX_ENABLE_LOW_WATERMARK */ 94 NX_PARAMETER_NOT_USED(socket_ptr); 95 NX_PARAMETER_NOT_USED(receive_queue_maximum); 96 97 return(NX_NOT_SUPPORTED); 98 99 #endif /* NX_ENABLE_LOW_WATERMARK */ 100 } 101 102