Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/man/man9 - Correct the IFQ_ENQUEUE macro.



details:   https://anonhg.NetBSD.org/src/rev/30059ac7ce58
branches:  trunk
changeset: 582111:30059ac7ce58
user:      peter <peter%NetBSD.org@localhost>
date:      Fri Jun 17 14:10:50 2005 +0000

description:
- Correct the IFQ_ENQUEUE macro.
- Fix some internal variable names for some macros.
- A few corrections from the OpenBSD manpage.

diffstat:

 share/man/man9/altq.9 |  55 +++++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 25 deletions(-)

diffs (148 lines):

diff -r e253f8208e56 -r 30059ac7ce58 share/man/man9/altq.9
--- a/share/man/man9/altq.9     Fri Jun 17 12:02:00 2005 +0000
+++ b/share/man/man9/altq.9     Fri Jun 17 14:10:50 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: altq.9,v 1.9 2003/04/16 13:35:24 wiz Exp $
+.\"    $NetBSD: altq.9,v 1.10 2005/06/17 14:10:50 peter Exp $
 .\"    $OpenBSD: altq.9,v 1.4 2001/07/12 12:41:42 itojun Exp $
 .\"
 .\" Copyright (C) 2001
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 10, 2001
+.Dd June 17, 2005
 .Dt ALTQ 9
 .Os
 .\"
@@ -37,7 +37,7 @@
 .In sys/socket.h
 .In net/if.h
 .Ft void \"macro
-.Fn IFQ_ENQUEUE "struct ifaltq *ifq" "struct mbuf *m" "int error"
+.Fn IFQ_ENQUEUE "struct ifaltq *ifq" "struct mbuf *m" "struct altq_pktattr *pattr" "int err"
 .Ft void \"macro
 .Fn IFQ_DEQUEUE "struct ifaltq *ifq" "struct mbuf *m"
 .Ft void \"macro
@@ -45,7 +45,7 @@
 .Ft void \"macro
 .Fn IFQ_PURGE "struct ifaltq *ifq"
 .Ft void \"macro
-.Fn IFQ_CLASSIFY "struct ifaltq *ifq" "struct mbuf *m" "int af" "struct altq_pktattr *pktattr"
+.Fn IFQ_CLASSIFY "struct ifaltq *ifq" "struct mbuf *m" "int af" "struct altq_pktattr *pa"
 .Ft void \"macro
 .Fn IFQ_IS_EMPTY "struct ifaltq *ifq"
 .Ft void \"macro
@@ -79,13 +79,13 @@
 to the queue
 .Fa ifq .
 The underlying queueing discipline may discard the packet.
-.Fa error
+.Fa err
 is set to 0 on success, or
 .Dv ENOBUFS
 if the packet is discarded.
 .Fa m
 will be freed by the device driver on success or by the queueing discipline on
-failure so that the caller should not touch
+failure, so that the caller should not touch
 .Fa m
 after calling
 .Fn IFQ_ENQUEUE .
@@ -120,7 +120,7 @@
 .Pp
 .Fn IFQ_CLASSIFY
 classifies a packet to a scheduling class, and returns the result in
-.Fa pktattr .
+.Fa pa .
 .Pp
 .Fn IFQ_IS_EMPTY
 can be used to check if the queue is empty.
@@ -206,28 +206,33 @@
        #endif
 .Ed
 .Ss Enqueue operation
-The semantics of the enqueue operation is changed.
+The semantics of the enqueue operation are changed.
 In the new style,
 enqueue and packet drop are combined since they cannot be easily
 separated in many queueing disciplines.
 The new enqueue operation corresponds to the following macro that is
 written with the old macros.
 .Bd -literal
-#define        IFQ_ENQUEUE(ifq, m, error)                      \e
-do {                                                    \e
-        if (IF_QFULL((ifq))) {                          \e
-                m_freem((m));                           \e
-                (error) = ENOBUFS;                      \e
-                IF_DROP(ifq);                           \e
-         } else {                                       \e
-                IF_ENQUEUE((ifq), (m));                 \e
-                (error) = 0;                            \e
-         }                                              \e
-} while (0)
+#define        IFQ_ENQUEUE(ifq, m, pattr, err)                   \e
+do {                                                      \e
+        if (ALTQ_IS_ENABLED((ifq)))                       \e
+                ALTQ_ENQUEUE((ifq), (m), (pattr), (err)); \e
+        else {                                            \e
+                if (IF_QFULL((ifq))) {                    \e
+                        m_freem((m));                     \e
+                        (err) = ENOBUFS;                  \e
+                } else {                                  \e
+                        IF_ENQUEUE((ifq), (m));           \e
+                        (err) = 0;                        \e
+                }                                         \e
+        }                                                 \e
+        if ((err))                                        \e
+                (ifq)-\*[Gt]ifq_drops++;                       \e
+} while (/*CONSTCOND*/ 0)
 .Ed
 .Pp
 .Fn IFQ_ENQUEUE
-does the followings:
+does the following:
 .Bl -hyphen -compact
 .It
 queue a packet
@@ -235,10 +240,10 @@
 drop (and free) a packet if the enqueue operation fails
 .El
 If the enqueue operation fails,
-.Fa error
+.Fa err
 is set to
 .Dv ENOBUFS .
-.Fa mbuf
+.Fa m
 is freed by the queueing discipline.
 The caller should not touch mbuf after calling
 .Fn IFQ_ENQUEUE
@@ -266,7 +271,7 @@
                                        |     len = m-\*[Gt]m_pkthdr.len;
      s = splimp();                     |     s = splimp();
      if (IF_QFULL(\*[Am]ifp-\*[Gt]if_snd)) {     |     IFQ_ENQUEUE(\*[Am]ifp-\*[Gt]if_snd, m,
-                                       |                 error);
+                                       |                 NULL, error);
          IF_DROP(\*[Am]ifp-\*[Gt]if_snd);        |     if (error != 0) {
          splx(s);                      |         splx(s);
          senderr(ENOBUFS);             |         return (error);
@@ -325,7 +330,7 @@
 Look for
 .Fa if_snd
 in the driver.
-Probably, you need to make changes to the lines that include
+You will probably need to make changes to the lines that include
 .Fa if_snd .
 .Ss Empty check operation
 If the code checks
@@ -546,7 +551,7 @@
  IF_ENQUEUE(ifq, m);                   |     }
                                        | } else
                                        |     IFQ_ENQUEUE(\*[Am]sc-\*[Gt]sc_if.if_snd,
-                                       |                 m, error);
+                                       |                 m, NULL, error);
                                        |
                                        | if (error) {
                                        |     splx(s);



Home | Main Index | Thread Index | Old Index