laforge has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-gprs/+/33971 )
Change subject: sndcp: Forward QoS params from SM to LLC
......................................................................
sndcp: Forward QoS params from SM to LLC
Change-Id: I70e355ef27d24bdaf00e54f0e7126193f5bbf19f
---
M include/osmocom/gprs/sndcp/sndcp_private.h
M src/sndcp/Makefile.am
M src/sndcp/sndcp.c
M src/sndcp/sndcp_prim.c
M tests/sndcp/sndcp_prim_test.c
5 files changed, 65 insertions(+), 0 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/include/osmocom/gprs/sndcp/sndcp_private.h
b/include/osmocom/gprs/sndcp/sndcp_private.h
index 5630c97..07fbb2b 100644
--- a/include/osmocom/gprs/sndcp/sndcp_private.h
+++ b/include/osmocom/gprs/sndcp/sndcp_private.h
@@ -151,6 +151,9 @@
/* The NSAPI we shall use on top of LLC */
uint8_t nsapi;
+ /* Peak Throughput, Reliability Class, from QoS Profile TS 24.008 10.5.6.5 */
+ uint8_t peak_throughput;
+ uint8_t reliability_class;
/* Radio Priority (MS only, used by LLC/RLCMAC), TS 24.008 10.5.7.2 */
uint8_t radio_prio;
diff --git a/src/sndcp/Makefile.am b/src/sndcp/Makefile.am
index ca72ecb..f3ec7b5 100644
--- a/src/sndcp/Makefile.am
+++ b/src/sndcp/Makefile.am
@@ -37,6 +37,7 @@
$(NULL)
libosmo_gprs_sndcp_la_LIBADD = \
+ $(top_builddir)/src/common/libosmo-gprs-common.la \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
-lm \
diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c
index 7e82b5d..88c4979 100644
--- a/src/sndcp/sndcp.c
+++ b/src/sndcp/sndcp.c
@@ -229,6 +229,8 @@
llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_unitdata_req(sne->snme->tlli,
sne->llc_sapi, data, len);
OSMO_ASSERT(llc_prim_tx);
+ llc_prim_tx->ll.unitdata_req.qos_params.peak_throughput = sne->peak_throughput;
+ llc_prim_tx->ll.unitdata_req.qos_params.reliability_class =
sne->reliability_class;
llc_prim_tx->ll.unitdata_req.radio_prio = sne->radio_prio;
rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx);
return rc;
diff --git a/src/sndcp/sndcp_prim.c b/src/sndcp/sndcp_prim.c
index 2e2139c..45d6a0f 100644
--- a/src/sndcp/sndcp_prim.c
+++ b/src/sndcp/sndcp_prim.c
@@ -31,6 +31,8 @@
#include <osmocom/gprs/sndcp/sndcp_prim.h>
#include <osmocom/gprs/sndcp/sndcp_private.h>
+#include "../common/qos.h"
+
#define SNDCP_MSGB_HEADROOM 0
const struct value_string osmo_gprs_sndcp_prim_sap_names[] = {
@@ -635,6 +637,7 @@
uint8_t nsapi = sndcp_prim->snsm.activate_ind.nsapi;
struct gprs_sndcp_mgmt_entity *snme;
struct gprs_sndcp_entity *sne;
+ struct osmo_gprs_sm_qos_profile_decoded decoded;
LOGSNDCP(LOGL_INFO, "SNSM-ACTIVATE.ind (TLLI=%08x, SAPI=%u, NSAPI=%u)\n",
tlli, sapi, nsapi);
@@ -661,6 +664,17 @@
if (g_sndcp_ctx->location != OSMO_GPRS_SNDCP_LOCATION_MS)
return 0;
+ if (gprs_qos_parse_qos_profile(&decoded,
+ sndcp_prim->snsm.activate_ind.qos_profile,
+ sndcp_prim->snsm.activate_ind.qos_profile_len) < 0) {
+ LOGSNE(sne, LOGL_ERROR, "Failed parsing QoS Profile len=%u: %s\n",
+ sndcp_prim->snsm.activate_ind.qos_profile_len,
+ osmo_hexdump(sndcp_prim->snsm.activate_ind.qos_profile,
+ sndcp_prim->snsm.activate_ind.qos_profile_len));
+ return -EINVAL;
+ }
+ sne->peak_throughput = decoded.qos_profile.data.peak_throughput;
+ sne->reliability_class = decoded.qos_profile.data.reliability_class;
sne->radio_prio = sndcp_prim->snsm.activate_ind.radio_prio;
/* TODO: when supporting and using LLC ABM mode, flow should go through
diff --git a/tests/sndcp/sndcp_prim_test.c b/tests/sndcp/sndcp_prim_test.c
index 9dd1b5e..defaeb7 100644
--- a/tests/sndcp/sndcp_prim_test.c
+++ b/tests/sndcp/sndcp_prim_test.c
@@ -124,6 +124,39 @@
0x01, 0x05, 0x00, 0x06, 0x00, 0x07, 0x01, 0x07, 0x00, 0x08, 0x01, 0x08,
0x80, 0x00, 0x04, 0x12, 0x00, 0x40, 0x07 };
+
+/* Quality Of Service - Negotiated QoS (taken from PDP Ctx Act msg)
+ 00.. .... = Spare bit(s): 0
+ ..10 0... = Quality of Service Delay class: Delay class 4 (best effort) (4)
+ .... .011 = Reliability class: Unacknowledged GTP/LLC, Ack RLC, Protected data (3)
+ 0110 .... = Peak throughput: Up to 32 000 octet/s (6)
+ .... 0... = Spare bit(s): 0
+ .... .010 = Precedence class: Normal priority (2)
+ 000. .... = Spare bit(s): 0
+ ...1 1111 = Mean throughput: Best effort (31)
+ 011. .... = Traffic class: Interactive class (3)
+ ...1 0... = Delivery order: Without delivery order ('no') (2)
+ .... .010 = Delivery of erroneous SDUs: Erroneous SDUs are delivered('yes') (2)
+ Maximum SDU size: 1520 octets (153)
+ Maximum bitrate for uplink: 63 kbps (63)
+ Maximum bitrate for downlink: 63 kbps (63)
+ 0001 .... = Residual Bit Error Rate (BER): 5*10-2 (1)
+ .... 0001 = SDU error ratio: 1*10-2 (1)
+ 0100 00.. = Transfer delay: 200 ms (16)
+ .... ..11 = Traffic handling priority: Priority level 3 (3)
+ Guaranteed bitrate for uplink: 0 kbps (255)
+ Guaranteed bitrate for downlink: 0 kbps (255)
+ 000. .... = Spare bit(s): 0
+ ...0 .... = Signalling indication: Not optimised for signalling traffic
+ .... 0000 = Source statistics description: unknown (0)
+ Maximum bitrate for downlink (extended): Use the value indicated by the Maximum bit rate
for downlink (0)
+ Guaranteed bitrate for downlink (extended): Use the value indicated by the Guaranteed
bit rate for downlink (0)
+*/
+static const uint8_t qos_profile_ie_val[] = {
+ 0x23, 0x62, 0x1f, 0x72, 0x9, 0x3f, 0x3f, 0x11,
+ 0x43, 0xff, 0xff, 0x00, 0x00, 0x00 };
+
+
static void test_sndcp_prim_net(void)
{
struct osmo_gprs_sndcp_prim *sndcp_prim;
@@ -211,6 +244,9 @@
* LL-ESTABLISH.Req in ABM mode if we supported it): */
sndcp_prim = osmo_gprs_sndcp_prim_alloc_snsm_activate_ind(tlli, nsapi, ll_sapi);
OSMO_ASSERT(sndcp_prim);
+ sndcp_prim->snsm.activate_ind.radio_prio = 1;
+ sndcp_prim->snsm.activate_ind.qos_profile_len = sizeof(qos_profile_ie_val);
+ memcpy(sndcp_prim->snsm.activate_ind.qos_profile, qos_profile_ie_val,
sizeof(qos_profile_ie_val));
rc = osmo_gprs_sndcp_prim_dispatch_snsm(sndcp_prim);
OSMO_ASSERT(rc == 0);
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/33971
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I70e355ef27d24bdaf00e54f0e7126193f5bbf19f
Gerrit-Change-Number: 33971
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: merged