isimodem: reporting operator name to core from unsolicited indications
Hi
With isimodem (on Nokia N900), there are cases where the request to get the current operator name fails. This seems to be operator-specific, since it works fine with other operators for exactly the same raw packets. The ISI trace looks something like:
ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_REQ [id=0xE5 utid=0x2E len=8]: ofonod[27080]: * 2E E5 00 3F 00 00 00 00 : ....?.... ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_RESP [id=0xE6 utid=0x2E len=10]: ofonod[27080]: * 2E E6 01 00 00 00 00 00 00 00 : ........... ofonod[27080]: gisi: normal RESP to 0xb6c8d0e0 [res=0x0A, id=0xE6, utid=0x2E] ofonod[27080]: drivers/isimodem/network-registration.c:check_response_status() Request failed: NET_CAUSE_COMMUNICATION_ERROR ofonod[27080]: src/network.c:current_operator_callback() 0x57c940, 0 ofonod[27080]: src/network.c:current_operator_callback() Error during current operator
However, there are also some frequent unsolicited NET_REG_STATUS_IND messages that contain the operator name (SZ 02/Eswatini Mobile in the snippet below):
ofonod[27080]: PN_NETWORK (0x0A): NET_REG_STATUS_IND [id=0xE2 utid=0x00 len=124]: ofonod[27080]: * 00 E2 00 04 00 18 00 02 00 00 00 05 00 53 00 5A : ..............S.Z ofonod[27080]: * 00 20 00 30 00 32 01 00 01 00 00 00 09 18 01 2D : ...0.2.........- ofonod[27080]: * 00 64 7A 36 56 F3 20 02 00 01 02 01 01 00 00 1F : .dz6V........... ofonod[27080]: * 01 01 01 00 E3 24 03 00 00 0F 00 45 00 73 00 77 : .....$.....E.s.w ofonod[27080]: * 00 61 00 74 00 69 00 6E 00 69 00 20 00 4D 00 6F : .a.t.i.n.i...M.o ofonod[27080]: * 00 62 00 69 00 6C 00 65 E3 24 02 00 00 0E 00 45 : .b.i.l.e.$.....E ofonod[27080]: * 00 73 00 77 00 61 00 74 00 69 00 6E 00 69 00 4D : .s.w.a.t.i.n.i.M ofonod[27080]: * 00 6F 00 62 00 69 00 6C 00 65 00 00 : .o.b.i.l.e.. ofonod[27080]: gisi: No error information IND to 0xb6c8f2a0 [res=0x0A, id=0xE2, utid=0x00]
They are handled by isimodem/network-registration.c:reg_status_ind_cb, which currently does not extract the operator name info.
I have written some initial code (attached at the end of this email) that is able to extract the operator name in the reg_status_ind_cb function. The challenge so far is that I have not figured out how to report this operator name to core.
Storing it in nd->nitz_name as in the name_ind_cb function,
https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/drivers/isimodem/network-registration.c#n882
does not appear to be enough, since this does not have a related 'sync' to core. So I think that function is also not fully functionally yet.
I would appreciate some pointers/suggestions, then I can test on device and submit a proper patch.
Sincerely
Sicelo
drivers/isimodem/debug.c +1 -0
@@ -1190,6 +1190,7 @@ const char *net_subblock_name(enum net_subblock value)_ (NET_REGISTRATION_CONF1_INFO );_ (NET_ROAMING_CONF1_INFO );_ (NET_AVAIL_NETWORK_INFO_COMMON ); +_ (NET_REG_STATUS_IND_OPER_NAME );_ (NET_OPER_NAME_INFO ); }return "NET_<UNKNOWN>" ;
drivers/isimodem/network-registration.c +49 -0
70 lines not on this page · raw message
drivers/isimodem/network.h +1 -0
@@ -90,6 +90,7 @@ enum net_subblock {NET_REGISTRATION_CONF1_INFO =0x59 ,NET_ROAMING_CONF1_INFO =0x5A ,NET_AVAIL_NETWORK_INFO_COMMON =0xE1 , +NET_REG_STATUS_IND_OPER_NAME =0xE3 , NET_OPER_NAME_INFO = 0xE7, };
Hi Sicelo,
Quoted 7 lines · Sicelo
Hi
With isimodem (on Nokia N900), there are cases where the request to get the current operator name fails. This seems to be operator-specific, since it works fine with other operators for exactly the same raw packets. The ISI trace looks something like:
Quoted 9 lines
ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_REQ [id=0xE5 utid=0x2E len=8]: ofonod[27080]: * 2E E5 00 3F 00 00 00 00 : ....?.... ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_RESP [id=0xE6 utid=0x2E len=10]: ofonod[27080]: * 2E E6 01 00 00 00 00 00 00 00 : ........... ofonod[27080]: gisi: normal RESP to 0xb6c8d0e0 [res=0x0A, id=0xE6, utid=0x2E] ofonod[27080]: drivers/isimodem/network-registration.c:check_response_status() Request failed: NET_CAUSE_COMMUNICATION_ERROR ofonod[27080]: src/network.c:current_operator_callback() 0x57c940, 0 ofonod[27080]: src/network.c:current_operator_callback() Error during current operator
Funny, so it fails at random?
Quoted 15 lines
However, there are also some frequent unsolicited
NET_REG_STATUS_INDmessages that contain the operator name (SZ 02/Eswatini Mobile in the snippet below):ofonod[27080]: PN_NETWORK (0x0A): NET_REG_STATUS_IND [id=0xE2 utid=0x00 len=124]: ofonod[27080]: * 00 E2 00 04 00 18 00 02 00 00 00 05 00 53 00 5A : ..............S.Z ofonod[27080]: * 00 20 00 30 00 32 01 00 01 00 00 00 09 18 01 2D : ...0.2.........- ofonod[27080]: * 00 64 7A 36 56 F3 20 02 00 01 02 01 01 00 00 1F : .dz6V........... ofonod[27080]: * 01 01 01 00 E3 24 03 00 00 0F 00 45 00 73 00 77 : .....$.....E.s.w ofonod[27080]: * 00 61 00 74 00 69 00 6E 00 69 00 20 00 4D 00 6F : .a.t.i.n.i...M.o ofonod[27080]: * 00 62 00 69 00 6C 00 65 E3 24 02 00 00 0E 00 45 : .b.i.l.e.$.....E ofonod[27080]: * 00 73 00 77 00 61 00 74 00 69 00 6E 00 69 00 4D : .s.w.a.t.i.n.i.M ofonod[27080]: * 00 6F 00 62 00 69 00 6C 00 65 00 00 : .o.b.i.l.e.. ofonod[27080]: gisi: No error information IND to 0xb6c8f2a0 [res=0x0A, id=0xE2, utid=0x00]
Quoted 2 lines
They are handled by isimodem/network-registration.c:reg_status_ind_cb, which currently does not extract the operator name info.
Refer to ofono_netreg_status_notify implementation here:
https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/src/network.c#n1347
Every time the network registration status is notified to the core, and it is roaming / registered, the driver current_operator method is invoked.
You can try to handle the NET_REG_STATUS_IND in the driver, cache it and invoke the above notify function to the core. Then in the current_operator driver function, return the cached name.
Quoted 5 lines
Storing it in
nd->nitz_nameas in thename_ind_cbfunction,
https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/drivers/isimodem/network-registration.c#n882
does not appear to be enough, since this does not have a related 'sync' to core. So I think that function is also not fully functionally yet.
Looks like the NITZ name is returned in cell_info_resp_cb(). Basically what this does is it runs NET_CELL_INFO_GET_REQ in order to obtain the operator MCC/MNC. Then it also copies in the NITZ name if available. Doesn't look like this path was well tested.
Seems your driver uses a different path, one going through create_name_get_req()?
I suppose what you can try is to return the nitz name if the name_get_resp_cb() fails to parse the operator name. Just make sure to reset the nitz name to empty if the network registration is lost.
Quoted 4 lines
I would appreciate some pointers/suggestions, then I can test on device and submit a proper patch.
Regards,
-Denis
Hi Denis
Quoted 10 lines · Denis Kenzior
Quoted 9 lines
ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_REQ [id=0xE5 utid=0x2E len=8]: ofonod[27080]: * 2E E5 00 3F 00 00 00 00 : ....?.... ofonod[27080]: PN_NETWORK (0x0A): NET_OPER_NAME_READ_RESP [id=0xE6 utid=0x2E len=10]: ofonod[27080]: * 2E E6 01 00 00 00 00 00 00 00 : ........... ofonod[27080]: gisi: normal RESP to 0xb6c8d0e0 [res=0x0A, id=0xE6, utid=0x2E] ofonod[27080]: drivers/isimodem/network-registration.c:check_response_status() Request failed: NET_CAUSE_COMMUNICATION_ERROR ofonod[27080]: src/network.c:current_operator_callback() 0x57c940, 0 ofonod[27080]: src/network.c:current_operator_callback() Error during current operatorFunny, so it fails at random?
Yes. I am guessing that the RESP is directly from the modem, so this failure is nothing that we can do anything about.
Quoted 7 lines
Refer to
ofono_netreg_status_notifyimplementation here:
https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/src/network.c#n1347Every time the network registration status is notified to the core, and it is roaming / registered, the driver
current_operatormethod is invoked.You can try to handle the
NET_REG_STATUS_INDin the driver
This is what the POC patch I posted tries to do.
Quoted 3 lines
cache it and
invoke the above notify function to the core. Then in thecurrent_operatordriver function, return the cached name.
This is where my lack of skill gets exposed - reg_status_ind_cb only has access to netreg of type ofono_netreg, and nd of type netreg_data. However the notify function, as called from name_get_resp_cb, requires to be passed structs of type ofono_netreg_operator_cb_t, ofono_network_operator and isi_cb_data. I am not sure I see how to pass these from reg_status_ind_cb.
So essentially I have two questions:
1. Where can I cache the name? I think nd->nitz_name is fine, but perhaps there is a better option
2. How can I make the cached name available in name_get_resp_cb?
Will appreciate suggestions. I guess it is something very simple but that eludes me.
Sicelo
Hi Sicelo,
Quoted 10 lines
Quoted 8 lines
Refer to
ofono_netreg_status_notifyimplementation here:
https://git.kernel.org/pub/scm/network/ofono/ofono.git/tree/src/network.c#n1347Every time the network registration status is notified to the core, and it is roaming / registered, the driver
current_operatormethod is invoked.You can try to handle the
NET_REG_STATUS_INDin the driverThis is what the POC patch I posted tries to do.
Right.
Quoted 11 lines
Quoted 4 lines
cache it and
invoke the above notify function to the core. Then in thecurrent_operatordriver function, return the cached name.This is where my lack of skill gets exposed -
reg_status_ind_cbonly has access to netreg of typeofono_netreg, and nd of typenetreg_data. However the notify function, as called fromname_get_resp_cb, requires to be passed structs of typeofono_netreg_operator_cb_t,ofono_network_operatorandisi_cb_data. I am not sure I see how to pass these fromreg_status_ind_cb.
You can't, but that's okay because you don't have to. The flow is like this:
*unsolicited NET_REG_STATUS_IND notification from modem*
drivers/isimodem/network-registration.c: reg_status_ind_cb()
- parse operator name and store it in nd->nitz.
- parse network status
- Invoke ofono_netreg_status_notify
oFono Core ofono_netreg_status_notify
- registered or roaming, call current_operator() driver method
drivers/isimodem/network-registration.c: isi_current_operator()
- Return the nitz name
Or better yet, fall back to returning the nitz name when name_get_resp_cb() fails somewhere in check_response_status(msg, NET_OPER_NAME_READ_RESP).
Regards,
-Denis
Hi Denis
Quoted 9 lines · Denis Kenzior
Quoted 6 lines
This is where my lack of skill gets exposed -
reg_status_ind_cbonly has access to netreg of typeofono_netreg, and nd of typenetreg_data. However the notify function, as called fromname_get_resp_cb, requires to be passed structs of typeofono_netreg_operator_cb_t,ofono_network_operatorandisi_cb_data. I am not sure I see how to pass these fromreg_status_ind_cb.You can't, but that's okay because you don't have to. The flow is like this:
Quoted 7 lines
*unsolicited
NET_REG_STATUS_INDnotification from modem*
drivers/isimodem/network-registration.c:reg_status_ind_cb()
- parse operator name and store it innd->nitz.
- parse network status
- Invokeofono_netreg_status_notify
oFono Coreofono_netreg_status_notify
- registered or roaming, callcurrent_operator()driver method
Thank you for your patience with my ineptitude here. I understand and can follow nicely up to this point.
Quoted 1 line
drivers/isimodem/network-registration.c:isi_current_operator()
isi_current_operator then calls (in my case),
- create_name_get_req
- when modem/network provides response to that _req, name_get_resp_cb is then called/run
- name_get_resp_cb sees an error condition, while checking for NET_OPER_NAME_READ_RESP, then reports the callback has failed
Quoted 2 lines
- Return the nitz name
I agree that I want to return nitz_name (or other variable that is suitable to use for caching the name) when the above check fails. The question I am still unable to answer for myself is:
* in name_get_resp_cb, how can i make the populated nd->nitz_name accessible/available for to use?
Quoted 2 lines
Or better yet, fall back to returning the nitz name when
name_get_resp_cb()fails somewhere incheck_response_status(msg, NET_OPER_NAME_READ_RESP).
This also has the same question - I will need the populated nd->nitz_name to be accessible in check_response_status, and I am not sure how, yet.
In passing, I now also extract MCC and MNC from the other parts of NET_MODEM_REG_STATUS_IND, so there are now two more pieces of information to be shuffled around. Updated patch attached at the end of this message.
Regards
Sicelo
From 691ef91c7c7ace745ca5ec04051210ade1097e69 Mon Sep 17 00:00:00 2001
From: "Sicelo A. Mhlongo" <[email protected]>
Date: Wed, 8 Nov 2023 23:33:23 +0200
Subject: [PATCH] reg_status_ind: parse operator names and mcc/mnc
--- drivers/isimodem/debug.c | 1 + drivers/isimodem/network-registration.c | 63 +++++++++++++++++++++++++ drivers/isimodem/network.h | 1 + 3 files changed, 65 insertions(+)
drivers/isimodem/debug.c +1 -0
@@ -1190,6 +1190,7 @@ const char *net_subblock_name(enum net_subblock value)_ (NET_REGISTRATION_CONF1_INFO );_ (NET_ROAMING_CONF1_INFO );_ (NET_AVAIL_NETWORK_INFO_COMMON ); +_ (NET_REG_STATUS_IND_OPER_NAME );_ (NET_OPER_NAME_INFO ); }return "NET_<UNKNOWN>" ;
drivers/isimodem/network-registration.c +63 -0
85 lines not on this page · raw message
drivers/isimodem/network.h +1 -0
@@ -90,6 +90,7 @@ enum net_subblock {NET_REGISTRATION_CONF1_INFO =0x59 ,NET_ROAMING_CONF1_INFO =0x5A ,NET_AVAIL_NETWORK_INFO_COMMON =0xE1 , +NET_REG_STATUS_IND_OPER_NAME =0xE3 , NET_OPER_NAME_INFO = 0xE7, };
--
2.42.0
Hi
Quoted 10 lines · Sicelo
I agree that I want to return
nitz_name(or other variable that is suitable to use for caching the name) when the above check fails. The question I am still unable to answer for myself is:* in
name_get_resp_cb, how can i make the populatednd->nitz_nameaccessible/available for to use?Quoted 2 lines
Or better yet, fall back to returning the nitz name when
name_get_resp_cb()fails somewhere incheck_response_status(msg, NET_OPER_NAME_READ_RESP).
Quoted 8 lines
This also has the same question - I will need the populated
nd->nitz_nameto be accessible incheck_response_status, and I am not sure how, yet.In passing, I now also extract MCC and MNC from the other parts of
NET_MODEM_REG_STATUS_IND, so there are now two more pieces of information to be shuffled around. Updated patch attached at the end of this message.
It appears that I have found a way to achieve the goal, and will soon post a patch for review.
Regards
Sicelo