Harald Welte has submitted this change and it was merged.

Change subject: VIRT-PHY: Enable multiple phy-instances by configurable 
l1ctl-sock-path.
......................................................................


VIRT-PHY: Enable multiple phy-instances by configurable l1ctl-sock-path.

Change-Id: Ief22eedacd1929450ff68f553068b95a778df80f
---
M src/host/virt_phy/include/virtphy/l1ctl_sock.h
M src/host/virt_phy/src/l1ctl_sap.c
M src/host/virt_phy/src/l1ctl_sock.c
M src/host/virt_phy/src/virtphy.c
4 files changed, 15 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/host/virt_phy/include/virtphy/l1ctl_sock.h 
b/src/host/virt_phy/include/virtphy/l1ctl_sock.h
index ef9799c..8c96dc8 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 3be6b9d..b89d963 100644
--- a/src/host/virt_phy/src/l1ctl_sap.c
+++ b/src/host/virt_phy/src/l1ctl_sap.c
@@ -74,10 +74,7 @@
        /* 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 5e0ba43..c28da60 100644
--- a/src/host/virt_phy/src/l1ctl_sock.c
+++ b/src/host/virt_phy/src/l1ctl_sock.c
@@ -163,6 +163,7 @@
        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 5007146..977a358 100644
--- a/src/host/virt_phy/src/virtphy.c
+++ b/src/host/virt_phy/src/virtphy.c
@@ -12,10 +12,18 @@
 #include <virtphy/gsmtapl1_if.h>
 #include <virtphy/logging.h>
 
-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 @@
        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)

-- 
To view, visit https://gerrit.osmocom.org/3201
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief22eedacd1929450ff68f553068b95a778df80f
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: BastusIII <sebastian.stump...@googlemail.com>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to