Exemple #1
0
int e1_reconfig_bts(struct gsm_bts *bts)
{
	struct gsm_e1_subslot *e1_link = &bts->oml_e1_link;
	struct e1inp_ts *sign_ts;
	struct e1inp_line *line;
	struct e1inp_sign_link *oml_link;
	struct gsm_bts_trx *trx;
	struct timespec tp;
	int rc;

	DEBUGP(DLMI, "e1_reconfig_bts(%u)\n", bts->nr);

	line = e1inp_line_find(e1_link->e1_nr);
	if (!line) {
		LOGP(DLINP, LOGL_ERROR, "BTS %u OML link referring to "
		     "non-existing E1 line %u\n", bts->nr, e1_link->e1_nr);
		return -ENOMEM;
	}

	if (!bts->model->e1line_bind_ops) {
		LOGP(DLINP, LOGL_ERROR, "no callback to bind E1 line operations\n");
		return -EINVAL;
	}
	if (!line->ops)
		bts->model->e1line_bind_ops(line);

	/* skip signal link initialization, this is done later for these BTS. */
	if (bts->type == GSM_BTS_TYPE_NANOBTS ||
	    bts->type == GSM_BTS_TYPE_OSMOBTS)
		return e1inp_line_update(line);

	/* OML link */
	if (!e1_link->e1_ts) {
		LOGP(DLINP, LOGL_ERROR, "BTS %u OML link without timeslot?\n",
		     bts->nr);
		return -EINVAL;
	}

	sign_ts = &line->ts[e1_link->e1_ts-1];
	e1inp_ts_config_sign(sign_ts, line);
	oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML,
					  bts->c0, bts->oml_tei, SAPI_OML);
	if (!oml_link) {
		LOGP(DLINP, LOGL_ERROR, "BTS %u OML link creation failed\n",
		     bts->nr);
		return -ENOMEM;
	}
	if (bts->oml_link)
		e1inp_sign_link_destroy(bts->oml_link);
	bts->oml_link = oml_link;
	rc = clock_gettime(CLOCK_MONOTONIC, &tp);
	bts->uptime = (rc < 0) ? 0 : tp.tv_sec; /* we don't need sub-second precision for uptime */

	llist_for_each_entry(trx, &bts->trx_list, list)
		e1_reconfig_trx(trx);

	/* notify E1 input something has changed */
	return e1inp_line_update(line);
}
Exemple #2
0
int link_reset_all(struct mtp_link_set *set)
{
	struct mtp_link *lnk;

	llist_for_each_entry(lnk, &set->links, entry)
		lnk->reset(lnk);
	return 0;
}
Exemple #3
0
int link_clear_all(struct mtp_link_set *set)
{
	struct mtp_link *lnk;

	llist_for_each_entry(lnk, &set->links, entry)
		lnk->clear_queue(lnk);
	return 0;
}
Exemple #4
0
int link_shutdown_all(struct mtp_link_set *set)
{
	struct mtp_link *lnk;

	llist_for_each_entry(lnk, &set->links, entry)
		lnk->shutdown(lnk);
	return 0;
}
Exemple #5
0
static int config_write_bsc(struct vty *vty)
{
	struct bsc_config *bsc;

	llist_for_each_entry(bsc, &_nat->bsc_configs, entry)
		config_write_bsc_single(vty, bsc);
	return CMD_SUCCESS;
}
Exemple #6
0
static void rate_ctr_timer_cb(void *data)
{
	struct rate_ctr_group *ctrg;

	/* Increment number of ticks before we calculate intervals,
	 * as a counter value of 0 would already wrap all counters */
	timer_ticks++;

	llist_for_each_entry(ctrg, &rate_ctr_groups, list)
		rate_ctr_group_intv(ctrg);

	bsc_schedule_timer(&rate_ctr_timer, 1, 0);
}
Exemple #7
0
/**
 * flush_smp_call_function_queue - Flush pending smp-call-function callbacks
 *
 * @warn_cpu_offline: If set to 'true', warn if callbacks were queued on an
 *		      offline CPU. Skip this check if set to 'false'.
 *
 * Flush any pending smp-call-function callbacks queued on this CPU. This is
 * invoked by the generic IPI handler, as well as by a CPU about to go offline,
 * to ensure that all pending IPI callbacks are run before it goes completely
 * offline.
 *
 * Loop through the call_single_queue and run all the queued callbacks.
 * Must be called with interrupts disabled.
 */
