Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/oce/oce_queue.c
Show First 20 Lines • Show All 963 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* @brief Start a work queue | * @brief Start a work queue | ||||
* @param wq pointer to a work queue | * @param wq pointer to a work queue | ||||
*/ | */ | ||||
int | int | ||||
oce_start_wq(struct oce_wq *wq) | oce_start_wq(struct oce_wq *wq) | ||||
{ | { | ||||
LOCK(&wq->tx_lock); /* XXX: maybe not necessary */ | |||||
oce_arm_cq(wq->parent, wq->cq->cq_id, 0, TRUE); | oce_arm_cq(wq->parent, wq->cq->cq_id, 0, TRUE); | ||||
UNLOCK(&wq->tx_lock); | |||||
return 0; | return 0; | ||||
} | } | ||||
/** | /** | ||||
* @brief Start a mailbox queue | * @brief Start a mailbox queue | ||||
* @param mq pointer to a mailbox queue | * @param mq pointer to a mailbox queue | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
oce_drain_wq_cq(struct oce_wq *wq) | oce_drain_wq_cq(struct oce_wq *wq) | ||||
{ | { | ||||
POCE_SOFTC sc = wq->parent; | POCE_SOFTC sc = wq->parent; | ||||
struct oce_cq *cq = wq->cq; | struct oce_cq *cq = wq->cq; | ||||
struct oce_nic_tx_cqe *cqe; | struct oce_nic_tx_cqe *cqe; | ||||
int num_cqes = 0; | int num_cqes = 0; | ||||
LOCK(&wq->tx_lock); /* XXX: maybe not necessary */ | |||||
bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, | bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, | ||||
BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTWRITE); | ||||
do { | do { | ||||
cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct oce_nic_tx_cqe); | cqe = RING_GET_CONSUMER_ITEM_VA(cq->ring, struct oce_nic_tx_cqe); | ||||
if (cqe->u0.dw[3] == 0) | if (cqe->u0.dw[3] == 0) | ||||
break; | break; | ||||
cqe->u0.dw[3] = 0; | cqe->u0.dw[3] = 0; | ||||
bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, | bus_dmamap_sync(cq->ring->dma.tag, cq->ring->dma.map, | ||||
BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTWRITE); | ||||
RING_GET(cq->ring, 1); | RING_GET(cq->ring, 1); | ||||
num_cqes++; | num_cqes++; | ||||
} while (TRUE); | } while (TRUE); | ||||
oce_arm_cq(sc, cq->cq_id, num_cqes, FALSE); | oce_arm_cq(sc, cq->cq_id, num_cqes, FALSE); | ||||
UNLOCK(&wq->tx_lock); | |||||
} | } | ||||
/* | /* | ||||
* @brief function to drain a MCQ and process its CQEs | * @brief function to drain a MCQ and process its CQEs | ||||
* @param dev software handle to the device | * @param dev software handle to the device | ||||
* @param cq pointer to the cq to drain | * @param cq pointer to the cq to drain | ||||
* @returns the number of CQEs processed | * @returns the number of CQEs processed | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |