Re: About XHCI_TD_PAGE_SIZE.

2014-12-22 Thread Ian Lepore
On Mon, 2014-12-22 at 10:48 +0100, Hans Petter Selasky wrote:
> On 12/22/14 10:31, Kohji Okuno wrote:
> > In an optimisation, we should reduce the number of LINK_TRB, too.
> > I heard  from a LSI engineer that,
> > Generally xhci controler has the cache of TRB array. But, LINK_TRB
> > may make the cache miss.
> 
> Hi,
> 
> One reason for the additional link TRB's is that I think there is 
> different behaviour among the XHCI implementations how and when they 
> generate a completion event. Any changes we make in that area needs to 
> be tested with different XHCI controllers.
> 
> Currently only the umass driver will use transfers greater than 64KBytes 
> in case of USB 3.0. Else the most common case is transfers below 
> 64KBytes, except for custom apps.
> 
> I have another idea pending, which is related to performance, but not 
> the XHCI. I was thinking that the FreeBSD libusb could be extended to 
> allocate a data buffer in the kernel which then gets mmapped to 
> userspace, to save copying/copyout of USB transfer data. The problem 
> about mmap() is that the buffers cannot be freed afterwards, and must 
> remain in the kernel.
> 
> What do you think?

So you're going to be doing DMA directly in and out of buffers mapped
into userspace?  I think that will fail on ARM and MIPS at least, and
maybe others (any platform that does cache maintenance based on virtual
addresses will be unable to do the maintenance reliably if the DMA
memory is mapped to multiple virtual addresses).  The solution for that
is bounce buffers, which just gets you right back into copying the data.

-- Ian


___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Disconnects every 15 seconds

2014-12-22 Thread Randall Fox
On Mon, Dec 22, 2014 at 1:52 AM, Hans Petter Selasky 
wrote:

> On 12/22/14 10:46, Randall Fox wrote:
>
>> On Mon, Dec 15, 2014 at 9:07 AM, Randall Fox 
>> wrote:
>>
>>  Here is the result, nothing but grep..
>>>
>>> $ ps auxw | grep ugen
>>> root   80705   0.0  0.0   16272   2080  0  S+9:04AM0:00.00
>>> grep ugen
>>>
>>> Looks like you have another message with a possible fix.. I will reply
>>> on that one..
>>>
>>> thnx
>>>
>>>
>>> On Mon, Dec 15, 2014 at 1:20 AM, Hans Petter Selasky 
>>> wrote:
>>>

 Hi,

 On 12/15/14 09:58, Randall Fox wrote:

  Dec 15 00:29:21 freenas kernel: uhub_read_port_status: port 2,
> wPortStatus=0x0101, wPortChange=0x0001, err=USB_ERR_NORMAL_COMPLETION
>
>
 This message means that the "UPS_C_CONNECT_STATUS" changed. My best
 guess
 is that the device had a problem and decided to restart. Maybe an
 unsupported command triggered it.

 Also, try to "ps auxw | grep ugen" to see if there are multiple drivers
 running on your device.

 --HPS


>>>  Result of ps auxw is above.   Any ideas on how to fix this?
>>
>>
> Hi,
>
> Can you get output from usbdump, as this attach/detach goes on.
>
> usbdump -i usbusX -f Y -s 65536 -vvv
>
> --HPS
>

I will send a txt file as attachment directly to you.. (This will save
people on the mailing list the large email message).
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: Disconnects every 15 seconds

2014-12-22 Thread Hans Petter Selasky

On 12/22/14 10:46, Randall Fox wrote:

On Mon, Dec 15, 2014 at 9:07 AM, Randall Fox  wrote:


Here is the result, nothing but grep..

$ ps auxw | grep ugen
root   80705   0.0  0.0   16272   2080  0  S+9:04AM0:00.00 grep ugen

Looks like you have another message with a possible fix.. I will reply on that 
one..

thnx


On Mon, Dec 15, 2014 at 1:20 AM, Hans Petter Selasky 
wrote:


Hi,

On 12/15/14 09:58, Randall Fox wrote:


