Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/altq.9
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
will be freed by the device driver on success, or by the queuing discipline on | will be freed by the device driver on success, or by the queuing discipline on | ||||
failure, so the caller should not touch | failure, so the caller should not touch | ||||
.Fa m | .Fa m | ||||
after enqueuing. | after enqueuing. | ||||
.Fn IFQ_HANDOFF | .Fn IFQ_HANDOFF | ||||
and | and | ||||
.Fn IFQ_HANDOFF_ADJ | .Fn IFQ_HANDOFF_ADJ | ||||
combine the enqueue operation with statistic generation and call | combine the enqueue operation with statistic generation and call | ||||
.Fn if_start | .Xr if_start 9 | ||||
upon successful enqueue to initiate the actual send. | upon successful enqueue to initiate the actual send. | ||||
.Pp | .Pp | ||||
.Fn IFQ_DEQUEUE | .Fn IFQ_DEQUEUE | ||||
dequeues a packet from the queue. | dequeues a packet from the queue. | ||||
The dequeued packet is returned in | The dequeued packet is returned in | ||||
.Fa m , | .Fa m , | ||||
or | or | ||||
.Fa m | .Fa m | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | |||||
.Pp | .Pp | ||||
.Fn IFQ_INC_LEN | .Fn IFQ_INC_LEN | ||||
and | and | ||||
.Fn IFQ_DEC_LEN | .Fn IFQ_DEC_LEN | ||||
increment or decrement the current queue length in packets. | increment or decrement the current queue length in packets. | ||||
This is mostly for internal purposes. | This is mostly for internal purposes. | ||||
.Pp | .Pp | ||||
.Fn IFQ_INC_DROPS | .Fn IFQ_INC_DROPS | ||||
increments the drop counter and is identical to | increments the drop counter. | ||||
.Fn IF_DROP . | |||||
It is defined for naming consistency only. | |||||
.Pp | .Pp | ||||
.Fn IFQ_SET_READY | .Fn IFQ_SET_READY | ||||
sets a flag to indicate that a driver was converted to use the new macros. | sets a flag to indicate that a driver was converted to use the new macros. | ||||
.Nm | .Nm | ||||
can be enabled only on interfaces with this flag. | can be enabled only on interfaces with this flag. | ||||
.Sh COMPATIBILITY | .Sh COMPATIBILITY | ||||
.Ss Vt ifaltq structure | .Ss Vt ifaltq structure | ||||
In order to keep compatibility with the existing code, the new | In order to keep compatibility with the existing code, the new | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
.Va m_pkthdr.len | .Va m_pkthdr.len | ||||
or | or | ||||
.Va m_flags | .Va m_flags | ||||
field beforehand for statistics. | field beforehand for statistics. | ||||
.Fn IFQ_HANDOFF | .Fn IFQ_HANDOFF | ||||
and | and | ||||
.Fn IFQ_HANDOFF_ADJ | .Fn IFQ_HANDOFF_ADJ | ||||
can be used if only default interface statistics and an immediate call to | can be used if only default interface statistics and an immediate call to | ||||
.Fn if_start | .Xr if_start 9 | ||||
are desired. | are desired. | ||||
The caller should not use | The caller should not use | ||||
.Fn senderr | .Xr senderr 9 | ||||
since mbuf was already freed. | since mbuf was already freed. | ||||
.Pp | .Pp | ||||
The new style | The new style | ||||
.Fn if_output | .Xr if_output 9 | ||||
looks as follows: | looks as follows: | ||||
.Bd -literal | .Bd -literal | ||||
##old-style## ##new-style## | ##old-style## ##new-style## | ||||
| | | | ||||
int | int | int | int | ||||
ether_output(ifp, m0, dst, rt0) | ether_output(ifp, m0, dst, rt0) | ether_output(ifp, m0, dst, rt0) | ether_output(ifp, m0, dst, rt0) | ||||
{ | { | { | { | ||||
...... | ...... | ...... | ...... | ||||
Show All 23 Lines | bad: | bad: | ||||
if (m) | if (m) | if (m) | if (m) | ||||
m_freem(m); | m_freem(m); | m_freem(m); | m_freem(m); | ||||
return (error); | return (error); | return (error); | return (error); | ||||
} | } | } | } | ||||
| | | | ||||
.Ed | .Ed | ||||
.Sh HOW TO CONVERT THE EXISTING DRIVERS | .Sh HOW TO CONVERT THE EXISTING DRIVERS | ||||
First, make sure the corresponding | First, make sure the corresponding | ||||
.Fn if_output | .Xr if_output 9 | ||||
is already converted to the new style. | is already converted to the new style. | ||||
.Pp | .Pp | ||||
Look for | Look for | ||||
.Va if_snd | .Va if_snd | ||||
in the driver. | in the driver. | ||||
Probably, you need to make changes to the lines that include | Probably, you need to make changes to the lines that include | ||||
.Va if_snd . | .Va if_snd . | ||||
.Ss Empty check operation | .Ss Empty check operation | ||||
Show All 37 Lines | .Bd -literal | ||||
##old-style## ##new-style## | ##old-style## ##new-style## | ||||
| | | | ||||
IF_DEQUEUE(&ifp->if_snd, m); | IFQ_DEQUEUE(&ifp->if_snd, m); | IF_DEQUEUE(&ifp->if_snd, m); | IFQ_DEQUEUE(&ifp->if_snd, m); | ||||
| if (m == NULL) | | if (m == NULL) | ||||
| return; | | return; | ||||
| | | | ||||
.Ed | .Ed | ||||
A driver is supposed to call | A driver is supposed to call | ||||
.Fn if_start | .Xr if_start 9 | ||||
from transmission complete interrupts in order to trigger the next dequeue. | from transmission complete interrupts in order to trigger the next dequeue. | ||||
.Ss Poll-and-dequeue operation | .Ss Poll-and-dequeue operation | ||||
If the code polls the packet at the head of the queue and actually uses | If the code polls the packet at the head of the queue and actually uses | ||||
the packet before dequeuing it, use | the packet before dequeuing it, use | ||||
.Fn IFQ_POLL_NOLOCK | .Fn IFQ_POLL_NOLOCK | ||||
and | and | ||||
.Fn IFQ_DEQUEUE_NOLOCK . | .Fn IFQ_DEQUEUE_NOLOCK . | ||||
.Bd -literal | .Bd -literal | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |