Send to E1, only if layer 1 is active

This prevents filling the TX queue inside libosmo-abis.
This commit is contained in:
Andreas Eversberg 2023-02-21 07:17:58 +01:00
parent bd2aae0f2b
commit c9f0c33587
3 changed files with 25 additions and 0 deletions

View File

@ -243,6 +243,12 @@ int ph_data_req_hdlc(struct msgb *msg, struct v5x_interface *v5if)
return 0;
}
if (!v5x_l1_is_up(v5if->cc_link->l1)) {
LOGP(DLINP, LOGL_DEBUG, "Link %d is down!\n", v5if->cc_link->id);
msgb_free(msg);
return 0;
}
LOGP(DLINP, LOGL_DEBUG, "Link %d L2->L1: %s\n", v5if->cc_link->id, msgb_hexdump(msg));
struct e1inp_ts *ts = &e1_line->ts[v5if->cc_link->c_channel[0].ts->nr - 1];
@ -267,6 +273,12 @@ int ph_data_req_dl_cc(struct msgb *msg, void *cbdata)
return 0;
}
if (!v5x_l1_is_up(v5if->cc_link->l1)) {
LOGP(DLINP, LOGL_DEBUG, "Link %d is down!\n", v5if->cc_link->id);
msgb_free(msg);
return 0;
}
struct e1inp_ts *ts = &e1_line->ts[v5if->cc_link->c_channel[0].ts->nr - 1];
/* add frame relay header */
@ -296,6 +308,12 @@ int ph_data_req_dl_prot(struct msgb *msg, void *cbdata)
return 0;
}
if (!v5x_l1_is_up(v5l->l1)) {
LOGP(DLINP, LOGL_DEBUG, "Link %d is down!\n", v5l->id);
msgb_free(msg);
return 0;
}
struct e1inp_ts *ts = &e1_line->ts[v5l->c_channel[0].ts->nr - 1];
/* add frame relay header */

View File

@ -616,6 +616,12 @@ void v5x_l1_init(void)
LOGP(DV5L1, LOGL_NOTICE, "Using V5x L1 protocol\n");
}
bool v5x_l1_is_up(struct v5x_l1_proto *l1)
{
return l1->fi->state == V5X_L1FSM_S_ANLE1_NORMAL
|| l1->fi->state == V5X_L1FSM_S_ANLE51_LINK_ID_SENDING
|| l1->fi->state == V5X_L1FSM_S_ANLE52_LINK_ID_RECEIVED;
}
/***********************************************************************
* Messages from other layers

View File

@ -3,5 +3,6 @@ void v5x_l1_mph_snd(struct v5x_link *v5i, enum v5x_mph_prim prim);
struct v5x_l1_proto *v5x_l1_fsm_create(void *ctx, struct v5x_link *v5l, uint8_t id);
void v5x_l1_fsm_destroy(struct v5x_l1_proto *l1);
void v5x_l1_init(void);
bool v5x_l1_is_up(struct v5x_l1_proto *l1);
int v5x_l1_signal_rcv(struct v5x_link *v5i, enum l1_signal_prim prim);
int v5x_l1_signal_snd(struct v5x_link *v5i, enum l1_signal_prim prim);