Dec 15 00:29:21 freenas kernel: uhub_read_port_status: port 2,
wPortStatus=0x0101, wPortChange=0x0001, err=USB_ERR_NORMAL_COMPLETION



This message means that the "UPS_C_CONNECT_STATUS" changed. My best guess
is that the device had a problem and decided to restart. Maybe an
unsupported command triggered it.

Also, try to "ps auxw | grep ugen" to see if there are multiple drivers
running on your device.

--HPS




Result of ps auxw is above.   Any ideas on how to fix this?



Hi,

Can you get output from usbdump, as this attach/detach goes on.

usbdump -i usbusX -f Y -s 65536 -vvv

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: About XHCI_TD_PAGE_SIZE.

2014-12-22 Thread Hans Petter Selasky

On 12/22/14 10:31, Kohji Okuno wrote:

In an optimisation, we should reduce the number of LINK_TRB, too.
I heard  from a LSI engineer that,
Generally xhci controler has the cache of TRB array. But, LINK_TRB
may make the cache miss.


Hi,

One reason for the additional link TRB's is that I think there is 
different behaviour among the XHCI implementations how and when they 
generate a completion event. Any changes we make in that area needs to 
be tested with different XHCI controllers.


Currently only the umass driver will use transfers greater than 64KBytes 
in case of USB 3.0. Else the most common case is transfers below 
64KBytes, except for custom apps.


I have another idea pending, which is related to performance, but not 
the XHCI. I was thinking that the FreeBSD libusb could be extended to 
allocate a data buffer in the kernel which then gets mmapped to 
userspace, to save copying/copyout of USB transfer data. The problem 
about mmap() is that the buffers cannot be freed afterwards, and must 
remain in the kernel.


What do you think?

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: urndis and umodem device collision for ue device

2014-12-22 Thread Hans Petter Selasky

On 12/22/14 10:29, Randall Fox wrote:

On Mon, Dec 22, 2014 at 1:23 AM, Hans Petter Selasky 
wrote:


I am not familiar with RNDIS..



This thread is about umodem and urndis.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: About XHCI_TD_PAGE_SIZE.

2014-12-22 Thread Kohji Okuno
From: Hans Petter Selasky 
Subject: Re: About XHCI_TD_PAGE_SIZE.
Date: Mon, 22 Dec 2014 10:10:46 +0100
Message-ID: <5497e016.7020...@selasky.org>

> On 12/22/14 02:38, Kohji Okuno wrote:
>> From: Hans Petter Selasky 
>> Subject: Re: About XHCI_TD_PAGE_SIZE.
>> Date: Sat, 20 Dec 2014 10:30:36 +0100
>>
>>> On 12/17/14 05:42, Nidal Khalil wrote:
 I agree. Thanks

 Nidal
 On Dec 16, 2014 6:25 PM, "Kohji Okuno" 
 wrote:

