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