x86: enable CONFIG_DEBUG_PAGEALLOC more widely
[wrt350n-kernel.git] / include / scsi / libsrp.h
blobba615e4c1d7c324ee93e59c78c17f027c3fb3dd4
1 #ifndef __LIBSRP_H__
2 #define __LIBSRP_H__
4 #include <linux/list.h>
5 #include <scsi/scsi_cmnd.h>
6 #include <scsi/scsi_host.h>
7 #include <scsi/srp.h>
9 enum iue_flags {
10 V_DIOVER,
11 V_WRITE,
12 V_LINKED,
13 V_FLYING,
16 struct srp_buf {
17 dma_addr_t dma;
18 void *buf;
21 struct srp_queue {
22 void *pool;
23 void *items;
24 struct kfifo *queue;
25 spinlock_t lock;
28 struct srp_target {
29 struct Scsi_Host *shost;
30 struct device *dev;
32 spinlock_t lock;
33 struct list_head cmd_queue;
35 size_t srp_iu_size;
36 struct srp_queue iu_queue;
37 size_t rx_ring_size;
38 struct srp_buf **rx_ring;
40 void *ldata;
43 struct iu_entry {
44 struct srp_target *target;
46 struct list_head ilist;
47 dma_addr_t remote_token;
48 unsigned long flags;
50 struct srp_buf *sbuf;
53 typedef int (srp_rdma_t)(struct scsi_cmnd *, struct scatterlist *, int,
54 struct srp_direct_buf *, int,
55 enum dma_data_direction, unsigned int);
56 extern int srp_target_alloc(struct srp_target *, struct device *, size_t, size_t);
57 extern void srp_target_free(struct srp_target *);
59 extern struct iu_entry *srp_iu_get(struct srp_target *);
60 extern void srp_iu_put(struct iu_entry *);
62 extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64, u64);
63 extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *,
64 srp_rdma_t, int, int);
67 static inline struct srp_target *host_to_srp_target(struct Scsi_Host *host)
69 return (struct srp_target *) host->hostdata;
72 static inline int srp_cmd_direction(struct srp_cmd *cmd)
74 return (cmd->buf_fmt >> 4) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
77 #endif