Enabling Flow Director reduces PBRXSIZE(0) to reserve packet buffer
memory for the filter table. The new size was computed from the
current register value, but the FDIR mode is reset to none when the
last rule is destroyed, on flush, or when enabling FDIR fails, without
restoring the buffer. The next FDIR rule created or validated then
enabled FDIR again and reduced the buffer a second time, until the
size underflowed.
Compute PBRXSIZE(0) from the default packet buffer size instead.
Fixes: ea230dda16ad ("net/txgbe: configure flow director filter")
Cc: [email protected]
Signed-off-by: Zhang Tengfei <[email protected]>
---
drivers/net/txgbe/txgbe_fdir.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_fdir.c b/drivers/net/txgbe/txgbe_fdir.c
index 67f586ffc7..cee38a42b8 100644
--- a/drivers/net/txgbe/txgbe_fdir.c
+++ b/drivers/net/txgbe/txgbe_fdir.c
@@ -390,11 +390,10 @@ txgbe_fdir_configure(struct rte_eth_dev *dev)
/*
* Before enabling Flow Director, the Rx Packet Buffer size
- * must be reduced. The new value is the current size minus
+ * must be reduced. The new value is the default size minus
* flow director memory usage size.
*/
- pbsize = rd32(hw, TXGBE_PBRXSIZE(0));
- pbsize -= TXGBD_FDIRCTL_BUF_BYTE(fdirctrl);
+ pbsize = (hw->mac.rx_pb_size << 10) - TXGBD_FDIRCTL_BUF_BYTE(fdirctrl);
wr32(hw, TXGBE_PBRXSIZE(0), pbsize);
/*
--
2.53.0