Skip to content

Commit cc79bd2

Browse files
davejiangjonmason
authored andcommitted
ntb: Clean up tx tail index on link down
The tx tail index is not reset when the link goes down. This causes the tail index to go out of sync when the link goes down and comes back up. Refactor the ntb_qp_link_down_reset() and reset the tail index as well. Fixes: 2849b5d ("NTB: Reset transport QP link stats on down") 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>
1 parent 28e70ed commit cc79bd2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/ntb/ntb_transport.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,
909909
return 0;
910910
}
911911

912-
static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
912+
static void ntb_qp_link_context_reset(struct ntb_transport_qp *qp)
913913
{
914914
qp->link_is_up = false;
915915
qp->active = false;
@@ -932,6 +932,13 @@ static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
932932
qp->tx_async = 0;
933933
}
934934

935+
static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
936+
{
937+
ntb_qp_link_context_reset(qp);
938+
if (qp->remote_rx_info)
939+
qp->remote_rx_info->entry = qp->rx_max_entry - 1;
940+
}
941+
935942
static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp)
936943
{
937944
struct ntb_transport_ctx *nt = qp->transport;
@@ -1174,7 +1181,7 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt,
11741181
qp->ndev = nt->ndev;
11751182
qp->client_ready = false;
11761183
qp->event_handler = NULL;
1177-
ntb_qp_link_down_reset(qp);
1184+
ntb_qp_link_context_reset(qp);
11781185

11791186
if (mw_num < qp_count % mw_count)
11801187
num_qps_mw = qp_count / mw_count + 1;

0 commit comments

Comments
 (0)