From: Somnath Kotur <somnath.kotur@broadcom.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
Thomas Monjalon <thomas@monjalon.net>,
Somalapuram Amaranath <asomalap@amd.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@oss.nxp.com>,
Haiyue Wang <haiyue.wang@intel.com>,
Gagandeep Singh <g.singh@nxp.com>,
Ziyang Xuan <xuanziyang2@huawei.com>,
Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>,
Guoyang Zhou <zhouguoyang@huawei.com>,
"Min Hu (Connor)" <humin29@huawei.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Lijun Ou <oulijun@huawei.com>,
Beilei Xing <beilei.xing@intel.com>,
Jingjing Wu <jingjing.wu@intel.com>,
Qiming Yang <qiming.yang@intel.com>,
Qi Zhang <qi.z.zhang@intel.com>, Rosen Xu <rosen.xu@intel.com>,
Shijith Thotton <sthotton@marvell.com>,
Srisivasubramanian Srinivasan <srinivasan@marvell.com>,
Heinrich Kuhn <heinrich.kuhn@corigine.com>,
Harman Kalra <hkalra@marvell.com>,
Jerin Jacob <jerinj@marvell.com>, Rasesh Mody <rmody@marvell.com>,
Devendra Singh Rawat <dsinghrawat@marvell.com>,
Maciej Czekaj <mczekaj@marvell.com>,
Jiawen Wu <jiawenwu@trustnetic.com>,
Jian Wang <jianwang@trustnetic.com>,
dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v3 2/6] ethdev: move jumbo frame offload check to library
Date: Mon, 4 Oct 2021 10:38:17 +0530 [thread overview]
Message-ID: <CAOBf=mukh1y9Nunh3bMJVwo3k-u66z662aHtJ7RT7teJob_2ow@mail.gmail.com> (raw)
In-Reply-To: <20211001143624.3744505-2-ferruh.yigit@intel.com>
[-- Attachment #1: Type: text/plain, Size: 24401 bytes --]
On Fri, Oct 1, 2021 at 8:06 PM Ferruh Yigit <ferruh.yigit@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.yigit@intel.com>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Reviewed-by: Rosen Xu <rosen.xu@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.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/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_common.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 +++++++++++++++++-
> 27 files changed, 29 insertions(+), 166 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 8c6f20b75aed..07ee19938930 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -3052,15 +3052,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: Somnath kotur <somnath.kotur@broadcom.com>
> /* Is there a change in mtu setting? */
> if (eth_dev->data->mtu == new_mtu)
> diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
> index 695d0d6fd3e2..349896f6a1bf 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_ops.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
> @@ -439,11 +439,6 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
> plt_err("Failed to max Rx frame length, rc=%d", rc);
> goto exit;
> }
> -
> - if (mtu > RTE_ETHER_MTU)
> - dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> exit:
> return rc;
> }
> diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
> index 8cf61f12a8d6..0c9cc2f5bb3f 100644
> --- a/drivers/net/cxgbe/cxgbe_ethdev.c
> +++ b/drivers/net/cxgbe/cxgbe_ethdev.c
> @@ -313,14 +313,6 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
> if (mtu < RTE_ETHER_MIN_MTU || new_mtu > dev_info.max_rx_pktlen)
> return -EINVAL;
>
> - /* set to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU)
> - eth_dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - eth_dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> err = t4_set_rxmode(adapter, adapter->mbox, pi->viid, new_mtu, -1, -1,
> -1, -1, true);
> return err;
> diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
> index adbdb87baab9..57b09f16ba44 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -187,13 +187,6 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EINVAL;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> fman_if_set_maxfrm(dev->process_private, frame_size);
>
> return 0;
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 758a14e0ad2d..df44bb204f65 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -1470,13 +1470,6 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> if (mtu < RTE_ETHER_MIN_MTU || frame_size > DPAA2_MAX_RX_PKT_LEN)
> return -EINVAL;
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> /* Set the Max Rx frame length as 'mtu' +
> * Maximum Ethernet header length
> */
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 6f418a36aa04..1b41dd04df5a 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -1818,15 +1818,10 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> rctl = E1000_READ_REG(hw, E1000_RCTL);
>
> /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU) {
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> + if (mtu > RTE_ETHER_MTU)
> rctl |= E1000_RCTL_LPE;
> - } else {
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> rctl &= ~E1000_RCTL_LPE;
> - }
> E1000_WRITE_REG(hw, E1000_RCTL, rctl);
>
> return 0;
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 4c114bf90fc7..a061d0529dd1 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -4396,15 +4396,10 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> rctl = E1000_READ_REG(hw, E1000_RCTL);
>
> /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU) {
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> + if (mtu > RTE_ETHER_MTU)
> rctl |= E1000_RCTL_LPE;
> - } else {
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> rctl &= ~E1000_RCTL_LPE;
> - }
> E1000_WRITE_REG(hw, E1000_RCTL, rctl);
>
> E1000_WRITE_REG(hw, E1000_RLPML, frame_size);
> diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
> index cdb9783b5372..fbcbbb6c0533 100644
> --- a/drivers/net/enetc/enetc_ethdev.c
> +++ b/drivers/net/enetc/enetc_ethdev.c
> @@ -677,13 +677,6 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EINVAL;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads &=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> enetc_port_wr(enetc_hw, ENETC_PTCMSDUR(0), ENETC_MAC_MAXFRM_SIZE);
> enetc_port_wr(enetc_hw, ENETC_PTXMBAR, 2 * ENETC_MAC_MAXFRM_SIZE);
>
> diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
> index 2d8271cb6095..4b30dfa222a8 100644
> --- a/drivers/net/hinic/hinic_pmd_ethdev.c
> +++ b/drivers/net/hinic/hinic_pmd_ethdev.c
> @@ -1547,13 +1547,6 @@ static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
> return ret;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> nic_dev->mtu_size = mtu;
>
> return ret;
> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
> index 4ead227f9122..e1d465de8234 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -2571,7 +2571,6 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> struct hns3_adapter *hns = dev->data->dev_private;
> uint32_t frame_size = mtu + HNS3_ETH_OVERHEAD;
> struct hns3_hw *hw = &hns->hw;
> - bool is_jumbo_frame;
> int ret;
>
> if (dev->data->dev_started) {
> @@ -2581,7 +2580,6 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> }
>
> rte_spinlock_lock(&hw->lock);
> - is_jumbo_frame = mtu > RTE_ETHER_MTU ? true : false;
> frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
>
> /*
> @@ -2596,12 +2594,6 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return ret;
> }
>
> - if (is_jumbo_frame)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> rte_spinlock_unlock(&hw->lock);
>
> return 0;
> diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
> index 0b5db486f8d6..3438b3650de6 100644
> --- a/drivers/net/hns3/hns3_ethdev_vf.c
> +++ b/drivers/net/hns3/hns3_ethdev_vf.c
> @@ -908,12 +908,6 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> rte_spinlock_unlock(&hw->lock);
> return ret;
> }
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> rte_spinlock_unlock(&hw->lock);
>
> return 0;
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 2033f8f55cd6..e14859db9cfd 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11774,11 +11774,6 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EBUSY;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev_data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> return ret;
> }
>
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 0eabce275d92..844d26d87ba6 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -1473,13 +1473,6 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EBUSY;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> return ret;
> }
>
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index e6d5128599e1..83e8f0da687c 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -3992,11 +3992,6 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EBUSY;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev_data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> return 0;
> }
>
> diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> index b26723064b07..dcbc26b8186e 100644
> --- a/drivers/net/igc/igc_ethdev.c
> +++ b/drivers/net/igc/igc_ethdev.c
> @@ -1592,15 +1592,10 @@ eth_igc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> }
>
> rctl = IGC_READ_REG(hw, IGC_RCTL);
> -
> - /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU) {
> - dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + if (mtu > RTE_ETHER_MTU)
> rctl |= IGC_RCTL_LPE;
> - } else {
> - dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> rctl &= ~IGC_RCTL_LPE;
> - }
> IGC_WRITE_REG(hw, IGC_RCTL, rctl);
>
> IGC_WRITE_REG(hw, IGC_RLPML, frame_size);
> diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
> index 3634c0c8c5f0..e8a33f04bd69 100644
> --- a/drivers/net/ipn3ke/ipn3ke_representor.c
> +++ b/drivers/net/ipn3ke/ipn3ke_representor.c
> @@ -2801,11 +2801,6 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)
> return -EBUSY;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - dev_data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev_data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> if (rpst->i40e_pf_eth) {
> ret = rpst->i40e_pf_eth->dev_ops->mtu_set(rpst->i40e_pf_eth,
> mtu);
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 31e67d86e77b..574a7bffc9cb 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -5198,13 +5198,10 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
>
> /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU) {
> - dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> + if (mtu > RTE_ETHER_MTU)
> hlreg0 |= IXGBE_HLREG0_JUMBOEN;
> - } else {
> - dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
> - }
> IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
>
> maxfrs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
> diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
> index 976916f870a5..3a516c52d199 100644
> --- a/drivers/net/liquidio/lio_ethdev.c
> +++ b/drivers/net/liquidio/lio_ethdev.c
> @@ -480,13 +480,6 @@ lio_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
> return -1;
> }
>
> - if (mtu > RTE_ETHER_MTU)
> - eth_dev->data->dev_conf.rxmode.offloads |=
> - DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - eth_dev->data->dev_conf.rxmode.offloads &=
> - ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> return 0;
> }
>
> diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
> index a2031a7a82cc..850ec7655f82 100644
> --- a/drivers/net/nfp/nfp_common.c
> +++ b/drivers/net/nfp/nfp_common.c
> @@ -962,12 +962,6 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EBUSY;
> }
>
> - /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> /* writing to configuration space */
> nn_cfg_writel(hw, NFP_NET_CFG_MTU, mtu);
>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index 69c3bda12df8..fb65be2c2dc3 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -552,11 +552,6 @@ octeontx_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
> if (rc)
> return rc;
>
> - if (mtu > RTE_ETHER_MTU)
> - nic->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - nic->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> octeontx_log_info("Received pkt beyond maxlen %d will be dropped",
> frame_size);
>
> diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
> index cf7804157198..293306c7be2a 100644
> --- a/drivers/net/octeontx2/otx2_ethdev_ops.c
> +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
> @@ -59,11 +59,6 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
> if (rc)
> return rc;
>
> - if (mtu > RTE_ETHER_MTU)
> - dev->rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> return rc;
> }
>
> diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
> index 4b971fd1fe3c..6886a4e5efb4 100644
> --- a/drivers/net/qede/qede_ethdev.c
> +++ b/drivers/net/qede/qede_ethdev.c
> @@ -2361,10 +2361,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
> fp->rxq->rx_buf_size = rc;
> }
> }
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
>
> if (!dev->data->dev_started && restart) {
> qede_dev_start(dev);
> diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
> index 1f55c90b419d..2ee80e2dc41f 100644
> --- a/drivers/net/sfc/sfc_ethdev.c
> +++ b/drivers/net/sfc/sfc_ethdev.c
> @@ -1064,15 +1064,6 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
> }
> }
>
> - /*
> - * The driver does not use it, but other PMDs update jumbo frame
> - * flag when MTU is set.
> - */
> - if (mtu > RTE_ETHER_MTU) {
> - struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
> - rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - }
> -
> sfc_adapter_unlock(sa);
>
> sfc_log_init(sa, "done");
> diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
> index c8ae95a61306..b501fee5332c 100644
> --- a/drivers/net/thunderx/nicvf_ethdev.c
> +++ b/drivers/net/thunderx/nicvf_ethdev.c
> @@ -151,7 +151,6 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
> struct nicvf *nic = nicvf_pmd_priv(dev);
> uint32_t buffsz, frame_size = mtu + NIC_HW_L2_OVERHEAD;
> size_t i;
> - struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
>
> PMD_INIT_FUNC_TRACE();
>
> @@ -176,11 +175,6 @@ nicvf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
> (frame_size + 2 * VLAN_TAG_SIZE > buffsz * NIC_HW_MAX_SEGS))
> return -EINVAL;
>
> - if (mtu > RTE_ETHER_MTU)
> - rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - rxmode->offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> if (nicvf_mbox_update_hw_max_frs(nic, mtu))
> return -EINVAL;
>
> diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
> index 269de9f848dd..35b98097c3a4 100644
> --- a/drivers/net/txgbe/txgbe_ethdev.c
> +++ b/drivers/net/txgbe/txgbe_ethdev.c
> @@ -3486,12 +3486,6 @@ txgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> return -EINVAL;
> }
>
> - /* switch to jumbo mode if needed */
> - if (mtu > RTE_ETHER_MTU)
> - dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> - else
> - dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> -
> if (hw->mode)
> wr32m(hw, TXGBE_FRMSZ, TXGBE_FRMSZ_MAX_MASK,
> TXGBE_FRAME_SIZE_MAX);
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 4d0584af52e3..1740bab98a83 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -3639,6 +3639,7 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
> int ret;
> struct rte_eth_dev_info dev_info;
> struct rte_eth_dev *dev;
> + int is_jumbo_frame_capable = 0;
>
> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> dev = &rte_eth_devices[port_id];
> @@ -3657,12 +3658,27 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
>
> if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu)
> return -EINVAL;
> +
> + if ((dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) != 0)
> + is_jumbo_frame_capable = 1;
> }
>
> + if (mtu > RTE_ETHER_MTU && is_jumbo_frame_capable == 0)
> + return -EINVAL;
> +
> ret = (*dev->dev_ops->mtu_set)(dev, mtu);
> - if (!ret)
> + if (ret == 0) {
> dev->data->mtu = mtu;
>
> + /* switch to jumbo mode if needed */
> + if (mtu > RTE_ETHER_MTU)
> + dev->data->dev_conf.rxmode.offloads |=
> + DEV_RX_OFFLOAD_JUMBO_FRAME;
> + else
> + dev->data->dev_conf.rxmode.offloads &=
> + ~DEV_RX_OFFLOAD_JUMBO_FRAME;
> + }
> +
> return eth_err(port_id, ret);
> }
>
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-10-04 5:08 UTC|newest]
Thread overview: 112+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 17:29 [dpdk-dev] [PATCH 1/4] ethdev: fix max Rx packet length Ferruh Yigit
2021-07-09 17:29 ` [dpdk-dev] [PATCH 2/4] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-07-13 13:48 ` Andrew Rybchenko
2021-07-21 12:26 ` Ferruh Yigit
2021-07-18 7:49 ` Xu, Rosen
2021-07-19 14:38 ` Ajit Khaparde
2021-07-09 17:29 ` [dpdk-dev] [PATCH 3/4] ethdev: move check to library for MTU set Ferruh Yigit
2021-07-13 13:56 ` Andrew Rybchenko
2021-07-18 7:52 ` Xu, Rosen
2021-07-09 17:29 ` [dpdk-dev] [PATCH 4/4] ethdev: remove jumbo offload flag Ferruh Yigit
2021-07-13 14:07 ` Andrew Rybchenko
2021-07-21 12:26 ` Ferruh Yigit
2021-07-21 12:39 ` Ferruh Yigit
2021-07-18 7:53 ` Xu, Rosen
2021-07-13 12:47 ` [dpdk-dev] [PATCH 1/4] ethdev: fix max Rx packet length Andrew Rybchenko
2021-07-21 16:46 ` Ferruh Yigit
2021-07-22 1:31 ` Ajit Khaparde
2021-07-22 10:27 ` Ferruh Yigit
2021-07-22 10:38 ` Andrew Rybchenko
2021-07-18 7:45 ` Xu, Rosen
2021-07-19 3:35 ` Huisong Li
2021-07-21 15:29 ` Ferruh Yigit
2021-07-22 7:21 ` Huisong Li
2021-07-22 10:12 ` Ferruh Yigit
2021-07-22 10:15 ` Andrew Rybchenko
2021-07-22 14:43 ` Stephen Hemminger
2021-09-17 1:08 ` Min Hu (Connor)
2021-09-17 8:04 ` Ferruh Yigit
2021-09-17 8:16 ` Min Hu (Connor)
2021-09-17 8:17 ` Min Hu (Connor)
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 1/6] " Ferruh Yigit
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-07-23 3:29 ` Huisong Li
2021-07-22 17:21 ` [dpdk-dev] [PATCH v2 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 1/6] ethdev: fix max Rx packet length Ferruh Yigit
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-10-04 5:08 ` Somnath Kotur [this message]
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-10-04 5:09 ` Somnath Kotur
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
[not found] ` <CAOBf=muYkU2dwgi3iC8Q7pdSNTJsMUwWYdXj14KeN_=_mUGa0w@mail.gmail.com>
2021-10-04 7:55 ` Somnath Kotur
2021-10-05 16:48 ` Ferruh Yigit
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-10-01 14:36 ` [dpdk-dev] [PATCH v3 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-01 15:07 ` [dpdk-dev] [PATCH v3 1/6] ethdev: fix max Rx packet length Stephen Hemminger
2021-10-05 16:46 ` Ferruh Yigit
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 " Ferruh Yigit
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-10-08 8:39 ` Xu, Rosen
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
2021-10-08 8:38 ` Xu, Rosen
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-10-05 17:16 ` [dpdk-dev] [PATCH v4 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-05 22:07 ` [dpdk-dev] [PATCH v4 1/6] ethdev: fix max Rx packet length Ajit Khaparde
2021-10-06 6:08 ` Somnath Kotur
2021-10-08 8:36 ` Xu, Rosen
2021-10-10 6:30 ` Matan Azrad
2021-10-11 21:59 ` Ferruh Yigit
2021-10-12 7:03 ` Matan Azrad
2021-10-12 11:03 ` Ferruh Yigit
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 " Ferruh Yigit
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-10-08 17:20 ` Ananyev, Konstantin
2021-10-09 10:58 ` lihuisong (C)
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-10-08 17:19 ` Ananyev, Konstantin
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
2021-10-08 17:11 ` Ananyev, Konstantin
2021-10-09 11:09 ` lihuisong (C)
2021-10-10 5:46 ` Matan Azrad
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-10-08 16:51 ` Ananyev, Konstantin
2021-10-11 19:50 ` Ferruh Yigit
2021-10-09 11:43 ` lihuisong (C)
2021-10-11 20:15 ` Ferruh Yigit
2021-10-12 4:02 ` lihuisong (C)
2021-10-07 16:56 ` [dpdk-dev] [PATCH v5 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-08 16:53 ` Ananyev, Konstantin
2021-10-08 15:57 ` [dpdk-dev] [PATCH v5 1/6] ethdev: fix max Rx packet length Ananyev, Konstantin
2021-10-11 19:47 ` Ferruh Yigit
2021-10-09 10:56 ` lihuisong (C)
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 " Ferruh Yigit
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
2021-10-12 17:20 ` Hyong Youb Kim (hyonkim)
2021-10-13 7:16 ` Michał Krawczyk
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-10-12 5:58 ` Andrew Rybchenko
2021-10-11 23:53 ` [dpdk-dev] [PATCH v6 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-12 6:02 ` [dpdk-dev] [PATCH v6 1/6] ethdev: fix max Rx packet length Andrew Rybchenko
2021-10-12 9:42 ` Ananyev, Konstantin
2021-10-13 7:08 ` Xu, Rosen
2021-10-15 1:31 ` Hyong Youb Kim (hyonkim)
2021-10-16 0:24 ` Ferruh Yigit
2021-10-18 8:54 ` Ferruh Yigit
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 " Ferruh Yigit
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 2/6] ethdev: move jumbo frame offload check to library Ferruh Yigit
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 3/6] ethdev: move check to library for MTU set Ferruh Yigit
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 4/6] ethdev: remove jumbo offload flag Ferruh Yigit
2021-10-21 0:43 ` Thomas Monjalon
2021-10-22 11:25 ` Ferruh Yigit
2021-10-22 11:29 ` Andrew Rybchenko
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 5/6] ethdev: unify MTU checks Ferruh Yigit
2021-10-18 13:48 ` [dpdk-dev] [PATCH v7 6/6] examples/ip_reassembly: remove unused parameter Ferruh Yigit
2021-10-18 17:31 ` [dpdk-dev] [PATCH v7 1/6] ethdev: fix max Rx packet length Ferruh Yigit
2021-11-05 14:19 ` Xueming(Steven) Li
2021-11-05 14:39 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOBf=mukh1y9Nunh3bMJVwo3k-u66z662aHtJ7RT7teJob_2ow@mail.gmail.com' \
--to=somnath.kotur@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=asomalap@amd.com \
--cc=beilei.xing@intel.com \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=dsinghrawat@marvell.com \
--cc=ferruh.yigit@intel.com \
--cc=g.singh@nxp.com \
--cc=haiyue.wang@intel.com \
--cc=heinrich.kuhn@corigine.com \
--cc=hemant.agrawal@nxp.com \
--cc=hkalra@marvell.com \
--cc=humin29@huawei.com \
--cc=jerinj@marvell.com \
--cc=jianwang@trustnetic.com \
--cc=jiawenwu@trustnetic.com \
--cc=jingjing.wu@intel.com \
--cc=kirankumark@marvell.com \
--cc=mczekaj@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=oulijun@huawei.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=rahul.lakkireddy@chelsio.com \
--cc=rmody@marvell.com \
--cc=rosen.xu@intel.com \
--cc=sachin.saxena@oss.nxp.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=srinivasan@marvell.com \
--cc=sthotton@marvell.com \
--cc=thomas@monjalon.net \
--cc=xuanziyang2@huawei.com \
--cc=yisen.zhuang@huawei.com \
--cc=zhouguoyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).