IB/core: Add timestamp_mask and hca_core_clock to query_device
authorMatan Barak <matanb@mellanox.com>
Thu, 11 Jun 2015 13:35:24 +0000 (16:35 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 12 Jun 2015 18:49:10 +0000 (14:49 -0400)
In order to expose timestamp we need to expose two new attributes in
query_device to be used for CQ completion time-stamping:

timestamp_mask - how many bits are valid in the timestamp, where timestamp
values could be 64bits the most.

hca_core_clock - timestamp is given in HW cycles, the frequency in KHZ units
of the HCA, necessary in order to convert cycles to seconds.

This is added both to ib_query_device and its respective uverbs counterpart.

Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/device.c
drivers/infiniband/core/uverbs_cmd.c
include/rdma/ib_verbs.h
include/uapi/rdma/ib_user_verbs.h

index 8d07c12ab7187615574385d7b84f8ee2aa7fa1eb..568cb41be904e88bb74efd6b70a3798e9a1e9f66 100644 (file)
@@ -539,6 +539,8 @@ EXPORT_SYMBOL(ib_dispatch_event);
 int ib_query_device(struct ib_device *device,
                    struct ib_device_attr *device_attr)
 {
+       memset(device_attr, 0, sizeof(*device_attr));
+
        return device->query_device(device, device_attr);
 }
 EXPORT_SYMBOL(ib_query_device);
index 51311b1c0b000d73adfaddd1facfbd7240df79e1..11ee298bb26b00540df1a1c1d0ed772ca04299c3 100644 (file)
@@ -3426,6 +3426,8 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
        if (ucore->outlen < resp.response_length)
                return -ENOSPC;
 
+       memset(&attr, 0, sizeof(attr));
+
        err = device->query_device(device, &attr);
        if (err)
                return err;
@@ -3450,6 +3452,18 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 #endif
        resp.response_length += sizeof(resp.odp_caps);
 
+       if (ucore->outlen < resp.response_length + sizeof(resp.timestamp_mask))
+               goto end;
+
+       resp.timestamp_mask = attr.timestamp_mask;
+       resp.response_length += sizeof(resp.timestamp_mask);
+
+       if (ucore->outlen < resp.response_length + sizeof(resp.hca_core_clock))
+               goto end;
+
+       resp.hca_core_clock = attr.hca_core_clock;
+       resp.response_length += sizeof(resp.hca_core_clock);
+
 end:
        err = ib_copy_to_udata(ucore, &resp, resp.response_length);
        if (err)
index 2b4bf0632c64418ed0ffea60421241d52f1c7b73..c0929245ddeedda3b395baa42420a1c6a524bce4 100644 (file)
@@ -227,6 +227,8 @@ struct ib_device_attr {
        int                     sig_prot_cap;
        int                     sig_guard_cap;
        struct ib_odp_caps      odp_caps;
+       uint64_t                timestamp_mask;
+       uint64_t                hca_core_clock; /* in KHZ */
 };
 
 enum ib_mtu {
index 19f0256e511e012ff6a70a03334be27f350c2245..978841eeaff10e1cffc5d1c6e37fbe175c3db197 100644 (file)
@@ -223,6 +223,8 @@ struct ib_uverbs_ex_query_device_resp {
        __u32 comp_mask;
        __u32 response_length;
        struct ib_uverbs_odp_caps odp_caps;
+       __u64 timestamp_mask;
+       __u64 hca_core_clock; /* in KHZ */
 };
 
 struct ib_uverbs_query_port {
This page took 0.030493 seconds and 5 git commands to generate.