osmo-bts-trx: cosmetic: TRXD 'header version' -> 'PDU version'
TRXDv2 brings significant changes to the whole PDU structure, not just the header. Let's highlight this in the code / strings. Change-Id: Id0274bd1ae5c419548596ed1852e6a28ec62b713 Related: SYS#4895, OS#4941, OS#4006
This commit is contained in:
parent
0b33ab8ac2
commit
32ef94cac0
|
@ -48,7 +48,7 @@ struct phy_link {
|
|||
uint32_t clock_advance;
|
||||
uint32_t rts_advance;
|
||||
bool use_legacy_setbsic;
|
||||
uint8_t trxd_hdr_ver_max; /* Maximum TRXD header version to negotiate */
|
||||
uint8_t trxd_pdu_ver_max; /* Maximum TRXD PDU version to negotiate */
|
||||
bool powered; /* last POWERON (true) or POWEROFF (false) confirmed */
|
||||
bool poweronoff_sent; /* is there a POWERON/POWEROFF in transit? (one or the other based on ->powered) */
|
||||
} osmotrx;
|
||||
|
|
|
@ -60,8 +60,8 @@ struct bts_trx_priv {
|
|||
};
|
||||
|
||||
struct trx_config {
|
||||
uint8_t trxd_hdr_ver_req; /* requested TRXD header version */
|
||||
uint8_t trxd_hdr_ver_use; /* actual TRXD header version in use */
|
||||
uint8_t trxd_pdu_ver_req; /* requested TRXD PDU version */
|
||||
uint8_t trxd_pdu_ver_use; /* actual TRXD PDU version in use */
|
||||
bool setformat_sent;
|
||||
bool setformat_acked;
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ void bts_model_phy_link_set_defaults(struct phy_link *plink)
|
|||
plink->u.osmotrx.clock_advance = 2;
|
||||
plink->u.osmotrx.rts_advance = 3;
|
||||
/* attempt use newest TRXD version by default: */
|
||||
plink->u.osmotrx.trxd_hdr_ver_max = TRX_DATA_FORMAT_VER;
|
||||
plink->u.osmotrx.trxd_pdu_ver_max = TRX_DATA_PDU_VER;
|
||||
}
|
||||
|
||||
void bts_model_phy_instance_set_defaults(struct phy_instance *pinst)
|
||||
|
|
|
@ -275,11 +275,11 @@ int trx_if_cmd_poweron(struct trx_l1h *l1h, trx_if_cmd_poweronoff_cb *cb)
|
|||
return trx_ctrl_cmd_cb(l1h, 1, cb, "POWERON", "");
|
||||
}
|
||||
|
||||
/*! Send "SETFORMAT" command to TRX: change TRXD header format version */
|
||||
/*! Send "SETFORMAT" command to TRX: change TRXD PDU version */
|
||||
int trx_if_cmd_setformat(struct trx_l1h *l1h, uint8_t ver, trx_if_cmd_generic_cb *cb)
|
||||
{
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO,
|
||||
"Requesting TRXD header format version %u\n", ver);
|
||||
"Requesting TRXD PDU version %u\n", ver);
|
||||
|
||||
return trx_ctrl_cmd_cb(l1h, 0, cb, "SETFORMAT", "%u", ver);
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ static int trx_ctrl_rx_rsp_setslot(struct trx_l1h *l1h, struct trx_ctrl_rsp *rsp
|
|||
return rsp->status == 0 ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
/* TRXD header format negotiation handler.
|
||||
/* TRXD PDU format negotiation handler.
|
||||
*
|
||||
* If the transceiver does not support the format negotiation, it would
|
||||
* reject SETFORMAT with 'RSP ERR 1'. If the requested version is not
|
||||
|
@ -526,7 +526,7 @@ static int trx_ctrl_rx_rsp_setformat(struct trx_l1h *l1h,
|
|||
if (strcmp(rsp->cmd, "SETFORMAT") != 0) {
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_NOTICE,
|
||||
"Transceiver rejected the format negotiation command, "
|
||||
"using legacy TRXD header format version (0)\n");
|
||||
"using legacy TRXD PDU version (0)\n");
|
||||
if (rsp->cb) {
|
||||
cb = (trx_if_cmd_generic_cb*) rsp->cb;
|
||||
cb(l1h, 0);
|
||||
|
@ -535,11 +535,11 @@ static int trx_ctrl_rx_rsp_setformat(struct trx_l1h *l1h,
|
|||
}
|
||||
|
||||
/* Status shall indicate a proper version supported by the transceiver */
|
||||
if (rsp->status < 0 || rsp->status > l1h->config.trxd_hdr_ver_req) {
|
||||
if (rsp->status < 0 || rsp->status > l1h->config.trxd_pdu_ver_req) {
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
|
||||
"Transceiver indicated an out of range "
|
||||
"header format version %d (requested %u)\n",
|
||||
rsp->status, l1h->config.trxd_hdr_ver_req);
|
||||
"PDU version %d (requested %u)\n",
|
||||
rsp->status, l1h->config.trxd_pdu_ver_req);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -814,7 +814,7 @@ skip_mts:
|
|||
return TRX_UL_V1HDR_LEN;
|
||||
}
|
||||
|
||||
/* TRXD burst handler for header version 0 */
|
||||
/* TRXD burst handler for PDU version 0 */
|
||||
static int trx_data_handle_burst_v0(struct trx_l1h *l1h,
|
||||
struct trx_ul_burst_ind *bi,
|
||||
const uint8_t *buf, size_t buf_len)
|
||||
|
@ -850,7 +850,7 @@ static int trx_data_handle_burst_v0(struct trx_l1h *l1h,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* TRXD burst handler for header version 1 */
|
||||
/* TRXD burst handler for PDU version 1 */
|
||||
static int trx_data_handle_burst_v1(struct trx_l1h *l1h,
|
||||
struct trx_ul_burst_ind *bi,
|
||||
const uint8_t *buf, size_t buf_len)
|
||||
|
@ -869,7 +869,7 @@ static int trx_data_handle_burst_v1(struct trx_l1h *l1h,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The burst format is the same as for version 0.
|
||||
/* The PDU format is the same as for version 0.
|
||||
* NOTE: other modulation types to be handled separately. */
|
||||
return trx_data_handle_burst_v0(l1h, bi, buf, buf_len);
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ static const char *trx_data_desc_msg(const struct trx_ul_burst_ind *bi)
|
|||
* +-----------------+------------------------+
|
||||
* | 7 6 5 4 3 2 1 0 | bit numbers |
|
||||
* +-----------------+------------------------+
|
||||
* | X X X X . . . . | header version (0..15) |
|
||||
* | X X X X . . . . | PDU version (0..15) |
|
||||
* +-----------------+------------------------+
|
||||
* | . . . . . X X X | TDMA TN (0..7) |
|
||||
* +-----------------+------------------------+
|
||||
|
@ -1040,7 +1040,7 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
uint8_t buf[TRX_DATA_MSG_MAX_LEN];
|
||||
struct trx_ul_burst_ind bi;
|
||||
ssize_t hdr_len, buf_len;
|
||||
uint8_t hdr_ver;
|
||||
uint8_t pdu_ver;
|
||||
int rc;
|
||||
|
||||
buf_len = recv(ofd->fd, buf, sizeof(buf), 0);
|
||||
|
@ -1054,9 +1054,9 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
/* Pre-clean (initialize) the flags */
|
||||
bi.flags = 0x00;
|
||||
|
||||
/* Parse the header depending on its version */
|
||||
hdr_ver = buf[0] >> 4;
|
||||
switch (hdr_ver) {
|
||||
/* Parse header depending on the PDU version */
|
||||
pdu_ver = buf[0] >> 4;
|
||||
switch (pdu_ver) {
|
||||
case 0:
|
||||
/* Legacy protocol has no version indicator */
|
||||
hdr_len = trx_data_handle_hdr_v0(l1h, &bi, buf, buf_len);
|
||||
|
@ -1066,7 +1066,7 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
break;
|
||||
default:
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
|
||||
"TRXD header version %u is not supported\n", hdr_ver);
|
||||
"TRXD PDU version %u is not supported\n", pdu_ver);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
buf_len -= hdr_len;
|
||||
|
||||
/* Handle burst bits */
|
||||
switch (hdr_ver) {
|
||||
switch (pdu_ver) {
|
||||
case 0:
|
||||
rc = trx_data_handle_burst_v0(l1h, &bi, buf + hdr_len, buf_len);
|
||||
break;
|
||||
|
@ -1101,9 +1101,9 @@ static int trx_data_read_cb(struct osmo_fd *ofd, unsigned int what)
|
|||
|
||||
skip_burst:
|
||||
/* Print header & burst info */
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "Rx %s (hdr_ver=%u): %s\n",
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "Rx %s (pdu_ver=%u): %s\n",
|
||||
(bi.flags & TRX_BI_F_NOPE_IND) ? "NOPE.ind" : "UL burst",
|
||||
hdr_ver, trx_data_desc_msg(&bi));
|
||||
pdu_ver, trx_data_desc_msg(&bi));
|
||||
|
||||
/* feed received burst into scheduler code */
|
||||
trx_sched_route_burst_ind(&bi, &l1h->l1s);
|
||||
|
@ -1118,7 +1118,7 @@ skip_burst:
|
|||
int trx_if_send_burst(struct trx_l1h *l1h, const struct trx_dl_burst_req *br)
|
||||
{
|
||||
ssize_t snd_len;
|
||||
uint8_t hdr_ver = l1h->config.trxd_hdr_ver_use;
|
||||
uint8_t pdu_ver = l1h->config.trxd_pdu_ver_use;
|
||||
uint8_t buf[TRX_DATA_MSG_MAX_LEN];
|
||||
|
||||
if ((br->burst_len != GSM_BURST_LEN) && (br->burst_len != EGPRS_BURST_LEN)) {
|
||||
|
@ -1128,22 +1128,22 @@ int trx_if_send_burst(struct trx_l1h *l1h, const struct trx_dl_burst_req *br)
|
|||
}
|
||||
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG,
|
||||
"Tx burst (hdr_ver=%u): tn=%u fn=%u att=%u\n",
|
||||
hdr_ver, br->tn, br->fn, br->att);
|
||||
"Tx burst (pdu_ver=%u): tn=%u fn=%u att=%u\n",
|
||||
pdu_ver, br->tn, br->fn, br->att);
|
||||
|
||||
switch (hdr_ver) {
|
||||
switch (pdu_ver) {
|
||||
case 0:
|
||||
case 1:
|
||||
/* Both versions have the same header format */
|
||||
/* Both versions have the same PDU format */
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
|
||||
"Requested TRXD header version %u is not supported\n", hdr_ver);
|
||||
"Requested TRXD PDU version %u is not supported\n", pdu_ver);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
buf[0] = ((hdr_ver & 0x0f) << 4) | br->tn;
|
||||
buf[0] = ((pdu_ver & 0x0f) << 4) | br->tn;
|
||||
osmo_store32be(br->fn, buf + 1);
|
||||
buf[5] = br->att;
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ int trx_if_cmd_rfmute(struct trx_l1h *l1h, bool mute);
|
|||
int trx_if_send_burst(struct trx_l1h *l1h, const struct trx_dl_burst_req *br);
|
||||
int trx_if_powered(struct trx_l1h *l1h);
|
||||
|
||||
/* The latest supported TRXD header format version */
|
||||
#define TRX_DATA_FORMAT_VER 1
|
||||
/* The latest supported TRXD PDU version */
|
||||
#define TRX_DATA_PDU_VER 1
|
||||
|
||||
/* Format negotiation command */
|
||||
int trx_if_cmd_setformat(struct trx_l1h *l1h, uint8_t ver, trx_if_cmd_generic_cb *cb);
|
||||
|
|
|
@ -148,16 +148,16 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
|
|||
l1h->config.bsic_acked = false;
|
||||
}
|
||||
|
||||
/* Ask transceiver to use the newest TRXD header version if not using it yet */
|
||||
/* Ask transceiver to use the newest TRXD PDU version if not using it yet */
|
||||
if (!l1h->config.setformat_sent) {
|
||||
l1h->config.setformat_sent = true;
|
||||
if (plink->u.osmotrx.trxd_hdr_ver_max == 0) {
|
||||
if (plink->u.osmotrx.trxd_pdu_ver_max == 0) {
|
||||
LOGPPHI(pinst, DL1C, LOGL_INFO,
|
||||
"No need to negotiate max TRXD version 0");
|
||||
l1h->config.trxd_hdr_ver_use = 0;
|
||||
l1h->config.trxd_pdu_ver_use = 0;
|
||||
l1h->config.setformat_acked = true;
|
||||
} else {
|
||||
trx_if_cmd_setformat(l1h, l1h->config.trxd_hdr_ver_req, l1if_setformat_cb);
|
||||
trx_if_cmd_setformat(l1h, l1h->config.trxd_pdu_ver_req, l1if_setformat_cb);
|
||||
l1h->config.setformat_acked = false;
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ static void st_open_poweroff_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_st
|
|||
struct trx_l1h *l1h = (struct trx_l1h *)fi->priv;
|
||||
struct phy_instance *pinst = l1h->phy_inst;
|
||||
|
||||
l1h->config.trxd_hdr_ver_req = pinst->phy_link->u.osmotrx.trxd_hdr_ver_max;
|
||||
l1h->config.trxd_pdu_ver_req = pinst->phy_link->u.osmotrx.trxd_pdu_ver_max;
|
||||
|
||||
/* Apply initial RFMUTE state */
|
||||
trx_if_cmd_rfmute(l1h, pinst->trx->mo.nm_state.administrative != NM_STATE_UNLOCKED);
|
||||
|
@ -354,18 +354,18 @@ static void st_open_poweroff(struct osmo_fsm_inst *fi, uint32_t event, void *dat
|
|||
case TRX_PROV_EV_SETFORMAT_CNF:
|
||||
status = (int)(intptr_t)data;
|
||||
/* Transceiver may suggest a lower version (than requested) */
|
||||
if (status == l1h->config.trxd_hdr_ver_req) {
|
||||
l1h->config.trxd_hdr_ver_use = status;
|
||||
if (status == l1h->config.trxd_pdu_ver_req) {
|
||||
l1h->config.trxd_pdu_ver_use = status;
|
||||
l1h->config.setformat_acked = true;
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO,
|
||||
"Using TRXD header format version %u\n",
|
||||
l1h->config.trxd_hdr_ver_use);
|
||||
"Using TRXD PDU version %u\n",
|
||||
l1h->config.trxd_pdu_ver_use);
|
||||
} else {
|
||||
LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG,
|
||||
"Transceiver suggests TRXD header version %u (requested %u)\n",
|
||||
status, l1h->config.trxd_hdr_ver_req);
|
||||
"Transceiver suggests TRXD PDU version %u (requested %u)\n",
|
||||
status, l1h->config.trxd_pdu_ver_req);
|
||||
/* Send another SETFORMAT with suggested version */
|
||||
l1h->config.trxd_hdr_ver_req = status;
|
||||
l1h->config.trxd_pdu_ver_req = status;
|
||||
l1h->config.setformat_sent = false;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -517,15 +517,15 @@ DEFUN_USRATTR(cfg_phy_trxd_max_version, cfg_phy_trxd_max_version_cmd,
|
|||
|
||||
int max_ver;
|
||||
if (strcmp(argv[0], "latest") == 0)
|
||||
max_ver = TRX_DATA_FORMAT_VER;
|
||||
max_ver = TRX_DATA_PDU_VER;
|
||||
else
|
||||
max_ver = atoi(argv[0]);
|
||||
if (max_ver > TRX_DATA_FORMAT_VER) {
|
||||
if (max_ver > TRX_DATA_PDU_VER) {
|
||||
vty_out(vty, "%% Format version %d is not supported, maximum supported is %d%s",
|
||||
max_ver, TRX_DATA_FORMAT_VER, VTY_NEWLINE);
|
||||
max_ver, TRX_DATA_PDU_VER, VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
plink->u.osmotrx.trxd_hdr_ver_max = max_ver;
|
||||
plink->u.osmotrx.trxd_pdu_ver_max = max_ver;
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -554,8 +554,8 @@ void bts_model_config_write_phy(struct vty *vty, const struct phy_link *plink)
|
|||
if (plink->u.osmotrx.use_legacy_setbsic)
|
||||
vty_out(vty, " osmotrx legacy-setbsic%s", VTY_NEWLINE);
|
||||
|
||||
if (plink->u.osmotrx.trxd_hdr_ver_max != TRX_DATA_FORMAT_VER)
|
||||
vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_hdr_ver_max, VTY_NEWLINE);
|
||||
if (plink->u.osmotrx.trxd_pdu_ver_max != TRX_DATA_PDU_VER)
|
||||
vty_out(vty, " osmotrx trxd-max-version %d%s", plink->u.osmotrx.trxd_pdu_ver_max, VTY_NEWLINE);
|
||||
}
|
||||
|
||||
void bts_model_config_write_phy_inst(struct vty *vty, const struct phy_instance *pinst)
|
||||
|
|
Loading…
Reference in New Issue