diff mbox series

[net,1/2] cxgb4: Fix work request size calculation for loopback test

Message ID 20200818154058.1770002-2-ganji.aravind@chelsio.com
State Accepted
Delegated to: David Miller
Headers show
Series cxgb4: Fix ethtool selftest flits calculation | expand

Commit Message

Ganji Aravind Aug. 18, 2020, 3:40 p.m. UTC
Work request used for sending loopback packet needs to add
the firmware work request only once. So, fix by using
correct structure size.

Fixes: 7235ffae3d2c ("cxgb4: add loopback ethtool self-test")
Signed-off-by: Ganji Aravind <ganji.aravind@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/sge.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jesse Brandeburg Aug. 18, 2020, 7:33 p.m. UTC | #1
Ganji Aravind wrote:

> Work request used for sending loopback packet needs to add
> the firmware work request only once. So, fix by using
> correct structure size.
> 
> Fixes: 7235ffae3d2c ("cxgb4: add loopback ethtool self-test")
> Signed-off-by: Ganji Aravind <ganji.aravind@chelsio.com>

changes look ok, but to understand why this change fixed the bug, you
could have just mentioned that the cpl_tx_pkt struct has a _core member
inside of it, and then I wouldn't have had to waste review time digging
through the code in the kernel.

Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index d2b587d1670a..7c9fe4bc235b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -2553,8 +2553,8 @@  int cxgb4_selftest_lb_pkt(struct net_device *netdev)
 
 	pkt_len = ETH_HLEN + sizeof(CXGB4_SELFTEST_LB_STR);
 
-	flits = DIV_ROUND_UP(pkt_len + sizeof(struct cpl_tx_pkt) +
-			     sizeof(*wr), sizeof(__be64));
+	flits = DIV_ROUND_UP(pkt_len + sizeof(*cpl) + sizeof(*wr),
+			     sizeof(__be64));
 	ndesc = flits_to_desc(flits);
 
 	lb = &pi->ethtool_lb;