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 990220b..5ad43a4 100644 (file)
@@ -537,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 {
@@ -1676,6 +1678,10 @@ 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];
 };
@@ -1779,6 +1785,14 @@ struct ib_dma_mapping_ops {
        void            (*unmap_sg)(struct ib_device *dev,
                                    struct scatterlist *sg, int nents,
                                    enum dma_data_direction direction);
+       int             (*map_sg_attrs)(struct ib_device *dev,
+                                       struct scatterlist *sg, int nents,
+                                       enum dma_data_direction direction,
+                                       unsigned long attrs);
+       void            (*unmap_sg_attrs)(struct ib_device *dev,
+                                         struct scatterlist *sg, int nents,
+                                         enum dma_data_direction direction,
+                                         unsigned long attrs);
        void            (*sync_single_for_cpu)(struct ib_device *dev,
                                               u64 dma_handle,
                                               size_t size,
@@ -2073,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;
@@ -2155,22 +2169,17 @@ static inline bool ib_is_udata_cleared(struct ib_udata *udata,
                                       size_t len)
 {
        const void __user *p = udata->inbuf + offset;
-       bool ret = false;
+       bool ret;
        u8 *buf;
 
        if (len > USHRT_MAX)
                return false;
 
-       buf = kmalloc(len, GFP_KERNEL);
-       if (!buf)
+       buf = memdup_user(p, len);
+       if (IS_ERR(buf))
                return false;
 
-       if (copy_from_user(buf, p, len))
-               goto free;
-
        ret = !memchr_inv(buf, 0, len);
-
-free:
        kfree(buf);
        return ret;
 }
@@ -3048,8 +3057,12 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev,
                                      enum dma_data_direction direction,
                                      unsigned long dma_attrs)
 {
-       return dma_map_sg_attrs(dev->dma_device, sg, nents, direction,
-                               dma_attrs);
+       if (dev->dma_ops)
+               return dev->dma_ops->map_sg_attrs(dev, sg, nents, direction,
+                                                 dma_attrs);
+       else
+               return dma_map_sg_attrs(dev->dma_device, sg, nents, direction,
+                                       dma_attrs);
 }
 
 static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
@@ -3057,7 +3070,12 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
                                         enum dma_data_direction direction,
                                         unsigned long dma_attrs)
 {
-       dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs);
+       if (dev->dma_ops)
+               return dev->dma_ops->unmap_sg_attrs(dev, sg, nents, direction,
+                                                 dma_attrs);
+       else
+               dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction,
+                                  dma_attrs);
 }
 /**
  * ib_sg_dma_address - Return the DMA address from a scatter/gather entry