Exemplo n.º 1
0
static void
ntb_transport_rx(struct ntb_transport_qp *qp)
{
	int rc, i;

	/* 
	 * Limit the number of packets processed in a single interrupt to
	 * provide fairness to others
	 */
	mtx_lock(&qp->transport->rx_lock);
	CTR0(KTR_NTB, "RX: transport_rx");
	for (i = 0; i < NTB_RX_MAX_PKTS; i++) {
		rc = ntb_process_rxc(qp);
		if (rc != 0) {
			CTR0(KTR_NTB, "RX: process_rxc failed");
			break;
		}
	}
	mtx_unlock(&qp->transport->rx_lock);
}
Exemplo n.º 2
0
/* Transport Rx */
static void
ntb_transport_rxc_db(void *arg, int pending __unused)
{
	struct ntb_transport_qp *qp = arg;
	ntb_q_idx_t i;
	int rc;

	/*
	 * Limit the number of packets processed in a single interrupt to
	 * provide fairness to others
	 */
	CTR0(KTR_NTB, "RX: transport_rx");
	mtx_lock(&qp->transport->rx_lock);
	for (i = 0; i < qp->rx_max_entry; i++) {
		rc = ntb_process_rxc(qp);
		if (rc != 0) {
			CTR0(KTR_NTB, "RX: process_rxc failed");
			break;
		}
	}
	mtx_unlock(&qp->transport->rx_lock);

	if (i == qp->rx_max_entry)
		taskqueue_enqueue(taskqueue_swi, &qp->rxc_db_work);
	else if ((ntb_db_read(qp->ntb) & (1ull << qp->qp_num)) != 0) {
		/* If db is set, clear it and read it back to commit clear. */
		ntb_db_clear(qp->ntb, 1ull << qp->qp_num);
		(void)ntb_db_read(qp->ntb);

		/*
		 * An interrupt may have arrived between finishing
		 * ntb_process_rxc and clearing the doorbell bit: there might
		 * be some more work to do.
		 */
		taskqueue_enqueue(taskqueue_swi, &qp->rxc_db_work);
	}
}