> Hi Hans,
>
> If we use PAGE_SIZE as USB_PAGE_SIZE, we should use PAGE_SIZE as
> XHCI_TD_PAGE_SIZE, too. I think.
>
> As you know, one TRB can use 1~64kB for the transfer length.
>
>>>
>>> Hi,
>>>
>>> We currently only check if 4K pages are supported by the hardware. If you
>>> change the value of XHCI_TD_PAGE_SIZE, you will also need to change the
>>> checks
>>> other places. You know that PAGE_SIZE is not a constant?
>>>
>>> Do you have a complete patch?
>>>
>>> --HPS
>>>
>>
>> Hi,
>>
>> XHCI_TD_PAGE_SIZE is used at only 2-points.
>>
>> 1. use as XHCI_TD_PAYLOAD_MAX (XHCI_TD_PAGE_NBUF) in xhci.h
>> We sholud change as the following, I think.
>>
>> - #define XHCI_TD_PAGE_NBUF  17  /* units, room enough for 64Kbytes */
>> - #define XHCI_TD_PAGE_SIZE  4096/* bytes */
>> - #define XHCI_TD_PAYLOAD_MAX(XHCI_TD_PAGE_SIZE * (XHCI_TD_PAGE_NBUF 
>> - 1))
>> + #define XHCI_TD_PAYLOAD_MAX(64*1024)   /* bytes */ 
>> + #define XHCI_TD_PAGE_SIZE  PAGE_SIZE   /* bytes */
>> + /* units, room enough for 64Kbytes */
>> + #define XHCI_TD_PAGE_NBUF  (XHCI_TD_PAYLOAD_MAX/XHCI_TD_PAGE_SIZE + 1)
>>
>> 2. use as the maximum length of TRB.
>> If PAGE_SIZE is 8kB, buf_res.length may be 8kB.
>> But, we can set 1B~64kB for length of TRB. This is the spcification
>> of xHCI. So, we don't need change this point.
>>
>> xhci.c
>> 1807 /* check for maximum length */
>> 1808 if (buf_res.length > XHCI_TD_PAGE_SIZE)
>> 1809 buf_res.length = XHCI_TD_PAGE_SIZE;
>>
> 
> Hi Kohji,
> 
> I see your points. By doing this you save some memory in the descriptor layout
> for 8K page size - right?
> 
> BTW: Do you think the following check is OK, or should it be extended to check
> also for 8K?
> 
> if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) {
> device_printf(sc->sc_bus.parent, "Controller does "
> "not support 4K page size.\n");
> return (USB_ERR_IOERROR);
> }
> 
> I guess your patch is more in the direction of optimisation. Is it very
> urgent? Or is it fine if I handle it the beginning of January?
> 
> Thank you for your input and review!
> 
> --HPS
> 

Hi HPS,

> I see your points. By doing this you save some memory in the
> descriptor layout for 8K page size - right?

Yes. In addition, we may reduce the size of data which a xhci
controller fetches.


> I guess your patch is more in the direction of optimisation. Is it very
> urgent? Or is it fine if I handle it the beginning of January?

No, it isn't urgent. It's OK in the next month.

In an optimisation, we should reduce the number of LINK_TRB, too.
I heard  from a LSI engineer that,
Generally xhci controler has the cache of TRB array. But, LINK_TRB
may make the cache miss.

Unfortunately, I don't know about XHCI_PAGESIZE. If I can hear from a
LSI engineer, I will inform you.

Best regards,
 Kohji Okuno
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: urndis and umodem device collision for ue device

2014-12-22 Thread Randall Fox
On Mon, Dec 22, 2014 at 1:23 AM, Hans Petter Selasky 
wrote:

> On 12/22/14 10:14, Randall Fox wrote:
>
>> On Mon, Dec 22, 2014 at 12:42 AM, Hans Petter Selasky 
>> wrote:
>>
>>  On 12/21/14 22:28, Randall Fox wrote:
>>>
>>>  On Sun, Dec 21, 2014 at 1:02 PM, Hans Petter Selasky 
 wrote:

   On 12/21/14 21:40, Randall Fox wrote:

>
>   Did you update /etc/devd/usb.conf, install new kernel and reboot your
>
>>
>>
>>>   system?
>>>
>>
>> I actually had the FreeNAS team apply this fix to the nightly build
>> and
>> I
>> created a whole new install based on their Nightly Build.  The DEVs
>> put
>> the
>> fix in, and it must have been correct because it worked for someone
>> else.
>>
>> Here is the link to the ticket for this:
>> https://bugs.freenas.org/issues/7153
>> It appears they are familiar with you!
>>
>> I will try putting the usb.conf in the location you specify, to see if
>> that
>> works.  I would be surprised if the dev's missed this.
>>
>>
>>
>> On Sun, Dec 21, 2014 at 12:24 PM, Hans Petter Selasky <
>> h...@selasky.org>
>> wrote:
>>
>>On 12/21/14 21:21, Randall Fox wrote:
>>
>>
>>>Hi,
>>>
>>>

  The following patches should fix your problem:
>
> https://svnweb.freebsd.org/changeset/base/275790
> https://svnweb.freebsd.org/changeset/base/275791
>
> --HPS
>
>
>
>
   Can you get the dmesg when plugging your device?

