This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/18646 )
Change subject: bts-trx: phy_link: Improve logging fmt in phy_link_state_set()
......................................................................
bts-trx: phy_link: Improve logging fmt in phy_link_state_set()
Change-Id: I4633dd81d0b4cc104ca9e0803993ba766cb23790
---
M include/osmo-bts/phy_link.h
M src/common/phy_link.c
2 files changed, 16 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/46/18646/1
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index cf877bd..2bed8ea 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -157,6 +157,7 @@
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);
+const char *phy_link_name(struct phy_link *plink);
void phy_link_state_set(struct phy_link *plink, enum phy_link_state state);
enum phy_link_state phy_link_state_get(struct phy_link *plink);
const char *phy_link_state_name(enum phy_link_state state);
@@ -178,4 +179,5 @@
int bts_model_phy_link_open(struct phy_link *plink);
+#define LOGPPHL(plink, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_link_name(plink), ##args)
#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)
diff --git a/src/common/phy_link.c b/src/common/phy_link.c
index 85f9e14..b5055a5 100644
--- a/src/common/phy_link.c
+++ b/src/common/phy_link.c
@@ -53,9 +53,9 @@
{
struct phy_instance *pinst;
- LOGP(DL1C, LOGL_INFO, "PHY link state change %s -> %s\n",
- get_value_string(phy_link_state_vals, plink->state),
- get_value_string(phy_link_state_vals, state));
+ LOGPPHL(plink, DL1C, LOGL_INFO, "PHY link state change %s -> %s\n",
+ get_value_string(phy_link_state_vals, plink->state),
+ get_value_string(phy_link_state_vals, state));
/* notify all TRX associated with this phy */
llist_for_each_entry(pinst, &plink->instances, list) {
@@ -65,11 +65,11 @@
switch (state) {
case PHY_LINK_CONNECTED:
- LOGP(DL1C, LOGL_INFO, "trx_set_avail(1)\n");
+ LOGPPHI(pinst, DL1C, LOGL_INFO, "trx_set_avail(1)\n");
trx_set_available(trx, 1);
break;
case PHY_LINK_SHUTDOWN:
- LOGP(DL1C, LOGL_INFO, "trx_set_avail(0)\n");
+ LOGPPHI(pinst, DL1C, LOGL_INFO, "trx_set_avail(0)\n");
trx_set_available(trx, 0);
break;
case PHY_LINK_CONNECTING:
@@ -148,6 +148,13 @@
talloc_free(plink);
}
+static char name_buf[32];
+const char *phy_link_name(struct phy_link *plink)
+{
+ snprintf(name_buf, sizeof(name_buf), "phy%u", plink->num);
+ return name_buf;
+}
+
int phy_links_open(void)
{
struct phy_link *plink;
@@ -165,9 +172,7 @@
const char *phy_instance_name(struct phy_instance *pinst)
{
- static char buf[32];
-
- snprintf(buf, sizeof(buf), "phy%u.%u", pinst->phy_link->num,
+ snprintf(name_buf, sizeof(name_buf), "phy%u.%u", pinst->phy_link->num,
pinst->num);
- return buf;
+ return name_buf;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18646
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I4633dd81d0b4cc104ca9e0803993ba766cb23790
Gerrit-Change-Number: 18646
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200603/78b01c2f/attachment.htm>