diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-07-31 23:45:26 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-08-09 12:22:26 +0000 |
commit | 965c43fec7b5ca25483b1d73f0bdec339636f996 (patch) | |
tree | 34982876b59024f8e39680a43bbb8c615c02a00c /src/mm-port-qmi.c | |
parent | 5adc469701abc6b08432cb0f59294cb52755354b (diff) |
port-qmi: limit MTU to max RMNET packet size
The maximum MTU that the master interface can support should be less
or equal than RMNET_MAX_PACKET_SIZE, as defined in the
`rmnet_private.h` file in the linux sources (not a public header).
Only applicable to RMNET link management (i.e. not to qmi_wwan
add_mux/del_mux).
Fixes https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/71
Diffstat (limited to 'src/mm-port-qmi.c')
-rw-r--r-- | src/mm-port-qmi.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c index 5cccb02a..a7fbee84 100644 --- a/src/mm-port-qmi.c +++ b/src/mm-port-qmi.c @@ -31,6 +31,9 @@ #define DEFAULT_LINK_PREALLOCATED_AMOUNT 4 +/* as internally defined in the kernel */ +#define RMNET_MAX_PACKET_SIZE 16384 + G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT) #if defined WITH_QRTR @@ -1321,8 +1324,13 @@ setup_master_mtu (GTask *task) * aggregation size */ if (ctx->kernel_data_modes_requested & (MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET | MM_PORT_QMI_KERNEL_DATA_MODE_MUX_QMIWWAN)) { /* Load current max datagram size supported */ - if (MM_PORT_QMI_DAP_IS_SUPPORTED_QMAP (ctx->wda_dl_dap_requested)) + if (MM_PORT_QMI_DAP_IS_SUPPORTED_QMAP (ctx->wda_dl_dap_requested)) { mtu = ctx->wda_dl_dap_max_size_current; + if ((ctx->kernel_data_modes_requested & MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET) && (mtu > RMNET_MAX_PACKET_SIZE)) { + mm_obj_dbg (self, "mtu limited to maximum rmnet packet size"); + mtu = RMNET_MAX_PACKET_SIZE; + } + } /* If no max aggregation size was specified by the modem (e.g. if we requested QMAP * aggregation protocol but the modem doesn't support it), skip */ |