>>>
> --HPS
>
>
>   uhid0:  1.10/2.0a,
>
 addr 3> on usbus1
 ugen1.3:  at usbus1 (disconnected)
 uhid0: at uhub3, port 1, addr 3 (disconnected)
 ugen1.3:  at usbus1
 uhid0: >>> addr 3> on usbus1
 ugen1.3:  at usbus1 (disconnected)
 uhid0: at uhub3, port 1, addr 3 (disconnected)

 I tried putting the usb.conf in /etc/devd and rebooting, but no change..


  Hi,
>>>
>>> This looks correct. Did you select the correct device profile?
>>>
>>> Also, did you set the correct USB configuration number?
>>>
>>> usbconfig -d X.Y dump_device_desc dump_curr_config_desc
>>> usbconfig -d X.Y set_config 1
>>>
>>> --HPS
>>>
>>>
>> I ran the set_config 1, but that didn't have any effect, nor did
>> set_config
>> 0.   the dump device & config is below.
>>
>> I did not select any profile, I just plug the unit in and I get the
>> disconnect messages.
>>
>> ugen1.3:  at usbus1, cfg=0
>> md=HOST spd=LOW (1.5Mbps) pwr=ON (0mA)
>>
>>bLength = 0x0012
>>bDescriptorType = 0x0001
>>bcdUSB = 0x0110
>>bDeviceClass = 0x
>>bDeviceSubClass = 0x
>>bDeviceProtocol = 0x
>>bMaxPacketSize0 = 0x0008
>>idVendor = 0x09ae
>>idProduct = 0x3015
>>bcdDevice = 0x020a
>>iManufacturer = 0x0002  
>>iProduct = 0x0003  
>>iSerialNumber = 0x0004  <2351BY0SM820600181>
>>bNumConfigurations = 0x0001
>>
>>
>>   Configuration index 0
>>
>>  bLength = 0x0009
>>  bDescriptorType = 0x0002
>>  wTotalLength = 0x0022
>>  bNumInterfaces = 0x0001
>>  bConfigurationValue = 0x0001
>>  iConfiguration = 0x  
>>  bmAttributes = 0x00e0
>>  bMaxPower = 0x
>>
>>  Interface 0
>>bLength = 0x0009
>>bDescriptorType = 0x0004
>>bInterfaceNumber = 0x
>>bAlternateSetting = 0x
>>bNumEndpoints = 0x0001
>>bInterfaceClass = 0x0003
>>bInterfaceSubClass = 0x
>>bInterfaceProtocol = 0x
>>iInterface = 0x  
>>
>>Additional Descriptor
>>
>>bLength = 0x09
>>bDescriptorType = 0x21
>>bDescriptorSubType = 0x10
>> RAW dump:
>> 0x00 | 0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0xe4,
>> 0x08 | 0x04
>>
>>Endpoint 0
>>
>>bLength = 0x0007
>>bDescriptorType = 0x0005
>>bEndpointAddress = 0x0081  
>>bmAttributes = 0x0003  
>>wMaxPacketSize = 0x0008
>>bInterval = 0x0028
>>bRefresh = 0x
>>bSynchAddress = 0x
>>
>>
> Hi,
>
> There is no RNDIS device here! There is only a UHID device.
>
> --HPS
>

I am not familiar with RNDIS..
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: urndis and umodem device collision for ue device

2014-12-22 Thread Hans Petter Selasky

On 12/22/14 10:14, Randall Fox wrote:

On Mon, Dec 22, 2014 at 12:42 AM, Hans Petter Selasky 
wrote:


On 12/21/14 22:28, Randall Fox wrote:


On Sun, Dec 21, 2014 at 1:02 PM, Hans Petter Selasky 
wrote:

  On 12/21/14 21:40, Randall Fox wrote:


  Did you update /etc/devd/usb.conf, install new kernel and reboot your




  system?


I actually had the FreeNAS team apply this fix to the nightly build and
I
created a whole new install based on their Nightly Build.  The DEVs put
the
fix in, and it must have been correct because it worked for someone
else.

