From b4b7ff4b08e691656c9d77c758fc355833128ac0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 20 Jan 2016 14:01:31 -0300 Subject: Linux-libre 4.4-gnu --- drivers/staging/rdma/hfi1/pio.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'drivers/staging/rdma/hfi1/pio.c') diff --git a/drivers/staging/rdma/hfi1/pio.c b/drivers/staging/rdma/hfi1/pio.c index 9991814a8..e5c32db4b 100644 --- a/drivers/staging/rdma/hfi1/pio.c +++ b/drivers/staging/rdma/hfi1/pio.c @@ -435,7 +435,6 @@ int init_send_contexts(struct hfi1_devdata *dd) sizeof(struct send_context_info), GFP_KERNEL); if (!dd->send_contexts || !dd->hw_to_sw) { - dd_dev_err(dd, "Unable to allocate send context arrays\n"); kfree(dd->hw_to_sw); kfree(dd->send_contexts); free_credit_return(dd); @@ -684,10 +683,8 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, return NULL; sc = kzalloc_node(sizeof(struct send_context), GFP_KERNEL, numa); - if (!sc) { - dd_dev_err(dd, "Cannot allocate send context structure\n"); + if (!sc) return NULL; - } spin_lock_irqsave(&dd->sc_lock, flags); ret = sc_hw_alloc(dd, type, &sw_index, &hw_context); @@ -813,8 +810,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, sc->sr = kzalloc_node(sizeof(union pio_shadow_ring) * sc->sr_size, GFP_KERNEL, numa); if (!sc->sr) { - dd_dev_err(dd, - "Cannot allocate send context shadow ring structure\n"); sc_free(sc); return NULL; } @@ -927,10 +922,12 @@ void sc_disable(struct send_context *sc) static void sc_wait_for_packet_egress(struct send_context *sc, int pause) { struct hfi1_devdata *dd = sc->dd; - u64 reg; + u64 reg = 0; + u64 reg_prev; u32 loop = 0; while (1) { + reg_prev = reg; reg = read_csr(dd, sc->hw_context * 8 + SEND_EGRESS_CTXT_STATUS); /* done if egress is stopped */ @@ -939,11 +936,17 @@ static void sc_wait_for_packet_egress(struct send_context *sc, int pause) reg = packet_occupancy(reg); if (reg == 0) break; - if (loop > 100) { + /* counter is reset if occupancy count changes */ + if (reg != reg_prev) + loop = 0; + if (loop > 500) { + /* timed out - bounce the link */ dd_dev_err(dd, - "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u\n", + "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n", __func__, sc->sw_index, sc->hw_context, (u32)reg); + queue_work(dd->pport->hfi1_wq, + &dd->pport->link_bounce_work); break; } loop++; -- cgit v1.2.3-54-g00ecf