Re: [PATCH v3] net: hinic: Set max_mtu/min_mtu directly to simplify the code.

From: Paolo Abeni
Date: Thu Oct 20 2022 - 05:09:46 EST


On Tue, 2022-10-18 at 19:06 +0800, Cai Huoqing wrote:
> Set max_mtu/min_mtu directly to avoid making the validity judgment
> when set mtu, because the judgment is made in net/core: dev_validate_mtu,
> so to simplify the code.
>
> Signed-off-by: Cai Huoqing <cai.huoqing@xxxxxxxxx>
> ---
> v1->v2:
> 1.Update changelog.
> 2.Reverse MAX_MTU to max jumbo frame size.
>
> v2->v3:
> 1.Update signature
>
> v1 link: https://lore.kernel.org/lkml/20221012082945.10353-1-cai.huoqing@xxxxxxxxx/
> v2 link: https://lore.kernel.org/lkml/20220429033733.GA15753@chq-T47/
>
>
> drivers/net/ethernet/huawei/hinic/hinic_dev.h | 4 ++++
> drivers/net/ethernet/huawei/hinic/hinic_main.c | 3 ++-
> drivers/net/ethernet/huawei/hinic/hinic_port.c | 17 +----------------
> 3 files changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_dev.h
> index a4fbf44f944c..2bbc94c0a9c1 100644
> --- a/drivers/net/ethernet/huawei/hinic/hinic_dev.h
> +++ b/drivers/net/ethernet/huawei/hinic/hinic_dev.h
> @@ -22,6 +22,10 @@
>
> #define LP_PKT_CNT 64
>
> +#define HINIC_MAX_JUMBO_FRAME_SIZE 15872
> +#define HINIC_MAX_MTU_SIZE (HINIC_MAX_JUMBO_FRAME_SIZE - ETH_HLEN - ETH_FCS_LEN)
> +#define HINIC_MIN_MTU_SIZE 256

I'm sorry for the nit pick, but the above is whitespace-damaged: you
are mixing spaces and tabs.

Cheers,

Paolo