Lines Matching full:handle

65 rdmasniff_stats(pcap_t *handle, struct pcap_stat *stat)
67 struct pcap_rdmasniff *priv = handle->priv;
77 rdmasniff_cleanup(pcap_t *handle)
79 struct pcap_rdmasniff *priv = handle->priv;
90 pcapint_cleanup_live_common(handle);
94 rdmasniff_post_recv(pcap_t *handle, uint64_t wr_id)
96 struct pcap_rdmasniff *priv = handle->priv;
101 sg_entry.addr = (uintptr_t) handle->buffer + RDMASNIFF_RECEIVE_SIZE * wr_id;
113 rdmasniff_read(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user)
115 struct pcap_rdmasniff *priv = handle->priv;
128 if (handle->break_loop) {
129 handle->break_loop = 0;
167 pkth.caplen = min(pkth.len, (u_int)handle->snapshot);
170 pktd = (u_char *) handle->buffer + wc.wr_id * RDMASNIFF_RECEIVE_SIZE;
172 if (handle->fcode.bf_insns == NULL ||
173 pcapint_filter(handle->fcode.bf_insns, pktd, pkth.len, pkth.caplen)) {
179 rdmasniff_post_recv(handle, wc.wr_id);
181 if (handle->break_loop) {
182 handle->break_loop = 0;
194 pcap_t *handle = sp->pd;
195 struct pcap_rdmasniff *priv = handle->priv;
203 rdmasniff_activate(pcap_t *handle)
205 struct pcap_rdmasniff *priv = handle->priv;
214 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
215 "Failed to open device %s", handle->opt.device);
221 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
222 "Failed to alloc PD for device %s", handle->opt.device);
228 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
229 "Failed to create comp channel for device %s", handle->opt.device);
236 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
237 "Failed to create CQ for device %s", handle->opt.device);
250 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
251 "Failed to create QP for device %s", handle->opt.device);
259 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
260 "Failed to modify QP to INIT for device %s", handle->opt.device);
267 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
268 "Failed to modify QP to RTR for device %s", handle->opt.device);
278 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
279 "Failed to create flow for device %s", handle->opt.device);
283 handle->bufsize = RDMASNIFF_NUM_RECEIVES * RDMASNIFF_RECEIVE_SIZE;
284 handle->buffer = malloc(handle->bufsize);
285 if (!handle->buffer) {
286 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
287 "Failed to allocate receive buffer for device %s", handle->opt.device);
293 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
294 "Failed to allocate oneshot buffer for device %s", handle->opt.device);
298 priv->mr = ibv_reg_mr(priv->pd, handle->buffer, handle->bufsize, IBV_ACCESS_LOCAL_WRITE);
300 snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
301 "Failed to register MR for device %s", handle->opt.device);
307 rdmasniff_post_recv(handle, i);
312 handle->linktype = DLT_INFINIBAND;
314 handle->linktype = DLT_EN10MB;
317 if (handle->snapshot <= 0 || handle->snapshot > RDMASNIFF_RECEIVE_SIZE)
318 handle->snapshot = RDMASNIFF_RECEIVE_SIZE;
320 handle->offset = 0;
321 handle->read_op = rdmasniff_read;
322 handle->stats_op = rdmasniff_stats;
323 handle->cleanup_op = rdmasniff_cleanup;
324 handle->setfilter_op = pcapint_install_bpf_program;
325 handle->setdirection_op = NULL;
326 handle->set_datalink_op = NULL;
327 handle->getnonblock_op = pcapint_getnonblock_fd;
328 handle->setnonblock_op = pcapint_setnonblock_fd;
329 handle->oneshot_callback = rdmasniff_oneshot;
330 handle->selectable_fd = priv->channel->fd;