From 5490fa9097efeeb13529ebf30c50afd001ea9e0c Mon Sep 17 00:00:00 2001 From: Sebastian Stumpf Date: Thu, 9 Feb 2017 17:59:54 +0100 Subject: VIRT-PHY: Enable multiple phy-instances by configurable l1ctl-sock-path. Change-Id: Ief22eedacd1929450ff68f553068b95a778df80f --- src/host/virt_phy/include/virtphy/l1ctl_sock.h | 1 + src/host/virt_phy/src/l1ctl_sap.c | 5 +---- src/host/virt_phy/src/l1ctl_sock.c | 1 + src/host/virt_phy/src/virtphy.c | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/host/virt_phy') diff --git a/src/host/virt_phy/include/virtphy/l1ctl_sock.h b/src/host/virt_phy/include/virtphy/l1ctl_sock.h index ef9799c2..8c96dc89 100644 --- a/src/host/virt_phy/include/virtphy/l1ctl_sock.h +++ b/src/host/virt_phy/include/virtphy/l1ctl_sock.h @@ -9,6 +9,7 @@ struct l1ctl_sock_inst { void *priv; /* Will be appended after osmo-fd's data pointer. */ struct osmo_fd connection; /* L1CTL connection to l2 app */ + char* l1ctl_sock_path; /* Socket path used to connect to l23 */ struct osmo_fd ofd; /* Osmocom file descriptor to accept L1CTL connections. */ void (*recv_cb)(struct l1ctl_sock_inst *vui, struct msgb *msg); /* Callback function called for incoming data from l2 app. */ }; diff --git a/src/host/virt_phy/src/l1ctl_sap.c b/src/host/virt_phy/src/l1ctl_sap.c index 3be6b9d2..b89d963c 100644 --- a/src/host/virt_phy/src/l1ctl_sap.c +++ b/src/host/virt_phy/src/l1ctl_sap.c @@ -74,10 +74,7 @@ void l1ctl_sap_tx_to_l23_inst(struct l1ctl_sock_inst *lsi, struct msgb *msg) /* prepend 16bit length before sending */ len = (uint16_t *)msgb_push(msg, sizeof(*len)); *len = htons(msg->len - sizeof(*len)); - - if (l1ctl_sock_write_msg(lsi, msg) == -1) { - DEBUGP(DL1C, "Error writing to layer2 socket"); - } + l1ctl_sock_write_msg(lsi, msg); } /** diff --git a/src/host/virt_phy/src/l1ctl_sock.c b/src/host/virt_phy/src/l1ctl_sock.c index 5e0ba43f..c28da607 100644 --- a/src/host/virt_phy/src/l1ctl_sock.c +++ b/src/host/virt_phy/src/l1ctl_sock.c @@ -163,6 +163,7 @@ struct l1ctl_sock_inst *l1ctl_sock_init( lsi->ofd.cb = l1ctl_sock_accept_cb; // no connection -> invalid filedescriptor and not 0 (==std_in) lsi->connection.fd = -1; + lsi->l1ctl_sock_path = path; osmo_fd_register(&lsi->ofd); diff --git a/src/host/virt_phy/src/virtphy.c b/src/host/virt_phy/src/virtphy.c index 5007146b..977a3589 100644 --- a/src/host/virt_phy/src/virtphy.c +++ b/src/host/virt_phy/src/virtphy.c @@ -12,10 +12,18 @@ #include #include -int main(void) +int main( int argc, char *argv[] ) { // init loginfo static struct l1_model_ms *model; + char * l1ctl_sock_path = NULL; + + // get path from commandline argument + if( argc > 1 ) { + l1ctl_sock_path = argv[1]; + } + + //ms_log_init("DL1C,1:DVIRPHY,1"); ms_log_init("DL1C,1"); //ms_log_init("DL1C,8:DVIRPHY,8"); @@ -28,12 +36,13 @@ int main(void) model->vui = virt_um_init(NULL, DEFAULT_BTS_MCAST_GROUP, DEFAULT_BTS_MCAST_PORT, DEFAULT_MS_MCAST_GROUP, DEFAULT_MS_MCAST_PORT, gsmtapl1_rx_from_virt_um_inst_cb); - model->lsi = l1ctl_sock_init(NULL, l1ctl_sap_rx_from_l23_inst_cb, NULL); + model->lsi = l1ctl_sock_init(NULL, l1ctl_sap_rx_from_l23_inst_cb, l1ctl_sock_path); gsmtapl1_init(model); l1ctl_sap_init(model); - LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer ready...\n"); + LOGP(DVIRPHY, LOGL_INFO, "Virtual physical layer ready...\n \ + Waiting for l23 app on", l1ctl_sock_path); while (1) { // handle osmocom fd READ events (l1ctl-unix-socket, virtual-um-mcast-socket) -- cgit v1.2.3