/* Resets a per cpu exches pool, releasing all of its sequences and exchanges. If sid is non-zero then reset only exchanges we sourced from the local port's FID. If did is non-zero then only reset exchanges destined for the local port's FID.  */
static void fc_exch_pool_reset(struct fc_lport *lport, struct fc_exch_pool *pool, u32 sid, u32 did)
/* Resets a per cpu exches pool, releasing all of its sequences and exchanges. If sid is non-zero then reset only exchanges we sourced from the local port's FID. If did is non-zero then only reset exchanges destined for the local port's FID.  */
static void fc_exch_pool_reset(struct fc_lport *lport, struct fc_exch_pool *pool, u32 sid, u32 did)
{
	struct fc_exch *ep;
	struct fc_exch *next;
	spin_lock_bh(&pool->lock);
restart:
	list_for_each_entry_safe(ep, next, &pool->ex_list, ex_list) {
		if ((lport == ep->lp) &&
		    (sid == 0 || sid == ep->sid) &&
		    (did == 0 || did == ep->did)) {
			fc_exch_hold(ep);
			spin_unlock_bh(&pool->lock);
			fc_exch_reset(ep);
			fc_exch_release(ep);
			spin_lock_bh(&pool->lock);
			goto restart;
		}
	}
	spin_unlock_bh(&pool->lock);
}