Move fhstate into eth structure

fhstate is only used in the ETHERNET library, so move it to a smaller
scope. In AW2S it is write-only, so we can remove it.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
Robert Schmidt
2026-06-29 13:54:23 +02:00
parent 9c0577ad1e
commit 6d75ca8e9c
5 changed files with 22 additions and 23 deletions

View File

@@ -280,7 +280,7 @@ void *trx_eth_write_udp_cmd(udpTXelem_t *udpTXelem)
int bytes_sent=0;
eth_state_t *eth = (eth_state_t*)device->priv;
int sendto_flag =0;
fhstate_t *fhstate = &device->fhstate;
fhstate_t *fhstate = &eth->fhstate;
//sendto_flag|=flags;
eth->tx_nsamps=nsamps;
@@ -413,7 +413,7 @@ void *udp_read_thread(void *arg)
udp_ctx_t *u = (udp_ctx_t *)arg;
openair0_device_t *device=u->device;
eth_state_t *eth = device->priv;
fhstate_t *fhstate = &device->fhstate;
fhstate_t *fhstate = &eth->fhstate;
char buffer[UDP_PACKET_SIZE_BYTES(256)];
int first_read=0;
while (oai_exit == 0) {
@@ -476,7 +476,8 @@ void *udp_read_thread(void *arg)
int trx_eth_read_udp(openair0_device_t *device, openair0_timestamp_t *timestamp, uint32_t **buff, int nsamps)
{
fhstate_t *fhstate = &device->fhstate;
eth_state_t *eth = device->priv;
fhstate_t *fhstate = &eth->fhstate;
openair0_timestamp_t prev_read_TS= fhstate->TS_read;
volatile openair0_timestamp_t min_TS;
// block until FH is ready

View File

@@ -492,10 +492,10 @@ int transport_init(openair0_device_t *device, openair0_config_t *openair0_cfg, e
device->trx_read_func2 = trx_eth_read_udp;
device->trx_ctlsend_func = trx_eth_ctlsend_udp;
device->trx_ctlrecv_func = trx_eth_ctlrecv_udp;
memset((void *)&device->fhstate, 0, sizeof(device->fhstate));
memset(&eth->fhstate, 0, sizeof(eth->fhstate));
printf("Setting %d RX channels to waiting\n", openair0_cfg->rx_num_channels);
for (int i = openair0_cfg->rx_num_channels; i < 8; i++)
device->fhstate.r[i] = 1;
eth->fhstate.r[i] = 1;
} else if (eth->flags == ETH_RAW_IF4p5_MODE) {
device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF4p5;

View File

@@ -38,6 +38,19 @@ typedef struct {
notifiedFIFO_t *resp;
} udp_ctx_t;
typedef struct fhstate_s {
openair0_timestamp_t TS[8];
openair0_timestamp_t TS0;
openair0_timestamp_t olddeltaTS[8];
openair0_timestamp_t oldTS[8];
openair0_timestamp_t TS_read;
int first_read;
uint32_t *buff[8];
uint32_t buff_size;
int r[8];
int active;
} fhstate_t;
/*!\brief opaque ethernet data structure */
typedef struct {
@@ -52,7 +65,7 @@ typedef struct {
/*!\brief buffer size */
unsigned int buffer_size;
/*!\brief Fronthaul state */
fhstate_t *fhstate;
fhstate_t fhstate;
/*!\brief destination address (control) for UDP socket*/
struct sockaddr_in dest_addrc;
/*!\brief local address (control) for UDP socket*/