Skip to contentSkip to conversation

gemalto: netmon driver

RFC PATCH Superseded Sergey Matyukevich 2 participants 6 messages Jan 10, 2021 – Jan 11, 2021 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover gemalto: netmon driver

Hello Denis and all,

This patch series implements netmon driver for gemalto modems that are able to provide basic measurements using AT+CQS and AT^SMONI commands.

This patch series is intendedly marked as RFC. In addition to general feedback for this v1 I would like to clarify the right way to handle negative values that can be returned by modem. For instance, this is the case for the values measured in dBm including EC/n0 and RSCP. Currently such values are discarded by CELL_INFO_DICT_APPEND macro.

Regards,
Sergey

Sergey Matyukevich (2):
gemalto: add netmon driver
plugin: gemalto: enable netmon

 Makefile.am                         |   3 +-
 drivers/gemaltomodem/gemaltomodem.c |   2 +
 drivers/gemaltomodem/gemaltomodem.h |   3 +
 drivers/gemaltomodem/netmon.c       | 609 ++++++++++++++++++++++++++++
 plugins/gemalto.c                   |   6 +
 5 files changed, 622 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gemaltomodem/netmon.c
#1 lore raw

RFC PATCH 1/2 gemalto: add netmon driver

Implement network monitoring driver for gemalto modems that are able to provide serving cell information and basic measurements using AT+CQS and AT^SMONI commands.

---
 Makefile.am                         |   3 +-
 drivers/gemaltomodem/gemaltomodem.c |   2 +
 drivers/gemaltomodem/gemaltomodem.h |   3 +
 drivers/gemaltomodem/netmon.c       | 609 ++++++++++++++++++++++++++++
 4 files changed, 616 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gemaltomodem/netmon.c
Makefile.am +2 -1
index c0631081..5e7614c1 100644
@@ -483,7 +483,8 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/gemaltomodem/gemaltomodem.c \
 			drivers/gemaltomodem/location-reporting.c \
 			drivers/gemaltomodem/voicecall.c \
-			drivers/gemaltomodem/gprs-context.c
+			drivers/gemaltomodem/gprs-context.c \
+			drivers/gemaltomodem/netmon.c
 
 builtin_modules += xmm7modem
 builtin_sources += drivers/atmodem/atutil.h \
drivers/gemaltomodem/gemaltomodem.c +2 -0
index 4b20dd1b..f7e4ff3e 100644
@@ -38,6 +38,7 @@ static int gemaltomodem_init(void)
 	gemalto_location_reporting_init();
 	gemalto_gprs_context_init();
 	gemalto_voicecall_init();
+	gemalto_netmon_init();
 
 	return 0;
 }
@@ -47,6 +48,7 @@ static void gemaltomodem_exit(void)
 	gemalto_location_reporting_exit();
 	gemalto_gprs_context_exit();
 	gemalto_voicecall_exit();
