Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 34 | bcmbal_access_term_id access_term_id = DEFAULT_ATERM_ID; |
| 35 | |
| 36 | /********************************************************************\ |
| 37 | * Function : bal_register_indication_cbs * |
| 38 | * Description : Registering the Call back function to handle the * |
| 39 | * indciations from BAL * |
| 40 | ********************************************************************/ |
| 41 | uint32_t bal_register_indication_cbs() |
| 42 | { |
| 43 | bcmos_errno err = BCM_ERR_OK; |
| 44 | bcmbal_cb_cfg cb_cfg = {}; |
| 45 | uint16_t ind_subgroup; |
| 46 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Subscription for other messages\n"); |
| 47 | |
| 48 | cb_cfg.module = BCMOS_MODULE_ID_NONE; |
| 49 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 50 | /* Access Terminal Operational State Change */ |
| 51 | cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL; |
| 52 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_osc_indication_cb; |
| 53 | ind_subgroup = bcmbal_access_terminal_auto_id_oper_status_change; |
| 54 | cb_cfg.p_subgroup = &ind_subgroup; |
| 55 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 56 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 57 | /* Register to get indications for interface objects |
| 58 | */ |
| 59 | cb_cfg.obj_type = BCMBAL_OBJ_ID_INTERFACE; |
| 60 | |
| 61 | /* Interface los */ |
| 62 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_los_indication_cb; |
| 63 | ind_subgroup = bcmbal_interface_auto_id_los; |
| 64 | cb_cfg.p_subgroup = &ind_subgroup; |
| 65 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 66 | |
| 67 | /* Interface Indication */ |
| 68 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_indication_cb; |
| 69 | ind_subgroup = bcmbal_interface_auto_id_ind; |
| 70 | cb_cfg.p_subgroup = &ind_subgroup; |
| 71 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 72 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 73 | /* Interface Operational State Change */ |
| 74 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_interface_osc_indication_cb; |
| 75 | ind_subgroup = bcmbal_interface_auto_id_oper_status_change; |
| 76 | cb_cfg.p_subgroup = &ind_subgroup; |
| 77 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 78 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 79 | /* Register to get indications for subscriber terminal objects |
| 80 | */ |
| 81 | cb_cfg.obj_type = BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 82 | |
| 83 | /* Subscriber Terminal Alarm */ |
| 84 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_alarm_indication_cb; |
| 85 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_alarm; |
| 86 | cb_cfg.p_subgroup = &ind_subgroup; |
| 87 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 88 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 89 | /* Subscriber Terminal dgi */ |
| 90 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_dgi_indication_cb; |
| 91 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_dgi; |
| 92 | cb_cfg.p_subgroup = &ind_subgroup; |
| 93 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 94 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 95 | /* Subscriber Terminal Discovery */ |
| 96 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_disc_indication_cb; |
| 97 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_sub_term_disc; |
| 98 | cb_cfg.p_subgroup = &ind_subgroup; |
| 99 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 100 | |
| 101 | /* Subscriber Terminal Indication */ |
| 102 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_indication_cb; |
| 103 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_ind; |
| 104 | cb_cfg.p_subgroup = &ind_subgroup; |
| 105 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 106 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 107 | /* Subscriber Terminal Operational State Change */ |
| 108 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_sub_term_osc_indication_cb; |
| 109 | ind_subgroup = bcmbal_subscriber_terminal_auto_id_oper_status_change; |
| 110 | cb_cfg.p_subgroup = &ind_subgroup; |
| 111 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 112 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 113 | /* Register to get indication callbacks for OMCI objects |
| 114 | */ |
| 115 | cb_cfg.obj_type = BCMBAL_OBJ_ID_PACKET; |
| 116 | |
| 117 | ind_subgroup = BCMBAL_IND_SUBGROUP(packet, itu_omci_channel_rx); |
| 118 | cb_cfg.p_object_key_info = NULL; |
| 119 | cb_cfg.p_subgroup = &ind_subgroup; |
| 120 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler )bal_omci_data_indication_cb; |
| 121 | bcmbal_subscribe_ind(0, &cb_cfg); |
| 122 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 123 | /* Bearer Channel Data */ |
| 124 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_packet_data_indication_cb; |
| 125 | ind_subgroup = bcmbal_packet_auto_id_bearer_channel_rx; |
| 126 | cb_cfg.p_subgroup = &ind_subgroup; |
| 127 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 128 | #if 0 |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 129 | /* OAM Channel Data - oam response indication */ |
| 130 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_oam_data_indication_cb; |
| 131 | ind_subgroup = bcmbal_packet_auto_id_ieee_oam_channel_rx; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 132 | cb_cfg.p_subgroup = &ind_subgroup; |
| 133 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 134 | #endif |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 135 | /* Register to get indication callbacks for flow objects |
| 136 | */ |
| 137 | cb_cfg.obj_type = BCMBAL_OBJ_ID_FLOW; |
| 138 | |
| 139 | /* Flow Operational State Change */ |
| 140 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_osc_indication_cb; |
| 141 | ind_subgroup = bcmbal_flow_auto_id_oper_status_change; |
| 142 | cb_cfg.p_subgroup = &ind_subgroup; |
| 143 | err = bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 144 | |
| 145 | /* Flow Indication */ |
| 146 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_flow_indication_cb; |
| 147 | ind_subgroup = bcmbal_flow_auto_id_ind; |
| 148 | cb_cfg.p_subgroup = &ind_subgroup; |
| 149 | err = bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 150 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 151 | /* Register to get indication callbacks for tm queue objects |
| 152 | */ |
| 153 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_QUEUE; |
| 154 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_tm_queue_indication_cb; |
| 155 | ind_subgroup = bcmbal_tm_queue_auto_id_ind; |
| 156 | cb_cfg.p_subgroup = &ind_subgroup; |
| 157 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 158 | |
| 159 | /* Register to get indication callbacks for tm sched objects |
| 160 | */ |
| 161 | cb_cfg.obj_type = BCMBAL_OBJ_ID_TM_SCHED; |
| 162 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_tm_sched_indication_cb; |
| 163 | ind_subgroup = bcmbal_tm_sched_auto_id_ind; |
| 164 | cb_cfg.p_subgroup = &ind_subgroup; |
| 165 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 166 | |
| 167 | /* Register to get indication callbacks for group objects |
| 168 | */ |
| 169 | cb_cfg.obj_type = BCMBAL_OBJ_ID_GROUP; |
| 170 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_group_indication_cb; |
| 171 | ind_subgroup = bcmbal_group_auto_id_ind; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 172 | cb_cfg.p_subgroup = &ind_subgroup; |
| 173 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 174 | return err; |
| 175 | } |
| 176 | |
| 177 | |
| 178 | /******************************************************************** |
| 179 | * * |
| 180 | * gRPC service RPC function implementation * |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 181 | * * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 182 | ********************************************************************/ |
| 183 | |
| 184 | /********************************************************************\ |
| 185 | * Function : asfvolt16_bal_init * |
| 186 | * Description : This function will initialize the BAL module * |
| 187 | ********************************************************************/ |
| 188 | uint32_t asfvolt16_bal_init(BalInit *bal_init, balCoreIpInfo *coreInfo) |
| 189 | |
| 190 | { |
| 191 | bcmos_errno err = BCM_ERR_OK; |
| 192 | |
| 193 | char *ip_and_port = NULL; |
| 194 | if (NULL == bal_init) |
| 195 | { |
| 196 | ASFVOLT_LOG(ASFVOLT_ERROR, "Recvied NULL balInit Structure from VOLTHA \n"); |
| 197 | return BAL_ERRNO__BAL_ERR_PERM; |
| 198 | } |
| 199 | else |
| 200 | { |
| 201 | ip_and_port = bal_init->voltha_adapter_ip_port; |
| 202 | ASFVOLT_LOG(ASFVOLT_DEBUG,"\nRecevied Adapter IP and Port from VOLTHA is %s\n",ip_and_port); |
| 203 | } |
| 204 | char *argv[6]; |
| 205 | /* Initialize BAL */ |
| 206 | argv[1] = coreInfo->bal_core_arg1; |
| 207 | argv[2] = coreInfo->bal_core_ip_port; |
| 208 | argv[3] = coreInfo->bal_core_arg2; |
| 209 | argv[4] = coreInfo->bal_shared_lib_ip_port; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 210 | int argc = 5; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 211 | client = grpc_c_client_init(ip_and_port, "bal_client", NULL); |
| 212 | |
| 213 | /* Init BAL */ |
| 214 | err = bcmbal_apiend_init_all(argc, argv, NULL,3); |
| 215 | if(err != BCM_ERR_OK) |
| 216 | { |
| 217 | printf("\n Failed in bcmbal_init \n"); |
| 218 | } |
| 219 | |
| 220 | #if 0 |
| 221 | err = (err != BCM_ERR_OK) ? err : bcmbal_autostart(); /* Execute bal_autostart.ini script if any */ |
| 222 | |
| 223 | if (err) |
| 224 | { |
| 225 | /* Let logger task have enough time to drain its message queue. */ |
| 226 | usleep(1000000); |
| 227 | ASFVOLT_LOG(ASFVOLT_ERROR, "failed to Initialize the BAL\n"); |
| 228 | return err; |
| 229 | } |
| 230 | #endif |
| 231 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 232 | /* Register the call back functions to handle any |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 233 | * indications from the BAL */ |
| 234 | bcmbal_cb_cfg cb_cfg = {}; |
| 235 | uint16_t ind_subgroup; |
| 236 | |
| 237 | cb_cfg.module = BCMOS_MODULE_ID_NONE; |
| 238 | /* Register to get indications for access terminal objects |
| 239 | */ |
| 240 | cb_cfg.obj_type = BCMBAL_OBJ_ID_ACCESS_TERMINAL; |
| 241 | |
| 242 | /* Access Terminal Indication */ |
| 243 | cb_cfg.ind_cb_hdlr = (f_bcmbal_ind_handler)bal_acc_term_indication_cb; |
| 244 | ind_subgroup = bcmbal_access_terminal_auto_id_ind; |
| 245 | cb_cfg.p_subgroup = &ind_subgroup; |
| 246 | err = err ? err : bcmbal_subscribe_ind(access_term_id, &cb_cfg); |
| 247 | |
| 248 | if (err) |
| 249 | { |
| 250 | ASFVOLT_LOG(ASFVOLT_ERROR, "failed to register call back functions to BAL\n"); |
| 251 | } |
| 252 | |
| 253 | return err; |
| 254 | } |
| 255 | |
| 256 | /********************************************************************\ |
| 257 | * Function : asfvolt16_bal_finish * |
| 258 | * Description : This function will Un-initialize the BAL module * |
| 259 | ********************************************************************/ |
| 260 | uint32_t asfvolt16_bal_finish(void) |
| 261 | { |
| 262 | bcmos_errno err = BCM_ERR_OK; |
| 263 | |
| 264 | /* Un-Initialize the BAL function */ |
| 265 | bcmbal_apiend_finish(); |
| 266 | |
| 267 | return err; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | /********************************************************************\ |
| 272 | * Function : asfvolt16_bal_cfg_set * |
| 273 | * Description : Handles below configuration * |
| 274 | * 1) Access Terminal Cfg * |
| 275 | * 2) Interface(PON & NNI) Cfg * |
| 276 | * 3) Subscriber Terminal (ONU) cfg * |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 277 | * 4) Flow Cfg * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 278 | * 5) Group Cfg (In case of Multicast) * |
| 279 | ********************************************************************/ |
| 280 | uint32_t asfvolt16_bal_cfg_set(BalCfg *cfg) |
| 281 | { |
| 282 | bcmos_errno err = BCM_ERR_OK; |
| 283 | memset(&voltha_device_id, 0, ASFVOLT_MAX_DEVICE_ID_SIZE); |
| 284 | strcpy(voltha_device_id,cfg->device_id); |
| 285 | |
| 286 | switch(cfg->hdr->obj_type) |
| 287 | { |
| 288 | case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL: |
| 289 | { |
| 290 | err = bal_access_terminal_cfg_set(cfg->cfg); |
| 291 | break; |
| 292 | } |
| 293 | case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE: |
| 294 | { |
| 295 | err = bal_interface_cfg_set(cfg->interface); |
| 296 | break; |
| 297 | } |
| 298 | case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL: |
| 299 | { |
| 300 | err = bal_subscriber_terminal_cfg_set(cfg->terminal); |
| 301 | break; |
| 302 | } |
| 303 | case BAL_OBJ_ID__BAL_OBJ_ID_FLOW: |
| 304 | { |
| 305 | err = bal_flow_cfg_set(cfg->flow); |
| 306 | break; |
| 307 | } |
| 308 | case BAL_OBJ_ID__BAL_OBJ_ID_GROUP: |
| 309 | { |
| 310 | err = bal_group_cfg_set(cfg->group); |
| 311 | break; |
| 312 | } |
| 313 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE: |
| 314 | { |
| 315 | err = bal_tm_queue_cfg_set(cfg->tm_queue_cfg); |
| 316 | break; |
| 317 | } |
| 318 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED: |
| 319 | { |
| 320 | err = bal_tm_sched_cfg_set(cfg->tm_sched_cfg); |
| 321 | break; |
| 322 | } |
| 323 | case BAL_OBJ_ID__BAL_OBJ_ID_PACKET: |
| 324 | { |
| 325 | err = bal_packet_cfg_req(cfg->packet); |
| 326 | break; |
| 327 | } |
| 328 | default: |
| 329 | { |
| 330 | ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid objet type for configuration\n"); |
| 331 | err = BAL_ERRNO__BAL_ERR_INVALID_OP; |
| 332 | break; |
| 333 | } |
| 334 | } |
| 335 | return err; |
| 336 | } |
| 337 | |
| 338 | /********************************************************************\ |
| 339 | * Function : asfvolt16_bal_cfg_clear * |
| 340 | * Description : Clears the configuration related to below objects * |
| 341 | * 1) Access Terminal Cfg * |
| 342 | * 2) Interface(PON & NNI) Cfg * |
| 343 | * 3) Subscriber Terminal (ONU) cfg * |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 344 | * 4) Flow Cfg * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 345 | * 5) Group Cfg (In case of Multicast) * |
| 346 | ********************************************************************/ |
| 347 | uint32_t asfvolt16_bal_cfg_clear(BalKey *key) |
| 348 | { |
| 349 | bcmos_errno err = BCM_ERR_OK; |
| 350 | |
| 351 | if(!key->hdr->has_obj_type) |
| 352 | { |
| 353 | ASFVOLT_LOG(ASFVOLT_ERROR, "object type is not present for clear\n"); |
| 354 | return BAL_ERRNO__BAL_ERR_INVALID_OP; |
| 355 | } |
| 356 | |
| 357 | switch(key->hdr->obj_type) |
| 358 | { |
| 359 | case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL: |
| 360 | { |
| 361 | err = bal_access_terminal_cfg_clear(key->access_term_key); |
| 362 | break; |
| 363 | } |
| 364 | case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE: |
| 365 | { |
| 366 | err = bal_interface_cfg_clear(key->interface_key); |
| 367 | break; |
| 368 | } |
| 369 | case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL: |
| 370 | { |
| 371 | err = bal_subscriber_terminal_cfg_clear(key->terminal_key); |
| 372 | break; |
| 373 | } |
| 374 | case BAL_OBJ_ID__BAL_OBJ_ID_FLOW: |
| 375 | { |
| 376 | err = bal_flow_cfg_clear(key->flow_key); |
| 377 | break; |
| 378 | } |
| 379 | case BAL_OBJ_ID__BAL_OBJ_ID_GROUP: |
| 380 | { |
| 381 | break; |
| 382 | } |
| 383 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE: |
| 384 | { |
| 385 | err = bal_tm_queue_cfg_clear(key->tm_queue_key); |
| 386 | break; |
| 387 | } |
| 388 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED: |
| 389 | { |
| 390 | err = bal_tm_sched_cfg_clear(key->tm_sched_key); |
| 391 | break; |
| 392 | } |
| 393 | /*case BAL_KEY__OBJ_PACKET_KEY: |
| 394 | { |
| 395 | break; |
| 396 | }*/ |
| 397 | default: |
| 398 | { |
| 399 | ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid objet type to handle clear\n"); |
| 400 | err = BAL_ERRNO__BAL_ERR_INVALID_OP; |
| 401 | break; |
| 402 | } |
| 403 | } |
| 404 | return err; |
| 405 | } |
| 406 | |
| 407 | |
| 408 | /********************************************************************\ |
| 409 | * Function : asfvolt16_bal_cfg_get * |
| 410 | * Description : Get the configuration related to below objects * |
| 411 | * 1) Access Terminal Cfg * |
| 412 | * 2) Interface(PON & NNI) Cfg * |
| 413 | * 3) Subscriber Terminal (ONU) cfg * |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 414 | * 4) Flow Cfg * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 415 | * 5) Group Cfg (In case of Multicast) * |
| 416 | ********************************************************************/ |
| 417 | uint32_t asfvolt16_bal_cfg_get(BalKey *key, BalCfg *cfg) |
| 418 | { |
| 419 | bcmos_errno err = BCM_ERR_OK; |
| 420 | |
| 421 | if(!key->hdr->has_obj_type) |
| 422 | { |
| 423 | ASFVOLT_LOG(ASFVOLT_ERROR, "object type is not present for get\n"); |
| 424 | return BAL_ERRNO__BAL_ERR_INVALID_OP; |
| 425 | } |
| 426 | |
| 427 | switch(key->hdr->obj_type) |
| 428 | { |
| 429 | case BAL_OBJ_ID__BAL_OBJ_ID_ACCESS_TERMINAL: |
| 430 | { |
| 431 | err = bal_access_terminal_cfg_get(key->access_term_key, cfg->cfg ); |
| 432 | break; |
| 433 | } |
| 434 | case BAL_OBJ_ID__BAL_OBJ_ID_INTERFACE: |
| 435 | { |
| 436 | err = bal_interface_cfg_get(key->interface_key, cfg->interface); |
| 437 | break; |
| 438 | } |
| 439 | case BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL: |
| 440 | { |
| 441 | err = bal_subscriber_terminal_cfg_get(key->terminal_key, cfg->terminal); |
| 442 | break; |
| 443 | } |
| 444 | case BAL_OBJ_ID__BAL_OBJ_ID_FLOW: |
| 445 | { |
| 446 | err = bal_flow_cfg_get(key->flow_key, cfg->flow); |
| 447 | break; |
| 448 | } |
| 449 | case BAL_OBJ_ID__BAL_OBJ_ID_GROUP: |
| 450 | { |
| 451 | err = bal_group_cfg_get(key->group_key, cfg->group); |
| 452 | break; |
| 453 | } |
| 454 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_QUEUE: |
| 455 | { |
| 456 | err = bal_tm_queue_cfg_get(key->tm_queue_key, cfg->tm_queue_cfg); |
| 457 | break; |
| 458 | } |
| 459 | case BAL_OBJ_ID__BAL_OBJ_ID_TM_SCHED: |
| 460 | { |
| 461 | err = bal_tm_sched_cfg_get(key->tm_sched_key, cfg->tm_sched_cfg); |
| 462 | break; |
| 463 | } |
| 464 | case BAL_OBJ_ID__BAL_OBJ_ID_PACKET: |
| 465 | { |
| 466 | break; |
| 467 | } |
| 468 | default: |
| 469 | { |
| 470 | ASFVOLT_LOG(ASFVOLT_ERROR, "Invalid objet type to handle Get\n"); |
| 471 | err = BAL_ERRNO__BAL_ERR_INVALID_OP; |
| 472 | break; |
| 473 | } |
| 474 | } |
| 475 | return err; |
| 476 | } |
| 477 | |
| 478 | |