diff options
author | Loic Poulain <loic.poulain@linaro.org> | 2021-03-29 17:39:32 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-29 16:26:16 -0700 |
commit | 3af562a37b7f1a5dbeb50a00ace280ba2d984762 (patch) | |
tree | 95c1cb2d71fb9464784ede84061a3bff12e0594a /drivers/net/mhi/proto_mbim.c | |
parent | d9f0713c9217fdd31077f890c2e15232ad2f0772 (diff) |
net: mhi: Allow decoupled MTU/MRU
MBIM protocol makes the mhi network interface asymmetric, ingress data
received from MHI is MBIM protocol, possibly containing multiple
aggregated IP packets, while egress data received from network stack is
IP protocol.
This changes allows a 'protocol' to specify its own MRU, that when
specified is used to allocate MHI RX buffers (skb).
For MBIM, Set the default MTU to 1500, which is the usual network MTU
for WWAN IP packets, and MRU to 3.5K (for allocation efficiency),
allowing skb to fit in an usual 4K page (including padding,
skb_shared_info, ...).
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mhi/proto_mbim.c')
-rw-r--r-- | drivers/net/mhi/proto_mbim.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/mhi/proto_mbim.c b/drivers/net/mhi/proto_mbim.c index 5a176c3eed53..fc72b3f6ec9e 100644 --- a/drivers/net/mhi/proto_mbim.c +++ b/drivers/net/mhi/proto_mbim.c @@ -26,6 +26,15 @@ #define MBIM_NDP16_SIGN_MASK 0x00ffffff +/* Usual WWAN MTU */ +#define MHI_MBIM_DEFAULT_MTU 1500 + +/* 3500 allows to optimize skb allocation, the skbs will basically fit in + * one 4K page. Large MBIM packets will simply be split over several MHI + * transfers and chained by the MHI net layer (zerocopy). + */ +#define MHI_MBIM_DEFAULT_MRU 3500 + struct mbim_context { u16 rx_seq; u16 tx_seq; @@ -281,6 +290,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; } |