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" |
| 18 | |
| 19 | /*static bcmos_mutex bal_ind_lock; - Need to define bcm independent mutex*/ |
| 20 | /********************************************************************\ |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 21 | * Function : bal_acc_term_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 22 | * Description : This function will handle the indications for * |
| 23 | * Access Terminal Indication * |
| 24 | * * |
| 25 | ********************************************************************/ |
| 26 | bcmos_errno bal_acc_term_indication_cb(bcmbal_obj *obj) |
| 27 | { |
| 28 | bcmos_errno result = BCM_ERR_OK; |
| 29 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 30 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 31 | bcmbal_access_terminal_auto_id_ind != obj->subgroup) |
| 32 | { |
| 33 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 34 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 35 | result = BCM_ERR_INTERNAL; |
| 36 | } |
| 37 | else |
| 38 | { |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 39 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 40 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 41 | BalIndications balIndCfg; |
| 42 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 43 | bal_indications__init(&balIndCfg); |
| 44 | balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND; |
| 45 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 46 | balIndCfg.objtype = obj->obj_type; |
| 47 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 48 | balIndCfg.sub_group = obj->subgroup; |
| 49 | balIndCfg.device_id = voltha_device_id; |
| 50 | |
| 51 | bcmbal_access_terminal_ind *acc_term_ind = (bcmbal_access_terminal_ind *)obj; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 52 | |
| 53 | BalAccessTerminalInd acessTermInd; |
| 54 | memset(&acessTermInd, 0, sizeof(BalAccessTerminalInd)); |
| 55 | bal_access_terminal_ind__init(&acessTermInd); |
| 56 | balIndCfg.access_term_ind = &acessTermInd; |
| 57 | |
| 58 | BalObj hdr; |
| 59 | memset(&hdr, 0, sizeof(BalObj)); |
| 60 | bal_obj__init(&hdr); |
| 61 | balIndCfg.access_term_ind->hdr = &hdr; |
| 62 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 63 | BalAccessTerminalKey accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 64 | memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 65 | bal_access_terminal_key__init(&accessTermkey); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 66 | balIndCfg.access_term_ind->key = &accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 67 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 68 | balIndCfg.access_term_ind->key->has_access_term_id = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 69 | balIndCfg.access_term_ind->key->access_term_id = acc_term_ind->key.access_term_id; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 70 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 71 | BalAccessTerminalIndData accessTermIndData; |
| 72 | memset(&accessTermIndData, 0, sizeof(BalAccessTerminalIndData)); |
| 73 | bal_access_terminal_ind_data__init(&accessTermIndData); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 74 | balIndCfg.access_term_ind->data = &accessTermIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 75 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 76 | balIndCfg.access_term_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 77 | balIndCfg.access_term_ind->data->admin_state = acc_term_ind->data.admin_state; |
| 78 | balIndCfg.access_term_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 79 | balIndCfg.access_term_ind->data->oper_status = acc_term_ind->data.oper_status; |
| 80 | balIndCfg.access_term_ind->data->has_iwf_mode = BAL_GRPC_PRES; |
| 81 | balIndCfg.access_term_ind->data->iwf_mode = acc_term_ind->data.iwf_mode; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 82 | |
| 83 | BalTopology balTop; |
| 84 | memset(&balTop, 0, sizeof(BalTopology)); |
| 85 | bal_topology__init(&balTop); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 86 | balIndCfg.access_term_ind->data->topology = &balTop; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 87 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 88 | balIndCfg.access_term_ind->data->topology->has_num_of_nni_ports = BAL_GRPC_PRES; |
| 89 | balIndCfg.access_term_ind->data->topology->num_of_nni_ports = |
| 90 | acc_term_ind->data.topology.num_of_nni_ports; |
| 91 | balIndCfg.access_term_ind->data->topology->has_num_of_pon_ports = BAL_GRPC_PRES; |
| 92 | balIndCfg.access_term_ind->data->topology->num_of_pon_ports = |
| 93 | acc_term_ind->data.topology.num_of_pon_ports; |
| 94 | balIndCfg.access_term_ind->data->topology->has_num_of_mac_devs = BAL_GRPC_PRES; |
| 95 | balIndCfg.access_term_ind->data->topology->num_of_mac_devs = |
| 96 | acc_term_ind->data.topology.num_of_mac_devs; |
| 97 | balIndCfg.access_term_ind->data->topology->has_num_of_pons_per_mac_dev = BAL_GRPC_PRES; |
| 98 | balIndCfg.access_term_ind->data->topology->num_of_pons_per_mac_dev = |
| 99 | acc_term_ind->data.topology.num_of_pons_per_mac_dev; |
| 100 | balIndCfg.access_term_ind->data->topology->has_pon_family = BAL_GRPC_PRES; |
| 101 | balIndCfg.access_term_ind->data->topology->pon_family = |
| 102 | acc_term_ind->data.topology.pon_family; |
| 103 | balIndCfg.access_term_ind->data->topology->has_pon_sub_family = BAL_GRPC_PRES; |
| 104 | balIndCfg.access_term_ind->data->topology->pon_sub_family = |
| 105 | acc_term_ind->data.topology.pon_sub_family; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 106 | |
| 107 | BalSwVersion balsv; |
| 108 | memset(&balsv, 0, sizeof(BalSwVersion)); |
| 109 | bal_sw_version__init(&balsv); |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 110 | balIndCfg.access_term_ind->data->sw_version = &balsv; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 111 | |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 112 | balIndCfg.access_term_ind->data->sw_version->has_version_type = BAL_GRPC_PRES; |
| 113 | balIndCfg.access_term_ind->data->sw_version->version_type = |
| 114 | acc_term_ind->data.sw_version.version_type; |
| 115 | balIndCfg.access_term_ind->data->sw_version->has_major_rev = BAL_GRPC_PRES; |
| 116 | balIndCfg.access_term_ind->data->sw_version->major_rev = |
| 117 | acc_term_ind->data.sw_version.major_rev; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 118 | balIndCfg.access_term_ind->data->sw_version->has_minor_rev = BAL_GRPC_PRES; |
| 119 | balIndCfg.access_term_ind->data->sw_version->minor_rev = |
| 120 | acc_term_ind->data.sw_version.minor_rev; |
| 121 | balIndCfg.access_term_ind->data->sw_version->has_patch_rev = BAL_GRPC_PRES; |
| 122 | balIndCfg.access_term_ind->data->sw_version->patch_rev = |
| 123 | acc_term_ind->data.sw_version.patch_rev; |
| 124 | balIndCfg.access_term_ind->data->sw_version->has_om_version = BAL_GRPC_PRES; |
| 125 | balIndCfg.access_term_ind->data->sw_version->om_version = |
| 126 | acc_term_ind->data.sw_version.om_version; |
| 127 | balIndCfg.access_term_ind->data->sw_version->has_dev_point = BAL_GRPC_PRES; |
| 128 | balIndCfg.access_term_ind->data->sw_version->dev_point = |
| 129 | acc_term_ind->data.sw_version.dev_point; |
| 130 | |
| 131 | bal_register_indication_cbs(); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 132 | |
| 133 | BalErr *output; |
| 134 | result = bal_ind__bal_acc_term_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 135 | } |
| 136 | |
| 137 | return result; |
| 138 | } |
| 139 | |
| 140 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 141 | * Function : bal_acc_term_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 142 | * Description : This function will handle the indications for * |
| 143 | * Access Terminal Operational State Change * |
| 144 | * * |
| 145 | ********************************************************************/ |
| 146 | bcmos_errno bal_acc_term_osc_indication_cb(bcmbal_obj *obj) |
| 147 | { |
| 148 | bcmos_errno result = BCM_ERR_OK; |
| 149 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 150 | if(BCMBAL_OBJ_ID_ACCESS_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 151 | bcmbal_access_terminal_auto_id_oper_status_change != obj->subgroup) |
| 152 | { |
| 153 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 154 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 155 | result = BCM_ERR_INTERNAL; |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | BalIndications balIndCfg; |
| 160 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 161 | bal_indications__init(&balIndCfg); |
| 162 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 163 | balIndCfg.objtype = obj->obj_type; |
| 164 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 165 | balIndCfg.sub_group = obj->subgroup; |
| 166 | balIndCfg.u_case = BAL_INDICATIONS__U_ACCESS_TERM_IND_OP_STATE; |
| 167 | balIndCfg.device_id = voltha_device_id; |
| 168 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 169 | bcmbal_access_terminal_oper_status_change *acc_term_osc = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 170 | (bcmbal_access_terminal_oper_status_change *)obj; |
| 171 | |
| 172 | BalAccessTerminalOperStatusChange acessTermOSC; |
| 173 | memset(&acessTermOSC, 0, sizeof(BalAccessTerminalOperStatusChange)); |
| 174 | bal_access_terminal_oper_status_change__init(&acessTermOSC); |
| 175 | balIndCfg.access_term_ind_op_state = &acessTermOSC; |
| 176 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 177 | BalObj hdr; |
| 178 | memset(&hdr, 0, sizeof(BalObj)); |
| 179 | bal_obj__init(&hdr); |
| 180 | balIndCfg.access_term_ind_op_state->hdr = &hdr; |
| 181 | |
| 182 | BalAccessTerminalKey accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 183 | memset(&accessTermkey, 0, sizeof(BalAccessTerminalKey)); |
| 184 | bal_access_terminal_key__init(&accessTermkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 185 | balIndCfg.access_term_ind_op_state->key = &accessTermkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 186 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 187 | balIndCfg.access_term_ind_op_state->key->has_access_term_id = BAL_GRPC_PRES; |
| 188 | balIndCfg.access_term_ind_op_state->key->access_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 189 | acc_term_osc->key.access_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 190 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 191 | BalAccessTerminalOperStatusChangeData accessTermOscData; |
| 192 | memset(&accessTermOscData, 0, sizeof(BalAccessTerminalOperStatusChangeData)); |
| 193 | bal_access_terminal_oper_status_change_data__init(&accessTermOscData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 194 | balIndCfg.access_term_ind_op_state->data = &accessTermOscData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 195 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 196 | balIndCfg.access_term_ind_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 197 | balIndCfg.access_term_ind_op_state->data->new_oper_status = |
| 198 | acc_term_osc->data.new_oper_status; |
| 199 | balIndCfg.access_term_ind_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 200 | balIndCfg.access_term_ind_op_state->data->old_oper_status = |
| 201 | acc_term_osc->data.old_oper_status; |
| 202 | balIndCfg.access_term_ind_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 203 | balIndCfg.access_term_ind_op_state->data->admin_state = |
| 204 | acc_term_osc->data.admin_state; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 205 | |
| 206 | BalErr *output; |
| 207 | result = bal_ind__bal_acc_term_oper_sts_cng_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 208 | } |
| 209 | |
| 210 | return result; |
| 211 | } |
| 212 | |
| 213 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 214 | * Function : bal_flow_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 215 | * Description : This function will handle the indications for * |
| 216 | * Flow Operational State Change * |
| 217 | * * |
| 218 | ********************************************************************/ |
| 219 | bcmos_errno bal_flow_osc_indication_cb(bcmbal_obj *obj) |
| 220 | { |
| 221 | bcmos_errno result = BCM_ERR_OK; |
| 222 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 223 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 224 | bcmbal_flow_auto_id_oper_status_change != obj->subgroup) |
| 225 | { |
| 226 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 227 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 228 | result = BCM_ERR_INTERNAL; |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | BalIndications balIndCfg; |
| 233 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 234 | bal_indications__init(&balIndCfg); |
| 235 | balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_OP_STATE; |
| 236 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 237 | balIndCfg.objtype = obj->obj_type; |
| 238 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 239 | balIndCfg.sub_group = obj->subgroup; |
| 240 | balIndCfg.device_id = voltha_device_id; |
| 241 | |
| 242 | bcmbal_flow_oper_status_change *flow_osc = (bcmbal_flow_oper_status_change *)obj; |
| 243 | |
| 244 | BalFlowOperStatusChange flowOscInd; |
| 245 | memset(&flowOscInd, 0, sizeof(BalFlowOperStatusChange)); |
| 246 | bal_flow_oper_status_change__init(&flowOscInd); |
| 247 | balIndCfg.flow_op_state = &flowOscInd; |
| 248 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 249 | BalObj hdr; |
| 250 | memset(&hdr, 0, sizeof(BalObj)); |
| 251 | bal_obj__init(&hdr); |
| 252 | balIndCfg.flow_op_state->hdr = &hdr; |
| 253 | |
| 254 | BalFlowKey flowkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 255 | memset(&flowkey, 0, sizeof(BalFlowKey)); |
| 256 | bal_flow_key__init(&flowkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 257 | balIndCfg.flow_op_state->key = &flowkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 258 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 259 | balIndCfg.flow_op_state->key->has_flow_id = BAL_GRPC_PRES; |
| 260 | balIndCfg.flow_op_state->key->flow_id = flow_osc->key.flow_id; |
| 261 | balIndCfg.flow_op_state->key->has_flow_type = BAL_GRPC_PRES; |
| 262 | balIndCfg.flow_op_state->key->flow_type = flow_osc->key.flow_type; |
| 263 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 264 | BalFlowOperStatusChangeData flowOscIndData; |
| 265 | memset(&flowOscIndData, 0, sizeof(BalFlowOperStatusChangeData)); |
| 266 | bal_flow_oper_status_change_data__init(&flowOscIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 267 | balIndCfg.flow_op_state->data = &flowOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 268 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 269 | balIndCfg.flow_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 270 | balIndCfg.flow_op_state->data->new_oper_status = flow_osc->data.new_oper_status; |
| 271 | balIndCfg.flow_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 272 | balIndCfg.flow_op_state->data->old_oper_status = flow_osc->data.old_oper_status; |
| 273 | balIndCfg.flow_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 274 | balIndCfg.flow_op_state->data->admin_state = flow_osc->data.admin_state; |
| 275 | balIndCfg.flow_op_state->data->has_svc_port_id = BAL_GRPC_PRES; |
| 276 | balIndCfg.flow_op_state->data->svc_port_id = flow_osc->data.svc_port_id; |
| 277 | balIndCfg.flow_op_state->data->has_dba_tm_sched_id = BAL_GRPC_PRES; |
| 278 | balIndCfg.flow_op_state->data->dba_tm_sched_id = flow_osc->data.dba_tm_sched_id; |
| 279 | balIndCfg.flow_op_state->data->has_cookie = BAL_GRPC_PRES; |
| 280 | balIndCfg.flow_op_state->data->cookie = flow_osc->data.cookie; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 281 | |
| 282 | BalErr *output; |
| 283 | result = bal_ind__bal_flow_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 284 | } |
| 285 | |
| 286 | return result; |
| 287 | } |
| 288 | |
| 289 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 290 | * Function : bal_flow_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 291 | * Description : This function will handle the indications for * |
| 292 | * Flow Indication * |
| 293 | * * |
| 294 | ********************************************************************/ |
| 295 | bcmos_errno bal_flow_indication_cb(bcmbal_obj *obj) |
| 296 | { |
| 297 | bcmos_errno result = BCM_ERR_OK; |
| 298 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 299 | if(BCMBAL_OBJ_ID_FLOW != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 300 | bcmbal_flow_auto_id_ind != obj->subgroup) |
| 301 | { |
| 302 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 303 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 304 | result = BCM_ERR_INTERNAL; |
| 305 | } |
| 306 | else |
| 307 | { |
| 308 | BalIndications balIndCfg; |
| 309 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 310 | bal_indications__init(&balIndCfg); |
| 311 | balIndCfg.u_case = BAL_INDICATIONS__U_FLOW_IND; |
| 312 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 313 | balIndCfg.objtype = obj->obj_type; |
| 314 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 315 | balIndCfg.sub_group = obj->subgroup; |
| 316 | balIndCfg.device_id = voltha_device_id; |
| 317 | |
| 318 | bcmbal_flow_ind *flow_ind = (bcmbal_flow_ind *)obj; |
| 319 | |
| 320 | BalFlowInd flowInd; |
| 321 | memset(&flowInd, 0, sizeof(BalFlowInd)); |
| 322 | bal_flow_ind__init(&flowInd); |
| 323 | balIndCfg.flow_ind = &flowInd; |
| 324 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 325 | BalObj hdr; |
| 326 | memset(&hdr, 0, sizeof(BalObj)); |
| 327 | bal_obj__init(&hdr); |
| 328 | balIndCfg.flow_ind->hdr = &hdr; |
| 329 | |
| 330 | BalFlowKey flowkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 331 | memset(&flowkey, 0, sizeof(BalFlowKey)); |
| 332 | bal_flow_key__init(&flowkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 333 | balIndCfg.flow_ind->key = &flowkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 334 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 335 | balIndCfg.flow_ind->key->has_flow_id = BAL_GRPC_PRES; |
| 336 | balIndCfg.flow_ind->key->flow_id = flow_ind->key.flow_id; |
| 337 | balIndCfg.flow_ind->key->has_flow_type = BAL_GRPC_PRES; |
| 338 | balIndCfg.flow_ind->key->flow_type = flow_ind->key.flow_type; |
| 339 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 340 | BalFlowIndData flowIndData; |
| 341 | memset(&flowIndData, 0, sizeof(BalFlowIndData)); |
| 342 | bal_flow_ind_data__init(&flowIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 343 | balIndCfg.flow_ind->data = &flowIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 344 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 345 | balIndCfg.flow_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 346 | balIndCfg.flow_ind->data->admin_state = flow_ind->data.admin_state; |
| 347 | balIndCfg.flow_ind->data->has_oper_status= BAL_GRPC_PRES; |
| 348 | balIndCfg.flow_ind->data->oper_status= flow_ind->data.oper_status; |
| 349 | balIndCfg.flow_ind->data->has_access_int_id = BAL_GRPC_PRES; |
| 350 | balIndCfg.flow_ind->data->access_int_id = flow_ind->data.access_int_id; |
| 351 | balIndCfg.flow_ind->data->has_network_int_id = BAL_GRPC_PRES; |
| 352 | balIndCfg.flow_ind->data->network_int_id = flow_ind->data.network_int_id; |
| 353 | balIndCfg.flow_ind->data->has_sub_term_id = BAL_GRPC_PRES; |
| 354 | balIndCfg.flow_ind->data->sub_term_id = flow_ind->data.sub_term_id; |
| 355 | balIndCfg.flow_ind->data->has_sub_term_uni_idx = BAL_GRPC_PRES; |
| 356 | balIndCfg.flow_ind->data->sub_term_uni_idx = flow_ind->data.sub_term_uni_idx; |
| 357 | balIndCfg.flow_ind->data->has_svc_port_id = BAL_GRPC_PRES; |
| 358 | balIndCfg.flow_ind->data->svc_port_id = flow_ind->data.svc_port_id; |
| 359 | balIndCfg.flow_ind->data->has_resolve_mac = BAL_GRPC_PRES; |
| 360 | balIndCfg.flow_ind->data->resolve_mac = flow_ind->data.resolve_mac; |
| 361 | balIndCfg.flow_ind->data->has_cookie = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 362 | balIndCfg.flow_ind->data->cookie = flow_ind->data.cookie; |
| 363 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 364 | BalClassifier balClassifier; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 365 | memset(&balClassifier, 0, sizeof(BalClassifier)); |
| 366 | bal_classifier__init(&balClassifier); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 367 | balIndCfg.flow_ind->data->classifier = &balClassifier; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 368 | |
| 369 | balIndCfg.flow_ind->data->classifier->has_presence_mask = BAL_GRPC_PRES; |
| 370 | balIndCfg.flow_ind->data->classifier->presence_mask = flow_ind->data.classifier.presence_mask; |
| 371 | balIndCfg.flow_ind->data->classifier->has_o_tpid = BAL_GRPC_PRES; |
| 372 | balIndCfg.flow_ind->data->classifier->o_tpid = flow_ind->data.classifier.o_tpid; |
| 373 | balIndCfg.flow_ind->data->classifier->has_o_vid = BAL_GRPC_PRES; |
| 374 | balIndCfg.flow_ind->data->classifier->o_vid = flow_ind->data.classifier.o_vid; |
| 375 | balIndCfg.flow_ind->data->classifier->has_i_tpid = BAL_GRPC_PRES; |
| 376 | balIndCfg.flow_ind->data->classifier->i_tpid = flow_ind->data.classifier.i_tpid; |
| 377 | balIndCfg.flow_ind->data->classifier->has_i_vid = BAL_GRPC_PRES; |
| 378 | balIndCfg.flow_ind->data->classifier->i_vid = flow_ind->data.classifier.i_vid; |
| 379 | balIndCfg.flow_ind->data->classifier->has_o_pbits = BAL_GRPC_PRES; |
| 380 | balIndCfg.flow_ind->data->classifier->o_pbits = flow_ind->data.classifier.o_pbits; |
| 381 | balIndCfg.flow_ind->data->classifier->has_i_pbits = BAL_GRPC_PRES; |
| 382 | balIndCfg.flow_ind->data->classifier->i_pbits = flow_ind->data.classifier.i_pbits; |
| 383 | balIndCfg.flow_ind->data->classifier->has_ether_type = BAL_GRPC_PRES; |
| 384 | balIndCfg.flow_ind->data->classifier->ether_type = flow_ind->data.classifier.ether_type; |
| 385 | balIndCfg.flow_ind->data->classifier->has_dst_mac = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 386 | balIndCfg.flow_ind->data->classifier->dst_mac.len = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 387 | (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.dst_mac.u8); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 388 | balIndCfg.flow_ind->data->classifier->dst_mac.data = |
| 389 | (uint8_t *)malloc((balIndCfg.flow_ind->data->classifier->dst_mac.len)*sizeof(uint8_t)); |
| 390 | memcpy(balIndCfg.flow_ind->data->classifier->dst_mac.data, |
| 391 | flow_ind->data.classifier.dst_mac.u8, |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 392 | balIndCfg.flow_ind->data->classifier->dst_mac.len); |
| 393 | balIndCfg.flow_ind->data->classifier->has_src_mac = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 394 | balIndCfg.flow_ind->data->classifier->src_mac.len = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 395 | (BCMOS_ETH_ALEN)*sizeof(flow_ind->data.classifier.src_mac.u8); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 396 | balIndCfg.flow_ind->data->classifier->src_mac.data = |
| 397 | (uint8_t *)malloc((balIndCfg.flow_ind->data->classifier->src_mac.len)*sizeof(uint8_t)); |
| 398 | memcpy(balIndCfg.flow_ind->data->classifier->src_mac.data, |
| 399 | flow_ind->data.classifier.src_mac.u8, |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 400 | balIndCfg.flow_ind->data->classifier->src_mac.len); |
| 401 | balIndCfg.flow_ind->data->classifier->has_ip_proto = BAL_GRPC_PRES; |
| 402 | balIndCfg.flow_ind->data->classifier->ip_proto = flow_ind->data.classifier.ip_proto; |
| 403 | balIndCfg.flow_ind->data->classifier->has_dst_ip = BAL_GRPC_PRES; |
| 404 | balIndCfg.flow_ind->data->classifier->dst_ip = flow_ind->data.classifier.dst_ip.u32; |
| 405 | balIndCfg.flow_ind->data->classifier->has_src_ip = BAL_GRPC_PRES; |
| 406 | balIndCfg.flow_ind->data->classifier->src_ip = flow_ind->data.classifier.src_ip.u32; |
| 407 | balIndCfg.flow_ind->data->classifier->has_src_port = BAL_GRPC_PRES; |
| 408 | balIndCfg.flow_ind->data->classifier->src_port = flow_ind->data.classifier.src_port; |
| 409 | balIndCfg.flow_ind->data->classifier->has_dst_port = BAL_GRPC_PRES; |
| 410 | balIndCfg.flow_ind->data->classifier->dst_port = flow_ind->data.classifier.dst_port; |
| 411 | balIndCfg.flow_ind->data->classifier->has_pkt_tag_type = BAL_GRPC_PRES; |
| 412 | balIndCfg.flow_ind->data->classifier->pkt_tag_type = flow_ind->data.classifier.pkt_tag_type; |
| 413 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 414 | BalAction balAction; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 415 | memset(&balAction, 0, sizeof(BalAction)); |
| 416 | bal_action__init(&balAction); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 417 | balIndCfg.flow_ind->data->action = &balAction; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 418 | |
| 419 | balIndCfg.flow_ind->data->action->has_presence_mask = BAL_GRPC_PRES; |
| 420 | balIndCfg.flow_ind->data->action->presence_mask = flow_ind->data.action.presence_mask; |
| 421 | balIndCfg.flow_ind->data->action->has_cmds_bitmask = BAL_GRPC_PRES; |
| 422 | balIndCfg.flow_ind->data->action->cmds_bitmask = flow_ind->data.action.cmds_bitmask; |
| 423 | balIndCfg.flow_ind->data->action->has_o_vid = BAL_GRPC_PRES; |
| 424 | balIndCfg.flow_ind->data->action->o_vid = flow_ind->data.action.o_vid; |
| 425 | balIndCfg.flow_ind->data->action->has_o_pbits = BAL_GRPC_PRES; |
| 426 | balIndCfg.flow_ind->data->action->o_pbits = flow_ind->data.action.o_pbits; |
| 427 | balIndCfg.flow_ind->data->action->has_o_tpid = BAL_GRPC_PRES; |
| 428 | balIndCfg.flow_ind->data->action->o_tpid = flow_ind->data.action.o_tpid; |
| 429 | balIndCfg.flow_ind->data->action->has_i_vid = BAL_GRPC_PRES; |
| 430 | balIndCfg.flow_ind->data->action->i_vid = flow_ind->data.action.i_vid; |
| 431 | balIndCfg.flow_ind->data->action->has_i_pbits = BAL_GRPC_PRES; |
| 432 | balIndCfg.flow_ind->data->action->i_pbits = flow_ind->data.action.i_pbits; |
| 433 | balIndCfg.flow_ind->data->action->has_i_tpid = BAL_GRPC_PRES; |
| 434 | balIndCfg.flow_ind->data->action->i_tpid = flow_ind->data.action.i_tpid; |
| 435 | BalErr *output; |
| 436 | result = bal_ind__bal_flow_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 437 | } |
| 438 | |
| 439 | return result; |
| 440 | } |
| 441 | |
| 442 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 443 | * Function : bal_group_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 444 | * Description : This function will handle the indications for * |
| 445 | * Group Indication * |
| 446 | * * |
| 447 | ********************************************************************/ |
| 448 | bcmos_errno bal_group_indication_cb(bcmbal_obj *obj) |
| 449 | { |
| 450 | bcmos_errno result = BCM_ERR_OK; |
| 451 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 452 | if(BCMBAL_OBJ_ID_GROUP != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 453 | bcmbal_group_auto_id_ind != obj->subgroup) |
| 454 | { |
| 455 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 456 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 457 | result = BCM_ERR_INTERNAL; |
| 458 | } |
| 459 | else |
| 460 | { |
| 461 | BalIndications balIndCfg; |
| 462 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 463 | bal_indications__init(&balIndCfg); |
| 464 | balIndCfg.u_case = BAL_INDICATIONS__U_GROUP_IND; |
| 465 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 466 | balIndCfg.objtype = obj->obj_type; |
| 467 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 468 | balIndCfg.sub_group = obj->subgroup; |
| 469 | balIndCfg.device_id = voltha_device_id; |
| 470 | |
| 471 | bcmbal_group_ind *group_ind = (bcmbal_group_ind *)obj; |
| 472 | |
| 473 | BalGroupInd groupInd; |
| 474 | memset(&groupInd, 0, sizeof(BalGroupInd)); |
| 475 | bal_group_ind__init(&groupInd); |
| 476 | balIndCfg.group_ind = &groupInd; |
| 477 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 478 | BalObj hdr; |
| 479 | memset(&hdr, 0, sizeof(BalObj)); |
| 480 | bal_obj__init(&hdr); |
| 481 | balIndCfg.group_ind->hdr = &hdr; |
| 482 | |
| 483 | BalGroupKey groupkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 484 | memset(&groupkey, 0, sizeof(BalGroupKey)); |
| 485 | bal_group_key__init(&groupkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 486 | balIndCfg.group_ind->key = &groupkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 487 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 488 | balIndCfg.group_ind->key->has_group_id = BAL_GRPC_PRES; |
| 489 | balIndCfg.group_ind->key->group_id = group_ind->key.group_id; |
| 490 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 491 | BalGroupIndData groupIndData; |
| 492 | memset(&groupIndData, 0, sizeof(BalGroupIndData)); |
| 493 | bal_group_ind_data__init(&groupIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 494 | balIndCfg.group_ind->data = &groupIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 495 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 496 | balIndCfg.group_ind->data->has_members_cmd = BAL_GRPC_PRES; |
| 497 | balIndCfg.group_ind->data->members_cmd = group_ind->data.members_cmd; |
| 498 | balIndCfg.group_ind->data->has_cookie = BAL_GRPC_PRES; |
| 499 | balIndCfg.group_ind->data->cookie = group_ind->data.cookie; |
| 500 | balIndCfg.group_ind->data->has_owner = BAL_GRPC_PRES; |
| 501 | balIndCfg.group_ind->data->owner = group_ind->data.owner; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 502 | |
| 503 | BalGroupMemberInfoList balMembers; |
| 504 | memset(&balMembers, 0, sizeof(BalGroupMemberInfoList)); |
| 505 | bal_group_member_info_list__init(&balMembers); |
| 506 | balIndCfg.group_ind->data->members = &balMembers; |
| 507 | |
| 508 | balIndCfg.group_ind->data->members->n_val = group_ind->data.members.len; |
| 509 | |
| 510 | BalGroupMemberInfo *balMemberInfo; |
| 511 | balMemberInfo = (BalGroupMemberInfo *)malloc(sizeof(BalGroupMemberInfo)); |
| 512 | memset(&balMemberInfo, 0, sizeof(BalGroupMemberInfo)); |
| 513 | bal_group_member_info__init(balMemberInfo); |
| 514 | balIndCfg.group_ind->data->members->val = &balMemberInfo; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 515 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 516 | balMemberInfo->has_intf_id = BAL_GRPC_PRES; |
| 517 | balMemberInfo->intf_id = group_ind->data.members.val->intf_id; |
| 518 | balMemberInfo->has_svc_port_id = BAL_GRPC_PRES; |
| 519 | balMemberInfo->svc_port_id = group_ind->data.members.val->svc_port_id; |
| 520 | |
| 521 | BalAction balAction; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 522 | memset(&balAction, 0, sizeof(BalAction)); |
| 523 | bal_action__init(&balAction); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 524 | balMemberInfo->action = &balAction; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 525 | |
| 526 | balMemberInfo->action->has_presence_mask = BAL_GRPC_PRES; |
| 527 | balMemberInfo->action->presence_mask = group_ind->data.members.val->action.presence_mask; |
| 528 | balMemberInfo->action->has_cmds_bitmask = BAL_GRPC_PRES; |
| 529 | balMemberInfo->action->cmds_bitmask = group_ind->data.members.val->action.cmds_bitmask; |
| 530 | balMemberInfo->action->has_o_vid = BAL_GRPC_PRES; |
| 531 | balMemberInfo->action->o_vid = group_ind->data.members.val->action.o_vid; |
| 532 | balMemberInfo->action->has_o_pbits = BAL_GRPC_PRES; |
| 533 | balMemberInfo->action->o_pbits = group_ind->data.members.val->action.o_pbits; |
| 534 | balMemberInfo->action->has_o_tpid = BAL_GRPC_PRES; |
| 535 | balMemberInfo->action->o_tpid = group_ind->data.members.val->action.o_tpid; |
| 536 | balMemberInfo->action->has_i_vid = BAL_GRPC_PRES; |
| 537 | balMemberInfo->action->i_vid = group_ind->data.members.val->action.i_vid; |
| 538 | balMemberInfo->action->has_i_pbits = BAL_GRPC_PRES; |
| 539 | balMemberInfo->action->i_pbits = group_ind->data.members.val->action.i_pbits; |
| 540 | balMemberInfo->action->has_i_tpid = BAL_GRPC_PRES; |
| 541 | balMemberInfo->action->i_tpid = group_ind->data.members.val->action.i_tpid; |
| 542 | |
| 543 | BalTmQueueRef balQueue; |
| 544 | memset(&balQueue, 0, sizeof(BalTmQueueRef)); |
| 545 | bal_tm_queue_ref__init(&balQueue); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 546 | balMemberInfo->queue = &balQueue; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 547 | |
| 548 | balMemberInfo->queue->has_sched_id = BAL_GRPC_PRES; |
| 549 | balMemberInfo->queue->sched_id = group_ind->data.members.val->queue.sched_id; |
| 550 | balMemberInfo->queue->has_queue_id = BAL_GRPC_PRES; |
| 551 | balMemberInfo->queue->queue_id = group_ind->data.members.val->queue.queue_id; |
| 552 | |
| 553 | BalIdList balFlows; |
| 554 | memset(&balFlows, 0, sizeof(BalIdList)); |
| 555 | bal_id_list__init(&balFlows); |
| 556 | balIndCfg.group_ind->data->flows = &balFlows; |
| 557 | |
| 558 | balIndCfg.group_ind->data->flows->n_val = group_ind->data.flows.len; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 559 | balIndCfg.group_ind->data->flows->val = |
| 560 | (uint32_t *)malloc((balIndCfg.group_ind->data->flows->n_val)*sizeof(uint32_t)); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 561 | memcpy(balIndCfg.group_ind->data->flows->val, group_ind->data.flows.val, |
| 562 | balIndCfg.group_ind->data->flows->n_val); |
| 563 | |
| 564 | BalErr *output; |
| 565 | result = bal_ind__bal_group_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 566 | } |
| 567 | |
| 568 | return result; |
| 569 | } |
| 570 | |
| 571 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 572 | * Function : bal_interface_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 573 | * Description : This function will handle the indications for * |
| 574 | * Interface Operational State Change * |
| 575 | * * |
| 576 | ********************************************************************/ |
| 577 | bcmos_errno bal_interface_osc_indication_cb(bcmbal_obj *obj) |
| 578 | { |
| 579 | bcmos_errno result = BCM_ERR_OK; |
| 580 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 581 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 582 | bcmbal_interface_auto_id_oper_status_change != obj->subgroup) |
| 583 | { |
| 584 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 585 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 586 | result = BCM_ERR_INTERNAL; |
| 587 | } |
| 588 | else |
| 589 | { |
| 590 | BalIndications balIndCfg; |
| 591 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 592 | bal_indications__init(&balIndCfg); |
| 593 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_OP_STATE; |
| 594 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 595 | balIndCfg.objtype = obj->obj_type; |
| 596 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 597 | balIndCfg.sub_group = obj->subgroup; |
| 598 | balIndCfg.device_id = voltha_device_id; |
| 599 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 600 | bcmbal_interface_oper_status_change *int_osc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 601 | (bcmbal_interface_oper_status_change *)obj; |
| 602 | |
| 603 | BalInterfaceOperStatusChange ifOsc; |
| 604 | memset(&ifOsc, 0, sizeof(BalInterfaceOperStatusChange)); |
| 605 | bal_interface_oper_status_change__init(&ifOsc); |
| 606 | balIndCfg.interface_op_state = &ifOsc; |
| 607 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 608 | BalObj hdr; |
| 609 | memset(&hdr, 0, sizeof(BalObj)); |
| 610 | bal_obj__init(&hdr); |
| 611 | balIndCfg.interface_op_state->hdr = &hdr; |
| 612 | |
| 613 | BalInterfaceKey ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 614 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 615 | bal_interface_key__init(&ifkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 616 | balIndCfg.interface_op_state->key = &ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 617 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 618 | balIndCfg.interface_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 619 | balIndCfg.interface_op_state->key->intf_id = int_osc_ind->key.intf_id; |
| 620 | balIndCfg.interface_op_state->key->has_intf_type = BAL_GRPC_PRES; |
| 621 | balIndCfg.interface_op_state->key->intf_type = int_osc_ind->key.intf_type; |
| 622 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 623 | BalInterfaceOperStatusChangeData ifOscIndData; |
| 624 | memset(&ifOscIndData, 0, sizeof(BalInterfaceOperStatusChangeData)); |
| 625 | bal_interface_oper_status_change_data__init(&ifOscIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 626 | balIndCfg.interface_op_state->data = &ifOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 627 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 628 | balIndCfg.interface_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 629 | balIndCfg.interface_op_state->data->new_oper_status = int_osc_ind->data.new_oper_status; |
| 630 | balIndCfg.interface_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 631 | balIndCfg.interface_op_state->data->old_oper_status = int_osc_ind->data.old_oper_status; |
| 632 | balIndCfg.interface_op_state->data->has_admin_state = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 633 | 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^] | 634 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 635 | BalErr *output; |
| 636 | result = bal_ind__bal_iface_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 637 | } |
| 638 | |
| 639 | return result; |
| 640 | } |
| 641 | |
| 642 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 643 | * Function : bal_interface_los_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 644 | * Description : This function will handle the indications for * |
| 645 | * Interface los Indication * |
| 646 | * * |
| 647 | ********************************************************************/ |
| 648 | bcmos_errno bal_interface_los_indication_cb(bcmbal_obj *obj) |
| 649 | { |
| 650 | bcmos_errno result = BCM_ERR_OK; |
| 651 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 652 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 653 | bcmbal_interface_auto_id_los != obj->subgroup) |
| 654 | { |
| 655 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 656 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 657 | result = BCM_ERR_INTERNAL; |
| 658 | } |
| 659 | else |
| 660 | { |
| 661 | BalIndications balIndCfg; |
| 662 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 663 | bal_indications__init(&balIndCfg); |
| 664 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_LOS; |
| 665 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 666 | balIndCfg.objtype = obj->obj_type; |
| 667 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 668 | balIndCfg.sub_group = obj->subgroup; |
| 669 | balIndCfg.device_id = voltha_device_id; |
| 670 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 671 | bcmbal_interface_los *int_los_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 672 | (bcmbal_interface_los *)obj; |
| 673 | |
| 674 | BalInterfaceLos ifLos; |
| 675 | memset(&ifLos, 0, sizeof(BalInterfaceLos)); |
| 676 | bal_interface_los__init(&ifLos); |
| 677 | balIndCfg.interface_los = &ifLos; |
| 678 | |
| 679 | BalObj hdr; |
| 680 | memset(&hdr, 0, sizeof(BalObj)); |
| 681 | bal_obj__init(&hdr); |
| 682 | balIndCfg.interface_los->hdr = &hdr; |
| 683 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 684 | BalInterfaceKey ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 685 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 686 | bal_interface_key__init(&ifkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 687 | balIndCfg.interface_los->key = &ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 688 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 689 | balIndCfg.interface_los->key->has_intf_id = BAL_GRPC_PRES; |
| 690 | balIndCfg.interface_los->key->intf_id = int_los_ind->key.intf_id; |
| 691 | balIndCfg.interface_los->key->has_intf_type = BAL_GRPC_PRES; |
| 692 | balIndCfg.interface_los->key->intf_type = int_los_ind->key.intf_type; |
| 693 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 694 | BalInterfaceLosData ifLosIndData; |
| 695 | memset(&ifLosIndData, 0, sizeof(BalInterfaceLosData)); |
| 696 | bal_interface_los_data__init(&ifLosIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 697 | balIndCfg.interface_los->data = &ifLosIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 698 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 699 | balIndCfg.interface_los->data->has_status = BAL_GRPC_PRES; |
| 700 | balIndCfg.interface_los->data->status = int_los_ind->data.status; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 701 | |
| 702 | BalErr *output; |
| 703 | result = bal_ind__bal_iface_los(client, NULL, &balIndCfg, &output, NULL, 0); |
| 704 | } |
| 705 | |
| 706 | return result; |
| 707 | } |
| 708 | |
| 709 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 710 | * Function : bal_interface_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 711 | * Description : This function will handle the indications for * |
| 712 | * Interface Indication * |
| 713 | * * |
| 714 | ********************************************************************/ |
| 715 | bcmos_errno bal_interface_indication_cb(bcmbal_obj *obj) |
| 716 | { |
| 717 | bcmos_errno result = BCM_ERR_OK; |
| 718 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 719 | if(BCMBAL_OBJ_ID_INTERFACE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 720 | bcmbal_interface_auto_id_ind != obj->subgroup) |
| 721 | { |
| 722 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 723 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 724 | result = BCM_ERR_INTERNAL; |
| 725 | } |
| 726 | else |
| 727 | { |
| 728 | BalIndications balIndCfg; |
| 729 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 730 | bal_indications__init(&balIndCfg); |
| 731 | balIndCfg.u_case = BAL_INDICATIONS__U_INTERFACE_IND; |
| 732 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 733 | balIndCfg.objtype = obj->obj_type; |
| 734 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 735 | balIndCfg.sub_group = obj->subgroup; |
| 736 | balIndCfg.device_id = voltha_device_id; |
| 737 | |
| 738 | bcmbal_interface_ind *interface_ind = (bcmbal_interface_ind *)obj; |
| 739 | |
| 740 | BalInterfaceInd ifInd; |
| 741 | memset(&ifInd, 0, sizeof(BalInterfaceInd)); |
| 742 | bal_interface_ind__init(&ifInd); |
| 743 | balIndCfg.interface_ind = &ifInd; |
| 744 | |
| 745 | BalObj hdr; |
| 746 | memset(&hdr, 0, sizeof(BalObj)); |
| 747 | bal_obj__init(&hdr); |
| 748 | balIndCfg.interface_ind->hdr = &hdr; |
| 749 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 750 | BalInterfaceKey ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 751 | memset(&ifkey, 0, sizeof(BalInterfaceKey)); |
| 752 | bal_interface_key__init(&ifkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 753 | balIndCfg.interface_ind->key = &ifkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 754 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 755 | balIndCfg.interface_ind->key->has_intf_id = BAL_GRPC_PRES; |
| 756 | balIndCfg.interface_ind->key->intf_id = interface_ind->key.intf_id; |
| 757 | balIndCfg.interface_ind->key->has_intf_type = BAL_GRPC_PRES; |
| 758 | balIndCfg.interface_ind->key->intf_type = interface_ind->key.intf_type; |
| 759 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 760 | BalInterfaceIndData ifIndData; |
| 761 | memset(&ifIndData, 0, sizeof(BalInterfaceIndData)); |
| 762 | bal_interface_ind_data__init(&ifIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 763 | balIndCfg.interface_ind->data = &ifIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 764 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 765 | balIndCfg.interface_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 766 | balIndCfg.interface_ind->data->admin_state = interface_ind->data.admin_state; |
| 767 | balIndCfg.interface_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 768 | balIndCfg.interface_ind->data->oper_status = interface_ind->data.oper_status; |
| 769 | balIndCfg.interface_ind->data->has_min_data_agg_port_id = BAL_GRPC_PRES; |
| 770 | balIndCfg.interface_ind->data->min_data_agg_port_id = interface_ind->data.min_data_agg_port_id; |
| 771 | balIndCfg.interface_ind->data->has_min_data_svc_port_id = BAL_GRPC_PRES; |
| 772 | balIndCfg.interface_ind->data->min_data_svc_port_id = interface_ind->data.min_data_svc_port_id; |
| 773 | balIndCfg.interface_ind->data->has_transceiver_type = BAL_GRPC_PRES; |
| 774 | balIndCfg.interface_ind->data->transceiver_type = interface_ind->data.transceiver_type; |
| 775 | balIndCfg.interface_ind->data->has_ds_miss_mode = BAL_GRPC_PRES; |
| 776 | balIndCfg.interface_ind->data->ds_miss_mode = interface_ind->data.ds_miss_mode; |
| 777 | balIndCfg.interface_ind->data->has_mtu = BAL_GRPC_PRES; |
| 778 | balIndCfg.interface_ind->data->mtu = interface_ind->data.mtu; |
| 779 | balIndCfg.interface_ind->data->has_flow_control = BAL_GRPC_PRES; |
| 780 | balIndCfg.interface_ind->data->flow_control = interface_ind->data.flow_control; |
| 781 | balIndCfg.interface_ind->data->has_ds_tm = BAL_GRPC_PRES; |
| 782 | balIndCfg.interface_ind->data->ds_tm = interface_ind->data.ds_tm; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 783 | balIndCfg.interface_ind->data->has_us_tm = BAL_GRPC_PRES; |
| 784 | balIndCfg.interface_ind->data->us_tm = interface_ind->data.us_tm; |
| 785 | |
| 786 | BalIdList balFlows; |
| 787 | memset(&balFlows, 0, sizeof(BalIdList)); |
| 788 | bal_id_list__init(&balFlows); |
| 789 | balIndCfg.interface_ind->data->sub_term_id_list = &balFlows; |
| 790 | |
| 791 | balIndCfg.interface_ind->data->sub_term_id_list->n_val = interface_ind->data.sub_term_id_list.len; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 792 | balIndCfg.interface_ind->data->sub_term_id_list->val = |
| 793 | (uint32_t *)malloc((balIndCfg.interface_ind->data->sub_term_id_list->n_val)*sizeof(uint32_t)); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 794 | memcpy(balIndCfg.interface_ind->data->sub_term_id_list->val, interface_ind->data.sub_term_id_list.val, |
| 795 | balIndCfg.interface_ind->data->sub_term_id_list->n_val); |
| 796 | |
| 797 | BalErr *output; |
| 798 | result = bal_ind__bal_iface_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 799 | } |
| 800 | |
| 801 | return result; |
| 802 | } |
| 803 | |
| 804 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 805 | * Function : bal_sub_term_osc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 806 | * Description : This function will handle the indications for * |
| 807 | * Subscriber term Operational State Change * |
| 808 | * * |
| 809 | ********************************************************************/ |
| 810 | bcmos_errno bal_sub_term_osc_indication_cb(bcmbal_obj *obj) |
| 811 | { |
| 812 | bcmos_errno result = BCM_ERR_OK; |
| 813 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 814 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 815 | bcmbal_subscriber_terminal_auto_id_oper_status_change != obj->subgroup) |
| 816 | { |
| 817 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 818 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 819 | result = BCM_ERR_INTERNAL; |
| 820 | } |
| 821 | else |
| 822 | { |
| 823 | BalIndications balIndCfg; |
| 824 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 825 | bal_indications__init(&balIndCfg); |
| 826 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_OP_STATE; |
| 827 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 828 | balIndCfg.objtype = obj->obj_type; |
| 829 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 830 | balIndCfg.sub_group = obj->subgroup; |
| 831 | balIndCfg.device_id = voltha_device_id; |
| 832 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 833 | bcmbal_subscriber_terminal_oper_status_change *sub_osc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 834 | (bcmbal_subscriber_terminal_oper_status_change *)obj; |
| 835 | |
| 836 | BalSubscriberTerminalOperStatusChange subOscInd; |
| 837 | memset(&subOscInd, 0, sizeof(BalSubscriberTerminalOperStatusChange)); |
| 838 | bal_subscriber_terminal_oper_status_change__init(&subOscInd); |
| 839 | balIndCfg.terminal_op_state = &subOscInd; |
| 840 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 841 | BalObj hdr; |
| 842 | memset(&hdr, 0, sizeof(BalObj)); |
| 843 | bal_obj__init(&hdr); |
| 844 | balIndCfg.terminal_op_state->hdr = &hdr; |
| 845 | |
| 846 | BalSubscriberTerminalKey subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 847 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 848 | bal_subscriber_terminal_key__init(&subkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 849 | balIndCfg.terminal_op_state->key = &subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 850 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 851 | balIndCfg.terminal_op_state->key->has_intf_id = BAL_GRPC_PRES; |
| 852 | balIndCfg.terminal_op_state->key->intf_id = sub_osc_ind->key.intf_id; |
| 853 | balIndCfg.terminal_op_state->key->has_sub_term_id = BAL_GRPC_PRES; |
| 854 | balIndCfg.terminal_op_state->key->sub_term_id = sub_osc_ind->key.sub_term_id; |
| 855 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 856 | BalSubscriberTerminalOperStatusChangeData subOscIndData; |
| 857 | memset(&subOscIndData, 0, sizeof(BalSubscriberTerminalOperStatusChangeData)); |
| 858 | bal_subscriber_terminal_oper_status_change_data__init(&subOscIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 859 | balIndCfg.terminal_op_state->data = &subOscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 860 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 861 | balIndCfg.terminal_op_state->data->has_new_oper_status = BAL_GRPC_PRES; |
| 862 | balIndCfg.terminal_op_state->data->new_oper_status = |
| 863 | sub_osc_ind->data.new_oper_status; |
| 864 | balIndCfg.terminal_op_state->data->has_old_oper_status = BAL_GRPC_PRES; |
| 865 | balIndCfg.terminal_op_state->data->old_oper_status = |
| 866 | sub_osc_ind->data.old_oper_status; |
| 867 | balIndCfg.terminal_op_state->data->has_admin_state = BAL_GRPC_PRES; |
| 868 | balIndCfg.terminal_op_state->data->admin_state = |
| 869 | sub_osc_ind->data.admin_state; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 870 | |
| 871 | BalErr *output; |
| 872 | result = bal_ind__bal_subs_term_oper_sts_cng(client, NULL, &balIndCfg, &output, NULL, 0); |
| 873 | } |
| 874 | |
| 875 | return result; |
| 876 | } |
| 877 | |
| 878 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 879 | * Function : bal_sub_term_disc_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 880 | * Description : This function will handle the indications for * |
| 881 | * Subscriber term disc indication * |
| 882 | * * |
| 883 | ********************************************************************/ |
| 884 | bcmos_errno bal_sub_term_disc_indication_cb(bcmbal_obj *obj) |
| 885 | { |
| 886 | bcmos_errno result = BCM_ERR_OK; |
| 887 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 888 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 889 | bcmbal_subscriber_terminal_auto_id_sub_term_disc != obj->subgroup) |
| 890 | { |
| 891 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 892 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 893 | result = BCM_ERR_INTERNAL; |
| 894 | } |
| 895 | else |
| 896 | { |
| 897 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 898 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 899 | BalIndications balIndCfg; |
| 900 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 901 | bal_indications__init(&balIndCfg); |
| 902 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DISC; |
| 903 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 904 | balIndCfg.objtype = obj->obj_type; |
| 905 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 906 | balIndCfg.sub_group = obj->subgroup; |
| 907 | balIndCfg.device_id = voltha_device_id; |
| 908 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 909 | bcmbal_subscriber_terminal_sub_term_disc *sub_disc_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 910 | (bcmbal_subscriber_terminal_sub_term_disc *)obj; |
| 911 | |
| 912 | BalSubscriberTerminalSubTermDisc subDiscInd; |
| 913 | memset(&subDiscInd, 0, sizeof(BalSubscriberTerminalSubTermDisc)); |
| 914 | bal_subscriber_terminal_sub_term_disc__init(&subDiscInd); |
| 915 | balIndCfg.terminal_disc = &subDiscInd; |
| 916 | |
| 917 | BalObj hdr; |
| 918 | memset(&hdr, 0, sizeof(BalObj)); |
| 919 | bal_obj__init(&hdr); |
| 920 | balIndCfg.terminal_disc->hdr = &hdr; |
| 921 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 922 | BalSubscriberTerminalKey subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 923 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 924 | bal_subscriber_terminal_key__init(&subkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 925 | balIndCfg.terminal_disc->key = &subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 926 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 927 | balIndCfg.terminal_disc->key->has_intf_id = BAL_GRPC_PRES; |
| 928 | balIndCfg.terminal_disc->key->intf_id = sub_disc_ind->key.intf_id; |
| 929 | balIndCfg.terminal_disc->key->has_sub_term_id = BAL_GRPC_PRES; |
| 930 | balIndCfg.terminal_disc->key->sub_term_id = sub_disc_ind->key.sub_term_id; |
| 931 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 932 | BalSubscriberTerminalSubTermDiscData subDiscIndData; |
| 933 | memset(&subDiscIndData, 0, sizeof(BalSubscriberTerminalSubTermDiscData)); |
| 934 | bal_subscriber_terminal_sub_term_disc_data__init(&subDiscIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 935 | balIndCfg.terminal_disc->data = &subDiscIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 936 | |
| 937 | BalSerialNumber serial_number; |
| 938 | memset(&serial_number, 0, sizeof(BalSerialNumber)); |
| 939 | bal_serial_number__init(&serial_number); |
| 940 | |
| 941 | balIndCfg.terminal_disc->data->serial_number = &serial_number; |
| 942 | |
| 943 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Discovered ONU serial number " |
| 944 | "%2X%2X%2X%2X%1X%1X%1X%1X%1X%1X%1X%1X ", |
| 945 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 946 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 947 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 948 | sub_disc_ind->data.serial_number.vendor_id[3], |
| 949 | sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 950 | sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 951 | sub_disc_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 952 | sub_disc_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 953 | sub_disc_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 954 | sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 955 | sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 956 | sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 957 | |
| 958 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor id is %s\n", sub_disc_ind->data.serial_number.vendor_id); |
| 959 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:Before decoding:Vendor specific is %s\n", sub_disc_ind->data.serial_number.vendor_specific); |
| 960 | |
| 961 | char vendor_id[MAX_CHAR_LENGTH]; |
| 962 | memset(&vendor_id, 0, MAX_CHAR_LENGTH); |
| 963 | sprintf(vendor_id,"%c%c%c%c", |
| 964 | sub_disc_ind->data.serial_number.vendor_id[0], |
| 965 | sub_disc_ind->data.serial_number.vendor_id[1], |
| 966 | sub_disc_ind->data.serial_number.vendor_id[2], |
| 967 | sub_disc_ind->data.serial_number.vendor_id[3]); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 968 | balIndCfg.terminal_disc->data->serial_number->vendor_id = vendor_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 969 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor id is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_id); |
| 970 | char vendor_specific[MAX_CHAR_LENGTH]; |
| 971 | memset(&vendor_specific, 0, MAX_CHAR_LENGTH); |
| 972 | sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X", |
| 973 | sub_disc_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 974 | sub_disc_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 975 | sub_disc_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 976 | sub_disc_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 977 | sub_disc_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 978 | sub_disc_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 979 | sub_disc_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 980 | sub_disc_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 981 | balIndCfg.terminal_disc->data->serial_number->vendor_specific = vendor_specific; |
| 982 | ASFVOLT_LOG(ASFVOLT_DEBUG, "ONU Discovery:After decoding:Vendor specific is %s\n", balIndCfg.terminal_disc->data->serial_number->vendor_specific); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 983 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 984 | BalErr *output; |
| 985 | result = bal_ind__bal_subs_term_discovery_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 986 | } |
| 987 | |
| 988 | return result; |
| 989 | } |
| 990 | |
| 991 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 992 | * Function : bal_sub_term_alarm_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 993 | * Description : This function will handle the indications for * |
| 994 | * Subscriber term alarm indication * |
| 995 | * * |
| 996 | ********************************************************************/ |
| 997 | bcmos_errno bal_sub_term_alarm_indication_cb(bcmbal_obj *obj) |
| 998 | { |
| 999 | bcmos_errno result = BCM_ERR_OK; |
| 1000 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1001 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1002 | bcmbal_subscriber_terminal_auto_id_sub_term_alarm != obj->subgroup) |
| 1003 | { |
| 1004 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1005 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1006 | result = BCM_ERR_INTERNAL; |
| 1007 | } |
| 1008 | else |
| 1009 | { |
| 1010 | BalIndications balIndCfg; |
| 1011 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1012 | bal_indications__init(&balIndCfg); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1013 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1014 | balIndCfg.objtype = BAL_OBJ_ID__BAL_OBJ_ID_SUBSCRIBER_TERMINAL; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1015 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1016 | balIndCfg.sub_group = obj->subgroup; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1017 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1018 | balIndCfg.device_id = voltha_device_id; |
| 1019 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1020 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_ALARM; |
| 1021 | bcmbal_subscriber_terminal_sub_term_alarm *sub_term_alarm = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1022 | (bcmbal_subscriber_terminal_sub_term_alarm *)obj; |
| 1023 | |
| 1024 | BalSubscriberTerminalSubTermAlarm subTermAlarm; |
| 1025 | memset(&subTermAlarm, 0, sizeof(BalSubscriberTerminalSubTermAlarm)); |
| 1026 | bal_subscriber_terminal_sub_term_alarm__init(&subTermAlarm); |
| 1027 | balIndCfg.terminal_alarm = &subTermAlarm; |
| 1028 | |
| 1029 | BalObj hdr; |
| 1030 | memset(&hdr, 0, sizeof(BalObj)); |
| 1031 | bal_obj__init(&hdr); |
| 1032 | balIndCfg.terminal_alarm->hdr = &hdr; |
| 1033 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1034 | BalSubscriberTerminalKey subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1035 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1036 | bal_subscriber_terminal_key__init(&subkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1037 | balIndCfg.terminal_alarm->key = &subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1038 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1039 | balIndCfg.terminal_alarm->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1040 | balIndCfg.terminal_alarm->key->sub_term_id = sub_term_alarm->key.sub_term_id; |
| 1041 | balIndCfg.terminal_alarm->key->has_intf_id = BAL_GRPC_PRES; |
| 1042 | balIndCfg.terminal_alarm->key->intf_id = sub_term_alarm->key.intf_id; |
| 1043 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1044 | BalsubscriberTerminalSubTermAlarmData subTermAlarmData; |
| 1045 | memset(&subTermAlarmData, 0, sizeof(BalsubscriberTerminalSubTermAlarmData)); |
| 1046 | balsubscriber_terminal_sub_term_alarm_data__init(&subTermAlarmData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1047 | balIndCfg.terminal_alarm->data = &subTermAlarmData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1048 | |
| 1049 | BalSubscriberTerminalAlarms balSubAlarms; |
| 1050 | memset(&balSubAlarms, 0, sizeof(BalSubscriberTerminalAlarms)); |
| 1051 | bal_subscriber_terminal_alarms__init(&balSubAlarms); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1052 | balIndCfg.terminal_alarm->data->alarm = &balSubAlarms; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1053 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1054 | balIndCfg.terminal_alarm->data->alarm->has_los = BAL_GRPC_PRES; |
| 1055 | balIndCfg.terminal_alarm->data->alarm->los = sub_term_alarm->data.alarm.los; |
| 1056 | balIndCfg.terminal_alarm->data->alarm->has_lob = BAL_GRPC_PRES; |
| 1057 | balIndCfg.terminal_alarm->data->alarm->lob = sub_term_alarm->data.alarm.lob; |
| 1058 | balIndCfg.terminal_alarm->data->alarm->has_lopc_miss = BAL_GRPC_PRES; |
| 1059 | balIndCfg.terminal_alarm->data->alarm->lopc_miss = sub_term_alarm->data.alarm.lopc_miss; |
| 1060 | balIndCfg.terminal_alarm->data->alarm->has_lopc_mic_error = BAL_GRPC_PRES; |
| 1061 | 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] | 1062 | |
| 1063 | BalErr *output; |
| 1064 | result = bal_ind__bal_subs_term_alarm_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1065 | } |
| 1066 | |
| 1067 | return result; |
| 1068 | } |
| 1069 | |
| 1070 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1071 | * Function : bal_sub_term_dgi_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1072 | * Description : This function will handle the indications for * |
| 1073 | * Subscriber term dgi indication * |
| 1074 | * * |
| 1075 | ********************************************************************/ |
| 1076 | bcmos_errno bal_sub_term_dgi_indication_cb(bcmbal_obj *obj) |
| 1077 | { |
| 1078 | bcmos_errno result = BCM_ERR_OK; |
| 1079 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1080 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1081 | bcmbal_subscriber_terminal_auto_id_dgi != obj->subgroup) |
| 1082 | { |
| 1083 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1084 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1085 | result = BCM_ERR_INTERNAL; |
| 1086 | } |
| 1087 | else |
| 1088 | { |
| 1089 | BalIndications balIndCfg; |
| 1090 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1091 | bal_indications__init(&balIndCfg); |
| 1092 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_DGI; |
| 1093 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1094 | balIndCfg.objtype = obj->obj_type; |
| 1095 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1096 | balIndCfg.sub_group = obj->subgroup; |
| 1097 | balIndCfg.device_id = voltha_device_id; |
| 1098 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1099 | bcmbal_subscriber_terminal_dgi *sub_dgi_ind = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1100 | (bcmbal_subscriber_terminal_dgi *)obj; |
| 1101 | |
| 1102 | BalSubscriberTerminalDgi subDgiInd; |
| 1103 | memset(&subDgiInd, 0, sizeof(BalSubscriberTerminalDgi)); |
| 1104 | bal_subscriber_terminal_dgi__init(&subDgiInd); |
| 1105 | balIndCfg.terminal_dgi= &subDgiInd; |
| 1106 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1107 | BalObj hdr; |
| 1108 | memset(&hdr, 0, sizeof(BalObj)); |
| 1109 | bal_obj__init(&hdr); |
| 1110 | balIndCfg.terminal_dgi->hdr = &hdr; |
| 1111 | |
| 1112 | BalSubscriberTerminalKey subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1113 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1114 | bal_subscriber_terminal_key__init(&subkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1115 | balIndCfg.terminal_disc->key = &subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1116 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1117 | balIndCfg.terminal_dgi->key->has_intf_id = BAL_GRPC_PRES; |
| 1118 | balIndCfg.terminal_dgi->key->intf_id = sub_dgi_ind->key.intf_id; |
| 1119 | balIndCfg.terminal_dgi->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1120 | balIndCfg.terminal_dgi->key->sub_term_id = sub_dgi_ind->key.sub_term_id; |
| 1121 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1122 | BalSubscriberTerminalDgiData subDgiIndData; |
| 1123 | memset(&subDgiIndData, 0, sizeof(BalSubscriberTerminalDgiData)); |
| 1124 | bal_subscriber_terminal_dgi_data__init(&subDgiIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1125 | balIndCfg.terminal_dgi->data = &subDgiIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1126 | |
| 1127 | balIndCfg.terminal_dgi->data->has_dgi_status = BAL_GRPC_PRES; |
| 1128 | balIndCfg.terminal_dgi->data->dgi_status = sub_dgi_ind->data.dgi_status; |
| 1129 | |
| 1130 | BalErr *output; |
| 1131 | result = bal_ind__bal_subs_term_dgi_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1132 | } |
| 1133 | |
| 1134 | return result; |
| 1135 | } |
| 1136 | |
| 1137 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1138 | * Function : bal_sub_term_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1139 | * Description : This function will handle the indications for * |
| 1140 | * Subscriber term indication * |
| 1141 | * * |
| 1142 | ********************************************************************/ |
| 1143 | bcmos_errno bal_sub_term_indication_cb(bcmbal_obj *obj) |
| 1144 | { |
| 1145 | bcmos_errno result = BCM_ERR_OK; |
| 1146 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1147 | if(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1148 | bcmbal_subscriber_terminal_auto_id_ind != obj->subgroup) |
| 1149 | { |
| 1150 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1151 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1152 | result = BCM_ERR_INTERNAL; |
| 1153 | } |
| 1154 | else |
| 1155 | { |
| 1156 | BalIndications balIndCfg; |
| 1157 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1158 | bal_indications__init(&balIndCfg); |
| 1159 | balIndCfg.u_case = BAL_INDICATIONS__U_TERMINAL_IND; |
| 1160 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1161 | balIndCfg.objtype = obj->obj_type; |
| 1162 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1163 | balIndCfg.sub_group = obj->subgroup; |
| 1164 | balIndCfg.device_id = voltha_device_id; |
| 1165 | |
| 1166 | bcmbal_subscriber_terminal_ind *sub_ind = (bcmbal_subscriber_terminal_ind *)obj; |
| 1167 | |
| 1168 | BalSubscriberTerminalInd subInd; |
| 1169 | memset(&subInd, 0, sizeof(BalSubscriberTerminalInd)); |
| 1170 | bal_subscriber_terminal_ind__init(&subInd); |
| 1171 | balIndCfg.terminal_ind = &subInd; |
| 1172 | |
| 1173 | BalObj hdr; |
| 1174 | memset(&hdr, 0, sizeof(BalObj)); |
| 1175 | bal_obj__init(&hdr); |
| 1176 | balIndCfg.terminal_ind->hdr = &hdr; |
| 1177 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1178 | BalSubscriberTerminalKey subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1179 | memset(&subkey, 0, sizeof(BalSubscriberTerminalKey)); |
| 1180 | bal_subscriber_terminal_key__init(&subkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1181 | balIndCfg.terminal_ind->key = &subkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1182 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1183 | balIndCfg.terminal_ind->key->has_intf_id = BAL_GRPC_PRES; |
| 1184 | balIndCfg.terminal_ind->key->intf_id = sub_ind->key.intf_id; |
| 1185 | balIndCfg.terminal_ind->key->has_sub_term_id = BAL_GRPC_PRES; |
| 1186 | balIndCfg.terminal_ind->key->sub_term_id = sub_ind->key.sub_term_id; |
| 1187 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1188 | BalSubscriberTerminalIndData subIndData; |
| 1189 | memset(&subIndData, 0, sizeof(BalSubscriberTerminalIndData)); |
| 1190 | bal_subscriber_terminal_ind_data__init(&subIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1191 | balIndCfg.terminal_ind->data = &subIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1192 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1193 | balIndCfg.terminal_ind->data->has_admin_state = BAL_GRPC_PRES; |
| 1194 | balIndCfg.terminal_ind->data->admin_state = sub_ind->data.admin_state; |
| 1195 | balIndCfg.terminal_ind->data->has_oper_status = BAL_GRPC_PRES; |
| 1196 | balIndCfg.terminal_ind->data->oper_status = sub_ind->data.oper_status; |
| 1197 | balIndCfg.terminal_ind->data->has_svc_port_id = BAL_GRPC_PRES; |
| 1198 | balIndCfg.terminal_ind->data->svc_port_id = sub_ind->data.svc_port_id; |
| 1199 | balIndCfg.terminal_ind->data->has_ds_tm = BAL_GRPC_PRES; |
| 1200 | balIndCfg.terminal_ind->data->ds_tm = sub_ind->data.ds_tm; |
| 1201 | balIndCfg.terminal_ind->data->has_us_tm = BAL_GRPC_PRES; |
| 1202 | balIndCfg.terminal_ind->data->us_tm = sub_ind->data.us_tm; |
| 1203 | balIndCfg.terminal_ind->data->has_sub_term_rate = BAL_GRPC_PRES; |
| 1204 | balIndCfg.terminal_ind->data->sub_term_rate = sub_ind->data.sub_term_rate; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1205 | char password[MAX_CHAR_LENGTH*2]; |
| 1206 | memset(&password, 0, MAX_CHAR_LENGTH*2); |
| 1207 | strcpy(password,(const char *)sub_ind->data.password.arr); |
| 1208 | balIndCfg.terminal_ind->data->password = password; |
| 1209 | char registration_id[MAX_CHAR_LENGTH*8]; |
| 1210 | memset(®istration_id, 0, MAX_CHAR_LENGTH*8); |
| 1211 | strcpy(registration_id,(const char *)sub_ind->data.registration_id.arr); |
| 1212 | balIndCfg.terminal_ind->data->registration_id = registration_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1213 | |
| 1214 | #if 0 |
| 1215 | balIndCfg.terminal_ind->data->has_mac_address = BAL_GRPC_PRES; |
| 1216 | balIndCfg.terminal_ind->data->mac_address.len = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1217 | (BCMOS_ETH_ALEN)*sizeof(sub_ind->data.mac_address.u8); |
| 1218 | uint8_t mac_address[balIndCfg.terminal_ind->data->mac_address.len]; |
| 1219 | memset(&mac_address, 0 ,balIndCfg.terminal_ind->data->mac_address.len); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1220 | strcpy((char *)mac_address,(const char *)sub_ind->data.mac_address.u8); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1221 | balIndCfg.terminal_ind->data->mac_address.data = mac_address; |
| 1222 | #endif |
| 1223 | |
| 1224 | BalSerialNumber serialNum; |
| 1225 | memset(&serialNum, 0, sizeof(BalSerialNumber)); |
| 1226 | bal_serial_number__init(&serialNum); |
| 1227 | balIndCfg.terminal_ind->data->serial_number = &serialNum; |
| 1228 | |
| 1229 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor id is %s\n", sub_ind->data.serial_number.vendor_id); |
| 1230 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:Before decoding:Vendor specific is %s\n", sub_ind->data.serial_number.vendor_specific); |
| 1231 | |
| 1232 | char vendor_id[MAX_CHAR_LENGTH]; |
| 1233 | memset(&vendor_id, 0, MAX_CHAR_LENGTH); |
| 1234 | sprintf(vendor_id,"%c%c%c%c", |
| 1235 | sub_ind->data.serial_number.vendor_id[0], |
| 1236 | sub_ind->data.serial_number.vendor_id[1], |
| 1237 | sub_ind->data.serial_number.vendor_id[2], |
| 1238 | sub_ind->data.serial_number.vendor_id[3]); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1239 | balIndCfg.terminal_ind->data->serial_number->vendor_id = vendor_id; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1240 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor id is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_id); |
| 1241 | char vendor_specific[MAX_CHAR_LENGTH]; |
| 1242 | memset(&vendor_specific, 0, MAX_CHAR_LENGTH); |
| 1243 | sprintf(vendor_specific,"%1X%1X%1X%1X%1X%1X%1X%1X", |
| 1244 | sub_ind->data.serial_number.vendor_specific[0]>>4 & 0x0f, |
| 1245 | sub_ind->data.serial_number.vendor_specific[0] & 0x0f, |
| 1246 | sub_ind->data.serial_number.vendor_specific[1]>>4 & 0x0f, |
| 1247 | sub_ind->data.serial_number.vendor_specific[1] & 0x0f, |
| 1248 | sub_ind->data.serial_number.vendor_specific[2]>>4 & 0x0f, |
| 1249 | sub_ind->data.serial_number.vendor_specific[2] & 0x0f, |
| 1250 | sub_ind->data.serial_number.vendor_specific[3]>>4 & 0x0f, |
| 1251 | sub_ind->data.serial_number.vendor_specific[3] & 0x0f); |
| 1252 | balIndCfg.terminal_ind->data->serial_number->vendor_specific = vendor_specific; |
| 1253 | ASFVOLT_LOG(ASFVOLT_ERROR, "ONU Activation:After decoding:Vendor specific is %s\n", balIndCfg.terminal_ind->data->serial_number->vendor_specific); |
| 1254 | |
| 1255 | BalIdList balAggportList; |
| 1256 | memset(&balAggportList, 0, sizeof(BalIdList)); |
| 1257 | bal_id_list__init(&balAggportList); |
| 1258 | balIndCfg.terminal_ind->data->agg_port_id_list = &balAggportList; |
| 1259 | |
| 1260 | #if 0 |
| 1261 | balIndCfg.terminal_ind->data->agg_port_id_list->n_val = sub_ind->data.agg_port_id_list.len; |
| 1262 | uint32_t agg_port_id_list[balIndCfg.terminal_ind->data->agg_port_id_list->n_val]; |
| 1263 | memset(&agg_port_id_list, 0, balIndCfg.terminal_ind->data->agg_port_id_list->n_val); |
| 1264 | strcpy((char *)agg_port_id_list,(const char *)sub_ind->data.agg_port_id_list.val); |
| 1265 | balIndCfg.terminal_ind->data->agg_port_id_list->val = agg_port_id_list; |
| 1266 | #endif |
| 1267 | |
| 1268 | BalErr *output; |
| 1269 | result = bal_ind__bal_subs_term_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1270 | } |
| 1271 | |
| 1272 | return result; |
| 1273 | } |
| 1274 | |
| 1275 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1276 | * Function : fill_bal_tm_red * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1277 | * Description : This function will fill grpc-BalTmred struture * |
| 1278 | * from bal-bcmbal_tm_red structure * |
| 1279 | * * |
| 1280 | ********************************************************************/ |
| 1281 | void fill_bal_tm_red(BalTmred *grpc_red, bcmbal_tm_red *bal_red) |
| 1282 | { |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1283 | grpc_red->has_min_threshold = BAL_GRPC_PRES; |
| 1284 | grpc_red->min_threshold = bal_red->min_threshold; |
| 1285 | grpc_red->has_max_threshold = BAL_GRPC_PRES; |
| 1286 | grpc_red->max_threshold = bal_red->max_threshold; |
| 1287 | grpc_red->has_max_probability = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1288 | grpc_red->max_probability = bal_red->max_probability; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1289 | return; |
| 1290 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1291 | |
| 1292 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1293 | * Function : bal_tm_queue_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1294 | * Description : This function will handle the indications for * |
| 1295 | * TM Queue indication * |
| 1296 | * * |
| 1297 | ********************************************************************/ |
| 1298 | bcmos_errno bal_tm_queue_indication_cb(bcmbal_obj *obj) |
| 1299 | { |
| 1300 | bcmos_errno result = BCM_ERR_OK; |
| 1301 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1302 | if(BCMBAL_OBJ_ID_TM_QUEUE != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1303 | bcmbal_tm_queue_auto_id_ind != obj->subgroup) |
| 1304 | { |
| 1305 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1306 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1307 | result = BCM_ERR_INTERNAL; |
| 1308 | } |
| 1309 | else |
| 1310 | { |
| 1311 | BalIndications balIndCfg; |
| 1312 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1313 | bal_indications__init(&balIndCfg); |
| 1314 | balIndCfg.u_case = BAL_INDICATIONS__U_TM_QUEUE__IND; |
| 1315 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1316 | balIndCfg.objtype = obj->obj_type; |
| 1317 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1318 | balIndCfg.sub_group = obj->subgroup; |
| 1319 | balIndCfg.device_id = voltha_device_id; |
| 1320 | |
| 1321 | bcmbal_tm_queue_ind *tm_que_ind = (bcmbal_tm_queue_ind *)obj; |
| 1322 | |
| 1323 | BalTmQueueInd tmQueInd; |
| 1324 | memset(&tmQueInd, 0, sizeof(BalTmQueueInd)); |
| 1325 | bal_tm_queue_ind__init(&tmQueInd); |
| 1326 | balIndCfg.tm_queue_ind = &tmQueInd; |
| 1327 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1328 | BalTmQueueKey tmQkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1329 | memset(&tmQkey, 0, sizeof(BalTmQueueKey)); |
| 1330 | bal_tm_queue_key__init(&tmQkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1331 | balIndCfg.tm_queue_ind->key = &tmQkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1332 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1333 | balIndCfg.tm_queue_ind->key->has_sched_id = BAL_GRPC_PRES; |
| 1334 | balIndCfg.tm_queue_ind->key->sched_id = tm_que_ind->key.sched_id; |
| 1335 | balIndCfg.tm_queue_ind->key->has_sched_dir = BAL_GRPC_PRES; |
| 1336 | balIndCfg.tm_queue_ind->key->sched_dir = tm_que_ind->key.sched_dir; |
| 1337 | balIndCfg.tm_queue_ind->key->has_id = BAL_GRPC_PRES; |
| 1338 | balIndCfg.tm_queue_ind->key->id = tm_que_ind->key.id; |
| 1339 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1340 | BalTmQueueIndData tmQIndData; |
| 1341 | memset(&tmQIndData, 0, sizeof(BalTmQueueIndData)); |
| 1342 | bal_tm_queue_ind_data__init(&tmQIndData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1343 | balIndCfg.tm_queue_ind->data = &tmQIndData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1344 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1345 | balIndCfg.tm_queue_ind->data->has_priority = BAL_GRPC_PRES; |
| 1346 | balIndCfg.tm_queue_ind->data->priority = tm_que_ind->data.priority; |
| 1347 | balIndCfg.tm_queue_ind->data->has_weight = BAL_GRPC_PRES; |
| 1348 | balIndCfg.tm_queue_ind->data->weight = tm_que_ind->data.weight; |
| 1349 | balIndCfg.tm_queue_ind->data->has_create_mode = BAL_GRPC_PRES; |
| 1350 | balIndCfg.tm_queue_ind->data->create_mode = tm_que_ind->data.create_mode; |
| 1351 | balIndCfg.tm_queue_ind->data->has_ref_count = BAL_GRPC_PRES; |
| 1352 | balIndCfg.tm_queue_ind->data->ref_count = tm_que_ind->data.ref_count; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1353 | |
| 1354 | BalTmShaping balShape; |
| 1355 | memset(&balShape, 0, sizeof(BalTmShaping)); |
| 1356 | bal_tm_shaping__init(&balShape); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1357 | balIndCfg.tm_queue_ind->data->rate = &balShape; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1358 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1359 | balIndCfg.tm_queue_ind->data->rate->has_presence_mask = BAL_GRPC_PRES; |
| 1360 | balIndCfg.tm_queue_ind->data->rate->presence_mask = tm_que_ind->data.rate.presence_mask; |
| 1361 | balIndCfg.tm_queue_ind->data->rate->has_cir = BAL_GRPC_PRES; |
| 1362 | balIndCfg.tm_queue_ind->data->rate->cir = tm_que_ind->data.rate.cir; |
| 1363 | balIndCfg.tm_queue_ind->data->rate->has_pir = BAL_GRPC_PRES; |
| 1364 | balIndCfg.tm_queue_ind->data->rate->pir = tm_que_ind->data.rate.pir; |
| 1365 | balIndCfg.tm_queue_ind->data->rate->has_burst = BAL_GRPC_PRES; |
| 1366 | balIndCfg.tm_queue_ind->data->rate->burst = tm_que_ind->data.rate.burst; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1367 | |
| 1368 | BalTmBac balBac; |
| 1369 | memset(&balBac, 0, sizeof(BalTmBac)); |
| 1370 | bal_tm_bac__init(&balBac); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1371 | balIndCfg.tm_queue_ind->data->bac = &balBac; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1372 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1373 | balIndCfg.tm_queue_ind->data->bac->has_type = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1374 | balIndCfg.tm_queue_ind->data->bac->type = tm_que_ind->data.bac.type; |
| 1375 | switch(tm_que_ind->data.bac.type) |
| 1376 | { |
| 1377 | case BCMBAL_TM_BAC_TYPE_TAILDROP: |
| 1378 | { |
| 1379 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_TAILDROP; |
| 1380 | BalTMBacTaildrop balTaildrop; |
| 1381 | memset(&balTaildrop, 0, sizeof(BalTMBacTaildrop)); |
| 1382 | bal_tmbac_taildrop__init(&balTaildrop); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1383 | balIndCfg.tm_queue_ind->data->bac->taildrop = &balTaildrop; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1384 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1385 | balIndCfg.tm_queue_ind->data->bac->taildrop->has_max_size = BAL_GRPC_PRES; |
| 1386 | balIndCfg.tm_queue_ind->data->bac->taildrop->max_size = |
| 1387 | tm_que_ind->data.bac.u.taildrop.max_size; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1388 | } |
| 1389 | break; |
| 1390 | case BCMBAL_TM_BAC_TYPE_WTAILDROP: |
| 1391 | { |
| 1392 | /* No bal/grpc structure was defined */ |
| 1393 | } |
| 1394 | break; |
| 1395 | case BCMBAL_TM_BAC_TYPE_RED: |
| 1396 | { |
| 1397 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_RED; |
| 1398 | BalTMBacRed balBacRed; |
| 1399 | memset(&balBacRed, 0, sizeof(BalTMBacRed)); |
| 1400 | bal_tmbac_red__init(&balBacRed); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1401 | balIndCfg.tm_queue_ind->data->bac->red = &balBacRed; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1402 | |
| 1403 | BalTmred balRed; |
| 1404 | memset(&balRed, 0, sizeof(BalTmred)); |
| 1405 | bal_tmred__init(&balRed); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1406 | balIndCfg.tm_queue_ind->data->bac->red->red = &balRed; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1407 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->red->red, &tm_que_ind->data.bac.u.red.red); |
| 1408 | } |
| 1409 | break; |
| 1410 | case BCMBAL_TM_BAC_TYPE_WRED: |
| 1411 | { |
| 1412 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U_WRED; |
| 1413 | BalTMBacWred balBacWred; |
| 1414 | memset(&balBacWred, 0, sizeof(BalTMBacWred)); |
| 1415 | bal_tmbac_wred__init(&balBacWred); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1416 | balIndCfg.tm_queue_ind->data->bac->wred = &balBacWred; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1417 | |
| 1418 | BalTmred balGreen; |
| 1419 | memset(&balGreen, 0, sizeof(BalTmred)); |
| 1420 | bal_tmred__init(&balGreen); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1421 | balIndCfg.tm_queue_ind->data->bac->wred->green = &balGreen; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1422 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->green, &tm_que_ind->data.bac.u.wred.green); |
| 1423 | |
| 1424 | BalTmred balYellow; |
| 1425 | memset(&balYellow, 0, sizeof(BalTmred)); |
| 1426 | bal_tmred__init(&balYellow); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1427 | balIndCfg.tm_queue_ind->data->bac->wred->yellow = &balYellow; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1428 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->yellow, &tm_que_ind->data.bac.u.wred.yellow); |
| 1429 | |
| 1430 | BalTmred balRed; |
| 1431 | memset(&balRed, 0, sizeof(BalTmred)); |
| 1432 | bal_tmred__init(&balRed); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1433 | balIndCfg.tm_queue_ind->data->bac->wred->red = &balRed; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1434 | fill_bal_tm_red(balIndCfg.tm_queue_ind->data->bac->wred->red, &tm_que_ind->data.bac.u.wred.red); |
| 1435 | } |
| 1436 | break; |
| 1437 | default: |
| 1438 | { |
| 1439 | balIndCfg.tm_queue_ind->data->bac->u_case = BAL_TM_BAC__U__NOT_SET; |
| 1440 | } |
| 1441 | break; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1442 | |
| 1443 | } |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1444 | |
| 1445 | BalErr *output; |
| 1446 | result = bal_ind__bal_tm_queue_ind_info(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1447 | } |
| 1448 | |
| 1449 | return result; |
| 1450 | } |
| 1451 | |
| 1452 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1453 | * Function : bal_tm_sched_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1454 | * Description : This function will handle the indications for * |
| 1455 | * TM Sched indication * |
| 1456 | * * |
| 1457 | ********************************************************************/ |
| 1458 | bcmos_errno bal_tm_sched_indication_cb(bcmbal_obj *obj) |
| 1459 | { |
| 1460 | bcmos_errno result = BCM_ERR_OK; |
| 1461 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1462 | if(BCMBAL_OBJ_ID_TM_SCHED != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1463 | bcmbal_tm_sched_auto_id_ind != obj->subgroup) |
| 1464 | { |
| 1465 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1466 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1467 | result = BCM_ERR_INTERNAL; |
| 1468 | } |
| 1469 | else |
| 1470 | { |
| 1471 | BalIndications balIndCfg; |
| 1472 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1473 | bal_indications__init(&balIndCfg); |
| 1474 | balIndCfg.u_case = BAL_INDICATIONS__U_TM_SCHED__IND; |
| 1475 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1476 | balIndCfg.objtype = obj->obj_type; |
| 1477 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1478 | balIndCfg.sub_group = obj->subgroup; |
| 1479 | balIndCfg.device_id = voltha_device_id; |
| 1480 | |
| 1481 | bcmbal_tm_sched_ind *tm_sched_ind = (bcmbal_tm_sched_ind *)obj; |
| 1482 | |
| 1483 | BalTmSchedInd tmSchedInd; |
| 1484 | memset(&tmSchedInd, 0, sizeof(BalTmSchedInd)); |
| 1485 | bal_tm_sched_ind__init(&tmSchedInd); |
| 1486 | balIndCfg.tm_sched_ind = &tmSchedInd; |
| 1487 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1488 | BalTmSchedKey tmSchedkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1489 | memset(&tmSchedkey, 0, sizeof(BalTmSchedKey)); |
| 1490 | bal_tm_sched_key__init(&tmSchedkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1491 | balIndCfg.tm_sched_ind->key = &tmSchedkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1492 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1493 | balIndCfg.tm_sched_ind->key->has_dir = BAL_GRPC_PRES; |
| 1494 | balIndCfg.tm_sched_ind->key->dir = tm_sched_ind->key.dir; |
| 1495 | balIndCfg.tm_sched_ind->key->has_id = BAL_GRPC_PRES; |
| 1496 | balIndCfg.tm_sched_ind->key->id = tm_sched_ind->key.id; |
| 1497 | |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1498 | BalTmSchedIndData tmSIndData; |
| 1499 | memset(&tmSIndData, 0, sizeof(BalTmSchedIndData)); |
| 1500 | bal_tm_sched_ind_data__init(&tmSIndData); |
| 1501 | balIndCfg.tm_sched_ind->data = &tmSIndData; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1502 | /* TODO: data should be populate */ |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1503 | |
| 1504 | BalErr *output; |
| 1505 | result = bal_ind__bal_tm_sched_ind_info(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1506 | } |
| 1507 | |
| 1508 | return result; |
| 1509 | } |
| 1510 | |
| 1511 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1512 | * Function : bal_packet_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1513 | * Description : This function will handle the indications for * |
| 1514 | * Packet Data indication * |
| 1515 | * * |
| 1516 | ********************************************************************/ |
| 1517 | bcmos_errno bal_packet_data_indication_cb(bcmbal_obj *obj) |
| 1518 | { |
| 1519 | bcmos_errno result = BCM_ERR_OK; |
| 1520 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1521 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1522 | bcmbal_packet_auto_id_bearer_channel_rx != obj->subgroup) |
| 1523 | { |
| 1524 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1525 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1526 | result = BCM_ERR_INTERNAL; |
| 1527 | } |
| 1528 | else |
| 1529 | { |
| 1530 | /*bcmos_mutex_lock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1531 | |
| 1532 | BalIndications balIndCfg; |
Rajeswara Rao | a3efbca | 2017-09-08 18:01:16 +0530 | [diff] [blame] | 1533 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1534 | bal_indications__init(&balIndCfg); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1535 | balIndCfg.u_case = BAL_INDICATIONS__U_PKT_DATA; |
| 1536 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1537 | balIndCfg.objtype = obj->obj_type; |
| 1538 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1539 | balIndCfg.sub_group = obj->subgroup; |
| 1540 | balIndCfg.device_id = voltha_device_id; |
| 1541 | |
| 1542 | BalPacketBearerChannelRx rxChannel; |
| 1543 | memset(&rxChannel, 0, sizeof(BalPacketBearerChannelRx)); |
| 1544 | bal_packet_bearer_channel_rx__init(&rxChannel); |
| 1545 | balIndCfg.pktdata = &rxChannel; |
| 1546 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1547 | BalObj hdr; |
| 1548 | memset(&hdr, 0, sizeof(BalObj)); |
| 1549 | bal_obj__init(&hdr); |
| 1550 | balIndCfg.pktdata->hdr = &hdr; |
| 1551 | |
| 1552 | BalPacketKey packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1553 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1554 | bal_packet_key__init(&packetkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1555 | balIndCfg.pktdata->key = &packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1556 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1557 | bcmbal_packet_bearer_channel_rx *rx_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1558 | (bcmbal_packet_bearer_channel_rx *)obj; |
| 1559 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1560 | balIndCfg.pktdata->key->has_reserved = BAL_GRPC_PRES; |
| 1561 | balIndCfg.pktdata->key->reserved = rx_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1562 | |
| 1563 | BalDest PktSndDest; |
| 1564 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1565 | bal_dest__init(&PktSndDest); |
| 1566 | balIndCfg.pktdata->key->packet_send_dest = &PktSndDest; |
| 1567 | |
| 1568 | balIndCfg.pktdata->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1569 | balIndCfg.pktdata->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1570 | rx_channel->key.packet_send_dest.type; |
| 1571 | switch( rx_channel->key.packet_send_dest.type) |
| 1572 | { |
| 1573 | case BCMBAL_DEST_TYPE_NNI: |
| 1574 | { |
| 1575 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_NNI; |
| 1576 | BalDestNni balNni; |
| 1577 | memset(&balNni, 0, sizeof(BalDestNni)); |
| 1578 | bal_dest_nni__init(&balNni); |
| 1579 | balIndCfg.pktdata->key->packet_send_dest->nni = &balNni; |
| 1580 | balIndCfg.pktdata->key->packet_send_dest->nni->has_intf_id = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1581 | balIndCfg.pktdata->key->packet_send_dest->nni->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1582 | rx_channel->key.packet_send_dest.u.nni.intf_id; |
| 1583 | } |
| 1584 | break; |
| 1585 | case BCMBAL_DEST_TYPE_SUB_TERM: |
| 1586 | { |
| 1587 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SUB_TERM; |
| 1588 | BalDestSubTerm balSubTerm; |
| 1589 | memset(&balSubTerm, 0, sizeof(BalDestSubTerm)); |
| 1590 | bal_dest_sub_term__init(&balSubTerm); |
| 1591 | balIndCfg.pktdata->key->packet_send_dest->sub_term = &balSubTerm; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1592 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1593 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1594 | balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1595 | rx_channel->key.packet_send_dest.u.sub_term.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1596 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_sub_term_uni = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1597 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1598 | balIndCfg.pktdata->key->packet_send_dest->sub_term->sub_term_uni = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1599 | rx_channel->key.packet_send_dest.u.sub_term.sub_term_uni; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1600 | balIndCfg.pktdata->key->packet_send_dest->sub_term->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1601 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1602 | balIndCfg.pktdata->key->packet_send_dest->sub_term->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1603 | rx_channel->key.packet_send_dest.u.sub_term.intf_id; |
| 1604 | } |
| 1605 | break; |
| 1606 | case BCMBAL_DEST_TYPE_SVC_PORT: |
| 1607 | { |
| 1608 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U_SVC_PORT; |
| 1609 | BalDestSvcPort balSvcPort; |
| 1610 | memset(&balSvcPort, 0, sizeof(BalDestSvcPort)); |
| 1611 | bal_dest_svc_port__init(&balSvcPort); |
| 1612 | balIndCfg.pktdata->key->packet_send_dest->svc_port = &balSvcPort; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1613 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_svc_port_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1614 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1615 | balIndCfg.pktdata->key->packet_send_dest->svc_port->svc_port_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1616 | rx_channel->key.packet_send_dest.u.svc_port.svc_port_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1617 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1618 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1619 | balIndCfg.pktdata->key->packet_send_dest->svc_port->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1620 | rx_channel->key.packet_send_dest.u.svc_port.intf_id; |
| 1621 | } |
| 1622 | break; |
| 1623 | default: |
| 1624 | { |
| 1625 | balIndCfg.pktdata->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1626 | } |
| 1627 | break; |
| 1628 | } |
| 1629 | |
| 1630 | BalPacketBearerChannelRxData pkdData; |
| 1631 | memset(&pkdData, 0, sizeof(BalPacketBearerChannelRxData)); |
| 1632 | bal_packet_bearer_channel_rx_data__init(&pkdData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1633 | balIndCfg.pktdata->data = &pkdData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1634 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1635 | balIndCfg.pktdata->data->has_flow_id = BAL_GRPC_PRES; |
| 1636 | balIndCfg.pktdata->data->flow_id = rx_channel->data.flow_id; |
| 1637 | balIndCfg.pktdata->data->has_flow_type = BAL_GRPC_PRES; |
| 1638 | balIndCfg.pktdata->data->flow_type = rx_channel->data.flow_type; |
| 1639 | balIndCfg.pktdata->data->has_intf_id = BAL_GRPC_PRES; |
| 1640 | balIndCfg.pktdata->data->intf_id = rx_channel->data.intf_id; |
| 1641 | balIndCfg.pktdata->data->has_intf_type = BAL_GRPC_PRES; |
| 1642 | balIndCfg.pktdata->data->intf_type = rx_channel->data.intf_type; |
| 1643 | balIndCfg.pktdata->data->has_svc_port = BAL_GRPC_PRES; |
| 1644 | balIndCfg.pktdata->data->svc_port = rx_channel->data.svc_port; |
| 1645 | balIndCfg.pktdata->data->has_flow_cookie = BAL_GRPC_PRES; |
| 1646 | balIndCfg.pktdata->data->flow_cookie = rx_channel->data.flow_cookie; |
| 1647 | balIndCfg.pktdata->data->has_pkt = BAL_GRPC_PRES; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1648 | balIndCfg.pktdata->data->pkt.len = rx_channel->data.pkt.len; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1649 | balIndCfg.pktdata->data->pkt.data = (uint8_t *)malloc((balIndCfg.pktdata->data->pkt.len)*sizeof(uint8_t)); |
| 1650 | 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] | 1651 | |
| 1652 | /*bcmos_mutex_unlock(&bal_ind_lock);-- Need to define bcm independent mutex*/ |
| 1653 | |
| 1654 | BalErr *output; |
| 1655 | result = bal_ind__bal_pkt_bearer_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1656 | } |
| 1657 | |
| 1658 | return result; |
| 1659 | } |
| 1660 | |
| 1661 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1662 | * Function : bal_omci_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1663 | * Description : This function will handle the indications for * |
| 1664 | * OMCI Data Response * |
| 1665 | * * |
| 1666 | ********************************************************************/ |
| 1667 | bcmos_errno bal_omci_data_indication_cb(bcmbal_obj *obj) |
| 1668 | { |
| 1669 | bcmos_errno result = BCM_ERR_OK; |
| 1670 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1671 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1672 | bcmbal_packet_auto_id_itu_omci_channel_rx != obj->subgroup) |
| 1673 | { |
| 1674 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1675 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1676 | result = BCM_ERR_INTERNAL; |
| 1677 | } |
| 1678 | else |
| 1679 | { |
| 1680 | ASFVOLT_LOG(ASFVOLT_DEBUG, "Received OMCI response via BAL APIs\n"); |
| 1681 | BalIndications balIndCfg; |
| 1682 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1683 | bal_indications__init(&balIndCfg); |
| 1684 | balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OMCI_RESP; |
| 1685 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1686 | balIndCfg.objtype = obj->obj_type; |
| 1687 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1688 | balIndCfg.sub_group = obj->subgroup; |
| 1689 | balIndCfg.device_id = voltha_device_id; |
| 1690 | |
| 1691 | BalPacketItuOmciChannelRx omciChannel; |
| 1692 | memset(&omciChannel, 0, sizeof(BalPacketItuOmciChannelRx)); |
| 1693 | bal_packet_itu_omci_channel_rx__init(&omciChannel); |
| 1694 | balIndCfg.balomciresp = &omciChannel; |
| 1695 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1696 | BalObj hdr; |
| 1697 | memset(&hdr, 0, sizeof(BalObj)); |
| 1698 | bal_obj__init(&hdr); |
| 1699 | balIndCfg.balomciresp->hdr = &hdr; |
| 1700 | |
| 1701 | BalPacketKey packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1702 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1703 | bal_packet_key__init(&packetkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1704 | balIndCfg.balomciresp->key = &packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1705 | |
| 1706 | BalPacketItuOmciChannelRxData omciData; |
| 1707 | memset(&omciData, 0, sizeof(BalPacketItuOmciChannelRxData)); |
| 1708 | bal_packet_itu_omci_channel_rx_data__init(&omciData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1709 | balIndCfg.balomciresp->data = &omciData; |
| 1710 | |
| 1711 | bcmbal_packet_itu_omci_channel_rx *omci_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1712 | (bcmbal_packet_itu_omci_channel_rx *)obj; |
| 1713 | |
| 1714 | balIndCfg.balomciresp->data->has_pkt = BAL_GRPC_PRES; |
| 1715 | balIndCfg.balomciresp->data->pkt.len = omci_channel->data.pkt.len; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1716 | balIndCfg.balomciresp->data->pkt.data = (uint8_t *)malloc((omci_channel->data.pkt.len)*sizeof(uint8_t)); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1717 | memcpy(balIndCfg.balomciresp->data->pkt.data, omci_channel->data.pkt.val, |
| 1718 | balIndCfg.balomciresp->data->pkt.len); |
| 1719 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1720 | balIndCfg.balomciresp->key->has_reserved = BAL_GRPC_PRES; |
| 1721 | balIndCfg.balomciresp->key->reserved = omci_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1722 | |
| 1723 | BalDest PktSndDest; |
| 1724 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1725 | bal_dest__init(&PktSndDest); |
| 1726 | balIndCfg.balomciresp->key->packet_send_dest = &PktSndDest; |
| 1727 | |
| 1728 | balIndCfg.balomciresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1729 | balIndCfg.balomciresp->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1730 | omci_channel->key.packet_send_dest.type; |
| 1731 | switch( omci_channel->key.packet_send_dest.type) |
| 1732 | { |
| 1733 | case BCMBAL_DEST_TYPE_ITU_OMCI_CHANNEL: |
| 1734 | { |
| 1735 | balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U_ITU_OMCI_CHANNEL; |
| 1736 | BalItuOmciChannel balOmci; |
| 1737 | memset(&balOmci, 0, sizeof(BalItuOmciChannel)); |
| 1738 | bal_itu_omci_channel__init(&balOmci); |
| 1739 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel = &balOmci; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1740 | 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] | 1741 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1742 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1743 | omci_channel->key.packet_send_dest.u.itu_omci_channel.sub_term_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1744 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1745 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1746 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1747 | omci_channel->key.packet_send_dest.u.itu_omci_channel.intf_id; |
| 1748 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n", |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1749 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1750 | } |
| 1751 | break; |
| 1752 | default: |
| 1753 | { |
| 1754 | balIndCfg.balomciresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1755 | } |
| 1756 | break; |
| 1757 | } |
| 1758 | |
| 1759 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response with %zd bytes is \n",balIndCfg.balomciresp->data->pkt.len); |
| 1760 | uint16_t idx; |
| 1761 | for(idx=0; idx<balIndCfg.balomciresp->data->pkt.len; idx++) |
| 1762 | { |
| 1763 | printf("%02x", balIndCfg.balomciresp->data->pkt.data[idx]); |
| 1764 | } |
| 1765 | printf("\n"); |
| 1766 | ASFVOLT_LOG(ASFVOLT_DEBUG, "OMCI Response for ONU id %d\n", |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1767 | balIndCfg.balomciresp->key->packet_send_dest->itu_omci_channel->sub_term_id); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1768 | BalErr *output; |
| 1769 | result = bal_ind__bal_pkt_omci_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1770 | } |
| 1771 | |
| 1772 | return result; |
| 1773 | } |
| 1774 | |
| 1775 | /********************************************************************\ |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1776 | * Function : bal_oam_data_indication_cb * |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1777 | * Description : This function will handle the indications for * |
| 1778 | * OAM Data Response * |
| 1779 | * * |
| 1780 | ********************************************************************/ |
| 1781 | bcmos_errno bal_oam_data_indication_cb(bcmbal_obj *obj) |
| 1782 | { |
| 1783 | bcmos_errno result = BCM_ERR_OK; |
| 1784 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1785 | if(BCMBAL_OBJ_ID_PACKET != obj->obj_type || |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1786 | bcmbal_packet_auto_id_ieee_oam_channel_rx != obj->subgroup) |
| 1787 | { |
| 1788 | ASFVOLT_LOG(ASFVOLT_ERROR, "Processing BAL API \'%s\' IND callback (status is %s)\n", |
| 1789 | bcmbal_objtype_str(obj->obj_type), bcmos_strerror(obj->status)); |
| 1790 | result = BCM_ERR_INTERNAL; |
| 1791 | } |
| 1792 | else |
| 1793 | { |
| 1794 | BalIndications balIndCfg; |
| 1795 | memset(&balIndCfg, 0, sizeof(BalIndications)); |
| 1796 | bal_indications__init(&balIndCfg); |
| 1797 | balIndCfg.u_case = BAL_INDICATIONS__U_BAL_OAM_RESP; |
| 1798 | balIndCfg.has_objtype = BAL_GRPC_PRES; |
| 1799 | balIndCfg.objtype = obj->obj_type; |
| 1800 | balIndCfg.has_sub_group = BAL_GRPC_PRES; |
| 1801 | balIndCfg.sub_group = obj->subgroup; |
| 1802 | balIndCfg.device_id = voltha_device_id; |
| 1803 | |
| 1804 | BalPacketIeeeOamChannelRx oamChannel; |
| 1805 | memset(&oamChannel, 0, sizeof(BalPacketIeeeOamChannelRx)); |
| 1806 | bal_packet_ieee_oam_channel_rx__init(&oamChannel); |
| 1807 | balIndCfg.baloamresp = &oamChannel; |
| 1808 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1809 | BalObj hdr; |
| 1810 | memset(&hdr, 0, sizeof(BalObj)); |
| 1811 | bal_obj__init(&hdr); |
| 1812 | balIndCfg.baloamresp->hdr = &hdr; |
| 1813 | |
| 1814 | BalPacketKey packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1815 | memset(&packetkey, 0, sizeof(BalPacketKey)); |
| 1816 | bal_packet_key__init(&packetkey); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1817 | balIndCfg.baloamresp->key = &packetkey; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1818 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1819 | bcmbal_packet_ieee_oam_channel_rx *oam_channel = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1820 | (bcmbal_packet_ieee_oam_channel_rx *)obj; |
| 1821 | |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1822 | balIndCfg.baloamresp->key->has_reserved = BAL_GRPC_PRES; |
| 1823 | balIndCfg.baloamresp->key->reserved = oam_channel->key.reserved; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1824 | |
| 1825 | BalDest PktSndDest; |
| 1826 | memset(&PktSndDest, 0, sizeof(BalDest)); |
| 1827 | bal_dest__init(&PktSndDest); |
| 1828 | balIndCfg.baloamresp->key->packet_send_dest = &PktSndDest; |
| 1829 | |
| 1830 | balIndCfg.baloamresp->key->packet_send_dest->has_type = BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1831 | balIndCfg.baloamresp->key->packet_send_dest->type = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1832 | oam_channel->key.packet_send_dest.type; |
| 1833 | switch( oam_channel->key.packet_send_dest.type) |
| 1834 | { |
| 1835 | case BCMBAL_DEST_TYPE_IEEE_OAM_CHANNEL: |
| 1836 | { |
| 1837 | balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U_IEEE_OAM_CHANNEL; |
| 1838 | BalIeeeOamChannel balOam; |
| 1839 | memset(&balOam, 0, sizeof(BalIeeeOamChannel)); |
| 1840 | bal_ieee_oam_channel__init(&balOam); |
| 1841 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel = &balOam; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1842 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1843 | BAL_GRPC_PRES; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1844 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->intf_id = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1845 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.intf_id; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1846 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->has_mac_address = BAL_GRPC_PRES; |
| 1847 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len = |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1848 | (BCMOS_ETH_ALEN)*sizeof(oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1849 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data = |
| 1850 | (uint8_t *)malloc((balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len)*sizeof(uint8_t)); |
| 1851 | memcpy(balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.data, |
| 1852 | oam_channel->key.packet_send_dest.u.ieee_oam_channel.mac_address.u8, |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1853 | balIndCfg.baloamresp->key->packet_send_dest->ieee_oam_channel->mac_address.len); |
| 1854 | |
| 1855 | } |
| 1856 | break; |
| 1857 | default: |
| 1858 | { |
| 1859 | balIndCfg.baloamresp->key->packet_send_dest->u_case = BAL_DEST__U__NOT_SET; |
| 1860 | } |
| 1861 | break; |
| 1862 | } |
| 1863 | |
| 1864 | BalPacketIeeeOamChannelRxData oamData; |
| 1865 | memset(&oamData, 0, sizeof(BalPacketIeeeOamChannelRxData)); |
| 1866 | bal_packet_ieee_oam_channel_rx_data__init(&oamData); |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1867 | balIndCfg.baloamresp->data = &oamData; |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1868 | |
| 1869 | balIndCfg.baloamresp->data->pkt.len = oam_channel->data.pkt.len; |
Rajeswara Rao | b2e441c | 2017-09-20 16:40:21 +0530 | [diff] [blame^] | 1870 | balIndCfg.baloamresp->data->pkt.data = (uint8_t *)malloc((balIndCfg.baloamresp->data->pkt.len)*sizeof(uint8_t)); |
Rajeswara Rao | f6b4e6c | 2017-08-31 17:26:27 +0530 | [diff] [blame] | 1871 | memcpy(balIndCfg.baloamresp->data->pkt.data, oam_channel->data.pkt.val, |
| 1872 | balIndCfg.baloamresp->data->pkt.len); |
| 1873 | |
| 1874 | BalErr *output; |
| 1875 | result = bal_ind__bal_pkt_ieee_oam_channel_rx_ind(client, NULL, &balIndCfg, &output, NULL, 0); |
| 1876 | |
| 1877 | } |
| 1878 | |
| 1879 | return result; |
| 1880 | } |