Update to v4.17.3 kernel headers.

Test: Builds, boots on a walleye.
Change-Id: I389d8b61ec00ea309e38d1b1a2e0dace48c21edb
diff --git a/libc/kernel/uapi/rdma/bnxt_re-abi.h b/libc/kernel/uapi/rdma/bnxt_re-abi.h
index 873c466..4e29624 100644
--- a/libc/kernel/uapi/rdma/bnxt_re-abi.h
+++ b/libc/kernel/uapi/rdma/bnxt_re-abi.h
@@ -32,10 +32,10 @@
   __u32 pdid;
   __u32 dpi;
   __u64 dbr;
-};
+} __attribute__((packed, aligned(4)));
 struct bnxt_re_cq_req {
-  __u64 cq_va;
-  __u64 cq_handle;
+  __aligned_u64 cq_va;
+  __aligned_u64 cq_handle;
 };
 struct bnxt_re_cq_resp {
   __u32 cqid;
@@ -44,14 +44,21 @@
   __u32 rsvd;
 };
 struct bnxt_re_qp_req {
-  __u64 qpsva;
-  __u64 qprva;
-  __u64 qp_handle;
+  __aligned_u64 qpsva;
+  __aligned_u64 qprva;
+  __aligned_u64 qp_handle;
 };
 struct bnxt_re_qp_resp {
   __u32 qpid;
   __u32 rsvd;
 };
+struct bnxt_re_srq_req {
+  __aligned_u64 srqva;
+  __aligned_u64 srq_handle;
+};
+struct bnxt_re_srq_resp {
+  __u32 srqid;
+};
 enum bnxt_re_shpg_offt {
   BNXT_RE_BEG_RESV_OFFT = 0x00,
   BNXT_RE_AVID_OFFT = 0x10,
diff --git a/libc/kernel/uapi/rdma/cxgb3-abi.h b/libc/kernel/uapi/rdma/cxgb3-abi.h
index 6f015ef..205d748 100644
--- a/libc/kernel/uapi/rdma/cxgb3-abi.h
+++ b/libc/kernel/uapi/rdma/cxgb3-abi.h
@@ -21,23 +21,23 @@
 #include <linux/types.h>
 #define IWCH_UVERBS_ABI_VERSION 1
 struct iwch_create_cq_req {
-  __u64 user_rptr_addr;
+  __aligned_u64 user_rptr_addr;
 };
 struct iwch_create_cq_resp_v0 {
-  __u64 key;
+  __aligned_u64 key;
   __u32 cqid;
   __u32 size_log2;
 };
 struct iwch_create_cq_resp {
-  __u64 key;
+  __aligned_u64 key;
   __u32 cqid;
   __u32 size_log2;
   __u32 memsize;
   __u32 reserved;
 };
 struct iwch_create_qp_resp {
-  __u64 key;
-  __u64 db_key;
+  __aligned_u64 key;
+  __aligned_u64 db_key;
   __u32 qpid;
   __u32 size_log2;
   __u32 sq_size_log2;
@@ -46,4 +46,7 @@
 struct iwch_reg_user_mr_resp {
   __u32 pbl_addr;
 };
+struct iwch_alloc_pd_resp {
+  __u32 pdid;
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/cxgb4-abi.h b/libc/kernel/uapi/rdma/cxgb4-abi.h
index 42ed246..188d901 100644
--- a/libc/kernel/uapi/rdma/cxgb4-abi.h
+++ b/libc/kernel/uapi/rdma/cxgb4-abi.h
@@ -21,9 +21,9 @@
 #include <linux/types.h>
 #define C4IW_UVERBS_ABI_VERSION 3
 struct c4iw_create_cq_resp {
-  __u64 key;
-  __u64 gts_key;
-  __u64 memsize;
+  __aligned_u64 key;
+  __aligned_u64 gts_key;
+  __aligned_u64 memsize;
   __u32 cqid;
   __u32 size;
   __u32 qid_mask;
@@ -33,13 +33,13 @@
   C4IW_QPF_ONCHIP = (1 << 0)
 };
 struct c4iw_create_qp_resp {
-  __u64 ma_sync_key;
-  __u64 sq_key;
-  __u64 rq_key;
-  __u64 sq_db_gts_key;
-  __u64 rq_db_gts_key;
-  __u64 sq_memsize;
-  __u64 rq_memsize;
+  __aligned_u64 ma_sync_key;
+  __aligned_u64 sq_key;
+  __aligned_u64 rq_key;
+  __aligned_u64 sq_db_gts_key;
+  __aligned_u64 rq_db_gts_key;
+  __aligned_u64 sq_memsize;
+  __aligned_u64 rq_memsize;
   __u32 sqid;
   __u32 rqid;
   __u32 sq_size;
@@ -48,8 +48,11 @@
   __u32 flags;
 };
 struct c4iw_alloc_ucontext_resp {
-  __u64 status_page_key;
+  __aligned_u64 status_page_key;
   __u32 status_page_size;
   __u32 reserved;
 };
+struct c4iw_alloc_pd_resp {
+  __u32 pdid;
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/hfi/hfi1_ioctl.h b/libc/kernel/uapi/rdma/hfi/hfi1_ioctl.h
index ea828fb..a430650 100644
--- a/libc/kernel/uapi/rdma/hfi/hfi1_ioctl.h
+++ b/libc/kernel/uapi/rdma/hfi/hfi1_ioctl.h
@@ -27,7 +27,7 @@
   __u8 uuid[16];
 };
 struct hfi1_ctxt_info {
-  __u64 runtime_flags;
+  __aligned_u64 runtime_flags;
   __u32 rcvegr_size;
   __u16 num_active;
   __u16 unit;
@@ -44,8 +44,8 @@
   __u16 sdma_ring_size;
 };
 struct hfi1_tid_info {
-  __u64 vaddr;
-  __u64 tidlist;
+  __aligned_u64 vaddr;
+  __aligned_u64 tidlist;
   __u32 tidcnt;
   __u32 length;
 };
@@ -55,18 +55,18 @@
   __u16 jkey;
   __u16 padding1;
   __u32 bthqp;
-  __u64 sc_credits_addr;
-  __u64 pio_bufbase_sop;
-  __u64 pio_bufbase;
-  __u64 rcvhdr_bufbase;
-  __u64 rcvegr_bufbase;
-  __u64 sdma_comp_bufbase;
-  __u64 user_regbase;
-  __u64 events_bufbase;
-  __u64 status_bufbase;
-  __u64 rcvhdrtail_base;
-  __u64 subctxt_uregbase;
-  __u64 subctxt_rcvegrbuf;
-  __u64 subctxt_rcvhdrbuf;
+  __aligned_u64 sc_credits_addr;
+  __aligned_u64 pio_bufbase_sop;
+  __aligned_u64 pio_bufbase;
+  __aligned_u64 rcvhdr_bufbase;
+  __aligned_u64 rcvegr_bufbase;
+  __aligned_u64 sdma_comp_bufbase;
+  __aligned_u64 user_regbase;
+  __aligned_u64 events_bufbase;
+  __aligned_u64 status_bufbase;
+  __aligned_u64 rcvhdrtail_base;
+  __aligned_u64 subctxt_uregbase;
+  __aligned_u64 subctxt_rcvegrbuf;
+  __aligned_u64 subctxt_rcvhdrbuf;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/hfi/hfi1_user.h b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
index 0d840e9..9148ed5 100644
--- a/libc/kernel/uapi/rdma/hfi/hfi1_user.h
+++ b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
@@ -75,8 +75,8 @@
   __u32 errcode;
 };
 struct hfi1_status {
-  __u64 dev;
-  __u64 port;
+  __aligned_u64 dev;
+  __aligned_u64 port;
   char freezemsg[0];
 };
 enum sdma_req_opcode {
@@ -94,19 +94,19 @@
   __u16 npkts;
   __u16 fragsize;
   __u16 comp_idx;
-} __packed;
+} __attribute__((__packed__));
 struct hfi1_kdeth_header {
   __le32 ver_tid_offset;
   __le16 jkey;
   __le16 hcrc;
   __le32 swdata[7];
-} __packed;
+} __attribute__((__packed__));
 struct hfi1_pkt_header {
   __le16 pbc[4];
   __be16 lrh[4];
   __be32 bth[3];
   struct hfi1_kdeth_header kdeth;
-} __packed;
+} __attribute__((__packed__));
 enum hfi1_ureg {
   ur_rcvhdrtail = 0,
   ur_rcvhdrhead = 1,
diff --git a/libc/kernel/uapi/rdma/hns-abi.h b/libc/kernel/uapi/rdma/hns-abi.h
index e6c0618..8c66f27 100644
--- a/libc/kernel/uapi/rdma/hns-abi.h
+++ b/libc/kernel/uapi/rdma/hns-abi.h
@@ -20,17 +20,29 @@
 #define HNS_ABI_USER_H
 #include <linux/types.h>
 struct hns_roce_ib_create_cq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
+};
+struct hns_roce_ib_create_cq_resp {
+  __aligned_u64 cqn;
+  __aligned_u64 cap_flags;
 };
 struct hns_roce_ib_create_qp {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u8 log_sq_bb_count;
   __u8 log_sq_stride;
   __u8 sq_no_prefetch;
   __u8 reserved[5];
 };
