lapdm: cosmetic: simplify lapdm_phsap_up(), use OSMO_PRIM[_HDR]

Change-Id: I87dedca0a38f290ae56649373dc9172433b8e4b1
Related: OS#3626
This commit is contained in:
Vadim Yanitskiy 2023-06-23 15:32:15 +07:00 committed by fixeria
parent fadda01f44
commit 9ec7749f01
1 changed files with 13 additions and 36 deletions

View File

@ -909,56 +909,33 @@ int lapdm_phsap_up(struct osmo_prim_hdr *oph, struct lapdm_entity *le)
if (oph->sap != SAP_GSM_PH) { if (oph->sap != SAP_GSM_PH) {
LOGP(DLLAPD, LOGL_ERROR, "primitive for unknown SAP %u\n", LOGP(DLLAPD, LOGL_ERROR, "primitive for unknown SAP %u\n",
oph->sap); oph->sap);
rc = -ENODEV; msgb_free(oph->msg);
goto free; return -ENODEV;
} }
switch (oph->primitive) { switch (OSMO_PRIM_HDR(oph)) {
case PRIM_PH_DATA: case OSMO_PRIM(PRIM_PH_DATA, PRIM_OP_INDICATION):
if (oph->operation != PRIM_OP_INDICATION) {
LOGP(DLLAPD, LOGL_ERROR, "PH_DATA is not INDICATION %u\n",
oph->operation);
rc = -ENODEV;
goto free;
}
rc = l2_ph_data_ind(oph->msg, le, pp->u.data.chan_nr, rc = l2_ph_data_ind(oph->msg, le, pp->u.data.chan_nr,
pp->u.data.link_id); pp->u.data.link_id);
break; break;
case PRIM_PH_RTS: case OSMO_PRIM(PRIM_PH_RTS, PRIM_OP_INDICATION):
if (oph->operation != PRIM_OP_INDICATION) {
LOGP(DLLAPD, LOGL_ERROR, "PH_RTS is not INDICATION %u\n",
oph->operation);
rc = -ENODEV;
goto free;
}
rc = l2_ph_data_conf(oph->msg, le); rc = l2_ph_data_conf(oph->msg, le);
break; break;
case PRIM_PH_RACH: case OSMO_PRIM(PRIM_PH_RACH, PRIM_OP_INDICATION):
switch (oph->operation) { rc = l2_ph_rach_ind(le, pp->u.rach_ind.ra, pp->u.rach_ind.fn,
case PRIM_OP_INDICATION: pp->u.rach_ind.acc_delay);
rc = l2_ph_rach_ind(le, pp->u.rach_ind.ra, pp->u.rach_ind.fn, break;
pp->u.rach_ind.acc_delay); case OSMO_PRIM(PRIM_PH_RACH, PRIM_OP_CONFIRM):
break; rc = l2_ph_chan_conf(oph->msg, le, pp->u.rach_ind.fn);
case PRIM_OP_CONFIRM:
rc = l2_ph_chan_conf(oph->msg, le, pp->u.rach_ind.fn);
break;
default:
rc = -EIO;
goto free;
}
break; break;
default: default:
LOGP(DLLAPD, LOGL_ERROR, "Unknown primitive %u\n", LOGP(DLLAPD, LOGL_ERROR, "Unknown primitive %u\n",
oph->primitive); oph->primitive);
rc = -EINVAL; msgb_free(oph->msg);
goto free; return -EINVAL;
} }
return rc; return rc;
free:
msgb_free(oph->msg);
return rc;
} }