fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/28792 )


Change subject: fixup! trxcon: make l1sched logging configurable, use 
trxcon->fi as prefix
......................................................................

fixup! trxcon: make l1sched logging configurable, use trxcon->fi as prefix

Change-Id: I9efe808a2c96b1e16a76a488dbbb85f2f62f679a
---
M src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
M src/host/trxcon/include/osmocom/bb/l1sched/logging.h
M src/host/trxcon/src/sched_trx.c
M src/host/trxcon/src/trxcon.c
4 files changed, 23 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/92/28792/1

diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h 
b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
index 1719ff8..3c28f45 100644
--- a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
+++ b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
@@ -350,10 +350,6 @@
 struct l1sched_cfg {
        /*! Logging context (used as prefix for messages) */
        const char *log_prefix;
-       /*! Logging category for common messages */
-       int log_cat_common;
-       /*! Logging category for data messages */
-       int log_cat_data;
 };

 /*! One scheduler instance */
@@ -376,8 +372,8 @@
        struct l1sched_ts *ts[TRX_TS_COUNT];
        /*! BSIC value learned from SCH bursts */
        uint8_t bsic;
-       /*! Scheduler configuration */
-       struct l1sched_cfg cfg;
+       /*! Logging context (used as prefix for messages) */
+       const char *log_prefix;
        /*! Some private data */
        void *priv;
 };
@@ -387,6 +383,7 @@
        enum gsm_phys_chan_config config, int tn);

 /* Scheduler management functions */
+void l1sched_logging_init(int log_cat_common, int log_cat_data);
 struct l1sched_state *l1sched_alloc(void *ctx, const struct l1sched_cfg *cfg,
                                    uint32_t fn_advance, void *priv);
 void l1sched_reset(struct l1sched_state *sched, bool reset_clock);
diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/logging.h 
b/src/host/trxcon/include/osmocom/bb/l1sched/logging.h
index ac0818f..fb1c018 100644
--- a/src/host/trxcon/include/osmocom/bb/l1sched/logging.h
+++ b/src/host/trxcon/include/osmocom/bb/l1sched/logging.h
@@ -1,9 +1,12 @@
 #pragma once

+extern int l1sched_log_cat_common;
+extern int l1sched_log_cat_data;
+
 /* Messages using l1sched_state as the context */
 #define LOGP_SCHED_CAT(sched, cat, level, fmt, args...) \
-       LOGP((sched)->cfg.log_cat_##cat, level, "%s" fmt, \
-            (sched)->cfg.log_prefix, ## args)
+       LOGP(l1sched_log_cat_##cat, level, "%s" fmt, \
+            (sched)->log_prefix, ## args)

 /* Common messages using l1sched_state as the context */
 #define LOGP_SCHEDC(sched, level, fmt, args...) \
diff --git a/src/host/trxcon/src/sched_trx.c b/src/host/trxcon/src/sched_trx.c
index 2c42c81..d44c1ba 100644
--- a/src/host/trxcon/src/sched_trx.c
+++ b/src/host/trxcon/src/sched_trx.c
@@ -35,6 +35,10 @@
 #include <osmocom/bb/l1sched/l1sched.h>
 #include <osmocom/bb/l1sched/logging.h>

+/* Logging categories to be used for common/data messages */
+int l1sched_log_cat_common = DLGLOBAL;
+int l1sched_log_cat_data = DLGLOBAL;
+
 static int l1sched_cfg_pchan_comb_req(struct l1sched_state *sched,
                                      uint8_t tn, enum gsm_phys_chan_config 
pchan)
 {
@@ -150,6 +154,12 @@
                l1sched_handle_burst_req(sched, &br[tn]);
 }

+void l1sched_logging_init(int log_cat_common, int log_cat_data)
+{
+       l1sched_log_cat_common = log_cat_common;
+       l1sched_log_cat_data = log_cat_data;
+}
+
 struct l1sched_state *l1sched_alloc(void *ctx, const struct l1sched_cfg *cfg,
                                    uint32_t fn_advance, void *priv)
 {
@@ -164,11 +174,12 @@
                .clock_cb = &sched_frame_clck_cb,
                .fn_counter_advance = fn_advance,
                .priv = priv,
-               .cfg = *cfg,
        };

-       if (sched->cfg.log_prefix == NULL)
-               sched->cfg.log_prefix = "";
+       if (cfg->log_prefix == NULL)
+               sched->log_prefix = talloc_asprintf(sched, "l1sched[0x%p]: ", 
sched);
+       else
+               sched->log_prefix = talloc_strdup(sched, cfg->log_prefix);

        return sched;
 }
diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c
index 374b8b2..86d4c49 100644
--- a/src/host/trxcon/src/trxcon.c
+++ b/src/host/trxcon/src/trxcon.c
@@ -349,8 +349,6 @@
        /* Init scheduler */
        const struct l1sched_cfg sched_cfg = {
                .log_prefix = trxcon->log_prefix,
-               .log_cat_common = DSCH,
-               .log_cat_data = DSCHD,
        };
 
        trxcon->sched = l1sched_alloc(trxcon, &sched_cfg, 
app_data.trx_fn_advance, trxcon);
@@ -539,6 +537,7 @@

        /* Init logging system */
        trx_log_init(tall_trxcon_ctx, app_data.debug_mask);
+       l1sched_logging_init(DSCH, DSCHD);

        /* Configure pretty logging */
        log_set_print_extended_timestamp(osmo_stderr_target, 1);

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/28792
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I9efe808a2c96b1e16a76a488dbbb85f2f62f679a
Gerrit-Change-Number: 28792
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to