]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/rdma/ib_verbs.h
IB/core: Enforce PKey security on QPs
[mirror_ubuntu-bionic-kernel.git] / include / rdma / ib_verbs.h
index 9dc4e7e0aba4e8d686a74272200352902f83a23e..0e480a5630d440240628619d5fcd5d3267554ea4 100644 (file)
@@ -1614,6 +1614,45 @@ struct ib_rwq_ind_table_init_attr {
        struct ib_wq    **ind_tbl;
 };
 
+enum port_pkey_state {
+       IB_PORT_PKEY_NOT_VALID = 0,
+       IB_PORT_PKEY_VALID = 1,
+       IB_PORT_PKEY_LISTED = 2,
+};
+
+struct ib_qp_security;
+
+struct ib_port_pkey {
+       enum port_pkey_state    state;
+       u16                     pkey_index;
+       u8                      port_num;
+       struct list_head        qp_list;
+       struct list_head        to_error_list;
+       struct ib_qp_security  *sec;
+};
+
+struct ib_ports_pkeys {
+       struct ib_port_pkey     main;
+       struct ib_port_pkey     alt;
+};
+
+struct ib_qp_security {
+       struct ib_qp           *qp;
+       struct ib_device       *dev;
+       /* Hold this mutex when changing port and pkey settings. */
+       struct mutex            mutex;
+       struct ib_ports_pkeys  *ports_pkeys;
+       /* A list of all open shared QP handles.  Required to enforce security
+        * properly for all users of a shared QP.
+        */
+       struct list_head        shared_qp_list;
+       void                   *security;
+       bool                    destroying;
+       atomic_t                error_list_count;
+       struct completion       error_complete;
+       int                     error_comps_pending;
+};
+
 /*
  * @max_write_sge: Maximum SGE elements per RDMA WRITE request.
  * @max_read_sge:  Maximum SGE elements per RDMA READ request.
@@ -1643,6 +1682,7 @@ struct ib_qp {
        u32                     max_read_sge;
        enum ib_qp_type         qp_type;
        struct ib_rwq_ind_table *rwq_ind_tbl;
+       struct ib_qp_security  *qp_sec;
 };
 
 struct ib_mr {
@@ -1941,6 +1981,12 @@ struct rdma_netdev {
                            union ib_gid *gid, u16 mlid);
 };
 
+struct ib_port_pkey_list {
+       /* Lock to hold while modifying the list. */
+       spinlock_t                    list_lock;
+       struct list_head              pkey_list;
+};
+
 struct ib_device {
        /* Do not access @dma_device directly from ULP nor from HW drivers. */
        struct device                *dma_device;
@@ -1964,6 +2010,8 @@ struct ib_device {
 
        int                           num_comp_vectors;
 
+       struct ib_port_pkey_list     *port_pkey_list;
+
        struct iw_cm_verbs           *iwcm;
 
        /**