net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
Subsystems (3)
PATCH 1/1 net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
When creating a multiplexed netdevice for modems requiring the WDS custom mux_id value, the mux_id improperly starts from 1, while it should start from WDS_BIND_MUX_DATA_PORT_MUX_ID + 1.
Fix this by moving the session_id assignment logic to mhi_mbim_newlink.
--- drivers/net/wwan/mhi_wwan_mbim.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wwan/mhi_wwan_mbim.c +3 -6
@@ -550,8 +550,8 @@ static int mhi_mbim_newlink(void *ctxt, struct net_device *ndev, u32 if_id,struct mhi_mbim_link *link =wwan_netdev_drvpriv (ndev);struct mhi_mbim_context *mbim = ctxt; - link->session = if_id; link->mbim = mbim; + link->session =mhi_mbim_get_link_mux_id (link->mbim->mdev->mhi_cntrl) + if_id; link->ndev = ndev;u64_stats_init (&link->rx_syncp);u64_stats_init (&link->tx_syncp);
@@ -607,7 +607,7 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id {struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;struct mhi_mbim_context *mbim; -int err, link_id; +int err; mbim =devm_kzalloc (&mhi_dev->dev,sizeof (*mbim),GFP_KERNEL );if (!mbim)
@@ -628,11 +628,8 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id/* Number of transfer descriptors determines size of the queue */ mbim->rx_queue_sz =mhi_get_free_desc_count (mhi_dev,DMA_FROM_DEVICE ); -/* Get the corresponding mux_id from mhi */ - link_id =mhi_mbim_get_link_mux_id (cntrl); -/* Register wwan link ops with MHI controller representing WWAN instance */ -return wwan_register_ops (&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, link_id); +return wwan_register_ops (&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim,0 ); }static void mhi_mbim_remove (struct mhi_device *mhi_dev)
base-commit: 5cdb2c77c4c3d36bdee83d9231649941157f8204
Signature · 1 line
2.37.1
Loic Poulain
maintainerHi Daniele,
Quoted 6 lines · Daniele Palmas
When creating a multiplexed netdevice for modems requiring the WDS custom
mux_idvalue, themux_idimproperly starts from 1, while it should start fromWDS_BIND_MUX_DATA_PORT_MUX_ID+ 1.Fix this by moving the
session_idassignment logic tomhi_mbim_newlink.
Currently, the MBIM session ID is identical to the WWAN ID. This change introduces a divergence by applying an offset to the WWAN ID for certain devices.
Whether this is acceptable likely depends on how the MBIM control path handles session addressing. For example, if mbimcli refers to SessionID 1, does that actually control the data session with WWAN ID 113?
Regards,
Loic
Hi Loic,
Il giorno lun 26 mag 2025 alle ore 16:06 Loic Poulain <[email protected]> ha scritto:
Quoted 11 lines
Hi Daniele,
Quoted 6 lines · Daniele Palmas
When creating a multiplexed netdevice for modems requiring the WDS custom
mux_idvalue, themux_idimproperly starts from 1, while it should start fromWDS_BIND_MUX_DATA_PORT_MUX_ID+ 1.Fix this by moving the
session_idassignment logic tomhi_mbim_newlink.
Quoted 9 lines
Currently, the MBIM session ID is identical to the WWAN ID. This change introduces a divergence by applying an offset to the WWAN ID for certain devices.
Whether this is acceptable likely depends on how the MBIM control path handles session addressing. For example, if mbimcli refers to SessionID 1, does that actually control the data session with WWAN ID 113?
yes, quoting from a QC case we had:
"There was a change in QBI on SDX75/72 to map sessionid from MBIM to muxids in the range (0x70-0x8F) for the PCIE tethered use. So, if you are bringing up data call using MBIM sessionId=1, QBI will bind that port to MuxId=113. So, the IP data packets are also expected to come from host on MuxId=113."
Regards,
Daniele
Quoted 2 lines
Regards,
Loic
Loic Poulain
maintainerQuoted 26 lines · Daniele Palmas
Hi Loic,
Il giorno lun 26 mag 2025 alle ore 16:06 Loic Poulain <[email protected]> ha scritto:
Quoted 11 lines
Hi Daniele,
Quoted 6 lines · Daniele Palmas
When creating a multiplexed netdevice for modems requiring the WDS custom
mux_idvalue, themux_idimproperly starts from 1, while it should start fromWDS_BIND_MUX_DATA_PORT_MUX_ID+ 1.Fix this by moving the
session_idassignment logic tomhi_mbim_newlink.Quoted 9 lines
Currently, the MBIM session ID is identical to the WWAN ID. This change introduces a divergence by applying an offset to the WWAN ID for certain devices.
Whether this is acceptable likely depends on how the MBIM control path handles session addressing. For example, if mbimcli refers to SessionID 1, does that actually control the data session with WWAN ID 113?
Quoted 7 lines
yes, quoting from a QC case we had:
"There was a change in QBI on SDX75/72 to map sessionid from MBIM to muxids in the range (0x70-0x8F) for the PCIE tethered use. So, if you are bringing up data call using MBIM sessionId=1, QBI will bind that port to MuxId=113. So, the IP data packets are also expected to come from host on MuxId=113."
Ack, could you please include that information in the commit message? Also, we should consider renaming the mux-id macro/function to make its purpose clearer.
Regards,
Loic
Hi Loic,
Il giorno lun 26 mag 2025 alle ore 22:38 Loic Poulain <[email protected]> ha scritto:
Quoted 30 lines · Daniele Palmas
Quoted 28 lines
Hi Loic,
Il giorno lun 26 mag 2025 alle ore 16:06 Loic Poulain <[email protected]> ha scritto:
Quoted 11 lines
Hi Daniele,
Quoted 6 lines · Daniele Palmas
When creating a multiplexed netdevice for modems requiring the WDS custom
mux_idvalue, themux_idimproperly starts from 1, while it should start fromWDS_BIND_MUX_DATA_PORT_MUX_ID+ 1.Fix this by moving the
session_idassignment logic tomhi_mbim_newlink.Quoted 9 lines
Currently, the MBIM session ID is identical to the WWAN ID. This change introduces a divergence by applying an offset to the WWAN ID for certain devices.
Whether this is acceptable likely depends on how the MBIM control path handles session addressing. For example, if mbimcli refers to SessionID 1, does that actually control the data session with WWAN ID 113?
yes, quoting from a QC case we had:
Quoted 7 lines
Quoted 5 lines
"There was a change in QBI on SDX75/72 to map sessionid from MBIM to muxids in the range (0x70-0x8F) for the PCIE tethered use. So, if you are bringing up data call using MBIM sessionId=1, QBI will bind that port to MuxId=113. So, the IP data packets are also expected to come from host on MuxId=113."
Ack, could you please include that information in the commit message?
Sure.
Quoted 3 lines
Also, we should consider renaming the mux-id macro/function to make its purpose clearer.
Ok, let me see if I'm able to find a better name.
I'll wait a few days to see if more comments are coming, then resend.
Thanks,
Daniele
Quoted 2 lines
Regards,
Loic