Пример #1
0
static void
release_offload_resources(struct toepcb *toep)
{
	struct tom_data *td = toep->td;
	struct adapter *sc = td_adapter(td);
	int tid = toep->tid;

	KASSERT(!(toep->flags & TPF_CPL_PENDING),
	    ("%s: %p has CPL pending.", __func__, toep));
	KASSERT(!(toep->flags & TPF_ATTACHED),
	    ("%s: %p is still attached.", __func__, toep));

	CTR5(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p, ce %p)",
	    __func__, toep, tid, toep->l2te, toep->ce);

	/*
	 * These queues should have been emptied at approximately the same time
	 * that a normal connection's socket's so_snd would have been purged or
	 * drained.  Do _not_ clean up here.
	 */
	MPASS(mbufq_len(&toep->ulp_pduq) == 0);
	MPASS(mbufq_len(&toep->ulp_pdu_reclaimq) == 0);
#ifdef INVARIANTS
	ddp_assert_empty(toep);
#endif

	if (toep->l2te)
		t4_l2t_release(toep->l2te);

	if (tid >= 0) {
		remove_tid(sc, tid, toep->ce ? 2 : 1);
		release_tid(sc, tid, toep->ctrlq);
	}

	if (toep->ce)
		release_lip(td, toep->ce);

#ifdef RATELIMIT
	if (toep->tc_idx != -1)
		t4_release_cl_rl_kbps(sc, toep->vi->pi->port_id, toep->tc_idx);
#endif
	mtx_lock(&td->toep_list_lock);
	TAILQ_REMOVE(&td->toep_list, toep, link);
	mtx_unlock(&td->toep_list_lock);

	free_toepcb(toep);
}
Пример #2
0
static void
khttpd_log_choke(struct khttpd_log *log)
{

	mtx_lock(&khttpd_log_lock);

	log->choking = TRUE;

	if (0 < mbufq_len(&log->queue)) {
		TAILQ_REMOVE(&khttpd_busy_logs, log, link);
		TAILQ_INSERT_HEAD(&khttpd_busy_logs, log, link);

		while (0 < mbufq_len(&log->queue)) {
			log->draining = TRUE;
			mtx_sleep(log, &khttpd_log_lock, 0, "drain", 0);
		}
	}

	mtx_unlock(&khttpd_log_lock);
}
Пример #3
0
/*
 * Add an skb to the deferred skb queue for processing from process context.
 */
void
t3_defer_reply(struct mbuf *m, struct toedev *dev, defer_handler_t handler)
{
	struct tom_data *td = TOM_DATA(dev);

	m_set_handler(m, handler);
	mtx_lock(&td->deferq.lock);
	
	mbufq_tail(&td->deferq, m);
	if (mbufq_len(&td->deferq) == 1)
		taskqueue_enqueue(td->tq, &td->deferq_task);
	mtx_lock(&td->deferq.lock);
}
Пример #4
0
void
khttpd_log_put(struct khttpd_log *log, struct mbuf *m)
{

	mtx_lock(&khttpd_log_lock);

	while (log->choking || mbufq_full(&log->queue))
		mtx_sleep(log, &khttpd_log_lock, 0, "choke", 0);

	if (log->fd == -1) {
		m_freem(m);

	} else {
		if (mbufq_len(&log->queue) == 0) {
			if (TAILQ_EMPTY(&khttpd_busy_logs))
				wakeup(&khttpd_busy_logs);
			TAILQ_INSERT_HEAD(&khttpd_busy_logs, log, link);
		}

		mbufq_enqueue(&log->queue, m);
	}

	mtx_unlock(&khttpd_log_lock);
}