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.
This commit is contained in:

committed by
Aleksander Morgado

parent
639900ed36
commit
65e2db75ed
@@ -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);
|
||||
|
Reference in New Issue
Block a user