diff options
author | Dave Jiang <[email protected]> | 2023-08-22 09:04:51 -0700 |
---|---|---|
committer | Jon Mason <[email protected]> | 2023-08-22 12:38:19 -0400 |
commit | f195a1a6fe416882984f8bd6c61afc1383171860 (patch) | |
tree | 119e26d8025cab3901431cc205957a4d6e17d9ff | |
parent | cc79bd2738c2d40aba58b2be6ce47dc0e471df0e (diff) |
ntb: Drop packets when qp link is down
Currently when the transport receive packets after netdev has closed the
transport returns error and triggers tx errors to be incremented and
carrier to be stopped. There is no reason to return error if the device is
already closed. Drop the packet and return 0.
Fixes: e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
Reported-by: Yuan Y Lu <[email protected]>
Tested-by: Yuan Y Lu <[email protected]>
Reviewed-by: Logan Gunthorpe <[email protected]>
Signed-off-by: Dave Jiang <[email protected]>
Signed-off-by: Jon Mason <[email protected]>
-rw-r--r-- | drivers/ntb/ntb_transport.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 3e7a6a8a9c87..7884ea9c7643 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -2283,9 +2283,13 @@ int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data, struct ntb_queue_entry *entry; int rc; - if (!qp || !qp->link_is_up || !len) + if (!qp || !len) return -EINVAL; + /* If the qp link is down already, just ignore. */ + if (!qp->link_is_up) + return 0; + entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q); if (!entry) { qp->tx_err_no_buf++; |