diff mbox

[2/3] IB/uverbs: Add support for checksum capability reporting in user verbs

Message ID ac71c808fb494bb57043ccf94a6c736d2ed87899.1442413048.git.bodong@mellanox.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Bodong Wang Sept. 16, 2015, 3:56 p.m. UTC
New field csum_cap is added to respective uverbs counterpart according
to ib_verbs.

Signed-off-by: Bodong Wang <bodong@mellanox.com>
---
 drivers/infiniband/core/uverbs_cmd.c | 7 +++++++
 include/uapi/rdma/ib_user_verbs.h    | 6 ++++++
 2 files changed, 13 insertions(+)
diff mbox

Patch

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index bbb02ff..9d5deec 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3464,6 +3464,13 @@  int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	resp.hca_core_clock = attr.hca_core_clock;
 	resp.response_length += sizeof(resp.hca_core_clock);
 
+	if (ucore->outlen < resp.response_length + sizeof(resp.csum_cap))
+		goto end;
+
+	resp.csum_cap.eth_csum_cap = attr.csum_cap.eth_csum_cap;
+	resp.csum_cap.ib_csum_cap = attr.csum_cap.ib_csum_cap;
+	resp.response_length += sizeof(resp.csum_cap);
+
 end:
 	err = ib_copy_to_udata(ucore, &resp, resp.response_length);
 	if (err)
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 978841e..9d69546 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -218,6 +218,11 @@  struct ib_uverbs_odp_caps {
 	__u32 reserved;
 };
 
+struct ib_uverbs_csum_cap_per_link {
+	__u32 eth_csum_cap;
+	__u32 ib_csum_cap;
+};
+
 struct ib_uverbs_ex_query_device_resp {
 	struct ib_uverbs_query_device_resp base;
 	__u32 comp_mask;
@@ -225,6 +230,7 @@  struct ib_uverbs_ex_query_device_resp {
 	struct ib_uverbs_odp_caps odp_caps;
 	__u64 timestamp_mask;
 	__u64 hca_core_clock; /* in KHZ */
+	struct ib_uverbs_csum_cap_per_link csum_cap;
 };
 
 struct ib_uverbs_query_port {