From: oulijun <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH rdma-core 1/7] libhns: Add initial main frame
Date: Thu, 27 Oct 2016 11:41:35 +0800 [thread overview]
Message-ID: <5811776F.20908@huawei.com> (raw)
In-Reply-To: <20161026162053.GE24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
在 2016/10/27 0:20, Jason Gunthorpe 写道:
> On Wed, Oct 26, 2016 at 09:04:02PM +0800, Lijun Ou wrote:
>> +static struct ibv_device *hns_roce_driver_init(const char *uverbs_sys_path,
>> + int abi_version)
>> +{
>> + struct hns_roce_device *dev;
>> + char value[128];
>> + int i;
>> +
>> + if (ibv_read_sysfs_file(uverbs_sys_path, "device/modalias",
>> + value, sizeof(value)) > 0)
>> + for (i = 0; i < sizeof(acpi_table) / sizeof(acpi_table[0]); ++i)
>> + if (!strcmp(value, acpi_table[i].hid))
>> + goto found;
>
> You shouldn't need to do both modalias and compatible, there should be
> an acceptable modalias for the DT version too.
>
when startup by DT, the content of device/modalias is of:NinfinibandT<NULL>Chisilicon,hns-roce-v1.
it is long and complex. the content of device/of_node/compatible is hisilicon,hns-roce-v1
when startup by APCI, the content of device/modalias is acpi:HISI00D1:
Hence, we decide to adopt the above approach to distinguish the device. when adding a device of pcie
in v2, we will add a condition branch to distinguish it, as follows:
if (ibv_read_sysfs_file(uverbs_sys_path, "device/modalias",
value, sizeof(value)) > 0)
for (i = 0; i < sizeof(acpi_table) / sizeof(acpi_table[0]); ++i)
if (!strcmp(value, acpi_table[i].hid))
goto found;
....
if (ibv_read_sysfs-file(uverbs_sys_path, "device/vendor", value, sizeof(value)) > 0)
...
if (ibv_read_sysfs-file(uverbs_sys_path, "device/vendor", value, sizeof(value)) > 0)
...
> But I wonder if this isn't generically better to be
>
> last_dir(readlink("device/driver")) == "hns"
>
> instead?
> Jason
>
I think it is not insteaded. because it will be find the hns in the path(device/driver)
As follows:
when startup by DT, the content of device/driver is:
root@(none)$ cat /sys/class/infiniband/hns_0/device/driver/
bind module/ unbind
c4000000.infiniband/ uevent
root@(none)$ cat /sys/class/infiniband/hns_0/device/driver/
>
when startup by ACPI, the content of device/driver is:
root@(none)$ cat /sys/class/infiniband/hns_0/device/driver/
HISI00D1:00/ bind module/ uevent unbind
root@(none)$ cat /sys/class/infiniband/hns_0/device/driver/
cat: read error: Is a directory
thanks
Lijun Ou
> .
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-10-27 3:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 13:04 [PATCH rdma-core 0/7] libhns: userspace library for hns Lijun Ou
[not found] ` <1477487048-62256-1-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-26 13:04 ` [PATCH rdma-core 1/7] libhns: Add initial main frame Lijun Ou
[not found] ` <1477487048-62256-2-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-26 16:20 ` Jason Gunthorpe
[not found] ` <20161026162053.GE24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-27 3:41 ` oulijun [this message]
[not found] ` <5811776F.20908-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-27 14:51 ` Jason Gunthorpe
[not found] ` <20161027145139.GD6818-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-28 7:28 ` oulijun
2016-10-28 7:59 ` oulijun
[not found] ` <58130573.4010902-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-28 16:40 ` Jason Gunthorpe
[not found] ` <20161028164030.GA17289-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-29 1:16 ` oulijun
[not found] ` <5813F869.7010606-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-11-07 23:15 ` Jason Gunthorpe
[not found] ` <20161107231532.GB7002-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-08 12:54 ` Leon Romanovsky
[not found] ` <20161108125441.GB27883-2ukJVAZIZ/Y@public.gmane.org>
2016-11-09 13:10 ` oulijun
[not found] ` <58232047.4060709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-11-10 17:30 ` Jason Gunthorpe
2016-10-26 13:04 ` [PATCH rdma-core 2/7] libhns: Add verbs of querying device and querying port Lijun Ou
2016-10-26 13:04 ` [PATCH rdma-core 3/7] libhns: Add verbs of pd and mr support Lijun Ou
2016-10-26 13:04 ` [PATCH rdma-core 4/7] libhns: Add verbs of cq support Lijun Ou
2016-10-26 13:04 ` [PATCH rdma-core 5/7] libhns: Add verbs of qp support Lijun Ou
[not found] ` <1477487048-62256-6-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-26 16:23 ` Jason Gunthorpe
[not found] ` <20161026162321.GF24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-27 2:25 ` oulijun
2016-10-26 13:04 ` [PATCH rdma-core 6/7] libhns: Add verbs of post_send and post_recv support Lijun Ou
2016-10-26 13:04 ` [PATCH rdma-core 7/7] libhns: Add consolidated repo for userspace library of hns Lijun Ou
[not found] ` <1477487048-62256-8-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-26 16:33 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5811776F.20908@huawei.com \
--to=oulijun-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.