]> Git Repo - J-linux.git/commitdiff
net: wwan: mhi: make default data link id configurable
authorSlark Xiao <[email protected]>
Mon, 1 Jul 2024 02:12:16 +0000 (10:12 +0800)
committerManivannan Sadhasivam <[email protected]>
Wed, 3 Jul 2024 13:41:01 +0000 (19:11 +0530)
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]>
drivers/net/wwan/mhi_wwan_mbim.c

index f2aef84fc08d25e06abac03c421e5281e824a5b4..d5a9360323d29df4b6665bef0949e017c90876a4 100644 (file)
@@ -42,6 +42,8 @@
 #define MHI_MBIM_LINK_HASH_SIZE 8
 #define LINK_HASH(session) ((session) % MHI_MBIM_LINK_HASH_SIZE)
 
+#define WDS_BIND_MUX_DATA_PORT_MUX_ID 112
+
 struct mhi_mbim_link {
        struct mhi_mbim_context *mbim;
        struct net_device *ndev;
@@ -93,6 +95,15 @@ static struct mhi_mbim_link *mhi_mbim_get_link_rcu(struct mhi_mbim_context *mbim
        return NULL;
 }
 
+static int mhi_mbim_get_link_mux_id(struct mhi_controller *cntrl)
+{
+       if (strcmp(cntrl->name, "foxconn-dw5934e") == 0 ||
+           strcmp(cntrl->name, "foxconn-t99w515") == 0)
+               return WDS_BIND_MUX_DATA_PORT_MUX_ID;
+
+       return 0;
+}
+
 static struct sk_buff *mbim_tx_fixup(struct sk_buff *skb, unsigned int session,
                                     u16 tx_seq)
 {
@@ -596,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;
+       int err, link_id;
 
        mbim = devm_kzalloc(&mhi_dev->dev, sizeof(*mbim), GFP_KERNEL);
        if (!mbim)
@@ -617,8 +628,11 @@ 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, 0);
+       return wwan_register_ops(&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, link_id);
 }
 
 static void mhi_mbim_remove(struct mhi_device *mhi_dev)
This page took 0.044752 seconds and 4 git commands to generate.