On Fri, Jul 9, 2021 at 10:30 AM Ferruh Yigit <ferruh.yi...@intel.com> wrote:

> Setting MTU bigger than RTE_ETHER_MTU requires the jumbo frame support,
> and application should enable the jumbo frame offload support for it.
>
> When jumbo frame offload is not enabled by application, but MTU bigger
> than RTE_ETHER_MTU is requested there are two options, either fail or
> enable jumbo frame offload implicitly.
>
> Enabling jumbo frame offload implicitly is selected by many drivers
> since setting a big MTU value already implies it, and this increases
> usability.
>
> This patch moves this logic from drivers to the library, both to reduce
> the duplicated code in the drivers and to make behaviour more visible.
>
> Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>
> ---
>  drivers/net/axgbe/axgbe_ethdev.c        |  9 ++-------
>  drivers/net/bnxt/bnxt_ethdev.c          |  9 ++-------
>  drivers/net/cnxk/cnxk_ethdev_ops.c      |  5 -----
>  drivers/net/cxgbe/cxgbe_ethdev.c        |  8 --------
>  drivers/net/dpaa/dpaa_ethdev.c          |  7 -------
>  drivers/net/dpaa2/dpaa2_ethdev.c        |  7 -------
>  drivers/net/e1000/em_ethdev.c           |  9 ++-------
>  drivers/net/e1000/igb_ethdev.c          |  9 ++-------
>  drivers/net/enetc/enetc_ethdev.c        |  7 -------
>  drivers/net/hinic/hinic_pmd_ethdev.c    |  7 -------
>  drivers/net/hns3/hns3_ethdev.c          |  8 --------
>  drivers/net/hns3/hns3_ethdev_vf.c       |  6 ------
>  drivers/net/i40e/i40e_ethdev.c          |  5 -----
>  drivers/net/i40e/i40e_ethdev_vf.c       |  5 -----
>  drivers/net/iavf/iavf_ethdev.c          |  7 -------
>  drivers/net/ice/ice_ethdev.c            |  5 -----
>  drivers/net/igc/igc_ethdev.c            |  9 ++-------
>  drivers/net/ipn3ke/ipn3ke_representor.c |  5 -----
>  drivers/net/ixgbe/ixgbe_ethdev.c        |  7 ++-----
>  drivers/net/liquidio/lio_ethdev.c       |  7 -------
>  drivers/net/nfp/nfp_net.c               |  6 ------
>  drivers/net/octeontx/octeontx_ethdev.c  |  5 -----
>  drivers/net/octeontx2/otx2_ethdev_ops.c |  5 -----
>  drivers/net/qede/qede_ethdev.c          |  4 ----
>  drivers/net/sfc/sfc_ethdev.c            |  9 ---------
>  drivers/net/thunderx/nicvf_ethdev.c     |  6 ------
>  drivers/net/txgbe/txgbe_ethdev.c        |  6 ------
>  lib/ethdev/rte_ethdev.c                 | 18 +++++++++++++++++-
>  28 files changed, 29 insertions(+), 171 deletions(-)
>
> diff --git a/drivers/net/axgbe/axgbe_ethdev.c
> b/drivers/net/axgbe/axgbe_ethdev.c
> index 76aeec077f2b..2960834b4539 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.c
> +++ b/drivers/net/axgbe/axgbe_ethdev.c
> @@ -1492,15 +1492,10 @@ static int axgb_mtu_set(struct rte_eth_dev *dev,
> uint16_t mtu)
>                                 dev->data->port_id);
>                 return -EBUSY;
>         }
> -       if (mtu > RTE_ETHER_MTU) {
> -               dev->data->dev_conf.rxmode.offloads |=
> -                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> +       if (mtu > RTE_ETHER_MTU)
>                 val = 1;
> -       } else {
> -               dev->data->dev_conf.rxmode.offloads &=
> -                       ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> +       else
>                 val = 0;
> -       }
>         AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
>         return 0;
>  }
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c
> b/drivers/net/bnxt/bnxt_ethdev.c
> index 335505a106d5..4344a012f06e 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -3018,15 +3018,10 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev,
> uint16_t new_mtu)
>                 return -EINVAL;
>         }
>
> -       if (new_mtu > RTE_ETHER_MTU) {
> +       if (new_mtu > RTE_ETHER_MTU)
>                 bp->flags |= BNXT_FLAG_JUMBO;
> -               bp->eth_dev->data->dev_conf.rxmode.offloads |=
> -                       DEV_RX_OFFLOAD_JUMBO_FRAME;
> -       } else {
> -               bp->eth_dev->data->dev_conf.rxmode.offloads &=
> -                       ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> +       else
>                 bp->flags &= ~BNXT_FLAG_JUMBO;
> -       }
>
Acked-by: Ajit Khaparde <ajit.khapa...@broadcom.com>



>
>

Reply via email to