static void flush_smp_call_function_queue(bool warn_cpu_offline)
{
	struct llist_head *head;
	struct llist_node *entry;
	call_single_data_t *csd, *csd_next;
	static bool warned;

	lockdep_assert_irqs_disabled();

	head = this_cpu_ptr(&call_single_queue);
	entry = llist_del_all(head);
	entry = llist_reverse_order(entry);

	/* There shouldn't be any pending callbacks on an offline CPU. */
	if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) &&
		     !warned && !llist_empty(head))) {
		warned = true;
		WARN(1, "IPI on offline CPU %d\n", smp_processor_id());

		/*
		 * We don't have to use the _safe() variant here
		 * because we are not invoking the IPI handlers yet.
		 */
		llist_for_each_entry(csd, entry, llist)
			pr_warn("IPI callback %pS sent to offline CPU\n",
				csd->func);
	}

	llist_for_each_entry_safe(csd, csd_next, entry, llist) {
		smp_call_func_t func = csd->func;
		void *info = csd->info;

		/* Do we wait until *after* callback? */
		if (csd->flags & CSD_FLAG_SYNCHRONOUS) {
			func(info);
			csd_unlock(csd);
		} else {
			csd_unlock(csd);
			func(info);
		}
	}
Exemple #8
0
static int config_write_nat(struct vty *vty)
{
	struct bsc_msg_acc_lst *lst;
	struct bsc_nat_paging_group *pgroup;

	vty_out(vty, "nat%s", VTY_NEWLINE);
	vty_out(vty, " msc ip %s%s", _nat->main_dest->ip, VTY_NEWLINE);
	vty_out(vty, " msc port %d%s", _nat->main_dest->port, VTY_NEWLINE);
	vty_out(vty, " timeout auth %d%s", _nat->auth_timeout, VTY_NEWLINE);
	vty_out(vty, " timeout ping %d%s", _nat->ping_timeout, VTY_NEWLINE);
	vty_out(vty, " timeout pong %d%s", _nat->pong_timeout, VTY_NEWLINE);
	if (_nat->token)
		vty_out(vty, " token %s%s", _nat->token, VTY_NEWLINE);
	vty_out(vty, " ip-dscp %d%s", _nat->bsc_ip_dscp, VTY_NEWLINE);
	if (_nat->acc_lst_name)
		vty_out(vty, " access-list-name %s%s", _nat->acc_lst_name, VTY_NEWLINE);
	if (_nat->imsi_black_list_fn)
		vty_out(vty, " imsi-black-list-file-name %s%s",
			_nat->imsi_black_list_fn, VTY_NEWLINE);
	if (_nat->ussd_lst_name)
		vty_out(vty, " ussd-list-name %s%s", _nat->ussd_lst_name, VTY_NEWLINE);
	if (_nat->ussd_query)
		vty_out(vty, " ussd-query %s%s", _nat->ussd_query, VTY_NEWLINE);
	if (_nat->ussd_token)
		vty_out(vty, " ussd-token %s%s", _nat->ussd_token, VTY_NEWLINE);
	if (_nat->ussd_local)
		vty_out(vty, " ussd-local-ip %s%s", _nat->ussd_local, VTY_NEWLINE);

	if (_nat->num_rewr_name)
		vty_out(vty, " number-rewrite %s%s", _nat->num_rewr_name, VTY_NEWLINE);
	if (_nat->num_rewr_post_name)
		vty_out(vty, " number-rewrite-post %s%s",
			_nat->num_rewr_post_name, VTY_NEWLINE);

	if (_nat->smsc_rewr_name)
		vty_out(vty, " rewrite-smsc addr %s%s",
			_nat->smsc_rewr_name, VTY_NEWLINE);
	if (_nat->tpdest_match_name)
		vty_out(vty, " rewrite-smsc tp-dest-match %s%s",
			_nat->tpdest_match_name, VTY_NEWLINE);
	if (_nat->sms_clear_tp_srr_name)
		vty_out(vty, " sms-clear-tp-srr %s%s",
			_nat->sms_clear_tp_srr_name, VTY_NEWLINE);
	if (_nat->sms_num_rewr_name)
		vty_out(vty, " sms-number-rewrite %s%s",
			_nat->sms_num_rewr_name, VTY_NEWLINE);
	if (_nat->num_rewr_trie_name)
		vty_out(vty, " prefix-tree %s%s",
			_nat->num_rewr_trie_name, VTY_NEWLINE);

	llist_for_each_entry(lst, &_nat->access_lists, list)
		bsc_msg_acc_lst_write(vty, lst);
	llist_for_each_entry(pgroup, &_nat->paging_groups, entry)
		write_pgroup_lst(vty, pgroup);
	if (_nat->mgcp_ipa)
		vty_out(vty, " use-msc-ipa-for-mgcp%s", VTY_NEWLINE);
	vty_out(vty, " %ssdp-ensure-amr-mode-set%s",
		_nat->sdp_ensure_amr_mode_set ? "" : "no ", VTY_NEWLINE);

	return CMD_SUCCESS;
}
Exemple #9
0
static void dump_lac(struct vty *vty, struct llist_head *head)
{
	struct bsc_lac_entry *lac;
	llist_for_each_entry(lac, head, entry)
		vty_out(vty, "  location_area_code %u%s", lac->lac, VTY_NEWLINE);
}