[M] Change in osmo-bts[master]: bts-trx: define TRXD_MSG_BUF_SIZE as a more realistic lower value
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/41660?usp=email ) Change subject: bts-trx: define TRXD_MSG_BUF_SIZE as a more realistic lower value ...................................................................... bts-trx: define TRXD_MSG_BUF_SIZE as a more realistic lower value Change-Id: Ic725e26637f8c116cfd5e64ff54d60a1d1bf9b87 --- M src/osmo-bts-trx/trx_if.c M src/osmo-bts-trx/trx_if.h 2 files changed, 43 insertions(+), 22 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c index 5f32360..60705fc 100644 --- a/src/osmo-bts-trx/trx_if.c +++ b/src/osmo-bts-trx/trx_if.c @@ -755,18 +755,11 @@ * TRX burst data socket */ -/* Uplink TRXDv0 header length: TDMA TN + FN + RSSI + ToA256 */ -#define TRX_UL_V0HDR_LEN (1 + 4 + 1 + 2) -/* Uplink TRXDv1 header length: additional MTS + C/I */ -#define TRX_UL_V1HDR_LEN (TRX_UL_V0HDR_LEN + 1 + 2) -/* Uplink TRXDv2 header length: TDMA TN + TRXN + MTS + RSSI + ToA256 + C/I */ -#define TRX_UL_V2HDR_LEN (1 + 1 + 1 + 1 + 2 + 2) - /* Minimum Uplink TRXD header length for all PDU versions */ static const uint8_t trx_data_rx_hdr_len[] = { - TRX_UL_V0HDR_LEN, /* TRXDv0 */ - TRX_UL_V1HDR_LEN, /* TRXDv1 */ - TRX_UL_V2HDR_LEN, /* TRXDv2 */ + TRXD_UL_V0HDR_LEN, /* TRXDv0 */ + TRXD_UL_V1HDR_LEN, /* TRXDv1 */ + TRXD_UL_V2HDR_LEN, /* TRXDv2 */ }; static const uint8_t trx_data_mod_val[] = { @@ -792,7 +785,7 @@ { /* Parse TRXDv0 specific header part */ trx_data_handle_hdr_v0_part(bi, buf); - buf_len -= TRX_UL_V0HDR_LEN; + buf_len -= TRXD_UL_V0HDR_LEN; /* Guess modulation and burst length by the rest octets. * NOTE: a legacy transceiver may append two garbage bytes. */ @@ -811,7 +804,7 @@ return -EINVAL; } - return TRX_UL_V0HDR_LEN; + return TRXD_UL_V0HDR_LEN; } /* Parser for MTS (Modulation and Training Sequence) */ @@ -862,7 +855,7 @@ /* Parse TRXDv0 specific header part */ trx_data_handle_hdr_v0_part(bi, buf); - buf += TRX_UL_V0HDR_LEN; + buf += TRXD_UL_V0HDR_LEN; /* MTS (Modulation and Training Sequence) */ rc = trx_data_parse_mts(phy_inst, bi, buf[0]); @@ -873,7 +866,7 @@ bi->ci_cb = (int16_t) osmo_load16be(buf + 1); bi->flags |= TRX_BI_F_CI_CB; - return TRX_UL_V1HDR_LEN; + return TRXD_UL_V1HDR_LEN; } /* TRXD header dissector for version 0x01 */ @@ -907,18 +900,18 @@ /* TDMA frame number is absent in batched PDUs */ if (bi->_num_pdus == 0) { - if (OSMO_UNLIKELY(buf_len < sizeof(bi->fn) + TRX_UL_V2HDR_LEN)) { + if (OSMO_UNLIKELY(buf_len < sizeof(bi->fn) + TRXD_UL_V2HDR_LEN)) { LOGPPHI(phy_inst, DTRX, LOGL_ERROR, "Rx malformed TRXDv2 PDU: not enough bytes " "to parse TDMA frame number\n"); return -EINVAL; } - bi->fn = osmo_load32be(buf + TRX_UL_V2HDR_LEN); - return TRX_UL_V2HDR_LEN + sizeof(bi->fn); + bi->fn = osmo_load32be(buf + TRXD_UL_V2HDR_LEN); + return TRXD_UL_V2HDR_LEN + sizeof(bi->fn); } - return TRX_UL_V2HDR_LEN; + return TRXD_UL_V2HDR_LEN; } /* TRXD burst handler (version independent) */ @@ -1132,7 +1125,7 @@ } if (l1h->data.sndbuf == NULL) { - l1h->data.sndbuf = msgb_alloc_c(l1h, TRXD_MSG_BUF_SIZE, "tx_trxd"); + l1h->data.sndbuf = msgb_alloc_c(l1h, TRXD_DL_MSG_BUF_SIZE, "tx_trxd"); OSMO_ASSERT(l1h->data.sndbuf); } sndbuf = l1h->data.sndbuf; @@ -1329,7 +1322,7 @@ close(rc); goto ret_close_trxc; } - osmo_iofd_set_alloc_info(l1h->trx_data_iofd, TRXD_MSG_BUF_SIZE, 0); + osmo_iofd_set_alloc_info(l1h->trx_data_iofd, TRXD_UL_MSG_BUF_SIZE, 0); /* register sockets */ osmo_iofd_register(l1h->trx_ctrl_iofd, -1); diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h index 13c537d..44483b5 100644 --- a/src/osmo-bts-trx/trx_if.h +++ b/src/osmo-bts-trx/trx_if.h @@ -1,9 +1,37 @@ #pragma once +#include <osmocom/core/utils.h> +#include <osmo-bts/scheduler.h> + +/* NOTE: (2*GSM_BURST_LEN = VAMOS) + * This ends up being EGPRS_BURST_LEN, 444 */ +#define TRXD_BURST_SIZE_MAX OSMO_MAX(2 * GSM_BURST_LEN, EGPRS_BURST_LEN) + +/* Uplink TRXDv0 header length: TDMA TN + FN + RSSI + ToA256 */ +#define TRXD_UL_V0HDR_LEN (1 + 4 + 1 + 2) +/* Uplink TRXDv1 header length: additional MTS + C/I */ +#define TRXD_UL_V1HDR_LEN (TRXD_UL_V0HDR_LEN + 1 + 2) +/* Uplink TRXDv2 header length: TDMA TN + TRXN + MTS + RSSI + ToA256 + C/I */ +#define TRXD_UL_V2HDR_LEN (1 + 1 + 1 + 1 + 2 + 2) +/* NOTE: TRXDv0: a legacy transceiver may append two garbage bytes: + * NOTE: TRXDv2: 4+ to account for optional TDMA Fn field: */ +#define TRXD_UL_MAX_HDR_LEN OSMO_MAX(TRXD_UL_V0HDR_LEN + 2, OSMO_MAX(TRXD_UL_V1HDR_LEN, 4 + TRXD_UL_V2HDR_LEN)) +/* Note (OS#5827): once we support TRX batching, we miss here "* PCU_IF_NUM_TRX" */ +#define TRXD_UL_MSG_BUF_SIZE ((TRXD_UL_MAX_HDR_LEN + TRXD_BURST_SIZE_MAX) * TRX_NR_TS) + + +/* Downlink TRXDv0/1 header length: TDMA TN + FN + Att */ +#define TRXD_DL_V0HDR_LEN (1 + 4 + 1) +#define TRXD_DL_V1HDR_LEN TRXD_DL_V0HDR_LEN +/* Downlink TRXDv2 header length: TDMA TN + TRXN + MTS + Att + SCPIR + spare3 + FN (on first PDU) */ +#define TRXD_DL_V2HDR_LEN (1 + 1 + 1 + 1 + 1 + 3 + 4) +#define TRXD_DL_MAX_HDR_LEN OSMO_MAX(TRXD_DL_V0HDR_LEN, OSMO_MAX(TRXD_DL_V1HDR_LEN, TRXD_DL_V2HDR_LEN)) + +/* Note (OS#5827): once we support TRX batching, we miss here "* PCU_IF_NUM_TRX" */ +#define TRXD_DL_MSG_BUF_SIZE ((TRXD_DL_MAX_HDR_LEN + TRXD_BURST_SIZE_MAX) * TRX_NR_TS) + /* TRXC read/send buffer size */ #define TRXC_MSG_BUF_SIZE 1500 -/* TRXD read/send buffer size (max. IPv4 MTU) */ -#define TRXD_MSG_BUF_SIZE 65535U struct trx_dl_burst_req; struct trx_l1h; -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41660?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ic725e26637f8c116cfd5e64ff54d60a1d1bf9b87 Gerrit-Change-Number: 41660 Gerrit-PatchSet: 7 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
pespin