mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 17:01:57 +07:00
net: qca_spi: Add available buffer space verification
Interferences on the SPI line could distort the response of available buffer space. So at least we should check that the response doesn't exceed the maximum available buffer space. In error case increase a new error counter and retry it later. This behavior avoids buffer errors in the QCA7000, which results in an unnecessary chip reset including packet loss. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
50254256f3
commit
026b907d58
@ -61,6 +61,7 @@ static const char qcaspi_gstrings_stats[][ETH_GSTRING_LEN] = {
|
|||||||
"Transmit ring full",
|
"Transmit ring full",
|
||||||
"SPI errors",
|
"SPI errors",
|
||||||
"Write verify errors",
|
"Write verify errors",
|
||||||
|
"Buffer available errors",
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
|
@ -289,6 +289,14 @@ qcaspi_transmit(struct qcaspi *qca)
|
|||||||
|
|
||||||
qcaspi_read_register(qca, SPI_REG_WRBUF_SPC_AVA, &available);
|
qcaspi_read_register(qca, SPI_REG_WRBUF_SPC_AVA, &available);
|
||||||
|
|
||||||
|
if (available > QCASPI_HW_BUF_LEN) {
|
||||||
|
/* This could only happen by interferences on the SPI line.
|
||||||
|
* So retry later ...
|
||||||
|
*/
|
||||||
|
qca->stats.buf_avail_err++;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (qca->txr.skb[qca->txr.head]) {
|
while (qca->txr.skb[qca->txr.head]) {
|
||||||
pkt_len = qca->txr.skb[qca->txr.head]->len + QCASPI_HW_PKT_LEN;
|
pkt_len = qca->txr.skb[qca->txr.head]->len + QCASPI_HW_PKT_LEN;
|
||||||
|
|
||||||
@ -355,7 +363,13 @@ qcaspi_receive(struct qcaspi *qca)
|
|||||||
netdev_dbg(net_dev, "qcaspi_receive: SPI_REG_RDBUF_BYTE_AVA: Value: %08x\n",
|
netdev_dbg(net_dev, "qcaspi_receive: SPI_REG_RDBUF_BYTE_AVA: Value: %08x\n",
|
||||||
available);
|
available);
|
||||||
|
|
||||||
if (available == 0) {
|
if (available > QCASPI_HW_BUF_LEN) {
|
||||||
|
/* This could only happen by interferences on the SPI line.
|
||||||
|
* So retry later ...
|
||||||
|
*/
|
||||||
|
qca->stats.buf_avail_err++;
|
||||||
|
return -1;
|
||||||
|
} else if (available == 0) {
|
||||||
netdev_dbg(net_dev, "qcaspi_receive called without any data being available!\n");
|
netdev_dbg(net_dev, "qcaspi_receive called without any data being available!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ struct qcaspi_stats {
|
|||||||
u64 ring_full;
|
u64 ring_full;
|
||||||
u64 spi_err;
|
u64 spi_err;
|
||||||
u64 write_verify_failed;
|
u64 write_verify_failed;
|
||||||
|
u64 buf_avail_err;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qcaspi {
|
struct qcaspi {
|
||||||
|
Loading…
Reference in New Issue
Block a user