Re: [PATCH net-next v9 2/2] net: Add Qcom WWAN control driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 5 Apr 2021 at 11:44, Loic Poulain <loic.poulain@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
>  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;
> +};



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux