[v7] net/i40e: fix max frame size configuration

Message ID 20230306121853.27547-1-simei.su@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v7] net/i40e: fix max frame size configuration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing warning apply patch failure
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Simei Su March 6, 2023, 12:18 p.m. UTC
  This patch sets max frame size at port level rather than queue level
to avoid unexpected packets received by port.

Fixes: 34fe803c051f ("net/i40e: don't check link status on device start")
Cc: stable@dpdk.org

Signed-off-by: Simei Su <simei.su@intel.com>
---
v7:
* Split v6 patch into two parts:
  - David Marchand's revert patch first:
    https://patchwork.dpdk.org/project/dpdk/patch/20221213091837.87953-1-david.marchand@redhat.com/
  - issue fix patch
* Refine commit title and commit log.

v6:
* Refine commit log.
* Remove return error.

v5:
* Fix misspelling in commit log.

v4:
* Refine commit log.
* Avoid duplicate call to set parameter "wait to complete" true.

v3:
* Put link update before interrupt enable.

v2:
* Refine commit log.
* Add link update.

 drivers/net/i40e/i40e_ethdev.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
  

Comments

Qi Zhang March 7, 2023, 2:27 a.m. UTC | #1
> -----Original Message-----
> From: Su, Simei <simei.su@intel.com>
> Sent: Monday, March 6, 2023 8:19 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yang, Qiming <qiming.yang@intel.com>;
> david.marchand@redhat.com; Su, Simei <simei.su@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v7] net/i40e: fix max frame size configuration
> 
> This patch sets max frame size at port level rather than queue level to avoid
> unexpected packets received by port.
> 
> Fixes: 34fe803c051f ("net/i40e: don't check link status on device start")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Simei Su <simei.su@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a982e42..371f422 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1710,11 +1710,6 @@  eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	 */
 	i40e_add_tx_flow_control_drop_filter(pf);
 
-	/* Set the max frame size to 0x2600 by default,
-	 * in case other drivers changed the default value.
-	 */
-	i40e_aq_set_mac_config(hw, I40E_FRAME_SIZE_MAX, TRUE, false, 0, NULL);
-
 	/* initialize RSS rule list */
 	TAILQ_INIT(&pf->rss_config_list);
 
@@ -2332,6 +2327,7 @@  i40e_dev_start(struct rte_eth_dev *dev)
 	uint32_t intr_vector = 0;
 	struct i40e_vsi *vsi;
 	uint16_t nb_rxq, nb_txq;
+	uint16_t max_frame_size;
 
 	hw->adapter_stopped = 0;
 
@@ -2452,7 +2448,7 @@  i40e_dev_start(struct rte_eth_dev *dev)
 			PMD_DRV_LOG(WARNING, "Fail to set phy mask");
 
 		/* Call get_link_info aq command to enable/disable LSE */
-		i40e_dev_link_update(dev, 0);
+		i40e_dev_link_update(dev, 1);
 	}
 
 	if (dev->data->dev_conf.intr_conf.rxq == 0) {
@@ -2470,6 +2466,13 @@  i40e_dev_start(struct rte_eth_dev *dev)
 			    "please call hierarchy_commit() "
 			    "before starting the port");
 
+	max_frame_size = dev->data->mtu ?
+		dev->data->mtu + I40E_ETH_OVERHEAD :
+		I40E_FRAME_SIZE_MAX;
+
+	/* Set the max frame size to HW*/
+	i40e_aq_set_mac_config(hw, max_frame_size, TRUE, false, 0, NULL);
+
 	return I40E_SUCCESS;
 
 tx_err: