version 1.1.2.17, 2013/06/26 15:04:02
|
version 1.1.2.18, 2013/06/26 15:31:17
|
Line 272 io_etherRecv(int eth, void * __restrict buf, size_t bu
|
Line 272 io_etherRecv(int eth, void * __restrict buf, size_t bu
|
#ifdef __FreeBSD__ |
#ifdef __FreeBSD__ |
struct bpf_zbuf bz; |
struct bpf_zbuf bz; |
struct bpf_zbuf_header *bzh; |
struct bpf_zbuf_header *bzh; |
|
#else |
|
if (zcbuf) { |
|
io_SetErr(ENOTSUP, "bpf zero copy buffer mode is not supported"); |
|
return -1; |
|
} |
#endif |
#endif |
|
|
if (!buf || !buflen) { |
if (!buf || !buflen) { |
Line 291 io_etherRecv(int eth, void * __restrict buf, size_t bu
|
Line 296 io_etherRecv(int eth, void * __restrict buf, size_t bu
|
bzh = (struct bpf_zbuf_header*) zcache; |
bzh = (struct bpf_zbuf_header*) zcache; |
memcpy(buf, zcache + sizeof(struct bpf_zbuf_header), |
memcpy(buf, zcache + sizeof(struct bpf_zbuf_header), |
MIN(buflen, rlen)); |
MIN(buflen, rlen)); |
ackZCbuf(bzh); |
|
} |
} |
if (!rlen && !ioctl(eth, BIOCROTZBUF, &bz)) { | if (!rlen && !ioctl(eth, BIOCROTZBUF, &bz)) |
bzh = (struct bpf_zbuf_header*) bz.bz_bufa; | continue; |
if (bzh && chkZCbuf(bzh)) { | |
rlen = bz.bz_buflen; | |
memcpy(buf, bz.bz_bufa + sizeof(struct bpf_zbuf_header), | |
MIN(buflen, rlen)); | |
} | |
} | |
} while (0); |
} while (0); |
#else |
#else |
rlen = -1; |
rlen = -1; |