本文整理汇总了C++中ib_poll_cq函数的典型用法代码示例。如果您正苦于以下问题:C++ ib_poll_cq函数的具体用法?C++ ib_poll_cq怎么用?C++ ib_poll_cq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ib_poll_cq函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:Shmuma,项目名称:sample_mods,代码行数:59,代码来源:verbs.c
示例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);
}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:10,代码来源:verbs.c
示例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);
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:13,代码来源:verbs.c
示例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);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:35,代码来源:krping.c
示例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);
}
开发者ID:jcarreira,项目名称:disag-firebox,代码行数:25,代码来源:rdma_library.c
示例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;
}
开发者ID:austriancoder,项目名称:linux,代码行数:29,代码来源:cq.c
示例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;
}
开发者ID:Lxg1582,项目名称:freebsd,代码行数:30,代码来源:sdp_rx.c
示例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);
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:7,代码来源:ibCompletionQueue.cpp
示例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);
}
}
开发者ID:Seagate,项目名称:SMR_FS-EXT4,代码行数:30,代码来源:trans_rdma.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;
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:31,代码来源:sdp_tx.c
示例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;
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:26,代码来源:verbs.c
示例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);
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:27,代码来源:iser_verbs.c
示例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;
}
开发者ID:710leo,项目名称:LVS,代码行数:27,代码来源:iser_verbs.c
示例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);
}
开发者ID:MaxChina,项目名称:linux,代码行数:16,代码来源:verbs.c
示例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);
}
开发者ID:ammubhave,项目名称:bargud,代码行数:50,代码来源:svc_rdma_transport.c
示例16: poll_rcq
static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
struct ib_wc *wcs,
struct rds_ib_ack_state *ack_state)
{
int nr, i;
struct ib_wc *wc;
while ((nr = ib_poll_cq(cq, RDS_IB_WC_MAX, wcs)) > 0) {
for (i = 0; i < nr; i++) {
wc = wcs + i;
rdsdebug("wc wr_id 0x%llx status %u byte_len %u imm_data %u\n",
(unsigned long long)wc->wr_id, wc->status,
wc->byte_len, be32_to_cpu(wc->ex.imm_data));
rds_ib_recv_cqe_handler(ic, wc, ack_state);
}
}
}
开发者ID:513855417,项目名称:linux,代码行数:18,代码来源:ib_cm.c
示例17: rpcrdma_recvcq_poll
/* The wc array is on stack: automatic memory is always CPU-local.
*
* struct ib_wc is 64 bytes, making the poll array potentially
* large. But this is at the bottom of the call chain. Further
* substantial work is done in another thread.
*/
static void
rpcrdma_recvcq_poll(struct ib_cq *cq)
{
struct ib_wc *pos, wcs[4];
int count, rc;
do {
pos = wcs;
rc = ib_poll_cq(cq, ARRAY_SIZE(wcs), pos);
if (rc < 0)
break;
count = rc;
while (count-- > 0)
rpcrdma_recvcq_process_wc(pos++);
} while (rc == ARRAY_SIZE(wcs));
}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:24,代码来源:verbs.c
示例18: rq_cq_reap
/*
* rq_cq_reap - Process the RQ CQ.
*
* Take all completing WC off the CQE and enqueue the associated DTO
* context on the dto_q for the transport.
*
* Note that caller must hold a transport reference.
*/
static void rq_cq_reap(struct svcxprt_rdma *xprt)
{
int ret;
struct ib_wc wc;
struct svc_rdma_op_ctxt *ctxt = NULL;
if (!test_and_clear_bit(RDMAXPRT_RQ_PENDING, &xprt->sc_flags))
return;
ib_req_notify_cq(xprt->sc_rq_cq, IB_CQ_NEXT_COMP);
atomic_inc(&rdma_stat_rq_poll);
while ((ret = ib_poll_cq(xprt->sc_rq_cq, 1, &wc)) > 0) {
ctxt = (struct svc_rdma_op_ctxt *)(unsigned long)wc.wr_id;
ctxt->wc_status = wc.status;
ctxt->byte_len = wc.byte_len;
svc_rdma_unmap_dma(ctxt);
if (wc.status != IB_WC_SUCCESS) {
/* Close the transport */
dprintk("svcrdma: transport closing putting ctxt %p\n", ctxt);
set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
svc_rdma_put_context(ctxt, 1);
svc_xprt_put(&xprt->sc_xprt);
continue;
}
spin_lock_bh(&xprt->sc_rq_dto_lock);
list_add_tail(&ctxt->dto_q, &xprt->sc_rq_dto_q);
spin_unlock_bh(&xprt->sc_rq_dto_lock);
svc_xprt_put(&xprt->sc_xprt);
}
if (ctxt)
atomic_inc(&rdma_stat_rq_prod);
set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags);
/*
* If data arrived before established event,
* don't enqueue. This defers RPC I/O until the
* RDMA connection is complete.
*/
if (!test_bit(RDMAXPRT_CONN_PENDING, &xprt->sc_flags))
svc_xprt_enqueue(&xprt->sc_xprt);
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:51,代码来源:svc_rdma_transport.c
示例19: rpcrdma_recvcq_poll
static int
rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
{
struct ib_wc *wcs;
int budget, count, rc;
budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE;
do {
wcs = ep->rep_recv_wcs;
rc = ib_poll_cq(cq, RPCRDMA_POLLSIZE, wcs);
if (rc <= 0)
return rc;
count = rc;
while (count-- > 0)
rpcrdma_recvcq_process_wc(wcs++);
} while (rc == RPCRDMA_POLLSIZE && --budget);
return 0;
}
开发者ID:MaxChina,项目名称:linux,代码行数:20,代码来源:verbs.c
示例20: 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;
if (!ssk->tx_ring.cq) {
sdp_dbg(sk_ssk(ssk), "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) {
struct sock *sk = sk_ssk(ssk);
sdp_prf1(sk, NULL, "Waking sendmsg. inflight=%d",
(u32) tx_ring_posted(ssk));
sk_mem_reclaim(sk);
sk_stream_write_space(sk_ssk(ssk));
if (sk->sk_write_pending &&
test_bit(SOCK_NOSPACE, &sk->sk_socket->flags) &&
tx_ring_posted(ssk)) {
/* a write is pending and still no room in tx queue,
* arm tx cq
*/
sdp_prf(sk_ssk(ssk), NULL, "pending tx - rearming");
sdp_arm_tx_cq(sk);
}
}
return wc_processed;
}
开发者ID:u9621071,项目名称:kernel-uek-UEK3,代码行数:41,代码来源:sdp_tx.c
注:本文中的ib_poll_cq函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论