diff mbox series

[RESEND,net-next,1/2] net: mhi: Allow decoupled MTU/MRU

Message ID 1616510707-27210-1-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 warning 1 maintainers not CCed: mani@kernel.org
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, 20 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
If a maximum receive unit (MRU) size is specified, use it for RX
buffers allocation instead of the MTU.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/mhi/mhi.h | 1 +
 drivers/net/mhi/net.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski March 24, 2021, 9:42 p.m. UTC | #1
On Tue, 23 Mar 2021 15:45:06 +0100 Loic Poulain wrote:
> If a maximum receive unit (MRU) size is specified, use it for RX
> buffers allocation instead of the MTU.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

I don't think this patch represents a logical change. You should merge
your patches into one.

> diff --git a/drivers/net/mhi/mhi.h b/drivers/net/mhi/mhi.h
> index 12e7407..1d0c499 100644
> --- a/drivers/net/mhi/mhi.h
> +++ b/drivers/net/mhi/mhi.h
> @@ -29,6 +29,7 @@ struct mhi_net_dev {
>  	struct mhi_net_stats stats;
>  	u32 rx_queue_sz;
>  	int msg_enable;
> +	unsigned int mru;
>  };
>  
>  struct mhi_net_proto {
> diff --git a/drivers/net/mhi/net.c b/drivers/net/mhi/net.c
> index f599608..5ec7a29 100644
> --- a/drivers/net/mhi/net.c
> +++ b/drivers/net/mhi/net.c
> @@ -265,10 +265,12 @@ static void mhi_net_rx_refill_work(struct work_struct *work)
>  						      rx_refill.work);
>  	struct net_device *ndev = mhi_netdev->ndev;
>  	struct mhi_device *mdev = mhi_netdev->mdev;
> -	int size = READ_ONCE(ndev->mtu);
>  	struct sk_buff *skb;
> +	unsigned int size;
>  	int err;
>  
> +	size = mhi_netdev->mru ? mhi_netdev->mru : READ_ONCE(ndev->mtu);
> +
>  	while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) {
>  		skb = netdev_alloc_skb(ndev, size);
>  		if (unlikely(!skb))
diff mbox series

Patch

diff --git a/drivers/net/mhi/mhi.h b/drivers/net/mhi/mhi.h
index 12e7407..1d0c499 100644
--- a/drivers/net/mhi/mhi.h
+++ b/drivers/net/mhi/mhi.h
@@ -29,6 +29,7 @@  struct mhi_net_dev {
 	struct mhi_net_stats stats;
 	u32 rx_queue_sz;
 	int msg_enable;
+	unsigned int mru;
 };
 
 struct mhi_net_proto {
diff --git a/drivers/net/mhi/net.c b/drivers/net/mhi/net.c
index f599608..5ec7a29 100644
--- a/drivers/net/mhi/net.c
+++ b/drivers/net/mhi/net.c
@@ -265,10 +265,12 @@  static void mhi_net_rx_refill_work(struct work_struct *work)
 						      rx_refill.work);
 	struct net_device *ndev = mhi_netdev->ndev;
 	struct mhi_device *mdev = mhi_netdev->mdev;
-	int size = READ_ONCE(ndev->mtu);
 	struct sk_buff *skb;
+	unsigned int size;
 	int err;
 
+	size = mhi_netdev->mru ? mhi_netdev->mru : READ_ONCE(ndev->mtu);
+
 	while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) {
 		skb = netdev_alloc_skb(ndev, size);
 		if (unlikely(!skb))