+struct hns_roce_ib_create_qp_resp {
+  __aligned_u64 cap_flags;
+};
 struct hns_roce_ib_alloc_ucontext_resp {
   __u32 qp_tab_size;
+  __u32 reserved;
+};
+struct hns_roce_ib_alloc_pd_resp {
+  __u32 pdn;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/i40iw-abi.h b/libc/kernel/uapi/rdma/i40iw-abi.h
new file mode 100644
index 0000000..60a17f5
--- /dev/null
+++ b/libc/kernel/uapi/rdma/i40iw-abi.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef I40IW_ABI_H
+#define I40IW_ABI_H
+#include <linux/types.h>
+#define I40IW_ABI_VER 5
+struct i40iw_alloc_ucontext_req {
+  __u32 reserved32;
+  __u8 userspace_ver;
+  __u8 reserved8[3];
+};
+struct i40iw_alloc_ucontext_resp {
+  __u32 max_pds;
+  __u32 max_qps;
+  __u32 wq_size;
+  __u8 kernel_ver;
+  __u8 reserved[3];
+};
+struct i40iw_alloc_pd_resp {
+  __u32 pd_id;
+  __u8 reserved[4];
+};
+struct i40iw_create_cq_req {
+  __aligned_u64 user_cq_buffer;
+  __aligned_u64 user_shadow_area;
+};
+struct i40iw_create_qp_req {
+  __aligned_u64 user_wqe_buffers;
+  __aligned_u64 user_compl_ctx;
+  __aligned_u64 user_sq_phb;
+  __aligned_u64 user_rq_phb;
+};
+enum i40iw_memreg_type {
+  IW_MEMREG_TYPE_MEM = 0x0000,
+  IW_MEMREG_TYPE_QP = 0x0001,
+  IW_MEMREG_TYPE_CQ = 0x0002,
+};
+struct i40iw_mem_reg_req {
+  __u16 reg_type;
+  __u16 cq_pages;
+  __u16 rq_pages;
+  __u16 sq_pages;
+};
+struct i40iw_create_cq_resp {
+  __u32 cq_id;
+  __u32 cq_size;
+  __u32 mmap_db_index;
+  __u32 reserved;
+};
+struct i40iw_create_qp_resp {
+  __u32 qp_id;
+  __u32 actual_sq_size;
+  __u32 actual_rq_size;
+  __u32 i40iw_drv_opt;
+  __u16 push_idx;
+  __u8 lsmm;
+  __u8 rsvd2;
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_cm.h b/libc/kernel/uapi/rdma/ib_user_cm.h
index 0802f2a..5ba46b8 100644
--- a/libc/kernel/uapi/rdma/ib_user_cm.h
+++ b/libc/kernel/uapi/rdma/ib_user_cm.h
@@ -47,14 +47,14 @@
   __u16 out;
 };
 struct ib_ucm_create_id {
-  __u64 uid;
-  __u64 response;
+  __aligned_u64 uid;
+  __aligned_u64 response;
 };
 struct ib_ucm_create_id_resp {
   __u32 id;
 };
 struct ib_ucm_destroy_id {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 reserved;
 };
@@ -62,7 +62,7 @@
   __u32 events_reported;
 };
 struct ib_ucm_attr_id {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 reserved;
 };
@@ -73,7 +73,7 @@
   __be32 remote_id;
 };
 struct ib_ucm_init_qp_attr {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 qp_state;
 };
