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 /* Bring in externs for caller checking code.  */
31 NX_CALLER_CHECKING_EXTERNS
32 
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _nxe_ip_interface_physical_address_set              PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Yuxin Zhou, Microsoft Corporation                                   */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function checks errors in the network interface physical       */
47 /*    address set service.                                                */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    ip_ptr                                IP control block pointer      */
52 /*    interface_index                       Index to the network interface*/
53 /*    physical_msw                          Physical address MSW          */
54 /*    physical_lsw                          Physical address LSW          */
55 /*    update_driver                         Update driver or not          */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _nx_ip_interface_physical_address_set                               */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
74 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_nxe_ip_interface_physical_address_set(NX_IP * ip_ptr,UINT interface_index,ULONG physical_msw,ULONG physical_lsw,UINT update_driver)78 UINT  _nxe_ip_interface_physical_address_set(NX_IP *ip_ptr, UINT interface_index,
79                                              ULONG physical_msw, ULONG physical_lsw, UINT update_driver)
80 {
81 
82 UINT status;
83 
84     /* Check for invalid input pointers.  */
85     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
86     {
87         return(NX_PTR_ERROR);
88     }
89 
90     /* Check for invalid interface index. */
91     if (interface_index >= NX_MAX_PHYSICAL_INTERFACES)
92     {
93         return(NX_INVALID_INTERFACE);
94     }
95 
96     /* Check for appropriate caller.  */
97     NX_INIT_AND_THREADS_CALLER_CHECKING
98 
99     status = _nx_ip_interface_physical_address_set(ip_ptr, interface_index, physical_msw, physical_lsw, update_driver);
100 
101     /* Return completion status.  */
102     return(status);
103 }
104 
105