[v5,3/5] net/ice: fix max mtu size packets with vlan tag cannot be received by default
Checks
Commit Message
when application presets the max rx packet length and expected mtu at
the same time, driver need identify if the preset max frame size can
hold mtu data and Ether overhead completely.
if not, adjust the max frame size via mtu_set ops within dev_configure.
Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
drivers/net/ice/ice_ethdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Comments
Couple comments inline,
Btw, no need to submit a new version, I will ack and merge the patch with below fix directly.
but please keep in mind in your next patch.
> -----Original Message-----
> From: SteveX Yang <stevex.yang@intel.com>
> Sent: Wednesday, October 14, 2020 5:20 PM
> To: dev@dpdk.org
> Cc: Guo, Jia <jia.guo@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH v5 3/5] net/ice: fix max mtu size packets with vlan tag cannot
> be received by default
Title is too long, please use check-git-log.sh
Renamed to
"fix MTU size for VLAN packets"
>
> when application presets the max rx packet length and expected mtu at the
s/when/When
> same time, driver need identify if the preset max frame size can hold mtu data
> and Ether overhead completely.
>
> if not, adjust the max frame size via mtu_set ops within dev_configure.
s/if/If
>
> Fixes: 50cc9d2a6e9d ("net/ice: fix max frame size")
>
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
> drivers/net/ice/ice_ethdev.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index
> 0056da78a..a707612c2 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -3305,6 +3305,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
> struct ice_adapter *ad =
> ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
> int ret;
>
> /* Initialize to TRUE. If any of Rx queues doesn't meet the @@ -3316,6
> +3317,16 @@ ice_dev_configure(struct rte_eth_dev *dev)
> if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
> dev->data->dev_conf.rxmode.offloads |=
> DEV_RX_OFFLOAD_RSS_HASH;
>
> + /**
> + * Reset the max frame size via mtu_set ops if preset max frame
> + * cannot hold MTU data and Ether overhead.
> + */
> + if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
> + ret = ice_mtu_set(dev, dev->data->mtu);
> + if (ret != 0)
> + return ret;
> + }
> +
> ret = ice_init_rss(pf);
> if (ret) {
> PMD_DRV_LOG(ERR, "Failed to enable rss for PF");
> --
> 2.17.1
@@ -3305,6 +3305,7 @@ ice_dev_configure(struct rte_eth_dev *dev)
struct ice_adapter *ad =
ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ uint32_t frame_size = dev->data->mtu + ICE_ETH_OVERHEAD;
int ret;
/* Initialize to TRUE. If any of Rx queues doesn't meet the
@@ -3316,6 +3317,16 @@ ice_dev_configure(struct rte_eth_dev *dev)
if (dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS_FLAG)
dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+ /**
+ * Reset the max frame size via mtu_set ops if preset max frame
+ * cannot hold MTU data and Ether overhead.
+ */
+ if (frame_size > dev->data->dev_conf.rxmode.max_rx_pkt_len) {
+ ret = ice_mtu_set(dev, dev->data->mtu);
+ if (ret != 0)
+ return ret;
+ }
+
ret = ice_init_rss(pf);
if (ret) {
PMD_DRV_LOG(ERR, "Failed to enable rss for PF");