libcxgbi.h 17 KB

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