Skip to content

Commit 65bc58c

Browse files
SlarkXiaoMani-Sadhasivam
authored andcommitted
net: wwan: mhi: make default data link id configurable
For SDX72 MBIM mode, it starts data mux id from 112 instead of 0. This would lead to device can't ping outside successfully. Also MBIM side would report "bad packet session (112)". In order to fix this issue, we decide to use the device name of MHI controller to do a match in wwan side. Then wwan driver could set a corresponding mux_id value according to the MHI product. Signed-off-by: Slark Xiao <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]>
1 parent 6334786 commit 65bc58c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/net/wwan/mhi_wwan_mbim.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define MHI_MBIM_LINK_HASH_SIZE 8
4343
#define LINK_HASH(session) ((session) % MHI_MBIM_LINK_HASH_SIZE)
4444

45+
#define WDS_BIND_MUX_DATA_PORT_MUX_ID 112
46+
4547
struct mhi_mbim_link {
4648
struct mhi_mbim_context *mbim;
4749
struct net_device *ndev;
@@ -93,6 +95,15 @@ static struct mhi_mbim_link *mhi_mbim_get_link_rcu(struct mhi_mbim_context *mbim
9395
return NULL;
9496
}
9597

98+
static int mhi_mbim_get_link_mux_id(struct mhi_controller *cntrl)
99+
{
100+
if (strcmp(cntrl->name, "foxconn-dw5934e") == 0 ||
101+
strcmp(cntrl->name, "foxconn-t99w515") == 0)
102+
return WDS_BIND_MUX_DATA_PORT_MUX_ID;
103+
104+
return 0;
105+
}
106+
96107
static struct sk_buff *mbim_tx_fixup(struct sk_buff *skb, unsigned int session,
97108
u16 tx_seq)
98109
{
@@ -596,7 +607,7 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id
596607
{
597608
struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
598609
struct mhi_mbim_context *mbim;
599-
int err;
610+
int err, link_id;
600611

601612
mbim = devm_kzalloc(&mhi_dev->dev, sizeof(*mbim), GFP_KERNEL);
602613
if (!mbim)
@@ -617,8 +628,11 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id
617628
/* Number of transfer descriptors determines size of the queue */
618629
mbim->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
619630

631+
/* Get the corresponding mux_id from mhi */
632+
link_id = mhi_mbim_get_link_mux_id(cntrl);
633+
620634
/* Register wwan link ops with MHI controller representing WWAN instance */
621-
return wwan_register_ops(&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, 0);
635+
return wwan_register_ops(&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, link_id);
622636
}
623637

624638
static void mhi_mbim_remove(struct mhi_device *mhi_dev)

0 commit comments

Comments
 (0)