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