net/ixgbe: fix setting MTU on stopped device
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>
This commit is contained in:
parent
b604589d57
commit
22d0e5aed3
@ -4689,6 +4689,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);
|
||||
|
||||
@ -4699,7 +4700,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;
|
||||
@ -5965,6 +5966,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);
|
||||
|
||||
@ -5974,7 +5976,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user