[openib-general] [RFC] IB_AT_MOST

Michael S. Tsirkin mst at mellanox.co.il
Fri Dec 16 05:57:40 PST 2005


Hi!
I recently noted that some middleware seems to use the "as much as possible"
approach, for example, using maximum possible value for max_rd_atomic or
other fields, in create/modify qp.

An obvious thing could be to perform query_device and use max. values from there.
However, it turns out that hardware max supported values might not be
easy to express in terms of a single constant.
Consider for example the max number of s/g entries supported per WQE: mellanox
HCAs support different number of these for RC and UD QPs.
So whatever single number query device reports, using it will never achieve what
the user wants for all QP types.

Rather than extending the device query for all thinkable hardware weirdness, 
I'd like to propose, instead, the following API extension (below):
passing a negative value in e.g. qp attribute would have the meaning:
let hardware use at most the specified value.
This, as opposed to the usual "at least the specified value" meaning for positive values.

How does the following work, for an API? Please comment.

Thanks,
MST


Index: openib/drivers/infiniband/include/rdma/ib_verbs.h
===================================================================
--- openib/drivers/infiniband/include/rdma/ib_verbs.h	(revision 4369)
+++ openib/drivers/infiniband/include/rdma/ib_verbs.h	(working copy)
@@ -56,6 +56,8 @@
 	class_device_create(cls, devt, device, fmt, ## arg)
 #endif /* XXX end of hack */
 
+#define IB_AT_MOST(x) (-(x))
+
 union ib_gid {
 	u8	raw[16];
 	struct {

-- 
MST



More information about the general mailing list