[PATCH v3 6/9] net: smc911x: Fix amount of words read from RX FIFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the datasheet the packet length field contains the packet
length in bytes (and it's also used like this in the driver). This means
the number of dwords to read from the FIFO is one quarter of that, or,
if we account for non dword aligned packet lengths, as:

	len = (pktlen + 3) / 4.

I have no idea why the code has an additional + 2 when calculating the
number of dwords. The corresponding U-Boot driver also does not have
this additional + 2, so drop it from the barebox driver as well.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/net/smc911x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 767d51761b..1fca58ab84 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -459,7 +459,7 @@ static int smc911x_eth_rx(struct eth_device *edev)
 
 		smc911x_reg_write(priv, RX_CFG, 0);
 
-		tmplen = (pktlen + 2 + 3) / 4;
+		tmplen = (pktlen + 3) / 4;
 		while(tmplen--)
 			*data++ = smc911x_reg_read(priv, RX_DATA_FIFO);
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux