Query all valid GID table entries of an RDMA device
RFC PATCH 1/1 Query all valid GID table entries of an RDMA device
When an application is not using RDMA CM and if it is using multiple RDMA devices with one or more RoCE ports, finding the right GID table entry is long process.
For example with two RoCE dual port devices in a system, when IP failover is used among between two RoCE ports, searching a suitable GID entry for a given source IP, matching netdevice of given RoCEv1/v2 type requires iterating over all 4 ports * 256 entry GID table. Even though best first match GID table for a given criteria is used, when matching entry is on 4th port, requires reading
3 ports * 256 entries * 3 files (GID, netdev, type) = 2304 files.
GID table needs to be referred on every QP creation during IP failover on other netdevice of an RDMA device.
In an alternative approach, a GID cache may be maintained and updated on GID change event reported by kernel. However, it comes with below two limitations.
(a) Maintain a thread per application process instance to listen and update cache
(b) Without the thread, on cache miss event, query the GID table. Even in this approach, if multiple processes are used, a GID cache needs to be maintained on per process basis. With large number of processes, this method doesn't scale.
Hence, introduce an API to query complete GID table of an rdma device that returns all valid GID table entries.
This is done through single ioctl, eliminating 2304 read, 2304 open and 2304 close system calls to just total of 2 calls.
While at it, also introduce a QUERY API to individual GID entry over ioctl interface which provides all GID attributes information.
This RFC only contains user facing data structures, APIs and user-kernel interface specification. A full implementation in kernel will be done once RFC review is completed.
--- kernel-headers/rdma/ib_user_ioctl_cmds.h | 11 ++++ kernel-headers/rdma/ib_user_ioctl_verbs.h | 14 +++++ libibverbs/man/ibv_query_gid_ex.3.md | 45 ++++++++++++++++ libibverbs/man/ibv_query_gid_table.3.md | 62 +++++++++++++++++++++++ libibverbs/verbs.h | 54 ++++++++++++++++++++ 5 files changed, 186 insertions(+) create mode 100644 libibverbs/man/ibv_query_gid_ex.3.md create mode 100644 libibverbs/man/ibv_query_gid_table.3.md
kernel-headers/rdma/ib_user_ioctl_cmds.h +11 -0
@@ -69,6 +69,8 @@ enum uverbs_methods_device {UVERBS_METHOD_INFO_HANDLES ,UVERBS_METHOD_QUERY_PORT ,UVERBS_METHOD_GET_CONTEXT , +UVERBS_METHOD_QUERY_GID_ENTRY , + UVERBS_METHOD_QUERY_GID_TABLE, }; enum uverbs_attrs_invoke_write_cmd_attr_ids {
@@ -337,4 +339,13 @@ enum uverbs_attrs_async_event_create { UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE, }; +enum uverbs_attrs_query_gid_table_cmd_attr_ids { +UVERBS_ATTR_QUERY_GID_TABLE_MAX_ENTRIES , +}; + +enum uverbs_attrs_query_gid_entry_cmd_attr_ids { +UVERBS_ATTR_QUERY_GID_ENTRY_PORT , +UVERBS_ATTR_QUERY_GID_ENTRY_GID_INDEX , +}; +#endif
kernel-headers/rdma/ib_user_ioctl_verbs.h +14 -0
@@ -250,4 +250,18 @@ enum rdma_driver_id { RDMA_DRIVER_SIW, }; +enum ib_uverbs_gid_entry_type { +IB_UVERBS_GID_TYPE_IB ,/* Applicable to IB link layer */ +IB_UVERBS_GID_TYPE_ROCEV1 ,/* RoCEv1 GID of Ethernet link layer */ +IB_UVERBS_GID_TYPE_ROCEV2 ,/* RoCEv2 GID of Ethernet link layer */ +}; + +struct ib_uverbs_gid_entry { +__u8 gid[16 ]; +__u32 gid_index; +__u32 port_num; +__u32 gid_type; +int netdev_ifindex;/* Valid only when its value is >= 0 */ +}; +#endif
libibverbs/man/ibv_query_gid_ex.3.md new file +45 -0
45 lines not on this page · raw message
libibverbs/man/ibv_query_gid_table.3.md new file +62 -0
62 lines not on this page · raw message
libibverbs/verbs.h +54 -0
66 lines not on this page · raw message
Signature · 1 line
2.19.2