Here is the link to the ticket for this:
https://bugs.freenas.org/issues/7153
It appears they are familiar with you!

I will try putting the usb.conf in the location you specify, to see if
that
works.  I would be surprised if the dev's missed this.



On Sun, Dec 21, 2014 at 12:24 PM, Hans Petter Selasky 
wrote:

   On 12/21/14 21:21, Randall Fox wrote:



   Hi,





The following patches should fix your problem:

https://svnweb.freebsd.org/changeset/base/275790
https://svnweb.freebsd.org/changeset/base/275791

--HPS





  Can you get the dmesg when plugging your device?


--HPS


  uhid0: 
addr 3> on usbus1
ugen1.3:  at usbus1 (disconnected)
uhid0: at uhub3, port 1, addr 3 (disconnected)
ugen1.3:  at usbus1
uhid0:  on usbus1
ugen1.3:  at usbus1 (disconnected)
uhid0: at uhub3, port 1, addr 3 (disconnected)

I tried putting the usb.conf in /etc/devd and rebooting, but no change..



Hi,

This looks correct. Did you select the correct device profile?

Also, did you set the correct USB configuration number?

usbconfig -d X.Y dump_device_desc dump_curr_config_desc
usbconfig -d X.Y set_config 1

--HPS



I ran the set_config 1, but that didn't have any effect, nor did set_config
0.   the dump device & config is below.

I did not select any profile, I just plug the unit in and I get the
disconnect messages.

ugen1.3:  at usbus1, cfg=0
md=HOST spd=LOW (1.5Mbps) pwr=ON (0mA)

   bLength = 0x0012
   bDescriptorType = 0x0001
   bcdUSB = 0x0110
   bDeviceClass = 0x
   bDeviceSubClass = 0x
   bDeviceProtocol = 0x
   bMaxPacketSize0 = 0x0008
   idVendor = 0x09ae
   idProduct = 0x3015
   bcdDevice = 0x020a
   iManufacturer = 0x0002  
   iProduct = 0x0003  
   iSerialNumber = 0x0004  <2351BY0SM820600181>
   bNumConfigurations = 0x0001


  Configuration index 0

 bLength = 0x0009
 bDescriptorType = 0x0002
 wTotalLength = 0x0022
 bNumInterfaces = 0x0001
 bConfigurationValue = 0x0001
 iConfiguration = 0x  
 bmAttributes = 0x00e0
 bMaxPower = 0x

 Interface 0
   bLength = 0x0009
   bDescriptorType = 0x0004
   bInterfaceNumber = 0x
   bAlternateSetting = 0x
   bNumEndpoints = 0x0001
   bInterfaceClass = 0x0003
   bInterfaceSubClass = 0x
   bInterfaceProtocol = 0x
   iInterface = 0x  

   Additional Descriptor

   bLength = 0x09
   bDescriptorType = 0x21
   bDescriptorSubType = 0x10
RAW dump:
0x00 | 0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0xe4,
0x08 | 0x04

   Endpoint 0

   bLength = 0x0007
   bDescriptorType = 0x0005
   bEndpointAddress = 0x0081  
   bmAttributes = 0x0003  
   wMaxPacketSize = 0x0008
   bInterval = 0x0028
   bRefresh = 0x
   bSynchAddress = 0x



Hi,

There is no RNDIS device here! There is only a UHID device.

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: urndis and umodem device collision for ue device

2014-12-22 Thread Randall Fox
On Mon, Dec 22, 2014 at 12:42 AM, Hans Petter Selasky 
wrote:

> On 12/21/14 22:28, Randall Fox wrote:
>
>> On Sun, Dec 21, 2014 at 1:02 PM, Hans Petter Selasky 
>> wrote:
>>
>>  On 12/21/14 21:40, Randall Fox wrote:
>>>
>>>  Did you update /etc/devd/usb.conf, install new kernel and reboot your

