All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Erickson <gerickson@nuovations.com>
To: connman@lists.linux.dev
Subject: [PATCH 0/4] ofono: Make the oFono Plugin Modem Interface Order Tolerant
Date: Wed, 12 Feb 2025 15:39:29 -0800	[thread overview]
Message-ID: <cover.1739403363.git.gerickson@nuovations.com> (raw)

This addresses and closes #135 by providing a secondary opportunity to
send D-Bus request to get Connection Manager interface properties and
contexts at the successful closure of 'try_create_device' since the
primary opportunity in 'modem_update_interfaces' is missed in the
following test case:

    # connmanctl disable cellular
    # /etc/init.d/connman stop
    # /etc/init.d/ofono stop
    # rm -rf /var/lib/ofono/*
    # rm -rf /var/lib/connman/cellular*
    # /etc/init.d/ofono start
    # /etc/init.d/connman start
    # connmanctl enable cellular

At this point, ofonod will create a fully-provisioned and -functional
Cellular service, with both IPv4 and IPv6 Cellular network
contexts. However, connmand has no network and no service associated
with it so, so any Connection Manager client observing the Cellular
service state will observe it failing, on timeout.

In this use case, the ordering of the oFono 'lte' (Long-term
Evolution) and 'cm' (Connection Manager) modem interfaces shared
between 'ofonod' and 'connmand' is different from what they normally
are in the case where a Cellular connection has already been
established. Consequently, when the 'cm' interface state change
notification addition arrives, the connman device has not yet been
created because in 'modem_update_interfaces' executing
'cm_get_properties' and 'cm_get_contexts' is dependent on the presence
of 'modem->device':

    if (api_added(old_ifaces, new_ifaces, OFONO_API_CM)) {
        if (modem->device) {
            cm_get_properties(modem);
            cm_get_contexts(modem);
        }
    }

Unfortunately, that does not and cannot happen until the 'lte' modem
interface is added because 'try_create_device' has these conditionals:

    if ((modem->capabilities & LTE_CAPABLE) &&
            !has_interface(modem->interfaces, OFONO_API_LTE))
        return false;

and the 'lte' interface is added only moments later (rather than
moments earlier as is normal outside this use case), but too late
nonetheless. So, the ofono plugin will never get 'cm' interface
properties or Cellular network contexts.

With this change, each call to 'try_create_device' now has an
opportunity to check if the 'cm' interface has been added and, if it
has, to request 'cm' properties and contexts.

Grant Erickson (4):
  ofono: Add additional 'DBG' statements.
  ofono: Use goto error-handling semantics in 'add_cm_context'.
  ofono: Documentation: Add comment about entry condition for
    'context_changed'.
  ofono: Provide a secondary opportunity to get CM props and contexts.

 plugins/ofono.c | 78 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 71 insertions(+), 7 deletions(-)

-- 
2.45.0


             reply	other threads:[~2025-02-12 23:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 23:39 Grant Erickson [this message]
2025-02-12 23:39 ` [PATCH 1/4] ofono: Add additional 'DBG' statements Grant Erickson
2025-02-12 23:39 ` [PATCH 2/4] ofono: Use goto error-handling semantics in 'add_cm_context' Grant Erickson
2025-02-12 23:39 ` [PATCH 3/4] ofono: Documentation: Add comment about entry condition for 'context_changed' Grant Erickson
2025-02-12 23:39 ` [PATCH 4/4] ofono: Provide a secondary opportunity to get CM props and contexts Grant Erickson
2025-02-14 21:10 ` [PATCH 0/4] ofono: Make the oFono Plugin Modem Interface Order Tolerant patchwork-bot+connman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1739403363.git.gerickson@nuovations.com \
    --to=gerickson@nuovations.com \
    --cc=connman@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.