Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp104911ybe; Sun, 1 Sep 2019 21:28:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc7siGBW+LR/tPQk3MTQCYnKC6dc5tkIGys/zwlB+WQYm78+P6C67joz8IsCKWrY69dOQV X-Received: by 2002:a63:5754:: with SMTP id h20mr22809726pgm.195.1567398485606; Sun, 01 Sep 2019 21:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567398485; cv=none; d=google.com; s=arc-20160816; b=yHHYH6aMvaFnIooI41PNe+A17cQdkjRcjBgsQ054Jj0XAuj76erQ/gyfOKp8L5iGK3 JHpDLEpUOknfeaRrZW3Z9KfPfwUG/51zpbz9/TsysPXP5ro1VIJlaR+0tChlS1mjB6mp yHWfoc/LiRjWn9wB0SR6KQmmCjo1cfTgpYBgoUybf1fLaPE27JNH8oYulfVxyx8S7H8A 7gu6aXYWbmjSJGT5Eqj1IPK1EtXEie1P1f9G5bE2SjukjBWttDcdniFXF5IBQP6qQ7lW fxr/4SONRV6K/OcErnR7DZi23D1mQLxS7v/xtTOVn9YsygHIoiCpiFPveSzYmY3DDNxU wFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pwRFOeh4cOPcUYmjiGBfrTnQh0W+gxB4XCbsBCEIq0E=; b=KOEEbNfDPczGGVcUmb93B5C5cT5JOj2Dyid8eJsN2MMJO8zi7hfEUOEptL0mI0GRcE uFSCHANpbIoecmkAnJ1et+jVBMARpkg6hFMz3xoScK/a8XeajAGDtc0575MAePcsQ7rZ TaR4+kXtUDuFrsSWYLkJoeQQ/e3oOMyYA530Ha4s2aFeoBzkKWocTOOuxu+OFYgdzNkj f56DpzACzozlfIV5E3wWY5Nb7cUQiuBkh8ZPliiiEdHomhhDnNci/jCsNNArkXaIAlas fnqvuUupN9mIPEtctow2oqoSyD1czBcQz+YvKSnCAH9ffglQ3muIicpZzA2w1lY8SgwC GTEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 78si10471375pga.419.2019.09.01.21.27.50; Sun, 01 Sep 2019 21:28:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729575AbfIBEZJ (ORCPT + 99 others); Mon, 2 Sep 2019 00:25:09 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:35702 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729566AbfIBEY4 (ORCPT ); Mon, 2 Sep 2019 00:24:56 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from parav@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Sep 2019 07:24:53 +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 x824OeRP001225; Mon, 2 Sep 2019 07:24:51 +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 v3 5/5] mtty: Optionally support mtty alias Date: Sun, 1 Sep 2019 23:24:36 -0500 Message-Id: <20190902042436.23294-6-parav@mellanox.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190902042436.23294-1-parav@mellanox.com> References: <20190826204119.54386-1-parav@mellanox.com> <20190902042436.23294-1-parav@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Make use of mtty_alias() API when alias_length module parameter is set. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Added mdev_alias() usage sample --- samples/vfio-mdev/mtty.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index 92e770a06ea2..075d65440bc0 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c @@ -150,6 +150,10 @@ static const struct file_operations vd_fops = { .owner = THIS_MODULE, }; +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"); + /* function prototypes */ static int mtty_trigger_interrupt(const guid_t *uuid); @@ -770,6 +774,9 @@ static int mtty_create(struct kobject *kobj, struct mdev_device *mdev) list_add(&mdev_state->next, &mdev_devices_list); mutex_unlock(&mdev_list_lock); + if (mtty_alias_length) + dev_dbg(mdev_dev(mdev), "alias is %s\n", mdev_alias(mdev)); + return 0; } @@ -1410,6 +1417,11 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; +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 +1434,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) -- 2.19.2