本文整理汇总了C++中ib_poll_cq函数的典型用法代码示例。如果您正苦于以下问题:C++ ib_poll_cq函数的具体用法?C++ ib_poll_cq怎么用?C++ ib_poll_cq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ib_poll_cq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timer_func
static void timer_func (unsigned long dummy)
{
struct ib_send_wr wr, *bad_wr;
struct ib_sge sge;
int ret;
struct ib_wc wc;
static int id = 1;
if (!have_path)
return;
if (!have_remote_info)
return;
printk (KERN_INFO "verbs_timer: sending datagram to LID = %u, qpn = %x\n", remote_info.lid, remote_info.qp_num);
memset (&wr, 0, sizeof (wr));
wr.wr_id = id++;
wr.wr.ud.ah = ah;
wr.wr.ud.port_num = 1;
wr.wr.ud.remote_qkey = remote_info.qkey;
wr.wr.ud.remote_qpn = remote_info.qp_num;
wr.opcode = IB_WR_SEND;
wr.sg_list = &sge;
wr.send_flags = 0;
wr.num_sge = 1;
/* sge */
sge.addr = send_key;
sge.length = buf_size;
sge.lkey = mr->lkey;
ret = ib_post_send (qp, &wr, &bad_wr);
if (ret)
printk (KERN_INFO "post_send failed: %d\n", ret);
else
printk (KERN_INFO "post_send succeeded\n");
ret = ib_req_notify_cq (recv_cq, IB_CQ_NEXT_COMP);
printk (KERN_INFO "notify_cq return %d for recv_cq\n", ret);
/* ret = ib_req_notify_cq (send_cq, IB_CQ_NEXT_COMP); */
/* printk (KERN_INFO "notify_cq return %d for send_cq\n", ret); */
ret = ib_poll_cq (recv_cq, 1, &wc);
printk (KERN_INFO "poll_cq returned %d for recv_cq\n", ret);
if (ret) {
printk (KERN_INFO "ID: %llu, status: %d, opcode: %d, len: %u\n",
wc.wr_id, (int)wc.status, (int)wc.opcode, wc.byte_len);
verbs_post_recv_req ();
}
ret = ib_poll_cq (send_cq, 1, &wc);
printk (KERN_INFO "poll_cq returned %d for send_cq\n", ret);
mod_timer (&verbs_timer, NEXTJIFF(SEND_INTERVAL));
}
示例2: rpcrdma_flush_cqs
static void
rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
{
struct ib_wc wc;
while (ib_poll_cq(ep->rep_attr.recv_cq, 1, &wc) > 0)
rpcrdma_recvcq_process_wc(&wc);
while (ib_poll_cq(ep->rep_attr.send_cq, 1, &wc) > 0)
rpcrdma_sendcq_process_wc(&wc);
}
示例3: rpcrdma_flush_cqs
static void
rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
{
struct ib_wc wc;
LIST_HEAD(sched_list);
while (ib_poll_cq(ep->rep_attr.recv_cq, 1, &wc) > 0)
rpcrdma_recvcq_process_wc(&wc, &sched_list);
if (!list_empty(&sched_list))
rpcrdma_schedule_tasklet(&sched_list);
while (ib_poll_cq(ep->rep_attr.send_cq, 1, &wc) > 0)
rpcrdma_sendcq_process_wc(&wc);
}
示例4: krping_rlat_test_server
static void krping_rlat_test_server(struct krping_cb *cb)
{
struct ib_send_wr *bad_wr;
struct ib_wc wc;
int ret;
/* Spin waiting for client's Start STAG/TO/Len */
while (cb->state < RDMA_READ_ADV) {
krping_cq_event_handler(cb->cq, cb);
}
/* Send STAG/TO/Len to client */
if (cb->dma_mr)
krping_format_send(cb, cb->start_addr, cb->dma_mr);
else
krping_format_send(cb, cb->start_addr, cb->start_mr);
ret = ib_post_send(cb->qp, &cb->sq_wr, &bad_wr);
if (ret) {
log(LOG_ERR, "post send error %d\n", ret);
return;
}
/* Spin waiting for send completion */
while ((ret = ib_poll_cq(cb->cq, 1, &wc) == 0));
if (ret < 0) {
log(LOG_ERR, "poll error %d\n", ret);
return;
}
if (wc.status) {
log(LOG_ERR, "send completiong error %d\n", wc.status);
return;
}
krping_wait(cb, ERROR);
}
示例5: comp_handler_send
static void comp_handler_send(struct ib_cq* cq, void* cq_context)
{
struct ib_wc wc;
rdma_ctx_t ctx = (rdma_ctx_t)cq_context;
LOG_KERN(LOG_INFO, ("COMP HANDLER\n"));
do {
while (ib_poll_cq(cq, 1, &wc)> 0) {
if (wc.status == IB_WC_SUCCESS) {
LOG_KERN(LOG_INFO, ("IB_WC_SUCCESS\n"));
LOG_KERN(LOG_INFO, ("OP: %s\n",
wc.opcode == IB_WC_RDMA_READ ? "IB_WC_RDMA_READ" :
wc.opcode == IB_WC_RDMA_WRITE ? "IB_WC_RDMA_WRITE" :
"other"));
LOG_KERN(LOG_INFO, ("byte_len: %d\n", wc.byte_len));
LOG_KERN(LOG_INFO, ("Decrementing outstanding requests...\n"));
ctx->outstanding_requests--;
} else {
LOG_KERN(LOG_INFO, ("FAILURE %d\n", wc.status));
}
}
} while (ib_req_notify_cq(cq, IB_CQ_NEXT_COMP |
IB_CQ_REPORT_MISSED_EVENTS) > 0);
}
示例6: __ib_process_cq
static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *wcs,
int batch)
{
int i, n, completed = 0;
/*
* budget might be (-1) if the caller does not
* want to bound this call, thus we need unsigned
* minimum here.
*/
while ((n = ib_poll_cq(cq, min_t(u32, batch,
budget - completed), wcs)) > 0) {
for (i = 0; i < n; i++) {
struct ib_wc *wc = &wcs[i];
if (wc->wr_cqe)
wc->wr_cqe->done(cq, wc);
else
WARN_ON_ONCE(wc->status == IB_WC_SUCCESS);
}
completed += n;
if (n != batch || (budget != -1 && completed >= budget))
break;
}
return completed;
}
示例7: sdp_poll_rx_cq
/* only from interrupt. */
static int
sdp_poll_rx_cq(struct sdp_sock *ssk)
{
struct ib_cq *cq = ssk->rx_ring.cq;
struct ib_wc ibwc[SDP_NUM_WC];
int n, i;
int wc_processed = 0;
struct mbuf *mb;
do {
n = ib_poll_cq(cq, SDP_NUM_WC, ibwc);
for (i = 0; i < n; ++i) {
struct ib_wc *wc = &ibwc[i];
BUG_ON(!(wc->wr_id & SDP_OP_RECV));
mb = sdp_process_rx_wc(ssk, wc);
if (!mb)
continue;
sdp_process_rx_mb(ssk, mb);
wc_processed++;
}
} while (n == SDP_NUM_WC);
if (wc_processed)
sdp_bzcopy_write_space(ssk);
return wc_processed;
}
示例8: mutex
ib_api_status_t IBCompletionQueue::pollCQRead(
IN OUT ib_wc_t** const freeWclist,
OUT ib_wc_t** const doneWclist)
{
eq::base::ScopedMutex mutex( _mutex );
return ib_poll_cq( getReadHandle(), freeWclist, doneWclist);
}
示例9: cq_comp_handler
static void cq_comp_handler(struct ib_cq *cq, void *cq_context)
{
struct p9_client *client = cq_context;
struct p9_trans_rdma *rdma = client->trans;
int ret;
struct ib_wc wc;
ib_req_notify_cq(rdma->cq, IB_CQ_NEXT_COMP);
while ((ret = ib_poll_cq(cq, 1, &wc)) > 0) {
struct p9_rdma_context *c = (void *) (unsigned long) wc.wr_id;
switch (c->wc_op) {
case IB_WC_RECV:
handle_recv(client, rdma, c, wc.status, wc.byte_len);
up(&rdma->rq_sem);
break;
case IB_WC_SEND:
handle_send(client, rdma, c, wc.status, wc.byte_len);
up(&rdma->sq_sem);
break;
default:
pr_err("unexpected completion type, c->wc_op=%d, wc.opcode=%d, status=%d\n",
c->wc_op, wc.opcode, wc.status);
break;
}
kfree(c);
}
}
示例10: sdp_process_tx_cq
static int
sdp_process_tx_cq(struct sdp_sock *ssk)
{
struct ib_wc ibwc[SDP_NUM_WC];
int n, i;
int wc_processed = 0;
SDP_WLOCK_ASSERT(ssk);
if (!ssk->tx_ring.cq) {
sdp_dbg(ssk->socket, "tx irq on destroyed tx_cq\n");
return 0;
}
do {
n = ib_poll_cq(ssk->tx_ring.cq, SDP_NUM_WC, ibwc);
for (i = 0; i < n; ++i) {
sdp_process_tx_wc(ssk, ibwc + i);
wc_processed++;
}
} while (n == SDP_NUM_WC);
if (wc_processed) {
sdp_post_sends(ssk, M_DONTWAIT);
sdp_prf1(sk, NULL, "Waking sendmsg. inflight=%d",
(u32) tx_ring_posted(ssk));
sowwakeup(ssk->socket);
}
return wc_processed;
}
示例11: rpcrdma_recvcq_poll
static int
rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
{
struct list_head sched_list;
struct ib_wc *wcs;
int budget, count, rc;
INIT_LIST_HEAD(&sched_list);
budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE;
do {
wcs = ep->rep_recv_wcs;
rc = ib_poll_cq(cq, RPCRDMA_POLLSIZE, wcs);
if (rc <= 0)
goto out_schedule;
count = rc;
while (count-- > 0)
rpcrdma_recvcq_process_wc(wcs++, &sched_list);
} while (rc == RPCRDMA_POLLSIZE && --budget);
rc = 0;
out_schedule:
rpcrdma_schedule_tasklet(&sched_list);
return rc;
}
示例12: iser_cq_tasklet_fn
static void iser_cq_tasklet_fn(unsigned long data)
{
struct iser_device *device = (struct iser_device *)data;
struct ib_cq *cq = device->cq;
struct ib_wc wc;
struct iser_desc *desc;
unsigned long xfer_len;
while (ib_poll_cq(cq, 1, &wc) == 1) {
desc = (struct iser_desc *) (unsigned long) wc.wr_id;
BUG_ON(desc == NULL);
if (wc.status == IB_WC_SUCCESS) {
if (desc->type == ISCSI_RX) {
xfer_len = (unsigned long)wc.byte_len;
iser_rcv_completion(desc, xfer_len);
} else /* type == ISCSI_TX_CONTROL/SCSI_CMD/DOUT */
iser_snd_completion(desc);
} else {
iser_err("comp w. error op %d status %d\n",desc->type,wc.status);
iser_handle_comp_error(desc);
}
}
/* #warning "it is assumed here that arming CQ only once its empty" *
* " would not cause interrupts to be missed" */
ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
}
示例13: iser_drain_tx_cq
static int iser_drain_tx_cq(struct iser_device *device)
{
struct ib_cq *cq = device->tx_cq;
struct ib_wc wc;
struct iser_tx_desc *tx_desc;
struct iser_conn *ib_conn;
int completed_tx = 0;
while (ib_poll_cq(cq, 1, &wc) == 1) {
tx_desc = (struct iser_tx_desc *) (unsigned long) wc.wr_id;
ib_conn = wc.qp->qp_context;
if (wc.status == IB_WC_SUCCESS) {
if (wc.opcode == IB_WC_SEND)
iser_snd_completion(tx_desc, ib_conn);
else
iser_err("expected opcode %d got %d\n",
IB_WC_SEND, wc.opcode);
} else {
iser_err("tx id %llx status %d vend_err %x\n",
wc.wr_id, wc.status, wc.vendor_err);
atomic_dec(&ib_conn->post_send_buf_count);
iser_handle_comp_error(tx_desc, ib_conn);
}
completed_tx++;
}
return completed_tx;
}
示例14: rpcrdma_clean_cq
/*
* Drain any cq, prior to teardown.
*/
static void
rpcrdma_clean_cq(struct ib_cq *cq)
{
struct ib_wc wc;
int count = 0;
while (1 == ib_poll_cq(cq, 1, &wc))
++count;
if (count)
dprintk("RPC: %s: flushed %d events (last 0x%x)\n",
__func__, count, wc.opcode);
}
示例15: sq_cq_reap
/*
* Send Queue Completion Handler - potentially called on interrupt context.
*
* Note that caller must hold a transport reference.
*/
static void sq_cq_reap(struct svcxprt_rdma *xprt)
{
struct svc_rdma_op_ctxt *ctxt = NULL;
struct ib_wc wc_a[6];
struct ib_wc *wc;
struct ib_cq *cq = xprt->sc_sq_cq;
int ret;
memset(wc_a, 0, sizeof(wc_a));
if (!test_and_clear_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags))
return;
ib_req_notify_cq(xprt->sc_sq_cq, IB_CQ_NEXT_COMP);
atomic_inc(&rdma_stat_sq_poll);
while ((ret = ib_poll_cq(cq, ARRAY_SIZE(wc_a), wc_a)) > 0) {
int i;
for (i = 0; i < ret; i++) {
wc = &wc_a[i];
if (wc->status != IB_WC_SUCCESS) {
dprintk("svcrdma: sq wc err status %s (%d)\n",
ib_wc_status_msg(wc->status),
wc->status);
/* Close the transport */
set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
}
/* Decrement used SQ WR count */
atomic_dec(&xprt->sc_sq_count);
wake_up(&xprt->sc_send_wait);
ctxt = (struct svc_rdma_op_ctxt *)
(unsigned long)wc->wr_id;
if (ctxt)
process_context(xprt, ctxt);
svc_xprt_put(&xprt->sc_xprt);
}
}
if (ctxt)
atomic_inc(&rdma_stat_sq_prod);
}