Change in osmo-bts[master]: vty: add "logging filter l1-sapi"
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 7: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 7 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Thu, 17 Oct 2019 08:04:25 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-bts[master]: vty: add "logging filter l1-sapi"
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. vty: add "logging filter l1-sapi" Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 --- M src/common/logging.c M src/common/vty.c 2 files changed, 70 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/logging.c b/src/common/logging.c index 3315a01..8340736 100644 --- a/src/common/logging.c +++ b/src/common/logging.c @@ -144,7 +144,21 @@ }, }; +static int osmo_bts_filter_fn(const struct log_context *ctx, struct log_target *tgt) +{ + uint8_t *sapi = ctx->ctx[LOG_CTX_L1_SAPI]; + uint16_t *sapi_mask = tgt->filter_data[LOG_FLT_L1_SAPI]; + + if ((tgt->filter_map & (1 << LOG_FLT_L1_SAPI)) != 0 + && sapi_mask && sapi + && (*sapi_mask & (1 << *sapi)) != 0) + return 1; + + return 0; +} + const struct log_info bts_log_info = { + .filter_fn = osmo_bts_filter_fn, .cat = bts_log_info_cat, .num_cat = ARRAY_SIZE(bts_log_info_cat), }; diff --git a/src/common/vty.c b/src/common/vty.c index 801f34c..865c236 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -1600,6 +1601,45 @@ return CMD_SUCCESS; } +DEFUN(logging_fltr_l1_sapi, logging_fltr_l1_sapi_cmd, "HIDDEN", "HIDDEN") +{ + uint8_t sapi = get_string_value(l1sap_common_sapi_names, argv[0]); + struct log_target *tgt = osmo_log_vty2tgt(vty); + uint16_t **sapi_mask; + + OSMO_ASSERT(sapi != -EINVAL); + if (!tgt) + return CMD_WARNING; + + sapi_mask = (uint16_t **)>filter_data[LOG_FLT_L1_SAPI]; + + if (!*sapi_mask) + *sapi_mask = talloc(tgt, uint16_t); + + **sapi_mask |= (1 << sapi); + tgt->filter_map |= (1 << LOG_FLT_L1_SAPI); + + return CMD_SUCCESS; +} + +DEFUN(no_logging_fltr_l1_sapi, no_logging_fltr_l1_sapi_cmd, "HIDDEN", "HIDDEN") +{ + uint8_t sapi = get_string_value(l1sap_common_sapi_names, argv[0]); + struct log_target *tgt = osmo_log_vty2tgt(vty); + uint16_t *sapi_mask; + + OSMO_ASSERT(sapi != -EINVAL); + if (!tgt) + return CMD_WARNING; + if (!tgt->filter_data[LOG_FLT_L1_SAPI]) + return CMD_SUCCESS; + + sapi_mask = (uint16_t *)tgt->filter_data[LOG_FLT_L1_SAPI]; + *sapi_mask &= ~(1 << sapi); + + return CMD_SUCCESS; +} + int bts_vty_init(struct gsm_bts *bts) { cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names, @@ -1616,11 +1656,27 @@ NO_STR "GSMTAP SAPI\n", "\n", "", 0); + logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names, + "logging filter l1-sapi (", + "|", ")", VTY_DO_LOWER); + logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names, + LOGGING_STR FILTER_STR "L1 SAPI\n", + "\n", "", 0); + + no_logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names, + "no logging filter l1-sapi (", + "|", ")", VTY_DO_LOWER); + no_logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names, + NO_STR LOGGING_STR FILTER_STR "L1 SAPI\n", + "\n", "", 0); + install_element_ve(_bts_cmd); install_element_ve(_trx_cmd); install_element_ve(_ts_cmd); install_element_ve(_lchan_cmd); install_element_ve(_lchan_summary_cmd); + install_element_ve(_fltr_l1_sapi_cmd); + install_element_ve(_logging_fltr_l1_sapi_cmd); logging_vty_add_cmds(); osmo_talloc_vty_add_cmds(); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 8 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer:
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 5 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 09 Oct 2019 16:48:59 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
Hello neels, laforge, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 to look at the new patch set (#5). Change subject: vty: add "logging filter l1-sapi" .. vty: add "logging filter l1-sapi" Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 --- M src/common/logging.c M src/common/vty.c 2 files changed, 70 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/15550/5 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 5 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-MessageType: newpatchset
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 4 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Sat, 28 Sep 2019 10:46:08 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 4: (1 comment) This change is ready for review. https://gerrit.osmocom.org/#/c/15550/3/src/common/vty.c File src/common/vty.c: https://gerrit.osmocom.org/#/c/15550/3/src/common/vty.c@1606 PS3, Line 1606: #define L1_SAPI_CMD_STR "logging filter l1-sapi (rach|agch|pch|bcch|pdtch|prach|ptcch|agch_dt)" > this probably needs updating? Also, the string names can actually be > generated, as you already have […] Done -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 4 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Fri, 27 Sep 2019 13:35:08 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
Hello neels, laforge, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 to look at the new patch set (#3). Change subject: vty: add "logging filter l1-sapi" .. vty: add "logging filter l1-sapi" Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Test: (osmo-ttcn3-hacks) I8c7f113eae7a93c6d4943cac9e3f49f153b323b1 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 --- M src/common/logging.c M src/common/vty.c 2 files changed, 77 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/15550/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 3 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-MessageType: newpatchset
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/15550/2/src/common/logging.c File src/common/logging.c: https://gerrit.osmocom.org/#/c/15550/2/src/common/logging.c@32 PS2, Line 32: #include > do we need this include? We don't, removed. -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 2 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 18 Sep 2019 08:19:12 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 2: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/15550/2/src/common/logging.c File src/common/logging.c: https://gerrit.osmocom.org/#/c/15550/2/src/common/logging.c@32 PS2, Line 32: #include do we need this include? -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 2 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 18 Sep 2019 08:13:18 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 2: (2 comments) https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c File src/common/vty.c: https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c@1607 PS1, Line 1607: uint16_t parse_l1_sapi_str(const char *sapi) { > there is a sapi_string[] in pcu_sock.c ... it is uppercase though. […] Done https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c@1640 PS1, Line 1640: *sapi_mask = talloc(tgt, uint16_t); > initially I was sure that this was a memleak; instead: kudos for getting this > right. yay, thanks :D -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 2 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-Reviewer: osmith Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 18 Sep 2019 07:48:36 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Comment-In-Reply-To: neels Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
Hello neels, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 to look at the new patch set (#2). Change subject: vty: add "logging filter l1-sapi" .. vty: add "logging filter l1-sapi" Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Test: (osmo-ttcn3-hacks) I8c7f113eae7a93c6d4943cac9e3f49f153b323b1 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 --- M src/common/logging.c M src/common/vty.c 2 files changed, 78 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/15550/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 2 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-MessageType: newpatchset
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 1: Code-Review+1 (2 comments) https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c File src/common/vty.c: https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c@1607 PS1, Line 1607: uint16_t parse_l1_sapi_str(const char *sapi) { > Looks like you want a value_string here instead of this if+else. there is a sapi_string[] in pcu_sock.c ... it is uppercase though. So you need a new value_string array and then use get_string_value() to get the value for a string. An unknown string will return -EINVAL; to be sure it can't hurt to wrap the get_string_value() and OSMO_ASSERT(val != -EINVAL) https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c@1640 PS1, Line 1640: *sapi_mask = talloc(tgt, uint16_t); initially I was sure that this was a memleak; instead: kudos for getting this right. -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 1 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels Gerrit-CC: pespin Gerrit-Comment-Date: Wed, 18 Sep 2019 01:04:59 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: pespin Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 ) Change subject: vty: add "logging filter l1-sapi" .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c File src/common/vty.c: https://gerrit.osmocom.org/#/c/15550/1/src/common/vty.c@1607 PS1, Line 1607: uint16_t parse_l1_sapi_str(const char *sapi) { Looks like you want a value_string here instead of this if+else. -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 1 Gerrit-Owner: osmith Gerrit-Reviewer: Jenkins Builder Gerrit-CC: pespin Gerrit-Comment-Date: Tue, 17 Sep 2019 15:29:43 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
Change in ...osmo-bts[master]: vty: add "logging filter l1-sapi"
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/15550 Change subject: vty: add "logging filter l1-sapi" .. vty: add "logging filter l1-sapi" Add VTY commands to filter by L1 SAPI. Allow to filter by multiple SAPIs by running the filter command multiple times: OsmoBTS> logging filter l1-sapi agch OsmoBTS> logging filter l1-sapi pch Related: OS#2356 Test: (osmo-ttcn3-hacks) I8c7f113eae7a93c6d4943cac9e3f49f153b323b1 Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 --- M src/common/vty.c 1 file changed, 66 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/50/15550/1 diff --git a/src/common/vty.c b/src/common/vty.c index 801f34c..842a9e7 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1600,6 +1600,70 @@ return CMD_SUCCESS; } +#define L1_SAPI_STR "Filter log messages by L1 SAPI\n" +#define L1_SAPI_ARG_STR "L1 SAPI to be used as filter\n" +#define L1_SAPI_CMD_STR "logging filter l1-sapi (rach|agch|pch|bcch|pdtch|prach|ptcch|agch_dt)" + +uint16_t parse_l1_sapi_str(const char *sapi) { + if (!strcmp(sapi, "rach")) + return PCU_IF_SAPI_RACH; + else if (!strcmp(sapi, "agch")) + return PCU_IF_SAPI_AGCH; + else if (!strcmp(sapi, "pch")) + return PCU_IF_SAPI_PCH; + else if (!strcmp(sapi, "bcch")) + return PCU_IF_SAPI_BCCH; + else if (!strcmp(sapi, "pdtch")) + return PCU_IF_SAPI_PDTCH; + else if (!strcmp(sapi, "prach")) + return PCU_IF_SAPI_PRACH; + else if (!strcmp(sapi, "ptcch")) + return PCU_IF_SAPI_PTCCH; + else if (!strcmp(sapi, "agch_dt")) + return PCU_IF_SAPI_AGCH_DT; + return 0; +} + +DEFUN(logging_fltr_l1_sapi, + logging_fltr_l1_sapi_cmd, + L1_SAPI_CMD_STR, + LOGGING_STR FILTER_STR L1_SAPI_STR L1_SAPI_ARG_STR) +{ + struct log_target *tgt = osmo_log_vty2tgt(vty); + uint16_t **sapi_mask; + + if (!tgt) + return CMD_WARNING; + + sapi_mask = (uint16_t **)>filter_data[LOG_FLT_L1_SAPI]; + if (!*sapi_mask) + *sapi_mask = talloc(tgt, uint16_t); + + **sapi_mask |= (1 << parse_l1_sapi_str(argv[0])); + tgt->filter_map |= (1 << LOG_FLT_L1_SAPI); + + return CMD_SUCCESS; +} + +DEFUN(no_logging_fltr_l1_sapi, + no_logging_fltr_l1_sapi_cmd, + "no " L1_SAPI_CMD_STR, + NO_STR LOGGING_STR FILTER_STR L1_SAPI_STR L1_SAPI_ARG_STR) +{ + struct log_target *tgt = osmo_log_vty2tgt(vty); + uint16_t *sapi_mask; + + if (!tgt) + return CMD_WARNING; + if (!tgt->filter_data[LOG_FLT_L1_SAPI]) + return CMD_SUCCESS; + + sapi_mask = (uint16_t *)tgt->filter_data[LOG_FLT_L1_SAPI]; + *sapi_mask &= ~(1 << parse_l1_sapi_str(argv[0])); + + return CMD_SUCCESS; +} + int bts_vty_init(struct gsm_bts *bts) { cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names, @@ -1621,6 +1685,8 @@ install_element_ve(_ts_cmd); install_element_ve(_lchan_cmd); install_element_ve(_lchan_summary_cmd); + install_element_ve(_fltr_l1_sapi_cmd); + install_element_ve(_logging_fltr_l1_sapi_cmd); logging_vty_add_cmds(); osmo_talloc_vty_add_cmds(); -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15550 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I32d86d3d34757135b4cce59919c2fc2b67f0a889 Gerrit-Change-Number: 15550 Gerrit-PatchSet: 1 Gerrit-Owner: osmith Gerrit-MessageType: newchange