>
>  system?

 I actually had the FreeNAS team apply this fix to the nightly build and
 I
 created a whole new install based on their Nightly Build.  The DEVs put
 the
 fix in, and it must have been correct because it worked for someone
 else.

 Here is the link to the ticket for this:
 https://bugs.freenas.org/issues/7153
 It appears they are familiar with you!

 I will try putting the usb.conf in the location you specify, to see if
 that
 works.  I would be surprised if the dev's missed this.



 On Sun, Dec 21, 2014 at 12:24 PM, Hans Petter Selasky 
 wrote:

   On 12/21/14 21:21, Randall Fox wrote:

>
>   Hi,
>
>>
>>
>>> The following patches should fix your problem:
>>>
>>> https://svnweb.freebsd.org/changeset/base/275790
>>> https://svnweb.freebsd.org/changeset/base/275791
>>>
>>> --HPS
>>>
>>>
>>>
>>
>>  Can you get the dmesg when plugging your device?
>>>
>>> --HPS
>>>
>>>
>>>  uhid0: > addr 3> on usbus1
>> ugen1.3:  at usbus1 (disconnected)
>> uhid0: at uhub3, port 1, addr 3 (disconnected)
>> ugen1.3:  at usbus1
>> uhid0: > addr 3> on usbus1
>> ugen1.3:  at usbus1 (disconnected)
>> uhid0: at uhub3, port 1, addr 3 (disconnected)
>>
>> I tried putting the usb.conf in /etc/devd and rebooting, but no change..
>>
>>
> Hi,
>
> This looks correct. Did you select the correct device profile?
>
> Also, did you set the correct USB configuration number?
>
> usbconfig -d X.Y dump_device_desc dump_curr_config_desc
> usbconfig -d X.Y set_config 1
>
> --HPS
>

I ran the set_config 1, but that didn't have any effect, nor did set_config
0.   the dump device & config is below.

I did not select any profile, I just plug the unit in and I get the
disconnect messages.

ugen1.3:  at usbus1, cfg=0
md=HOST spd=LOW (1.5Mbps) pwr=ON (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x
  bDeviceSubClass = 0x
  bDeviceProtocol = 0x
  bMaxPacketSize0 = 0x0008
  idVendor = 0x09ae
  idProduct = 0x3015
  bcdDevice = 0x020a
  iManufacturer = 0x0002  
  iProduct = 0x0003  
  iSerialNumber = 0x0004  <2351BY0SM820600181>
  bNumConfigurations = 0x0001


 Configuration index 0

bLength = 0x0009
bDescriptorType = 0x0002
wTotalLength = 0x0022
bNumInterfaces = 0x0001
bConfigurationValue = 0x0001
iConfiguration = 0x  
bmAttributes = 0x00e0
bMaxPower = 0x

Interface 0
  bLength = 0x0009
  bDescriptorType = 0x0004
  bInterfaceNumber = 0x
  bAlternateSetting = 0x
  bNumEndpoints = 0x0001
  bInterfaceClass = 0x0003
  bInterfaceSubClass = 0x
  bInterfaceProtocol = 0x
  iInterface = 0x  

  Additional Descriptor

  bLength = 0x09
  bDescriptorType = 0x21
  bDescriptorSubType = 0x10
   RAW dump:
   0x00 | 0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0xe4,
   0x08 | 0x04

  Endpoint 0

  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0081  
  bmAttributes = 0x0003  
  wMaxPacketSize = 0x0008
  bInterval = 0x0028
  bRefresh = 0x
  bSynchAddress = 0x
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: About XHCI_TD_PAGE_SIZE.

2014-12-22 Thread Hans Petter Selasky

On 12/22/14 02:38, Kohji Okuno wrote:

From: Hans Petter Selasky 
Subject: Re: About XHCI_TD_PAGE_SIZE.
Date: Sat, 20 Dec 2014 10:30:36 +0100


On 12/17/14 05:42, Nidal Khalil wrote:

I agree. Thanks

Nidal
On Dec 16, 2014 6:25 PM, "Kohji Okuno"  wrote:


Hi Hans,

If we use PAGE_SIZE as USB_PAGE_SIZE, we should use PAGE_SIZE as
XHCI_TD_PAGE_SIZE, too. I think.

As you know, one TRB can use 1~64kB for the transfer length.



Hi,

We currently only check if 4K pages are supported by the hardware. If you
change the value of XHCI_TD_PAGE_SIZE, you will also need to change the checks
other places. You know that PAGE_SIZE is not a constant?

Do you have a complete patch?

--HPS



Hi,

XHCI_TD_PAGE_SIZE is used at only 2-points.

1. use as XHCI_TD_PAYLOAD_MAX (XHCI_TD_PAGE_NBUF) in xhci.h
We sholud change as the following, I think.

- #define XHCI_TD_PAGE_NBUF 17  /* units, room enough for 64Kbytes */
- #define XHCI_TD_PAGE_SIZE 4096/* bytes */
- #define XHCI_TD_PAYLOAD_MAX   (XHCI_TD_PAGE_SIZE * (XHCI_TD_PAGE_NBUF - 1))
+ #define XHCI_TD_PAYLOAD_MAX   (64*1024)   /* bytes */ 
+ #define XHCI_TD_PAGE_SIZE PAGE_SIZE   /* bytes */
+ /* units, room enough for 64Kbytes */
+ #define XHCI_TD_PAGE_NBUF (XHCI_TD_PAYLOAD_MAX/XHCI_TD_PAGE_SIZE + 1)

2. use as the maximum length of TRB.
If PAGE_SIZE is 8kB, buf_res.length may be 8kB.
But, we can set 1B~64kB for length of TRB. This is the spcification
of xHCI. So, we don't need change this point.

xhci.c
1807 /* check for maximum length */
1808 if (buf_res.length > XHCI_TD_PAGE_SIZE)
1809 buf_res.length = XHCI_TD_PAGE_SIZE;



Hi Kohji,

I see your points. By doing this you save some memory in the descriptor 
layout for 8K page size - right?


BTW: Do you think the following check is OK, or should it be extended to 
check also for 8K?


if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) {
device_printf(sc->sc_bus.parent, "Controller does "
"not support 4K page size.\n");
return (USB_ERR_IOERROR);
}

