OM2000: Move IS conn group list generation out of VTY code
This commit is contained in:
parent
af9b810419
commit
d529db6e50
|
@ -41,12 +41,21 @@ struct abis_om2k_mo {
|
|||
uint8_t inst;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* on-wire format for IS conn group */
|
||||
struct om2k_is_conn_grp {
|
||||
uint16_t icp1;
|
||||
uint16_t icp2;
|
||||
uint8_t cont_idx;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* internal data formant for IS conn group */
|
||||
struct is_conn_group {
|
||||
struct llist_head list;
|
||||
uint16_t icp1;
|
||||
uint16_t icp2;
|
||||
uint8_t ci;
|
||||
};
|
||||
|
||||
extern const struct value_string om2k_mo_class_short_vals[];
|
||||
|
||||
int abis_om2k_rcvmsg(struct msgb *msg);
|
||||
|
@ -63,8 +72,7 @@ int abis_om2k_tx_disable_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo)
|
|||
int abis_om2k_tx_test_req(struct gsm_bts *bts, const struct abis_om2k_mo *mo);
|
||||
int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
|
||||
uint8_t operational);
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
|
||||
unsigned int num_cg);
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_tf_conf_req(struct gsm_bts *bts);
|
||||
int abis_om2k_tx_rx_conf_req(struct gsm_bts_trx *trx);
|
||||
int abis_om2k_tx_tx_conf_req(struct gsm_bts_trx *trx);
|
||||
|
|
|
@ -954,11 +954,35 @@ int abis_om2k_tx_op_info(struct gsm_bts *bts, const struct abis_om2k_mo *mo,
|
|||
return abis_om2k_sendmsg(bts, msg);
|
||||
}
|
||||
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
|
||||
unsigned int num_cg )
|
||||
static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
|
||||
uint16_t icp2, uint8_t cont_idx)
|
||||
{
|
||||
grp->icp1 = htons(icp1);
|
||||
grp->icp2 = htons(icp2);
|
||||
grp->cont_idx = cont_idx;
|
||||
}
|
||||
|
||||
int abis_om2k_tx_is_conf_req(struct gsm_bts *bts)
|
||||
{
|
||||
struct msgb *msg = om2k_msgb_alloc();
|
||||
struct abis_om2k_hdr *o2k;
|
||||
struct is_conn_group *grp;
|
||||
unsigned int num_grps = 0, i = 0;
|
||||
struct om2k_is_conn_grp *cg;
|
||||
|
||||
/* count number of groups in linked list */
|
||||
llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
|
||||
num_grps++;
|
||||
|
||||
if (!num_grps)
|
||||
return -EINVAL;
|
||||
|
||||
/* allocate buffer for oml group array */
|
||||
cg = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps);
|
||||
|
||||
/* fill array with data from linked list */
|
||||
llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
|
||||
om2k_fill_is_conn_grp(&cg[i++], grp->icp1, grp->icp2, grp->ci);
|
||||
|
||||
o2k = (struct abis_om2k_hdr *) msgb_put(msg, sizeof(*o2k));
|
||||
fill_om2k_hdr(o2k, &om2k_mo_is, OM2K_MSGT_IS_CONF_REQ);
|
||||
|
@ -967,7 +991,9 @@ int abis_om2k_tx_is_conf_req(struct gsm_bts *bts, struct om2k_is_conn_grp *cg,
|
|||
msgb_tv_put(msg, OM2K_DEI_END_LIST_NR, 1);
|
||||
|
||||
msgb_tlv_put(msg, OM2K_DEI_IS_CONN_LIST,
|
||||
num_cg * sizeof(*cg), (uint8_t *)cg);
|
||||
num_grps * sizeof(*cg), (uint8_t *)cg);
|
||||
|
||||
talloc_free(cg);
|
||||
|
||||
return abis_om2k_sendmsg(bts, msg);
|
||||
}
|
||||
|
|
|
@ -324,21 +324,6 @@ DEFUN(om2k_con_list_tei, om2k_con_list_tei_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static void om2k_fill_is_conn_grp(struct om2k_is_conn_grp *grp, uint16_t icp1,
|
||||
uint16_t icp2, uint8_t cont_idx)
|
||||
{
|
||||
grp->icp1 = htons(icp1);
|
||||
grp->icp2 = htons(icp2);
|
||||
grp->cont_idx = cont_idx;
|
||||
}
|
||||
|
||||
struct is_conn_group {
|
||||
struct llist_head list;
|
||||
uint16_t icp1;
|
||||
uint16_t icp2;
|
||||
uint8_t ci;
|
||||
};
|
||||
|
||||
DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd,
|
||||
"is-connection-list (add|del) <0-2047> <0-2047> <0-255>",
|
||||
"Interface Switch Connnection List\n"
|
||||
|
@ -375,37 +360,6 @@ DEFUN(cfg_bts_is_conn_list, cfg_bts_is_conn_list_cmd,
|
|||
}
|
||||
|
||||
|
||||
static int is_conf_req(struct gsm_bts *bts, struct vty *vty)
|
||||
{
|
||||
struct is_conn_group *grp;
|
||||
unsigned int num_grps = 0, i = 0;
|
||||
struct om2k_is_conn_grp *o2grps;
|
||||
|
||||
/* count number of groups in linked list */
|
||||
llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
|
||||
num_grps++;
|
||||
|
||||
if (!num_grps) {
|
||||
vty_out(vty, "%% No IS connection groups configured!%s",
|
||||
VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
/* allocate buffer for oml group array */
|
||||
o2grps = talloc_zero_array(bts, struct om2k_is_conn_grp, num_grps);
|
||||
|
||||
/* fill array with data from linked list */
|
||||
llist_for_each_entry(grp, &bts->rbs2000.is.conn_groups, list)
|
||||
om2k_fill_is_conn_grp(&o2grps[i++], grp->icp1, grp->icp2, grp->ci);
|
||||
|
||||
/* send the actual OML request */
|
||||
abis_om2k_tx_is_conf_req(bts, o2grps, num_grps);
|
||||
|
||||
talloc_free(o2grps);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(om2k_conf_req, om2k_conf_req_cmd,
|
||||
"configuration-request",
|
||||
"Send the configuration request for current MO\n")
|
||||
|
@ -417,7 +371,7 @@ DEFUN(om2k_conf_req, om2k_conf_req_cmd,
|
|||
|
||||
switch (oms->mo.class) {
|
||||
case OM2K_MO_CLS_IS:
|
||||
return is_conf_req(bts, vty);
|
||||
abis_om2k_tx_is_conf_req(bts);
|
||||
break;
|
||||
case OM2K_MO_CLS_TS:
|
||||
trx = gsm_bts_trx_by_nr(bts, oms->mo.assoc_so);
|
||||
|
|
Loading…
Reference in New Issue