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 /**   Internet Protocol (IP)                                              */
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_ip.h"
30 #ifdef NX_ENABLE_DUAL_PACKET_POOL
31 #include "nx_packet.h"
32 
33 /* Bring in externs for caller checking code.  */
34 
35 NX_CALLER_CHECKING_EXTERNS
36 #endif /* NX_ENABLE_DUAL_PACKET_POOL */
37 
38 
39 /**************************************************************************/
40 /*                                                                        */
41 /*  FUNCTION                                               RELEASE        */
42 /*                                                                        */
43 /*    _nxe_ip_auxiliary_packet_pool_set                   PORTABLE C      */
44 /*                                                           6.1          */
45 /*  AUTHOR                                                                */
46 /*                                                                        */
47 /*    Yuxin Zhou, Microsoft Corporation                                   */
48 /*                                                                        */
49 /*  DESCRIPTION                                                           */
50 /*                                                                        */
51 /*    This function checks for errors in the auxiliary packet pool set    */
52 /*    function call.                                                      */
53 /*                                                                        */
54 /*  INPUT                                                                 */
55 /*                                                                        */
56 /*    ip_ptr                                Pointer to IP control block   */
57 /*    auxiliary_pool                        Pointer to a valid auxiliary  */
58 /*                                            pool to be used as an       */
59 /*                                            auxiliary packet pool       */
60 /*                                                                        */
61 /*  OUTPUT                                                                */
62 /*                                                                        */
63 /*    status                                Completion status             */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*    _nx_ip_auxiliary_packet_pool_set      Actual auxiliary packet pool  */
68 /*                                           set function                 */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
79 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
_nxe_ip_auxiliary_packet_pool_set(NX_IP * ip_ptr,NX_PACKET_POOL * auxiliary_pool)83 UINT  _nxe_ip_auxiliary_packet_pool_set(NX_IP *ip_ptr, NX_PACKET_POOL *auxiliary_pool)
84 {
85 #ifdef NX_ENABLE_DUAL_PACKET_POOL
86 UINT status;
87 
88 
89     /* Check for invalid input pointers.  */
90     if ((ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID))
91     {
92         return(NX_PTR_ERROR);
93     }
94 
95     /* Check for invalid input pointers.  */
96     if ((auxiliary_pool == NX_NULL) || (auxiliary_pool -> nx_packet_pool_id != NX_PACKET_POOL_ID))
97     {
98         return(NX_PTR_ERROR);
99     }
100 
101     /* Check for appropriate caller.  */
102     NX_INIT_AND_THREADS_CALLER_CHECKING
103 
104     /* Call actual auxiliary packet pool set function.  */
105     status =  _nx_ip_auxiliary_packet_pool_set(ip_ptr, auxiliary_pool);
106 
107     /* Return completion status.  */
108     return(status);
109 
110 #else /* !NX_ENABLE_DUAL_PACKET_POOL */
111     NX_PARAMETER_NOT_USED(ip_ptr);
112     NX_PARAMETER_NOT_USED(auxiliary_pool);
113 
114     return(NX_NOT_SUPPORTED);
115 
116 #endif /* NX_ENABLE_DUAL_PACKET_POOL */
117 }
118 
119