Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp507630ybc; Sat, 16 Nov 2019 03:38:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxAgSonTojk2hRRSKcys8BHuJQXAOZ981CIS+6THqzxV5u1940Wlh0zt2Cz/08Slat7rokh X-Received: by 2002:a17:906:52c4:: with SMTP id w4mr8634285ejn.99.1573904283795; Sat, 16 Nov 2019 03:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573904283; cv=none; d=google.com; s=arc-20160816; b=LoCNW+vytxNV0A+x1hjD1GBNmkFkVbI31R55kAWMW0rxCo2WHGwnp6zmaZos0ulQul 4/0ziamc4o+npd3asuF4dLuZkRpII5HUkovKkbdBdS4l5PL/M2zU1wQzM+uRnTjnqOjE Whmzcy+PXDJh59ObIlcbOwyM2JtHZpk83wsPZwK9I6P2W6vfr66oSxZdcRjGkeAxSku1 9IRAgstm0mwSm0QNAv3Fu8rNQZCcXkiSvN4RmbTszqGPG77MWLta8wUA8EwIb4fVVPEO EHckR6MERztD+GbOHP6xt9H45aq7V4CSJJhnFgg35bTMJU4ddW6JBN35l8eL6q3D7xsm fdSg== 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 :message-id:date:subject:cc:to:from; bh=vzh5uCLAaua0ghXeyKrggZT65lqyx1644B1AOx4mPx8=; b=qtgLnacLLhrF6Wmc3fmN0uk/8UP5Lxm345W5NYHYSX5/bO3AkP1vOe3sJ4OWHyJJgO OC8wUzalN7sDpXExSg/k4wz+dsx8I72/s1/KI+nuWyl/RLePiNVcmb4++BRqdi08kdsW 6MvQ8DkH7uFZI63NXz745/iqNRpce/wdfLmvZ1gKEvwNvvReZTRTWhdjN7cFQqRhUf/a Y7w9BbEYpO783pPFX6DGKinYvwsEkl3zyqRRvQxJAu0VyNl44hgRCAZK74AiVzW+ZveU 5JOnqTlSUhltW5bsODkTNAj/au4v66T6Or6nsGM8uRowNLiVvt20BFAoOvRWkjCsD5dk ootw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dd5si7723175ejb.179.2019.11.16.03.37.37; Sat, 16 Nov 2019 03:38:03 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbfKPLga (ORCPT + 99 others); Sat, 16 Nov 2019 06:36:30 -0500 Received: from mga17.intel.com ([192.55.52.151]:37564 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbfKPLga (ORCPT ); Sat, 16 Nov 2019 06:36:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2019 03:36:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,312,1569308400"; d="scan'208";a="236375360" Received: from twinkler-lnx.jer.intel.com ([10.12.91.155]) by fmsmga002.fm.intel.com with ESMTP; 16 Nov 2019 03:36:27 -0800 From: Tomas Winkler To: Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, Tomas Winkler Subject: [char-misc-next] mei: bus: add more client attributes to sysfs Date: Sat, 16 Nov 2019 16:21:36 +0200 Message-Id: <20191116142136.17535-1-tomas.winkler@intel.com> X-Mailer: git-send-email 2.21.0 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 From: Alexander Usyskin Export more client attributes via sysfs that are usually obtained upon connection. In some cases, for example a monitoring application may wish to know the attributes without actually performing the connection. Added attributes: max number of connections, fixed address, max message length. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler --- Documentation/ABI/testing/sysfs-bus-mei | 21 +++++++++++++++ drivers/misc/mei/bus.c | 33 +++++++++++++++++++++++ drivers/misc/mei/client.h | 36 +++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei index 3f8701e8fa24..3d37e2796d5a 100644 --- a/Documentation/ABI/testing/sysfs-bus-mei +++ b/Documentation/ABI/testing/sysfs-bus-mei @@ -26,3 +26,24 @@ KernelVersion: 4.3 Contact: Tomas Winkler Description: Stores mei client protocol version Format: %d + +What: /sys/bus/mei/devices/.../max_conn +Date: Nov 2019 +KernelVersion: 5.5 +Contact: Tomas Winkler +Description: Stores mei client maximum number of connections + Format: %d + +What: /sys/bus/mei/devices/.../fixed +Date: Nov 2019 +KernelVersion: 5.5 +Contact: Tomas Winkler +Description: Stores mei client fixed address, if any + Format: %d + +What: /sys/bus/mei/devices/.../max_len +Date: Nov 2019 +KernelVersion: 5.5 +Contact: Tomas Winkler +Description: Stores mei client maximum message length + Format: %d diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 53bb394ccba6..a0a495c95e3c 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -791,11 +791,44 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, } static DEVICE_ATTR_RO(modalias); +static ssize_t max_conn_show(struct device *dev, struct device_attribute *a, + char *buf) +{ + struct mei_cl_device *cldev = to_mei_cl_device(dev); + u8 maxconn = mei_me_cl_max_conn(cldev->me_cl); + + return scnprintf(buf, PAGE_SIZE, "%d", maxconn); +} +static DEVICE_ATTR_RO(max_conn); + +static ssize_t fixed_show(struct device *dev, struct device_attribute *a, + char *buf) +{ + struct mei_cl_device *cldev = to_mei_cl_device(dev); + u8 fixed = mei_me_cl_fixed(cldev->me_cl); + + return scnprintf(buf, PAGE_SIZE, "%d", fixed); +} +static DEVICE_ATTR_RO(fixed); + +static ssize_t max_len_show(struct device *dev, struct device_attribute *a, + char *buf) +{ + struct mei_cl_device *cldev = to_mei_cl_device(dev); + u32 maxlen = mei_me_cl_max_len(cldev->me_cl); + + return scnprintf(buf, PAGE_SIZE, "%u", maxlen); +} +static DEVICE_ATTR_RO(max_len); + static struct attribute *mei_cldev_attrs[] = { &dev_attr_name.attr, &dev_attr_uuid.attr, &dev_attr_version.attr, &dev_attr_modalias.attr, + &dev_attr_max_conn.attr, + &dev_attr_fixed.attr, + &dev_attr_max_len.attr, NULL, }; ATTRIBUTE_GROUPS(mei_cldev); diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h index c1f9e810cf81..2f8954def591 100644 --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h @@ -69,6 +69,42 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) return me_cl->props.protocol_version; } +/** + * mei_me_cl_max_conn - return me client max number of connections + * + * @me_cl: me client + * + * Return: me client max number of connections + */ +static inline u8 mei_me_cl_max_conn(const struct mei_me_client *me_cl) +{ + return me_cl->props.max_number_of_connections; +} + +/** + * mei_me_cl_fixed - return me client fixed address, if any + * + * @me_cl: me client + * + * Return: me client fixed address + */ +static inline u8 mei_me_cl_fixed(const struct mei_me_client *me_cl) +{ + return me_cl->props.fixed_address; +} + +/** + * mei_me_cl_max_len - return me client max msg length + * + * @me_cl: me client + * + * Return: me client max msg length + */ +static inline u32 mei_me_cl_max_len(const struct mei_me_client *me_cl) +{ + return me_cl->props.max_msg_length; +} + /* * MEI IO Functions */ -- 2.21.0