<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">Sorry, I had assumed, that in OsmoBTS, this L1 SAPI logging would<br>only be relevant for the BTS<-->PCU socket, and therefore thought<br>the appropriate log context would be what is defined with<br>PCU_IF_SAPI_*.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">I wonder where that impression was raised? The L1 is not used only by the PCU,<br>but by all of OsmoBTS.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">I ran "git grep SAPI" in osmo-bts.git, and got the most matches inside the common dir in pcu_sock.c. But I know now, that I should have researched it better.</p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><ul><li>set the log context in other places in OSmoBTS, that are not</li><li>related to the PCU (that must be the other side, when talking to</li><li>hardware backends)</li></ul></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">You need to set that value for every L1P (and possibly L1C?) primitive received from the<br>respective PHY, as soon as possible.  That's for the uplink part.  For downlink, I<br>suspect it's sufficient to set it based on chan_nr when received from L1SAP.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">What I'm still struggling with is, how one should extract the L1 SAPI value from every L1P/L1C primitive. With "as soon as possible" you could either mean in the code of the various PHYs or in common/l1sap.c's l1sap_up() function (because that is the first time, the primitive is passed to the common code).</p><p style="white-space: pre-wrap; word-wrap: break-word;">But there is only a "struct osmo_phsap_prim", which does not seem to have the SAPI attached to it. The only relation to the SAPI I can find, is in the "to_gsmtap" function, which gets called in l1sap_up() for *some* types of primitives (but not all of them! so it does not seem suitable for logging?). The to_gsmtap() function then runs one of gsmtap_pdch(), gsmtap_ph_data() or gsmtap_ph_rach(), which in turn set the chan_type variable, and this seems to be the SAPI (as its value comes from gsmtap_sapi_names).</p><p style="white-space: pre-wrap; word-wrap: break-word;">So I'm wondering, what is the best way to go forward with this? Modify (and rename) the to_gsmtap function to also set the SAPI log context? (but then what about the cases where to_gsmtap is not called, are they simply irrelevant for setting the log context?)</p><p style="white-space: pre-wrap; word-wrap: break-word;">Or am I missing something and there is a feasible way to read the SAPI from the osmo_phsap_prim?</p><p style="white-space: pre-wrap; word-wrap: break-word;">Thanks!</p><p style="white-space: pre-wrap; word-wrap: break-word;">(Voting with -2 and removing WIP state, because otherwise no mail notifications get sent.)</p><p>Patch set 4:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -2</span></p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/15539">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/15539">change 15539</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/15539"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I6b7bb2e1d61502b61214f854a4ec5cbb7267545b </div>
<div style="display:none"> Gerrit-Change-Number: 15539 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 24 Sep 2019 11:59:35 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>