I guess your patch is more in the direction of optimisation. Is it very 
urgent? Or is it fine if I handle it the beginning of January?


Thank you for your input and review!

--HPS

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: urndis and umodem device collision for ue device

2014-12-22 Thread Hans Petter Selasky

On 12/21/14 22:28, Randall Fox wrote:

On Sun, Dec 21, 2014 at 1:02 PM, Hans Petter Selasky 
wrote:


On 12/21/14 21:40, Randall Fox wrote:


Did you update /etc/devd/usb.conf, install new kernel and reboot your



system?

I actually had the FreeNAS team apply this fix to the nightly build and I
created a whole new install based on their Nightly Build.  The DEVs put
the
fix in, and it must have been correct because it worked for someone else.

Here is the link to the ticket for this:
https://bugs.freenas.org/issues/7153
It appears they are familiar with you!

I will try putting the usb.conf in the location you specify, to see if
that
works.  I would be surprised if the dev's missed this.



On Sun, Dec 21, 2014 at 12:24 PM, Hans Petter Selasky 
wrote:

  On 12/21/14 21:21, Randall Fox wrote:


  Hi,




The following patches should fix your problem:

https://svnweb.freebsd.org/changeset/base/275790
https://svnweb.freebsd.org/changeset/base/275791

--HPS






Can you get the dmesg when plugging your device?

--HPS



uhid0:  on usbus1
ugen1.3:  at usbus1 (disconnected)
uhid0: at uhub3, port 1, addr 3 (disconnected)
ugen1.3:  at usbus1
uhid0:  on usbus1
ugen1.3:  at usbus1 (disconnected)
uhid0: at uhub3, port 1, addr 3 (disconnected)

I tried putting the usb.conf in /etc/devd and rebooting, but no change..



Hi,

This looks correct. Did you select the correct device profile?

Also, did you set the correct USB configuration number?

usbconfig -d X.Y dump_device_desc dump_curr_config_desc
usbconfig -d X.Y set_config 1

--HPS
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"