Skip to content

Commit

Permalink
net/ngbe: fix maximum frame size
Browse files Browse the repository at this point in the history
[ upstream commit d5774f0 ]

Remain the same max frame size after the device restarts.

Fixes: 07baabb ("net/ngbe: support MTU set")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and kevintraynor committed Oct 11, 2022
1 parent 60df277 commit 82fa390
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ngbe/base/ngbe_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ngbe/base/ngbe_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 3 additions & 7 deletions drivers/net/ngbe/ngbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,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
Expand All @@ -2470,12 +2470,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;
}
Expand Down

0 comments on commit 82fa390

Please sign in to comment.