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 /* FUNCTION RELEASE */
34 /* */
35 /* _nx_ip_interface_address_mapping_configure PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Yuxin Zhou, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function configures whether address mapping is needed for */
44 /* specified interface. This routine is typically called from the */
45 /* interface device driver to notify the IP stack whether the */
46 /* underlying interface requires IP address to layer two (MAC) address */
47 /* mapping. */
48 /* */
49 /* INPUT */
50 /* */
51 /* ip_ptr IP control block pointer */
52 /* interface_index Index to the interface */
53 /* mapping_needed Need mapping or not */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* status Completion status */
58 /* */
59 /* CALLS */
60 /* */
61 /* tx_mutex_get Get protection mutex */
62 /* tx_mutex_put Put protection mutex */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */
73 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* */
76 /**************************************************************************/
_nx_ip_interface_address_mapping_configure(NX_IP * ip_ptr,UINT interface_index,UINT mapping_needed)77 UINT _nx_ip_interface_address_mapping_configure(NX_IP *ip_ptr, UINT interface_index, UINT mapping_needed)
78 {
79
80 /* Get mutex protection. */
81 tx_mutex_get(&(ip_ptr -> nx_ip_protection), TX_WAIT_FOREVER);
82
83 /* Set mapping needed. */
84 ip_ptr -> nx_ip_interface[interface_index].nx_interface_address_mapping_needed = (UCHAR)mapping_needed;
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
93