Remain the same max frame size after the device restarts. Fixes: 07baabb6a51a ("net/ngbe: support MTU set") Cc: sta...@dpdk.org
Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com> --- drivers/net/ngbe/base/ngbe_regs.h | 2 +- drivers/net/ngbe/base/ngbe_type.h | 2 +- drivers/net/ngbe/ngbe_ethdev.c | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/ngbe/base/ngbe_regs.h b/drivers/net/ngbe/base/ngbe_regs.h index 640e385990..c0e79a2ba7 100644 --- a/drivers/net/ngbe/base/ngbe_regs.h +++ b/drivers/net/ngbe/base/ngbe_regs.h @@ -525,7 +525,7 @@ enum ngbe_5tuple_protocol { #define NGBE_PSRCTL_LBENA MS(18, 0x1) #define NGBE_FRMSZ 0x015020 #define NGBE_FRMSZ_MAX_MASK MS(0, 0xFFFF) -#define NGBE_FRMSZ_MAX(v) LS(v, 0, 0xFFFF) +#define NGBE_FRMSZ_MAX(v) LS((v) + 4, 0, 0xFFFF) #define NGBE_VLANCTL 0x015088 #define NGBE_VLANCTL_TPID_MASK MS(0, 0xFFFF) #define NGBE_VLANCTL_TPID(v) LS(v, 0, 0xFFFF) diff --git a/drivers/net/ngbe/base/ngbe_type.h b/drivers/net/ngbe/base/ngbe_type.h index 73111f7950..aa5c41146c 100644 --- a/drivers/net/ngbe/base/ngbe_type.h +++ b/drivers/net/ngbe/base/ngbe_type.h @@ -9,7 +9,7 @@ #define NGBE_LINK_UP_TIME 90 /* 9.0 Seconds */ #define NGBE_FRAME_SIZE_MAX (9728) /* Maximum frame size, +FCS */ -#define NGBE_FRAME_SIZE_DFT (1522) /* Default frame size, +FCS */ +#define NGBE_FRAME_SIZE_DFT (1518) /* Default frame size, +FCS */ #define NGBE_NUM_POOL (32) #define NGBE_PBRXSIZE_MAX 0x00080000 /* 512KB Packet Buffer */ #define NGBE_PBTXSIZE_MAX 0x00005000 /* 20KB Packet Buffer */ diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index df32bf64ff..1090ba9a11 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -2473,7 +2473,7 @@ static int ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct ngbe_hw *hw = ngbe_dev_hw(dev); - uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4; + uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct rte_eth_dev_data *dev_data = dev->data; /* If device is started, refuse mtu that requires the support of @@ -2486,12 +2486,8 @@ ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return -EINVAL; } - if (hw->mode) - wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK, - NGBE_FRAME_SIZE_MAX); - else - wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK, - NGBE_FRMSZ_MAX(frame_size)); + wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK, + NGBE_FRMSZ_MAX(frame_size)); return 0; } -- 2.27.0