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 "bal_indications_hdlr.h" |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 18 | #include "bal_indications_queue.h" |
| 19 | |
| 20 | /*global variables*/ |
| 21 | |
| 22 | /*extern variables*/ |
| 23 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 24 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 25 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 26 | * Function : bal_acc_term_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 27 | * Description : This function will handle the indications for * |
| 28 | * Access Terminal Operational State Change * |
| 29 | * * |
| 30 | ********************************************************************/ |
| 31 | bcmos_errno bal_acc_term_osc_indication_cb(bcmbal_obj *obj) |
| 32 | { |
| 33 | bcmos_errno result = BCM_ERR_OK; |
| 34 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 35 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 36 | bcmbal_access_terminal_auto_id_oper_status_change != obj->subgroup) |
| 37 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 38 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 39 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 40 | result = BCM_ERR_INTERNAL; |
| 41 | } |
| 42 | else |
| 43 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 44 | BalIndications *balIndCfg; |
| 45 | balIndCfg = malloc(sizeof(BalIndications)); |
| 46 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 47 | bal_indications__init(balIndCfg); |
| 48 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 49 | balIndCfg->objtype = obj->obj_type; |
| 50 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 51 | balIndCfg->sub_group = obj->subgroup; |
| 52 | balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE; |
| 53 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 54 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 55 | bcmbal_access_terminal_oper_status_change *acc_term_osc = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 56 | (bcmbal_access_terminal_oper_status_change *)obj; |
| 57 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 58 | BalAccessTerminalOperStatusChange *acessTermOSC; |
| 59 | acessTermOSC = malloc(sizeof(BalAccessTerminalOperStatusChange)); |
| 60 | memset(acessTermOSC, 0, sizeof(BalAccessTerminalOperStatusChange)); |
| 61 | bal_access_terminal_oper_status_change__init(acessTermOSC); |
| 62 | balIndCfg->access_term_ind_op_state = acessTermOSC; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 63 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 64 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 65 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 66 | BalAccessTerminalKey *accessTermkey; |
| 67 | accessTermkey = malloc(sizeof(BalAccessTerminalKey)); |
| 68 | memset(accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 69 | bal_access_terminal_key__init(accessTermkey); |
| 70 | balIndCfg->access_term_ind_op_state->key = accessTermkey; |
| 71 | balIndCfg->access_term_ind_op_state->key->has_access_term_id = BAL_GRPC_PRES; |
| 72 | balIndCfg->access_term_ind_op_state->key->access_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 73 | acc_term_osc->key.access_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 74 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 75 | BalAccessTerminalOperStatusChangeData *accessTermOscData; |
| 76 | accessTermOscData = malloc(sizeof(BalAccessTerminalOperStatusChangeData)); |
| 77 | memset(accessTermOscData, 0, sizeof(BalAccessTerminalOperStatusChangeData)); |
| 78 | bal_access_terminal_oper_status_change_data__init(accessTermOscData); |
| 79 | balIndCfg->access_term_ind_op_state->data = accessTermOscData; |
| 80 | balIndCfg->access_term_ind_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 81 | balIndCfg->access_term_ind_op_state->data->new_oper_status = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 82 | acc_term_osc->data.new_oper_status; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 83 | balIndCfg->access_term_ind_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 84 | balIndCfg->access_term_ind_op_state->data->old_oper_status = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 85 | acc_term_osc->data.old_oper_status; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 86 | balIndCfg->access_term_ind_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 87 | balIndCfg->access_term_ind_op_state->data->admin_state = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 88 | acc_term_osc->data.admin_state; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 89 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 90 | bal_register_indication_cbs(); |
| 91 | |
| 92 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 93 | bal_indication_node->bal_indication = balIndCfg; |
| 94 | |
| 95 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 96 | add_bal_indication_node(bal_indication_node); |
| 97 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 98 | is_reboot = BAL_REBOOT_STATUS__BAL_OLT_UP_AFTER_ACTIVATION; |
| 99 | } |
| 100 | |
| 101 | return result; |
| 102 | } |
| 103 | |
| 104 | /********************************************************************\ |
| 105 | * Function : bal_acc_term_processing_error_indication_cb * |
| 106 | * Description : This function will handle the error indications * |
| 107 | * for Access Terminal * |
| 108 | * * |
| 109 | ********************************************************************/ |
| 110 | bcmos_errno bal_acc_term_processing_error_indication_cb(bcmbal_obj *obj) |
| 111 | { |
| 112 | bcmos_errno result = BCM_ERR_OK; |
| 113 | |
| 114 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
| 115 | bcmbal_access_terminal_auto_id_processing_error != obj->subgroup) |
| 116 | { |
| 117 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 118 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 119 | result = BCM_ERR_INTERNAL; |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | BalIndications *balIndCfg; |
| 124 | balIndCfg = malloc(sizeof(BalIndications)); |
| 125 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 126 | bal_indications__init(balIndCfg); |
| 127 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 128 | balIndCfg->objtype = obj->obj_type; |
| 129 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 130 | balIndCfg->sub_group = obj->subgroup; |
| 131 | balIndCfg->u_case = BAL_INDICATIONS__U_ACCESS_TERM_PROC_ERR; |
| 132 | balIndCfg->device_id = voltha_device_id; |
| 133 | |
| 134 | bcmbal_access_terminal_processing_error *acc_term_err = |
| 135 | (bcmbal_access_terminal_processing_error *)obj; |
| 136 | |
| 137 | BalAccessTerminalProcessingError *acessTermError; |
| 138 | acessTermError = malloc(sizeof(BalAccessTerminalProcessingError)); |
| 139 | memset(acessTermError, 0, sizeof(BalAccessTerminalProcessingError)); |
| 140 | bal_access_terminal_processing_error__init(acessTermError); |
| 141 | balIndCfg->access_term_proc_err = acessTermError; |
| 142 | |
| 143 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 144 | |
| 145 | BalAccessTerminalKey *accessTermkey; |
| 146 | accessTermkey = malloc(sizeof(BalAccessTerminalKey)); |
| 147 | memset(accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 148 | bal_access_terminal_key__init(accessTermkey); |
| 149 | balIndCfg->access_term_proc_err->key = accessTermkey; |
| 150 | balIndCfg->access_term_proc_err->key->has_access_term_id = BAL_GRPC_PRES; |
| 151 | balIndCfg->access_term_proc_err->key->access_term_id = |
| 152 | acc_term_err->key.access_term_id; |
| 153 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 154 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 155 | bal_indication_node->bal_indication = balIndCfg; |
| 156 | |
| 157 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 158 | add_bal_indication_node(bal_indication_node); |
| 159 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | return result; |
| 163 | } |
| 164 | |
| 165 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 166 | * Function : bal_flow_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 167 | * Description : This function will handle the indications for * |
| 168 | * Flow Operational State Change * |
| 169 | * * |
| 170 | ********************************************************************/ |
| 171 | bcmos_errno bal_flow_osc_indication_cb(bcmbal_obj *obj) |
| 172 | { |
| 173 | bcmos_errno result = BCM_ERR_OK; |
| 174 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 175 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 176 | bcmbal_flow_auto_id_oper_status_change != obj->subgroup) |
| 177 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 178 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 179 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 180 | result = BCM_ERR_INTERNAL; |
| 181 | } |
| 182 | else |
| 183 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 184 | BalIndications *balIndCfg; |
| 185 | balIndCfg = malloc(sizeof(BalIndications)); |
| 186 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 187 | bal_indications__init(balIndCfg); |
| 188 | balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_OP_STATE; |
| 189 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 190 | balIndCfg->objtype = obj->obj_type; |
| 191 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 192 | balIndCfg->sub_group = obj->subgroup; |
| 193 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 194 | |
| 195 | bcmbal_flow_oper_status_change *flow_osc = (bcmbal_flow_oper_status_change *)obj; |
| 196 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 197 | BalFlowOperStatusChange *flowOscInd; |
| 198 | flowOscInd = malloc(sizeof(BalFlowOperStatusChange)); |
| 199 | memset(flowOscInd, 0, sizeof(BalFlowOperStatusChange)); |
| 200 | bal_flow_oper_status_change__init(flowOscInd); |
| 201 | balIndCfg->flow_op_state = flowOscInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 202 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 203 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 204 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 205 | BalFlowKey *flowkey; |
| 206 | flowkey = malloc(sizeof(BalFlowKey)); |
| 207 | memset(flowkey, 0, sizeof(BalFlowKey)); |
| 208 | bal_flow_key__init(flowkey); |
| 209 | balIndCfg->flow_op_state->key = flowkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 210 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 211 | balIndCfg->flow_op_state->key->has_flow_id = BAL_GRPC_PRES; |
| 212 | balIndCfg->flow_op_state->key->flow_id = flow_osc->key.flow_id; |
| 213 | balIndCfg->flow_op_state->key->has_flow_type = BAL_GRPC_PRES; |
| 214 | balIndCfg->flow_op_state->key->flow_type = flow_osc->key.flow_type; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 215 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 216 | BalFlowOperStatusChangeData *flowOscIndData; |
| 217 | flowOscIndData = malloc(sizeof(BalFlowOperStatusChangeData)); |
| 218 | memset(flowOscIndData, 0, sizeof(BalFlowOperStatusChangeData)); |
| 219 | bal_flow_oper_status_change_data__init(flowOscIndData); |
| 220 | balIndCfg->flow_op_state->data = flowOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 221 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 222 | balIndCfg->flow_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 223 | balIndCfg->flow_op_state->data->new_oper_status = flow_osc->data.new_oper_status; |
| 224 | balIndCfg->flow_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 225 | balIndCfg->flow_op_state->data->old_oper_status = flow_osc->data.old_oper_status; |
| 226 | balIndCfg->flow_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 227 | balIndCfg->flow_op_state->data->admin_state = flow_osc->data.admin_state; |
| 228 | balIndCfg->flow_op_state->data->has_svc_port_id = BAL_GRPC_PRES; |
| 229 | balIndCfg->flow_op_state->data->svc_port_id = flow_osc->data.svc_port_id; |
| 230 | balIndCfg->flow_op_state->data->has_dba_tm_sched_id = BAL_GRPC_PRES; |
| 231 | balIndCfg->flow_op_state->data->dba_tm_sched_id = flow_osc->data.dba_tm_sched_id; |
| 232 | balIndCfg->flow_op_state->data->has_cookie = BAL_GRPC_PRES; |
| 233 | balIndCfg->flow_op_state->data->cookie = flow_osc->data.cookie; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 234 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 235 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 236 | bal_indication_node->bal_indication = balIndCfg; |
| 237 | |
| 238 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 239 | add_bal_indication_node(bal_indication_node); |
| 240 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | return result; |
| 244 | } |
| 245 | |
| 246 | /********************************************************************\ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 247 | * Function : bal_flow_processing_error_indication_cb * |
| 248 | * Description : This function will handle flow processing errors * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 249 | * * |
| 250 | ********************************************************************/ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 251 | bcmos_errno bal_flow_processing_error_indication_cb(bcmbal_obj *obj) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 252 | { |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 253 | bcmos_errno result = BCM_ERR_OK; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 254 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 255 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 256 | bcmbal_flow_auto_id_processing_error != obj->subgroup) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 257 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 258 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 259 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 260 | result = BCM_ERR_INTERNAL; |
| 261 | } |
| 262 | else |
| 263 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 264 | BalIndications *balIndCfg; |
| 265 | balIndCfg = malloc(sizeof(BalIndications)); |
| 266 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 267 | bal_indications__init(balIndCfg); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 268 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 269 | balIndCfg->objtype = obj->obj_type; |
| 270 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 271 | balIndCfg->sub_group = obj->subgroup; |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 272 | balIndCfg->u_case = BAL_INDICATIONS__U_FLOW_PROC_ERR; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 273 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 274 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 275 | bcmbal_flow_processing_error *flow_proc_error = |
| 276 | (bcmbal_flow_processing_error *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 277 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 278 | BalFlowProcessingError *flowProcError; |
| 279 | flowProcError = malloc(sizeof(BalFlowProcessingError)); |
| 280 | memset(flowProcError, 0, sizeof(BalFlowProcessingError)); |
| 281 | bal_flow_processing_error__init(flowProcError); |
| 282 | balIndCfg->flow_proc_err = flowProcError; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 283 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 284 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 285 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 286 | BalFlowKey *flowKey; |
| 287 | flowKey = malloc(sizeof(BalFlowKey)); |
| 288 | memset(flowKey, 0, sizeof(BalFlowKey)); |
| 289 | bal_flow_key__init(flowKey); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 290 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 291 | balIndCfg->flow_proc_err->key = flowKey; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 292 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 293 | balIndCfg->flow_proc_err->key->has_flow_id = BAL_GRPC_PRES; |
| 294 | balIndCfg->flow_proc_err->key->flow_id = |
| 295 | flow_proc_error->key.flow_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 296 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 297 | balIndCfg->flow_proc_err->key->has_flow_type = BAL_GRPC_PRES; |
| 298 | balIndCfg->flow_proc_err->key->flow_type = |
| 299 | flow_proc_error->key.flow_type; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 300 | |
| 301 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 302 | bal_indication_node->bal_indication = balIndCfg; |
| 303 | |
| 304 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 305 | add_bal_indication_node(bal_indication_node); |
| 306 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 307 | } |
| 308 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 309 | |
| 310 | return result; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 311 | } |
| 312 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 313 | |
| 314 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 315 | * Function : bal_interface_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 316 | * Description : This function will handle the indications for * |
| 317 | * Interface Operational State Change * |
| 318 | * * |
| 319 | ********************************************************************/ |
| 320 | bcmos_errno bal_interface_osc_indication_cb(bcmbal_obj *obj) |
| 321 | { |
| 322 | bcmos_errno result = BCM_ERR_OK; |
| 323 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 324 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 325 | bcmbal_interface_auto_id_oper_status_change != obj->subgroup) |
| 326 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 327 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 328 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 329 | result = BCM_ERR_INTERNAL; |
| 330 | } |
| 331 | else |
| 332 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 333 | BalIndications *balIndCfg; |
| 334 | balIndCfg = malloc(sizeof(BalIndications)); |
| 335 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 336 | bal_indications__init(balIndCfg); |
| 337 | balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_OP_STATE; |
| 338 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 339 | balIndCfg->objtype = obj->obj_type; |
| 340 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 341 | balIndCfg->sub_group = obj->subgroup; |
| 342 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 343 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 344 | bcmbal_interface_oper_status_change *int_osc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 345 | (bcmbal_interface_oper_status_change *)obj; |
| 346 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 347 | BalInterfaceOperStatusChange *ifOsc; |
| 348 | ifOsc = malloc(sizeof(BalInterfaceOperStatusChange)); |
| 349 | memset(ifOsc, 0, sizeof(BalInterfaceOperStatusChange)); |
| 350 | bal_interface_oper_status_change__init(ifOsc); |
| 351 | balIndCfg->interface_op_state = ifOsc; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 352 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 353 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 354 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 355 | BalInterfaceKey *ifkey; |
| 356 | ifkey = malloc(sizeof(BalInterfaceKey)); |
| 357 | memset(ifkey, 0, sizeof(BalInterfaceKey)); |
| 358 | bal_interface_key__init(ifkey); |
| 359 | balIndCfg->interface_op_state->key = ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 360 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 361 | balIndCfg->interface_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 362 | balIndCfg->interface_op_state->key->intf_id = int_osc_ind->key.intf_id; |
| 363 | balIndCfg->interface_op_state->key->has_intf_type = BAL_GRPC_PRES; |
| 364 | balIndCfg->interface_op_state->key->intf_type = int_osc_ind->key.intf_type; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 365 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 366 | BalInterfaceOperStatusChangeData *ifOscIndData; |
| 367 | ifOscIndData = malloc(sizeof(BalInterfaceOperStatusChangeData)); |
| 368 | memset(ifOscIndData, 0, sizeof(BalInterfaceOperStatusChangeData)); |
| 369 | bal_interface_oper_status_change_data__init(ifOscIndData); |
| 370 | balIndCfg->interface_op_state->data = ifOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 371 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 372 | balIndCfg->interface_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 373 | balIndCfg->interface_op_state->data->new_oper_status = int_osc_ind->data.new_oper_status; |
| 374 | balIndCfg->interface_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 375 | balIndCfg->interface_op_state->data->old_oper_status = int_osc_ind->data.old_oper_status; |
| 376 | balIndCfg->interface_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 377 | balIndCfg->interface_op_state->data->admin_state = int_osc_ind->data.admin_state; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 378 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 379 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 380 | bal_indication_node->bal_indication = balIndCfg; |
| 381 | |
| 382 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 383 | add_bal_indication_node(bal_indication_node); |
| 384 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | return result; |
| 388 | } |
| 389 | |
| 390 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 391 | * Function : bal_interface_los_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 392 | * Description : This function will handle the indications for * |
| 393 | * Interface los Indication * |
| 394 | * * |
| 395 | ********************************************************************/ |
| 396 | bcmos_errno bal_interface_los_indication_cb(bcmbal_obj *obj) |
| 397 | { |
| 398 | bcmos_errno result = BCM_ERR_OK; |
| 399 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 400 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 401 | bcmbal_interface_auto_id_los != obj->subgroup) |
| 402 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 403 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 404 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 405 | result = BCM_ERR_INTERNAL; |
| 406 | } |
| 407 | else |
| 408 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 409 | BalIndications *balIndCfg; |
| 410 | balIndCfg = malloc(sizeof(BalIndications)); |
| 411 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 412 | bal_indications__init(balIndCfg); |
| 413 | balIndCfg->u_case = BAL_INDICATIONS__U_INTERFACE_LOS; |
| 414 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 415 | balIndCfg->objtype = obj->obj_type; |
| 416 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 417 | balIndCfg->sub_group = obj->subgroup; |
| 418 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 419 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 420 | bcmbal_interface_los *int_los_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 421 | (bcmbal_interface_los *)obj; |
| 422 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 423 | BalInterfaceLos *ifLos; |
| 424 | ifLos = malloc(sizeof(BalInterfaceLos)); |
| 425 | memset(ifLos, 0, sizeof(BalInterfaceLos)); |
| 426 | bal_interface_los__init(ifLos); |
| 427 | balIndCfg->interface_los = ifLos; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 428 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 429 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 430 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 431 | BalInterfaceKey *ifkey; |
| 432 | ifkey = malloc(sizeof(BalInterfaceKey)); |
| 433 | memset(ifkey, 0, sizeof(BalInterfaceKey)); |
| 434 | bal_interface_key__init(ifkey); |
| 435 | balIndCfg->interface_los->key = ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 436 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 437 | balIndCfg->interface_los->key->has_intf_id = BAL_GRPC_PRES; |
| 438 | balIndCfg->interface_los->key->intf_id = int_los_ind->key.intf_id; |
| 439 | balIndCfg->interface_los->key->has_intf_type = BAL_GRPC_PRES; |
| 440 | balIndCfg->interface_los->key->intf_type = int_los_ind->key.intf_type; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 441 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 442 | BalInterfaceLosData *ifLosIndData; |
| 443 | ifLosIndData = malloc(sizeof(BalInterfaceLosData)); |
| 444 | memset(ifLosIndData, 0, sizeof(BalInterfaceLosData)); |
| 445 | bal_interface_los_data__init(ifLosIndData); |
| 446 | balIndCfg->interface_los->data = ifLosIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 447 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 448 | balIndCfg->interface_los->data->has_status = BAL_GRPC_PRES; |
| 449 | balIndCfg->interface_los->data->status = int_los_ind->data.status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 450 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 451 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 452 | bal_indication_node->bal_indication = balIndCfg; |
| 453 | |
| 454 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 455 | add_bal_indication_node(bal_indication_node); |
| 456 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | return result; |
| 460 | } |
| 461 | |
| 462 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 463 | * Function : bal_sub_term_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 464 | * Description : This function will handle the indications for * |
| 465 | * Subscriber term Operational State Change * |
| 466 | * * |
| 467 | ********************************************************************/ |
| 468 | bcmos_errno bal_sub_term_osc_indication_cb(bcmbal_obj *obj) |
| 469 | { |
| 470 | bcmos_errno result = BCM_ERR_OK; |
| 471 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 472 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 473 | bcmbal_subscriber_terminal_auto_id_oper_status_change != obj->subgroup) |
| 474 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 475 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 476 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 477 | result = BCM_ERR_INTERNAL; |
| 478 | } |
| 479 | else |
| 480 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 481 | BalIndications *balIndCfg; |
| 482 | balIndCfg = malloc(sizeof(BalIndications)); |
| 483 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 484 | bal_indications__init(balIndCfg); |
| 485 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_OP_STATE; |
| 486 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 487 | balIndCfg->objtype = obj->obj_type; |
| 488 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 489 | balIndCfg->sub_group = obj->subgroup; |
| 490 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 491 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 492 | bcmbal_subscriber_terminal_oper_status_change *sub_osc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 493 | (bcmbal_subscriber_terminal_oper_status_change *)obj; |
| 494 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 495 | BalSubscriberTerminalOperStatusChange *subOscInd; |
| 496 | subOscInd = malloc(sizeof(BalSubscriberTerminalOperStatusChange)); |
| 497 | memset(subOscInd, 0, sizeof(BalSubscriberTerminalOperStatusChange)); |
| 498 | bal_subscriber_terminal_oper_status_change__init(subOscInd); |
| 499 | balIndCfg->terminal_op_state = subOscInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 500 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 501 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 502 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 503 | BalSubscriberTerminalKey *subkey; |
| 504 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 505 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 506 | bal_subscriber_terminal_key__init(subkey); |
| 507 | balIndCfg->terminal_op_state->key = subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 508 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 509 | balIndCfg->terminal_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 510 | balIndCfg->terminal_op_state->key->intf_id = sub_osc_ind->key.intf_id; |
| 511 | balIndCfg->terminal_op_state->key->has_sub_term_id = BAL_GRPC_PRES; |
| 512 | balIndCfg->terminal_op_state->key->sub_term_id = sub_osc_ind->key.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 513 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 514 | BalSubscriberTerminalOperStatusChangeData *subOscIndData; |
| 515 | subOscIndData = malloc(sizeof(BalSubscriberTerminalOperStatusChangeData)); |
| 516 | memset(subOscIndData, 0, sizeof(BalSubscriberTerminalOperStatusChangeData)); |
| 517 | bal_subscriber_terminal_oper_status_change_data__init(subOscIndData); |
| 518 | balIndCfg->terminal_op_state->data = subOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 519 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 520 | balIndCfg->terminal_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 521 | balIndCfg->terminal_op_state->data->new_oper_status = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 522 | sub_osc_ind->data.new_oper_status; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 523 | balIndCfg->terminal_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 524 | balIndCfg->terminal_op_state->data->old_oper_status = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 525 | sub_osc_ind->data.old_oper_status; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 526 | balIndCfg->terminal_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 527 | balIndCfg->terminal_op_state->data->admin_state = |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 528 | sub_osc_ind->data.admin_state; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 529 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 530 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 531 | bal_indication_node->bal_indication = balIndCfg; |
| 532 | |
| 533 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 534 | add_bal_indication_node(bal_indication_node); |
| 535 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 536 | } |
| 537 | |
| 538 | return result; |
| 539 | } |
| 540 | |
| 541 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 542 | * Function : bal_sub_term_disc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 543 | * Description : This function will handle the indications for * |
| 544 | * Subscriber term disc indication * |
| 545 | * * |
| 546 | ********************************************************************/ |
| 547 | bcmos_errno bal_sub_term_disc_indication_cb(bcmbal_obj *obj) |
| 548 | { |
| 549 | bcmos_errno result = BCM_ERR_OK; |
| 550 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 551 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 552 | bcmbal_subscriber_terminal_auto_id_sub_term_disc != obj->subgroup) |
| 553 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 554 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 555 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 556 | result = BCM_ERR_INTERNAL; |
| 557 | } |
| 558 | else |
| 559 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 560 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 561 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 562 | BalIndications *balIndCfg; |
| 563 | balIndCfg = malloc(sizeof(BalIndications)); |
| 564 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 565 | bal_indications__init(balIndCfg); |
| 566 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DISC; |
| 567 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 568 | balIndCfg->objtype = obj->obj_type; |
| 569 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 570 | balIndCfg->sub_group = obj->subgroup; |
| 571 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 572 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 573 | bcmbal_subscriber_terminal_sub_term_disc *sub_disc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 574 | (bcmbal_subscriber_terminal_sub_term_disc *)obj; |
| 575 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 576 | BalSubscriberTerminalSubTermDisc *subDiscInd; |
| 577 | subDiscInd = malloc(sizeof(BalSubscriberTerminalSubTermDisc)); |
| 578 | memset(subDiscInd, 0, sizeof(BalSubscriberTerminalSubTermDisc)); |
| 579 | bal_subscriber_terminal_sub_term_disc__init(subDiscInd); |
| 580 | balIndCfg->terminal_disc = subDiscInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 581 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 582 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 583 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 584 | BalSubscriberTerminalKey *subkey; |
| 585 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 586 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 587 | bal_subscriber_terminal_key__init(subkey); |
| 588 | balIndCfg->terminal_disc->key = subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 589 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 590 | balIndCfg->terminal_disc->key->has_intf_id = BAL_GRPC_PRES; |
| 591 | balIndCfg->terminal_disc->key->intf_id = sub_disc_ind->key.intf_id; |
| 592 | balIndCfg->terminal_disc->key->has_sub_term_id = BAL_GRPC_PRES; |
| 593 | balIndCfg->terminal_disc->key->sub_term_id = sub_disc_ind->key.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 594 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 595 | BalSubscriberTerminalSubTermDiscData *subDiscIndData; |
| 596 | subDiscIndData = malloc(sizeof(BalSubscriberTerminalSubTermDiscData)); |
| 597 | memset(subDiscIndData, 0, sizeof(BalSubscriberTerminalSubTermDiscData)); |
| 598 | bal_subscriber_terminal_sub_term_disc_data__init(subDiscIndData); |
| 599 | balIndCfg->terminal_disc->data = subDiscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 600 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 601 | BalSerialNumber *serial_number; |
| 602 | serial_number = malloc(sizeof(BalSerialNumber)); |
| 603 | memset(serial_number, 0, sizeof(BalSerialNumber)); |
| 604 | bal_serial_number__init(serial_number); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 605 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 606 | balIndCfg->terminal_disc->data->serial_number = serial_number; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 607 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 608 | ASFVOLT_LOG(ASFVOLT_INFO, "Discovered ONU serial number " |
| 609 | "%c%c%c%c%02X%02X%02X%02X", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 610 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 611 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 612 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 613 | sub_disc_ind->data.serial_number.vendor_id[3], |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 614 | sub_disc_ind->data.serial_number.vendor_specific[0], |
| 615 | sub_disc_ind->data.serial_number.vendor_specific[1], |
| 616 | sub_disc_ind->data.serial_number.vendor_specific[2], |
| 617 | sub_disc_ind->data.serial_number.vendor_specific[3]); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 618 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 619 | //ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor id is %s", sub_disc_ind->data.serial_number.vendor_id); |
| 620 | //ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor specific is %s", sub_disc_ind->data.serial_number.vendor_specific); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 621 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 622 | char *vendor_id = malloc(sizeof(char)*MAX_CHAR_LENGTH); |
| 623 | memset(vendor_id, 0, MAX_CHAR_LENGTH); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 624 | sprintf(vendor_id,"%c%c%c%c", |
| 625 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 626 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 627 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 628 | sub_disc_ind->data.serial_number.vendor_id[3]); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 629 | balIndCfg->terminal_disc->data->serial_number->vendor_id = vendor_id; |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 630 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor id is %s", balIndCfg->terminal_disc->data->serial_number->vendor_id); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 631 | char *vendor_specific = malloc(sizeof(char)*MAX_CHAR_LENGTH); |
| 632 | memset(vendor_specific, 0, MAX_CHAR_LENGTH); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 633 | sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X", |
| 634 | sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 635 | sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 636 | sub_disc_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 637 | sub_disc_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 638 | sub_disc_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 639 | sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 640 | sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 641 | sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 642 | balIndCfg->terminal_disc->data->serial_number->vendor_specific = vendor_specific; |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 643 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor specific is %s", balIndCfg->terminal_disc->data->serial_number->vendor_specific); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 644 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 645 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 646 | bal_indication_node->bal_indication = balIndCfg; |
| 647 | |
| 648 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 649 | add_bal_indication_node(bal_indication_node); |
| 650 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 651 | } |
| 652 | |
| 653 | return result; |
| 654 | } |
| 655 | |
| 656 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 657 | * Function : bal_sub_term_alarm_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 658 | * Description : This function will handle the indications for * |
| 659 | * Subscriber term alarm indication * |
| 660 | * * |
| 661 | ********************************************************************/ |
| 662 | bcmos_errno bal_sub_term_alarm_indication_cb(bcmbal_obj *obj) |
| 663 | { |
| 664 | bcmos_errno result = BCM_ERR_OK; |
| 665 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 666 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 667 | bcmbal_subscriber_terminal_auto_id_sub_term_alarm != obj->subgroup) |
| 668 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 669 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 670 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 671 | result = BCM_ERR_INTERNAL; |
| 672 | } |
| 673 | else |
| 674 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 675 | BalIndications *balIndCfg; |
| 676 | balIndCfg = malloc(sizeof(BalIndications)); |
| 677 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 678 | bal_indications__init(balIndCfg); |
| 679 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 680 | balIndCfg->objtype = BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
| 681 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 682 | balIndCfg->sub_group = obj->subgroup; |
| 683 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 684 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 685 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_ALARM; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 686 | bcmbal_subscriber_terminal_sub_term_alarm *sub_term_alarm = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 687 | (bcmbal_subscriber_terminal_sub_term_alarm *)obj; |
| 688 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 689 | BalSubscriberTerminalSubTermAlarm *subTermAlarm; |
| 690 | subTermAlarm = malloc(sizeof(BalSubscriberTerminalSubTermAlarm)); |
| 691 | memset(subTermAlarm, 0, sizeof(BalSubscriberTerminalSubTermAlarm)); |
| 692 | bal_subscriber_terminal_sub_term_alarm__init(subTermAlarm); |
| 693 | balIndCfg->terminal_alarm = subTermAlarm; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 694 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 695 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 696 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 697 | BalSubscriberTerminalKey *subkey; |
| 698 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 699 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 700 | bal_subscriber_terminal_key__init(subkey); |
| 701 | balIndCfg->terminal_alarm->key = subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 702 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 703 | balIndCfg->terminal_alarm->key->has_sub_term_id = BAL_GRPC_PRES; |
| 704 | balIndCfg->terminal_alarm->key->sub_term_id = sub_term_alarm->key.sub_term_id; |
| 705 | balIndCfg->terminal_alarm->key->has_intf_id = BAL_GRPC_PRES; |
| 706 | balIndCfg->terminal_alarm->key->intf_id = sub_term_alarm->key.intf_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 707 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 708 | BalsubscriberTerminalSubTermAlarmData *subTermAlarmData; |
| 709 | subTermAlarmData = malloc(sizeof(BalsubscriberTerminalSubTermAlarmData)); |
| 710 | memset(subTermAlarmData, 0, sizeof(BalsubscriberTerminalSubTermAlarmData)); |
| 711 | balsubscriber_terminal_sub_term_alarm_data__init(subTermAlarmData); |
| 712 | balIndCfg->terminal_alarm->data = subTermAlarmData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 713 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 714 | BalSubscriberTerminalAlarms *balSubAlarms; |
| 715 | balSubAlarms = malloc(sizeof(BalSubscriberTerminalAlarms)); |
| 716 | memset(balSubAlarms, 0, sizeof(BalSubscriberTerminalAlarms)); |
| 717 | bal_subscriber_terminal_alarms__init(balSubAlarms); |
| 718 | balIndCfg->terminal_alarm->data->alarm = balSubAlarms; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 719 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 720 | balIndCfg->terminal_alarm->data->alarm->has_los = BAL_GRPC_PRES; |
| 721 | balIndCfg->terminal_alarm->data->alarm->los = sub_term_alarm->data.alarm.los; |
| 722 | balIndCfg->terminal_alarm->data->alarm->has_lob = BAL_GRPC_PRES; |
| 723 | balIndCfg->terminal_alarm->data->alarm->lob = sub_term_alarm->data.alarm.lob; |
| 724 | balIndCfg->terminal_alarm->data->alarm->has_lopc_miss = BAL_GRPC_PRES; |
| 725 | balIndCfg->terminal_alarm->data->alarm->lopc_miss = sub_term_alarm->data.alarm.lopc_miss; |
| 726 | balIndCfg->terminal_alarm->data->alarm->has_lopc_mic_error = BAL_GRPC_PRES; |
| 727 | balIndCfg->terminal_alarm->data->alarm->lopc_mic_error = sub_term_alarm->data.alarm.lopc_mic_error; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 728 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 729 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 730 | bal_indication_node->bal_indication = balIndCfg; |
| 731 | |
| 732 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 733 | add_bal_indication_node(bal_indication_node); |
| 734 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 735 | } |
| 736 | |
| 737 | return result; |
| 738 | } |
| 739 | |
| 740 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 741 | * Function : bal_sub_term_dgi_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 742 | * Description : This function will handle the indications for * |
| 743 | * Subscriber term dgi indication * |
| 744 | * * |
| 745 | ********************************************************************/ |
| 746 | bcmos_errno bal_sub_term_dgi_indication_cb(bcmbal_obj *obj) |
| 747 | { |
| 748 | bcmos_errno result = BCM_ERR_OK; |
| 749 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 750 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 751 | bcmbal_subscriber_terminal_auto_id_dgi != obj->subgroup) |
| 752 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 753 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 754 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 755 | result = BCM_ERR_INTERNAL; |
| 756 | } |
| 757 | else |
| 758 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 759 | BalIndications *balIndCfg; |
| 760 | balIndCfg = malloc(sizeof(BalIndications)); |
| 761 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 762 | bal_indications__init(balIndCfg); |
| 763 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DGI; |
| 764 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 765 | balIndCfg->objtype = obj->obj_type; |
| 766 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 767 | balIndCfg->sub_group = obj->subgroup; |
| 768 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 769 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 770 | bcmbal_subscriber_terminal_dgi *sub_dgi_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 771 | (bcmbal_subscriber_terminal_dgi *)obj; |
| 772 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 773 | BalSubscriberTerminalDgi *subDgiInd; |
| 774 | subDgiInd = malloc(sizeof(BalSubscriberTerminalDgi)); |
| 775 | memset(subDgiInd, 0, sizeof(BalSubscriberTerminalDgi)); |
| 776 | bal_subscriber_terminal_dgi__init(subDgiInd); |
| 777 | balIndCfg->terminal_dgi= subDgiInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 778 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 779 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 780 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 781 | BalSubscriberTerminalKey *subkey; |
| 782 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 783 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 784 | bal_subscriber_terminal_key__init(subkey); |
| 785 | balIndCfg->terminal_dgi->key = subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 786 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 787 | balIndCfg->terminal_dgi->key->has_intf_id = BAL_GRPC_PRES; |
| 788 | balIndCfg->terminal_dgi->key->intf_id = sub_dgi_ind->key.intf_id; |
| 789 | balIndCfg->terminal_dgi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 790 | balIndCfg->terminal_dgi->key->sub_term_id = sub_dgi_ind->key.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 791 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 792 | BalSubscriberTerminalDgiData *subDgiIndData; |
| 793 | subDgiIndData = malloc(sizeof(BalSubscriberTerminalDgiData)); |
| 794 | memset(subDgiIndData, 0, sizeof(BalSubscriberTerminalDgiData)); |
| 795 | bal_subscriber_terminal_dgi_data__init(subDgiIndData); |
| 796 | balIndCfg->terminal_dgi->data = subDgiIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 797 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 798 | balIndCfg->terminal_dgi->data->has_dgi_status = BAL_GRPC_PRES; |
| 799 | balIndCfg->terminal_dgi->data->dgi_status = sub_dgi_ind->data.dgi_status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 800 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 801 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 802 | bal_indication_node->bal_indication = balIndCfg; |
| 803 | |
| 804 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 805 | add_bal_indication_node(bal_indication_node); |
| 806 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | return result; |
| 810 | } |
| 811 | |
| 812 | /********************************************************************\ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 813 | * Function : bal_sub_term_dowi_indication_cb * |
| 814 | * Description : This function will handle dowi indication * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 815 | * * |
| 816 | ********************************************************************/ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 817 | bcmos_errno bal_sub_term_dowi_indication_cb(bcmbal_obj *obj) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 818 | { |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 819 | bcmos_errno result = BCM_ERR_OK; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 820 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 821 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 822 | bcmbal_subscriber_terminal_auto_id_dowi != obj->subgroup) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 823 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 824 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 825 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 826 | result = BCM_ERR_INTERNAL; |
| 827 | } |
| 828 | else |
| 829 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 830 | BalIndications *balIndCfg; |
| 831 | balIndCfg = malloc(sizeof(BalIndications)); |
| 832 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 833 | bal_indications__init(balIndCfg); |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 834 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_DOWI; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 835 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 836 | balIndCfg->objtype = obj->obj_type; |
| 837 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 838 | balIndCfg->sub_group = obj->subgroup; |
| 839 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 840 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 841 | bcmbal_subscriber_terminal_dowi *sub_dowi_ind = |
| 842 | (bcmbal_subscriber_terminal_dowi *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 843 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 844 | BalSubscriberTerminalDowi *subDowiInd; |
| 845 | subDowiInd = malloc(sizeof(BalSubscriberTerminalDowi)); |
| 846 | memset(subDowiInd, 0, sizeof(BalSubscriberTerminalDowi)); |
| 847 | bal_subscriber_terminal_dowi__init(subDowiInd); |
| 848 | balIndCfg->terminal_dowi= subDowiInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 849 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 850 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 851 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 852 | BalSubscriberTerminalKey *subkey; |
| 853 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 854 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 855 | bal_subscriber_terminal_key__init(subkey); |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 856 | balIndCfg->terminal_dowi->key = subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 857 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 858 | balIndCfg->terminal_dowi->key->has_intf_id = BAL_GRPC_PRES; |
| 859 | balIndCfg->terminal_dowi->key->intf_id = sub_dowi_ind->key.intf_id; |
| 860 | balIndCfg->terminal_dowi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 861 | balIndCfg->terminal_dowi->key->sub_term_id = sub_dowi_ind->key.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 862 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 863 | BalSubscriberTerminalDowiData *subDowiIndData; |
| 864 | subDowiIndData = malloc(sizeof(BalSubscriberTerminalDowiData)); |
| 865 | memset(subDowiIndData, 0, sizeof(BalSubscriberTerminalDowiData)); |
| 866 | bal_subscriber_terminal_dowi_data__init(subDowiIndData); |
| 867 | balIndCfg->terminal_dowi->data = subDowiIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 868 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 869 | balIndCfg->terminal_dowi->data->has_dowi_status = BAL_GRPC_PRES; |
| 870 | balIndCfg->terminal_dowi->data->dowi_status = sub_dowi_ind->data.dowi_status; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 871 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 872 | balIndCfg->terminal_dowi->data->has_drift_value = BAL_GRPC_PRES; |
| 873 | balIndCfg->terminal_dowi->data->drift_value = sub_dowi_ind->data.drift_value; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 874 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 875 | balIndCfg->terminal_dowi->data->has_new_eqd = BAL_GRPC_PRES; |
| 876 | balIndCfg->terminal_dowi->data->new_eqd = sub_dowi_ind->data.new_eqd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 877 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 878 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 879 | bal_indication_node->bal_indication = balIndCfg; |
| 880 | |
| 881 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 882 | add_bal_indication_node(bal_indication_node); |
| 883 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 884 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 885 | return result; |
| 886 | } |
| 887 | |
| 888 | /********************************************************************\ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 889 | * Function : bal_sub_term_looci_indication_cb * |
| 890 | * Description : This function will handle looci indication * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 891 | * * |
| 892 | ********************************************************************/ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 893 | bcmos_errno bal_sub_term_looci_indication_cb(bcmbal_obj *obj) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 894 | { |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 895 | bcmos_errno result = BCM_ERR_OK; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 896 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 897 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 898 | bcmbal_subscriber_terminal_auto_id_looci != obj->subgroup) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 899 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 900 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 901 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 902 | result = BCM_ERR_INTERNAL; |
| 903 | } |
| 904 | else |
| 905 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 906 | BalIndications *balIndCfg; |
| 907 | balIndCfg = malloc(sizeof(BalIndications)); |
| 908 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 909 | bal_indications__init(balIndCfg); |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 910 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_LOOCI; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 911 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 912 | balIndCfg->objtype = obj->obj_type; |
| 913 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 914 | balIndCfg->sub_group = obj->subgroup; |
| 915 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 916 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 917 | bcmbal_subscriber_terminal_looci *sub_looci_ind = |
| 918 | (bcmbal_subscriber_terminal_looci *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 919 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 920 | BalSubscriberTerminalLooci *subLoociInd; |
| 921 | subLoociInd = malloc(sizeof(BalSubscriberTerminalLooci)); |
| 922 | memset(subLoociInd, 0, sizeof(BalSubscriberTerminalLooci)); |
| 923 | bal_subscriber_terminal_looci__init(subLoociInd); |
| 924 | balIndCfg->terminal_looci= subLoociInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 925 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 926 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 927 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 928 | BalSubscriberTerminalKey *subkey; |
| 929 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 930 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 931 | bal_subscriber_terminal_key__init(subkey); |
| 932 | balIndCfg->terminal_looci->key = subkey; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 933 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 934 | balIndCfg->terminal_looci->key->has_intf_id = BAL_GRPC_PRES; |
| 935 | balIndCfg->terminal_looci->key->intf_id = sub_looci_ind->key.intf_id; |
| 936 | balIndCfg->terminal_looci->key->has_sub_term_id = BAL_GRPC_PRES; |
| 937 | balIndCfg->terminal_looci->key->sub_term_id = sub_looci_ind->key.sub_term_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 938 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 939 | BalSubscriberTerminalLoociData *subLoociIndData; |
| 940 | subLoociIndData = malloc(sizeof(BalSubscriberTerminalLoociData)); |
| 941 | memset(subLoociIndData, 0, sizeof(BalSubscriberTerminalLoociData)); |
| 942 | bal_subscriber_terminal_looci_data__init(subLoociIndData); |
| 943 | balIndCfg->terminal_looci->data = subLoociIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 944 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 945 | balIndCfg->terminal_looci->data->has_looci_status = BAL_GRPC_PRES; |
| 946 | balIndCfg->terminal_looci->data->looci_status = sub_looci_ind->data.looci_status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 947 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 948 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 949 | bal_indication_node->bal_indication = balIndCfg; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 950 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 951 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 952 | add_bal_indication_node(bal_indication_node); |
| 953 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 954 | } |
| 955 | return result; |
| 956 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 957 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 958 | /********************************************************************\ |
| 959 | * Function : bal_sub_term_processing_error_indication_cb * |
| 960 | * Description : This function will handle sub term processing error* |
| 961 | * * |
| 962 | ********************************************************************/ |
| 963 | bcmos_errno bal_sub_term_processing_error_indication_cb(bcmbal_obj *obj) |
| 964 | { |
| 965 | bcmos_errno result = BCM_ERR_OK; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 966 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 967 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 968 | bcmbal_subscriber_terminal_auto_id_processing_error != obj->subgroup) |
| 969 | { |
| 970 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 971 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 972 | result = BCM_ERR_INTERNAL; |
| 973 | } |
| 974 | else |
| 975 | { |
| 976 | BalIndications *balIndCfg; |
| 977 | balIndCfg = malloc(sizeof(BalIndications)); |
| 978 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 979 | bal_indications__init(balIndCfg); |
| 980 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_PROC_ERR; |
| 981 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 982 | balIndCfg->objtype = obj->obj_type; |
| 983 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 984 | balIndCfg->sub_group = obj->subgroup; |
| 985 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 986 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 987 | bcmbal_subscriber_terminal_processing_error *sub_proc_err_ind = |
| 988 | (bcmbal_subscriber_terminal_processing_error *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 989 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 990 | BalSubscriberTerminalProcessingError *subProcErrInd; |
| 991 | subProcErrInd = malloc(sizeof(BalSubscriberTerminalProcessingError)); |
| 992 | memset(subProcErrInd, 0, sizeof(BalSubscriberTerminalProcessingError)); |
| 993 | bal_subscriber_terminal_processing_error__init(subProcErrInd); |
| 994 | balIndCfg->terminal_proc_err= subProcErrInd; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 995 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 996 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 997 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 998 | BalSubscriberTerminalKey *subkey; |
| 999 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1000 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1001 | bal_subscriber_terminal_key__init(subkey); |
| 1002 | balIndCfg->terminal_proc_err->key = subkey; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1003 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1004 | balIndCfg->terminal_proc_err->key->has_intf_id = BAL_GRPC_PRES; |
| 1005 | balIndCfg->terminal_proc_err->key->intf_id = sub_proc_err_ind->key.intf_id; |
| 1006 | balIndCfg->terminal_proc_err->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1007 | balIndCfg->terminal_proc_err->key->sub_term_id = sub_proc_err_ind->key.sub_term_id; |
| 1008 | |
| 1009 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1010 | bal_indication_node->bal_indication = balIndCfg; |
| 1011 | |
| 1012 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1013 | add_bal_indication_node(bal_indication_node); |
| 1014 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 1015 | } |
| 1016 | return result; |
| 1017 | } |
| 1018 | |
| 1019 | /********************************************************************\ |
| 1020 | * Function : bal_sub_term_sdi_indication_cb * |
| 1021 | * Description : This function will handle sdi indication * |
| 1022 | * * |
| 1023 | ********************************************************************/ |
| 1024 | bcmos_errno bal_sub_term_sdi_indication_cb(bcmbal_obj *obj) |
| 1025 | { |
| 1026 | bcmos_errno result = BCM_ERR_OK; |
| 1027 | |
| 1028 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1029 | bcmbal_subscriber_terminal_auto_id_sdi != obj->subgroup) |
| 1030 | { |
| 1031 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 1032 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1033 | result = BCM_ERR_INTERNAL; |
| 1034 | } |
| 1035 | else |
| 1036 | { |
| 1037 | BalIndications *balIndCfg; |
| 1038 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1039 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1040 | bal_indications__init(balIndCfg); |
| 1041 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SDI; |
| 1042 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1043 | balIndCfg->objtype = obj->obj_type; |
| 1044 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1045 | balIndCfg->sub_group = obj->subgroup; |
| 1046 | balIndCfg->device_id = voltha_device_id; |
| 1047 | |
| 1048 | bcmbal_subscriber_terminal_sdi *sub_sdi_ind = |
| 1049 | (bcmbal_subscriber_terminal_sdi *)obj; |
| 1050 | |
| 1051 | BalSubscriberTerminalSdi *subSdiInd; |
| 1052 | subSdiInd = malloc(sizeof(BalSubscriberTerminalSdi)); |
| 1053 | memset(subSdiInd, 0, sizeof(BalSubscriberTerminalSdi)); |
| 1054 | bal_subscriber_terminal_sdi__init(subSdiInd); |
| 1055 | balIndCfg->terminal_sdi= subSdiInd; |
| 1056 | |
| 1057 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 1058 | |
| 1059 | BalSubscriberTerminalKey *subkey; |
| 1060 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1061 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1062 | bal_subscriber_terminal_key__init(subkey); |
| 1063 | balIndCfg->terminal_sdi->key = subkey; |
| 1064 | |
| 1065 | balIndCfg->terminal_sdi->key->has_intf_id = BAL_GRPC_PRES; |
| 1066 | balIndCfg->terminal_sdi->key->intf_id = sub_sdi_ind->key.intf_id; |
| 1067 | balIndCfg->terminal_sdi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1068 | balIndCfg->terminal_sdi->key->sub_term_id = sub_sdi_ind->key.sub_term_id; |
| 1069 | |
| 1070 | BalSubscriberTerminalSdiData *subSdiIndData; |
| 1071 | subSdiIndData = malloc(sizeof(BalSubscriberTerminalSdiData)); |
| 1072 | memset(subSdiIndData, 0, sizeof(BalSubscriberTerminalSdiData)); |
| 1073 | bal_subscriber_terminal_sdi_data__init(subSdiIndData); |
| 1074 | balIndCfg->terminal_sdi->data = subSdiIndData; |
| 1075 | |
| 1076 | balIndCfg->terminal_sdi->data->has_sdi_status = BAL_GRPC_PRES; |
| 1077 | balIndCfg->terminal_sdi->data->sdi_status = sub_sdi_ind->data.sdi_status; |
| 1078 | |
| 1079 | balIndCfg->terminal_sdi->data->has_ber = BAL_GRPC_PRES; |
| 1080 | balIndCfg->terminal_sdi->data->ber = sub_sdi_ind->data.ber; |
| 1081 | |
| 1082 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1083 | bal_indication_node->bal_indication = balIndCfg; |
| 1084 | |
| 1085 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1086 | add_bal_indication_node(bal_indication_node); |
| 1087 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 1088 | } |
| 1089 | return result; |
| 1090 | } |
| 1091 | |
| 1092 | /********************************************************************\ |
| 1093 | * Function : bal_sub_term_sfi_indication_cb * |
| 1094 | * Description : This function will handle sfi indication * |
| 1095 | * * |
| 1096 | ********************************************************************/ |
| 1097 | bcmos_errno bal_sub_term_sfi_indication_cb(bcmbal_obj *obj) |
| 1098 | { |
| 1099 | bcmos_errno result = BCM_ERR_OK; |
| 1100 | |
| 1101 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1102 | bcmbal_subscriber_terminal_auto_id_sfi != obj->subgroup) |
| 1103 | { |
| 1104 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 1105 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1106 | result = BCM_ERR_INTERNAL; |
| 1107 | } |
| 1108 | else |
| 1109 | { |
| 1110 | BalIndications *balIndCfg; |
| 1111 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1112 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1113 | bal_indications__init(balIndCfg); |
| 1114 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SFI; |
| 1115 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1116 | balIndCfg->objtype = obj->obj_type; |
| 1117 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1118 | balIndCfg->sub_group = obj->subgroup; |
| 1119 | balIndCfg->device_id = voltha_device_id; |
| 1120 | |
| 1121 | bcmbal_subscriber_terminal_sfi *sub_sfi_ind = |
| 1122 | (bcmbal_subscriber_terminal_sfi *)obj; |
| 1123 | |
| 1124 | BalSubscriberTerminalSfi *subSfiInd; |
| 1125 | subSfiInd = malloc(sizeof(BalSubscriberTerminalSfi)); |
| 1126 | memset(subSfiInd, 0, sizeof(BalSubscriberTerminalSfi)); |
| 1127 | bal_subscriber_terminal_sfi__init(subSfiInd); |
| 1128 | balIndCfg->terminal_sfi= subSfiInd; |
| 1129 | |
| 1130 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 1131 | |
| 1132 | BalSubscriberTerminalKey *subkey; |
| 1133 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1134 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1135 | bal_subscriber_terminal_key__init(subkey); |
| 1136 | balIndCfg->terminal_sfi->key = subkey; |
| 1137 | |
| 1138 | balIndCfg->terminal_sfi->key->has_intf_id = BAL_GRPC_PRES; |
| 1139 | balIndCfg->terminal_sfi->key->intf_id = sub_sfi_ind->key.intf_id; |
| 1140 | balIndCfg->terminal_sfi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1141 | balIndCfg->terminal_sfi->key->sub_term_id = sub_sfi_ind->key.sub_term_id; |
| 1142 | |
| 1143 | BalSubscriberTerminalSfiData *subSfiIndData; |
| 1144 | subSfiIndData = malloc(sizeof(BalSubscriberTerminalSfiData)); |
| 1145 | memset(subSfiIndData, 0, sizeof(BalSubscriberTerminalSfiData)); |
| 1146 | bal_subscriber_terminal_sfi_data__init(subSfiIndData); |
| 1147 | balIndCfg->terminal_sfi->data = subSfiIndData; |
| 1148 | |
| 1149 | balIndCfg->terminal_sfi->data->has_sfi_status = BAL_GRPC_PRES; |
| 1150 | balIndCfg->terminal_sfi->data->sfi_status = sub_sfi_ind->data.sfi_status; |
| 1151 | |
| 1152 | balIndCfg->terminal_sfi->data->has_ber = BAL_GRPC_PRES; |
| 1153 | balIndCfg->terminal_sfi->data->ber = sub_sfi_ind->data.ber; |
| 1154 | |
| 1155 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1156 | bal_indication_node->bal_indication = balIndCfg; |
| 1157 | |
| 1158 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1159 | add_bal_indication_node(bal_indication_node); |
| 1160 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 1161 | } |
| 1162 | return result; |
| 1163 | } |
| 1164 | |
| 1165 | /********************************************************************\ |
| 1166 | * Function : bal_sub_term_act_fail_indication_cb * |
| 1167 | * Description : This function will handle sub term activation fail * |
| 1168 | * indication * |
| 1169 | * * |
| 1170 | ********************************************************************/ |
| 1171 | bcmos_errno bal_sub_term_act_fail_indication_cb(bcmbal_obj *obj) |
| 1172 | { |
| 1173 | bcmos_errno result = BCM_ERR_OK; |
| 1174 | |
| 1175 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1176 | bcmbal_subscriber_terminal_auto_id_sub_term_act_fail != obj->subgroup) |
| 1177 | { |
| 1178 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 1179 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1180 | result = BCM_ERR_INTERNAL; |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | BalIndications *balIndCfg; |
| 1185 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1186 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1187 | bal_indications__init(balIndCfg); |
| 1188 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SUB_TERM_ACT_FAIL; |
| 1189 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1190 | balIndCfg->objtype = obj->obj_type; |
| 1191 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1192 | balIndCfg->sub_group = obj->subgroup; |
| 1193 | balIndCfg->device_id = voltha_device_id; |
| 1194 | |
| 1195 | bcmbal_subscriber_terminal_sub_term_act_fail *sub_term_act_fail_ind = |
| 1196 | (bcmbal_subscriber_terminal_sub_term_act_fail *)obj; |
| 1197 | |
| 1198 | BalSubscriberTerminalSubTermActFail *subTermActFailInd; |
| 1199 | subTermActFailInd = malloc(sizeof(BalSubscriberTerminalSubTermActFail)); |
| 1200 | memset(subTermActFailInd, 0, sizeof(BalSubscriberTerminalSubTermActFail)); |
| 1201 | bal_subscriber_terminal_sub_term_act_fail__init(subTermActFailInd); |
| 1202 | balIndCfg->terminal_sub_term_act_fail= subTermActFailInd; |
| 1203 | |
| 1204 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 1205 | |
| 1206 | BalSubscriberTerminalKey *subkey; |
| 1207 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1208 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1209 | bal_subscriber_terminal_key__init(subkey); |
| 1210 | balIndCfg->terminal_sub_term_act_fail->key = subkey; |
| 1211 | |
| 1212 | balIndCfg->terminal_sub_term_act_fail->key->has_intf_id = BAL_GRPC_PRES; |
| 1213 | balIndCfg->terminal_sub_term_act_fail->key->intf_id = sub_term_act_fail_ind->key.intf_id; |
| 1214 | balIndCfg->terminal_sub_term_act_fail->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1215 | balIndCfg->terminal_sub_term_act_fail->key->sub_term_id = sub_term_act_fail_ind->key.sub_term_id; |
| 1216 | |
| 1217 | BalSubscriberTerminalSubTermActFailData *subTermActFailIndData; |
| 1218 | subTermActFailIndData = malloc(sizeof(BalSubscriberTerminalSubTermActFailData)); |
| 1219 | memset(subTermActFailIndData, 0, sizeof(BalSubscriberTerminalSubTermActFailData)); |
| 1220 | bal_subscriber_terminal_sub_term_act_fail_data__init(subTermActFailIndData); |
| 1221 | balIndCfg->terminal_sub_term_act_fail->data = subTermActFailIndData; |
| 1222 | |
| 1223 | balIndCfg->terminal_sub_term_act_fail->data->has_fail_reason = BAL_GRPC_PRES; |
| 1224 | balIndCfg->terminal_sub_term_act_fail->data->fail_reason = sub_term_act_fail_ind->data.fail_reason; |
| 1225 | |
| 1226 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1227 | bal_indication_node->bal_indication = balIndCfg; |
| 1228 | |
| 1229 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1230 | add_bal_indication_node(bal_indication_node); |
| 1231 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 1232 | } |
| 1233 | return result; |
| 1234 | } |
| 1235 | |
| 1236 | /********************************************************************\ |
| 1237 | * Function : bal_sub_term_sufi_indication_cb * |
| 1238 | * Description : This function will handle sufi indication * |
| 1239 | * * |
| 1240 | ********************************************************************/ |
| 1241 | bcmos_errno bal_sub_term_sufi_indication_cb(bcmbal_obj *obj) |
| 1242 | { |
| 1243 | bcmos_errno result = BCM_ERR_OK; |
| 1244 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1245 | bcmbal_subscriber_terminal_auto_id_sufi != obj->subgroup) |
| 1246 | { |
| 1247 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 1248 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1249 | result = BCM_ERR_INTERNAL; |
| 1250 | } |
| 1251 | else |
| 1252 | { |
| 1253 | BalIndications *balIndCfg; |
| 1254 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1255 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1256 | bal_indications__init(balIndCfg); |
| 1257 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_SUFI; |
| 1258 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1259 | balIndCfg->objtype = obj->obj_type; |
| 1260 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1261 | balIndCfg->sub_group = obj->subgroup; |
| 1262 | balIndCfg->device_id = voltha_device_id; |
| 1263 | |
| 1264 | bcmbal_subscriber_terminal_sufi *sub_sufi_ind = |
| 1265 | (bcmbal_subscriber_terminal_sufi *)obj; |
| 1266 | |
| 1267 | BalSubscriberTerminalSufi *subSufiInd; |
| 1268 | subSufiInd = malloc(sizeof(BalSubscriberTerminalSufi)); |
| 1269 | memset(subSufiInd, 0, sizeof(BalSubscriberTerminalSufi)); |
| 1270 | bal_subscriber_terminal_sufi__init(subSufiInd); |
| 1271 | balIndCfg->terminal_sufi= subSufiInd; |
| 1272 | |
| 1273 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 1274 | |
| 1275 | BalSubscriberTerminalKey *subkey; |
| 1276 | subkey = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1277 | memset(subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1278 | bal_subscriber_terminal_key__init(subkey); |
| 1279 | balIndCfg->terminal_sufi->key = subkey; |
| 1280 | |
| 1281 | balIndCfg->terminal_sufi->key->has_intf_id = BAL_GRPC_PRES; |
| 1282 | balIndCfg->terminal_sufi->key->intf_id = sub_sufi_ind->key.intf_id; |
| 1283 | balIndCfg->terminal_sufi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1284 | balIndCfg->terminal_sufi->key->sub_term_id = sub_sufi_ind->key.sub_term_id; |
| 1285 | |
| 1286 | BalSubscriberTerminalSufiData *subSufiIndData; |
| 1287 | subSufiIndData = malloc(sizeof(BalSubscriberTerminalSufiData)); |
| 1288 | memset(subSufiIndData, 0, sizeof(BalSubscriberTerminalSufiData)); |
| 1289 | bal_subscriber_terminal_sufi_data__init(subSufiIndData); |
| 1290 | balIndCfg->terminal_sufi->data = subSufiIndData; |
| 1291 | |
| 1292 | balIndCfg->terminal_sufi->data->has_sufi_status = BAL_GRPC_PRES; |
| 1293 | balIndCfg->terminal_sufi->data->sufi_status = sub_sufi_ind->data.sufi_status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1294 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1295 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1296 | bal_indication_node->bal_indication = balIndCfg; |
| 1297 | |
| 1298 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1299 | add_bal_indication_node(bal_indication_node); |
| 1300 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1301 | } |
| 1302 | |
| 1303 | return result; |
| 1304 | } |
| 1305 | |
| 1306 | /********************************************************************\ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1307 | * Function : bal_sub_term_tiwi_indication_cb * |
| 1308 | * Description : This function will handle tiwi indication * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1309 | * * |
| 1310 | ********************************************************************/ |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1311 | bcmos_errno bal_sub_term_tiwi_indication_cb(bcmbal_obj *obj) |
| 1312 | { |
| 1313 | bcmos_errno result = BCM_ERR_OK; |
| 1314 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
| 1315 | BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_TIWI != obj->subgroup) |
| 1316 | { |
| 1317 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
| 1318 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1319 | result = BCM_ERR_INTERNAL; |
| 1320 | } |
| 1321 | else |
| 1322 | { |
| 1323 | BalIndications *balIndCfg; |
| 1324 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1325 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1326 | bal_indications__init(balIndCfg); |
| 1327 | balIndCfg->u_case = BAL_INDICATIONS__U_TERMINAL_TIWI; |
| 1328 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1329 | balIndCfg->objtype = obj->obj_type; |
| 1330 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1331 | balIndCfg->sub_group = obj->subgroup; |
| 1332 | balIndCfg->device_id = voltha_device_id; |
| 1333 | |
| 1334 | bcmbal_subscriber_terminal_tiwi *sub_term_tiwi = |
| 1335 | (bcmbal_subscriber_terminal_tiwi *)obj; |
| 1336 | |
| 1337 | BalSubscriberTerminalTiwi *subTermTiwi; |
| 1338 | subTermTiwi = malloc(sizeof(BalSubscriberTerminalTiwi)); |
| 1339 | memset(subTermTiwi, 0, sizeof(BalSubscriberTerminalTiwi)); |
| 1340 | bal_subscriber_terminal_tiwi__init(subTermTiwi); |
| 1341 | balIndCfg->terminal_tiwi = subTermTiwi; |
| 1342 | |
| 1343 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
| 1344 | |
| 1345 | BalSubscriberTerminalKey *sub_term_key; |
| 1346 | sub_term_key = malloc(sizeof(BalSubscriberTerminalKey)); |
| 1347 | memset(sub_term_key, 0, sizeof(BalSubscriberTerminalKey)); |
| 1348 | bal_subscriber_terminal_key__init(sub_term_key); |
| 1349 | balIndCfg->terminal_tiwi->key = sub_term_key; |
| 1350 | |
| 1351 | balIndCfg->terminal_tiwi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1352 | balIndCfg->terminal_tiwi->key->sub_term_id = sub_term_tiwi->key.sub_term_id; |
| 1353 | balIndCfg->terminal_tiwi->key->has_intf_id = BAL_GRPC_PRES; |
| 1354 | balIndCfg->terminal_tiwi->key->intf_id = sub_term_tiwi->key.intf_id; |
| 1355 | |
| 1356 | BalSubscriberTerminalTiwiData *sub_term_tiwi_data; |
| 1357 | sub_term_tiwi_data = malloc(sizeof(BalSubscriberTerminalTiwiData)); |
| 1358 | memset(sub_term_tiwi_data, 0, sizeof(BalSubscriberTerminalTiwiData)); |
| 1359 | bal_subscriber_terminal_tiwi_data__init(sub_term_tiwi_data); |
| 1360 | balIndCfg->terminal_tiwi->data = sub_term_tiwi_data; |
| 1361 | |
| 1362 | balIndCfg->terminal_tiwi->data->has_tiwi_status = BAL_GRPC_PRES; |
| 1363 | balIndCfg->terminal_tiwi->data->tiwi_status = sub_term_tiwi->data.tiwi_status; |
| 1364 | |
| 1365 | balIndCfg->terminal_tiwi->data->has_drift_value = BAL_GRPC_PRES; |
| 1366 | balIndCfg->terminal_tiwi->data->drift_value = sub_term_tiwi->data.drift_value; |
| 1367 | |
| 1368 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1369 | bal_indication_node->bal_indication = balIndCfg; |
| 1370 | |
| 1371 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1372 | add_bal_indication_node(bal_indication_node); |
| 1373 | pthread_mutex_unlock(&bal_ind_queue_lock); |
| 1374 | } |
| 1375 | |
| 1376 | return result; |
| 1377 | } |
| 1378 | |
| 1379 | /********************************************************************\ |
| 1380 | * Function : bal_tm_sched_auto_id_oper_status_change_cb * |
| 1381 | * Description : This function will handle tm sched operation status* |
| 1382 | * change indication * |
| 1383 | * * |
| 1384 | ********************************************************************/ |
| 1385 | bcmos_errno bal_tm_sched_auto_id_oper_status_change_cb(bcmbal_obj *obj) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1386 | { |
| 1387 | bcmos_errno result = BCM_ERR_OK; |
| 1388 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1389 | if(BCMBAL_OBJ_ID_TM_SCHED != obj->obj_type || |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1390 | bcmbal_tm_sched_auto_id_oper_status_change != obj->subgroup) |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1391 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1392 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1393 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1394 | result = BCM_ERR_INTERNAL; |
| 1395 | } |
| 1396 | else |
| 1397 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1398 | BalIndications *balIndCfg; |
| 1399 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1400 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1401 | bal_indications__init(balIndCfg); |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1402 | balIndCfg->u_case = BAL_INDICATIONS__U_TM_SCHED_OPER_STATS_CHANGE; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1403 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1404 | balIndCfg->objtype = obj->obj_type; |
| 1405 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1406 | balIndCfg->sub_group = obj->subgroup; |
| 1407 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1408 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1409 | bcmbal_tm_sched_oper_status_change *tm_sched_osc = |
| 1410 | (bcmbal_tm_sched_oper_status_change *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1411 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1412 | BalTmSchedOperStatusChange *tmSchedOsc; |
| 1413 | tmSchedOsc = malloc(sizeof(BalTmSchedOperStatusChange)); |
| 1414 | memset(tmSchedOsc, 0, sizeof(BalTmSchedOperStatusChange)); |
| 1415 | bal_tm_sched_oper_status_change__init(tmSchedOsc); |
| 1416 | balIndCfg->tm_sched_oper_stats_change = tmSchedOsc; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1417 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1418 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1419 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1420 | BalTmSchedKey *tmSchedKey; |
| 1421 | tmSchedKey = malloc(sizeof(BalTmSchedKey)); |
| 1422 | memset(tmSchedKey, 0, sizeof(BalTmSchedKey)); |
| 1423 | bal_tm_sched_key__init(tmSchedKey); |
| 1424 | balIndCfg->tm_sched_oper_stats_change->key = tmSchedKey; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1425 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1426 | balIndCfg->tm_sched_oper_stats_change->key->has_dir = BAL_GRPC_PRES; |
| 1427 | balIndCfg->tm_sched_oper_stats_change->key->dir = tm_sched_osc->key.dir; |
| 1428 | balIndCfg->tm_sched_oper_stats_change->key->has_id = BAL_GRPC_PRES; |
| 1429 | balIndCfg->tm_sched_oper_stats_change->key->id = tm_sched_osc->key.id; |
| 1430 | |
| 1431 | BalTmSchedOperStatusChangeData *tmschedOscData; |
| 1432 | tmschedOscData = malloc(sizeof(BalTmSchedOperStatusChangeData)); |
| 1433 | memset(tmschedOscData, 0, sizeof(BalTmSchedOperStatusChangeData)); |
| 1434 | bal_tm_sched_oper_status_change_data__init(tmschedOscData); |
| 1435 | balIndCfg->tm_sched_oper_stats_change->data = tmschedOscData; |
| 1436 | |
| 1437 | balIndCfg->tm_sched_oper_stats_change->data->has_new_oper_status = BAL_GRPC_PRES; |
| 1438 | balIndCfg->tm_sched_oper_stats_change->data->new_oper_status = |
| 1439 | tm_sched_osc->data.new_oper_status; |
| 1440 | balIndCfg->tm_sched_oper_stats_change->data->has_old_oper_status = BAL_GRPC_PRES; |
| 1441 | balIndCfg->tm_sched_oper_stats_change->data->old_oper_status = |
| 1442 | tm_sched_osc->data.old_oper_status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1443 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1444 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1445 | bal_indication_node->bal_indication = balIndCfg; |
| 1446 | |
| 1447 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1448 | add_bal_indication_node(bal_indication_node); |
| 1449 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1450 | } |
| 1451 | |
| 1452 | return result; |
| 1453 | } |
| 1454 | |
| 1455 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1456 | * Function : bal_packet_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1457 | * Description : This function will handle the indications for * |
| 1458 | * Packet Data indication * |
| 1459 | * * |
| 1460 | ********************************************************************/ |
| 1461 | bcmos_errno bal_packet_data_indication_cb(bcmbal_obj *obj) |
| 1462 | { |
| 1463 | bcmos_errno result = BCM_ERR_OK; |
| 1464 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1465 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1466 | bcmbal_packet_auto_id_bearer_channel_rx != obj->subgroup) |
| 1467 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1468 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1469 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1470 | result = BCM_ERR_INTERNAL; |
| 1471 | } |
| 1472 | else |
| 1473 | { |
| 1474 | /*bcmos_mutex_lock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1475 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1476 | BalIndications *balIndCfg; |
| 1477 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1478 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1479 | bal_indications__init(balIndCfg); |
| 1480 | balIndCfg->u_case = BAL_INDICATIONS__U_PKT_DATA; |
| 1481 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1482 | balIndCfg->objtype = obj->obj_type; |
| 1483 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1484 | balIndCfg->sub_group = obj->subgroup; |
| 1485 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1486 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1487 | BalPacketBearerChannelRx *rxChannel; |
| 1488 | rxChannel = malloc(sizeof(BalPacketBearerChannelRx)); |
| 1489 | memset(rxChannel, 0, sizeof(BalPacketBearerChannelRx)); |
| 1490 | bal_packet_bearer_channel_rx__init(rxChannel); |
| 1491 | balIndCfg->pktdata = rxChannel; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1492 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1493 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1494 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1495 | BalPacketKey *packetkey; |
| 1496 | packetkey = malloc(sizeof(BalPacketKey)); |
| 1497 | memset(packetkey, 0, sizeof(BalPacketKey)); |
| 1498 | bal_packet_key__init(packetkey); |
| 1499 | balIndCfg->pktdata->key = packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1500 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1501 | bcmbal_packet_bearer_channel_rx *rx_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1502 | (bcmbal_packet_bearer_channel_rx *)obj; |
| 1503 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1504 | balIndCfg->pktdata->key->has_reserved = BAL_GRPC_PRES; |
| 1505 | balIndCfg->pktdata->key->reserved = rx_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1506 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1507 | BalDest *PktSndDest; |
| 1508 | PktSndDest = malloc(sizeof(BalDest)); |
| 1509 | memset(PktSndDest, 0, sizeof(BalDest)); |
| 1510 | bal_dest__init(PktSndDest); |
| 1511 | balIndCfg->pktdata->key->packet_send_dest = PktSndDest; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1512 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1513 | balIndCfg->pktdata->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1514 | balIndCfg->pktdata->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1515 | rx_channel->key.packet_send_dest.type; |
| 1516 | switch( rx_channel->key.packet_send_dest.type) |
| 1517 | { |
| 1518 | case BCMBAL_DEST_TYPE_NNI: |
| 1519 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1520 | balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_NNI; |
| 1521 | BalDestNni *balNni; |
| 1522 | balNni = malloc(sizeof(BalDestNni)); |
| 1523 | memset(balNni, 0, sizeof(BalDestNni)); |
| 1524 | bal_dest_nni__init(balNni); |
| 1525 | balIndCfg->pktdata->key->packet_send_dest->nni = balNni; |
| 1526 | balIndCfg->pktdata->key->packet_send_dest->nni->has_intf_id = BAL_GRPC_PRES; |
| 1527 | balIndCfg->pktdata->key->packet_send_dest->nni->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1528 | rx_channel->key.packet_send_dest.u.nni.intf_id; |
| 1529 | } |
| 1530 | break; |
| 1531 | case BCMBAL_DEST_TYPE_SUB_TERM: |
| 1532 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1533 | balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SUB_TERM; |
| 1534 | BalDestSubTerm *balSubTerm; |
| 1535 | balSubTerm = malloc(sizeof(BalDestSubTerm)); |
| 1536 | memset(balSubTerm, 0, sizeof(BalDestSubTerm)); |
| 1537 | bal_dest_sub_term__init(balSubTerm); |
| 1538 | balIndCfg->pktdata->key->packet_send_dest->sub_term = balSubTerm; |
| 1539 | balIndCfg->pktdata->key->packet_send_dest->sub_term->has_sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1540 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1541 | balIndCfg->pktdata->key->packet_send_dest->sub_term->sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1542 | rx_channel->key.packet_send_dest.u.sub_term.sub_term_id; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1543 | balIndCfg->pktdata->key->packet_send_dest->sub_term->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1544 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1545 | balIndCfg->pktdata->key->packet_send_dest->sub_term->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1546 | rx_channel->key.packet_send_dest.u.sub_term.intf_id; |
| 1547 | } |
| 1548 | break; |
| 1549 | case BCMBAL_DEST_TYPE_SVC_PORT: |
| 1550 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1551 | balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SVC_PORT; |
| 1552 | BalDestSvcPort *balSvcPort; |
| 1553 | balSvcPort = malloc(sizeof(BalDestSvcPort)); |
| 1554 | memset(balSvcPort, 0, sizeof(BalDestSvcPort)); |
| 1555 | bal_dest_svc_port__init(balSvcPort); |
| 1556 | balIndCfg->pktdata->key->packet_send_dest->svc_port = balSvcPort; |
| 1557 | balIndCfg->pktdata->key->packet_send_dest->svc_port->has_svc_port_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1558 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1559 | balIndCfg->pktdata->key->packet_send_dest->svc_port->svc_port_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1560 | rx_channel->key.packet_send_dest.u.svc_port.svc_port_id; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1561 | balIndCfg->pktdata->key->packet_send_dest->svc_port->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1562 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1563 | balIndCfg->pktdata->key->packet_send_dest->svc_port->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1564 | rx_channel->key.packet_send_dest.u.svc_port.intf_id; |
| 1565 | } |
| 1566 | break; |
| 1567 | default: |
| 1568 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1569 | balIndCfg->pktdata->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1570 | } |
| 1571 | break; |
| 1572 | } |
| 1573 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1574 | BalPacketBearerChannelRxData *pkdData; |
| 1575 | pkdData = malloc(sizeof(BalPacketBearerChannelRxData)); |
| 1576 | memset(pkdData, 0, sizeof(BalPacketBearerChannelRxData)); |
| 1577 | bal_packet_bearer_channel_rx_data__init(pkdData); |
| 1578 | balIndCfg->pktdata->data = pkdData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1579 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1580 | balIndCfg->pktdata->data->has_flow_id = BAL_GRPC_PRES; |
| 1581 | balIndCfg->pktdata->data->flow_id = rx_channel->data.flow_id; |
| 1582 | balIndCfg->pktdata->data->has_flow_type = BAL_GRPC_PRES; |
| 1583 | balIndCfg->pktdata->data->flow_type = rx_channel->data.flow_type; |
| 1584 | balIndCfg->pktdata->data->has_intf_id = BAL_GRPC_PRES; |
| 1585 | balIndCfg->pktdata->data->intf_id = rx_channel->data.intf_id; |
| 1586 | balIndCfg->pktdata->data->has_intf_type = BAL_GRPC_PRES; |
| 1587 | balIndCfg->pktdata->data->intf_type = rx_channel->data.intf_type; |
| 1588 | balIndCfg->pktdata->data->has_svc_port = BAL_GRPC_PRES; |
| 1589 | balIndCfg->pktdata->data->svc_port = rx_channel->data.svc_port; |
| 1590 | balIndCfg->pktdata->data->has_flow_cookie = BAL_GRPC_PRES; |
| 1591 | balIndCfg->pktdata->data->flow_cookie = rx_channel->data.flow_cookie; |
| 1592 | balIndCfg->pktdata->data->has_pkt = BAL_GRPC_PRES; |
| 1593 | balIndCfg->pktdata->data->pkt.len = rx_channel->data.pkt.len; |
| 1594 | balIndCfg->pktdata->data->pkt.data = (uint8_t *)malloc((balIndCfg->pktdata->data->pkt.len)*sizeof(uint8_t)); |
| 1595 | memcpy(balIndCfg->pktdata->data->pkt.data, rx_channel->data.pkt.val, balIndCfg->pktdata->data->pkt.len); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1596 | |
| 1597 | /*bcmos_mutex_unlock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1598 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1599 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1600 | bal_indication_node->bal_indication = balIndCfg; |
| 1601 | |
| 1602 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1603 | add_bal_indication_node(bal_indication_node); |
| 1604 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1605 | } |
| 1606 | |
| 1607 | return result; |
| 1608 | } |
| 1609 | |
| 1610 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1611 | * Function : bal_omci_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1612 | * Description : This function will handle the indications for * |
| 1613 | * OMCI Data Response * |
| 1614 | * * |
| 1615 | ********************************************************************/ |
| 1616 | bcmos_errno bal_omci_data_indication_cb(bcmbal_obj *obj) |
| 1617 | { |
| 1618 | bcmos_errno result = BCM_ERR_OK; |
| 1619 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1620 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1621 | bcmbal_packet_auto_id_itu_omci_channel_rx != obj->subgroup) |
| 1622 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1623 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1624 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1625 | result = BCM_ERR_INTERNAL; |
| 1626 | } |
| 1627 | else |
| 1628 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1629 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Received OMCI response via BAL APIs"); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1630 | BalIndications *balIndCfg; |
| 1631 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1632 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1633 | bal_indications__init(balIndCfg); |
| 1634 | balIndCfg->u_case = BAL_INDICATIONS__U_BAL_OMCI_RESP; |
| 1635 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1636 | balIndCfg->objtype = obj->obj_type; |
| 1637 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1638 | balIndCfg->sub_group = obj->subgroup; |
| 1639 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1640 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1641 | BalPacketItuOmciChannelRx *omciChannel; |
| 1642 | omciChannel = malloc(sizeof(BalPacketItuOmciChannelRx)); |
| 1643 | memset(omciChannel, 0, sizeof(BalPacketItuOmciChannelRx)); |
| 1644 | bal_packet_itu_omci_channel_rx__init(omciChannel); |
| 1645 | balIndCfg->balomciresp = omciChannel; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1646 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1647 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1648 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1649 | BalPacketKey *packetkey; |
| 1650 | packetkey = malloc(sizeof(BalPacketKey)); |
| 1651 | memset(packetkey, 0, sizeof(BalPacketKey)); |
| 1652 | bal_packet_key__init(packetkey); |
| 1653 | balIndCfg->balomciresp->key = packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1654 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1655 | BalPacketItuOmciChannelRxData *omciData; |
| 1656 | omciData = malloc(sizeof(BalPacketItuOmciChannelRxData)); |
| 1657 | memset(omciData, 0, sizeof(BalPacketItuOmciChannelRxData)); |
| 1658 | bal_packet_itu_omci_channel_rx_data__init(omciData); |
| 1659 | balIndCfg->balomciresp->data = omciData; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1660 | |
| 1661 | bcmbal_packet_itu_omci_channel_rx *omci_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1662 | (bcmbal_packet_itu_omci_channel_rx *)obj; |
| 1663 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1664 | balIndCfg->balomciresp->data->has_pkt = BAL_GRPC_PRES; |
| 1665 | balIndCfg->balomciresp->data->pkt.len = omci_channel->data.pkt.len; |
| 1666 | balIndCfg->balomciresp->data->pkt.data = (uint8_t *)malloc((omci_channel->data.pkt.len)*sizeof(uint8_t)); |
| 1667 | memcpy(balIndCfg->balomciresp->data->pkt.data, omci_channel->data.pkt.val, |
| 1668 | balIndCfg->balomciresp->data->pkt.len); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1669 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1670 | balIndCfg->balomciresp->key->has_reserved = BAL_GRPC_PRES; |
| 1671 | balIndCfg->balomciresp->key->reserved = omci_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1672 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1673 | BalDest *PktSndDest; |
| 1674 | PktSndDest = malloc(sizeof(BalDest)); |
| 1675 | memset(PktSndDest, 0, sizeof(BalDest)); |
| 1676 | bal_dest__init(PktSndDest); |
| 1677 | balIndCfg->balomciresp->key->packet_send_dest = PktSndDest; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1678 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1679 | balIndCfg->balomciresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1680 | balIndCfg->balomciresp->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1681 | omci_channel->key.packet_send_dest.type; |
| 1682 | switch( omci_channel->key.packet_send_dest.type) |
| 1683 | { |
| 1684 | case BCMBAL_DEST_TYPE_ITU_OMCI_CHANNEL: |
| 1685 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1686 | balIndCfg->balomciresp->key->packet_send_dest->u_case = BAL_DEST__U_ITU_OMCI_CHANNEL; |
| 1687 | BalItuOmciChannel *balOmci; |
| 1688 | balOmci = malloc(sizeof(BalItuOmciChannel)); |
| 1689 | memset(balOmci, 0, sizeof(BalItuOmciChannel)); |
| 1690 | bal_itu_omci_channel__init(balOmci); |
| 1691 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel = balOmci; |
| 1692 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->has_sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1693 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1694 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1695 | omci_channel->key.packet_send_dest.u.itu_omci_channel.sub_term_id; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1696 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1697 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1698 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1699 | omci_channel->key.packet_send_dest.u.itu_omci_channel.intf_id; |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1700 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d", |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1701 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1702 | } |
| 1703 | break; |
| 1704 | default: |
| 1705 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1706 | balIndCfg->balomciresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1707 | } |
| 1708 | break; |
| 1709 | } |
| 1710 | |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1711 | ASFVOLT_HEX2LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is ", |
| 1712 | balIndCfg->balomciresp->data->pkt.data, balIndCfg->balomciresp->data->pkt.len); |
| 1713 | |
| 1714 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d", |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1715 | balIndCfg->balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1716 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1717 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1718 | bal_indication_node->bal_indication = balIndCfg; |
| 1719 | |
| 1720 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1721 | add_bal_indication_node(bal_indication_node); |
| 1722 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1723 | } |
| 1724 | |
| 1725 | return result; |
| 1726 | } |
| 1727 | |
| 1728 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1729 | * Function : bal_oam_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1730 | * Description : This function will handle the indications for * |
| 1731 | * OAM Data Response * |
| 1732 | * * |
| 1733 | ********************************************************************/ |
| 1734 | bcmos_errno bal_oam_data_indication_cb(bcmbal_obj *obj) |
| 1735 | { |
| 1736 | bcmos_errno result = BCM_ERR_OK; |
| 1737 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1738 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1739 | bcmbal_packet_auto_id_ieee_oam_channel_rx != obj->subgroup) |
| 1740 | { |
Kim Kempf | afa1ab4 | 2017-11-13 09:31:47 -0800 | [diff] [blame] | 1741 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API '%s' IND callback (status is %s)", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1742 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1743 | result = BCM_ERR_INTERNAL; |
| 1744 | } |
| 1745 | else |
| 1746 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1747 | BalIndications *balIndCfg; |
| 1748 | balIndCfg = malloc(sizeof(BalIndications)); |
| 1749 | memset(balIndCfg, 0, sizeof(BalIndications)); |
| 1750 | bal_indications__init(balIndCfg); |
| 1751 | balIndCfg->u_case = BAL_INDICATIONS__U_BAL_OAM_RESP; |
| 1752 | balIndCfg->has_objtype = BAL_GRPC_PRES; |
| 1753 | balIndCfg->objtype = obj->obj_type; |
| 1754 | balIndCfg->has_sub_group = BAL_GRPC_PRES; |
| 1755 | balIndCfg->sub_group = obj->subgroup; |
| 1756 | balIndCfg->device_id = voltha_device_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1757 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1758 | BalPacketIeeeOamChannelRx *oamChannel; |
| 1759 | oamChannel = malloc(sizeof(BalPacketIeeeOamChannelRx)); |
| 1760 | memset(oamChannel, 0, sizeof(BalPacketIeeeOamChannelRx)); |
| 1761 | bal_packet_ieee_oam_channel_rx__init(oamChannel); |
| 1762 | balIndCfg->baloamresp = oamChannel; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1763 | |
Girish Gowdru | 9ebd8b2 | 2018-09-26 03:21:03 -0700 | [diff] [blame^] | 1764 | /*'hdr' field is not parsed by voltha adapter, hence not filled */ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1765 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1766 | BalPacketKey *packetkey; |
| 1767 | packetkey = malloc(sizeof(BalPacketKey)); |
| 1768 | memset(packetkey, 0, sizeof(BalPacketKey)); |
| 1769 | bal_packet_key__init(packetkey); |
| 1770 | balIndCfg->baloamresp->key = packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1771 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1772 | bcmbal_packet_ieee_oam_channel_rx *oam_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1773 | (bcmbal_packet_ieee_oam_channel_rx *)obj; |
| 1774 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1775 | balIndCfg->baloamresp->key->has_reserved = BAL_GRPC_PRES; |
| 1776 | balIndCfg->baloamresp->key->reserved = oam_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1777 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1778 | BalDest *PktSndDest; |
| 1779 | PktSndDest = malloc(sizeof(BalDest)); |
| 1780 | memset(PktSndDest, 0, sizeof(BalDest)); |
| 1781 | bal_dest__init(PktSndDest); |
| 1782 | balIndCfg->baloamresp->key->packet_send_dest = PktSndDest; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1783 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1784 | balIndCfg->baloamresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
| 1785 | balIndCfg->baloamresp->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1786 | oam_channel->key.packet_send_dest.type; |
| 1787 | switch( oam_channel->key.packet_send_dest.type) |
| 1788 | { |
| 1789 | case BCMBAL_DEST_TYPE_IEEE_OAM_CHANNEL: |
| 1790 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1791 | balIndCfg->baloamresp->key->packet_send_dest->u_case = BAL_DEST__U_IEEE_OAM_CHANNEL; |
| 1792 | BalIeeeOamChannel *balOam; |
| 1793 | balOam = malloc(sizeof(BalIeeeOamChannel)); |
| 1794 | memset(balOam, 0, sizeof(BalIeeeOamChannel)); |
| 1795 | bal_ieee_oam_channel__init(balOam); |
| 1796 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel = balOam; |
| 1797 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1798 | BAL_GRPC_PRES; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1799 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1800 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.intf_id; |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1801 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->has_mac_address = BAL_GRPC_PRES; |
| 1802 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1803 | (BCMOS_ETH_ALEN)*sizeof(oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8); |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1804 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data = |
| 1805 | (uint8_t *)malloc((balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len)*sizeof(uint8_t)); |
| 1806 | memcpy(balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data, |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame] | 1807 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8, |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1808 | balIndCfg->baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1809 | |
| 1810 | } |
| 1811 | break; |
| 1812 | default: |
| 1813 | { |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1814 | balIndCfg->baloamresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1815 | } |
| 1816 | break; |
| 1817 | } |
| 1818 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1819 | BalPacketIeeeOamChannelRxData *oamData; |
| 1820 | oamData = malloc(sizeof(BalPacketIeeeOamChannelRxData)); |
| 1821 | memset(oamData, 0, sizeof(BalPacketIeeeOamChannelRxData)); |
| 1822 | bal_packet_ieee_oam_channel_rx_data__init(oamData); |
| 1823 | balIndCfg->baloamresp->data = oamData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1824 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1825 | balIndCfg->baloamresp->data->pkt.len = oam_channel->data.pkt.len; |
| 1826 | balIndCfg->baloamresp->data->pkt.data = (uint8_t *)malloc((balIndCfg->baloamresp->data->pkt.len)*sizeof(uint8_t)); |
| 1827 | memcpy(balIndCfg->baloamresp->data->pkt.data, oam_channel->data.pkt.val, |
| 1828 | balIndCfg->baloamresp->data->pkt.len); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1829 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1830 | list_node *bal_indication_node = malloc(sizeof(list_node)); |
| 1831 | bal_indication_node->bal_indication = balIndCfg; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1832 | |
VoLTHA | 753536e | 2017-11-02 20:15:09 +0530 | [diff] [blame] | 1833 | pthread_mutex_lock(&bal_ind_queue_lock); |
| 1834 | add_bal_indication_node(bal_indication_node); |
| 1835 | pthread_mutex_unlock(&bal_ind_queue_lock); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1836 | } |
| 1837 | |
| 1838 | return result; |
| 1839 | } |