NetBSD-Bugs archive

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

Re: kern/45352



The following reply was made to PR kern/45352; it has been noted by GNATS.

From: Darren Reed <darrenr%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/45352
Date: Fri, 23 Sep 2011 21:11:07 +0200

 So I added some instrumentation to ucom.c to measure what sort
 of USB "packets" where being generated...
 
 in ucom.c, I added this...:
 
 void ucom_count_bytes(u_int bytes, u_long cnarray[]) {
         int i;
         for(i = 0; bytes > 0 && i < 32; i++)
                 bytes >>= 1;
         cnarray[i]++;
 }
 
 with a call here:
 
 ucomstart(struct tty *tp)
 ...
         /* Grab the first contiguous region of buffer space. */
         data = tp->t_outq.c_cf;
         cnt = ndqb(&tp->t_outq, 0);
 
         if (cnt == 0)
                 goto out;
 ucom_count_bytes(cnt,ucom_cnt_outbytes);
 
 and another here:
 
 ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status)
 ...
         usbd_get_xfer_status(xfer, NULL, (void *)&cp, &cc, NULL);
 
         if (cc == 0) {
                 aprint_normal_dev(sc->sc_dev,
                     "ucomreadcb: zero length xfer!\n");
         }
 ucom_count_bytes(cc,ucom_cnt_inbytes);
 
 .... I don't know if the above is suffiicient...
 
 ... running on a live kernel:
 
 (gdb) x/13 &ucom_cnt_inbytes
 0xc0c16da0 <ucom_cnt_inbytes>:      0x00000000 (0)  0x0000000a (1)  
 0x00000000 (2)  0x0000002d
 0xc0c16db0 <ucom_cnt_inbytes+16>:   0x00000060 (4)  0x00000021 (8)  
 0x0001f49f (16) 0x0000ba53
 0xc0c16dc0 <ucom_cnt_inbytes+32>:   0x0001b5b2(128) 0x0000a975(256) 
 0x0001126b(512) 0x0014a877
 0xc0c16dd0 <ucom_cnt_inbytes+48>:   0x00000000 .... 0x00000000
 (gdb) x/13 &ucom_cnt_outbytes
 0xc0c16d20 <ucom_cnt_outbytes>:     0x00000000      0x00000068      
 0x00000000      0x00000000
 0xc0c16d30 <ucom_cnt_outbytes+16>:  0x00000001      0x00000006      
 0x000fd1f5      0x00028a01
 0xc0c16d40 <ucom_cnt_outbytes+32>:  0x0000143b      0x00005578      
 0x0000296f      0x00000cab
 0xc0c16d50 <ucom_cnt_outbytes+48>:  0x00000000 .... 0x00000000
 
 ... so it would seem that USB isn't generating USB packets greater than 
 1k...
 


Home | Main Index | Thread Index | Old Index