mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-03 21:43:32 +00:00 
			
		
		
		
	lchan: Remember why a channel is broken using static strings
Remember why a channel is being marked as broken. So we can maybe understand what happend.
This commit is contained in:
		@@ -71,6 +71,7 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id,
 | 
				
			|||||||
			enum rsl_rel_mode release_mode);
 | 
								enum rsl_rel_mode release_mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int rsl_lchan_set_state(struct gsm_lchan *lchan, int);
 | 
					int rsl_lchan_set_state(struct gsm_lchan *lchan, int);
 | 
				
			||||||
 | 
					int rsl_lchan_mark_broken(struct gsm_lchan *lchan, const char *broken);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* to be provided by external code */
 | 
					/* to be provided by external code */
 | 
				
			||||||
int rsl_deact_sacch(struct gsm_lchan *lchan);
 | 
					int rsl_deact_sacch(struct gsm_lchan *lchan);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -195,6 +195,7 @@ struct gsm_lchan {
 | 
				
			|||||||
	enum lchan_csd_mode csd_mode;
 | 
						enum lchan_csd_mode csd_mode;
 | 
				
			||||||
	/* State */
 | 
						/* State */
 | 
				
			||||||
	enum gsm_lchan_state state;
 | 
						enum gsm_lchan_state state;
 | 
				
			||||||
 | 
						const char *broken_reason;
 | 
				
			||||||
	/* Power levels for MS and BTS */
 | 
						/* Power levels for MS and BTS */
 | 
				
			||||||
	uint8_t bs_power;
 | 
						uint8_t bs_power;
 | 
				
			||||||
	uint8_t ms_power;
 | 
						uint8_t ms_power;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -210,7 +210,7 @@ static void lchan_act_tmr_cb(void *data)
 | 
				
			|||||||
		"%s Timeout during activation. Marked as broken.\n",
 | 
							"%s Timeout during activation. Marked as broken.\n",
 | 
				
			||||||
		gsm_lchan_name(lchan));
 | 
							gsm_lchan_name(lchan));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rsl_lchan_set_state(lchan, LCHAN_S_BROKEN);
 | 
						rsl_lchan_mark_broken(lchan, "activation timeout");
 | 
				
			||||||
	lchan_free(lchan);
 | 
						lchan_free(lchan);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -222,7 +222,7 @@ static void lchan_deact_tmr_cb(void *data)
 | 
				
			|||||||
		"%s Timeout during deactivation! Marked as broken.\n",
 | 
							"%s Timeout during deactivation! Marked as broken.\n",
 | 
				
			||||||
		gsm_lchan_name(lchan));
 | 
							gsm_lchan_name(lchan));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rsl_lchan_set_state(lchan, LCHAN_S_BROKEN);
 | 
						rsl_lchan_mark_broken(lchan, "de-activation timeout");
 | 
				
			||||||
	lchan_free(lchan);
 | 
						lchan_free(lchan);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -943,6 +943,13 @@ int rsl_release_request(struct gsm_lchan *lchan, uint8_t link_id,
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int rsl_lchan_mark_broken(struct gsm_lchan *lchan, const char *reason)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						lchan->state = LCHAN_S_BROKEN;
 | 
				
			||||||
 | 
						lchan->broken_reason = reason;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int rsl_lchan_set_state(struct gsm_lchan *lchan, int state)
 | 
					int rsl_lchan_set_state(struct gsm_lchan *lchan, int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	lchan->state = state;
 | 
						lchan->state = state;
 | 
				
			||||||
@@ -1013,13 +1020,14 @@ static int rsl_rx_chan_act_nack(struct msgb *msg)
 | 
				
			|||||||
		print_rsl_cause(LOGL_ERROR, cause,
 | 
							print_rsl_cause(LOGL_ERROR, cause,
 | 
				
			||||||
				TLVP_LEN(&tp, RSL_IE_CAUSE));
 | 
									TLVP_LEN(&tp, RSL_IE_CAUSE));
 | 
				
			||||||
		msg->lchan->error_cause = *cause;
 | 
							msg->lchan->error_cause = *cause;
 | 
				
			||||||
		if (*cause != RSL_ERR_RCH_ALR_ACTV_ALLOC)
 | 
							if (*cause != RSL_ERR_RCH_ALR_ACTV_ALLOC) {
 | 
				
			||||||
			rsl_lchan_set_state(msg->lchan, LCHAN_S_BROKEN);
 | 
								rsl_lchan_mark_broken(msg->lchan, "NACK on activation");
 | 
				
			||||||
		else
 | 
							} else
 | 
				
			||||||
			rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
 | 
								rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else
 | 
						} else {
 | 
				
			||||||
		rsl_lchan_set_state(msg->lchan, LCHAN_S_BROKEN);
 | 
							rsl_lchan_mark_broken(msg->lchan, "NACK on activation no IE");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LOGPC(DRSL, LOGL_ERROR, "\n");
 | 
						LOGPC(DRSL, LOGL_ERROR, "\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -959,9 +959,12 @@ static void lchan_dump_full_vty(struct vty *vty, struct gsm_lchan *lchan)
 | 
				
			|||||||
	vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
 | 
						vty_out(vty, "BTS %u, TRX %u, Timeslot %u, Lchan %u: Type %s%s",
 | 
				
			||||||
		lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
 | 
							lchan->ts->trx->bts->nr, lchan->ts->trx->nr, lchan->ts->nr,
 | 
				
			||||||
		lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
 | 
							lchan->nr, gsm_lchant_name(lchan->type), VTY_NEWLINE);
 | 
				
			||||||
	vty_out(vty, "  Connection: %u, State: %s%s",
 | 
						vty_out(vty, "  Connection: %u, State: %s%s%s%s",
 | 
				
			||||||
		lchan->conn ? 1: 0,
 | 
							lchan->conn ? 1: 0,
 | 
				
			||||||
		gsm_lchans_name(lchan->state), VTY_NEWLINE);
 | 
							gsm_lchans_name(lchan->state),
 | 
				
			||||||
 | 
							lchan->state == LCHAN_S_BROKEN ? " Error reason: " : "",
 | 
				
			||||||
 | 
							lchan->state == LCHAN_S_BROKEN ? lchan->broken_reason : "",
 | 
				
			||||||
 | 
							VTY_NEWLINE);
 | 
				
			||||||
	vty_out(vty, "  BS Power: %u dBm, MS Power: %u dBm%s",
 | 
						vty_out(vty, "  BS Power: %u dBm, MS Power: %u dBm%s",
 | 
				
			||||||
		lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
 | 
							lchan->ts->trx->nominal_power - lchan->ts->trx->max_power_red
 | 
				
			||||||
		- lchan->bs_power*2,
 | 
							- lchan->bs_power*2,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -198,6 +198,8 @@ struct gsm_lchan *lchan_alloc(struct gsm_bts *bts, enum gsm_chan_t type,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		/* clear multi rate config */
 | 
							/* clear multi rate config */
 | 
				
			||||||
		memset(&lchan->mr_conf, 0, sizeof(lchan->mr_conf));
 | 
							memset(&lchan->mr_conf, 0, sizeof(lchan->mr_conf));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							lchan->broken_reason = "";
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		struct challoc_signal_data sig;
 | 
							struct challoc_signal_data sig;
 | 
				
			||||||
		sig.bts = bts;
 | 
							sig.bts = bts;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user