comparison src/g23m-aci/aci/gaci_srcc.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module implements the source control management for GACI.
18 +-----------------------------------------------------------------------------
19 */
20
21
22 #ifdef GPRS
23
24 #include "aci_all.h"
25
26 /*==== INCLUDES ===================================================*/
27 #include "dti.h" /* functionality of the dti library */
28 #include "aci_cmh.h"
29
30 #include "dti_conn_mng.h"
31 #include "dti_cntrl_mng.h"
32
33 #include "gaci.h"
34 #include "gaci_cmh.h"
35 #include "psa.h"
36 #include "psa_sm.h"
37 #include "psa_gppp.h"
38 #include "psa_gmm.h"
39
40
41 #include "cmh.h"
42 #include "cmh_sm.h"
43 #include "cmh_gppp.h"
44 #include "cmh_gmm.h"
45 #include "gaci_srcc.h"
46
47
48 /*===== PRIVATE VARIABLES ==========================================*/
49 static UBYTE entity_counter[SRRC_MAX_ENTITY];
50
51 /*===== FUNCTIONS DECLARATIONS =====================================*/
52
53 /*
54 +--------------------------------------------------------------------+
55 | PROJECT : MODULE : ACI_DTI |
56 | STATE : finished ROUTINE : srcc_init |
57 +--------------------------------------------------------------------+
58
59 PURPOSE : init of source control management
60 */
61 GLOBAL void srcc_init (void)
62 {
63 SHORT i = 0;
64
65 for (i = 0; i < SRRC_MAX_ENTITY; i++)
66 entity_counter[i] = 0;
67 }
68
69 /*
70 +--------------------------------------------------------------------+
71 | PROJECT : MODULE : ACI_DTI |
72 | STATE : finished ROUTINE : srcc_new_count |
73 +--------------------------------------------------------------------+
74
75 PURPOSE :
76 */
77 GLOBAL void srcc_new_count ( SRCC_LINK_NO link_no )
78 {
79
80 T_PDP_CONTEXT_INTERNAL *p_pdp_context_node = NULL;
81
82 p_pdp_context_node = pdp_context_find_node_from_cid( work_cids[cid_pointer] );
83
84 TRACE_FUNCTION("srcc_new_count()");
85
86 if ( !p_pdp_context_node )
87 {
88 TRACE_ERROR("PDP Context Not Found");
89 return;
90 }
91
92 if ( srcc_reserve_sources( link_no, 1) )
93 {
94 switch( link_no )
95 {
96
97 case SRCC_PPPS_SNDCP_LINK:
98 entity_counter[SRRC_PPPS_ENTITY]++;
99 entity_counter[SRRC_SNDCP_ENTITY]++;
100 TRACE_EVENT_P3("link_no = %d, new PPP counter = %d and new SNDCP counter = %d",
101 link_no, entity_counter[SRRC_PPPS_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
102 break;
103
104 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI)
105 case SRCC_PKTIO_SNDCP_LINK:
106 entity_counter[SRRC_SNDCP_ENTITY]++;
107 TRACE_EVENT_P2("link_no = %d, new SNDCP counter = %d",
108 link_no, entity_counter[SRRC_SNDCP_ENTITY]);
109 break;
110 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */
111
112 #ifdef FF_SAT_E
113 case SRCC_SIM_SNDCP_LINK:
114 entity_counter[SRRC_SIM_ENTITY]++;
115 entity_counter[SRRC_SNDCP_ENTITY]++;
116 TRACE_EVENT_P3("link_no = %d, new SIM counter = %d and new SNDCP counter = %d",
117 link_no, entity_counter[SRRC_SIM_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
118 break;
119 #endif
120
121 case SRCC_IP_SNDCP_LINK:
122 #ifdef CO_UDP_IP
123 entity_counter[SRRC_IP_ENTITY]++;
124 TRACE_EVENT_P2("link_no = %d, new IP counter = %d",
125 link_no, entity_counter[SRRC_IP_ENTITY]);
126 #endif
127 entity_counter[SRRC_SNDCP_ENTITY]++;
128 TRACE_EVENT_P1("new SNDCP counter = %d", entity_counter[SRRC_SNDCP_ENTITY]);
129 break;
130
131 #ifdef FF_GPF_TCPIP
132 case SRCC_TCPIP_SNDCP_LINK:
133 entity_counter[SRRC_TCPIP_ENTITY]++;
134 entity_counter[SRRC_SNDCP_ENTITY]++;
135 TRACE_EVENT_P3("link_no = %d, new TCPIP counter = %d and new SNDCP counter = %d",
136 link_no, entity_counter[SRRC_TCPIP_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
137 break;
138 #endif
139
140 default:
141 TRACE_EVENT_P1("ERROR: srcc_new_count: link_no unknown: %d",link_no);
142 return;
143 }
144 }
145 }
146
147 /*
148 +--------------------------------------------------------------------+
149 | PROJECT : MODULE : ACI_DTI |
150 | STATE : finished ROUTINE : srcc_delete_count |
151 +--------------------------------------------------------------------+
152
153 PURPOSE :
154 */
155 GLOBAL void srcc_delete_count ( SRCC_LINK_NO link_no )
156 {
157
158 TRACE_FUNCTION("srcc_delete_count()");
159
160 switch( link_no )
161 {
162 case SRCC_PPPS_SNDCP_LINK:
163 entity_counter[SRRC_PPPS_ENTITY]--;
164 entity_counter[SRRC_SNDCP_ENTITY]--;
165 TRACE_EVENT_P3("link_no = %d, new PPP counter = %d and new SNDCP counter = %d",
166 link_no, entity_counter[SRRC_PPPS_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
167 return;
168 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI)
169 case SRCC_PKTIO_SNDCP_LINK:
170 entity_counter[SRRC_SNDCP_ENTITY]--;
171 TRACE_EVENT_P1("new SNDCP counter = %d", entity_counter[SRRC_SNDCP_ENTITY]);
172 return;
173 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */
174 #ifdef FF_SAT_E
175 case SRCC_SIM_SNDCP_LINK:
176 entity_counter[SRRC_SIM_ENTITY]--;
177 entity_counter[SRRC_SNDCP_ENTITY]--;
178 TRACE_EVENT_P3("link_no = %d, new SIM counter = %d and new SNDCP counter = %d",
179 link_no, entity_counter[SRRC_SIM_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
180 break;
181 #endif
182 case SRCC_IP_SNDCP_LINK:
183 #ifdef CO_UDP_IP
184 entity_counter[SRRC_IP_ENTITY]--;
185 TRACE_EVENT_P2("link_no = %d, new IP counter = %d",
186 link_no, entity_counter[SRRC_IP_ENTITY]);
187 #endif
188 entity_counter[SRRC_SNDCP_ENTITY]--;
189 TRACE_EVENT_P1("new SNDCP counter = %d", entity_counter[SRRC_SNDCP_ENTITY]);
190 break;
191
192 #ifdef FF_GPF_TCPIP
193 case SRCC_TCPIP_SNDCP_LINK:
194 entity_counter[SRRC_TCPIP_ENTITY]--;
195 entity_counter[SRRC_SNDCP_ENTITY]--;
196 TRACE_EVENT_P3("link_no = %d, new TCPIP counter = %d and new SNDCP counter = %d",
197 link_no, entity_counter[SRRC_TCPIP_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
198 return;
199 #endif
200
201 default:
202 return;
203 }
204 }
205
206 /*
207 +--------------------------------------------------------------------+
208 | PROJECT : MODULE : ACI_DTI |
209 | STATE : finished ROUTINE : srcc_reserve_sources |
210 +--------------------------------------------------------------------+
211
212 PURPOSE : check the possibility of creation a number of dti connections
213 */
214 GLOBAL BOOL srcc_reserve_sources( SRCC_LINK_NO link_no, SHORT no )
215 {
216
217 TRACE_FUNCTION("srcc_reserve_sources()");
218
219 switch( link_no )
220 {
221
222 case SRCC_PPPS_SNDCP_LINK:
223 if ( entity_counter[SRRC_PPPS_ENTITY] >= MAX_PPPS_INSTANCES OR
224 entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES
225 )
226 {
227 TRACE_EVENT_P3("FAILED to reserve resources for link_no = %d, PPP counter = %d and SNDCP counter = %d",
228 link_no, entity_counter[SRRC_PPPS_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
229 return FALSE;
230 }
231 break;
232
233 #if defined (FF_PKTIO) OR defined (FF_TCP_IP) OR defined (FF_PSI)
234 case SRCC_PKTIO_SNDCP_LINK:
235 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES )
236 {
237 TRACE_EVENT_P2("FAILED to reserve resources for link_no = %d, SNDCP counter = %d",
238 link_no, entity_counter[SRRC_SNDCP_ENTITY]);
239 return FALSE;
240 }
241 break;
242 #endif /* FF_PKTIO OR FF_TCP_IP OR FF_PSI */
243
244 #ifdef FF_SAT_E
245 case SRCC_SIM_SNDCP_LINK:
246 if ( entity_counter[SRRC_SIM_ENTITY] >= MAX_SIM_INSTANCES OR
247 entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES )
248 {
249 TRACE_EVENT_P3("FAILED to reserve resources for link_no = %d, SIM counter = %d and SNDCP counter = %d",
250 link_no, entity_counter[SRRC_SIM_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
251 return FALSE;
252 }
253 break;
254 #endif /* FF_SAT_E */
255
256 case SRCC_IP_SNDCP_LINK:
257 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES
258 #ifdef CO_UDP_IP
259 OR
260 entity_counter[SRRC_IP_ENTITY] >= MAX_IP_INSTANCES
261 #endif
262 )
263 {
264 TRACE_EVENT_P2("FAILED to reserve resources for link_no = %d, SNDCP counter = %d",
265 link_no, entity_counter[SRRC_SNDCP_ENTITY]);
266 #ifdef CO_UDP_IP
267 TRACE_EVENT_P1(" IP counter = %d", entity_counter[SRRC_IP_ENTITY]);
268 #endif
269 return FALSE;
270 }
271 break;
272
273 #ifdef FF_GPF_TCPIP
274 case SRCC_TCPIP_SNDCP_LINK:
275 if ( entity_counter[SRRC_SNDCP_ENTITY] >= MAX_SNDCP_INSTANCES
276 OR entity_counter[SRRC_TCPIP_ENTITY] >= MAX_TCPIP_INSTANCES )
277 {
278 TRACE_EVENT_P3("FAILED to reserve resources for link_no = %d, TCPIP counter = %d and SNDCP counter = %d",
279 link_no, entity_counter[SRRC_TCPIP_ENTITY], entity_counter[SRRC_SNDCP_ENTITY]);
280 return FALSE;
281 }
282 break;
283
284 #endif /* FF_GPF_TCPIP */
285
286 default:
287 return FALSE;
288 }
289
290 return TRUE;
291 }
292 #endif