libcxgbi.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  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. int err;
  131. rwlock_t callback_lock;
  132. void *user_data;
  133. u32 rcv_nxt;
  134. u32 copied_seq;
  135. u32 rcv_wup;
  136. u32 snd_nxt;
  137. u32 snd_una;
  138. u32 write_seq;
  139. u32 snd_win;
  140. u32 rcv_win;
  141. };
  142. /*
  143. * connection states
  144. */
  145. enum cxgbi_sock_states{
  146. CTP_CLOSED,
  147. CTP_CONNECTING,
  148. CTP_ACTIVE_OPEN,
  149. CTP_ESTABLISHED,
  150. CTP_ACTIVE_CLOSE,
  151. CTP_PASSIVE_CLOSE,
  152. CTP_CLOSE_WAIT_1,
  153. CTP_CLOSE_WAIT_2,
  154. CTP_ABORTING,
  155. };
  156. /*
  157. * Connection flags -- many to track some close related events.
  158. */
  159. enum cxgbi_sock_flags {
  160. CTPF_ABORT_RPL_RCVD, /*received one ABORT_RPL_RSS message */
  161. CTPF_ABORT_REQ_RCVD, /*received one ABORT_REQ_RSS message */
  162. CTPF_ABORT_RPL_PENDING, /* expecting an abort reply */
  163. CTPF_TX_DATA_SENT, /* already sent a TX_DATA WR */
  164. CTPF_ACTIVE_CLOSE_NEEDED,/* need to be closed */
  165. CTPF_HAS_ATID, /* reserved atid */
  166. CTPF_HAS_TID, /* reserved hw tid */
  167. CTPF_OFFLOAD_DOWN, /* offload function off */
  168. };
  169. struct cxgbi_skb_rx_cb {
  170. __u32 ddigest;
  171. __u32 pdulen;
  172. };
  173. struct cxgbi_skb_tx_cb {
  174. void *l2t;
  175. struct sk_buff *wr_next;
  176. };
  177. enum cxgbi_skcb_flags {
  178. SKCBF_TX_NEED_HDR, /* packet needs a header */
  179. SKCBF_TX_MEM_WRITE, /* memory write */
  180. SKCBF_TX_FLAG_COMPL, /* wr completion flag */
  181. SKCBF_RX_COALESCED, /* received whole pdu */
  182. SKCBF_RX_HDR, /* received pdu header */
  183. SKCBF_RX_DATA, /* received pdu payload */
  184. SKCBF_RX_STATUS, /* received ddp status */
  185. SKCBF_RX_DATA_DDPD, /* pdu payload ddp'd */
  186. SKCBF_RX_HCRC_ERR, /* header digest error */
  187. SKCBF_RX_DCRC_ERR, /* data digest error */
  188. SKCBF_RX_PAD_ERR, /* padding byte error */
  189. };
  190. struct cxgbi_skb_cb {
  191. unsigned char ulp_mode;
  192. unsigned long flags;
  193. unsigned int seq;
  194. union {
  195. struct cxgbi_skb_rx_cb rx;
  196. struct cxgbi_skb_tx_cb tx;
  197. };
  198. };
  199. #define CXGBI_SKB_CB(skb) ((struct cxgbi_skb_cb *)&((skb)->cb[0]))
  200. #define cxgbi_skcb_flags(skb) (CXGBI_SKB_CB(skb)->flags)
  201. #define cxgbi_skcb_ulp_mode(skb) (CXGBI_SKB_CB(skb)->ulp_mode)
  202. #define cxgbi_skcb_tcp_seq(skb) (CXGBI_SKB_CB(skb)->seq)
  203. #define cxgbi_skcb_rx_ddigest(skb) (CXGBI_SKB_CB(skb)->rx.ddigest)
  204. #define cxgbi_skcb_rx_pdulen(skb) (CXGBI_SKB_CB(skb)->rx.pdulen)
  205. #define cxgbi_skcb_tx_wr_next(skb) (CXGBI_SKB_CB(skb)->tx.wr_next)
  206. static inline void cxgbi_skcb_set_flag(struct sk_buff *skb,
  207. enum cxgbi_skcb_flags flag)
  208. {
  209. __set_bit(flag, &(cxgbi_skcb_flags(skb)));
  210. }
  211. static inline void cxgbi_skcb_clear_flag(struct sk_buff *skb,
  212. enum cxgbi_skcb_flags flag)
  213. {
  214. __clear_bit(flag, &(cxgbi_skcb_flags(skb)));
  215. }
  216. static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
  217. enum cxgbi_skcb_flags flag)
  218. {
  219. return test_bit(flag, &(cxgbi_skcb_flags(skb)));
  220. }
  221. static inline void cxgbi_sock_set_flag(struct cxgbi_sock *csk,
  222. enum cxgbi_sock_flags flag)
  223. {
  224. __set_bit(flag, &csk->flags);
  225. log_debug(1 << CXGBI_DBG_SOCK,
  226. "csk 0x%p,%u,0x%lx, bit %d.\n",
  227. csk, csk->state, csk->flags, flag);
  228. }
  229. static inline void cxgbi_sock_clear_flag(struct cxgbi_sock *csk,
  230. enum cxgbi_sock_flags flag)
  231. {
  232. __clear_bit(flag, &csk->flags);
  233. log_debug(1 << CXGBI_DBG_SOCK,
  234. "csk 0x%p,%u,0x%lx, bit %d.\n",
  235. csk, csk->state, csk->flags, flag);
  236. }
  237. static inline int cxgbi_sock_flag(struct cxgbi_sock *csk,
  238. enum cxgbi_sock_flags flag)
  239. {
  240. if (csk == NULL)
  241. return 0;
  242. return test_bit(flag, &csk->flags);
  243. }
  244. static inline void cxgbi_sock_set_state(struct cxgbi_sock *csk, int state)
  245. {
  246. log_debug(1 << CXGBI_DBG_SOCK,
  247. "csk 0x%p,%u,0x%lx, state -> %u.\n",
  248. csk, csk->state, csk->flags, state);
  249. csk->state = state;
  250. }
  251. static inline void cxgbi_sock_free(struct kref *kref)
  252. {
  253. struct cxgbi_sock *csk = container_of(kref,
  254. struct cxgbi_sock,
  255. refcnt);
  256. if (csk) {
  257. log_debug(1 << CXGBI_DBG_SOCK,
  258. "free csk 0x%p, state %u, flags 0x%lx\n",
  259. csk, csk->state, csk->flags);
  260. kfree(csk);
  261. }
  262. }
  263. static inline void __cxgbi_sock_put(const char *fn, struct cxgbi_sock *csk)
  264. {
  265. log_debug(1 << CXGBI_DBG_SOCK,
  266. "%s, put csk 0x%p, ref %u-1.\n",
  267. fn, csk, atomic_read(&csk->refcnt.refcount));
  268. kref_put(&csk->refcnt, cxgbi_sock_free);
  269. }
  270. #define cxgbi_sock_put(csk) __cxgbi_sock_put(__func__, csk)
  271. static inline void __cxgbi_sock_get(const char *fn, struct cxgbi_sock *csk)
  272. {
  273. log_debug(1 << CXGBI_DBG_SOCK,
  274. "%s, get csk 0x%p, ref %u+1.\n",
  275. fn, csk, atomic_read(&csk->refcnt.refcount));
  276. kref_get(&csk->refcnt);
  277. }
  278. #define cxgbi_sock_get(csk) __cxgbi_sock_get(__func__, csk)
  279. static inline int cxgbi_sock_is_closing(struct cxgbi_sock *csk)
  280. {
  281. return csk->state >= CTP_ACTIVE_CLOSE;
  282. }
  283. static inline int cxgbi_sock_is_established(struct cxgbi_sock *csk)
  284. {
  285. return csk->state == CTP_ESTABLISHED;
  286. }
  287. static inline void cxgbi_sock_purge_write_queue(struct cxgbi_sock *csk)
  288. {
  289. struct sk_buff *skb;
  290. while ((skb = __skb_dequeue(&csk->write_queue)))
  291. __kfree_skb(skb);
  292. }
  293. static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)
  294. {
  295. unsigned int wscale = 0;
  296. while (wscale < 14 && (65535 << wscale) < win)
  297. wscale++;
  298. return wscale;
  299. }
  300. static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp)
  301. {
  302. struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);
  303. if (skb) {
  304. __skb_put(skb, wrlen);
  305. memset(skb->head, 0, wrlen + dlen);
  306. } else
  307. pr_info("alloc cpl wr skb %u+%u, OOM.\n", wrlen, dlen);
  308. return skb;
  309. }
  310. /*
  311. * The number of WRs needed for an skb depends on the number of fragments
  312. * in the skb and whether it has any payload in its main body. This maps the
  313. * length of the gather list represented by an skb into the # of necessary WRs.
  314. * The extra two fragments are for iscsi bhs and payload padding.
  315. */
  316. #define SKB_WR_LIST_SIZE (MAX_SKB_FRAGS + 2)
  317. static inline void cxgbi_sock_reset_wr_list(struct cxgbi_sock *csk)
  318. {
  319. csk->wr_pending_head = csk->wr_pending_tail = NULL;
  320. }
  321. static inline void cxgbi_sock_enqueue_wr(struct cxgbi_sock *csk,
  322. struct sk_buff *skb)
  323. {
  324. cxgbi_skcb_tx_wr_next(skb) = NULL;
  325. /*
  326. * We want to take an extra reference since both us and the driver
  327. * need to free the packet before it's really freed. We know there's
  328. * just one user currently so we use atomic_set rather than skb_get
  329. * to avoid the atomic op.
  330. */
  331. atomic_set(&skb->users, 2);
  332. if (!csk->wr_pending_head)
  333. csk->wr_pending_head = skb;
  334. else
  335. cxgbi_skcb_tx_wr_next(csk->wr_pending_tail) = skb;
  336. csk->wr_pending_tail = skb;
  337. }
  338. static inline int cxgbi_sock_count_pending_wrs(const struct cxgbi_sock *csk)
  339. {
  340. int n = 0;
  341. const struct sk_buff *skb = csk->wr_pending_head;
  342. while (skb) {
  343. n += skb->csum;
  344. skb = cxgbi_skcb_tx_wr_next(skb);
  345. }
  346. return n;
  347. }
  348. static inline struct sk_buff *cxgbi_sock_peek_wr(const struct cxgbi_sock *csk)
  349. {
  350. return csk->wr_pending_head;
  351. }
  352. static inline struct sk_buff *cxgbi_sock_dequeue_wr(struct cxgbi_sock *csk)
  353. {
  354. struct sk_buff *skb = csk->wr_pending_head;
  355. if (likely(skb)) {
  356. csk->wr_pending_head = cxgbi_skcb_tx_wr_next(skb);
  357. cxgbi_skcb_tx_wr_next(skb) = NULL;
  358. }
  359. return skb;
  360. }
  361. void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *);
  362. void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *);
  363. void cxgbi_sock_skb_entail(struct cxgbi_sock *, struct sk_buff *);
  364. void cxgbi_sock_fail_act_open(struct cxgbi_sock *, int);
  365. void cxgbi_sock_act_open_req_arp_failure(void *, struct sk_buff *);
  366. void cxgbi_sock_closed(struct cxgbi_sock *);
  367. void cxgbi_sock_established(struct cxgbi_sock *, unsigned int, unsigned int);
  368. void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *);
  369. void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *);
  370. void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *, u32);
  371. void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *, unsigned int, unsigned int,
  372. int);
  373. unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *, unsigned int);
  374. void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *);
  375. struct cxgbi_hba {
  376. struct net_device *ndev;
  377. struct net_device *vdev; /* vlan dev */
  378. struct Scsi_Host *shost;
  379. struct cxgbi_device *cdev;
  380. __be32 ipv4addr;
  381. unsigned char port_id;
  382. };
  383. struct cxgbi_ports_map {
  384. unsigned int max_connect;
  385. unsigned int used;
  386. unsigned short sport_base;
  387. spinlock_t lock;
  388. unsigned int next;
  389. struct cxgbi_sock **port_csk;
  390. };
  391. #define CXGBI_FLAG_DEV_T3 0x1
  392. #define CXGBI_FLAG_DEV_T4 0x2
  393. #define CXGBI_FLAG_ADAPTER_RESET 0x4
  394. #define CXGBI_FLAG_IPV4_SET 0x10
  395. #define CXGBI_FLAG_USE_PPOD_OFLDQ 0x40
  396. #define CXGBI_FLAG_DDP_OFF 0x100
  397. struct cxgbi_device {
  398. struct list_head list_head;
  399. struct list_head rcu_node;
  400. unsigned int flags;
  401. struct net_device **ports;
  402. void *lldev;
  403. struct cxgbi_hba **hbas;
  404. const unsigned short *mtus;
  405. unsigned char nmtus;
  406. unsigned char nports;
  407. struct pci_dev *pdev;
  408. struct dentry *debugfs_root;
  409. struct iscsi_transport *itp;
  410. unsigned int pfvf;
  411. unsigned int rx_credit_thres;
  412. unsigned int skb_tx_rsvd;
  413. unsigned int skb_rx_extra; /* for msg coalesced mode */
  414. unsigned int tx_max_size;
  415. unsigned int rx_max_size;
  416. struct cxgbi_ports_map pmap;
  417. void (*dev_ddp_cleanup)(struct cxgbi_device *);
  418. struct cxgbi_ppm* (*cdev2ppm)(struct cxgbi_device *);
  419. int (*csk_ddp_set_map)(struct cxgbi_ppm *, struct cxgbi_sock *,
  420. struct cxgbi_task_tag_info *);
  421. void (*csk_ddp_clear_map)(struct cxgbi_device *cdev,
  422. struct cxgbi_ppm *,
  423. struct cxgbi_task_tag_info *);
  424. int (*csk_ddp_setup_digest)(struct cxgbi_sock *,
  425. unsigned int, int, int, int);
  426. int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *,
  427. unsigned int, int, bool);
  428. void (*csk_release_offload_resources)(struct cxgbi_sock *);
  429. int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *);
  430. u32 (*csk_send_rx_credits)(struct cxgbi_sock *, u32);
  431. int (*csk_push_tx_frames)(struct cxgbi_sock *, int);
  432. void (*csk_send_abort_req)(struct cxgbi_sock *);
  433. void (*csk_send_close_req)(struct cxgbi_sock *);
  434. int (*csk_alloc_cpls)(struct cxgbi_sock *);
  435. int (*csk_init_act_open)(struct cxgbi_sock *);
  436. void *dd_data;
  437. };
  438. #define cxgbi_cdev_priv(cdev) ((cdev)->dd_data)
  439. struct cxgbi_conn {
  440. struct cxgbi_endpoint *cep;
  441. struct iscsi_conn *iconn;
  442. struct cxgbi_hba *chba;
  443. u32 task_idx_bits;
  444. unsigned int ddp_full;
  445. unsigned int ddp_tag_full;
  446. };
  447. struct cxgbi_endpoint {
  448. struct cxgbi_conn *cconn;
  449. struct cxgbi_hba *chba;
  450. struct cxgbi_sock *csk;
  451. };
  452. #define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
  453. struct cxgbi_task_data {
  454. unsigned short nr_frags;
  455. struct page_frag frags[MAX_PDU_FRAGS];
  456. struct sk_buff *skb;
  457. unsigned int dlen;
  458. unsigned int offset;
  459. unsigned int count;
  460. unsigned int sgoffset;
  461. struct cxgbi_task_tag_info ttinfo;
  462. };
  463. #define iscsi_task_cxgbi_data(task) \
  464. ((task)->dd_data + sizeof(struct iscsi_tcp_task))
  465. static inline void *cxgbi_alloc_big_mem(unsigned int size,
  466. gfp_t gfp)
  467. {
  468. void *p = kzalloc(size, gfp | __GFP_NOWARN);
  469. if (!p)
  470. p = vzalloc(size);
  471. return p;
  472. }
  473. static inline void cxgbi_free_big_mem(void *addr)
  474. {
  475. kvfree(addr);
  476. }
  477. static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr)
  478. {
  479. if (chba->cdev->flags & CXGBI_FLAG_IPV4_SET)
  480. chba->ipv4addr = ipaddr;
  481. else
  482. pr_info("set iscsi ipv4 NOT supported, using %s ipv4.\n",
  483. chba->ndev->name);
  484. }
  485. struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int);
  486. void cxgbi_device_unregister(struct cxgbi_device *);
  487. void cxgbi_device_unregister_all(unsigned int flag);
  488. struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
  489. struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
  490. struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
  491. int *);
  492. int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
  493. struct scsi_host_template *,
  494. struct scsi_transport_template *);
  495. void cxgbi_hbas_remove(struct cxgbi_device *);
  496. int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
  497. unsigned int max_conn);
  498. void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev);
  499. void cxgbi_conn_tx_open(struct cxgbi_sock *);
  500. void cxgbi_conn_pdu_ready(struct cxgbi_sock *);
  501. int cxgbi_conn_alloc_pdu(struct iscsi_task *, u8);
  502. int cxgbi_conn_init_pdu(struct iscsi_task *, unsigned int , unsigned int);
  503. int cxgbi_conn_xmit_pdu(struct iscsi_task *);
  504. void cxgbi_cleanup_task(struct iscsi_task *task);
  505. umode_t cxgbi_attr_is_visible(int param_type, int param);
  506. void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
  507. int cxgbi_set_conn_param(struct iscsi_cls_conn *,
  508. enum iscsi_param, char *, int);
  509. int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param, char *);
  510. struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32);
  511. int cxgbi_bind_conn(struct iscsi_cls_session *,
  512. struct iscsi_cls_conn *, u64, int);
  513. void cxgbi_destroy_session(struct iscsi_cls_session *);
  514. struct iscsi_cls_session *cxgbi_create_session(struct iscsi_endpoint *,
  515. u16, u16, u32);
  516. int cxgbi_set_host_param(struct Scsi_Host *,
  517. enum iscsi_host_param, char *, int);
  518. int cxgbi_get_host_param(struct Scsi_Host *, enum iscsi_host_param, char *);
  519. struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *,
  520. struct sockaddr *, int);
  521. int cxgbi_ep_poll(struct iscsi_endpoint *, int);
  522. void cxgbi_ep_disconnect(struct iscsi_endpoint *);
  523. int cxgbi_iscsi_init(struct iscsi_transport *,
  524. struct scsi_transport_template **);
  525. void cxgbi_iscsi_cleanup(struct iscsi_transport *,
  526. struct scsi_transport_template **);
  527. void cxgbi_parse_pdu_itt(struct iscsi_conn *, itt_t, int *, int *);
  528. int cxgbi_ddp_init(struct cxgbi_device *, unsigned int, unsigned int,
  529. unsigned int, unsigned int);
  530. int cxgbi_ddp_cleanup(struct cxgbi_device *);
  531. void cxgbi_ddp_page_size_factor(int *);
  532. void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *,
  533. struct cxgbi_task_tag_info *,
  534. struct scatterlist **sg_pp, unsigned int *sg_off);
  535. void cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *,
  536. struct cxgbi_tag_format *, unsigned int ppmax,
  537. unsigned int llimit, unsigned int start,
  538. unsigned int rsvd_factor);
  539. #endif /*__LIBCXGBI_H__*/