From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 251638D8A for ; Thu, 1 Oct 2015 00:28:52 +0200 (CEST) Received: by pacfv12 with SMTP id fv12so53962680pac.2 for ; Wed, 30 Sep 2015 15:28:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lyuhMHZGtnqW5d0x4cQhF02RPCQAbRGbUvhWnI2571Q=; b=cxONMsNZey+PdMkCrXKx/jKD5GBYzqD5taA8MOmCI3eTAZEJ+prhR2phM5DpHrv2Ng De5VbV0sRrZP+2e13tPYUxS04cB9vomQS45tN93P9LDue3fYGJVjWvBzCsBKKZpfDBc8 pfJdRhcZWj/mZ63IhA2DROtIKbHXwnZlaBIshp61ut6oJq9m5NISqWMiD1ahVc4+PgNG 3Lcf/0vd9vbwAszbhnl1EYpYXjOGicE6RylhMld1Z2N8TUDzjDknF894A9+AfadxhRzg 6ebMiTDTiic4qzd0tIokSE8BRIUYwRRS244a1Eg/IQfUGRDoh5j9j75s0a/2/yAYSEqw 1JrQ== X-Gm-Message-State: ALoCoQnLExiwHR7eOfxfOZ5+GYaLaH2JzG+qHgfjMWMKRF770+TrbcwloH/+zAni75RfdN/txdPe X-Received: by 10.69.16.166 with SMTP id fx6mr7747747pbd.18.1443652131573; Wed, 30 Sep 2015 15:28:51 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id gw3sm2603289pbc.46.2015.09.30.15.28.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 15:28:50 -0700 (PDT) From: Stephen Hemminger To: hjk@hansjkoch.de, gregkh@linux-foundation.org Date: Wed, 30 Sep 2015 15:28:57 -0700 Message-Id: <1443652138-31782-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443652138-31782-1-git-send-email-stephen@networkplumber.org> References: <1443652138-31782-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, linux-kernel@vger.kernel.org Subject: [dpdk-dev] [PATCH 1/2] uio: add support for ioctls X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 22:28:52 -0000 Allow UIO device driver to provide ioctl interface. This allow additional API's for UIO. Signed-off-by: Stephen Hemminger --- drivers/uio/uio.c | 15 +++++++++++++++ include/linux/uio_driver.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 8196581..5ab32ab 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -576,6 +576,20 @@ static ssize_t uio_write(struct file *filep, const char __user *buf, return retval ? retval : sizeof(s32); } +static long uio_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) +{ + struct uio_listener *listener = filep->private_data; + struct uio_device *idev = listener->dev; + + if (!idev->info) + return -EIO; + + if (!idev->info->ioctl) + return -ENOTTY; + + return idev->info->ioctl(idev->info, cmd, arg); +} + static int uio_find_mem_index(struct vm_area_struct *vma) { struct uio_device *idev = vma->vm_private_data; @@ -712,6 +726,7 @@ static const struct file_operations uio_fops = { .write = uio_write, .mmap = uio_mmap, .poll = uio_poll, + .unlocked_ioctl = uio_ioctl, .fasync = uio_fasync, .llseek = noop_llseek, }; diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 32c0e83..10d7833 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -89,6 +89,7 @@ struct uio_device { * @mmap: mmap operation for this uio device * @open: open operation for this uio device * @release: release operation for this uio device + * @ioctl: ioctl handler * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX */ struct uio_info { @@ -105,6 +106,8 @@ struct uio_info { int (*open)(struct uio_info *info, struct inode *inode); int (*release)(struct uio_info *info, struct inode *inode); int (*irqcontrol)(struct uio_info *info, s32 irq_on); + int (*ioctl)(struct uio_info *info, unsigned int cmd, + unsigned long arg); }; extern int __must_check -- 2.1.4