[ipaccess-config] fix bugs in generating the PHYSICAL CONFIG attribute

... while asking the BTS to perform tests for us.  The length of the
ARFCN whitelist is the actual length in bytes, not the number of 16bit
ARFCN numbers.

Also, implement a limit, either by rxlevel or by number of ARFCN
that should end up in the whitelist.
This commit is contained in:
Harald Welte 2010-07-22 20:12:09 +02:00
parent e39a5912f1
commit c95cf10d08
4 changed files with 15 additions and 6 deletions

View File

@ -10,4 +10,7 @@ void ipac_nwl_init(void);
int ipac_nwl_test_start(struct gsm_bts_trx *trx, uint8_t testnr,
const uint8_t *phys_conf, unsigned int phys_conf_len);
int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev,
uint16_t max_num_arfcns);
#endif /* _OPENBSC_NWL_H */

View File

@ -1058,7 +1058,8 @@ int abis_nm_rcvmsg(struct msgb *msg)
if (oh->placement != ABIS_OM_PLACEMENT_ONLY) {
LOGP(DNM, LOGL_ERROR, "ABIS OML placement 0x%x not supported\n",
oh->placement);
return -EINVAL;
if (oh->placement != ABIS_OM_PLACEMENT_FIRST)
return -EINVAL;
}
if (oh->sequence != 0) {
LOGP(DNM, LOGL_ERROR, "ABIS OML sequence 0x%x != 0x00\n",

View File

@ -127,10 +127,10 @@ static uint16_t build_physconf(uint8_t *physconf_buf, const struct rxlev_stats *
/* Create whitelist from rxlevels */
physconf_buf[0] = phys_conf_min[0];
physconf_buf[1] = NM_IPAC_EIE_ARFCN_WHITE;
num_arfcn = ipac_rxlevstat2whitelist(whitelist, st);
num_arfcn = ipac_rxlevstat2whitelist(whitelist, st, 0, 100);
arfcnlist_size = num_arfcn * 2;
*((uint16_t *) (physconf_buf+2)) = htons(num_arfcn);
printf("pc_buf (%s)\n", hexdump(physconf_buf, arfcnlist_size+4));
*((uint16_t *) (physconf_buf+2)) = htons(arfcnlist_size);
DEBUGP(DNM, "physconf_buf (%s)\n", hexdump(physconf_buf, arfcnlist_size+4));
return arfcnlist_size+4;
}

View File

@ -40,18 +40,23 @@
#define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1)
int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st)
int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev,
uint16_t max_num_arfcns)
{
int i;
unsigned int num_arfcn = 0;
for (i = NUM_RXLEVS-1; i >= 0; i--) {
for (i = NUM_RXLEVS-1; i >= min_rxlev; i--) {
int16_t arfcn = -1;
while ((arfcn = rxlev_stat_get_next(st, i, arfcn)) >= 0) {
*buf++ = htons(arfcn);
num_arfcn++;
}
if (num_arfcn > max_num_arfcns)
break;
}
return num_arfcn;