blob: 3d824af0d4fe156a5bc203dae4d8093f8f7cba82 [file] [log] [blame]
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +05301/*
2** Copyright 2017-present Open Networking Foundation
3**
4** Licensed under the Apache License, Version 2.0 (the "License");
5** you may not use this file except in compliance with the License.
6** You may obtain a copy of the License at
7**
8** http://www.apache.org/licenses/LICENSE-2.0
9**
10** Unless required by applicable law or agreed to in writing, software
11** distributed under the License is distributed on an "AS IS" BASIS,
12** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13** See the License for the specific language governing permissions and
14** limitations under the License.
15*/
16
17#include <stdio.h>
18#include <bcmos_system.h>
19#include <bal_api.h>
20
21#undef _SYS_QUEUE_H_
22
23#include "asfvolt16_driver.h"
24#include "bal_access_terminal_hdlr.h"
25#include "bal_subscriber_terminal_hdlr.h"
26#include "bal_flow_hdlr.h"
27#include "bal_group_hdlr.h"
28#include "bal_interface_hdlr.h"
29#include "bal_tmqueue_hdlr.h"
30#include "bal_tmsched_hdlr.h"
31#include "bal_packet_hdlr.h"
32#include "bal_indications_hdlr.h"
33
Kim Kempfafa1ab42017-11-13 09:31:47 -080034#if 0
35#include "bal_api_end.h" /* Use when BAL -Wsign-compare is cleaned up */
36#else
37extern bcmos_errno bcmbal_apiend_init_all(int argc, char *argv[], void *, int);
38extern bcmos_errno bcmbal_apiend_finish(void);
39#endif
40
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053041bcmbal_access_term_id access_term_id = DEFAULT_ATERM_ID;
42
43/********************************************************************\
44 * Function : bal_register_indication_cbs *
45 * Description : Registering the Call back function to handle the *
46 * indciations from BAL *
47 ********************************************************************/
48uint32_t bal_register_indication_cbs()
49{
50 bcmos_errno err = BCM_ERR_OK;
51 bcmbal_cb_cfg cb_cfg = {};
52 uint16_t ind_subgroup;
Kim Kempfafa1ab42017-11-13 09:31:47 -080053 ASFVOLT_LOG(ASFVOLT_DEBUG, "Subscription for other messages");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053054
55 cb_cfg.module = BCMOS_MODULE_ID_NONE;
56
Girish Gowdru9ebd8b22018-09-26 03:21:03 -070057 /* Register to get indications for access terminal objects
58 */
Rajeswara Raob2e441c2017-09-20 16:40:21 +053059 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Girish Gowdru9ebd8b22018-09-26 03:21:03 -070060
61
62 /* Access Terminal processing error */
63 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_processing_error_indication_cb;
64 ind_subgroup = bcmbal_access_terminal_auto_id_processing_error;
Rajeswara Raob2e441c2017-09-20 16:40:21 +053065 cb_cfg.p_subgroup = &ind_subgroup;
66 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
67
Girish Gowdru9ebd8b22018-09-26 03:21:03 -070068 /* Register to get indication callbacks for flow objects
69 */
70 cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW;
71
72 /* Flow Operational State Change */
73 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_osc_indication_cb;
74 ind_subgroup = bcmbal_flow_auto_id_oper_status_change;
75 cb_cfg.p_subgroup = &ind_subgroup;
76 err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
77
78 /* Flow processing error */
79 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_processing_error_indication_cb;
80 ind_subgroup = bcmbal_flow_auto_id_processing_error;
81 cb_cfg.p_subgroup = &ind_subgroup;
82 err = bcmbal_subscribe_ind(access_term_id, &cb_cfg);
83
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +053084 /* Register to get indications for interface objects
85 */
86 cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE;
87
88 /* Interface los */
89 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_los_indication_cb;
90 ind_subgroup = bcmbal_interface_auto_id_los;
91 cb_cfg.p_subgroup = &ind_subgroup;
92 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
93
Rajeswara Raob2e441c2017-09-20 16:40:21 +053094 /* Interface Operational State Change */
95 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_osc_indication_cb;
96 ind_subgroup = bcmbal_interface_auto_id_oper_status_change;
97 cb_cfg.p_subgroup = &ind_subgroup;
98 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
99
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530100 /* Register to get indication callbacks for OMCI objects
101 */
102 cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET;
103
104 ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx);
105 cb_cfg.p_object_key_info = NULL;
106 cb_cfg.p_subgroup = &ind_subgroup;
107 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler )bal_omci_data_indication_cb;
108 bcmbal_subscribe_ind(0, &cb_cfg);
109
Rajeswara Raoa3efbca2017-09-08 18:01:16 +0530110 /* Bearer Channel Data */
111 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_packet_data_indication_cb;
112 ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx;
113 cb_cfg.p_subgroup = &ind_subgroup;
114 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700115
116 // On registering for OAM Channel Data, voltha_bal_driver crashes.
117 // This is not important/necessary right now, hence bypassing this.
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530118#if 0
Rajeswara Raob2e441c2017-09-20 16:40:21 +0530119 /* OAM Channel Data - oam response indication */
120 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_oam_data_indication_cb;
121 ind_subgroup = bcmbal_packet_auto_id_ieee_oam_channel_rx;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530122 cb_cfg.p_subgroup = &ind_subgroup;
123 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
Rajeswara Raob2e441c2017-09-20 16:40:21 +0530124#endif
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700125
126 /* Register to get indications for subscriber terminal objects
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530127 */
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700128 cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530129
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700130 /* Subscriber Terminal dgi */
131 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dgi_indication_cb;
132 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530133 cb_cfg.p_subgroup = &ind_subgroup;
134 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
135
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700136 /* Subscriber Terminal dowi*/
137 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dowi_indication_cb;
138 ind_subgroup = bcmbal_subscriber_terminal_auto_id_dowi;
139 cb_cfg.p_subgroup = &ind_subgroup;
140 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
141
142 /* Subscriber Terminal looci*/
143 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_looci_indication_cb;
144 ind_subgroup = bcmbal_subscriber_terminal_auto_id_looci;
145 cb_cfg.p_subgroup = &ind_subgroup;
146 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
147
148 /* Subscriber Terminal Operational State Change */
149 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_osc_indication_cb;
150 ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change;
151 cb_cfg.p_subgroup = &ind_subgroup;
152 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
153
154 /* Subscriber Terminal processing error*/
155 cb_cfg.ind_cb_hdlr = \
156 (f_bcmbal_ind_handler)bal_sub_term_processing_error_indication_cb;
157 ind_subgroup = bcmbal_subscriber_terminal_auto_id_processing_error;
158 cb_cfg.p_subgroup = &ind_subgroup;
159 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
160
161 /* Subscriber Terminal sdi */
162 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sdi_indication_cb;
163 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sdi;
164 cb_cfg.p_subgroup = &ind_subgroup;
165 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
166
167 /* Subscriber Terminal sfi */
168 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sfi_indication_cb;
169 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sfi;
170 cb_cfg.p_subgroup = &ind_subgroup;
171 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
172
173 /* Subscriber Terminal activation fail */
174 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_act_fail_indication_cb;
175 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_act_fail;
176 cb_cfg.p_subgroup = &ind_subgroup;
177 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
178
179 /* Subscriber Terminal Alarm */
180 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_alarm_indication_cb;
181 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm;
182 cb_cfg.p_subgroup = &ind_subgroup;
183 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
184
185 /* Subscriber Terminal Discovery */
186 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_disc_indication_cb;
187 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc;
188 cb_cfg.p_subgroup = &ind_subgroup;
189 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
190
191 /* Subscriber Terminal sufi */
192 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_sufi_indication_cb;
193 ind_subgroup = bcmbal_subscriber_terminal_auto_id_sufi;
194 cb_cfg.p_subgroup = &ind_subgroup;
195 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
196
197 /* Subscriber Terminal tiwi */
198 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_tiwi_indication_cb;
199 ind_subgroup = bcmbal_subscriber_terminal_auto_id_tiwi;
200 cb_cfg.p_subgroup = &ind_subgroup;
201 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
202
203 /* Register to get indication callbacks for Tm Sched Objects
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530204 */
205 cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED;
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700206
207 /* TM Sched operation status change */
208 cb_cfg.ind_cb_hdlr = \
209 (f_bcmbal_ind_handler)bal_tm_sched_auto_id_oper_status_change_cb;
210 ind_subgroup = bcmbal_tm_sched_auto_id_oper_status_change;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530211 cb_cfg.p_subgroup = &ind_subgroup;
212 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
Rajeswara Raob2e441c2017-09-20 16:40:21 +0530213
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530214 return err;
215}
216
217
218/********************************************************************
219 * *
220 * gRPC service RPC function implementation *
Rajeswara Raoa3efbca2017-09-08 18:01:16 +0530221 * *
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530222 ********************************************************************/
223
224/********************************************************************\
225 * Function : asfvolt16_bal_init *
226 * Description : This function will initialize the BAL module *
227 ********************************************************************/
228uint32_t asfvolt16_bal_init(BalInit *bal_init, balCoreIpInfo *coreInfo)
229
230{
231 bcmos_errno err = BCM_ERR_OK;
232
233 char *ip_and_port = NULL;
234 if (NULL == bal_init)
235 {
Kim Kempfafa1ab42017-11-13 09:31:47 -0800236 ASFVOLT_LOG(ASFVOLT_ERROR, "Received NULL balInit Structure from VOLTHA");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530237 return BAL_ERRNO__BAL_ERR_PERM;
238 }
239 else
240 {
241 ip_and_port = bal_init->voltha_adapter_ip_port;
Kim Kempfafa1ab42017-11-13 09:31:47 -0800242 ASFVOLT_LOG(ASFVOLT_DEBUG,"Received Adapter IP and Port from VOLTHA is %s",ip_and_port);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530243 }
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700244 char *argv[4];
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530245 /* Initialize BAL */
246 argv[1] = coreInfo->bal_core_arg1;
247 argv[2] = coreInfo->bal_core_ip_port;
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700248 int argc = 3;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530249 client = grpc_c_client_init(ip_and_port, "bal_client", NULL);
250
251 /* Init BAL */
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700252 err = bcmbal_apiend_init_all(argc, argv, NULL, 3);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530253 if(err != BCM_ERR_OK)
254 {
255 printf("\n Failed in bcmbal_init \n");
256 }
257
258#if 0
259 err = (err != BCM_ERR_OK) ? err : bcmbal_autostart(); /* Execute bal_autostart.ini script if any */
260
261 if (err)
262 {
263 /* Let logger task have enough time to drain its message queue. */
264 usleep(1000000);
Kim Kempfafa1ab42017-11-13 09:31:47 -0800265 ASFVOLT_LOG(ASFVOLT_ERROR, "failed to Initialize the BAL");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530266 return err;
267 }
268#endif
269
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700270 /* Register the call back functions to handle access term oper change
271 * indications from the BAL */
272 bcmbal_cb_cfg cb_cfg = {};
273 uint16_t ind_subgroup;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530274
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700275 cb_cfg.module = BCMOS_MODULE_ID_NONE;
276 /* Register to get indications for access terminal objects
277 */
278 cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530279
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700280 /* Access Terminal Operational State Change */
281 cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_osc_indication_cb;
282 ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change;
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530283 cb_cfg.p_subgroup = &ind_subgroup;
284 err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg);
285
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700286 if (err)
287 {
288 ASFVOLT_LOG(ASFVOLT_ERROR, "failed to register call back functions to BAL");
289 }
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530290
291 return err;
292}
293
294/********************************************************************\
295 * Function : asfvolt16_bal_finish *
296 * Description : This function will Un-initialize the BAL module *
297 ********************************************************************/
298uint32_t asfvolt16_bal_finish(void)
299{
300 bcmos_errno err = BCM_ERR_OK;
301
302 /* Un-Initialize the BAL function */
303 bcmbal_apiend_finish();
304
305 return err;
306}
307
308
309/********************************************************************\
310 * Function : asfvolt16_bal_cfg_set *
311 * Description : Handles below configuration *
312 * 1) Access Terminal Cfg *
313 * 2) Interface(PON & NNI) Cfg *
314 * 3) Subscriber Terminal (ONU) cfg *
Rajeswara Raoa3efbca2017-09-08 18:01:16 +0530315 * 4) Flow Cfg *
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530316 * 5) Group Cfg (In case of Multicast) *
317 ********************************************************************/
318uint32_t asfvolt16_bal_cfg_set(BalCfg *cfg)
319{
320 bcmos_errno err = BCM_ERR_OK;
321 memset(&voltha_device_id, 0, ASFVOLT_MAX_DEVICE_ID_SIZE);
322 strcpy(voltha_device_id,cfg->device_id);
323
324 switch(cfg->hdr->obj_type)
325 {
326 case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
327 {
328 err = bal_access_terminal_cfg_set(cfg->cfg);
329 break;
330 }
331 case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
332 {
333 err = bal_interface_cfg_set(cfg->interface);
334 break;
335 }
336 case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
337 {
338 err = bal_subscriber_terminal_cfg_set(cfg->terminal);
339 break;
340 }
341 case BAL_OBJ_ID__BAL_OBJ_ID_FLOW:
342 {
343 err = bal_flow_cfg_set(cfg->flow);
344 break;
345 }
346 case BAL_OBJ_ID__BAL_OBJ_ID_GROUP:
347 {
348 err = bal_group_cfg_set(cfg->group);
349 break;
350 }
351 case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE:
352 {
353 err = bal_tm_queue_cfg_set(cfg->tm_queue_cfg);
354 break;
355 }
356 case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED:
357 {
358 err = bal_tm_sched_cfg_set(cfg->tm_sched_cfg);
359 break;
360 }
361 case BAL_OBJ_ID__BAL_OBJ_ID_PACKET:
362 {
363 err = bal_packet_cfg_req(cfg->packet);
364 break;
365 }
366 default:
367 {
Kim Kempfafa1ab42017-11-13 09:31:47 -0800368 ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid object type for configuration");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530369 err = BAL_ERRNO__BAL_ERR_INVALID_OP;
370 break;
371 }
372 }
373 return err;
374}
375
376/********************************************************************\
377 * Function : asfvolt16_bal_cfg_clear *
378 * Description : Clears the configuration related to below objects *
379 * 1) Access Terminal Cfg *
380 * 2) Interface(PON & NNI) Cfg *
381 * 3) Subscriber Terminal (ONU) cfg *
Rajeswara Raoa3efbca2017-09-08 18:01:16 +0530382 * 4) Flow Cfg *
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530383 * 5) Group Cfg (In case of Multicast) *
384 ********************************************************************/
385uint32_t asfvolt16_bal_cfg_clear(BalKey *key)
386{
387 bcmos_errno err = BCM_ERR_OK;
388
389 if(!key->hdr->has_obj_type)
390 {
Kim Kempfafa1ab42017-11-13 09:31:47 -0800391 ASFVOLT_LOG(ASFVOLT_ERROR, "object type is not present for clear");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530392 return BAL_ERRNO__BAL_ERR_INVALID_OP;
393 }
394
395 switch(key->hdr->obj_type)
396 {
397 case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
398 {
399 err = bal_access_terminal_cfg_clear(key->access_term_key);
400 break;
401 }
402 case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
403 {
404 err = bal_interface_cfg_clear(key->interface_key);
405 break;
406 }
407 case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
408 {
409 err = bal_subscriber_terminal_cfg_clear(key->terminal_key);
410 break;
411 }
412 case BAL_OBJ_ID__BAL_OBJ_ID_FLOW:
413 {
414 err = bal_flow_cfg_clear(key->flow_key);
415 break;
416 }
417 case BAL_OBJ_ID__BAL_OBJ_ID_GROUP:
418 {
419 break;
420 }
421 case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE:
422 {
423 err = bal_tm_queue_cfg_clear(key->tm_queue_key);
424 break;
425 }
426 case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED:
427 {
428 err = bal_tm_sched_cfg_clear(key->tm_sched_key);
429 break;
430 }
431 /*case BAL_KEY__OBJ_PACKET_KEY:
432 {
433 break;
434 }*/
435 default:
436 {
Kim Kempfafa1ab42017-11-13 09:31:47 -0800437 ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid object type to handle clear");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530438 err = BAL_ERRNO__BAL_ERR_INVALID_OP;
439 break;
440 }
441 }
442 return err;
443}
444
445
446/********************************************************************\
447 * Function : asfvolt16_bal_cfg_get *
448 * Description : Get the configuration related to below objects *
449 * 1) Access Terminal Cfg *
450 * 2) Interface(PON & NNI) Cfg *
451 * 3) Subscriber Terminal (ONU) cfg *
Rajeswara Raoa3efbca2017-09-08 18:01:16 +0530452 * 4) Flow Cfg *
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530453 * 5) Group Cfg (In case of Multicast) *
454 ********************************************************************/
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700455uint32_t asfvolt16_bal_cfg_get(BalCfg *cfg)
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530456{
457 bcmos_errno err = BCM_ERR_OK;
458
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700459 switch(cfg->hdr->obj_type)
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530460 {
461 case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL:
462 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700463 err = bal_access_terminal_cfg_get(cfg->cfg);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530464 break;
465 }
466 case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE:
467 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700468 err = bal_interface_cfg_get(cfg->interface);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530469 break;
470 }
471 case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL:
472 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700473 err = bal_subscriber_terminal_cfg_get(cfg->terminal);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530474 break;
475 }
476 case BAL_OBJ_ID__BAL_OBJ_ID_FLOW:
477 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700478 err = bal_flow_cfg_get(cfg->flow);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530479 break;
480 }
481 case BAL_OBJ_ID__BAL_OBJ_ID_GROUP:
482 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700483 err = bal_group_cfg_get(cfg->group);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530484 break;
485 }
486 case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE:
487 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700488 err = bal_tm_queue_cfg_get(cfg->tm_queue_cfg);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530489 break;
490 }
491 case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED:
492 {
Girish Gowdru9ebd8b22018-09-26 03:21:03 -0700493 err = bal_tm_sched_cfg_get(cfg->tm_sched_cfg);
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530494 break;
495 }
496 case BAL_OBJ_ID__BAL_OBJ_ID_PACKET:
497 {
498 break;
499 }
500 default:
501 {
Kim Kempfafa1ab42017-11-13 09:31:47 -0800502 ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid object type to handle Get");
Rajeswara Raof6b4e6c2017-08-31 17:26:27 +0530503 err = BAL_ERRNO__BAL_ERR_INVALID_OP;
504 break;
505 }
506 }
507 return err;
508}
509
510