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 /** Internet Protocol (IP) */ 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_ip.h" 29 30 /**************************************************************************/ 31 /* */ 32 /* FUNCTION RELEASE */ 33 /* */ 34 /* _nx_ip_interface_capability_set PORTABLE C */ 35 /* 6.1 */ 36 /* AUTHOR */ 37 /* */ 38 /* Yuxin Zhou, Microsoft Corporation */ 39 /* */ 40 /* DESCRIPTION */ 41 /* */ 42 /* This function sets the capability flag of the specified network */ 43 /* interface. It is typically called by the device driver during */ 44 /* initializaion phase to notify the IP stack the hardware capability */ 45 /* available from the this device. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* ip_ptr IP control block pointer */ 50 /* interface_index Index to the network */ 51 /* interface */ 52 /* interface_capability_flag Interface capability flag */ 53 /* */ 54 /* OUTPUT */ 55 /* */ 56 /* status Completion status */ 57 /* */ 58 /* CALLS */ 59 /* */ 60 /* tx_mutex_get Get protection mutex */ 61 /* tx_mutex_put Put protection mutex */ 62 /* */ 63 /* CALLED BY */ 64 /* */ 65 /* Application Code */ 66 /* */ 67 /* RELEASE HISTORY */ 68 /* */ 69 /* DATE NAME DESCRIPTION */ 70 /* */ 71 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 72 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 73 /* resulting in version 6.1 */ 74 /* */ 75 /**************************************************************************/ _nx_ip_interface_capability_set(NX_IP * ip_ptr,UINT interface_index,ULONG interface_capability_flag)76UINT _nx_ip_interface_capability_set(NX_IP *ip_ptr, UINT interface_index, ULONG interface_capability_flag) 77 { 78 #ifdef NX_ENABLE_INTERFACE_CAPABILITY 79 80 /* Get mutex protection. */ 81 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER); 82 83 /* Set interface capability flag. */ 84 ip_ptr -> nx_ip_interface[interface_index].nx_interface_capability_flag = interface_capability_flag; 85 86 /* Release mutex protection. */ 87 tx_mutex_put(&(ip_ptr -> nx_ip_protection)); 88 89 /* Return completion status. */ 90 return(NX_SUCCESS); 91 92 #else /* NX_ENABLE_INTERFACE_CAPABILITY */ 93 NX_PARAMETER_NOT_USED(ip_ptr); 94 NX_PARAMETER_NOT_USED(interface_index); 95 NX_PARAMETER_NOT_USED(interface_capability_flag); 96 97 return(NX_NOT_SUPPORTED); 98 99 #endif /* NX_ENABLE_INTERFACE_CAPABILITY */ 100 } 101 102