diff mbox series

[v3,06/22] net/hns3: fix the jumbo frame flag condition for mtu set

Message ID 20210114094616.13898-1-stevex.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series None | expand

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Steve Yang Jan. 14, 2021, 9:46 a.m. UTC
The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
but the Ether overhead is larger than 18 when it supports dual VLAN tags.
That will cause the jumbo flag rx offload is wrong when MTU size is
'RTE_ETHER_MTU'.

This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
that perhaps impacts the cases of the jumbo frame related.

Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Fixes: a5475d61fa34 ("net/hns3: support VF")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 +-
 drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

oulijun Jan. 18, 2021, 1:30 a.m. UTC | #1
Acked-by: Lijun Ou <oulijun@huawei.com>

在 2021/1/14 17:46, Steve Yang 写道:
> The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition,
> but the Ether overhead is larger than 18 when it supports dual VLAN tags.
> That will cause the jumbo flag rx offload is wrong when MTU size is
> 'RTE_ETHER_MTU'.
> 
> This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN',
> that perhaps impacts the cases of the jumbo frame related.
> 
> Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
> Fixes: a5475d61fa34 ("net/hns3: support VF")
> 
> Signed-off-by: Steve Yang <stevex.yang@intel.com>
> ---
>   drivers/net/hns3/hns3_ethdev.c    | 2 +-
>   drivers/net/hns3/hns3_ethdev_vf.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
> index 7c34e382fb..10e0c0de46 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>   	}
>   
>   	rte_spinlock_lock(&hw->lock);
> -	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
> +	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
>   	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
>   
>   	/*
> diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
> index f09cabcd82..ef03fb1c4e 100644
> --- a/drivers/net/hns3/hns3_ethdev_vf.c
> +++ b/drivers/net/hns3/hns3_ethdev_vf.c
> @@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>   		rte_spinlock_unlock(&hw->lock);
>   		return ret;
>   	}
> -	if (frame_size > RTE_ETHER_MAX_LEN)
> +	if (mtu > RTE_ETHER_MTU)
>   		dev->data->dev_conf.rxmode.offloads |=
>   						DEV_RX_OFFLOAD_JUMBO_FRAME;
>   	else
>
diff mbox series

Patch

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7c34e382fb..10e0c0de46 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2467,7 +2467,7 @@  hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	}
 
 	rte_spinlock_lock(&hw->lock);
-	is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false;
+	is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false;
 	frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN);
 
 	/*
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index f09cabcd82..ef03fb1c4e 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -928,7 +928,7 @@  hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		rte_spinlock_unlock(&hw->lock);
 		return ret;
 	}
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (mtu > RTE_ETHER_MTU)
 		dev->data->dev_conf.rxmode.offloads |=
 						DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else