aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-07-27 16:36:14 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-07-28 13:49:49 +0200
commit8b1e4cbae663397203d1a38083c5a2ddf9202d10 (patch)
treebced825591262e5cc2c279575b732e2d58f525ea
parentbd7964f1011486a2b9e4d02207edfcf8cbc488d6 (diff)
sndcp: Forward QoS params from SM to LLC
-rw-r--r--include/osmocom/gprs/sndcp/sndcp_private.h3
-rw-r--r--src/sndcp/Makefile.am1
-rw-r--r--src/sndcp/sndcp.c2
-rw-r--r--src/sndcp/sndcp_prim.c14
-rw-r--r--tests/sndcp/sndcp_prim_test.c36
5 files changed, 56 insertions, 0 deletions
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 @@ struct gprs_sndcp_entity {
/* 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 @@ libosmo_gprs_sndcp_la_LDFLAGS = \
$(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 @@ int gprs_sndcp_sne_submit_llc_ll_unitdata_req(struct gprs_sndcp_entity *sne, uin
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 @@ static int gprs_sndcp_prim_handle_sndcp_snsm_activate_ind(struct osmo_gprs_sndcp
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 @@ static int gprs_sndcp_prim_handle_sndcp_snsm_activate_ind(struct osmo_gprs_sndcp
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 @@ static const uint8_t sndcp_xid[] = {
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 @@ static void test_sndcp_prim_ms(void)
* 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);