FS-Cache: make check_consistency callback return int
[linux-2.6-block.git] / include / rdma / ib_verbs.h
index dd8e15dfc1a80461f4de55c93843e2208ae32b35..432bed510369e7b19a4773ec5a8bb09b8d9bb1e6 100644 (file)
@@ -220,6 +220,7 @@ enum ib_device_cap_flags {
        IB_DEVICE_ON_DEMAND_PAGING              = (1 << 31),
        IB_DEVICE_SG_GAPS_REG                   = (1ULL << 32),
        IB_DEVICE_VIRTUAL_FUNCTION              = ((u64)1 << 33),
+       IB_DEVICE_RAW_SCATTER_FCS               = ((u64)1 << 34),
 };
 
 enum ib_signature_prot_cap {
@@ -402,56 +403,55 @@ enum ib_port_speed {
        IB_SPEED_EDR    = 32
 };
 
-struct ib_protocol_stats {
-       /* TBD... */
-};
-
-struct iw_protocol_stats {
-       u64     ipInReceives;
-       u64     ipInHdrErrors;
-       u64     ipInTooBigErrors;
-       u64     ipInNoRoutes;
-       u64     ipInAddrErrors;
-       u64     ipInUnknownProtos;
-       u64     ipInTruncatedPkts;
-       u64     ipInDiscards;
-       u64     ipInDelivers;
-       u64     ipOutForwDatagrams;
-       u64     ipOutRequests;
-       u64     ipOutDiscards;
-       u64     ipOutNoRoutes;
-       u64     ipReasmTimeout;
-       u64     ipReasmReqds;
-       u64     ipReasmOKs;
-       u64     ipReasmFails;
-       u64     ipFragOKs;
-       u64     ipFragFails;
-       u64     ipFragCreates;
-       u64     ipInMcastPkts;
-       u64     ipOutMcastPkts;
-       u64     ipInBcastPkts;
-       u64     ipOutBcastPkts;
-
-       u64     tcpRtoAlgorithm;
-       u64     tcpRtoMin;
-       u64     tcpRtoMax;
-       u64     tcpMaxConn;
-       u64     tcpActiveOpens;
-       u64     tcpPassiveOpens;
-       u64     tcpAttemptFails;
-       u64     tcpEstabResets;
-       u64     tcpCurrEstab;
-       u64     tcpInSegs;
-       u64     tcpOutSegs;
-       u64     tcpRetransSegs;
-       u64     tcpInErrs;
-       u64     tcpOutRsts;
-};
-
-union rdma_protocol_stats {
-       struct ib_protocol_stats        ib;
-       struct iw_protocol_stats        iw;
-};
+/**
+ * struct rdma_hw_stats
+ * @timestamp - Used by the core code to track when the last update was
+ * @lifespan - Used by the core code to determine how old the counters
+ *   should be before being updated again.  Stored in jiffies, defaults
+ *   to 10 milliseconds, drivers can override the default be specifying
+ *   their own value during their allocation routine.
+ * @name - Array of pointers to static names used for the counters in
+ *   directory.
+ * @num_counters - How many hardware counters there are.  If name is
+ *   shorter than this number, a kernel oops will result.  Driver authors
+ *   are encouraged to leave BUILD_BUG_ON(ARRAY_SIZE(@name) < num_counters)
+ *   in their code to prevent this.
+ * @value - Array of u64 counters that are accessed by the sysfs code and
+ *   filled in by the drivers get_stats routine
+ */
+struct rdma_hw_stats {
+       unsigned long   timestamp;
+       unsigned long   lifespan;
+       const char * const *names;
+       int             num_counters;
+       u64             value[];
+};
+
+#define RDMA_HW_STATS_DEFAULT_LIFESPAN 10
+/**
+ * rdma_alloc_hw_stats_struct - Helper function to allocate dynamic struct
+ *   for drivers.
+ * @names - Array of static const char *
+ * @num_counters - How many elements in array
+ * @lifespan - How many milliseconds between updates
+ */
+static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct(
+               const char * const *names, int num_counters,
+               unsigned long lifespan)
+{
+       struct rdma_hw_stats *stats;
+
+       stats = kzalloc(sizeof(*stats) + num_counters * sizeof(u64),
+                       GFP_KERNEL);
+       if (!stats)
+               return NULL;
+       stats->names = names;
+       stats->num_counters = num_counters;
+       stats->lifespan = msecs_to_jiffies(lifespan);
+
+       return stats;
+}
+
 
 /* Define bits for the various functionality this port needs to be supported by
  * the core.
@@ -988,6 +988,7 @@ enum ib_qp_create_flags {
        IB_QP_CREATE_NETIF_QP                   = 1 << 5,
        IB_QP_CREATE_SIGNATURE_EN               = 1 << 6,
        IB_QP_CREATE_USE_GFP_NOIO               = 1 << 7,
+       IB_QP_CREATE_SCATTER_FCS                = 1 << 8,
        /* reserve bits 26-31 for low level drivers' internal use */
        IB_QP_CREATE_RESERVED_START             = 1 << 26,
        IB_QP_CREATE_RESERVED_END               = 1 << 31,
@@ -1435,6 +1436,7 @@ struct ib_qp {
        spinlock_t              mr_lock;
        int                     mrs_used;
        struct list_head        rdma_mrs;
+       struct list_head        sig_mrs;
        struct ib_srq          *srq;
        struct ib_xrcd         *xrcd; /* XRC TGT QPs only */
        struct list_head        xrcd_list;
@@ -1704,8 +1706,29 @@ struct ib_device {
 
        struct iw_cm_verbs           *iwcm;
 
-       int                        (*get_protocol_stats)(struct ib_device *device,
-                                                        union rdma_protocol_stats *stats);
+       /**
+        * alloc_hw_stats - Allocate a struct rdma_hw_stats and fill in the
+        *   driver initialized data.  The struct is kfree()'ed by the sysfs
+        *   core when the device is removed.  A lifespan of -1 in the return
+        *   struct tells the core to set a default lifespan.
+        */
+       struct rdma_hw_stats      *(*alloc_hw_stats)(struct ib_device *device,
+                                                    u8 port_num);
+       /**
+        * get_hw_stats - Fill in the counter value(s) in the stats struct.
+        * @index - The index in the value array we wish to have updated, or
+        *   num_counters if we want all stats updated
+        * Return codes -
+        *   < 0 - Error, no counters updated
+        *   index - Updated the single counter pointed to by index
+        *   num_counters - Updated all counters (will reset the timestamp
+        *     and prevent further calls for lifespan milliseconds)
+        * Drivers are allowed to update all counters in leiu of just the
+        *   one given in index at their option
+        */
+       int                        (*get_hw_stats)(struct ib_device *device,
+                                                  struct rdma_hw_stats *stats,
+                                                  u8 port, int index);
        int                        (*query_device)(struct ib_device *device,
                                                   struct ib_device_attr *device_attr,
                                                   struct ib_udata *udata);
@@ -1847,7 +1870,7 @@ struct ib_device {
        int                        (*map_mr_sg)(struct ib_mr *mr,
                                                struct scatterlist *sg,
                                                int sg_nents,
-                                               unsigned sg_offset);
+                                               unsigned int *sg_offset);
        struct ib_mw *             (*alloc_mw)(struct ib_pd *pd,
                                               enum ib_mw_type type,
                                               struct ib_udata *udata);
@@ -1923,6 +1946,8 @@ struct ib_device {
        u8                           node_type;
        u8                           phys_port_cnt;
        struct ib_device_attr        attrs;
+       struct attribute_group       *hw_stats_ag;
+       struct rdma_hw_stats         *hw_stats;
 
        /**
         * The following mandatory functions are used only at device
@@ -3144,11 +3169,11 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port,
                                            const struct sockaddr *addr);
 
 int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
-               unsigned int sg_offset, unsigned int page_size);
+                unsigned int *sg_offset, unsigned int page_size);
 
 static inline int
 ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
-               unsigned int sg_offset, unsigned int page_size)
+                 unsigned int *sg_offset, unsigned int page_size)
 {
        int n;
 
@@ -3159,7 +3184,7 @@ ib_map_mr_sg_zbva(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
 }
 
 int ib_sg_to_pages(struct ib_mr *mr, struct scatterlist *sgl, int sg_nents,
-               unsigned int sg_offset, int (*set_page)(struct ib_mr *, u64));
+               unsigned int *sg_offset, int (*set_page)(struct ib_mr *, u64));
 
 void ib_drain_rq(struct ib_qp *qp);
 void ib_drain_sq(struct ib_qp *qp);