[BACK]Return to udp_usrreq.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / netinet

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/netinet/udp_usrreq.c between version 1.139 and 1.140

version 1.139, 2005/08/05 09:21:26 version 1.140, 2005/08/10 13:05:17
Line 186  struct mowner udp_tx_mowner = { "udp", "
Line 186  struct mowner udp_tx_mowner = { "udp", "
 #ifdef UDP_CSUM_COUNTERS  #ifdef UDP_CSUM_COUNTERS
 #include <sys/device.h>  #include <sys/device.h>
   
   #if defined(INET)
 struct evcnt udp_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,  struct evcnt udp_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
     NULL, "udp", "hwcsum bad");      NULL, "udp", "hwcsum bad");
 struct evcnt udp_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,  struct evcnt udp_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
Line 195  struct evcnt udp_hwcsum_data = EVCNT_INI
Line 196  struct evcnt udp_hwcsum_data = EVCNT_INI
 struct evcnt udp_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,  struct evcnt udp_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
     NULL, "udp", "swcsum");      NULL, "udp", "swcsum");
   
 #define UDP_CSUM_COUNTER_INCR(ev)       (ev)->ev_count++  
   
 EVCNT_ATTACH_STATIC(udp_hwcsum_bad);  EVCNT_ATTACH_STATIC(udp_hwcsum_bad);
 EVCNT_ATTACH_STATIC(udp_hwcsum_ok);  EVCNT_ATTACH_STATIC(udp_hwcsum_ok);
 EVCNT_ATTACH_STATIC(udp_hwcsum_data);  EVCNT_ATTACH_STATIC(udp_hwcsum_data);
 EVCNT_ATTACH_STATIC(udp_swcsum);  EVCNT_ATTACH_STATIC(udp_swcsum);
   #endif /* defined(INET) */
   
   #if defined(INET6)
   struct evcnt udp6_hwcsum_bad = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
       NULL, "udp6", "hwcsum bad");
   struct evcnt udp6_hwcsum_ok = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
       NULL, "udp6", "hwcsum ok");
   struct evcnt udp6_hwcsum_data = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
       NULL, "udp6", "hwcsum data");
   struct evcnt udp6_swcsum = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
       NULL, "udp6", "swcsum");
   
   EVCNT_ATTACH_STATIC(udp6_hwcsum_bad);
   EVCNT_ATTACH_STATIC(udp6_hwcsum_ok);
   EVCNT_ATTACH_STATIC(udp6_hwcsum_data);
   EVCNT_ATTACH_STATIC(udp6_swcsum);
   #endif /* defined(INET6) */
   
   #define UDP_CSUM_COUNTER_INCR(ev)       (ev)->ev_count++
   
 #else  #else
   
Line 442  static int
Line 460  static int
 udp6_input_checksum(struct mbuf *m, const struct udphdr *uh, int off, int len)  udp6_input_checksum(struct mbuf *m, const struct udphdr *uh, int off, int len)
 {  {
   
           /*
            * XXX it's better to record and check if this mbuf is
            * already checked.
            */
   
         if (__predict_false((m->m_flags & M_LOOP) && !udp_do_loopback_cksum)) {          if (__predict_false((m->m_flags & M_LOOP) && !udp_do_loopback_cksum)) {
                 goto good;                  goto good;
         }          }
Line 449  udp6_input_checksum(struct mbuf *m, cons
Line 472  udp6_input_checksum(struct mbuf *m, cons
                 udp6stat.udp6s_nosum++;                  udp6stat.udp6s_nosum++;
                 goto bad;                  goto bad;
         }          }
         if (in6_cksum(m, IPPROTO_UDP, off, len) != 0) {  
           switch (m->m_pkthdr.csum_flags &
               ((m->m_pkthdr.rcvif->if_csum_flags_rx & M_CSUM_UDPv6) |
               M_CSUM_TCP_UDP_BAD | M_CSUM_DATA)) {
           case M_CSUM_UDPv6|M_CSUM_TCP_UDP_BAD:
                   UDP_CSUM_COUNTER_INCR(&udp6_hwcsum_bad);
                 udp6stat.udp6s_badsum++;                  udp6stat.udp6s_badsum++;
                 goto bad;                  goto bad;
   
   #if 0 /* notyet */
           case M_CSUM_UDPv6|M_CSUM_DATA:
   #endif
   
           case M_CSUM_UDPv6:
                   /* Checksum was okay. */
                   UDP_CSUM_COUNTER_INCR(&udp6_hwcsum_ok);
                   break;
   
           default:
                   /*
                    * Need to compute it ourselves.  Maybe skip checksum
                    * on loopback interfaces.
                    */
                   UDP_CSUM_COUNTER_INCR(&udp6_swcsum);
                   if (in6_cksum(m, IPPROTO_UDP, off, len) != 0) {
                           udp6stat.udp6s_badsum++;
                           goto bad;
                   }
         }          }
   
 good:  good:

Legend:
Removed from v.1.139  
changed lines
  Added in v.1.140

CVSweb <webmaster@jp.NetBSD.org>