ctl_getenqueuespace question
ctl_getenqueuespace question
- Subject: ctl_getenqueuespace question
- From: "Bhavesh Davda" <email@hidden>
- Date: Mon, 2 Oct 2006 13:41:40 -0700
In my NKE, I do:
size_t queueRoom, mbufLen;
...
ctl_getenqueuespace(ctlRef, unit, &queueRoom);
...
mbufLen = mbuf_pkthdr_len(m);
...
if (queueRoom < mbufLen) {
// drop packet
}
else {
if ((err = ctl_enqueuembuf(ctlRef, unit, m, CTL_DATA_EOR)) != 0) {
// error log; drop packet
}
I'm seeing that ctl_getenqueuespace() sometimes returns queueRoom ==
0xfffffe00, which interpreted as a size_t is 4294966784. When mbufLen
== 1514, this is less than 4294966784, so I attempt to call
ctl_enqueuembuf(...).
But then ctl_enqueuembuf() returns ENOBUFS.
Looking in the xnu-792.10.96/bsd/kern/kernl_control.c code, I see the check:
...
if (sbspace(&so->so_rcv) < m->m_pkthdr.len) {
error = ENOBUFS;
goto bye;
}
...
This is pretty much the same check as my NKE code above, with the one
notable difference of the types of queueRoom/mbufLen versus the value
returned by sbspace().
Could this be a type conversion bug? If so, are there any workarounds?
Also, I spend a couple of hours trying to figure out what sbspace()
really does, and gave up after getting more confused then when I
started looking at it :) Can someone explain the intent of sbspace()
in English?
Thanks
--
Bhavesh P. Davda
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden