Re: usb: usbtmc: Proposal for new ioctl functions

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

 



On Wed, Apr 04, 2018 at 10:03:22PM +0000, Guido Kiener wrote:
> Greg,
> 
> Before sending patches we want to be sure doing  the right things. I'm not sure how we should deal with the sysfs parameters for USBTMC devices:
> See https://github.com/torvalds/linux/blob/master/Documentation/ABI/stable/sysfs-driver-usb-usbtmc
> There are some parameters defined for each device instance: TermChar, TermCharEnabled, and auto_abort.
> The new driver should include ioctl functions to change these parameters for each file handle and not for each device instance.

Why do you need this on a file-handle basis and not a device instance
basis?

> So we could reassign the device instance parameters (TermChar, TermCharEnabled) to be default values for each file handle.
> Furthermore the new driver will have more ioctl functions to change timeout and EOM flag,
> Here are my questions:
> 1. Are there any (test) scripts that are using the sysfs parameters TermChar, TermCharEnabled where we can check that the new driver is doing the same things?

I do not know, you all are the ones that use and have these devices, not
me :)

> 2. Shall we add new sysfs parameters for timeout and EOM flag? (ioctls are already added)

If you want to.

> 3. Is there any rule when to use upper/lower case or underscore for these parameters (e.g. Timeout, EOM or end_of_message)?

If a specification names something, then use that same name, otherwise
use Linux kernel naming schemes.

> Well, I'm quite happy with the performance of the new ioctl functions
> for generic read/write and I don't want to start a lengthy discussion
> here.
> However I need some expert knowledge and hints about the following questions:
> 1. We can detect short USB packages. A ZLP (Zero Length Package) can
> happen when the previous package has the maximum packet length.
> The driver could be simplified if it would be possible to detect ZLPs.

How can it be simplified?

> Is there any way (without changing the USB subsystem) to detect ZLPs? 

On an urb you send, just set URB_ZERO_PACKET, right?  What else do you
need?

> 2. For ultimate performance: Is there any trick where a usb_complete_t
> function or submitted urb can transfer (copy) received data directly
> to a userland buffer (e.g. scatter/gather streams) ?

Are you _sure_ your speed issue is with copying the data from the urb
into your userspace buffer?  Do you have benchmarks showing this?  I
think you will find that there are alot of other places you can do
things to improve speed before having to worry about this.

That being said, yes, you can use scatter/gather on urb buffers, look at
the storage driver for one example.  But first do a lot of benchmarking,
CPUs copy data really really fast, faster than switching contexts, so
it's almost always faster to copy data instead of messing with page
tables.  The break-even point is higher than you think...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux