|
libosmo-trx 1.8.0.50-7f5e
Osmocom TRX protocol (TRXC/TRXD) library
|
TRX protocol socket endpoint management (clock/ctrl/data UDP sockets). More...
#include <errno.h>#include <stdio.h>#include <string.h>#include <stdarg.h>#include <unistd.h>#include <sys/socket.h>#include <netinet/in.h>#include <osmocom/core/talloc.h>#include <osmocom/core/logging.h>#include <osmocom/core/msgb.h>#include <osmocom/core/osmo_io.h>#include <osmocom/core/socket.h>#include <osmocom/core/utils.h>#include <osmocom/trx/trxc.h>#include <osmocom/trx/trxd.h>#include <osmocom/trx/ep.h>Data Structures | |
| struct | osmo_trx_ep_chan |
| struct | osmo_trx_ep |
Macros | |
| #define | TRX_EP_L1_PORT_OFS 100 |
| The L1 side uses a fixed base port offset (see trx_toolkit) More... | |
| #define | TRX_EP_DATA_BUF_SIZE 4096 |
| Maximum TRXD datagram size: 8 batched PDUs with the largest bursts. More... | |
| #define | OSMO_TRX_EP_F_OPEN (1 << 0) |
| Sockets currently bound. More... | |
| #define | OSMO_TRX_EP_F_CLOCK_SOCKET (1 << 1) |
| Enable the clock socket (base_port + 0) More... | |
| #define | OSMO_TRX_EP_F_PENDING_FREE (1 << 2) |
| osmo_trx_ep_free() was called while a chan's ctrl socket was still flushing: the actual free is deferred to trx_ep_ctrl_close_sendto_cb(), once the last one completes. More... | |
| #define | OSMO_TRX_EP_F_CTRL_PROMISC (1 << 3) |
| Leave the ctrl socket unconnected, accepting/replying to any peer. More... | |
| #define | OSMO_TRX_EP_F_NO_PDU_BATCH (1 << 4) |
| Send one datagram per PDU instead of batching a TDMA frame's worth of BURST.ind/req PDUs into one, even if TRXDv2+ is negotiated. More... | |
| #define | TRX_EP_DEFAULT_BASE_PORT 5700 |
| Default base UDP port, see osmo_trx_ep_set_base_port() More... | |
| #define | LOGEP(ep, level, fmt, args...) |
| #define | LOGEPCH(ep, chan, level, fmt, args...) |
Functions | |
| __attribute__ ((weak)) | |
| static uint16_t | trx_ep_port (const struct osmo_trx_ep *ep, bool local, uint16_t ofs) |
| static void | trx_ep_clck_read_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg) |
| static void | trx_ep_ctrl_recvfrom_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg, const struct osmo_sockaddr *saddr) |
| static void | trx_ep_data_read_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg) |
| static void | trx_ep_write_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg) |
| static void | trx_ep_ctrl_sendto_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg, const struct osmo_sockaddr *daddr) |
| static void | trx_ep_ctrl_close_sendto_cb (struct osmo_io_fd *iofd, int res, struct msgb *msg, const struct osmo_sockaddr *daddr) |
| Write call-back for a channel's ctrl_iofd while it is being flushed asynchronously after osmo_trx_ep_close(): a 'goodbye' TRXC message (e.g. More... | |
| static void | trx_ep_ctrl_close (struct osmo_trx_ep_chan *chan) |
| static struct osmo_io_fd * | trx_ep_open_iofd (struct osmo_trx_ep *ep, uint16_t ofs, const struct osmo_io_ops *ioops, enum osmo_io_fd_mode mode, unsigned int buf_size, void *data, bool connect_socket) |
| static void | trx_ep_chan_init (struct osmo_trx_ep_chan *chan, struct osmo_trx_ep *ep, unsigned int num) |
| static int | trx_ep_chan_open (struct osmo_trx_ep_chan *chan) |
| static void | trx_ep_chan_close (struct osmo_trx_ep_chan *chan) |
| struct osmo_trx_ep * | osmo_trx_ep_alloc (void *ctx, unsigned int num_chans) |
| Allocate a TRX endpoint instance. More... | |
| int | osmo_trx_ep_open (struct osmo_trx_ep *ep) |
| Open the clock/ctrl/data sockets of the given endpoint. More... | |
| void | osmo_trx_ep_close (struct osmo_trx_ep *ep) |
| Close all sockets of the given endpoint. More... | |
| void | osmo_trx_ep_free (struct osmo_trx_ep *ep) |
| Free the given endpoint instance (closes all sockets). More... | |
| bool | osmo_trx_ep_is_open (const struct osmo_trx_ep *ep) |
| Whether the endpoint's sockets are currently open. More... | |
| bool | osmo_trx_ep_is_closing (const struct osmo_trx_ep *ep) |
| Whether a ctrl socket from a previous osmo_trx_ep_close() is still flushing a queued TRXC message in the background (see trx_ep_ctrl_close()). More... | |
| void | osmo_trx_ep_set_closed_cb (struct osmo_trx_ep *ep, osmo_trx_ep_closed_cb_t closed_cb) |
| Set the call-back invoked once osmo_trx_ep_close() has fully completed: immediately if no ctrl chan needed flushing, or once the last async flush finishes (see osmo_trx_ep_is_closing()) otherwise. More... | |
| void | osmo_trx_ep_set_priv (struct osmo_trx_ep *ep, void *priv) |
| Set the application-private data. More... | |
| void * | osmo_trx_ep_get_priv (const struct osmo_trx_ep *ep) |
| Obtain the application-private data. More... | |
| unsigned int | osmo_trx_ep_get_num_chans (const struct osmo_trx_ep *ep) |
| Obtain the number of channels. More... | |
| int | osmo_trx_ep_set_num_chans (struct osmo_trx_ep *ep, unsigned int num_chans) |
| Change the number of channels; only valid before osmo_trx_ep_open(). More... | |
| int | osmo_trx_ep_set_mode (struct osmo_trx_ep *ep, enum osmo_trx_ep_mode mode) |
| Set the endpoint mode (default: OSMO_TRX_EP_MODE_L1) More... | |
| enum osmo_trx_ep_mode | osmo_trx_ep_get_mode (const struct osmo_trx_ep *ep) |
| Obtain the endpoint mode. More... | |
| int | osmo_trx_ep_set_laddr (struct osmo_trx_ep *ep, const char *addr) |
| Set the local IP address (copied) More... | |
| const char * | osmo_trx_ep_get_laddr (const struct osmo_trx_ep *ep) |
| Obtain the local IP address. More... | |
| int | osmo_trx_ep_set_raddr (struct osmo_trx_ep *ep, const char *addr) |
| Set the remote IP address (copied) More... | |
| const char * | osmo_trx_ep_get_raddr (const struct osmo_trx_ep *ep) |
| Obtain the remote IP address. More... | |
| int | osmo_trx_ep_set_base_port (struct osmo_trx_ep *ep, uint16_t base_port) |
| Set the base UDP port (default: 5700), see ep.h for the port layout. More... | |
| uint16_t | osmo_trx_ep_get_base_port (const struct osmo_trx_ep *ep) |
| Obtain the base UDP port. More... | |
| int | osmo_trx_ep_set_clock_socket (struct osmo_trx_ep *ep, bool enable) |
| Enable/disable the clock socket (default: false) More... | |
| bool | osmo_trx_ep_get_clock_socket (const struct osmo_trx_ep *ep) |
| Whether the clock socket is enabled. More... | |
| int | osmo_trx_ep_set_ctrl_promisc (struct osmo_trx_ep *ep, bool enable) |
| Enable/disable promiscuous ctrl socket mode (default: false): leaves the ctrl socket unconnected, accepting TRXC PDUs from any peer instead of only the configured one, e.g. More... | |
| bool | osmo_trx_ep_get_ctrl_promisc (const struct osmo_trx_ep *ep) |
| Whether promiscuous ctrl socket mode is enabled. More... | |
| void | osmo_trx_ep_set_pdu_batch (struct osmo_trx_ep *ep, bool enable) |
| Enable/disable batching BURST.ind/req PDUs on the data sockets (default: true): when enabled and TRXDv2 (or higher) is negotiated on a channel, a TDMA frame's worth of PDUs is accumulated and sent in a single datagram (see osmo_trx_ep_send_burst_ind()/_req()); when disabled, every PDU is sent in its own datagram regardless of the negotiated TRXD PDU version, trading datagram count for latency. More... | |
| bool | osmo_trx_ep_get_pdu_batch (const struct osmo_trx_ep *ep) |
| Whether batching BURST.ind/req PDUs on the data sockets is enabled. More... | |
| int | osmo_trx_ep_set_name (struct osmo_trx_ep *ep, const char *fmt,...) |
| Set the name (log prefix) of the given instance, e.g. More... | |
| const char * | osmo_trx_ep_get_name (const struct osmo_trx_ep *ep) |
| Obtain the name (log prefix) of the given instance. More... | |
| void | osmo_trx_ep_set_log_cat (struct osmo_trx_ep *ep, int log_cat) |
| Set the logging category (e.g. More... | |
| int | osmo_trx_ep_set_pdu_ver (struct osmo_trx_ep *ep, unsigned int chan, uint8_t ver) |
| Set the TRXD PDU version in use for the given channel (default: 0), usually after the negotiation (see osmo_trxc_client_negotiate_format()) More... | |
| int | osmo_trx_ep_get_pdu_ver (const struct osmo_trx_ep *ep, unsigned int chan) |
| Get the TRXD PDU version in use for the given channel. More... | |
| int | osmo_trx_ep_send_clck_ind (struct osmo_trx_ep *ep, uint32_t fn) |
| Send a clock indication ("IND CLOCK <fn>") on the clock socket. More... | |
| int | osmo_trx_ep_send_ctrl_msg (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxc_msg *tmsg) |
| Send a TRXC message on the ctrl socket of the given channel. More... | |
| static int | trx_ep_data_tx_flush (struct osmo_trx_ep_chan *c) |
| Flush a channel's pending Tx batching buffer: write the accumulated msgb to the data socket and clear c->tx_msg. More... | |
| int | osmo_trx_ep_send_burst_ind (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_ind *bi) |
| Send a burst indication on the data socket of the given channel (OSMO_TRX_EP_MODE_TRX only). More... | |
| int | osmo_trx_ep_send_burst_req (struct osmo_trx_ep *ep, unsigned int chan, const struct osmo_trxd_burst_req *br) |
| Send a burst transmit request on the data socket of the given channel (OSMO_TRX_EP_MODE_L1 only). More... | |
| int | osmo_trx_ep_send_burst_fin (struct osmo_trx_ep *ep, unsigned int chan) |
| Flush the TRXDv2 batching buffer accumulated by osmo_trx_ep_send_burst_ind() or osmo_trx_ep_send_burst_req() (whichever applies to this endpoint's mode), transmitting it in a single datagram; no-op (returns -ENOMSG) if nothing was accumulated, and for TRXDv0/v1 (each PDU is already sent immediately by osmo_trx_ep_send_burst_ind()/_req()). More... | |
Variables | |
| static const struct osmo_io_ops | trx_ep_ctrl_close_ioops |
| static const struct osmo_io_ops | trx_ep_clck_ioops |
| static const struct osmo_io_ops | trx_ep_ctrl_ioops |
| static const struct osmo_io_ops | trx_ep_data_ioops |
TRX protocol socket endpoint management (clock/ctrl/data UDP sockets).
Based on the socket handling in osmo-bts-trx (trx_if.c) and the port numbering convention of trx_toolkit (transceiver.py).
| #define LOGEP | ( | ep, | |
| level, | |||
| fmt, | |||
| args... | |||
| ) |
| #define LOGEPCH | ( | ep, | |
| chan, | |||
| level, | |||
| fmt, | |||
| args... | |||
| ) |
| #define OSMO_TRX_EP_F_CLOCK_SOCKET (1 << 1) |
Enable the clock socket (base_port + 0)
| #define OSMO_TRX_EP_F_CTRL_PROMISC (1 << 3) |
Leave the ctrl socket unconnected, accepting/replying to any peer.
| #define OSMO_TRX_EP_F_NO_PDU_BATCH (1 << 4) |
Send one datagram per PDU instead of batching a TDMA frame's worth of BURST.ind/req PDUs into one, even if TRXDv2+ is negotiated.
| #define OSMO_TRX_EP_F_OPEN (1 << 0) |
Sockets currently bound.
| #define OSMO_TRX_EP_F_PENDING_FREE (1 << 2) |
osmo_trx_ep_free() was called while a chan's ctrl socket was still flushing: the actual free is deferred to trx_ep_ctrl_close_sendto_cb(), once the last one completes.
| #define TRX_EP_DATA_BUF_SIZE 4096 |
Maximum TRXD datagram size: 8 batched PDUs with the largest bursts.
| #define TRX_EP_DEFAULT_BASE_PORT 5700 |
Default base UDP port, see osmo_trx_ep_set_base_port()
| #define TRX_EP_L1_PORT_OFS 100 |
The L1 side uses a fixed base port offset (see trx_toolkit)
| __attribute__ | ( | (weak) | ) |
References osmo_trx_ep_chan::ep, and LOGEP.
| struct osmo_trx_ep * osmo_trx_ep_alloc | ( | void * | ctx, |
| unsigned int | num_chans | ||
| ) |
Allocate a TRX endpoint instance.
The mode, addresses and base port default to zero/unset and must be configured via the osmo_trx_ep_set_*() accessors before osmo_trx_ep_open(); num_chans may be changed later via osmo_trx_ep_set_num_chans(), but before osmo_trx_ep_open().
| [in] | ctx | talloc context to allocate from |
| [in] | num_chans | number of channels (> 0) |
References osmo_trx_ep::base_port, osmo_trx_ep::log_cat, osmo_trx_ep::name, osmo_trx_ep::num_chans, osmo_trx_ep_set_num_chans(), and TRX_EP_DEFAULT_BASE_PORT.
| void osmo_trx_ep_close | ( | struct osmo_trx_ep * | ep | ) |
Close all sockets of the given endpoint.
No-op if not opened. Any TRXC message still queued on a ctrl socket (e.g. a 'goodbye' "CMD POWEROFF" sent right before teardown) is flushed asynchronously (best-effort) instead of being dropped; pending Tx data batches are dropped.
References osmo_trx_ep::chans, osmo_trx_ep::clck_iofd, osmo_trx_ep::closed_cb, osmo_trx_ep::flags, osmo_trx_ep::laddr, LOGEP, osmo_trx_ep::num_chans, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), osmo_trx_ep::raddr, trx_ep_chan_close(), and trx_ep_port().
Referenced by osmo_trx_ep_free(), and osmo_trx_ep_open().
| void osmo_trx_ep_free | ( | struct osmo_trx_ep * | ep | ) |
Free the given endpoint instance (closes all sockets).
If a ctrl socket is still flushing (see osmo_trx_ep_is_closing()), the endpoint itself is kept alive until the flush completes (see trx_ep_ctrl_close_sendto_cb()), which then finishes this deferred free.
References osmo_trx_ep::flags, osmo_trx_ep_close(), OSMO_TRX_EP_F_PENDING_FREE, and osmo_trx_ep_is_closing().
| uint16_t osmo_trx_ep_get_base_port | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the base UDP port.
References osmo_trx_ep::base_port.
| bool osmo_trx_ep_get_clock_socket | ( | const struct osmo_trx_ep * | ep | ) |
Whether the clock socket is enabled.
References osmo_trx_ep::flags, and OSMO_TRX_EP_F_CLOCK_SOCKET.
| bool osmo_trx_ep_get_ctrl_promisc | ( | const struct osmo_trx_ep * | ep | ) |
Whether promiscuous ctrl socket mode is enabled.
References osmo_trx_ep::flags, and OSMO_TRX_EP_F_CTRL_PROMISC.
| const char * osmo_trx_ep_get_laddr | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the local IP address.
References osmo_trx_ep::laddr.
| enum osmo_trx_ep_mode osmo_trx_ep_get_mode | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the endpoint mode.
References osmo_trx_ep::mode.
| const char * osmo_trx_ep_get_name | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the name (log prefix) of the given instance.
References osmo_trx_ep::name.
| unsigned int osmo_trx_ep_get_num_chans | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the number of channels.
References osmo_trx_ep::num_chans.
| bool osmo_trx_ep_get_pdu_batch | ( | const struct osmo_trx_ep * | ep | ) |
Whether batching BURST.ind/req PDUs on the data sockets is enabled.
References osmo_trx_ep::flags, and OSMO_TRX_EP_F_NO_PDU_BATCH.
| int osmo_trx_ep_get_pdu_ver | ( | const struct osmo_trx_ep * | ep, |
| unsigned int | chan | ||
| ) |
Get the TRXD PDU version in use for the given channel.
References osmo_trx_ep::chans, osmo_trx_ep::num_chans, and osmo_trx_ep_chan::pdu_ver.
| void * osmo_trx_ep_get_priv | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the application-private data.
References osmo_trx_ep::priv.
| const char * osmo_trx_ep_get_raddr | ( | const struct osmo_trx_ep * | ep | ) |
Obtain the remote IP address.
References osmo_trx_ep::raddr.
| bool osmo_trx_ep_is_closing | ( | const struct osmo_trx_ep * | ep | ) |
Whether a ctrl socket from a previous osmo_trx_ep_close() is still flushing a queued TRXC message in the background (see trx_ep_ctrl_close()).
References osmo_trx_ep::chans, osmo_trx_ep_chan::ctrl_wr_pending, and osmo_trx_ep::num_chans.
Referenced by osmo_trx_ep_close(), osmo_trx_ep_free(), osmo_trx_ep_open(), osmo_trx_ep_set_num_chans(), and trx_ep_ctrl_close_sendto_cb().
| bool osmo_trx_ep_is_open | ( | const struct osmo_trx_ep * | ep | ) |
Whether the endpoint's sockets are currently open.
References osmo_trx_ep::flags, and OSMO_TRX_EP_F_OPEN.
| int osmo_trx_ep_open | ( | struct osmo_trx_ep * | ep | ) |
Open the clock/ctrl/data sockets of the given endpoint.
References osmo_trx_ep::chans, osmo_trx_ep::clck_iofd, osmo_trx_ep::flags, osmo_trx_ep::laddr, LOGEP, osmo_trx_ep::num_chans, osmo_trx_ep_close(), OSMO_TRX_EP_F_CLOCK_SOCKET, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), OSMO_TRXC_MSG_BUF_SIZE, osmo_trx_ep::raddr, trx_ep_chan_open(), trx_ep_clck_ioops, trx_ep_open_iofd(), and trx_ep_port().
| int osmo_trx_ep_send_burst_fin | ( | struct osmo_trx_ep * | ep, |
| unsigned int | chan | ||
| ) |
Flush the TRXDv2 batching buffer accumulated by osmo_trx_ep_send_burst_ind() or osmo_trx_ep_send_burst_req() (whichever applies to this endpoint's mode), transmitting it in a single datagram; no-op (returns -ENOMSG) if nothing was accumulated, and for TRXDv0/v1 (each PDU is already sent immediately by osmo_trx_ep_send_burst_ind()/_req()).
References osmo_trx_ep::chans, osmo_trx_ep_chan::ep, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.
| int osmo_trx_ep_send_burst_ind | ( | struct osmo_trx_ep * | ep, |
| unsigned int | chan, | ||
| const struct osmo_trxd_burst_ind * | bi | ||
| ) |
Send a burst indication on the data socket of the given channel (OSMO_TRX_EP_MODE_TRX only).
For TRXDv2, the PDUs are batched: they get accumulated until osmo_trx_ep_send_burst_fin() is called, which transmits all accumulated PDUs in a single datagram. For TRXDv0/v1, each PDU is transmitted immediately.
References osmo_trx_ep::chans, osmo_trx_ep::flags, OSMO_TRX_EP_F_NO_PDU_BATCH, osmo_trxd_burst_ind_build(), osmo_trx_ep_chan::pdu_ver, TRX_EP_DATA_BUF_SIZE, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.
| int osmo_trx_ep_send_burst_req | ( | struct osmo_trx_ep * | ep, |
| unsigned int | chan, | ||
| const struct osmo_trxd_burst_req * | br | ||
| ) |
Send a burst transmit request on the data socket of the given channel (OSMO_TRX_EP_MODE_L1 only).
For TRXDv2, the PDUs are batched: they get accumulated until osmo_trx_ep_send_burst_fin() is called, which transmits all accumulated PDUs in a single datagram. For TRXDv0/v1, each PDU is transmitted immediately.
References osmo_trx_ep::chans, osmo_trx_ep::flags, OSMO_TRX_EP_F_NO_PDU_BATCH, osmo_trxd_burst_req_build(), osmo_trx_ep_chan::pdu_ver, TRX_EP_DATA_BUF_SIZE, trx_ep_data_tx_flush(), and osmo_trx_ep_chan::tx_msg.
| int osmo_trx_ep_send_clck_ind | ( | struct osmo_trx_ep * | ep, |
| uint32_t | fn | ||
| ) |
Send a clock indication ("IND CLOCK <fn>") on the clock socket.
References osmo_trx_ep::clck_iofd, osmo_trxc_clock_ind_build(), and OSMO_TRXC_MSG_BUF_SIZE.
| int osmo_trx_ep_send_ctrl_msg | ( | struct osmo_trx_ep * | ep, |
| unsigned int | chan, | ||
| const struct osmo_trxc_msg * | tmsg | ||
| ) |
Send a TRXC message on the ctrl socket of the given channel.
References osmo_trx_ep::chans, osmo_trx_ep_chan::ctrl_iofd, osmo_trx_ep_chan::ctrl_peer, osmo_trx_ep_chan::ctrl_wr_pending, OSMO_TRXC_MSG_BUF_SIZE, and osmo_trxc_msg_build().
| int osmo_trx_ep_set_base_port | ( | struct osmo_trx_ep * | ep, |
| uint16_t | base_port | ||
| ) |
Set the base UDP port (default: 5700), see ep.h for the port layout.
Base UDP port (default: 5700).
References osmo_trx_ep::base_port, osmo_trx_ep::flags, and OSMO_TRX_EP_F_OPEN.
| int osmo_trx_ep_set_clock_socket | ( | struct osmo_trx_ep * | ep, |
| bool | enable | ||
| ) |
Enable/disable the clock socket (default: false)
Open the clock socket (base port + 0); default: false.
References osmo_trx_ep::flags, OSMO_TRX_EP_F_CLOCK_SOCKET, and OSMO_TRX_EP_F_OPEN.
| void osmo_trx_ep_set_closed_cb | ( | struct osmo_trx_ep * | ep, |
| osmo_trx_ep_closed_cb_t | closed_cb | ||
| ) |
Set the call-back invoked once osmo_trx_ep_close() has fully completed: immediately if no ctrl chan needed flushing, or once the last async flush finishes (see osmo_trx_ep_is_closing()) otherwise.
References osmo_trx_ep::closed_cb.
| int osmo_trx_ep_set_ctrl_promisc | ( | struct osmo_trx_ep * | ep, |
| bool | enable | ||
| ) |
Enable/disable promiscuous ctrl socket mode (default: false): leaves the ctrl socket unconnected, accepting TRXC PDUs from any peer instead of only the configured one, e.g.
Unconnected ctrl socket accepting/replying to any peer; default: false.
a test tool injecting extra TRXC commands from its own socket. The RSP always goes back to whoever actually sent the CMD, promiscuous or not (see trx_ep_ctrl_recvfrom_cb() and chan->ctrl_peer).
References osmo_trx_ep::flags, OSMO_TRX_EP_F_CTRL_PROMISC, and OSMO_TRX_EP_F_OPEN.
| int osmo_trx_ep_set_laddr | ( | struct osmo_trx_ep * | ep, |
| const char * | addr | ||
| ) |
Set the local IP address (copied)
Local/remote IP address (copied); must be set before osmo_trx_ep_open()
References osmo_trx_ep::flags, osmo_trx_ep::laddr, and OSMO_TRX_EP_F_OPEN.
| void osmo_trx_ep_set_log_cat | ( | struct osmo_trx_ep * | ep, |
| int | log_cat | ||
| ) |
Set the logging category (e.g.
DTRX in osmo-bts; default: DLGLOBAL)
References osmo_trx_ep::log_cat.
| int osmo_trx_ep_set_mode | ( | struct osmo_trx_ep * | ep, |
| enum osmo_trx_ep_mode | mode | ||
| ) |
Set the endpoint mode (default: OSMO_TRX_EP_MODE_L1)
References osmo_trx_ep::flags, osmo_trx_ep::mode, and OSMO_TRX_EP_F_OPEN.
| int osmo_trx_ep_set_name | ( | struct osmo_trx_ep * | ep, |
| const char * | fmt, | ||
| ... | |||
| ) |
| int osmo_trx_ep_set_num_chans | ( | struct osmo_trx_ep * | ep, |
| unsigned int | num_chans | ||
| ) |
Change the number of channels; only valid before osmo_trx_ep_open().
References osmo_trx_ep::chans, osmo_trx_ep::flags, osmo_trx_ep::num_chans, OSMO_TRX_EP_F_OPEN, osmo_trx_ep_is_closing(), and trx_ep_chan_init().
Referenced by osmo_trx_ep_alloc().
| void osmo_trx_ep_set_pdu_batch | ( | struct osmo_trx_ep * | ep, |
| bool | enable | ||
| ) |
Enable/disable batching BURST.ind/req PDUs on the data sockets (default: true): when enabled and TRXDv2 (or higher) is negotiated on a channel, a TDMA frame's worth of PDUs is accumulated and sent in a single datagram (see osmo_trx_ep_send_burst_ind()/_req()); when disabled, every PDU is sent in its own datagram regardless of the negotiated TRXD PDU version, trading datagram count for latency.
May be changed at any time.
References osmo_trx_ep::flags, and OSMO_TRX_EP_F_NO_PDU_BATCH.
| int osmo_trx_ep_set_pdu_ver | ( | struct osmo_trx_ep * | ep, |
| unsigned int | chan, | ||
| uint8_t | ver | ||
| ) |
Set the TRXD PDU version in use for the given channel (default: 0), usually after the negotiation (see osmo_trxc_client_negotiate_format())
Per-channel TRXD PDU version in use (set after SETFORMAT negotiation)
References osmo_trx_ep::chans, LOGEPCH, osmo_trx_ep::num_chans, OSMO_TRXD_PDU_VER_MAX, and osmo_trx_ep_chan::pdu_ver.
| void osmo_trx_ep_set_priv | ( | struct osmo_trx_ep * | ep, |
| void * | priv | ||
| ) |
Set the application-private data.
References osmo_trx_ep::priv.
| int osmo_trx_ep_set_raddr | ( | struct osmo_trx_ep * | ep, |
| const char * | addr | ||
| ) |
Set the remote IP address (copied)
References osmo_trx_ep::flags, OSMO_TRX_EP_F_OPEN, and osmo_trx_ep::raddr.
|
static |
References osmo_trx_ep_chan::data_iofd, trx_ep_ctrl_close(), and osmo_trx_ep_chan::tx_msg.
Referenced by osmo_trx_ep_close().
|
static |
References osmo_trx_ep_chan::ep, and osmo_trx_ep_chan::num.
Referenced by osmo_trx_ep_set_num_chans().
|
static |
References osmo_trx_ep_chan::ctrl_iofd, osmo_trx_ep_chan::ctrl_peer, osmo_trx_ep_chan::data_iofd, osmo_trx_ep_chan::ep, osmo_trx_ep::flags, LOGEPCH, osmo_trx_ep_chan::num, OSMO_TRX_EP_F_CTRL_PROMISC, OSMO_TRXC_MSG_BUF_SIZE, trx_ep_ctrl_ioops, TRX_EP_DATA_BUF_SIZE, trx_ep_data_ioops, and trx_ep_open_iofd().
Referenced by osmo_trx_ep_open().
|
static |
References LOGEP, osmo_trx_ep_rx_clck_ind(), and osmo_trxc_clock_ind_parse().
|
static |
References osmo_trx_ep_chan::ctrl_iofd, osmo_trx_ep_chan::ctrl_wr_pending, osmo_trx_ep_chan::ep, LOGEPCH, osmo_trx_ep_chan::num, and trx_ep_ctrl_close_ioops.
Referenced by trx_ep_chan_close().
|
static |
Write call-back for a channel's ctrl_iofd while it is being flushed asynchronously after osmo_trx_ep_close(): a 'goodbye' TRXC message (e.g.
"CMD POWEROFF") may have been enqueued via osmo_trx_ep_send_ctrl_msg() right before tearing down the endpoint; osmo_iofd_free() would otherwise drop it together with the (now pointless) rest of the Tx queue. Keeps waiting until every byte enqueued on it has actually completed (or a write fails), then frees the iofd and, if osmo_trx_ep_free() was called on the (kept alive) endpoint in the meantime and no other channel is still flushing, finally frees the endpoint too.
References osmo_trx_ep::closed_cb, osmo_trx_ep_chan::ctrl_iofd, osmo_trx_ep_chan::ctrl_wr_pending, osmo_trx_ep_chan::ep, osmo_trx_ep::flags, LOGEP, LOGEPCH, osmo_trx_ep_chan::num, OSMO_TRX_EP_F_PENDING_FREE, and osmo_trx_ep_is_closing().
|
static |
|
static |
References osmo_trx_ep_chan::ctrl_wr_pending, osmo_trx_ep_chan::ep, LOGEPCH, and osmo_trx_ep_chan::num.
|
static |
|
static |
Flush a channel's pending Tx batching buffer: write the accumulated msgb to the data socket and clear c->tx_msg.
Shared by osmo_trx_ep_send_burst_fin() and the immediate (non-batched, TRXDv0/v1) send path.
References osmo_trx_ep_chan::data_iofd, osmo_trxd_build_fin(), osmo_trx_ep_chan::pdu_ver, and osmo_trx_ep_chan::tx_msg.
Referenced by osmo_trx_ep_send_burst_fin(), osmo_trx_ep_send_burst_ind(), and osmo_trx_ep_send_burst_req().
|
static |
References osmo_trx_ep::laddr, LOGEP, osmo_trx_ep::raddr, and trx_ep_port().
Referenced by osmo_trx_ep_open(), and trx_ep_chan_open().
|
static |
References osmo_trx_ep::base_port, osmo_trx_ep_chan::ep, osmo_trx_ep::mode, OSMO_TRX_EP_MODE_L1, and TRX_EP_L1_PORT_OFS.
Referenced by osmo_trx_ep_close(), osmo_trx_ep_open(), and trx_ep_open_iofd().
|
static |
|
static |
Referenced by osmo_trx_ep_open().
|
static |
Referenced by trx_ep_ctrl_close().
|
static |
Referenced by trx_ep_chan_open().
|
static |
Referenced by trx_ep_chan_open().