netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
@ 2025-06-03  9:12 Daniele Palmas
  2025-06-03 13:10 ` Loic Poulain
  2025-06-05 10:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniele Palmas @ 2025-06-03  9:12 UTC (permalink / raw)
  To: Loic Poulain, Sergey Ryazanov, Johannes Berg, Slark Xiao,
	Manivannan Sadhasivam
  Cc: Andrew Lunn, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet, netdev, Daniele Palmas

Recent Qualcomm chipsets like SDX72/75 require MBIM sessionId mapping
to muxId in the range (0x70-0x8F) for the PCIe tethered use.

This has been partially addressed by the referenced commit, mapping
the default data call to muxId = 112, but the multiplexed data calls
scenario was not properly considered, mapping sessionId = 1 to muxId
1, while it should have been 113.

Fix this by moving the session_id assignment logic to mhi_mbim_newlink,
in order to map sessionId = n to muxId = n + WDS_BIND_MUX_DATA_PORT_MUX_ID.

Fixes: 65bc58c3dcad ("net: wwan: mhi: make default data link id configurable")
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
v2: change commit description including information from QC case according to
Loic's feedback

@Loic, I've left out the mux-id macro/function renaming, since I'm not sure
that it can really be considered a fix for net. Maybe we can think about it
when net-next opens again.

 drivers/net/wwan/mhi_wwan_mbim.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c
index 8755c5e6a65b..c814fbd756a1 100644
--- a/drivers/net/wwan/mhi_wwan_mbim.c
+++ b/drivers/net/wwan/mhi_wwan_mbim.c
@@ -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: 408da3a0f89d581421ca9bd6ff39c7dd05bc4b2f
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
  2025-06-03  9:12 [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing Daniele Palmas
@ 2025-06-03 13:10 ` Loic Poulain
  2025-06-05 10:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2025-06-03 13:10 UTC (permalink / raw)
  To: Daniele Palmas
  Cc: Sergey Ryazanov, Johannes Berg, Slark Xiao, Manivannan Sadhasivam,
	Andrew Lunn, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Eric Dumazet, netdev

On Tue, Jun 3, 2025 at 11:24 AM Daniele Palmas <dnlplm@gmail.com> wrote:
>
> Recent Qualcomm chipsets like SDX72/75 require MBIM sessionId mapping
> to muxId in the range (0x70-0x8F) for the PCIe tethered use.
>
> This has been partially addressed by the referenced commit, mapping
> the default data call to muxId = 112, but the multiplexed data calls
> scenario was not properly considered, mapping sessionId = 1 to muxId
> 1, while it should have been 113.
>
> Fix this by moving the session_id assignment logic to mhi_mbim_newlink,
> in order to map sessionId = n to muxId = n + WDS_BIND_MUX_DATA_PORT_MUX_ID.
>
> Fixes: 65bc58c3dcad ("net: wwan: mhi: make default data link id configurable")
> Signed-off-by: Daniele Palmas <dnlplm@gmail.com>

Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>


> ---
> v2: change commit description including information from QC case according to
> Loic's feedback
>
> @Loic, I've left out the mux-id macro/function renaming, since I'm not sure
> that it can really be considered a fix for net. Maybe we can think about it
> when net-next opens again.
>
>  drivers/net/wwan/mhi_wwan_mbim.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c
> index 8755c5e6a65b..c814fbd756a1 100644
> --- a/drivers/net/wwan/mhi_wwan_mbim.c
> +++ b/drivers/net/wwan/mhi_wwan_mbim.c
> @@ -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: 408da3a0f89d581421ca9bd6ff39c7dd05bc4b2f
> --
> 2.37.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
  2025-06-03  9:12 [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing Daniele Palmas
  2025-06-03 13:10 ` Loic Poulain
@ 2025-06-05 10:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-05 10:30 UTC (permalink / raw)
  To: Daniele Palmas
  Cc: loic.poulain, ryazanov.s.a, johannes, slark_xiao,
	manivannan.sadhasivam, andrew+netdev, davem, kuba, pabeni,
	edumazet, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue,  3 Jun 2025 11:12:04 +0200 you wrote:
> Recent Qualcomm chipsets like SDX72/75 require MBIM sessionId mapping
> to muxId in the range (0x70-0x8F) for the PCIe tethered use.
> 
> This has been partially addressed by the referenced commit, mapping
> the default data call to muxId = 112, but the multiplexed data calls
> scenario was not properly considered, mapping sessionId = 1 to muxId
> 1, while it should have been 113.
> 
> [...]

Here is the summary with links:
  - [net,v2,1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing
    https://git.kernel.org/netdev/net/c/501fe52aa908

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-05 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03  9:12 [PATCH net v2 1/1] net: wwan: mhi_wwan_mbim: use correct mux_id for multiplexing Daniele Palmas
2025-06-03 13:10 ` Loic Poulain
2025-06-05 10:30 ` patchwork-bot+netdevbpf

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).