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
This commit is contained in:
@@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
#define DEFAULT_LINK_PREALLOCATED_AMOUNT 4
|
#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)
|
G_DEFINE_TYPE (MMPortQmi, mm_port_qmi, MM_TYPE_PORT)
|
||||||
|
|
||||||
#if defined WITH_QRTR
|
#if defined WITH_QRTR
|
||||||
@@ -1321,8 +1324,13 @@ setup_master_mtu (GTask *task)
|
|||||||
* aggregation size */
|
* aggregation size */
|
||||||
if (ctx->kernel_data_modes_requested & (MM_PORT_QMI_KERNEL_DATA_MODE_MUX_RMNET | MM_PORT_QMI_KERNEL_DATA_MODE_MUX_QMIWWAN)) {
|
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 */
|
/* 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;
|
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
|
/* 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 */
|
* aggregation protocol but the modem doesn't support it), skip */
|
||||||
|
Reference in New Issue
Block a user