Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/7876

to look at the new patch set (#2).

osmux: Move examples and tests to use new output APIs

Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
---
M examples/osmux-test-output.c
M tests/jibuf/jibuf_tool.c
M tests/osmo-pcap-test/osmux_test.c
M tests/osmux/osmux_test.c
4 files changed, 12 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/76/7876/2

diff --git a/examples/osmux-test-output.c b/examples/osmux-test-output.c
index 9b7c113..22e60af 100644
--- a/examples/osmux-test-output.c
+++ b/examples/osmux-test-output.c
@@ -88,7 +88,6 @@
 {
        struct msgb *msg;
         struct osmux_hdr *osmuxh;
-       struct llist_head list;
 
        LOGP(DOSMUX_TEST, LOGL_DEBUG, "received message from datagram\n");
 
@@ -107,10 +106,8 @@
        LOGP(DOSMUX_TEST, LOGL_DEBUG, "received OSMUX message (len=%d) %s\n",
                msg->len, buf);
 
-       while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) {
-               osmux_xfrm_output(osmuxh, &h_output, &list);
-               osmux_tx_sched(&list, tx_cb, NULL);
-       }
+       while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL)
+               osmux_xfrm_output_sched(&h_output, osmuxh);
 
        return 0;
 }
@@ -158,7 +155,7 @@
         * initialize OSMUX handlers.
         */
        osmux_xfrm_output_init(&h_output, random());
-
+       osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
        /*
         * initialize datagram server.
         */
diff --git a/tests/jibuf/jibuf_tool.c b/tests/jibuf/jibuf_tool.c
index 8fa9f2e..c60bb69 100644
--- a/tests/jibuf/jibuf_tool.c
+++ b/tests/jibuf/jibuf_tool.c
@@ -114,7 +114,6 @@
 static struct osmo_pcap osmo_pcap;
 static bool pcap_finished;
 static struct osmux_out_handle pcap_osmux_h;
-static struct llist_head osmux_list;
 /* ----------------------------- */
 
 static void sigalarm_handler(int foo)
@@ -438,10 +437,8 @@
        struct osmux_hdr *osmuxh;
 
        /* This code below belongs to the osmux receiver */
-       while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL) {
-               osmux_xfrm_output(osmuxh, &pcap_osmux_h, &osmux_list);
-               osmux_tx_sched(&osmux_list, glue_cb, NULL);
-       }
+       while((osmuxh = osmux_xfrm_output_pull(msg)) != NULL)
+               osmux_xfrm_output_sched(&pcap_osmux_h, osmuxh);
        msgb_free(msg);
        return 0;
 }
@@ -520,8 +517,8 @@
        osmo_pcap.timer.cb = pcap_pkt_timer_cb;
 
        if(opt_osmux) {
-               INIT_LLIST_HEAD(&osmux_list);
                osmux_xfrm_output_init(&pcap_osmux_h, 0);
+               osmux_xfrm_output_set_tx_cb(&pcap_osmux_h, glue_cb, NULL);
        }
 
        jb = osmo_jibuf_alloc(NULL);
diff --git a/tests/osmo-pcap-test/osmux_test.c 
b/tests/osmo-pcap-test/osmux_test.c
index 463b212..7ec78a0 100644
--- a/tests/osmo-pcap-test/osmux_test.c
+++ b/tests/osmo-pcap-test/osmux_test.c
@@ -52,16 +52,12 @@
 static void deliver(struct msgb *batch_msg)
 {
        struct osmux_hdr *osmuxh;
-       struct llist_head list;
 
        printf("sending batch (len=%d) [emulated]\n", batch_msg->len);
 
        /* This code below belongs to the osmux receiver */
-       while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) {
-
-               osmux_xfrm_output(osmuxh, &h_output, &list);
-               osmux_tx_sched(&list, tx_cb, NULL);
-       }
+       while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL)
+               osmux_xfrm_output_sched(&h_output, osmuxh);
        msgb_free(batch_msg);
 }
 
@@ -194,6 +190,7 @@
 
        osmux_xfrm_input_init(&h_input);
        osmux_xfrm_output_init(&h_output);
+       osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 
        /* first run */
        osmo_pcap_pkt_timer_cb(NULL);
diff --git a/tests/osmux/osmux_test.c b/tests/osmux/osmux_test.c
index 631ade8..704ccbc 100644
--- a/tests/osmux/osmux_test.c
+++ b/tests/osmux/osmux_test.c
@@ -103,7 +103,6 @@
 static void osmux_deliver(struct msgb *batch_msg, void *data)
 {
        struct osmux_hdr *osmuxh;
-       LLIST_HEAD(list);
        char buf[2048];
 
        osmux_snprintf(buf, sizeof(buf), batch_msg);
@@ -112,10 +111,8 @@
        /* For each OSMUX message, extract the RTP messages and put them
         * in a list. Then, reconstruct transmission timing.
         */
-       while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL) {
-               osmux_xfrm_output(osmuxh, &h_output, &list);
-               osmux_tx_sched(&list, tx_cb, NULL);
-       }
+       while((osmuxh = osmux_xfrm_output_pull(batch_msg)) != NULL)
+               osmux_xfrm_output_sched(&h_output, osmuxh);
        msgb_free(batch_msg);
 }
 
@@ -273,6 +270,7 @@
        log_set_log_level(osmo_stderr_target, LOGL_DEBUG);
 
        osmux_xfrm_output_init(&h_output, 0x7000000);
+       osmux_xfrm_output_set_tx_cb(&h_output, tx_cb, NULL);
 
        /* If the test takes longer than 10 seconds, abort it */
        alarm(10);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie69c427308eb7d81aedab7fbb71f1bdaf43f0275
Gerrit-PatchSet: 2
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to