]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/scsi/cxgbi/libcxgbi.h
Merge tag 'iio-for-4.13b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / cxgbi / libcxgbi.h
CommitLineData
9ba682f0 1/*
2 * libcxgbi.h: Chelsio common library for T3/T4 iSCSI driver.
3 *
1149a5ed 4 * Copyright (c) 2010-2015 Chelsio Communications, Inc.
9ba682f0 5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation.
9 *
10 * Written by: Karen Xie (kxie@chelsio.com)
11 * Written by: Rakesh Ranjan (rranjan@chelsio.com)
12 */
13
14#ifndef __LIBCXGBI_H__
15#define __LIBCXGBI_H__
16
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/types.h>
20#include <linux/debugfs.h>
21#include <linux/list.h>
22#include <linux/netdevice.h>
23#include <linux/if_vlan.h>
24#include <linux/scatterlist.h>
25#include <linux/skbuff.h>
26#include <linux/vmalloc.h>
71f7a00b 27#include <linux/version.h>
9ba682f0 28#include <scsi/scsi_device.h>
29#include <scsi/libiscsi_tcp.h>
30
71f7a00b
VP
31#include <libcxgb_ppm.h>
32
9ba682f0 33enum cxgbi_dbg_flag {
34 CXGBI_DBG_ISCSI,
35 CXGBI_DBG_DDP,
36 CXGBI_DBG_TOE,
37 CXGBI_DBG_SOCK,
38
39 CXGBI_DBG_PDU_TX,
40 CXGBI_DBG_PDU_RX,
41 CXGBI_DBG_DEV,
42};
43
44#define log_debug(level, fmt, ...) \
45 do { \
46 if (dbg_level & (level)) \
47 pr_info(fmt, ##__VA_ARGS__); \
48 } while (0)
49
fc8d0590
AB
50#define pr_info_ipaddr(fmt_trail, \
51 addr1, addr2, args_trail...) \
52do { \
53 if (!((1 << CXGBI_DBG_SOCK) & dbg_level)) \
54 break; \
55 pr_info("%pISpc - %pISpc, " fmt_trail, \
56 addr1, addr2, args_trail); \
57} while (0)
58
9ba682f0 59/* max. connections per adapter */
60#define CXGBI_MAX_CONN 16384
61
62/* always allocate rooms for AHS */
63#define SKB_TX_ISCSI_PDU_HEADER_MAX \
64 (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE)
65
66#define ISCSI_PDU_NONPAYLOAD_LEN 312 /* bhs(48) + ahs(256) + digest(8)*/
67
68/*
69 * align pdu size to multiple of 512 for better performance
70 */
71#define cxgbi_align_pdu_size(n) do { n = (n) & (~511); } while (0)
72
73#define ULP2_MODE_ISCSI 2
74
75#define ULP2_MAX_PKT_SIZE 16224
76#define ULP2_MAX_PDU_PAYLOAD \
77 (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_LEN)
78
79/*
80 * For iscsi connections HW may inserts digest bytes into the pdu. Those digest
81 * bytes are not sent by the host but are part of the TCP payload and therefore
82 * consume TCP sequence space.
83 */
84static const unsigned int ulp2_extra_len[] = { 0, 4, 4, 8 };
85static inline unsigned int cxgbi_ulp_extra_len(int submode)
86{
87 return ulp2_extra_len[submode & 3];
88}
89
9ba682f0 90#define CPL_RX_DDP_STATUS_DDP_SHIFT 16 /* ddp'able */
91#define CPL_RX_DDP_STATUS_PAD_SHIFT 19 /* pad error */
92#define CPL_RX_DDP_STATUS_HCRC_SHIFT 20 /* hcrc error */
93#define CPL_RX_DDP_STATUS_DCRC_SHIFT 21 /* dcrc error */
94
9ba682f0 95/*
96 * sge_opaque_hdr -
97 * Opaque version of structure the SGE stores at skb->head of TX_DATA packets
98 * and for which we must reserve space.
99 */
100struct sge_opaque_hdr {
101 void *dev;
102 dma_addr_t addr[MAX_SKB_FRAGS + 1];
103};
104
105struct cxgbi_sock {
106 struct cxgbi_device *cdev;
107
108 int tid;
109 int atid;
110 unsigned long flags;
111 unsigned int mtu;
112 unsigned short rss_qid;
113 unsigned short txq_idx;
114 unsigned short advmss;
115 unsigned int tx_chan;
116 unsigned int rx_chan;
117 unsigned int mss_idx;
118 unsigned int smac_idx;
119 unsigned char port_id;
120 int wr_max_cred;
121 int wr_cred;
122 int wr_una_cred;
123 unsigned char hcrc_len;
124 unsigned char dcrc_len;
125
126 void *l2t;
127 struct sk_buff *wr_pending_head;
128 struct sk_buff *wr_pending_tail;
129 struct sk_buff *cpl_close;
130 struct sk_buff *cpl_abort_req;
131 struct sk_buff *cpl_abort_rpl;
132 struct sk_buff *skb_ulp_lhdr;
133 spinlock_t lock;
134 struct kref refcnt;
135 unsigned int state;
fc8d0590
AB
136 unsigned int csk_family;
137 union {
138 struct sockaddr_in saddr;
139 struct sockaddr_in6 saddr6;
140 };
141 union {
142 struct sockaddr_in daddr;
143 struct sockaddr_in6 daddr6;
144 };
9ba682f0 145 struct dst_entry *dst;
146 struct sk_buff_head receive_queue;
147 struct sk_buff_head write_queue;
148 struct timer_list retry_timer;
149 int err;
150 rwlock_t callback_lock;
151 void *user_data;
152
153 u32 rcv_nxt;
154 u32 copied_seq;
155 u32 rcv_wup;
156 u32 snd_nxt;
157 u32 snd_una;
158 u32 write_seq;
81daf10c
KX
159 u32 snd_win;
160 u32 rcv_win;
9ba682f0 161};
162
163/*
164 * connection states
165 */
166enum cxgbi_sock_states{
167 CTP_CLOSED,
168 CTP_CONNECTING,
169 CTP_ACTIVE_OPEN,
170 CTP_ESTABLISHED,
171 CTP_ACTIVE_CLOSE,
172 CTP_PASSIVE_CLOSE,
173 CTP_CLOSE_WAIT_1,
174 CTP_CLOSE_WAIT_2,
175 CTP_ABORTING,
176};
177
178/*
179 * Connection flags -- many to track some close related events.
180 */
181enum cxgbi_sock_flags {
182 CTPF_ABORT_RPL_RCVD, /*received one ABORT_RPL_RSS message */
183 CTPF_ABORT_REQ_RCVD, /*received one ABORT_REQ_RSS message */
184 CTPF_ABORT_RPL_PENDING, /* expecting an abort reply */
185 CTPF_TX_DATA_SENT, /* already sent a TX_DATA WR */
186 CTPF_ACTIVE_CLOSE_NEEDED,/* need to be closed */
187 CTPF_HAS_ATID, /* reserved atid */
188 CTPF_HAS_TID, /* reserved hw tid */
189 CTPF_OFFLOAD_DOWN, /* offload function off */
e0f8e8cf 190 CTPF_LOGOUT_RSP_RCVD, /* received logout response */
9ba682f0 191};
192
193struct cxgbi_skb_rx_cb {
194 __u32 ddigest;
195 __u32 pdulen;
196};
197
198struct cxgbi_skb_tx_cb {
75b61250
VP
199 void *handle;
200 void *arp_err_handler;
9ba682f0 201 struct sk_buff *wr_next;
202};
203
204enum cxgbi_skcb_flags {
205 SKCBF_TX_NEED_HDR, /* packet needs a header */
71f7a00b
VP
206 SKCBF_TX_MEM_WRITE, /* memory write */
207 SKCBF_TX_FLAG_COMPL, /* wr completion flag */
75b61250 208 SKCBF_TX_DONE, /* skb tx done */
9ba682f0 209 SKCBF_RX_COALESCED, /* received whole pdu */
25985edc
LDM
210 SKCBF_RX_HDR, /* received pdu header */
211 SKCBF_RX_DATA, /* received pdu payload */
212 SKCBF_RX_STATUS, /* received ddp status */
44830d8f 213 SKCBF_RX_ISCSI_COMPL, /* received iscsi completion */
9ba682f0 214 SKCBF_RX_DATA_DDPD, /* pdu payload ddp'd */
215 SKCBF_RX_HCRC_ERR, /* header digest error */
216 SKCBF_RX_DCRC_ERR, /* data digest error */
217 SKCBF_RX_PAD_ERR, /* padding byte error */
218};
219
220struct cxgbi_skb_cb {
9ba682f0 221 union {
222 struct cxgbi_skb_rx_cb rx;
223 struct cxgbi_skb_tx_cb tx;
224 };
75b61250
VP
225 unsigned char ulp_mode;
226 unsigned long flags;
227 unsigned int seq;
9ba682f0 228};
229
230#define CXGBI_SKB_CB(skb) ((struct cxgbi_skb_cb *)&((skb)->cb[0]))
231#define cxgbi_skcb_flags(skb) (CXGBI_SKB_CB(skb)->flags)
232#define cxgbi_skcb_ulp_mode(skb) (CXGBI_SKB_CB(skb)->ulp_mode)
233#define cxgbi_skcb_tcp_seq(skb) (CXGBI_SKB_CB(skb)->seq)
234#define cxgbi_skcb_rx_ddigest(skb) (CXGBI_SKB_CB(skb)->rx.ddigest)
235#define cxgbi_skcb_rx_pdulen(skb) (CXGBI_SKB_CB(skb)->rx.pdulen)
236#define cxgbi_skcb_tx_wr_next(skb) (CXGBI_SKB_CB(skb)->tx.wr_next)
237
238static inline void cxgbi_skcb_set_flag(struct sk_buff *skb,
239 enum cxgbi_skcb_flags flag)
240{
241 __set_bit(flag, &(cxgbi_skcb_flags(skb)));
242}
243
244static inline void cxgbi_skcb_clear_flag(struct sk_buff *skb,
245 enum cxgbi_skcb_flags flag)
246{
247 __clear_bit(flag, &(cxgbi_skcb_flags(skb)));
248}
249
84944d8c
KX
250static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
251 enum cxgbi_skcb_flags flag)
9ba682f0 252{
253 return test_bit(flag, &(cxgbi_skcb_flags(skb)));
254}
255
256static inline void cxgbi_sock_set_flag(struct cxgbi_sock *csk,
257 enum cxgbi_sock_flags flag)
258{
259 __set_bit(flag, &csk->flags);
260 log_debug(1 << CXGBI_DBG_SOCK,
261 "csk 0x%p,%u,0x%lx, bit %d.\n",
262 csk, csk->state, csk->flags, flag);
263}
264
265static inline void cxgbi_sock_clear_flag(struct cxgbi_sock *csk,
266 enum cxgbi_sock_flags flag)
267{
268 __clear_bit(flag, &csk->flags);
269 log_debug(1 << CXGBI_DBG_SOCK,
270 "csk 0x%p,%u,0x%lx, bit %d.\n",
271 csk, csk->state, csk->flags, flag);
272}
273
274static inline int cxgbi_sock_flag(struct cxgbi_sock *csk,
275 enum cxgbi_sock_flags flag)
276{
277 if (csk == NULL)
278 return 0;
279 return test_bit(flag, &csk->flags);
280}
281
282static inline void cxgbi_sock_set_state(struct cxgbi_sock *csk, int state)
283{
284 log_debug(1 << CXGBI_DBG_SOCK,
285 "csk 0x%p,%u,0x%lx, state -> %u.\n",
286 csk, csk->state, csk->flags, state);
287 csk->state = state;
288}
289
290static inline void cxgbi_sock_free(struct kref *kref)
291{
292 struct cxgbi_sock *csk = container_of(kref,
293 struct cxgbi_sock,
294 refcnt);
295 if (csk) {
296 log_debug(1 << CXGBI_DBG_SOCK,
297 "free csk 0x%p, state %u, flags 0x%lx\n",
298 csk, csk->state, csk->flags);
299 kfree(csk);
300 }
301}
302
303static inline void __cxgbi_sock_put(const char *fn, struct cxgbi_sock *csk)
304{
305 log_debug(1 << CXGBI_DBG_SOCK,
306 "%s, put csk 0x%p, ref %u-1.\n",
2c935bc5 307 fn, csk, kref_read(&csk->refcnt));
9ba682f0 308 kref_put(&csk->refcnt, cxgbi_sock_free);
309}
310#define cxgbi_sock_put(csk) __cxgbi_sock_put(__func__, csk)
311
312static inline void __cxgbi_sock_get(const char *fn, struct cxgbi_sock *csk)
313{
314 log_debug(1 << CXGBI_DBG_SOCK,
315 "%s, get csk 0x%p, ref %u+1.\n",
2c935bc5 316 fn, csk, kref_read(&csk->refcnt));
9ba682f0 317 kref_get(&csk->refcnt);
318}
319#define cxgbi_sock_get(csk) __cxgbi_sock_get(__func__, csk)
320
321static inline int cxgbi_sock_is_closing(struct cxgbi_sock *csk)
322{
323 return csk->state >= CTP_ACTIVE_CLOSE;
324}
325
326static inline int cxgbi_sock_is_established(struct cxgbi_sock *csk)
327{
328 return csk->state == CTP_ESTABLISHED;
329}
330
331static inline void cxgbi_sock_purge_write_queue(struct cxgbi_sock *csk)
332{
333 struct sk_buff *skb;
334
335 while ((skb = __skb_dequeue(&csk->write_queue)))
336 __kfree_skb(skb);
337}
338
339static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)
340{
341 unsigned int wscale = 0;
342
343 while (wscale < 14 && (65535 << wscale) < win)
344 wscale++;
345 return wscale;
346}
347
24d3f95a 348static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp)
9ba682f0 349{
9ba682f0 350 struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);
351
352 if (skb) {
353 __skb_put(skb, wrlen);
354 memset(skb->head, 0, wrlen + dlen);
355 } else
24d3f95a 356 pr_info("alloc cpl wr skb %u+%u, OOM.\n", wrlen, dlen);
9ba682f0 357 return skb;
358}
359
360
361/*
362 * The number of WRs needed for an skb depends on the number of fragments
363 * in the skb and whether it has any payload in its main body. This maps the
364 * length of the gather list represented by an skb into the # of necessary WRs.
365 * The extra two fragments are for iscsi bhs and payload padding.
366 */
367#define SKB_WR_LIST_SIZE (MAX_SKB_FRAGS + 2)
368
369static inline void cxgbi_sock_reset_wr_list(struct cxgbi_sock *csk)
370{
371 csk->wr_pending_head = csk->wr_pending_tail = NULL;
372}
373
374static inline void cxgbi_sock_enqueue_wr(struct cxgbi_sock *csk,
375 struct sk_buff *skb)
376{
377 cxgbi_skcb_tx_wr_next(skb) = NULL;
378 /*
379 * We want to take an extra reference since both us and the driver
75b61250 380 * need to free the packet before it's really freed.
9ba682f0 381 */
75b61250 382 skb_get(skb);
9ba682f0 383
384 if (!csk->wr_pending_head)
385 csk->wr_pending_head = skb;
386 else
387 cxgbi_skcb_tx_wr_next(csk->wr_pending_tail) = skb;
388 csk->wr_pending_tail = skb;
389}
390
391static inline int cxgbi_sock_count_pending_wrs(const struct cxgbi_sock *csk)
392{
393 int n = 0;
394 const struct sk_buff *skb = csk->wr_pending_head;
395
396 while (skb) {
397 n += skb->csum;
398 skb = cxgbi_skcb_tx_wr_next(skb);
399 }
400 return n;
401}
402
403static inline struct sk_buff *cxgbi_sock_peek_wr(const struct cxgbi_sock *csk)
404{
405 return csk->wr_pending_head;
406}
407
408static inline struct sk_buff *cxgbi_sock_dequeue_wr(struct cxgbi_sock *csk)
409{
410 struct sk_buff *skb = csk->wr_pending_head;
411
412 if (likely(skb)) {
413 csk->wr_pending_head = cxgbi_skcb_tx_wr_next(skb);
414 cxgbi_skcb_tx_wr_next(skb) = NULL;
415 }
416 return skb;
417}
418
419void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *);
420void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *);
421void cxgbi_sock_skb_entail(struct cxgbi_sock *, struct sk_buff *);
422void cxgbi_sock_fail_act_open(struct cxgbi_sock *, int);
423void cxgbi_sock_act_open_req_arp_failure(void *, struct sk_buff *);
424void cxgbi_sock_closed(struct cxgbi_sock *);
425void cxgbi_sock_established(struct cxgbi_sock *, unsigned int, unsigned int);
426void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *);
427void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *);
428void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *, u32);
429void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *, unsigned int, unsigned int,
430 int);
431unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *, unsigned int);
432void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *);
433
434struct cxgbi_hba {
435 struct net_device *ndev;
0b3d8947 436 struct net_device *vdev; /* vlan dev */
9ba682f0 437 struct Scsi_Host *shost;
438 struct cxgbi_device *cdev;
439 __be32 ipv4addr;
440 unsigned char port_id;
441};
442
443struct cxgbi_ports_map {
444 unsigned int max_connect;
445 unsigned int used;
446 unsigned short sport_base;
447 spinlock_t lock;
448 unsigned int next;
449 struct cxgbi_sock **port_csk;
450};
451
452#define CXGBI_FLAG_DEV_T3 0x1
453#define CXGBI_FLAG_DEV_T4 0x2
454#define CXGBI_FLAG_ADAPTER_RESET 0x4
455#define CXGBI_FLAG_IPV4_SET 0x10
71f7a00b
VP
456#define CXGBI_FLAG_USE_PPOD_OFLDQ 0x40
457#define CXGBI_FLAG_DDP_OFF 0x100
458
9ba682f0 459struct cxgbi_device {
460 struct list_head list_head;
078efae0 461 struct list_head rcu_node;
9ba682f0 462 unsigned int flags;
463 struct net_device **ports;
464 void *lldev;
465 struct cxgbi_hba **hbas;
466 const unsigned short *mtus;
467 unsigned char nmtus;
468 unsigned char nports;
469 struct pci_dev *pdev;
470 struct dentry *debugfs_root;
471 struct iscsi_transport *itp;
1fe1fdb0 472 struct module *owner;
9ba682f0 473
474 unsigned int pfvf;
9ba682f0 475 unsigned int rx_credit_thres;
476 unsigned int skb_tx_rsvd;
477 unsigned int skb_rx_extra; /* for msg coalesced mode */
478 unsigned int tx_max_size;
479 unsigned int rx_max_size;
480 struct cxgbi_ports_map pmap;
9ba682f0 481
482 void (*dev_ddp_cleanup)(struct cxgbi_device *);
71f7a00b
VP
483 struct cxgbi_ppm* (*cdev2ppm)(struct cxgbi_device *);
484 int (*csk_ddp_set_map)(struct cxgbi_ppm *, struct cxgbi_sock *,
485 struct cxgbi_task_tag_info *);
486 void (*csk_ddp_clear_map)(struct cxgbi_device *cdev,
487 struct cxgbi_ppm *,
488 struct cxgbi_task_tag_info *);
9ba682f0 489 int (*csk_ddp_setup_digest)(struct cxgbi_sock *,
490 unsigned int, int, int, int);
491 int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *,
492 unsigned int, int, bool);
493
494 void (*csk_release_offload_resources)(struct cxgbi_sock *);
495 int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *);
496 u32 (*csk_send_rx_credits)(struct cxgbi_sock *, u32);
497 int (*csk_push_tx_frames)(struct cxgbi_sock *, int);
498 void (*csk_send_abort_req)(struct cxgbi_sock *);
499 void (*csk_send_close_req)(struct cxgbi_sock *);
500 int (*csk_alloc_cpls)(struct cxgbi_sock *);
501 int (*csk_init_act_open)(struct cxgbi_sock *);
502
503 void *dd_data;
504};
505#define cxgbi_cdev_priv(cdev) ((cdev)->dd_data)
506
507struct cxgbi_conn {
508 struct cxgbi_endpoint *cep;
509 struct iscsi_conn *iconn;
510 struct cxgbi_hba *chba;
511 u32 task_idx_bits;
71f7a00b
VP
512 unsigned int ddp_full;
513 unsigned int ddp_tag_full;
9ba682f0 514};
515
516struct cxgbi_endpoint {
517 struct cxgbi_conn *cconn;
518 struct cxgbi_hba *chba;
519 struct cxgbi_sock *csk;
520};
521
522#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
523struct cxgbi_task_data {
524 unsigned short nr_frags;
6a39a16a 525 struct page_frag frags[MAX_PDU_FRAGS];
9ba682f0 526 struct sk_buff *skb;
71f7a00b 527 unsigned int dlen;
9ba682f0 528 unsigned int offset;
529 unsigned int count;
530 unsigned int sgoffset;
71f7a00b 531 struct cxgbi_task_tag_info ttinfo;
9ba682f0 532};
e3d2ad8c 533#define iscsi_task_cxgbi_data(task) \
534 ((task)->dd_data + sizeof(struct iscsi_tcp_task))
9ba682f0 535
9ba682f0 536static inline void *cxgbi_alloc_big_mem(unsigned int size,
537 gfp_t gfp)
538{
8be04b93
JP
539 void *p = kzalloc(size, gfp | __GFP_NOWARN);
540
9ba682f0 541 if (!p)
8be04b93
JP
542 p = vzalloc(size);
543
9ba682f0 544 return p;
545}
546
547static inline void cxgbi_free_big_mem(void *addr)
548{
32a78fac 549 kvfree(addr);
9ba682f0 550}
551
552static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr)
553{
554 if (chba->cdev->flags & CXGBI_FLAG_IPV4_SET)
555 chba->ipv4addr = ipaddr;
556 else
557 pr_info("set iscsi ipv4 NOT supported, using %s ipv4.\n",
558 chba->ndev->name);
559}
560
9ba682f0 561struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int);
562void cxgbi_device_unregister(struct cxgbi_device *);
563void cxgbi_device_unregister_all(unsigned int flag);
564struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
fc8d0590 565struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
078efae0
AB
566struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
567 int *);
1abf635d 568int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
9ba682f0 569 struct scsi_host_template *,
570 struct scsi_transport_template *);
571void cxgbi_hbas_remove(struct cxgbi_device *);
572
573int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
574 unsigned int max_conn);
575void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev);
576
577void cxgbi_conn_tx_open(struct cxgbi_sock *);
578void cxgbi_conn_pdu_ready(struct cxgbi_sock *);
579int cxgbi_conn_alloc_pdu(struct iscsi_task *, u8);
580int cxgbi_conn_init_pdu(struct iscsi_task *, unsigned int , unsigned int);
581int cxgbi_conn_xmit_pdu(struct iscsi_task *);
582
583void cxgbi_cleanup_task(struct iscsi_task *task);
584
587a1f16 585umode_t cxgbi_attr_is_visible(int param_type, int param);
9ba682f0 586void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
587int cxgbi_set_conn_param(struct iscsi_cls_conn *,
588 enum iscsi_param, char *, int);
c71b9b66 589int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param, char *);
9ba682f0 590struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32);
591int cxgbi_bind_conn(struct iscsi_cls_session *,
592 struct iscsi_cls_conn *, u64, int);
593void cxgbi_destroy_session(struct iscsi_cls_session *);
594struct iscsi_cls_session *cxgbi_create_session(struct iscsi_endpoint *,
595 u16, u16, u32);
596int cxgbi_set_host_param(struct Scsi_Host *,
597 enum iscsi_host_param, char *, int);
598int cxgbi_get_host_param(struct Scsi_Host *, enum iscsi_host_param, char *);
599struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *,
600 struct sockaddr *, int);
601int cxgbi_ep_poll(struct iscsi_endpoint *, int);
602void cxgbi_ep_disconnect(struct iscsi_endpoint *);
603
604int cxgbi_iscsi_init(struct iscsi_transport *,
605 struct scsi_transport_template **);
606void cxgbi_iscsi_cleanup(struct iscsi_transport *,
607 struct scsi_transport_template **);
608void cxgbi_parse_pdu_itt(struct iscsi_conn *, itt_t, int *, int *);
609int cxgbi_ddp_init(struct cxgbi_device *, unsigned int, unsigned int,
610 unsigned int, unsigned int);
611int cxgbi_ddp_cleanup(struct cxgbi_device *);
612void cxgbi_ddp_page_size_factor(int *);
71f7a00b
VP
613void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *,
614 struct cxgbi_task_tag_info *,
615 struct scatterlist **sg_pp, unsigned int *sg_off);
616void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *,
617 struct cxgbi_tag_format *, unsigned int ppmax,
618 unsigned int llimit, unsigned int start,
619 unsigned int rsvd_factor);
9ba682f0 620#endif /*__LIBCXGBI_H__*/