diff options
author | Michael Heimpold <michael.heimpold@in-tech.com> | 2019-11-20 18:29:12 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-20 12:42:23 -0800 |
commit | 3e7e676c8196efbdedf6e12e895356f073f39abd (patch) | |
tree | 42efd0dcbab0e535f92452c5b08605b874071f6a /drivers/net/ethernet/qualcomm/qca_spi.c | |
parent | aee024f610cc77aa7b44e32ad1cd3e781a97291f (diff) | |
download | linux-stable-3e7e676c8196efbdedf6e12e895356f073f39abd.tar.gz linux-stable-3e7e676c8196efbdedf6e12e895356f073f39abd.tar.bz2 linux-stable-3e7e676c8196efbdedf6e12e895356f073f39abd.zip |
net: qca_spi: fix receive buffer size check
When receiving many or larger packets, e.g. when doing a file download,
it was observed that the read buffer size register reports up to 4 bytes
more than the current define allows in the check.
If this is the case, then no data transfer is initiated to receive the
packets (and thus to empty the buffer) which results in a stall of the
interface.
These 4 bytes are a hardware generated frame length which is prepended
to the actual frame, thus we have to respect it during our check.
Fixes: 026b907d58c4 ("net: qca_spi: Add available buffer space verification")
Signed-off-by: Michael Heimpold <michael.heimpold@in-tech.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/qca_spi.c')
-rw-r--r-- | drivers/net/ethernet/qualcomm/qca_spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c index 5ecf61df78bd..351f24ff4ca5 100644 --- a/drivers/net/ethernet/qualcomm/qca_spi.c +++ b/drivers/net/ethernet/qualcomm/qca_spi.c @@ -363,7 +363,7 @@ qcaspi_receive(struct qcaspi *qca) netdev_dbg(net_dev, "qcaspi_receive: SPI_REG_RDBUF_BYTE_AVA: Value: %08x\n", available); - if (available > QCASPI_HW_BUF_LEN) { + if (available > QCASPI_HW_BUF_LEN + QCASPI_HW_PKT_LEN) { /* This could only happen by interferences on the SPI line. * So retry later ... */ |