+	gemalto_netmon_exit();
 }
 
 OFONO_PLUGIN_DEFINE(gemaltomodem, "Gemalto modem driver", VERSION,
drivers/gemaltomodem/gemaltomodem.h +3 -0
index dc0d346b..ae8f2141 100644
@@ -30,3 +30,6 @@ extern void gemalto_voicecall_exit();
 
 extern void gemalto_gprs_context_init();
 extern void gemalto_gprs_context_exit();
+
+extern void gemalto_netmon_init(void);
+extern void gemalto_netmon_exit(void);
drivers/gemaltomodem/netmon.c new file +609 -0

609 lines not on this page · raw message

#2 lore raw

Re: [RFC PATCH 1/2] gemalto: add netmon driver

Hi Sergey,

Quoted 11 lines · Sergey Matyukevich

Implement network monitoring driver for gemalto modems that are able to provide serving cell information and basic measurements using AT+CQS and AT^SMONI commands.

---
  Makefile.am                         |   3 +-
  drivers/gemaltomodem/gemaltomodem.c |   2 +
  drivers/gemaltomodem/gemaltomodem.h |   3 +
  drivers/gemaltomodem/netmon.c       | 609 ++++++++++++++++++++++++++++
  4 files changed, 616 insertions(+), 1 deletion(-)

create mode 100644 drivers/gemaltomodem/netmon.c

<snip>

drivers/gemaltomodem/netmon.c line 570

Quoted 11 lines
drivers/gemaltomodem/netmon.c new file +11 -0
+static int gemalto_netmon_probe(struct ofono_netmon *netmon,
+					unsigned int vendor, void *user)
+{
+	GAtChat *chat = user;
+	struct netmon_driver_data *nmd;
+
+	DBG("gemalto netmon probe");
+
+	nmd = g_try_new0(struct netmon_driver_data, 1);
+	if (nmd == NULL)
+		return -ENOMEM;

Feel free to use g_new0. We have given up using g_try_new0 since these errors don't really occur on Linux.

drivers/gemaltomodem/netmon.c line 579

Quoted 9 lines
drivers/gemaltomodem/netmon.c new file +9 -0
+
+	nmd->chat = g_at_chat_clone(chat);
+
+	ofono_netmon_set_data(netmon, nmd);
+
+	g_idle_add(gemalto_delayed_register, netmon);
+
+	return 0;
+}

Other than this, LGTM.

Regards,
-Denis

#3 lore raw

RFC PATCH 2/2 plugin: gemalto: enable netmon

In reply to Sergey Matyukevich

Enable netmon functionality for Gemalto ELS81x modems.

---
 plugins/gemalto.c | 6 ++++++
 1 file changed, 6 insertions(+)
plugins/gemalto.c +6 -0
index 28ee3aff..135e2d26 100644
@@ -48,6 +48,7 @@
 #include <ofono/gprs.h>
 #include <ofono/gprs-context.h>
 #include <ofono/location-reporting.h>
+#include <ofono/netmon.h>
 
 #include <drivers/atmodem/atutil.h>
 #include <drivers/atmodem/vendor.h>
@@ -622,6 +623,7 @@ static void gemalto_post_sim(struct ofono_modem *modem)
 static void gemalto_post_online(struct ofono_modem *modem)
 {
 	struct gemalto_data *data = ofono_modem_get_data(modem);
+	const char *model = ofono_modem_get_string(modem, "Model");
 
 	DBG("%p", modem);
 
@@ -634,6 +636,10 @@ static void gemalto_post_online(struct ofono_modem *modem)
 	ofono_call_settings_create(modem, 0, "atmodem", data->app);
 	ofono_call_meter_create(modem, 0, "atmodem", data->app);
 	ofono_call_barring_create(modem, 0, "atmodem", data->app);
+
+	if (!g_strcmp0(model, GEMALTO_MODEL_ELS81x))
+		ofono_netmon_create(modem, OFONO_VENDOR_GEMALTO,
+					"gemaltomodem", data->app);
 }
 
 static struct ofono_modem_driver gemalto_driver = {
#4 lore raw
In reply to Sergey Matyukevich

Hi Sergey,

Quoted 6 lines · Sergey Matyukevich

Hello Denis and all,

This patch series implements netmon driver for gemalto modems that are able to provide basic measurements using AT+CQS and AT^SMONI commands.

This patch series is intendedly marked as RFC. In addition to general

I guess you mean intentionally here...

Quoted 2 lines

feedback for this v1 I would like to clarify the right way to handle negative values that can be returned by modem. For instance, this

So the short answer is: You're not supposed to even have negative numbers in AT commands. And since oFono follows 27.007, which is itself based on AT commands, negative numbers do not really exist at the API level.

Refer to ITU v.250 Section 5.4.2.1 "Numeric constants". Strings are also supposed to be formatted in a certain way, which the firmware isn't doing properly either... The fact that you have to resort to using next_unquoted_string is kind of telling.

Quoted 2 lines

is the case for the values measured in dBm including EC/n0 and RSCP. Currently such values are discarded by CELL_INFO_DICT_APPEND macro.

I would guess your best bet would be to re-scale from what Gemalto firmware reports into something that 27.007 recommends. You may have to refer to 27.007, Section 8.69 to see what the scale is according to 3GPP.

Regards,
-Denis

#5 lore raw

Hello Denis,

Quoted 19 lines
Quoted 4 lines

This patch series implements netmon driver for gemalto modems that are able to provide basic measurements using AT+CQS and AT^SMONI commands.

This patch series is intendedly marked as RFC. In addition to general

I guess you mean intentionally here...

Quoted 2 lines

feedback for this v1 I would like to clarify the right way to handle negative values that can be returned by modem. For instance, this

So the short answer is: You're not supposed to even have negative numbers in AT commands. And since oFono follows 27.007, which is itself based on AT commands, negative numbers do not really exist at the API level.

Refer to ITU v.250 Section 5.4.2.1 "Numeric constants". Strings are also supposed to be formatted in a certain way, which the firmware isn't doing properly either... The fact that you have to resort to using next_unquoted_string is kind of telling.

Quoted 6 lines
Quoted 2 lines

is the case for the values measured in dBm including EC/n0 and RSCP. Currently such values are discarded by CELL_INFO_DICT_APPEND macro.

I would guess your best bet would be to re-scale from what Gemalto firmware reports into something that 27.007 recommends. You may have to refer to 27.007, Section 8.69 to see what the scale is according to 3GPP.

Thanks a lot for pointing me in the right direction. I will get back with v2 once I introduce the suggested changes.

Regards,
Sergey