All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Xie, WeiX" <weix.xie@intel.com>
To: "Zhang, AlvinX" <alvinx.zhang@intel.com>,
	"Guo, Jia" <jia.guo@intel.com>,
	 "Wang, Haiyue" <haiyue.wang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Zhang, AlvinX" <alvinx.zhang@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fix configuration of max frame size
Date: Fri, 15 Jan 2021 06:43:38 +0000	[thread overview]
Message-ID: <f185559589f04be08bc99d050b6415de@intel.com> (raw)
In-Reply-To: <20210115023126.26248-1-alvinx.zhang@intel.com>

Tested-by:  Xie,WeiX < weix.xie@intel.com>

Regards,
Xie Wei


> -----Original Message-----
> From: Zhang,Alvin [mailto:alvinx.zhang@intel.com]
> Sent: Friday, January 15, 2021 10:31 AM
> To: Guo, Jia <jia.guo@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>;
> Xie, WeiX <weix.xie@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/ixgbe: fix configuration of max frame size
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> For 82599 NIC, jumbo frame feature is not supported in IOV mode, but if a VF
> requests to configure the frame size to that not bigger than
> RTE_ETHER_MAX_LEN, the PMD should not return -1.
> This patch keeps ixgbe PMD's handling mode consistent with kernel driver in
> above situation.
> 
> In addition, the value set by the command IXGBE_VF_SET_LPE represents
> the max frame size, not the mtu.
> 
> Fixes: 1b9ea09c067b ("ixgbe: support X550")
> Fixes: 95a27b3ba5f5 ("net/ixgbe: enable jumbo frame for VF")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_pf.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
> index 833863a..4cedaa5 100644
> --- a/drivers/net/ixgbe/ixgbe_pf.c
> +++ b/drivers/net/ixgbe/ixgbe_pf.c
> @@ -555,27 +555,30 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
> *eth_dev)  ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused
> uint32_t vf, uint32_t *msgbuf)  {
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> -	uint32_t new_mtu = msgbuf[1];
> -	uint32_t max_frs;
> +	uint32_t max_frame = msgbuf[1];
> +	uint32_t cur_frame_size;
>  	uint32_t hlreg0;
> -	int max_frame = new_mtu + RTE_ETHER_HDR_LEN +
> RTE_ETHER_CRC_LEN;
> 
>  	/* X540 and X550 support jumbo frames in IOV mode */
>  	if (hw->mac.type != ixgbe_mac_X540 &&
>  		hw->mac.type != ixgbe_mac_X550 &&
>  		hw->mac.type != ixgbe_mac_X550EM_x &&
> -		hw->mac.type != ixgbe_mac_X550EM_a)
> -		return -1;
> +		hw->mac.type != ixgbe_mac_X550EM_a) {
> +		if (max_frame > dev->data-
> >dev_conf.rxmode.max_rx_pkt_len)
> +			return -1;
> +
> +		return 0;
> +	}
> 
>  	if (max_frame < RTE_ETHER_MIN_LEN ||
>  			max_frame >
> RTE_ETHER_MAX_JUMBO_FRAME_LEN)
>  		return -1;
> 
> -	max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
> -		   IXGBE_MHADD_MFS_MASK) >>
> IXGBE_MHADD_MFS_SHIFT;
> -	if (max_frs < new_mtu) {
> +	cur_frame_size = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
> +			 IXGBE_MHADD_MFS_MASK) >>
> IXGBE_MHADD_MFS_SHIFT;
> +	if (cur_frame_size < max_frame) {
>  		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
> -		if (new_mtu > RTE_ETHER_MAX_LEN) {
> +		if (max_frame > RTE_ETHER_MAX_LEN) {
>  			dev->data->dev_conf.rxmode.offloads |=
>  				DEV_RX_OFFLOAD_JUMBO_FRAME;
>  			hlreg0 |= IXGBE_HLREG0_JUMBOEN;
> @@ -586,8 +589,8 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
> *eth_dev)
>  		}
>  		IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
> 
> -		max_frs = new_mtu << IXGBE_MHADD_MFS_SHIFT;
> -		IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
> +		IXGBE_WRITE_REG(hw, IXGBE_MAXFRS,
> +				max_frame << IXGBE_MHADD_MFS_SHIFT);
>  	}
> 
>  	return 0;
> --
> 1.8.3.1


  reply	other threads:[~2021-01-15  6:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 10:14 [dpdk-dev] [PATCH] net/ixgbe: fix configuration of max frame size Zhang,Alvin
2021-01-15  2:31 ` [dpdk-dev] [PATCH v2] " Zhang,Alvin
2021-01-15  6:43   ` Xie, WeiX [this message]
2021-01-15  7:00   ` [dpdk-dev] [PATCH v3] " Zhang,Alvin
2021-01-15  7:34     ` Xie, WeiX
2021-01-15  8:15     ` Guo, Jia
2021-01-15  9:50       ` Zhang, AlvinX
2021-01-15 10:08     ` [dpdk-dev] [PATCH v4] " Zhang,Alvin
2021-01-18  5:03       ` [dpdk-dev] [PATCH v5] " Zhang,Alvin
2021-01-18  5:58         ` Xie, WeiX
2021-01-18  8:35         ` [dpdk-dev] [PATCH v6] " Zhang,Alvin
2021-01-18  8:37           ` Guo, Jia
2021-01-19  5:25           ` [dpdk-dev] [PATCH v7] " Zhang,Alvin
2021-01-19  6:30             ` Zhang, Qi Z

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=f185559589f04be08bc99d050b6415de@intel.com \
    --to=weix.xie@intel.com \
    --cc=alvinx.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyue.wang@intel.com \
    --cc=jia.guo@intel.com \
    --cc=stable@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.