Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
[cascardo/linux.git] / include / rdma / ib_verbs.h
index 9e93565..5ad43a4 100644 (file)
@@ -261,6 +261,16 @@ struct ib_odp_caps {
        } per_transport_caps;
 };
 
+struct ib_rss_caps {
+       /* Corresponding bit will be set if qp type from
+        * 'enum ib_qp_type' is supported, e.g.
+        * supported_qpts |= 1 << IB_QPT_UD
+        */
+       u32 supported_qpts;
+       u32 max_rwq_indirection_tables;
+       u32 max_rwq_indirection_table_size;
+};
+
 enum ib_cq_creation_flags {
        IB_CQ_FLAGS_TIMESTAMP_COMPLETION   = 1 << 0,
        IB_CQ_FLAGS_IGNORE_OVERRUN         = 1 << 1,
@@ -318,6 +328,8 @@ struct ib_device_attr {
        struct ib_odp_caps      odp_caps;
        uint64_t                timestamp_mask;
        uint64_t                hca_core_clock; /* in KHZ */
+       struct ib_rss_caps      rss_caps;
+       u32                     max_wq_type_rq;
 };
 
 enum ib_mtu {
@@ -525,9 +537,11 @@ enum ib_device_modify_flags {
        IB_DEVICE_MODIFY_NODE_DESC      = 1 << 1
 };
 
+#define IB_DEVICE_NODE_DESC_MAX 64
+
 struct ib_device_modify {
        u64     sys_image_guid;
-       char    node_desc[64];
+       char    node_desc[IB_DEVICE_NODE_DESC_MAX];
 };
 
 enum ib_port_modify_flags {
@@ -1370,10 +1384,17 @@ struct ib_udata {
 
 struct ib_pd {
        u32                     local_dma_lkey;
+       u32                     flags;
        struct ib_device       *device;
        struct ib_uobject      *uobject;
        atomic_t                usecnt; /* count all resources */
-       struct ib_mr           *local_mr;
+
+       u32                     unsafe_global_rkey;
+
+       /*
+        * Implementation details of the RDMA core, don't use in drivers:
+        */
+       struct ib_mr           *__internal_mr;
 };
 
 struct ib_xrcd {
@@ -1604,6 +1625,8 @@ struct ib_flow_eth_filter {
        u8      src_mac[6];
        __be16  ether_type;
        __be16  vlan_tag;
+       /* Must be last */
+       u8      real_sz[0];
 };
 
 struct ib_flow_spec_eth {
@@ -1616,6 +1639,8 @@ struct ib_flow_spec_eth {
 struct ib_flow_ib_filter {
        __be16 dlid;
        __u8   sl;
+       /* Must be last */
+       u8      real_sz[0];
 };
 
 struct ib_flow_spec_ib {
@@ -1625,9 +1650,22 @@ struct ib_flow_spec_ib {
        struct ib_flow_ib_filter mask;
 };
 
+/* IPv4 header flags */
+enum ib_ipv4_flags {
+       IB_IPV4_DONT_FRAG = 0x2, /* Don't enable packet fragmentation */
+       IB_IPV4_MORE_FRAG = 0X4  /* For All fragmented packets except the
+                                   last have this flag set */
+};
+
 struct ib_flow_ipv4_filter {
        __be32  src_ip;
        __be32  dst_ip;
+       u8      proto;
+       u8      tos;
+       u8      ttl;
+       u8      flags;
+       /* Must be last */
+       u8      real_sz[0];
 };
 
 struct ib_flow_spec_ipv4 {
@@ -1640,6 +1678,12 @@ struct ib_flow_spec_ipv4 {
 struct ib_flow_ipv6_filter {
        u8      src_ip[16];
        u8      dst_ip[16];
+       __be32  flow_label;
+       u8      next_hdr;
+       u8      traffic_class;
+       u8      hop_limit;
+       /* Must be last */
+       u8      real_sz[0];
 };
 
 struct ib_flow_spec_ipv6 {
@@ -1652,6 +1696,8 @@ struct ib_flow_spec_ipv6 {
 struct ib_flow_tcp_udp_filter {
        __be16  dst_port;
        __be16  src_port;
+       /* Must be last */
+       u8      real_sz[0];
 };
 
 struct ib_flow_spec_tcp_udp {
@@ -2041,7 +2087,7 @@ struct ib_device {
        u64                          uverbs_cmd_mask;
        u64                          uverbs_ex_cmd_mask;
 
-       char                         node_desc[64];
+       char                         node_desc[IB_DEVICE_NODE_DESC_MAX];
        __be64                       node_guid;
        u32                          local_dma_lkey;
        u16                          is_switch:1;
@@ -2505,8 +2551,23 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
 int ib_find_pkey(struct ib_device *device,
                 u8 port_num, u16 pkey, u16 *index);
 
-struct ib_pd *ib_alloc_pd(struct ib_device *device);
+enum ib_pd_flags {
+       /*
+        * Create a memory registration for all memory in the system and place
+        * the rkey for it into pd->unsafe_global_rkey.  This can be used by
+        * ULPs to avoid the overhead of dynamic MRs.
+        *
+        * This flag is generally considered unsafe and must only be used in
+        * extremly trusted environments.  Every use of it will log a warning
+        * in the kernel log.
+        */
+       IB_PD_UNSAFE_GLOBAL_RKEY        = 0x01,
+};
 
+struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
+               const char *caller);
+#define ib_alloc_pd(device, flags) \
+       __ib_alloc_pd((device), (flags), __func__)
 void ib_dealloc_pd(struct ib_pd *pd);
 
 /**
@@ -2859,18 +2920,6 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt)
                -ENOSYS;
 }
 
-/**
- * ib_get_dma_mr - Returns a memory region for system memory that is
- *   usable for DMA.
- * @pd: The protection domain associated with the memory region.
- * @mr_access_flags: Specifies the memory access rights.
- *
- * Note that the ib_dma_*() functions defined below must be used
- * to create/destroy addresses used with the Lkey or Rkey returned
- * by ib_get_dma_mr().
- */
-struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
-
 /**
  * ib_dma_mapping_error - check a DMA addr for error
  * @dev: The device for which the dma_addr was created