linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>
Cc: linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Aleksander Morgado <aleksander@aleksander.es>,
	open list <linux-kernel@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: Re: [PATCH net-next v9 2/2] net: Add Qcom WWAN control driver
Date: Mon, 5 Apr 2021 12:30:50 +0200	[thread overview]
Message-ID: <CAMZdPi-b0diW-80QhXLen0UJVHYQH_qixnZ+he_wWaoFxW5Dxg@mail.gmail.com> (raw)
In-Reply-To: <1617616369-27305-2-git-send-email-loic.poulain@linaro.org>

On Mon, 5 Apr 2021 at 11:44, Loic Poulain <loic.poulain@linaro.org> wrote:
>
> The MHI WWWAN control driver allows MHI QCOM-based modems to expose
> different modem control protocols/ports via the WWAN framework, so that
> userspace modem tools or daemon (e.g. ModemManager) can control WWAN
> config and state (APN config, SMS, provider selection...). A QCOM-based
> modem can expose one or several of the following protocols:
> - AT: Well known AT commands interactive protocol (microcom, minicom...)
> - MBIM: Mobile Broadband Interface Model (libmbim, mbimcli)
> - QMI: QCOM MSM/Modem Interface (libqmi, qmicli)
> - QCDM: QCOM Modem diagnostic interface (libqcdm)
> - FIREHOSE: XML-based protocol for Modem firmware management
>         (qmi-firmware-update)
>
> Note that this patch is mostly a rework of the earlier MHI UCI
> tentative that was a generic interface for accessing MHI bus from
> userspace. As suggested, this new version is WWAN specific and is
> dedicated to only expose channels used for controlling a modem, and
> for which related opensource userpace support exist.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  v2: update copyright (2021)
>  v3: Move driver to dedicated drivers/net/wwan directory
>  v4: Rework to use wwan framework instead of self cdev management
>  v5: Fix errors/typos in Kconfig
>  v6: - Move to new wwan interface, No need dedicated call to wwan_dev_create
>      - Cleanup code (remove legacy from mhi_uci, unused defines/vars...)
>      - Remove useless write_lock mutex
>      - Add mhi_wwan_wait_writable and mhi_wwan_wait_dlqueue_lock_irq helpers
>      - Rework locking
>      - Add MHI_WWAN_TX_FULL flag
>      - Add support for NONBLOCK read/write
>  v7: Fix change log (mixed up 1/2 and 2/2)
>  v8: - Implement wwan_port_ops instead of fops
>      - Remove all obsolete elements (kref, lock, waitqueues)
>      - Add tracking of RX buffer budget
>      - Use WWAN TX flow control function to stop TX when MHI queue is full
>  v9: - Add proper locking for rx_budget + rx_refill scheduling
>      - Fix cocci errors (use-after-free, ERR_CAST)
>
[...]
> +static int mhi_wwan_ctrl_probe(struct mhi_device *mhi_dev,
> +                              const struct mhi_device_id *id)
> +{
> +       struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
> +       struct mhi_wwan_dev *mhiwwan;
> +       struct wwan_port *port;
> +
> +       mhiwwan = kzalloc(sizeof(*mhiwwan), GFP_KERNEL);
> +       if (!mhiwwan)
> +               return -ENOMEM;
> +
> +       mhiwwan->mhi_dev = mhi_dev;
> +       mhiwwan->mtu = MHI_WWAN_MAX_MTU;
> +       INIT_WORK(&mhiwwan->rx_refill, mhi_wwan_ctrl_refill_work);
> +       spin_lock_init(&mhiwwan->tx_lock);
> +       spin_lock_init(&mhiwwan->rx_lock);
> +
> +       if (mhi_dev->dl_chan)
> +               set_bit(MHI_WWAN_DL_CAP, &mhiwwan->flags);
> +       if (mhi_dev->ul_chan)
> +               set_bit(MHI_WWAN_UL_CAP, &mhiwwan->flags);
> +
> +       dev_set_drvdata(&mhi_dev->dev, mhiwwan);
> +
> +       /* Register as a wwan port, id->driver_data contains wwan port type */
> +       port = wwan_create_port(&cntrl->mhi_dev->dev, id->driver_data,
> +                               &wwan_pops, mhiwwan);
> +       if (IS_ERR(mhiwwan->wwan_port)) {

Should obviously be IS_ERR(port)... but waiting for comments on the
series before resubmitting.


> +               kfree(mhiwwan);
> +               return PTR_ERR(port);
> +       }
> +
> +       mhiwwan->wwan_port = port;
> +
> +       return 0;
> +};

  reply	other threads:[~2021-04-05 10:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05  9:52 [PATCH net-next v9 1/2] net: Add a WWAN subsystem Loic Poulain
2021-04-05  9:52 ` [PATCH net-next v9 2/2] net: Add Qcom WWAN control driver Loic Poulain
2021-04-05 10:30   ` Loic Poulain [this message]
2021-04-05 13:12   ` [PATCH] net: fix odd_ptr_err.cocci warnings kernel test robot
2021-04-07 14:32 ` [PATCH net-next v9 1/2] net: Add a WWAN subsystem Dan Williams
2021-04-08  8:56   ` Loic Poulain
2021-04-08 20:05     ` Aleksander Morgado

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=CAMZdPi-b0diW-80QhXLen0UJVHYQH_qixnZ+he_wWaoFxW5Dxg@mail.gmail.com \
    --to=loic.poulain@linaro.org \
    --cc=aleksander@aleksander.es \
    --cc=bjorn.andersson@linaro.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).