v5x_protocol: look-up user port only where needed (PSTN signaling)

... and add some more comments on the grouping of messages
This commit is contained in:
Harald Welte 2022-09-11 20:46:07 +02:00
parent 704336eb79
commit 5027a2ba43
1 changed files with 9 additions and 2 deletions

View File

@ -396,10 +396,9 @@ int v5x_rcv(struct v5x_instance *v5i, struct msgb *msg)
l3_addr = v51_l3_addr_dec(l3h->l3_addr);
/* look-up user port based on L3 addr? */
v5up = v5x_user_port_find(v5i, l3_addr);
switch (l3h->msg_type) {
/* PSTN signaling protocol */
case V51_CTRL_MSGT_ESTABLISH:
case V51_CTRL_MSGT_ESTABLISH_ACK:
case V51_CTRL_MSGT_SIGNAL:
@ -409,14 +408,20 @@ int v5x_rcv(struct v5x_instance *v5i, struct msgb *msg)
case V51_CTRL_MSGT_STATUS_ENQUIRY:
case V51_CTRL_MSGT_STATUS:
case V51_CTRL_MSGT_PROTOCOL_PARAMETER:
/* look-up user port based on L3 addr? */
v5up = v5x_user_port_find(v5i, l3_addr);
if (!v5up)
return -ENODEV;
rc = v51_rcv_pstn(v5up, msg, &tp);
break;
/* control protocol (Section 14 G.964) */
case V51_CTRL_MSGT_PORT_CTRL:
case V51_CTRL_MSGT_PORT_CTRL_ACK:
case V51_CTRL_MSGT_COMMON_CTRL:
case V51_CTRL_MSGT_COMMON_CTRL_ACK:
rc = v51_rcv_ctrl(v5i, msg, &tp);
break;
/* protection protocol (Section 18 G.965) */
case V52_CTRL_MSGT_PP_SWITCH_OVER_REQ:
case V52_CTRL_MSGT_PP_SWITCH_OVER_COM:
case V52_CTRL_MSGT_PP_OS_SWITCH_OVER_COM:
@ -427,6 +432,7 @@ int v5x_rcv(struct v5x_instance *v5i, struct msgb *msg)
case V52_CTRL_MSGT_PP_RESET_SN_ACK:
rc = v52_rcv_pp(v5i, msg, &tp);
break;
/* BCC protocol (Section 17 G.965) */
case V52_CTRL_MSGT_ALLOCATION:
case V52_CTRL_MSGT_ALLOCATION_COMPLETE:
case V52_CTRL_MSGT_ALLOCATION_REJECT:
@ -440,6 +446,7 @@ int v5x_rcv(struct v5x_instance *v5i, struct msgb *msg)
case V52_CTRL_MSGT_PROTOCOL_ERROR:
rc = v52_rcv_bcc(v5i, msg, &tp);
break;
/* Link control protocol (Section 16 G.965) */
case V52_CTRL_MSGT_LCP_LINK_CTRL:
case V52_CTRL_MSGT_LCP_LINK_CTRL_ACK:
rc = v52_rcv_lcp(v5i, msg, &tp);