lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <479ef16f-1711-4b16-8cad-c06fc5b42da0@quicinc.com>
Date: Tue, 22 Oct 2024 17:25:44 -0700
From: Chris Lew <quic_clew@...cinc.com>
To: Denis Kenzior <denkenz@...il.com>, <netdev@...r.kernel.org>
CC: Marcel Holtmann <marcel@...tmann.org>, Andy Gross <agross@...nel.org>,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        "David S. Miller"
	<davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, <linux-arm-msm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1 10/10] net: qrtr: mhi: Report endpoint id in sysfs



On 10/18/2024 11:18 AM, Denis Kenzior wrote:
> Add a read-only 'endpoint' sysfs entry that contains the qrtr endpoint
> identifier assigned to this mhi device.  Can be used to direct / receive
> qrtr traffic only from a particular MHI device.
> 
> Signed-off-by: Denis Kenzior <denkenz@...il.com>
> Reviewed-by: Marcel Holtmann <marcel@...tmann.org>
> Reviewed-by: Andy Gross <agross@...nel.org>
> ---
>   net/qrtr/mhi.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c
> index 69f53625a049..a4696ed31fb1 100644
> --- a/net/qrtr/mhi.c
> +++ b/net/qrtr/mhi.c
> @@ -72,6 +72,16 @@ static int qcom_mhi_qrtr_send(struct qrtr_endpoint *ep, struct sk_buff *skb)
>   	return rc;
>   }
>   
> +static ssize_t endpoint_show(struct device *dev,
> +			     struct device_attribute *attr, char *buf)
> +{
> +	struct qrtr_mhi_dev *qdev = dev_get_drvdata(dev);
> +
> +	return sprintf(buf, "%d\n", qdev->ep.id);

%u might be more appropriate because the endpoint id is stored as a u32

> +}
> +
> +static DEVICE_ATTR_RO(endpoint);
> +
>   static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
>   			       const struct mhi_device_id *id)
>   {
> @@ -91,6 +101,9 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
>   	if (rc)
>   		return rc;
>   
> +	if (device_create_file(&mhi_dev->dev, &dev_attr_endpoint) < 0)
> +		dev_err(qdev->dev, "Failed to create endpoint attribute\n");
> +
>   	/* start channels */
>   	rc = mhi_prepare_for_transfer_autoqueue(mhi_dev);
>   	if (rc) {
> @@ -107,6 +120,7 @@ static void qcom_mhi_qrtr_remove(struct mhi_device *mhi_dev)
>   {
>   	struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev);
>   
> +	device_remove_file(&mhi_dev->dev, &dev_attr_endpoint);
>   	qrtr_endpoint_unregister(&qdev->ep);
>   	mhi_unprepare_from_transfer(mhi_dev);
>   	dev_set_drvdata(&mhi_dev->dev, NULL);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