Skip to content

Commit

Permalink
ntb: Drop packets when qp link is down
Browse files Browse the repository at this point in the history
commit f195a1a upstream.

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: e26a584 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
Reported-by: Yuan Y Lu <yuan.y.lu@intel.com>
Tested-by: Yuan Y Lu <yuan.y.lu@intel.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
davejiang authored and gregkh committed Sep 13, 2023
1 parent e95e31a commit 4f4af6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/ntb/ntb_transport.c
Expand Up @@ -2276,9 +2276,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++;
Expand Down

0 comments on commit 4f4af6b

Please sign in to comment.