ctl_getenqueuespace question
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=sJeiHFgrGdn4DUsc9A51dkviqjUP8kfMxFln+GH16GpfaRboQmUdWg7SpZsCq9spgG9ybeP9IqHbupr28nz5w2G7m6qsO1LPk97SolCrxhlpsDCqnKznfg8AQlcIWkUP1yI13fnCwFN6mIOoCwaQCT/o8ZZGIyUKmX5PZ+3fukQ= 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Bhavesh Davda