From patchwork Tue Aug 27 19:16:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parav Pandit X-Patchwork-Id: 11117393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C80414E5 for ; Tue, 27 Aug 2019 19:17:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 595C72189D for ; Tue, 27 Aug 2019 19:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731116AbfH0TRO (ORCPT ); Tue, 27 Aug 2019 15:17:14 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:38910 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731082AbfH0TRN (ORCPT ); Tue, 27 Aug 2019 15:17:13 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from parav@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Aug 2019 22:17:09 +0300 Received: from sw-mtx-036.mtx.labs.mlnx (sw-mtx-036.mtx.labs.mlnx [10.12.150.149]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x7RJGuGv026842; Tue, 27 Aug 2019 22:17:08 +0300 From: Parav Pandit To: alex.williamson@redhat.com, jiri@mellanox.com, kwankhede@nvidia.com, cohuck@redhat.com, davem@davemloft.net Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Parav Pandit Subject: [PATCH v1 5/5] mtty: Optionally support mtty alias Date: Tue, 27 Aug 2019 14:16:54 -0500 Message-Id: <20190827191654.41161-6-parav@mellanox.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190827191654.41161-1-parav@mellanox.com> References: <20190826204119.54386-1-parav@mellanox.com> <20190827191654.41161-1-parav@mellanox.com> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Provide a module parameter to set alias length to optionally generate mdev alias. Example to request mdev alias. $ modprobe mtty alias_length=12 Signed-off-by: Parav Pandit --- samples/vfio-mdev/mtty.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index 92e770a06ea2..92208245b057 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c @@ -1410,6 +1410,15 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; +static unsigned int mtty_alias_length; +module_param_named(alias_length, mtty_alias_length, uint, 0444); +MODULE_PARM_DESC(alias_length, "mdev alias length; default=0"); + +static unsigned int mtty_get_alias_length(void) +{ + return mtty_alias_length; +} + static const struct mdev_parent_ops mdev_fops = { .owner = THIS_MODULE, .dev_attr_groups = mtty_dev_groups, @@ -1422,6 +1431,7 @@ static const struct mdev_parent_ops mdev_fops = { .read = mtty_read, .write = mtty_write, .ioctl = mtty_ioctl, + .get_alias_length = mtty_get_alias_length }; static void mtty_device_release(struct device *dev)