<p>laforge <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/15420">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pcu_interface: Forward ETWS Primary Notification to PCU<br><br>All MS/UE must be notified of ETWS Primary Notifiations.<br><br>Depending on their state, the notification goes different paths:<br>* CS dedicated mode: BSC sends it as L3 message over LAPDm / DCCH<br>* CS/PS idle mode: BTS sends paging messages on PCH<br>* PS TBF active: PCU send Packet Application Info<br><br>This enables the last of the three methods by passing any<br>ETWS Primary Notifications received over RSL via the PCU socket into<br>the PCU.<br><br>Change-Id: Ic0b3f38b400a0ca7e4089061ceb6548b0695faa6<br>Related: OS#4047, OS#4048<br>---<br>M include/osmo-bts/pcu_if.h<br>M include/osmo-bts/pcuif_proto.h<br>M src/common/pcu_sock.c<br>M src/common/rsl.c<br>4 files changed, 36 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h</span><br><span>index 6253c84..114f87d 100644</span><br><span>--- a/include/osmo-bts/pcu_if.h</span><br><span>+++ b/include/osmo-bts/pcu_if.h</span><br><span>@@ -5,6 +5,7 @@</span><br><span> </span><br><span> int pcu_tx_info_ind(void);</span><br><span> int pcu_tx_si13(const struct gsm_bts *bts, bool enable);</span><br><span style="color: hsl(120, 100%, 40%);">+int pcu_tx_app_info_req(struct gsm_bts *bts, uint8_t app_type, uint8_t len, const uint8_t *app_data);</span><br><span> int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,</span><br><span>      uint16_t arfcn, uint8_t block_nr);</span><br><span> int pcu_tx_data_ind(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,</span><br><span>diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h</span><br><span>index 144fba6..2d24c43 100644</span><br><span>--- a/include/osmo-bts/pcuif_proto.h</span><br><span>+++ b/include/osmo-bts/pcuif_proto.h</span><br><span>@@ -13,6 +13,7 @@</span><br><span> #define PCU_IF_MSG_DATA_CNF     0x01    /* confirm (e.g. transmission on PCH) */</span><br><span> #define PCU_IF_MSG_DATA_IND 0x02    /* receive data from given channel */</span><br><span> #define PCU_IF_MSG_SUSP_REQ    0x03    /* BTS forwards GPRS SUSP REQ to PCU */</span><br><span style="color: hsl(120, 100%, 40%);">+#define PCU_IF_MSG_APP_INFO_REQ        0x04    /* BTS asks PCU to tranmit APP INFO via PACCH */</span><br><span> #define PCU_IF_MSG_RTS_REQ  0x10    /* ready to send request */</span><br><span> #define PCU_IF_MSG_DATA_CNF_DT   0x11    /* confirm (with direct tlli) */</span><br><span> #define PCU_IF_MSG_RACH_IND 0x22    /* receive RACH */</span><br><span>@@ -172,6 +173,13 @@</span><br><span>    uint8_t         identity_lv[9];</span><br><span> } __attribute__ ((packed));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* BTS tells PCU to [once] send given application data via PACCH to all UE with active TBF */</span><br><span style="color: hsl(120, 100%, 40%);">+struct gsm_pcu_if_app_info_req {</span><br><span style="color: hsl(120, 100%, 40%);">+   uint8_t         application_type; /* 4bit field, see TS 44.060 11.2.47 */</span><br><span style="color: hsl(120, 100%, 40%);">+     uint8_t         len;              /* length of data */</span><br><span style="color: hsl(120, 100%, 40%);">+        uint8_t         data[162];        /* random size choice; ETWS needs 56 bytes */</span><br><span style="color: hsl(120, 100%, 40%);">+} __attribute__ ((packed));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* BTS tells PCU about a GPRS SUSPENSION REQUEST received on DCCH */</span><br><span> struct gsm_pcu_if_susp_req {</span><br><span>       uint32_t        tlli;</span><br><span>@@ -198,6 +206,7 @@</span><br><span>          struct gsm_pcu_if_act_req       act_req;</span><br><span>             struct gsm_pcu_if_time_ind      time_ind;</span><br><span>            struct gsm_pcu_if_pag_req       pag_req;</span><br><span style="color: hsl(120, 100%, 40%);">+              struct gsm_pcu_if_app_info_req  app_info_req;</span><br><span>        } u;</span><br><span> } __attribute__ ((packed));</span><br><span> </span><br><span>diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c</span><br><span>index 84a98f5..ba9e172 100644</span><br><span>--- a/src/common/pcu_sock.c</span><br><span>+++ b/src/common/pcu_sock.c</span><br><span>@@ -290,6 +290,27 @@</span><br><span>      return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+int pcu_tx_app_info_req(struct gsm_bts *bts, uint8_t app_type, uint8_t len, const uint8_t *app_data)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   struct gsm_pcu_if_app_info_req *ai_req;</span><br><span style="color: hsl(120, 100%, 40%);">+       struct gsm_pcu_if *pcu_prim;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct msgb *msg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   if (app_type & 0xF0 || len > sizeof(ai_req->data))</span><br><span style="color: hsl(120, 100%, 40%);">+          return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     msg = pcu_msgb_alloc(PCU_IF_MSG_APP_INFO_REQ, bts->nr);</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!msg)</span><br><span style="color: hsl(120, 100%, 40%);">+             return -ENOMEM;</span><br><span style="color: hsl(120, 100%, 40%);">+       pcu_prim = (struct gsm_pcu_if *) msg->data;</span><br><span style="color: hsl(120, 100%, 40%);">+        ai_req = &pcu_prim->u.app_info_req;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  ai_req->application_type = app_type;</span><br><span style="color: hsl(120, 100%, 40%);">+       ai_req->len = len;</span><br><span style="color: hsl(120, 100%, 40%);">+ memcpy(ai_req->data, app_data, ai_req->len);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  return pcu_sock_send(&bts_gsmnet, msg);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span> </span><br><span> int pcu_tx_rts_req(struct gsm_bts_trx_ts *ts, uint8_t is_ptcch, uint32_t fn,</span><br><span>   uint16_t arfcn, uint8_t block_nr)</span><br><span>diff --git a/src/common/rsl.c b/src/common/rsl.c</span><br><span>index 0bcad4c..056c16d 100644</span><br><span>--- a/src/common/rsl.c</span><br><span>+++ b/src/common/rsl.c</span><br><span>@@ -558,6 +558,11 @@</span><br><span> </span><br><span>            /* toggle the PNI to allow phones to distinguish new from old primary notification */</span><br><span>                bts->etws.pni = !bts->etws.pni;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+               /* forward the request to the PCU, so the PCU can send it over any active TBF</span><br><span style="color: hsl(120, 100%, 40%);">+          * to phones which currently don't listen to the paging channel */</span><br><span style="color: hsl(120, 100%, 40%);">+                pcu_tx_app_info_req(bts, 0, TLVP_LEN(&tp, RSL_IE_SMSCB_MSG),</span><br><span style="color: hsl(120, 100%, 40%);">+                                  TLVP_VAL(&tp, RSL_IE_SMSCB_MSG));</span><br><span>    }</span><br><span>    return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/15420">change 15420</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/+/15420"/><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: Ic0b3f38b400a0ca7e4089061ceb6548b0695faa6 </div>
<div style="display:none"> Gerrit-Change-Number: 15420 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@gnumonks.org> </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: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>