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