aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Palmas <dnlplm@gmail.com>2023-08-01 14:38:24 +0200
committerAleksander Morgado <aleksander@aleksander.es>2023-08-07 10:52:55 +0000
commit65e2db75edb6b792aa8f270899718e24ce80d03a (patch)
treea89f46732a3a8d439b4a1e9979a3493d983e2def
parent639900ed36470ef5c979df9b69fa6bf7793b6b21 (diff)
port-qmi: restore driver initial MTU for mhi-net when resetting link
Kernel driver mhi-net sets a custom MTU for the netdevice: use the same value when resetting the netdevice to its initial state. This is important especially when rmnet is used on top of mhi-net, since rmnet netdevices get their initial MTU from the mhi-net one.
-rw-r--r--src/mm-port-qmi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c
index c0cf6092..46a14b63 100644
--- a/src/mm-port-qmi.c
+++ b/src/mm-port-qmi.c
@@ -33,6 +33,7 @@
/* as internally defined in the kernel */
#define RMNET_MAX_PACKET_SIZE 16384
+#define MHI_NET_MTU_DEFAULT 16384
G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT)
@@ -977,6 +978,7 @@ internal_reset (MMPortQmi *self,
{
GTask *task;
InternalResetContext *ctx;
+ guint mtu;
task = g_task_new (self, NULL, callback, user_data);
@@ -985,12 +987,18 @@ internal_reset (MMPortQmi *self,
ctx->device = g_object_ref (device);
g_task_set_task_data (task, ctx, (GDestroyNotify) internal_reset_context_free);
+ /* mhi_net has a custom default MTU set by the kernel driver */
+ if (g_strcmp0 (self->priv->net_driver, "mhi_net") == 0)
+ mtu = MHI_NET_MTU_DEFAULT;
+ else
+ mtu = MM_PORT_NET_MTU_DEFAULT;
+
/* first, bring down main interface */
mm_obj_dbg (self, "bringing down data interface '%s'",
mm_port_get_device (ctx->data));
mm_port_net_link_setup (MM_PORT_NET (ctx->data),
FALSE,
- MM_PORT_NET_MTU_DEFAULT,
+ mtu,
NULL,
(GAsyncReadyCallback) net_link_down_ready,
task);