diff mbox series

[RESEND,net-next,2/2] net: mhi: proto_mbim: Adjust MTU and MRU

Message ID 1616510707-27210-2-git-send-email-loic.poulain@linaro.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [RESEND,net-next,1/2] net: mhi: Allow decoupled MTU/MRU | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Loic Poulain March 23, 2021, 2:45 p.m. UTC
MBIM protocol makes the interface asymmetric, ingress data received
from MHI is MBIM protocol, that can contain multiple aggregated IP
packets, while egress data received from network stack is IP protocol.

Set a default MTU to 1500 (usual network MTU for WWAN), and MRU to 32K
which is the default size of MBIM-over-MHI packets.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/mhi/proto_mbim.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jakub Kicinski March 24, 2021, 9:46 p.m. UTC | #1
On Tue, 23 Mar 2021 15:45:07 +0100 Loic Poulain wrote:
> MBIM protocol makes the interface asymmetric, ingress data received
> from MHI is MBIM protocol, that can contain multiple aggregated IP
> packets, while egress data received from network stack is IP protocol.
> 
> Set a default MTU to 1500 (usual network MTU for WWAN), and MRU to 32K
> which is the default size of MBIM-over-MHI packets.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  drivers/net/mhi/proto_mbim.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/mhi/proto_mbim.c b/drivers/net/mhi/proto_mbim.c
> index 75b5484..29d8577 100644
> --- a/drivers/net/mhi/proto_mbim.c
> +++ b/drivers/net/mhi/proto_mbim.c
> @@ -26,6 +26,9 @@
>  
>  #define MBIM_NDP16_SIGN_MASK 0x00ffffff
>  
> +#define MHI_MBIM_DEFAULT_MRU 32768
> +#define MHI_MBIM_DEFAULT_MTU 1500
> +
>  struct mbim_context {
>  	u16 rx_seq;
>  	u16 tx_seq;
> @@ -282,6 +285,8 @@ static int mbim_init(struct mhi_net_dev *mhi_netdev)
>  		return -ENOMEM;
>  
>  	ndev->needed_headroom = sizeof(struct mbim_tx_hdr);
> +	ndev->mtu = MHI_MBIM_DEFAULT_MTU;
> +	mhi_netdev->mru = MHI_MBIM_DEFAULT_MRU;
>  
>  	return 0;
>  }

32k + skb overhead will result in rather large contiguous allocation.
Using ~3.5k buffers (basically a page - paddings and skb_shinfo) should
be much more resilient, and still very efficient.

This sort of 32k buffer thing is common for USB, but I thought MHI is
over PCI so there should be no bus considerations once we're above 1k.
diff mbox series

Patch

diff --git a/drivers/net/mhi/proto_mbim.c b/drivers/net/mhi/proto_mbim.c
index 75b5484..29d8577 100644
--- a/drivers/net/mhi/proto_mbim.c
+++ b/drivers/net/mhi/proto_mbim.c
@@ -26,6 +26,9 @@ 
 
 #define MBIM_NDP16_SIGN_MASK 0x00ffffff
 
+#define MHI_MBIM_DEFAULT_MRU 32768
+#define MHI_MBIM_DEFAULT_MTU 1500
+
 struct mbim_context {
 	u16 rx_seq;
 	u16 tx_seq;
@@ -282,6 +285,8 @@  static int mbim_init(struct mhi_net_dev *mhi_netdev)
 		return -ENOMEM;
 
 	ndev->needed_headroom = sizeof(struct mbim_tx_hdr);
+	ndev->mtu = MHI_MBIM_DEFAULT_MTU;
+	mhi_netdev->mru = MHI_MBIM_DEFAULT_MRU;
 
 	return 0;
 }