date and time created 82/03/27 22:57:39 by sam
[unix-history] / usr / src / sys / net / if.h
index 2de24b7..067db3f 100644 (file)
@@ -1,4 +1,4 @@
-/*     if.h    4.7     82/01/24        */
+/*     if.h    4.10    82/03/19        */
 
 /*
  * Structures defining a network interface, providing a packet
 
 /*
  * Structures defining a network interface, providing a packet
@@ -38,9 +38,13 @@ struct ifnet {
        short   if_net;                 /* network number of interface */
        int     if_host[2];             /* local net host number */
        struct  in_addr if_addr;        /* internet address of interface */
        short   if_net;                 /* network number of interface */
        int     if_host[2];             /* local net host number */
        struct  in_addr if_addr;        /* internet address of interface */
+       struct  in_addr if_broadaddr;   /* broadcast address of interface */
        struct  ifqueue {
                struct  mbuf *ifq_head;
                struct  mbuf *ifq_tail;
        struct  ifqueue {
                struct  mbuf *ifq_head;
                struct  mbuf *ifq_tail;
+               int     ifq_len;
+               int     ifq_maxlen;
+               int     ifq_drops;
        } if_snd;                       /* output queue */
 /* procedure handles */
        int     (*if_init)();           /* init routine */
        } if_snd;                       /* output queue */
 /* procedure handles */
        int     (*if_init)();           /* init routine */
@@ -62,6 +66,8 @@ struct ifnet {
  * (defined above).  Entries are added to and deleted from these structures
  * by these macros, which should be called with ipl raised to splimp().
  */
  * (defined above).  Entries are added to and deleted from these structures
  * by these macros, which should be called with ipl raised to splimp().
  */
+#define        IF_QFULL(ifq)           ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
+#define        IF_DROP(ifq)            ((ifq)->ifq_drops++)
 #define        IF_ENQUEUE(ifq, m) { \
        (m)->m_act = 0; \
        if ((ifq)->ifq_tail == 0) \
 #define        IF_ENQUEUE(ifq, m) { \
        (m)->m_act = 0; \
        if ((ifq)->ifq_tail == 0) \
@@ -69,10 +75,14 @@ struct ifnet {
        else \
                (ifq)->ifq_tail->m_act = m; \
        (ifq)->ifq_tail = m; \
        else \
                (ifq)->ifq_tail->m_act = m; \
        (ifq)->ifq_tail = m; \
+       (ifq)->ifq_len++; \
 }
 #define        IF_PREPEND(ifq, m) { \
        (m)->m_act = (ifq)->ifq_head; \
 }
 #define        IF_PREPEND(ifq, m) { \
        (m)->m_act = (ifq)->ifq_head; \
+       if ((ifq)->ifq_tail == 0) \
+               (ifq)->ifq_tail = (m); \
        (ifq)->ifq_head = (m); \
        (ifq)->ifq_head = (m); \
+       (ifq)->ifq_len++; \
 }
 #define        IF_DEQUEUE(ifq, m) { \
        (m) = (ifq)->ifq_head; \
 }
 #define        IF_DEQUEUE(ifq, m) { \
        (m) = (ifq)->ifq_head; \
@@ -80,14 +90,17 @@ struct ifnet {
                if (((ifq)->ifq_head = (m)->m_act) == 0) \
                        (ifq)->ifq_tail = 0; \
                (m)->m_act = 0; \
                if (((ifq)->ifq_head = (m)->m_act) == 0) \
                        (ifq)->ifq_tail = 0; \
                (m)->m_act = 0; \
+               (ifq)->ifq_len--; \
        } \
 }
 
        } \
 }
 
+#define        IFQ_MAXLEN      50
+
 #ifdef KERNEL
 #ifdef KERNEL
+struct ifqueue rawintrq;               /* raw packet input queue */
 #ifdef INET
 struct ifqueue ipintrq;                /* ip packet input queue */
 #endif
 #ifdef INET
 struct ifqueue ipintrq;                /* ip packet input queue */
 #endif
-struct ifqueue rawintrq;               /* raw packet input queue */
 struct ifnet *ifnet;
 struct ifnet *if_ifwithaddr(), *if_ifonnetof(), *if_gatewayfor();
 struct in_addr if_makeaddr();
 struct ifnet *ifnet;
 struct ifnet *if_ifwithaddr(), *if_ifonnetof(), *if_gatewayfor();
 struct in_addr if_makeaddr();