[RFC] nas: new 'Phy CA Agg Secondary Cells' TLV in "Get LTE Cphy CA Info"

Bjørn Mork bjorn at mork.no
Mon Jan 22 09:34:50 UTC 2018


I have no docs, so the names are wrong.  Decoding example with one
secondary:

[04 Dec 2017, 07:30:57] [Debug] [/dev/cdc-wdm0] received message...
<<<<<< RAW:
<<<<<<   length = 91
<<<<<<   data   =
01:5A:00:80:03:01:02:01:00:AC:00:4E:00:02:04:00:00:00:00:00:10:08:00:05:00:4C:0C:02:00:00:00:11:04:00:05:00:00:00:12:0E:00:04:00:86:0B:05:00:00:00:7F:00:02:00:00:00:13:0A:00:05:00:4C:0C:05:00:00:00:7F:00:14:01:00:01:15:10:00:01:04:00:86:0B:05:00:00:00:7F:00:02:00:00:00:01

[04 Dec 2017, 07:30:57] [Debug] [/dev/cdc-wdm0] received generic response
(translated)...
<<<<<< QMUX:
>>>>>>   length  = 90
>>>>>>   flags   = 0x80
>>>>>>   service = "nas"
>>>>>>   client  = 1
>>>>>> QMI:
>>>>>>   flags       = "response"
>>>>>>   transaction = 1
>>>>>>   tlv_length  = 78
>>>>>>   message     = "Get LTE Cphy CA Info" (0x00AC)
>>>>>> TLV:
>>>>>>   type       = "Result" (0x02)
>>>>>>   length     = 4
>>>>>>   value      = 00:00:00:00
>>>>>>   translated = SUCCESS
>>>>>> TLV:
>>>>>>   type   = 0x10
>>>>>>   length = 8
>>>>>>   value  = 05:00:4C:0C:02:00:00:00
>>>>>> TLV:
>>>>>>   type       = "DL Bandwidth" (0x11)
>>>>>>   length     = 4
>>>>>>   value      = 05:00:00:00
>>>>>>   translated = 20
>>>>>> TLV:
>>>>>>   type       = "Phy CA Agg SCell Info" (0x12)
>>>>>>   length     = 14
>>>>>>   value      = 04:00:86:0B:05:00:00:00:7F:00:02:00:00:00
>>>>>>   translated = [ physical_cell_id = '4' rx_channel = '2950' dl_bandwidth = '20' lte_band = 'eutran-8' state = 'activated' ]
>>>>>> TLV:
>>>>>>   type       = "Phy CA Agg PCell Info" (0x13)
>>>>>>   length     = 10
>>>>>>   value      = 05:00:4C:0C:05:00:00:00:7F:00
>>>>>>   translated = [ physical_cell_id = '5' rx_channel = '3148' dl_bandwidth = '20' lte_band = 'eutran-8' ]
>>>>>> TLV:
>>>>>>   type       = "SCell index" (0x14)
>>>>>>   length     = 1
>>>>>>   value      = 01
>>>>>>   translated = 1
>>>>>> TLV:
>>>>>>   type       = "Phy CA Agg Secondary Cells" (0x15)
>>>>>>   length     = 16
>>>>>>   value      = 01:04:00:86:0B:05:00:00:00:7F:00:02:00:00:00:01
>>>>>>   translated = { [0] = '[ physical_cell_id = '4' rx_channel = '2950' dl_bandwidth = '20' lte_band = 'eutran-8' state = 'activated' cell_index = '1' ] '}

Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
This patch was previously only sent to the mailing list as an attachment.  As I
did not see any comments, I fear that many might have missed it....

Please ignore if the comments were absent for a good reason, like the embarrassing
ugliness of this code.

Note that we might want to hold this off until we have some proper names for
the TLVs. But I still would like to know if the code is close enough to OK, so
sending as an RFC



Bjørn


 data/qmi-service-nas.json | 27 ++++++++++++++++-
 src/qmicli/qmicli-nas.c   | 76 +++++++++++++++++++++++++++++++----------------
 2 files changed, 77 insertions(+), 26 deletions(-)

diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
index 24d4ff0ae72a..bc50865bab03 100644
--- a/data/qmi-service-nas.json
+++ b/data/qmi-service-nas.json
@@ -3592,5 +3592,30 @@
                      "type"       : "TLV",
                      "since"      : "1.16",
                      "format"     : "guint8",
-                     "prerequisites": [ { "common-ref" : "Success" } ] } ] }
+                     "prerequisites": [ { "common-ref" : "Success" } ] },
+                   { "name"               : "Phy CA Agg Secondary Cells",
+                     "id"                 : "0x15",
+                     "mandatory"          : "no",
+                     "type"               : "TLV",
+                     "since"              : "1.16",
+		     "format"             : "array",
+                     "size-prefix-format" : "guint8",
+                     "array-element"      : { "name"     : "SSC",
+                                              "format"   : "struct",
+                                              "contents" : [  { "name"          : "Physical Cell ID",
+                                                                "format"        : "guint16"},
+                                                              { "name"          : "Rx Channel",
+                                                                "format"        : "guint16" },
+                                                              { "name"          : "DL Bandwidth",
+                                                                "format"        : "guint32",
+                                                                "public-format" : "QmiNasDLBandwidth" },
+                                                              { "name"          : "LTE Band",
+                                                                "format"        : "guint16",
+                                                                "public-format" : "QmiNasActiveBand" },
+                                                              { "name"          : "State",
+                                                                "format"        : "guint32",
+                                                                "public-format" : "QmiNasScellState" },
+				                              { "name"          : "Cell Index",
+                                                                "format"        : "guint8" } ] },
+                     "prerequisites"      : [ { "common-ref" : "Success" } ] } ] }
 ]
diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c
index 4cca61b285c5..2ea5a6b0b589 100644
--- a/src/qmicli/qmicli-nas.c
+++ b/src/qmicli/qmicli-nas.c
@@ -3023,6 +3023,7 @@ get_lte_cphy_ca_info_ready (QmiClientNas *client,
     QmiNasActiveBand band;
     QmiNasScellState state;
     guint8 scell_index;
+    GArray *array;
 
     output = qmi_client_nas_get_lte_cphy_ca_info_finish (client, res, &error);
     if (!output) {
@@ -3051,26 +3052,6 @@ get_lte_cphy_ca_info_ready (QmiClientNas *client,
                  qmi_nas_dl_bandwidth_get_string (dl_bandwidth));
     }
 
-    if (qmi_message_nas_get_lte_cphy_ca_info_output_get_phy_ca_agg_scell_info (
-        output,
-        &pci,
-        &channel,
-        &dl_bandwidth,
-        &band,
-        &state,
-        NULL)) {
-        g_print ("Secondary Cell Info\n");
-        g_print ("\tPhysical Cell ID: '%" G_GUINT16_FORMAT"'\n"
-                 "\tRX Channel: '%" G_GUINT16_FORMAT"'\n"
-                 "\tDL Bandwidth: '%s'\n"
-                 "\tLTE Band: '%s'\n"
-                 "\tState: '%s'\n",
-                 pci, channel,
-                 qmi_nas_dl_bandwidth_get_string (dl_bandwidth),
-                 qmi_nas_active_band_get_string (band),
-                 qmi_nas_scell_state_get_string (state));
-    }
-
     if (qmi_message_nas_get_lte_cphy_ca_info_output_get_phy_ca_agg_pcell_info (
         output,
         &pci,
@@ -3088,11 +3069,56 @@ get_lte_cphy_ca_info_ready (QmiClientNas *client,
                  qmi_nas_active_band_get_string (band));
     }
 
-    if (qmi_message_nas_get_lte_cphy_ca_info_output_get_scell_index (
-        output,
-        &scell_index,
-        NULL)) {
-        g_print ("Secondary Cell index: '%u'\n", scell_index);
+    if (qmi_message_nas_get_lte_cphy_ca_info_output_get_phy_ca_agg_secondary_cells (
+        output, &array, NULL)) {
+        guint i;
+
+        if (!array->len)
+            g_print ("No Secondary Cells\n");
+        for (i = 0; i < array->len; i++) {
+            QmiMessageNasGetLteCphyCaInfoOutputPhyCaAggSecondaryCellsSsc *e;
+            e = &g_array_index (array, QmiMessageNasGetLteCphyCaInfoOutputPhyCaAggSecondaryCellsSsc, i);
+            g_print ("Secondary Cell %u Info\n"
+                     "\tPhysical Cell ID: '%" G_GUINT16_FORMAT"'\n"
+                     "\tRX Channel: '%" G_GUINT16_FORMAT"'\n"
+                     "\tDL Bandwidth: '%s'\n"
+                     "\tLTE Band: '%s'\n"
+                     "\tState: '%s'\n"
+                     "\tCell index: '%u'\n",
+                     i + 1, e->physical_cell_id, e->rx_channel,
+                     qmi_nas_dl_bandwidth_get_string (e->dl_bandwidth),
+                     qmi_nas_active_band_get_string (e->lte_band),
+                     qmi_nas_scell_state_get_string (e->state),
+                     e->cell_index);
+        }
+
+    } else {
+        if (qmi_message_nas_get_lte_cphy_ca_info_output_get_phy_ca_agg_scell_info (
+            output,
+            &pci,
+            &channel,
+            &dl_bandwidth,
+            &band,
+            &state,
+            NULL)) {
+            g_print ("Secondary Cell Info\n");
+            g_print ("\tPhysical Cell ID: '%" G_GUINT16_FORMAT"'\n"
+                     "\tRX Channel: '%" G_GUINT16_FORMAT"'\n"
+                     "\tDL Bandwidth: '%s'\n"
+                     "\tLTE Band: '%s'\n"
+                     "\tState: '%s'\n",
+                     pci, channel,
+                     qmi_nas_dl_bandwidth_get_string (dl_bandwidth),
+                     qmi_nas_active_band_get_string (band),
+                     qmi_nas_scell_state_get_string (state));
+        }
+
+        if (qmi_message_nas_get_lte_cphy_ca_info_output_get_scell_index (
+            output,
+            &scell_index,
+            NULL)) {
+            g_print ("Secondary Cell index: '%u'\n", scell_index);
+        }
     }
 
     qmi_message_nas_get_lte_cphy_ca_info_output_unref (output);
-- 
2.11.0



More information about the libqmi-devel mailing list