@@ -88,7 +88,7 @@
   __u32 event;
 };
 struct ib_ucm_private_data {
-  __u64 data;
+  __aligned_u64 data;
   __u32 id;
   __u8 len;
   __u8 reserved[3];
@@ -99,9 +99,9 @@
   __u32 qp_type;
   __u32 psn;
   __be64 sid;
-  __u64 data;
-  __u64 primary_path;
-  __u64 alternate_path;
+  __aligned_u64 data;
+  __aligned_u64 primary_path;
+  __aligned_u64 alternate_path;
   __u8 len;
   __u8 peer_to_peer;
   __u8 responder_resources;
@@ -116,8 +116,8 @@
   __u8 reserved[5];
 };
 struct ib_ucm_rep {
-  __u64 uid;
-  __u64 data;
+  __aligned_u64 uid;
+  __aligned_u64 data;
   __u32 id;
   __u32 qpn;
   __u32 psn;
@@ -134,22 +134,22 @@
 struct ib_ucm_info {
   __u32 id;
   __u32 status;
-  __u64 info;
-  __u64 data;
+  __aligned_u64 info;
+  __aligned_u64 data;
   __u8 info_len;
   __u8 data_len;
   __u8 reserved[6];
 };
 struct ib_ucm_mra {
-  __u64 data;
+  __aligned_u64 data;
   __u32 id;
   __u8 len;
   __u8 timeout;
   __u8 reserved[2];
 };
 struct ib_ucm_lap {
-  __u64 path;
-  __u64 data;
+  __aligned_u64 path;
+  __aligned_u64 data;
   __u32 id;
   __u8 len;
   __u8 reserved[3];
@@ -158,8 +158,8 @@
   __u32 id;
   __u32 timeout;
   __be64 sid;
-  __u64 data;
-  __u64 path;
+  __aligned_u64 data;
+  __aligned_u64 path;
   __u16 reserved_pkey;
   __u8 len;
   __u8 max_cm_retries;
@@ -170,16 +170,16 @@
   __u32 qpn;
   __u32 qkey;
   __u32 status;
-  __u64 info;
-  __u64 data;
+  __aligned_u64 info;
+  __aligned_u64 data;
   __u8 info_len;
   __u8 data_len;
   __u8 reserved[6];
 };
 struct ib_ucm_event_get {
-  __u64 response;
-  __u64 data;
-  __u64 info;
+  __aligned_u64 response;
+  __aligned_u64 data;
+  __aligned_u64 info;
   __u8 data_len;
   __u8 info_len;
   __u8 reserved[6];
@@ -245,7 +245,7 @@
 #define IB_UCM_PRES_PRIMARY 0x04
 #define IB_UCM_PRES_ALTERNATE 0x08
 struct ib_ucm_event_resp {
-  __u64 uid;
+  __aligned_u64 uid;
   __u32 id;
   __u32 event;
   __u32 present;
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
new file mode 100644
index 0000000..4bc9786
--- /dev/null
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef IB_USER_IOCTL_CMDS_H
+#define IB_USER_IOCTL_CMDS_H
+#define UVERBS_ID_NS_MASK 0xF000
+#define UVERBS_ID_NS_SHIFT 12
+#define UVERBS_UDATA_DRIVER_DATA_NS 1
+#define UVERBS_UDATA_DRIVER_DATA_FLAG (1UL << UVERBS_ID_NS_SHIFT)
+enum uverbs_default_objects {
+  UVERBS_OBJECT_DEVICE,
+  UVERBS_OBJECT_PD,
+  UVERBS_OBJECT_COMP_CHANNEL,
+  UVERBS_OBJECT_CQ,
+  UVERBS_OBJECT_QP,
+  UVERBS_OBJECT_SRQ,
+  UVERBS_OBJECT_AH,
+  UVERBS_OBJECT_MR,
+  UVERBS_OBJECT_MW,
+  UVERBS_OBJECT_FLOW,
+  UVERBS_OBJECT_XRCD,
+  UVERBS_OBJECT_RWQ_IND_TBL,
+  UVERBS_OBJECT_WQ,
+  UVERBS_OBJECT_FLOW_ACTION,
+  UVERBS_OBJECT_DM,
+};
+enum {
+  UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
+  UVERBS_ATTR_UHW_OUT,
+};
+enum uverbs_attrs_create_cq_cmd_attr_ids {
+  UVERBS_ATTR_CREATE_CQ_HANDLE,
+  UVERBS_ATTR_CREATE_CQ_CQE,
+  UVERBS_ATTR_CREATE_CQ_USER_HANDLE,
+  UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL,
+  UVERBS_ATTR_CREATE_CQ_COMP_VECTOR,
+  UVERBS_ATTR_CREATE_CQ_FLAGS,
+  UVERBS_ATTR_CREATE_CQ_RESP_CQE,
+};
+enum uverbs_attrs_destroy_cq_cmd_attr_ids {
+  UVERBS_ATTR_DESTROY_CQ_HANDLE,
+  UVERBS_ATTR_DESTROY_CQ_RESP,
+};
+enum uverbs_attrs_create_flow_action_esp {
+  UVERBS_ATTR_FLOW_ACTION_ESP_HANDLE,
+  UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
+  UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
+  UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
+  UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY,
+  UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
+};
+enum uverbs_attrs_destroy_flow_action_esp {
+  UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
+};
+enum uverbs_methods_cq {
+  UVERBS_METHOD_CQ_CREATE,
+  UVERBS_METHOD_CQ_DESTROY,
+};
+enum uverbs_methods_actions_flow_action_ops {
+  UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
+  UVERBS_METHOD_FLOW_ACTION_DESTROY,
+  UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY,
+};
+enum uverbs_attrs_alloc_dm_cmd_attr_ids {
+  UVERBS_ATTR_ALLOC_DM_HANDLE,
+  UVERBS_ATTR_ALLOC_DM_LENGTH,
+  UVERBS_ATTR_ALLOC_DM_ALIGNMENT,
+};
+enum uverbs_attrs_free_dm_cmd_attr_ids {
+  UVERBS_ATTR_FREE_DM_HANDLE,
+};
+enum uverbs_methods_dm {
+  UVERBS_METHOD_DM_ALLOC,
+  UVERBS_METHOD_DM_FREE,
+};
+enum uverbs_attrs_reg_dm_mr_cmd_attr_ids {
+  UVERBS_ATTR_REG_DM_MR_HANDLE,
+  UVERBS_ATTR_REG_DM_MR_OFFSET,
+  UVERBS_ATTR_REG_DM_MR_LENGTH,
+  UVERBS_ATTR_REG_DM_MR_PD_HANDLE,
+  UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS,
+  UVERBS_ATTR_REG_DM_MR_DM_HANDLE,
+  UVERBS_ATTR_REG_DM_MR_RESP_LKEY,
+  UVERBS_ATTR_REG_DM_MR_RESP_RKEY,
+};
+enum uverbs_methods_mr {
+  UVERBS_METHOD_DM_MR_REG,
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
index 766fe4c..261734e 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
@@ -18,44 +18,51 @@
  ****************************************************************************/
 #ifndef IB_USER_IOCTL_VERBS_H
 #define IB_USER_IOCTL_VERBS_H
-#include <rdma/rdma_user_ioctl.h>
-#define UVERBS_UDATA_DRIVER_DATA_NS 1
-#define UVERBS_UDATA_DRIVER_DATA_FLAG (1UL << UVERBS_ID_NS_SHIFT)
-enum uverbs_default_objects {
-  UVERBS_OBJECT_DEVICE,
-  UVERBS_OBJECT_PD,
-  UVERBS_OBJECT_COMP_CHANNEL,
-  UVERBS_OBJECT_CQ,
-  UVERBS_OBJECT_QP,
-  UVERBS_OBJECT_SRQ,
-  UVERBS_OBJECT_AH,
-  UVERBS_OBJECT_MR,
-  UVERBS_OBJECT_MW,
-  UVERBS_OBJECT_FLOW,
-  UVERBS_OBJECT_XRCD,
-  UVERBS_OBJECT_RWQ_IND_TBL,
-  UVERBS_OBJECT_WQ,
-  UVERBS_OBJECT_LAST,
+#include <linux/types.h>
+#ifndef RDMA_UAPI_PTR
+#define RDMA_UAPI_PTR(_type,_name) __aligned_u64 _name
+#endif
+enum ib_uverbs_flow_action_esp_keymat {
+  IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM,
 };
-enum {
-  UVERBS_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
-  UVERBS_UHW_OUT,
+enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo {
+  IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ,
 };
-enum uverbs_create_cq_cmd_attr_ids {
-  CREATE_CQ_HANDLE,
-  CREATE_CQ_CQE,
-  CREATE_CQ_USER_HANDLE,
-  CREATE_CQ_COMP_CHANNEL,
-  CREATE_CQ_COMP_VECTOR,
-  CREATE_CQ_FLAGS,
-  CREATE_CQ_RESP_CQE,
+struct ib_uverbs_flow_action_esp_keymat_aes_gcm {
+  __aligned_u64 iv;
+  __u32 iv_algo;
+  __u32 salt;
+  __u32 icv_len;
+  __u32 key_len;
+  __u32 aes_key[256 / 32];
 };
-enum uverbs_destroy_cq_cmd_attr_ids {
-  DESTROY_CQ_HANDLE,
-  DESTROY_CQ_RESP,
+enum ib_uverbs_flow_action_esp_replay {
+  IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE,
+  IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP,
 };
-enum uverbs_actions_cq_ops {
-  UVERBS_CQ_CREATE,
-  UVERBS_CQ_DESTROY,
+struct ib_uverbs_flow_action_esp_replay_bmp {
+  __u32 size;
+};
+enum ib_uverbs_flow_action_esp_flags {
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO = 0UL << 0,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD = 1UL << 0,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL = 0UL << 1,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT = 1UL << 1,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT = 0UL << 2,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT = 1UL << 2,
+  IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW = 1UL << 3,
+};
+struct ib_uverbs_flow_action_esp_encap {
+  RDMA_UAPI_PTR(void *, val_ptr);
+  RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr);
+  __u16 len;
+  __u16 type;
+};
+struct ib_uverbs_flow_action_esp {
+  __u32 spi;
+  __u32 seq;
+  __u32 tfc_pad;
+  __u32 flags;
+  __aligned_u64 hard_limit_pkts;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/ib_user_mad.h b/libc/kernel/uapi/rdma/ib_user_mad.h
index cd723bb..dadb590 100644
--- a/libc/kernel/uapi/rdma/ib_user_mad.h
+++ b/libc/kernel/uapi/rdma/ib_user_mad.h
@@ -61,7 +61,7 @@
 };
 struct ib_user_mad {
   struct ib_user_mad_hdr hdr;
-  __u64 data[0];
+  __aligned_u64 data[0];
 };
 typedef unsigned long __attribute__((aligned(4))) packed_ulong;
 #define IB_USER_MAD_LONGS_PER_METHOD_MASK (128 / (8 * sizeof(long)))
@@ -85,7 +85,7 @@
   __u8 mgmt_class_version;
   __u16 res;
   __u32 flags;
-  __u64 method_mask[2];
+  __aligned_u64 method_mask[2];
   __u32 oui;
   __u8 rmpp_version;
   __u8 reserved[3];
diff --git a/libc/kernel/uapi/rdma/ib_user_verbs.h b/libc/kernel/uapi/rdma/ib_user_verbs.h
index 03a2fcd..53e4725 100644
--- a/libc/kernel/uapi/rdma/ib_user_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_verbs.h
@@ -79,12 +79,12 @@
   IB_USER_VERBS_EX_CMD_MODIFY_CQ
 };
 struct ib_uverbs_async_event_desc {
-  __u64 element;
+  __aligned_u64 element;
   __u32 event_type;
   __u32 reserved;
 };
 struct ib_uverbs_comp_event_desc {
-  __u64 cq_handle;
+  __aligned_u64 cq_handle;
 };
 struct ib_uverbs_cq_moderation_caps {
   __u16 max_cq_moderation_count;
@@ -92,38 +92,36 @@
   __u32 reserved;
 };
 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
-#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
-#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
-#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
+#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u
 struct ib_uverbs_cmd_hdr {
   __u32 command;
   __u16 in_words;
   __u16 out_words;
 };
 struct ib_uverbs_ex_cmd_hdr {
-  __u64 response;
+  __aligned_u64 response;
   __u16 provider_in_words;
   __u16 provider_out_words;
   __u32 cmd_hdr_reserved;
 };
 struct ib_uverbs_get_context {
-  __u64 response;
-  __u64 driver_data[0];
+  __aligned_u64 response;
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_get_context_resp {
   __u32 async_fd;
   __u32 num_comp_vectors;
 };
 struct ib_uverbs_query_device {
-  __u64 response;
-  __u64 driver_data[0];
+  __aligned_u64 response;
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_query_device_resp {
-  __u64 fw_ver;
+  __aligned_u64 fw_ver;
   __be64 node_guid;
   __be64 sys_image_guid;
-  __u64 max_mr_size;
-  __u64 page_size_cap;
+  __aligned_u64 max_mr_size;
+  __aligned_u64 page_size_cap;
   __u32 vendor_id;
   __u32 vendor_part_id;
   __u32 hw_ver;
@@ -166,7 +164,7 @@
   __u32 reserved;
 };
 struct ib_uverbs_odp_caps {
-  __u64 general_caps;
+  __aligned_u64 general_caps;
   struct {
     __u32 rc_odp_caps;
     __u32 uc_odp_caps;
@@ -193,20 +191,21 @@
   __u32 comp_mask;
   __u32 response_length;
   struct ib_uverbs_odp_caps odp_caps;
-  __u64 timestamp_mask;
-  __u64 hca_core_clock;
-  __u64 device_cap_flags_ex;
+  __aligned_u64 timestamp_mask;
+  __aligned_u64 hca_core_clock;
+  __aligned_u64 device_cap_flags_ex;
   struct ib_uverbs_rss_caps rss_caps;
   __u32 max_wq_type_rq;
   __u32 raw_packet_caps;
   struct ib_uverbs_tm_caps tm_caps;
   struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
+  __aligned_u64 max_dm_size;
 };
 struct ib_uverbs_query_port {
-  __u64 response;
+  __aligned_u64 response;
   __u8 port_num;
   __u8 reserved[7];
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_query_port_resp {
   __u32 port_cap_flags;
@@ -232,8 +231,8 @@
   __u8 reserved[2];
 };
 struct ib_uverbs_alloc_pd {
-  __u64 response;
-  __u64 driver_data[0];
+  __aligned_u64 response;
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_alloc_pd_resp {
   __u32 pd_handle;
@@ -242,10 +241,10 @@
   __u32 pd_handle;
 };
 struct ib_uverbs_open_xrcd {
-  __u64 response;
+  __aligned_u64 response;
   __u32 fd;
   __u32 oflags;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_open_xrcd_resp {
   __u32 xrcd_handle;
@@ -254,13 +253,13 @@
   __u32 xrcd_handle;
 };
 struct ib_uverbs_reg_mr {
-  __u64 response;
-  __u64 start;
-  __u64 length;
-  __u64 hca_va;
+  __aligned_u64 response;
+  __aligned_u64 start;
+  __aligned_u64 length;
+  __aligned_u64 hca_va;
   __u32 pd_handle;
   __u32 access_flags;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_reg_mr_resp {
   __u32 mr_handle;
@@ -268,12 +267,12 @@
   __u32 rkey;
 };
 struct ib_uverbs_rereg_mr {
-  __u64 response;
+  __aligned_u64 response;
   __u32 mr_handle;
   __u32 flags;
-  __u64 start;
-  __u64 length;
-  __u64 hca_va;
+  __aligned_u64 start;
+  __aligned_u64 length;
+  __aligned_u64 hca_va;
   __u32 pd_handle;
   __u32 access_flags;
 };
@@ -285,7 +284,7 @@
   __u32 mr_handle;
 };
 struct ib_uverbs_alloc_mw {
-  __u64 response;
+  __aligned_u64 response;
   __u32 pd_handle;
   __u8 mw_type;
   __u8 reserved[3];
@@ -298,22 +297,26 @@
   __u32 mw_handle;
 };
 struct ib_uverbs_create_comp_channel {
-  __u64 response;
+  __aligned_u64 response;
 };
 struct ib_uverbs_create_comp_channel_resp {
   __u32 fd;
 };
 struct ib_uverbs_create_cq {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 cqe;
   __u32 comp_vector;
   __s32 comp_channel;
   __u32 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
+};
+enum ib_uverbs_ex_create_cq_flags {
+  IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
+  IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1,
 };
 struct ib_uverbs_ex_create_cq {
-  __u64 user_handle;
+  __aligned_u64 user_handle;
   __u32 cqe;
   __u32 comp_vector;
   __s32 comp_channel;
@@ -331,29 +334,29 @@
   __u32 response_length;
 };
 struct ib_uverbs_resize_cq {
-  __u64 response;
+  __aligned_u64 response;
   __u32 cq_handle;
   __u32 cqe;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_resize_cq_resp {
   __u32 cqe;
   __u32 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_poll_cq {
-  __u64 response;
+  __aligned_u64 response;
   __u32 cq_handle;
   __u32 ne;
 };
 struct ib_uverbs_wc {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 status;
   __u32 opcode;
   __u32 vendor_err;
   __u32 byte_len;
   union {
-    __u32 imm_data;
+    __be32 imm_data;
     __u32 invalidate_rkey;
   } ex;
   __u32 qp_num;
@@ -376,7 +379,7 @@
   __u32 solicited_only;
 };
 struct ib_uverbs_destroy_cq {
-  __u64 response;
+  __aligned_u64 response;
   __u32 cq_handle;
   __u32 reserved;
 };
@@ -436,8 +439,8 @@
   __u8 reserved[5];
 };
 struct ib_uverbs_create_qp {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 send_cq_handle;
   __u32 recv_cq_handle;
@@ -451,7 +454,7 @@
   __u8 qp_type;
   __u8 is_srq;
   __u8 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 enum ib_uverbs_create_qp_mask {
   IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
@@ -466,7 +469,7 @@
   IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
 };
 struct ib_uverbs_ex_create_qp {
-  __u64 user_handle;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 send_cq_handle;
   __u32 recv_cq_handle;
@@ -486,13 +489,13 @@
   __u32 source_qpn;
 };
 struct ib_uverbs_open_qp {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 qpn;
   __u8 qp_type;
   __u8 reserved[7];
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_create_qp_resp {
   __u32 qp_handle;
@@ -524,10 +527,10 @@
   __u8 port_num;
 };
 struct ib_uverbs_query_qp {
-  __u64 response;
+  __aligned_u64 response;
   __u32 qp_handle;
   __u32 attr_mask;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_query_qp_resp {
   struct ib_uverbs_qp_dest dest;
@@ -560,7 +563,7 @@
   __u8 alt_timeout;
   __u8 sq_sig_all;
   __u8 reserved[5];
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_modify_qp {
   struct ib_uverbs_qp_dest dest;
@@ -589,7 +592,7 @@
   __u8 alt_port_num;
   __u8 alt_timeout;
   __u8 reserved[2];
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_ex_modify_qp {
   struct ib_uverbs_modify_qp base;
@@ -603,7 +606,7 @@
   __u32 response_length;
 };
 struct ib_uverbs_destroy_qp {
-  __u64 response;
+  __aligned_u64 response;
   __u32 qp_handle;
   __u32 reserved;
 };
@@ -611,29 +614,29 @@
   __u32 events_reported;
 };
 struct ib_uverbs_sge {
-  __u64 addr;
+  __aligned_u64 addr;
   __u32 length;
   __u32 lkey;
 };
 struct ib_uverbs_send_wr {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 opcode;
   __u32 send_flags;
   union {
-    __u32 imm_data;
+    __be32 imm_data;
     __u32 invalidate_rkey;
   } ex;
   union {
     struct {
-      __u64 remote_addr;
+      __aligned_u64 remote_addr;
       __u32 rkey;
       __u32 reserved;
     } rdma;
     struct {
-      __u64 remote_addr;
-      __u64 compare_add;
-      __u64 swap;
+      __aligned_u64 remote_addr;
+      __aligned_u64 compare_add;
+      __aligned_u64 swap;
       __u32 rkey;
       __u32 reserved;
     } atomic;
@@ -646,7 +649,7 @@
   } wr;
 };
 struct ib_uverbs_post_send {
-  __u64 response;
+  __aligned_u64 response;
   __u32 qp_handle;
   __u32 wr_count;
   __u32 sge_count;
@@ -657,12 +660,12 @@
   __u32 bad_wr;
 };
 struct ib_uverbs_recv_wr {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 reserved;
 };
 struct ib_uverbs_post_recv {
-  __u64 response;
+  __aligned_u64 response;
   __u32 qp_handle;
   __u32 wr_count;
   __u32 sge_count;
@@ -673,7 +676,7 @@
   __u32 bad_wr;
 };
 struct ib_uverbs_post_srq_recv {
-  __u64 response;
+  __aligned_u64 response;
   __u32 srq_handle;
   __u32 wr_count;
   __u32 sge_count;
@@ -684,8 +687,8 @@
   __u32 bad_wr;
 };
 struct ib_uverbs_create_ah {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 reserved;
   struct ib_uverbs_ah_attr attr;
@@ -701,20 +704,20 @@
   __u32 qp_handle;
   __u16 mlid;
   __u16 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_detach_mcast {
   __u8 gid[16];
   __u32 qp_handle;
   __u16 mlid;
   __u16 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_flow_spec_hdr {
   __u32 type;
   __u16 size;
   __u16 reserved;
-  __u64 flow_spec_data[0];
+  __aligned_u64 flow_spec_data[0];
 };
 struct ib_uverbs_flow_eth_filter {
   __u8 dst_mac[6];
@@ -813,6 +816,18 @@
     };
   };
 };
+struct ib_uverbs_flow_spec_action_handle {
+  union {
+    struct ib_uverbs_flow_spec_hdr hdr;
+    struct {
+      __u32 type;
+      __u16 size;
+      __u16 reserved;
+    };
+  };
+  __u32 handle;
+  __u32 reserved1;
+};
 struct ib_uverbs_flow_tunnel_filter {
   __be32 tunnel_id;
 };
@@ -828,6 +843,22 @@
   struct ib_uverbs_flow_tunnel_filter val;
   struct ib_uverbs_flow_tunnel_filter mask;
 };
+struct ib_uverbs_flow_spec_esp_filter {
+  __u32 spi;
+  __u32 seq;
+};
+struct ib_uverbs_flow_spec_esp {
+  union {
+    struct ib_uverbs_flow_spec_hdr hdr;
+    struct {
+      __u32 type;
+      __u16 size;
+      __u16 reserved;
+    };
+  };
+  struct ib_uverbs_flow_spec_esp_filter val;
+  struct ib_uverbs_flow_spec_esp_filter mask;
+};
 struct ib_uverbs_flow_attr {
   __u32 type;
   __u16 size;
@@ -852,17 +883,17 @@
   __u32 flow_handle;
 };
 struct ib_uverbs_create_srq {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 max_wr;
   __u32 max_sge;
   __u32 srq_limit;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_create_xsrq {
-  __u64 response;
-  __u64 user_handle;
+  __aligned_u64 response;
+  __aligned_u64 user_handle;
   __u32 srq_type;
   __u32 pd_handle;
   __u32 max_wr;
@@ -871,7 +902,7 @@
   __u32 max_num_tags;
   __u32 xrcd_handle;
   __u32 cq_handle;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_create_srq_resp {
   __u32 srq_handle;
@@ -884,13 +915,13 @@
   __u32 attr_mask;
   __u32 max_wr;
   __u32 srq_limit;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_query_srq {
-  __u64 response;
+  __aligned_u64 response;
   __u32 srq_handle;
   __u32 reserved;
-  __u64 driver_data[0];
+  __aligned_u64 driver_data[0];
 };
 struct ib_uverbs_query_srq_resp {
   __u32 max_wr;
@@ -899,7 +930,7 @@
   __u32 reserved;
 };
 struct ib_uverbs_destroy_srq {
-  __u64 response;
+  __aligned_u64 response;
   __u32 srq_handle;
   __u32 reserved;
 };
@@ -909,7 +940,7 @@
 struct ib_uverbs_ex_create_wq {
   __u32 comp_mask;
   __u32 wq_type;
-  __u64 user_handle;
+  __aligned_u64 user_handle;
   __u32 pd_handle;
   __u32 cq_handle;
   __u32 max_wr;
diff --git a/libc/kernel/uapi/rdma/mlx4-abi.h b/libc/kernel/uapi/rdma/mlx4-abi.h
index 078b386..121762b 100644
--- a/libc/kernel/uapi/rdma/mlx4-abi.h
+++ b/libc/kernel/uapi/rdma/mlx4-abi.h
@@ -26,6 +26,9 @@
   __u16 bf_reg_size;
   __u16 bf_regs_per_page;
 };
+enum {
+  MLX4_USER_DEV_CAP_LARGE_CQE = 1L << 0,
+};
 struct mlx4_ib_alloc_ucontext_resp {
   __u32 dev_caps;
   __u32 qp_tab_size;
@@ -38,26 +41,26 @@
   __u32 reserved;
 };
 struct mlx4_ib_create_cq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
 };
 struct mlx4_ib_create_cq_resp {
   __u32 cqn;
   __u32 reserved;
 };
 struct mlx4_ib_resize_cq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
 };
 struct mlx4_ib_create_srq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
 };
 struct mlx4_ib_create_srq_resp {
   __u32 srqn;
   __u32 reserved;
 };
 struct mlx4_ib_create_qp_rss {
-  __u64 rx_hash_fields_mask;
+  __aligned_u64 rx_hash_fields_mask;
   __u8 rx_hash_function;
   __u8 reserved[7];
   __u8 rx_hash_key[40];
@@ -65,8 +68,8 @@
   __u32 reserved1;
 };
 struct mlx4_ib_create_qp {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u8 log_sq_bb_count;
   __u8 log_sq_stride;
   __u8 sq_no_prefetch;
@@ -74,8 +77,8 @@
   __u32 inl_recv_sz;
 };
 struct mlx4_ib_create_wq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u8 log_range_size;
   __u8 reserved[3];
   __u32 comp_mask;
@@ -99,6 +102,28 @@
   MLX4_IB_RX_HASH_SRC_PORT_TCP = 1 << 4,
   MLX4_IB_RX_HASH_DST_PORT_TCP = 1 << 5,
   MLX4_IB_RX_HASH_SRC_PORT_UDP = 1 << 6,
-  MLX4_IB_RX_HASH_DST_PORT_UDP = 1 << 7
+  MLX4_IB_RX_HASH_DST_PORT_UDP = 1 << 7,
+  MLX4_IB_RX_HASH_INNER = 1ULL << 31,
+};
+struct mlx4_ib_rss_caps {
+  __aligned_u64 rx_hash_fields_mask;
+  __u8 rx_hash_function;
+  __u8 reserved[7];
+};
+enum query_device_resp_mask {
+  MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
+};
+struct mlx4_ib_tso_caps {
+  __u32 max_tso;
+  __u32 supported_qpts;
+};
+struct mlx4_uverbs_ex_query_device_resp {
+  __u32 comp_mask;
+  __u32 response_length;
+  __aligned_u64 hca_core_clock_offset;
+  __u32 max_inl_recv_sz;
+  __u32 reserved;
+  struct mlx4_ib_rss_caps rss_caps;
+  struct mlx4_ib_tso_caps tso_caps;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index 9347cf3..170c0a6 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -24,6 +24,9 @@
   MLX5_QP_FLAG_SIGNATURE = 1 << 0,
   MLX5_QP_FLAG_SCATTER_CQE = 1 << 1,
   MLX5_QP_FLAG_TUNNEL_OFFLOADS = 1 << 2,
+  MLX5_QP_FLAG_BFREG_INDEX = 1 << 3,
+  MLX5_QP_FLAG_TYPE_DCT = 1 << 4,
+  MLX5_QP_FLAG_TYPE_DCI = 1 << 5,
 };
 enum {
   MLX5_SRQ_FLAG_SIGNATURE = 1 << 0,
@@ -48,7 +51,7 @@
   __u8 reserved0;
   __u16 reserved1;
   __u32 reserved2;
-  __u64 lib_caps;
+  __aligned_u64 lib_caps;
 };
 enum mlx5_ib_alloc_ucontext_resp_mask {
   MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
@@ -64,6 +67,13 @@
   MLX5_USER_INLINE_MODE_IP,
   MLX5_USER_INLINE_MODE_TCP_UDP,
 };
+enum {
+  MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM = 1 << 0,
+  MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_REQ_METADATA = 1 << 1,
+  MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_SPI_STEERING = 1 << 2,
+  MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_FULL_OFFLOAD = 1 << 3,
+  MLX5_USER_ALLOC_UCONTEXT_FLOW_ACTION_FLAGS_ESP_AES_GCM_TX_IV_IS_ESN = 1 << 4,
+};
 struct mlx5_ib_alloc_ucontext_resp {
   __u32 qp_tab_size;
   __u32 bf_reg_size;
@@ -75,16 +85,18 @@
   __u32 max_recv_wr;
   __u32 max_srq_recv_wr;
   __u16 num_ports;
-  __u16 reserved1;
+  __u16 flow_action_flags;
   __u32 comp_mask;
   __u32 response_length;
   __u8 cqe_version;
   __u8 cmds_supp_uhw;
   __u8 eth_min_inline;
-  __u8 reserved2;
-  __u64 hca_core_clock_offset;
+  __u8 clock_info_versions;
+  __aligned_u64 hca_core_clock_offset;
   __u32 log_uar_size;
   __u32 num_uars_per_page;
+  __u32 num_dyn_bfregs;
+  __u32 reserved3;
 };
 struct mlx5_ib_alloc_pd_resp {
   __u32 pdn;
@@ -94,7 +106,7 @@
   __u32 supported_qpts;
 };
 struct mlx5_ib_rss_caps {
-  __u64 rx_hash_fields_mask;
+  __aligned_u64 rx_hash_fields_mask;
   __u8 rx_hash_function;
   __u8 reserved[7];
 };
@@ -107,11 +119,15 @@
   __u32 max_num;
   __u32 supported_format;
 };
+enum mlx5_ib_packet_pacing_cap_flags {
+  MLX5_IB_PP_SUPPORT_BURST = 1 << 0,
+};
 struct mlx5_packet_pacing_caps {
   __u32 qp_rate_limit_min;
   __u32 qp_rate_limit_max;
   __u32 supported_qpts;
-  __u32 reserved;
+  __u8 cap_flags;
+  __u8 reserved[3];
 };
 enum mlx5_ib_mpw_caps {
   MPW_RESERVED = 1 << 0,
@@ -162,8 +178,8 @@
   MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,
 };
 struct mlx5_ib_create_cq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u32 cqe_size;
   __u8 cqe_comp_en;
   __u8 cqe_comp_res_format;
@@ -174,14 +190,14 @@
   __u32 reserved;
 };
 struct mlx5_ib_resize_cq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
   __u16 cqe_size;
   __u16 reserved0;
   __u32 reserved1;
 };
 struct mlx5_ib_create_srq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u32 flags;
   __u32 reserved0;
   __u32 uidx;
@@ -192,15 +208,18 @@
   __u32 reserved;
 };
 struct mlx5_ib_create_qp {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u32 sq_wqe_count;
   __u32 rq_wqe_count;
   __u32 rq_wqe_shift;
   __u32 flags;
   __u32 uidx;
-  __u32 reserved0;
-  __u64 sq_buf_addr;
+  __u32 bfreg_index;
+  union {
+    __aligned_u64 sq_buf_addr;
+    __aligned_u64 access_key;
+  };
 };
 enum mlx5_rx_hash_function_flags {
   MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
@@ -214,10 +233,11 @@
   MLX5_RX_HASH_DST_PORT_TCP = 1 << 5,
   MLX5_RX_HASH_SRC_PORT_UDP = 1 << 6,
   MLX5_RX_HASH_DST_PORT_UDP = 1 << 7,
-  MLX5_RX_HASH_INNER = 1 << 31
+  MLX5_RX_HASH_IPSEC_SPI = 1 << 8,
+  MLX5_RX_HASH_INNER = (1UL << 31),
 };
 struct mlx5_ib_create_qp_rss {
-  __u64 rx_hash_fields_mask;
+  __aligned_u64 rx_hash_fields_mask;
   __u8 rx_hash_function;
   __u8 rx_key_len;
   __u8 reserved[6];
@@ -227,6 +247,7 @@
 };
 struct mlx5_ib_create_qp_resp {
   __u32 bfreg_index;
+  __u32 reserved;
 };
 struct mlx5_ib_alloc_mw {
   __u32 comp_mask;
@@ -238,8 +259,8 @@
   MLX5_IB_CREATE_WQ_STRIDING_RQ = (1 << 0),
 };
 struct mlx5_ib_create_wq {
-  __u64 buf_addr;
-  __u64 db_addr;
+  __aligned_u64 buf_addr;
+  __aligned_u64 db_addr;
   __u32 rq_wqe_count;
   __u32 rq_wqe_shift;
   __u32 user_index;
@@ -254,6 +275,20 @@
   __u8 dmac[ETH_ALEN];
   __u8 reserved[6];
 };
+struct mlx5_ib_burst_info {
+  __u32 max_burst_sz;
+  __u16 typical_pkt_sz;
+  __u16 reserved;
+};
+struct mlx5_ib_modify_qp {
+  __u32 comp_mask;
+  struct mlx5_ib_burst_info burst_info;
+  __u32 reserved;
+};
+struct mlx5_ib_modify_qp_resp {
+  __u32 response_length;
+  __u32 dctn;
+};
 struct mlx5_ib_create_wq_resp {
   __u32 response_length;
   __u32 reserved;
@@ -266,4 +301,31 @@
   __u32 comp_mask;
   __u32 reserved;
 };
+struct mlx5_ib_clock_info {
+  __u32 sign;
+  __u32 resv;
+  __aligned_u64 nsec;
+  __aligned_u64 cycles;
+  __aligned_u64 frac;
+  __u32 mult;
+  __u32 shift;
+  __aligned_u64 mask;
+  __aligned_u64 overflow_period;
+};
+enum mlx5_ib_mmap_cmd {
+  MLX5_IB_MMAP_REGULAR_PAGE = 0,
+  MLX5_IB_MMAP_GET_CONTIGUOUS_PAGES = 1,
+  MLX5_IB_MMAP_WC_PAGE = 2,
+  MLX5_IB_MMAP_NC_PAGE = 3,
+  MLX5_IB_MMAP_CORE_CLOCK = 5,
+  MLX5_IB_MMAP_ALLOC_WC = 6,
+  MLX5_IB_MMAP_CLOCK_INFO = 7,
+  MLX5_IB_MMAP_DEVICE_MEM = 8,
+};
+enum {
+  MLX5_IB_CLOCK_INFO_KERNEL_UPDATING = 1,
+};
+enum {
+  MLX5_IB_CLOCK_INFO_V1 = 0,
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
new file mode 100644
index 0000000..37aebaf
--- /dev/null
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -0,0 +1,29 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef MLX5_USER_IOCTL_CMDS_H
+#define MLX5_USER_IOCTL_CMDS_H
+#include <rdma/ib_user_ioctl_cmds.h>
+enum mlx5_ib_create_flow_action_attrs {
+  MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT),
+};
+enum mlx5_ib_alloc_dm_attrs {
+  MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT),
+  MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX,
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
new file mode 100644
index 0000000..c9a83cf
--- /dev/null
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -0,0 +1,25 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef MLX5_USER_IOCTL_VERBS_H
+#define MLX5_USER_IOCTL_VERBS_H
+#include <linux/types.h>
+enum mlx5_ib_uapi_flow_action_flags {
+  MLX5_IB_UAPI_FLOW_ACTION_FLAGS_REQUIRE_METADATA = 1 << 0,
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/mthca-abi.h b/libc/kernel/uapi/rdma/mthca-abi.h
index 49d1df0..86224f2 100644
--- a/libc/kernel/uapi/rdma/mthca-abi.h
+++ b/libc/kernel/uapi/rdma/mthca-abi.h
@@ -36,8 +36,8 @@
 struct mthca_create_cq {
   __u32 lkey;
   __u32 pdn;
-  __u64 arm_db_page;
-  __u64 set_db_page;
+  __aligned_u64 arm_db_page;
+  __aligned_u64 set_db_page;
   __u32 arm_db_index;
   __u32 set_db_index;
 };
@@ -52,7 +52,7 @@
 struct mthca_create_srq {
   __u32 lkey;
   __u32 db_index;
-  __u64 db_page;
+  __aligned_u64 db_page;
 };
 struct mthca_create_srq_resp {
   __u32 srqn;
@@ -61,8 +61,8 @@
 struct mthca_create_qp {
   __u32 lkey;
   __u32 reserved;
-  __u64 sq_db_page;
-  __u64 rq_db_page;
+  __aligned_u64 sq_db_page;
+  __aligned_u64 rq_db_page;
   __u32 sq_db_index;
   __u32 rq_db_index;
 };
diff --git a/libc/kernel/uapi/rdma/nes-abi.h b/libc/kernel/uapi/rdma/nes-abi.h
index 1545e18..724852e 100644
--- a/libc/kernel/uapi/rdma/nes-abi.h
+++ b/libc/kernel/uapi/rdma/nes-abi.h
@@ -39,13 +39,13 @@
   __u32 mmap_db_index;
 };
 struct nes_create_cq_req {
-  __u64 user_cq_buffer;
+  __aligned_u64 user_cq_buffer;
   __u32 mcrqf;
   __u8 reserved[4];
 };
 struct nes_create_qp_req {
-  __u64 user_wqe_buffers;
-  __u64 user_qp_buffer;
+  __aligned_u64 user_wqe_buffers;
+  __aligned_u64 user_qp_buffer;
 };
 enum iwnes_memreg_type {
   IWNES_MEMREG_TYPE_MEM = 0x0000,
diff --git a/libc/kernel/uapi/rdma/ocrdma-abi.h b/libc/kernel/uapi/rdma/ocrdma-abi.h
index f909632..007f0e1 100644
--- a/libc/kernel/uapi/rdma/ocrdma-abi.h
+++ b/libc/kernel/uapi/rdma/ocrdma-abi.h
@@ -26,22 +26,22 @@
   __u32 wqe_size;
   __u32 max_inline_data;
   __u32 dpp_wqe_size;
-  __u64 ah_tbl_page;
+  __aligned_u64 ah_tbl_page;
   __u32 ah_tbl_len;
   __u32 rqe_size;
   __u8 fw_ver[32];
-  __u64 rsvd1;
-  __u64 rsvd2;
+  __aligned_u64 rsvd1;
+  __aligned_u64 rsvd2;
 };
 struct ocrdma_alloc_pd_ureq {
-  __u64 rsvd1;
+  __u32 rsvd[2];
 };
 struct ocrdma_alloc_pd_uresp {
   __u32 id;
   __u32 dpp_enabled;
   __u32 dpp_page_addr_hi;
   __u32 dpp_page_addr_lo;
-  __u64 rsvd1;
+  __u32 rsvd[2];
 };
 struct ocrdma_create_cq_ureq {
   __u32 dpp_cq;
@@ -53,12 +53,12 @@
   __u32 page_size;
   __u32 num_pages;
   __u32 max_hw_cqe;
-  __u64 page_addr[MAX_CQ_PAGES];
-  __u64 db_page_addr;
+  __aligned_u64 page_addr[MAX_CQ_PAGES];
+  __aligned_u64 db_page_addr;
   __u32 db_page_size;
   __u32 phase_change;
-  __u64 rsvd1;
-  __u64 rsvd2;
+  __aligned_u64 rsvd1;
+  __aligned_u64 rsvd2;
 };
 #define MAX_QP_PAGES 8
 #define MAX_UD_AV_PAGES 8
@@ -77,9 +77,9 @@
   __u32 rq_page_size;
   __u32 num_sq_pages;
   __u32 num_rq_pages;
-  __u64 sq_page_addr[MAX_QP_PAGES];
-  __u64 rq_page_addr[MAX_QP_PAGES];
-  __u64 db_page_addr;
+  __aligned_u64 sq_page_addr[MAX_QP_PAGES];
+  __aligned_u64 rq_page_addr[MAX_QP_PAGES];
+  __aligned_u64 db_page_addr;
   __u32 db_page_size;
   __u32 dpp_credit;
   __u32 dpp_offset;
@@ -88,21 +88,21 @@
   __u32 db_sq_offset;
   __u32 db_rq_offset;
   __u32 db_shift;
-  __u64 rsvd[11];
-} __packed;
+  __aligned_u64 rsvd[11];
+};
 struct ocrdma_create_srq_uresp {
   __u16 rq_dbid;
   __u16 resv0;
   __u32 resv1;
   __u32 rq_page_size;
   __u32 num_rq_pages;
-  __u64 rq_page_addr[MAX_QP_PAGES];
-  __u64 db_page_addr;
+  __aligned_u64 rq_page_addr[MAX_QP_PAGES];
+  __aligned_u64 db_page_addr;
   __u32 db_page_size;
   __u32 num_rqe_allocated;
   __u32 db_rq_offset;
   __u32 db_shift;
-  __u64 rsvd2;
-  __u64 rsvd3;
+  __aligned_u64 rsvd2;
+  __aligned_u64 rsvd3;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/qedr-abi.h b/libc/kernel/uapi/rdma/qedr-abi.h
index 55af44b..8626f8c 100644
--- a/libc/kernel/uapi/rdma/qedr-abi.h
+++ b/libc/kernel/uapi/rdma/qedr-abi.h
@@ -21,7 +21,7 @@
 #include <linux/types.h>
 #define QEDR_ABI_VERSION (8)
 struct qedr_alloc_ucontext_resp {
-  __u64 db_pa;
+  __aligned_u64 db_pa;
   __u32 db_size;
   __u32 max_send_wr;
   __u32 max_recv_wr;
@@ -33,28 +33,31 @@
   __u8 dpm_enabled;
   __u8 wids_enabled;
   __u16 wid_count;
+  __u32 reserved;
 };
 struct qedr_alloc_pd_ureq {
-  __u64 rsvd1;
+  __aligned_u64 rsvd1;
 };
 struct qedr_alloc_pd_uresp {
   __u32 pd_id;
+  __u32 reserved;
 };
 struct qedr_create_cq_ureq {
-  __u64 addr;
-  __u64 len;
+  __aligned_u64 addr;
+  __aligned_u64 len;
 };
 struct qedr_create_cq_uresp {
   __u32 db_offset;
   __u16 icid;
+  __u16 reserved;
 };
 struct qedr_create_qp_ureq {
   __u32 qp_handle_hi;
   __u32 qp_handle_lo;
-  __u64 sq_addr;
-  __u64 sq_len;
-  __u64 rq_addr;
-  __u64 rq_len;
+  __aligned_u64 sq_addr;
+  __aligned_u64 sq_len;
+  __aligned_u64 rq_addr;
+  __aligned_u64 rq_len;
 };
 struct qedr_create_qp_uresp {
   __u32 qp_id;
@@ -64,5 +67,6 @@
   __u32 rq_db_offset;
   __u16 rq_icid;
   __u32 rq_db2_offset;
+  __u32 reserved;
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/rdma_netlink.h b/libc/kernel/uapi/rdma/rdma_netlink.h
index c7bcb6d..36c8911 100644
--- a/libc/kernel/uapi/rdma/rdma_netlink.h
+++ b/libc/kernel/uapi/rdma/rdma_netlink.h
@@ -173,13 +173,13 @@
 enum rdma_nldev_command {
   RDMA_NLDEV_CMD_UNSPEC,
   RDMA_NLDEV_CMD_GET,
-  RDMA_NLDEV_CMD_SET,
-  RDMA_NLDEV_CMD_NEW,
-  RDMA_NLDEV_CMD_DEL,
-  RDMA_NLDEV_CMD_PORT_GET,
-  RDMA_NLDEV_CMD_PORT_SET,
-  RDMA_NLDEV_CMD_PORT_NEW,
-  RDMA_NLDEV_CMD_PORT_DEL,
+  RDMA_NLDEV_CMD_PORT_GET = 5,
+  RDMA_NLDEV_CMD_RES_GET = 9,
+  RDMA_NLDEV_CMD_RES_QP_GET,
+  RDMA_NLDEV_CMD_RES_CM_ID_GET,
+  RDMA_NLDEV_CMD_RES_CQ_GET,
+  RDMA_NLDEV_CMD_RES_MR_GET,
+  RDMA_NLDEV_CMD_RES_PD_GET,
   RDMA_NLDEV_NUM_OPS
 };
 enum rdma_nldev_attr {
@@ -198,6 +198,43 @@
   RDMA_NLDEV_ATTR_PORT_STATE,
   RDMA_NLDEV_ATTR_PORT_PHYS_STATE,
   RDMA_NLDEV_ATTR_DEV_NODE_TYPE,
+  RDMA_NLDEV_ATTR_RES_SUMMARY,
+  RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY,
+  RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME,
+  RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_CURR,
+  RDMA_NLDEV_ATTR_RES_QP,
+  RDMA_NLDEV_ATTR_RES_QP_ENTRY,
+  RDMA_NLDEV_ATTR_RES_LQPN,
+  RDMA_NLDEV_ATTR_RES_RQPN,
+  RDMA_NLDEV_ATTR_RES_RQ_PSN,
+  RDMA_NLDEV_ATTR_RES_SQ_PSN,
+  RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE,
+  RDMA_NLDEV_ATTR_RES_TYPE,
+  RDMA_NLDEV_ATTR_RES_STATE,
+  RDMA_NLDEV_ATTR_RES_PID,
+  RDMA_NLDEV_ATTR_RES_KERN_NAME,
+  RDMA_NLDEV_ATTR_RES_CM_ID,
+  RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY,
+  RDMA_NLDEV_ATTR_RES_PS,
+  RDMA_NLDEV_ATTR_RES_SRC_ADDR,
+  RDMA_NLDEV_ATTR_RES_DST_ADDR,
+  RDMA_NLDEV_ATTR_RES_CQ,
+  RDMA_NLDEV_ATTR_RES_CQ_ENTRY,
+  RDMA_NLDEV_ATTR_RES_CQE,
+  RDMA_NLDEV_ATTR_RES_USECNT,
+  RDMA_NLDEV_ATTR_RES_POLL_CTX,
+  RDMA_NLDEV_ATTR_RES_MR,
+  RDMA_NLDEV_ATTR_RES_MR_ENTRY,
+  RDMA_NLDEV_ATTR_RES_RKEY,
+  RDMA_NLDEV_ATTR_RES_LKEY,
+  RDMA_NLDEV_ATTR_RES_IOVA,
+  RDMA_NLDEV_ATTR_RES_MRLEN,
+  RDMA_NLDEV_ATTR_RES_PD,
+  RDMA_NLDEV_ATTR_RES_PD_ENTRY,
+  RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY,
+  RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY,
+  RDMA_NLDEV_ATTR_NDEV_INDEX,
+  RDMA_NLDEV_ATTR_NDEV_NAME,
   RDMA_NLDEV_ATTR_MAX
 };
 #endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_cm.h b/libc/kernel/uapi/rdma/rdma_user_cm.h
index 24e0f2e..b200491 100644
--- a/libc/kernel/uapi/rdma/rdma_user_cm.h
+++ b/libc/kernel/uapi/rdma/rdma_user_cm.h
@@ -50,14 +50,20 @@
   RDMA_USER_CM_CMD_RESOLVE_ADDR,
   RDMA_USER_CM_CMD_JOIN_MCAST
 };
+enum rdma_ucm_port_space {
+  RDMA_PS_IPOIB = 0x0002,
+  RDMA_PS_IB = 0x013F,
+  RDMA_PS_TCP = 0x0106,
+  RDMA_PS_UDP = 0x0111,
+};
 struct rdma_ucm_cmd_hdr {
   __u32 cmd;
   __u16 in;
   __u16 out;
 };
 struct rdma_ucm_create_id {
-  __u64 uid;
-  __u64 response;
+  __aligned_u64 uid;
+  __aligned_u64 response;
   __u16 ps;
   __u8 qp_type;
   __u8 reserved[5];
@@ -66,7 +72,7 @@
   __u32 id;
 };
 struct rdma_ucm_destroy_id {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 reserved;
 };
@@ -74,7 +80,7 @@
   __u32 events_reported;
 };
 struct rdma_ucm_bind_ip {
-  __u64 response;
+  __aligned_u64 response;
   struct sockaddr_in6 addr;
   __u32 id;
 };
@@ -109,12 +115,12 @@
   RDMA_USER_CM_QUERY_GID
 };
 struct rdma_ucm_query {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 option;
 };
 struct rdma_ucm_query_route_resp {
-  __u64 node_guid;
+  __aligned_u64 node_guid;
   struct ib_user_path_rec ib_route[2];
   struct sockaddr_in6 src_addr;
   struct sockaddr_in6 dst_addr;
@@ -123,7 +129,7 @@
   __u8 reserved[3];
 };
 struct rdma_ucm_query_addr_resp {
-  __u64 node_guid;
+  __aligned_u64 node_guid;
   __u8 port_num;
   __u8 reserved;
   __u16 pkey;
@@ -168,7 +174,7 @@
   __u32 backlog;
 };
 struct rdma_ucm_accept {
-  __u64 uid;
+  __aligned_u64 uid;
   struct rdma_ucm_conn_param conn_param;
   __u32 id;
   __u32 reserved;
@@ -183,7 +189,7 @@
   __u32 id;
 };
 struct rdma_ucm_init_qp_attr {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 qp_state;
 };
@@ -192,8 +198,8 @@
   __u32 event;
 };
 struct rdma_ucm_join_ip_mcast {
-  __u64 response;
-  __u64 uid;
+  __aligned_u64 response;
+  __aligned_u64 uid;
   struct sockaddr_in6 addr;
   __u32 id;
 };
@@ -203,18 +209,18 @@
   RDMA_MC_JOIN_FLAG_RESERVED,
 };
 struct rdma_ucm_join_mcast {
-  __u64 response;
-  __u64 uid;
+  __aligned_u64 response;
+  __aligned_u64 uid;
   __u32 id;
   __u16 addr_size;
   __u16 join_flags;
   struct sockaddr_storage addr;
 };
 struct rdma_ucm_get_event {
-  __u64 response;
+  __aligned_u64 response;
 };
 struct rdma_ucm_event_resp {
-  __u64 uid;
+  __aligned_u64 uid;
   __u32 id;
   __u32 event;
   __u32 status;
@@ -222,6 +228,7 @@
     struct rdma_ucm_conn_param conn;
     struct rdma_ucm_ud_param ud;
   } param;
+  __u32 reserved;
 };
 enum {
   RDMA_OPTION_ID = 0,
@@ -234,14 +241,14 @@
   RDMA_OPTION_IB_PATH = 1
 };
 struct rdma_ucm_set_option {
-  __u64 optval;
+  __aligned_u64 optval;
   __u32 id;
   __u32 level;
   __u32 optname;
   __u32 optlen;
 };
 struct rdma_ucm_migrate_id {
-  __u64 response;
+  __aligned_u64 response;
   __u32 id;
   __u32 fd;
 };
diff --git a/libc/kernel/uapi/rdma/rdma_user_ioctl.h b/libc/kernel/uapi/rdma/rdma_user_ioctl.h
index 41c11bc..2f532d3 100644
--- a/libc/kernel/uapi/rdma/rdma_user_ioctl.h
+++ b/libc/kernel/uapi/rdma/rdma_user_ioctl.h
@@ -18,34 +18,10 @@
  ****************************************************************************/
 #ifndef RDMA_USER_IOCTL_H
 #define RDMA_USER_IOCTL_H
-#include <linux/types.h>
-#include <linux/ioctl.h>
 #include <rdma/ib_user_mad.h>
 #include <rdma/hfi/hfi1_ioctl.h>
-#define RDMA_IOCTL_MAGIC 0x1b
+#include <rdma/rdma_user_ioctl_cmds.h>
 #define IB_IOCTL_MAGIC RDMA_IOCTL_MAGIC
-#define RDMA_VERBS_IOCTL _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr)
-#define UVERBS_ID_NS_MASK 0xF000
-#define UVERBS_ID_NS_SHIFT 12
-enum {
-  UVERBS_ATTR_F_MANDATORY = 1U << 0,
-  UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1,
-};
-struct ib_uverbs_attr {
-  __u16 attr_id;
-  __u16 len;
-  __u16 flags;
-  __u16 reserved;
-  __u64 data;
-};
-struct ib_uverbs_ioctl_hdr {
-  __u16 length;
-  __u16 object_id;
-  __u16 method_id;
-  __u16 num_attrs;
-  __u64 reserved;
-  struct ib_uverbs_attr attrs[0];
-};
 #define IB_USER_MAD_REGISTER_AGENT _IOWR(RDMA_IOCTL_MAGIC, 0x01, struct ib_user_mad_reg_req)
 #define IB_USER_MAD_UNREGISTER_AGENT _IOW(RDMA_IOCTL_MAGIC, 0x02, __u32)
 #define IB_USER_MAD_ENABLE_PKEY _IO(RDMA_IOCTL_MAGIC, 0x03)
diff --git a/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
new file mode 100644
index 0000000..5da7917
--- /dev/null
+++ b/libc/kernel/uapi/rdma/rdma_user_ioctl_cmds.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef RDMA_USER_IOCTL_CMDS_H
+#define RDMA_USER_IOCTL_CMDS_H
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#define RDMA_IOCTL_MAGIC 0x1b
+#define RDMA_VERBS_IOCTL _IOWR(RDMA_IOCTL_MAGIC, 1, struct ib_uverbs_ioctl_hdr)
+enum {
+  UVERBS_ATTR_F_MANDATORY = 1U << 0,
+  UVERBS_ATTR_F_VALID_OUTPUT = 1U << 1,
+};
+struct ib_uverbs_attr {
+  __u16 attr_id;
+  __u16 len;
+  __u16 flags;
+  union {
+    struct {
+      __u8 elem_id;
+      __u8 reserved;
+    } enum_data;
+    __u16 reserved;
+  } attr_data;
+  __aligned_u64 data;
+};
+struct ib_uverbs_ioctl_hdr {
+  __u16 length;
+  __u16 object_id;
+  __u16 method_id;
+  __u16 num_attrs;
+  __aligned_u64 reserved1;
+  __u32 driver_id;
+  __u32 reserved2;
+  struct ib_uverbs_attr attrs[0];
+};
+enum rdma_driver_id {
+  RDMA_DRIVER_UNKNOWN,
+  RDMA_DRIVER_MLX5,
+  RDMA_DRIVER_MLX4,
+  RDMA_DRIVER_CXGB3,
+  RDMA_DRIVER_CXGB4,
+  RDMA_DRIVER_MTHCA,
+  RDMA_DRIVER_BNXT_RE,
+  RDMA_DRIVER_OCRDMA,
+  RDMA_DRIVER_NES,
+  RDMA_DRIVER_I40IW,
+  RDMA_DRIVER_VMW_PVRDMA,
+  RDMA_DRIVER_QEDR,
+  RDMA_DRIVER_HNS,
+  RDMA_DRIVER_USNIC,
+  RDMA_DRIVER_RXE,
+  RDMA_DRIVER_HFI1,
+  RDMA_DRIVER_QIB,
+};
+#endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_rxe.h b/libc/kernel/uapi/rdma/rdma_user_rxe.h
index 8d1bbd0..a57ed1a 100644
--- a/libc/kernel/uapi/rdma/rdma_user_rxe.h
+++ b/libc/kernel/uapi/rdma/rdma_user_rxe.h
@@ -19,6 +19,9 @@
 #ifndef RDMA_USER_RXE_H
 #define RDMA_USER_RXE_H
 #include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/in.h>
+#include <linux/in6.h>
 union rxe_gid {
   __u8 raw[16];
   struct {
@@ -36,15 +39,16 @@
 struct rxe_av {
   __u8 port_num;
   __u8 network_type;
+  __u16 reserved1;
+  __u32 reserved2;
   struct rxe_global_route grh;
   union {
-    struct sockaddr _sockaddr;
     struct sockaddr_in _sockaddr_in;
     struct sockaddr_in6 _sockaddr_in6;
   } sgid_addr, dgid_addr;
 };
 struct rxe_send_wr {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 opcode;
   __u32 send_flags;
@@ -54,14 +58,16 @@
   } ex;
   union {
     struct {
-      __u64 remote_addr;
+      __aligned_u64 remote_addr;
       __u32 rkey;
+      __u32 reserved;
     } rdma;
     struct {
-      __u64 remote_addr;
-      __u64 compare_add;
-      __u64 swap;
+      __aligned_u64 remote_addr;
+      __aligned_u64 compare_add;
+      __aligned_u64 swap;
       __u32 rkey;
+      __u32 reserved;
     } atomic;
     struct {
       __u32 remote_qpn;
@@ -69,19 +75,22 @@
       __u16 pkey_index;
     } ud;
     struct {
-      struct ib_mr * mr;
+      union {
+        struct ib_mr * mr;
+        __aligned_u64 reserved;
+      };
       __u32 key;
-      int access;
+      __u32 access;
     } reg;
   } wr;
 };
 struct rxe_sge {
-  __u64 addr;
+  __aligned_u64 addr;
   __u32 length;
   __u32 lkey;
 };
 struct mminfo {
-  __u64 offset;
+  __aligned_u64 offset;
   __u32 size;
   __u32 pad;
 };
@@ -91,6 +100,7 @@
   __u32 cur_sge;
   __u32 num_sge;
   __u32 sge_offset;
+  __u32 reserved;
   union {
     __u8 inline_data[0];
     struct rxe_sge sge[0];
@@ -101,7 +111,7 @@
   struct rxe_av av;
   __u32 status;
   __u32 state;
-  __u64 iova;
+  __aligned_u64 iova;
   __u32 mask;
   __u32 first_psn;
   __u32 last_psn;
@@ -111,9 +121,27 @@
   struct rxe_dma_info dma;
 };
 struct rxe_recv_wqe {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 padding;
   struct rxe_dma_info dma;
 };
+struct rxe_create_cq_resp {
+  struct mminfo mi;
+};
+struct rxe_resize_cq_resp {
+  struct mminfo mi;
+};
+struct rxe_create_qp_resp {
+  struct mminfo rq_mi;
+  struct mminfo sq_mi;
+};
+struct rxe_create_srq_resp {
+  struct mminfo mi;
+  __u32 srq_num;
+  __u32 reserved;
+};
+struct rxe_modify_srq_cmd {
+  __aligned_u64 mmap_info_addr;
+};
 #endif
diff --git a/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h b/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
index 7c13680..7b43e35 100644
--- a/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
+++ b/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
@@ -22,12 +22,14 @@
 #define PVRDMA_UVERBS_ABI_VERSION 3
 #define PVRDMA_UAR_HANDLE_MASK 0x00FFFFFF
 #define PVRDMA_UAR_QP_OFFSET 0
-#define PVRDMA_UAR_QP_SEND BIT(30)
-#define PVRDMA_UAR_QP_RECV BIT(31)
+#define PVRDMA_UAR_QP_SEND (1 << 30)
+#define PVRDMA_UAR_QP_RECV (1 << 31)
 #define PVRDMA_UAR_CQ_OFFSET 4
-#define PVRDMA_UAR_CQ_ARM_SOL BIT(29)
-#define PVRDMA_UAR_CQ_ARM BIT(30)
-#define PVRDMA_UAR_CQ_POLL BIT(31)
+#define PVRDMA_UAR_CQ_ARM_SOL (1 << 29)
+#define PVRDMA_UAR_CQ_ARM (1 << 30)
+#define PVRDMA_UAR_CQ_POLL (1 << 31)
+#define PVRDMA_UAR_SRQ_OFFSET 8
+#define PVRDMA_UAR_SRQ_RECV (1 << 30)
 enum pvrdma_wr_opcode {
   PVRDMA_WR_RDMA_WRITE,
   PVRDMA_WR_RDMA_WRITE_WITH_IMM,
@@ -104,7 +106,7 @@
   __u32 reserved;
 };
 struct pvrdma_create_cq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
   __u32 buf_size;
   __u32 reserved;
 };
@@ -113,12 +115,12 @@
   __u32 reserved;
 };
 struct pvrdma_resize_cq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
   __u32 buf_size;
   __u32 reserved;
 };
 struct pvrdma_create_srq {
-  __u64 buf_addr;
+  __aligned_u64 buf_addr;
   __u32 buf_size;
   __u32 reserved;
 };
@@ -127,21 +129,21 @@
   __u32 reserved;
 };
 struct pvrdma_create_qp {
-  __u64 rbuf_addr;
-  __u64 sbuf_addr;
+  __aligned_u64 rbuf_addr;
+  __aligned_u64 sbuf_addr;
   __u32 rbuf_size;
   __u32 sbuf_size;
-  __u64 qp_addr;
+  __aligned_u64 qp_addr;
 };
 struct pvrdma_ex_cmp_swap {
-  __u64 swap_val;
-  __u64 compare_val;
-  __u64 swap_mask;
-  __u64 compare_mask;
+  __aligned_u64 swap_val;
+  __aligned_u64 compare_val;
+  __aligned_u64 swap_mask;
+  __aligned_u64 compare_mask;
 };
 struct pvrdma_ex_fetch_add {
-  __u64 add_val;
-  __u64 field_boundary;
+  __aligned_u64 add_val;
+  __aligned_u64 field_boundary;
 };
 struct pvrdma_av {
   __u32 port_pd;
@@ -155,17 +157,17 @@
   __u8 reserved[6];
 };
 struct pvrdma_sge {
-  __u64 addr;
+  __aligned_u64 addr;
   __u32 length;
   __u32 lkey;
 };
 struct pvrdma_rq_wqe_hdr {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 total_len;
 };
 struct pvrdma_sq_wqe_hdr {
-  __u64 wr_id;
+  __aligned_u64 wr_id;
   __u32 num_sge;
   __u32 total_len;
   __u32 opcode;
@@ -177,19 +179,19 @@
   __u32 reserved;
   union {
     struct {
-      __u64 remote_addr;
+      __aligned_u64 remote_addr;
       __u32 rkey;
       __u8 reserved[4];
     } rdma;
     struct {
-      __u64 remote_addr;
-      __u64 compare_add;
-      __u64 swap;
+      __aligned_u64 remote_addr;
+      __aligned_u64 compare_add;
+      __aligned_u64 swap;
       __u32 rkey;
       __u32 reserved;
     } atomic;
     struct {
-      __u64 remote_addr;
+      __aligned_u64 remote_addr;
       __u32 log_arg_sz;
       __u32 rkey;
       union {
@@ -198,13 +200,14 @@
       } wr_data;
     } masked_atomics;
     struct {
-      __u64 iova_start;
-      __u64 pl_pdir_dma;
+      __aligned_u64 iova_start;
+      __aligned_u64 pl_pdir_dma;
       __u32 page_shift;
       __u32 page_list_len;
       __u32 length;
       __u32 access_flags;
       __u32 rkey;
+      __u32 reserved;
     } fast_reg;
     struct {
       __u32 remote_qpn;
@@ -214,8 +217,8 @@
   } wr;
 };
 struct pvrdma_cqe {
-  __u64 wr_id;
-  __u64 qp;
+  __aligned_u64 wr_id;
+  __aligned_u64 qp;
   __u32 opcode;
   __u32 status;
   __u32 byte_len;