aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-09 13:13:37 +0100
committerHarald Welte <laforge@gnumonks.org>2016-02-15 14:18:59 +0100
commitd784e50747b8cf0ce505489e1451f75be5ccbd4b (patch)
treeb143bbf2162bea0959ba9b80cc5d1573de7d62ee /include
parentf58542899a91d1db0bbe9966ae98ccdf449f45d0 (diff)
Introduce new phy_link and phy_instance abstraction
This way we can model a flexible mapping between any number of PHYs, each having multiple instances, and then map BTSs with TRXx on top of those PHYs.
Diffstat (limited to 'include')
-rw-r--r--include/osmo-bts/Makefile.am2
-rw-r--r--include/osmo-bts/bts.h2
-rw-r--r--include/osmo-bts/bts_model.h8
-rw-r--r--include/osmo-bts/gsm_data.h15
-rw-r--r--include/osmo-bts/phy_link.h115
-rw-r--r--include/osmo-bts/scheduler.h4
-rw-r--r--include/osmo-bts/vty.h7
7 files changed, 134 insertions, 19 deletions
diff --git a/include/osmo-bts/Makefile.am b/include/osmo-bts/Makefile.am
index af88a1ac..d0b55ff9 100644
--- a/include/osmo-bts/Makefile.am
+++ b/include/osmo-bts/Makefile.am
@@ -1,4 +1,4 @@
noinst_HEADERS = abis.h bts.h bts_model.h gsm_data.h logging.h measurement.h \
oml.h paging.h rsl.h signal.h vty.h amr.h pcu_if.h pcuif_proto.h \
handover.h msg_utils.h tx_power.h control_if.h cbch.h l1sap.h \
- power_control.h scheduler.h scheduler_backend.h
+ power_control.h scheduler.h scheduler_backend.h phy_link.h
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 9e211864..ec58eddc 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -21,12 +21,12 @@ void destroy_bts(struct gsm_bts *bts);
int work_bts(struct gsm_bts *bts);
int bts_link_estab(struct gsm_bts *bts);
int trx_link_estab(struct gsm_bts_trx *trx);
+int trx_set_available(struct gsm_bts_trx *trx, int avail);
void bts_new_si(void *arg);
void bts_setup_slot(struct gsm_bts_trx_ts *slot, uint8_t comb);
int bts_agch_enqueue(struct gsm_bts *bts, struct msgb *msg);
struct msgb *bts_agch_dequeue(struct gsm_bts *bts);
-void bts_update_agch_max_queue_length(struct gsm_bts *bts);
int bts_agch_max_queue_length(int T, int bcch_conf);
int bts_ccch_copy_msg(struct gsm_bts *bts, uint8_t *out_buf, struct gsm_time *gt,
int is_ag_res);
diff --git a/include/osmo-bts/bts_model.h b/include/osmo-bts/bts_model.h
index 41b5e93b..6252557a 100644
--- a/include/osmo-bts/bts_model.h
+++ b/include/osmo-bts/bts_model.h
@@ -8,6 +8,9 @@
#include <osmo-bts/gsm_data.h>
+struct phy_link;
+struct phy_instance;
+
/* BTS model specific functions needed by the common code */
int bts_model_init(struct gsm_bts *bts);
@@ -32,6 +35,8 @@ int bts_model_vty_init(struct gsm_bts *bts);
void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts);
void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx);
+void bts_model_config_write_phy(struct vty *vty, struct phy_link *plink);
+void bts_model_config_write_phy_inst(struct vty *vty, struct phy_instance *pinst);
int bts_model_oml_estab(struct gsm_bts *bts);
@@ -47,4 +52,7 @@ int bts_model_ctrl_cmds_install(struct gsm_bts *bts);
int bts_model_handle_options(int argc, char **argv);
void bts_model_print_help();
+void bts_model_phy_link_set_defaults(struct phy_link *plink);
+void bts_model_phy_instance_set_defaults(struct phy_instance *pinst);
+
#endif
diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index 6a7bca87..f9e6ed13 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -119,21 +119,6 @@ enum lchan_ciph_state {
#include "openbsc/gsm_data_shared.h"
-struct femtol1_hdl;
-
-static inline struct femtol1_hdl *trx_femtol1_hdl(struct gsm_bts_trx *trx)
-{
- return trx->role_bts.l1h;
-}
-
-struct trx_l1h;
-
-static inline struct trx_l1h *trx_l1h_hdl(struct gsm_bts_trx *trx)
-{
- return trx->role_bts.l1h;
-}
-
-
void lchan_set_state(struct gsm_lchan *lchan, enum gsm_lchan_state state);
/* cipher code */
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
new file mode 100644
index 00000000..b9fc4121
--- /dev/null
+++ b/include/osmo-bts/phy_link.h
@@ -0,0 +1,115 @@
+#pragma once
+
+#include <stdint.h>
+#include <osmocom/core/linuxlist.h>
+
+#include <osmo-bts/scheduler.h>
+
+#include <linux/if_packet.h>
+
+struct gsm_bts_trx;
+
+enum phy_link_type {
+ PHY_LINK_T_NONE,
+ PHY_LINK_T_SYSMOBTS,
+ PHY_LINK_T_OSMOTRX,
+};
+
+enum phy_link_state {
+ PHY_LINK_SHUTDOWN,
+ PHY_LINK_CONNECTING,
+ PHY_LINK_CONNECTED,
+};
+
+/* A PHY link represents the connection to a given PHYsical layer
+ * implementation. That PHY link contains 1...N PHY instances, one for
+ * each TRX */
+struct phy_link {
+ struct llist_head list;
+ int num;
+ enum phy_link_type type;
+ enum phy_link_state state;
+ struct llist_head instances;
+ char *description;
+ union {
+ struct {
+ } sysmobts;
+ struct {
+ char *transceiver_ip;
+ uint16_t base_port_local;
+ uint16_t base_port_remote;
+ struct osmo_fd trx_ofd_clk;
+
+ uint32_t clock_advance;
+ uint32_t rts_advance;
+
+ int rxgain_valid;
+ int rxgain;
+ int rxgain_sent;
+
+ int power_valid;
+ int power;
+ int power_oml;
+ int power_sent;
+ } osmotrx;
+ struct {
+ /* MAC address of the PHY */
+ struct sockaddr_ll phy_addr;
+ /* Network device name */
+ char *netdev_name;
+
+ /* configuration */
+ uint32_t rf_port_index;
+ uint32_t rx_gain_db;
+ uint32_t tx_atten_db;
+
+ struct octphy_hdl *hdl;
+ } octphy;
+ } u;
+};
+
+struct phy_instance {
+ /* liked inside phy_link.linstances */
+ struct llist_head list;
+ int num;
+ char *description;
+
+ /* pointer to the PHY link to which we belong */
+ struct phy_link *phy_link;
+
+ /* back-pointer to the TRX to which we're associated */
+ struct gsm_bts_trx *trx;
+
+ union {
+ struct {
+ } sysmobts;
+ struct {
+ struct trx_l1h *hdl;
+ } osmotrx;
+ struct {
+ /* logical transceiver number within one PHY */
+ uint32_t trx_id;
+ } octphy;
+ } u;
+};
+
+struct phy_link *phy_link_by_num(int num);
+struct phy_link *phy_link_create(void *ctx, int num);
+void phy_link_destroy(struct phy_link *plink);
+void phy_link_state_set(struct phy_link *plink, enum phy_link_state state);
+int phy_links_open(void);
+
+struct phy_instance *phy_instance_by_num(struct phy_link *plink, int num);
+struct phy_instance *phy_instance_create(struct phy_link *plink, int num);
+void phy_instance_link_to_trx(struct phy_instance *pinst, struct gsm_bts_trx *trx);
+void phy_instance_destroy(struct phy_instance *pinst);
+const char *phy_instance_name(struct phy_instance *pinst);
+
+void phy_user_statechg_notif(struct phy_instance *pinst, enum phy_link_state link_state);
+
+static inline struct phy_instance *trx_phy_instance(struct gsm_bts_trx *trx)
+{
+ return trx->role_bts.l1h;
+}
+
+int bts_model_phy_link_open(struct phy_link *plink);
diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 13ef0511..b11e6f18 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -1,6 +1,8 @@
#ifndef TRX_SCHEDULER_H
#define TRX_SCHEDULER_H
+#include <osmo-bts/gsm_data.h>
+
/* These types define the different channels on a multiframe.
* Each channel has queues and can be activated individually.
*/
@@ -133,7 +135,7 @@ extern uint32_t transceiver_last_fn;
/*! \brief Initialize the scheudler data structures */
-int trx_sched_init(struct l1sched_trx *l1t);
+int trx_sched_init(struct l1sched_trx *l1t, struct gsm_bts_trx *trx);
/*! \brief De-initialize the scheudler data structures */
void trx_sched_exit(struct l1sched_trx *l1t);
diff --git a/include/osmo-bts/vty.h b/include/osmo-bts/vty.h
index 546729c0..5d8d4a73 100644
--- a/include/osmo-bts/vty.h
+++ b/include/osmo-bts/vty.h
@@ -5,7 +5,12 @@
#include <osmocom/vty/command.h>
enum bts_vty_node {
- BTS_NODE = _LAST_OSMOVTY_NODE + 1,
+ /* PHY_NODE must come before BTS node to ensure the phy
+ * instances are created at the time the TRX nodes want to refer
+ * to them */
+ PHY_NODE = _LAST_OSMOVTY_NODE + 1,
+ PHY_INST_NODE,
+ BTS_NODE,
TRX_NODE,
};