mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Ozan Çağlayan" <ozancag@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kernel driver vs libusb performance
Date: Fri, 11 Jan 2013 05:41:18 -0800	[thread overview]
Message-ID: <20130111134118.GB19224@kroah.com> (raw)
In-Reply-To: <CAFub=KQK9Qm1vDAetJc53O+mTZCgnaGDw9hYgeSZ76KCX_XSyQ@mail.gmail.com>

On Fri, Jan 11, 2013 at 11:53:36AM +0200, Ozan Çağlayan wrote:
> Hi,
> 
> I have a device which I'm currently accessing using libusb. It's
> basically a HID compliant USB device. It reports 32bytes of data with
> a time resolution of 128Hz, e.g. I have to read and store 32bytes each
> 1/128 second. One performance drawback is that those 32bytes chunks
> are encrypted with AES so once I receive them through the USB endpoint
> I first decrypt them.
> 
> So 128Hz is quite a low polling frequency and can be handled in a
> single-thread using a modern CPU, but I'm planning to run this loop on
> a Raspberry Pi or namely low-end, cheap embedded processors. I'm also
> using Python which is significantly slow on Raspberry Pi.

Ah, my sympathies, USB on a rpi is horrible, and you will have all sorts
of nasty issues, no matter how you end up doing this (in the kernel or
userspace).

> So I wonder whether writing a kernel driver which decrypts the packets
> using in-kernel crypto API and then exposing them through a character
> device node would bring a performance gain at all. At least on the
> userspace side I may get rid of all the bus searching, crypto key
> generation, fetching and decrypting boilerplate, am I in the wrong
> way?

Test it out and see.  I really don't think that user vs. kernel space is
going to be the issue here, I think you are going to see some very real
problems with the hardware itself in this area.

Best of luck,

greg k-h

  reply	other threads:[~2013-01-11 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  9:53 Ozan Çağlayan
2013-01-11 13:41 ` Greg KH [this message]
2013-01-11 14:10   ` Ozan Çağlayan
2013-01-11 14:23     ` Greg KH
2013-01-11 14:40       ` Ozan Çağlayan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130111134118.GB19224@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ozancag@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®