diff mbox

[dpdk-dev] ixgbe: check scatter_enable in set_mtu

Message ID 1493359891-6323-1-git-send-email-jyu@vmware.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Jia Yu April 28, 2017, 6:11 a.m. UTC
There exists case that software sets mtu (i.e jumbo frame) of
ixgbe device when it's stopped. Before the fix, scattered_rx
is cleared during device stop, and setting jumbo frame mtu
after device stop will always fail as scattered_rx is 0.

Signed-off-by: Jia Yu <jyu@vmware.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Wenzhuo Lu May 2, 2017, 12:51 a.m. UTC | #1
Hi, 

> -----Original Message-----
> From: Jia Yu [mailto:jyu@vmware.com]
> Sent: Friday, April 28, 2017 2:12 PM
> To: Lu, Wenzhuo; Ananyev, Konstantin
> Cc: dev@dpdk.org; Jia Yu
> Subject: [PATCH] ixgbe: check scatter_enable in set_mtu
> 
> There exists case that software sets mtu (i.e jumbo frame) of ixgbe device
> when it's stopped. Before the fix, scattered_rx is cleared during device stop,
> and setting jumbo frame mtu after device stop will always fail as
> scattered_rx is 0.
> 
> Signed-off-by: Jia Yu <jyu@vmware.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Thomas Monjalon May 5, 2017, 3:18 p.m. UTC | #2
02/05/2017 02:51, Lu, Wenzhuo:
> From: Jia Yu [mailto:jyu@vmware.com]
> > 
> > There exists case that software sets mtu (i.e jumbo frame) of ixgbe device
> > when it's stopped. Before the fix, scattered_rx is cleared during device stop,
> > and setting jumbo frame mtu after device stop will always fail as
> > scattered_rx is 0.
> > 
> > Signed-off-by: Jia Yu <jyu@vmware.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied, thanks
diff mbox

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7b856bb..aa5ba8c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4671,6 +4671,7 @@  ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev_info dev_info;
 	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
 
 	ixgbe_dev_info_get(dev, &dev_info);
 
@@ -4681,7 +4682,7 @@  ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	/* refuse mtu that requires the support of scattered packets when this
 	 * feature has not been enabled before.
 	 */
-	if (!dev->data->scattered_rx &&
+	if (!rx_conf->enable_scatter &&
 	    (frame_size + 2 * IXGBE_VLAN_TAG_SIZE >
 	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
 		return -EINVAL;
@@ -5939,6 +5940,7 @@  ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct ixgbe_hw *hw;
 	uint32_t max_frame = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+	struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode;
 
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -5948,7 +5950,7 @@  ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	/* refuse mtu that requires the support of scattered packets when this
 	 * feature has not been enabled before.
 	 */
-	if (!dev->data->scattered_rx &&
+	if (!rx_conf->enable_scatter &&
 	    (max_frame + 2 * IXGBE_VLAN_TAG_SIZE >
 	     dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
 		return -EINVAL;