19ba682f0Skxie@chelsio.com /*
29ba682f0Skxie@chelsio.com * libcxgbi.h: Chelsio common library for T3/T4 iSCSI driver.
39ba682f0Skxie@chelsio.com *
41149a5edSKaren Xie * Copyright (c) 2010-2015 Chelsio Communications, Inc.
59ba682f0Skxie@chelsio.com *
69ba682f0Skxie@chelsio.com * This program is free software; you can redistribute it and/or modify
79ba682f0Skxie@chelsio.com * it under the terms of the GNU General Public License as published by
89ba682f0Skxie@chelsio.com * the Free Software Foundation.
99ba682f0Skxie@chelsio.com *
109ba682f0Skxie@chelsio.com * Written by: Karen Xie (kxie@chelsio.com)
119ba682f0Skxie@chelsio.com * Written by: Rakesh Ranjan (rranjan@chelsio.com)
129ba682f0Skxie@chelsio.com */
139ba682f0Skxie@chelsio.com
149ba682f0Skxie@chelsio.com #ifndef __LIBCXGBI_H__
159ba682f0Skxie@chelsio.com #define __LIBCXGBI_H__
169ba682f0Skxie@chelsio.com
179ba682f0Skxie@chelsio.com #include <linux/kernel.h>
189ba682f0Skxie@chelsio.com #include <linux/errno.h>
199ba682f0Skxie@chelsio.com #include <linux/types.h>
209ba682f0Skxie@chelsio.com #include <linux/debugfs.h>
219ba682f0Skxie@chelsio.com #include <linux/list.h>
229ba682f0Skxie@chelsio.com #include <linux/netdevice.h>
239ba682f0Skxie@chelsio.com #include <linux/if_vlan.h>
249ba682f0Skxie@chelsio.com #include <linux/scatterlist.h>
259ba682f0Skxie@chelsio.com #include <linux/skbuff.h>
269ba682f0Skxie@chelsio.com #include <linux/vmalloc.h>
279ba682f0Skxie@chelsio.com #include <scsi/scsi_device.h>
289ba682f0Skxie@chelsio.com #include <scsi/libiscsi_tcp.h>
299ba682f0Skxie@chelsio.com
3071f7a00bSVarun Prakash #include <libcxgb_ppm.h>
3171f7a00bSVarun Prakash
329ba682f0Skxie@chelsio.com enum cxgbi_dbg_flag {
339ba682f0Skxie@chelsio.com CXGBI_DBG_ISCSI,
349ba682f0Skxie@chelsio.com CXGBI_DBG_DDP,
359ba682f0Skxie@chelsio.com CXGBI_DBG_TOE,
369ba682f0Skxie@chelsio.com CXGBI_DBG_SOCK,
379ba682f0Skxie@chelsio.com
389ba682f0Skxie@chelsio.com CXGBI_DBG_PDU_TX,
399ba682f0Skxie@chelsio.com CXGBI_DBG_PDU_RX,
409ba682f0Skxie@chelsio.com CXGBI_DBG_DEV,
419ba682f0Skxie@chelsio.com };
429ba682f0Skxie@chelsio.com
439ba682f0Skxie@chelsio.com #define log_debug(level, fmt, ...) \
449ba682f0Skxie@chelsio.com do { \
459ba682f0Skxie@chelsio.com if (dbg_level & (level)) \
469ba682f0Skxie@chelsio.com pr_info(fmt, ##__VA_ARGS__); \
479ba682f0Skxie@chelsio.com } while (0)
489ba682f0Skxie@chelsio.com
49fc8d0590SAnish Bhatt #define pr_info_ipaddr(fmt_trail, \
50fc8d0590SAnish Bhatt addr1, addr2, args_trail...) \
51fc8d0590SAnish Bhatt do { \
52fc8d0590SAnish Bhatt if (!((1 << CXGBI_DBG_SOCK) & dbg_level)) \
53fc8d0590SAnish Bhatt break; \
54fc8d0590SAnish Bhatt pr_info("%pISpc - %pISpc, " fmt_trail, \
55fc8d0590SAnish Bhatt addr1, addr2, args_trail); \
56fc8d0590SAnish Bhatt } while (0)
57fc8d0590SAnish Bhatt
589ba682f0Skxie@chelsio.com /* max. connections per adapter */
599ba682f0Skxie@chelsio.com #define CXGBI_MAX_CONN 16384
609ba682f0Skxie@chelsio.com
619ba682f0Skxie@chelsio.com /* always allocate rooms for AHS */
629ba682f0Skxie@chelsio.com #define SKB_TX_ISCSI_PDU_HEADER_MAX \
639ba682f0Skxie@chelsio.com (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE)
649ba682f0Skxie@chelsio.com
659ba682f0Skxie@chelsio.com #define ISCSI_PDU_NONPAYLOAD_LEN 312 /* bhs(48) + ahs(256) + digest(8)*/
669ba682f0Skxie@chelsio.com
679ba682f0Skxie@chelsio.com /*
689ba682f0Skxie@chelsio.com * align pdu size to multiple of 512 for better performance
699ba682f0Skxie@chelsio.com */
709ba682f0Skxie@chelsio.com #define cxgbi_align_pdu_size(n) do { n = (n) & (~511); } while (0)
719ba682f0Skxie@chelsio.com
729ba682f0Skxie@chelsio.com #define ULP2_MODE_ISCSI 2
739ba682f0Skxie@chelsio.com
749ba682f0Skxie@chelsio.com #define ULP2_MAX_PKT_SIZE 16224
759ba682f0Skxie@chelsio.com #define ULP2_MAX_PDU_PAYLOAD \
769ba682f0Skxie@chelsio.com (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_LEN)
779ba682f0Skxie@chelsio.com
78e33c2482SVarun Prakash #define CXGBI_ULP2_MAX_ISO_PAYLOAD 65535
79e33c2482SVarun Prakash
80e33c2482SVarun Prakash #define CXGBI_MAX_ISO_DATA_IN_SKB \
81e33c2482SVarun Prakash min_t(u32, MAX_SKB_FRAGS << PAGE_SHIFT, CXGBI_ULP2_MAX_ISO_PAYLOAD)
82e33c2482SVarun Prakash
83e33c2482SVarun Prakash #define cxgbi_is_iso_config(csk) ((csk)->cdev->skb_iso_txhdr)
84e33c2482SVarun Prakash #define cxgbi_is_iso_disabled(csk) ((csk)->disable_iso)
85e33c2482SVarun Prakash
869ba682f0Skxie@chelsio.com /*
879ba682f0Skxie@chelsio.com * For iscsi connections HW may inserts digest bytes into the pdu. Those digest
889ba682f0Skxie@chelsio.com * bytes are not sent by the host but are part of the TCP payload and therefore
899ba682f0Skxie@chelsio.com * consume TCP sequence space.
909ba682f0Skxie@chelsio.com */
919ba682f0Skxie@chelsio.com static const unsigned int ulp2_extra_len[] = { 0, 4, 4, 8 };
cxgbi_ulp_extra_len(int submode)929ba682f0Skxie@chelsio.com static inline unsigned int cxgbi_ulp_extra_len(int submode)
939ba682f0Skxie@chelsio.com {
949ba682f0Skxie@chelsio.com return ulp2_extra_len[submode & 3];
959ba682f0Skxie@chelsio.com }
969ba682f0Skxie@chelsio.com
979ba682f0Skxie@chelsio.com #define CPL_RX_DDP_STATUS_DDP_SHIFT 16 /* ddp'able */
989ba682f0Skxie@chelsio.com #define CPL_RX_DDP_STATUS_PAD_SHIFT 19 /* pad error */
999ba682f0Skxie@chelsio.com #define CPL_RX_DDP_STATUS_HCRC_SHIFT 20 /* hcrc error */
1009ba682f0Skxie@chelsio.com #define CPL_RX_DDP_STATUS_DCRC_SHIFT 21 /* dcrc error */
1019ba682f0Skxie@chelsio.com
1029ba682f0Skxie@chelsio.com /*
1039ba682f0Skxie@chelsio.com * sge_opaque_hdr -
1049ba682f0Skxie@chelsio.com * Opaque version of structure the SGE stores at skb->head of TX_DATA packets
1059ba682f0Skxie@chelsio.com * and for which we must reserve space.
1069ba682f0Skxie@chelsio.com */
1079ba682f0Skxie@chelsio.com struct sge_opaque_hdr {
1089ba682f0Skxie@chelsio.com void *dev;
1099ba682f0Skxie@chelsio.com dma_addr_t addr[MAX_SKB_FRAGS + 1];
1109ba682f0Skxie@chelsio.com };
1119ba682f0Skxie@chelsio.com
1129ba682f0Skxie@chelsio.com struct cxgbi_sock {
1139ba682f0Skxie@chelsio.com struct cxgbi_device *cdev;
1149ba682f0Skxie@chelsio.com
1159ba682f0Skxie@chelsio.com int tid;
1169ba682f0Skxie@chelsio.com int atid;
1179ba682f0Skxie@chelsio.com unsigned long flags;
1189ba682f0Skxie@chelsio.com unsigned int mtu;
1199ba682f0Skxie@chelsio.com unsigned short rss_qid;
1209ba682f0Skxie@chelsio.com unsigned short txq_idx;
1219ba682f0Skxie@chelsio.com unsigned short advmss;
1229ba682f0Skxie@chelsio.com unsigned int tx_chan;
1239ba682f0Skxie@chelsio.com unsigned int rx_chan;
1249ba682f0Skxie@chelsio.com unsigned int mss_idx;
1259ba682f0Skxie@chelsio.com unsigned int smac_idx;
1269ba682f0Skxie@chelsio.com unsigned char port_id;
1279ba682f0Skxie@chelsio.com int wr_max_cred;
1289ba682f0Skxie@chelsio.com int wr_cred;
1299ba682f0Skxie@chelsio.com int wr_una_cred;
130b5a5fe4eSVarun Prakash #ifdef CONFIG_CHELSIO_T4_DCB
131b5a5fe4eSVarun Prakash u8 dcb_priority;
132b5a5fe4eSVarun Prakash #endif
1339ba682f0Skxie@chelsio.com unsigned char hcrc_len;
1349ba682f0Skxie@chelsio.com unsigned char dcrc_len;
1359ba682f0Skxie@chelsio.com
1369ba682f0Skxie@chelsio.com void *l2t;
1379ba682f0Skxie@chelsio.com struct sk_buff *wr_pending_head;
1389ba682f0Skxie@chelsio.com struct sk_buff *wr_pending_tail;
1399ba682f0Skxie@chelsio.com struct sk_buff *cpl_close;
1409ba682f0Skxie@chelsio.com struct sk_buff *cpl_abort_req;
1419ba682f0Skxie@chelsio.com struct sk_buff *cpl_abort_rpl;
1429ba682f0Skxie@chelsio.com struct sk_buff *skb_ulp_lhdr;
1439ba682f0Skxie@chelsio.com spinlock_t lock;
1449ba682f0Skxie@chelsio.com struct kref refcnt;
1459ba682f0Skxie@chelsio.com unsigned int state;
146fc8d0590SAnish Bhatt unsigned int csk_family;
147fc8d0590SAnish Bhatt union {
1489ba682f0Skxie@chelsio.com struct sockaddr_in saddr;
149fc8d0590SAnish Bhatt struct sockaddr_in6 saddr6;
150fc8d0590SAnish Bhatt };
151fc8d0590SAnish Bhatt union {
1529ba682f0Skxie@chelsio.com struct sockaddr_in daddr;
153fc8d0590SAnish Bhatt struct sockaddr_in6 daddr6;
154fc8d0590SAnish Bhatt };
1559ba682f0Skxie@chelsio.com struct dst_entry *dst;
1569ba682f0Skxie@chelsio.com struct sk_buff_head receive_queue;
1579ba682f0Skxie@chelsio.com struct sk_buff_head write_queue;
1589ba682f0Skxie@chelsio.com struct timer_list retry_timer;
1599e8f1c79SVarun Prakash struct completion cmpl;
1609ba682f0Skxie@chelsio.com int err;
1619ba682f0Skxie@chelsio.com rwlock_t callback_lock;
1629ba682f0Skxie@chelsio.com void *user_data;
1639ba682f0Skxie@chelsio.com
1649ba682f0Skxie@chelsio.com u32 rcv_nxt;
1659ba682f0Skxie@chelsio.com u32 copied_seq;
1669ba682f0Skxie@chelsio.com u32 rcv_wup;
1679ba682f0Skxie@chelsio.com u32 snd_nxt;
1689ba682f0Skxie@chelsio.com u32 snd_una;
1699ba682f0Skxie@chelsio.com u32 write_seq;
17081daf10cSKaren Xie u32 snd_win;
17181daf10cSKaren Xie u32 rcv_win;
172e33c2482SVarun Prakash
173e33c2482SVarun Prakash bool disable_iso;
174e33c2482SVarun Prakash u32 no_tx_credits;
175e33c2482SVarun Prakash unsigned long prev_iso_ts;
1769ba682f0Skxie@chelsio.com };
1779ba682f0Skxie@chelsio.com
1789ba682f0Skxie@chelsio.com /*
1799ba682f0Skxie@chelsio.com * connection states
1809ba682f0Skxie@chelsio.com */
1819ba682f0Skxie@chelsio.com enum cxgbi_sock_states{
1829ba682f0Skxie@chelsio.com CTP_CLOSED,
1839ba682f0Skxie@chelsio.com CTP_CONNECTING,
1849ba682f0Skxie@chelsio.com CTP_ACTIVE_OPEN,
1859ba682f0Skxie@chelsio.com CTP_ESTABLISHED,
1869ba682f0Skxie@chelsio.com CTP_ACTIVE_CLOSE,
1879ba682f0Skxie@chelsio.com CTP_PASSIVE_CLOSE,
1889ba682f0Skxie@chelsio.com CTP_CLOSE_WAIT_1,
1899ba682f0Skxie@chelsio.com CTP_CLOSE_WAIT_2,
1909ba682f0Skxie@chelsio.com CTP_ABORTING,
1919ba682f0Skxie@chelsio.com };
1929ba682f0Skxie@chelsio.com
1939ba682f0Skxie@chelsio.com /*
1949ba682f0Skxie@chelsio.com * Connection flags -- many to track some close related events.
1959ba682f0Skxie@chelsio.com */
1969ba682f0Skxie@chelsio.com enum cxgbi_sock_flags {
1979ba682f0Skxie@chelsio.com CTPF_ABORT_RPL_RCVD, /*received one ABORT_RPL_RSS message */
1989ba682f0Skxie@chelsio.com CTPF_ABORT_REQ_RCVD, /*received one ABORT_REQ_RSS message */
1999ba682f0Skxie@chelsio.com CTPF_ABORT_RPL_PENDING, /* expecting an abort reply */
2009ba682f0Skxie@chelsio.com CTPF_TX_DATA_SENT, /* already sent a TX_DATA WR */
2019ba682f0Skxie@chelsio.com CTPF_ACTIVE_CLOSE_NEEDED,/* need to be closed */
2029ba682f0Skxie@chelsio.com CTPF_HAS_ATID, /* reserved atid */
2039ba682f0Skxie@chelsio.com CTPF_HAS_TID, /* reserved hw tid */
2049ba682f0Skxie@chelsio.com CTPF_OFFLOAD_DOWN, /* offload function off */
205e0f8e8cfSVarun Prakash CTPF_LOGOUT_RSP_RCVD, /* received logout response */
2069ba682f0Skxie@chelsio.com };
2079ba682f0Skxie@chelsio.com
2089ba682f0Skxie@chelsio.com struct cxgbi_skb_rx_cb {
2099ba682f0Skxie@chelsio.com __u32 ddigest;
2109ba682f0Skxie@chelsio.com __u32 pdulen;
2119ba682f0Skxie@chelsio.com };
2129ba682f0Skxie@chelsio.com
2139ba682f0Skxie@chelsio.com struct cxgbi_skb_tx_cb {
21475b61250SVarun Prakash void *handle;
21575b61250SVarun Prakash void *arp_err_handler;
2169ba682f0Skxie@chelsio.com struct sk_buff *wr_next;
217e33c2482SVarun Prakash u16 iscsi_hdr_len;
218e33c2482SVarun Prakash u8 ulp_mode;
2199ba682f0Skxie@chelsio.com };
2209ba682f0Skxie@chelsio.com
2219ba682f0Skxie@chelsio.com enum cxgbi_skcb_flags {
2229ba682f0Skxie@chelsio.com SKCBF_TX_NEED_HDR, /* packet needs a header */
22371f7a00bSVarun Prakash SKCBF_TX_MEM_WRITE, /* memory write */
22471f7a00bSVarun Prakash SKCBF_TX_FLAG_COMPL, /* wr completion flag */
2259ba682f0Skxie@chelsio.com SKCBF_RX_COALESCED, /* received whole pdu */
22625985edcSLucas De Marchi SKCBF_RX_HDR, /* received pdu header */
22725985edcSLucas De Marchi SKCBF_RX_DATA, /* received pdu payload */
22825985edcSLucas De Marchi SKCBF_RX_STATUS, /* received ddp status */
22944830d8fSVarun Prakash SKCBF_RX_ISCSI_COMPL, /* received iscsi completion */
2309ba682f0Skxie@chelsio.com SKCBF_RX_DATA_DDPD, /* pdu payload ddp'd */
2319ba682f0Skxie@chelsio.com SKCBF_RX_HCRC_ERR, /* header digest error */
2329ba682f0Skxie@chelsio.com SKCBF_RX_DCRC_ERR, /* data digest error */
2339ba682f0Skxie@chelsio.com SKCBF_RX_PAD_ERR, /* padding byte error */
234e33c2482SVarun Prakash SKCBF_TX_ISO, /* iso cpl in tx skb */
2359ba682f0Skxie@chelsio.com };
2369ba682f0Skxie@chelsio.com
2379ba682f0Skxie@chelsio.com struct cxgbi_skb_cb {
2389ba682f0Skxie@chelsio.com union {
2399ba682f0Skxie@chelsio.com struct cxgbi_skb_rx_cb rx;
2409ba682f0Skxie@chelsio.com struct cxgbi_skb_tx_cb tx;
2419ba682f0Skxie@chelsio.com };
24275b61250SVarun Prakash unsigned long flags;
24375b61250SVarun Prakash unsigned int seq;
2449ba682f0Skxie@chelsio.com };
2459ba682f0Skxie@chelsio.com
2469ba682f0Skxie@chelsio.com #define CXGBI_SKB_CB(skb) ((struct cxgbi_skb_cb *)&((skb)->cb[0]))
2479ba682f0Skxie@chelsio.com #define cxgbi_skcb_flags(skb) (CXGBI_SKB_CB(skb)->flags)
2489ba682f0Skxie@chelsio.com #define cxgbi_skcb_tcp_seq(skb) (CXGBI_SKB_CB(skb)->seq)
2499ba682f0Skxie@chelsio.com #define cxgbi_skcb_rx_ddigest(skb) (CXGBI_SKB_CB(skb)->rx.ddigest)
2509ba682f0Skxie@chelsio.com #define cxgbi_skcb_rx_pdulen(skb) (CXGBI_SKB_CB(skb)->rx.pdulen)
2519ba682f0Skxie@chelsio.com #define cxgbi_skcb_tx_wr_next(skb) (CXGBI_SKB_CB(skb)->tx.wr_next)
252e33c2482SVarun Prakash #define cxgbi_skcb_tx_iscsi_hdrlen(skb) (CXGBI_SKB_CB(skb)->tx.iscsi_hdr_len)
253e33c2482SVarun Prakash #define cxgbi_skcb_tx_ulp_mode(skb) (CXGBI_SKB_CB(skb)->tx.ulp_mode)
2549ba682f0Skxie@chelsio.com
cxgbi_skcb_set_flag(struct sk_buff * skb,enum cxgbi_skcb_flags flag)2559ba682f0Skxie@chelsio.com static inline void cxgbi_skcb_set_flag(struct sk_buff *skb,
2569ba682f0Skxie@chelsio.com enum cxgbi_skcb_flags flag)
2579ba682f0Skxie@chelsio.com {
2589ba682f0Skxie@chelsio.com __set_bit(flag, &(cxgbi_skcb_flags(skb)));
2599ba682f0Skxie@chelsio.com }
2609ba682f0Skxie@chelsio.com
cxgbi_skcb_clear_flag(struct sk_buff * skb,enum cxgbi_skcb_flags flag)2619ba682f0Skxie@chelsio.com static inline void cxgbi_skcb_clear_flag(struct sk_buff *skb,
2629ba682f0Skxie@chelsio.com enum cxgbi_skcb_flags flag)
2639ba682f0Skxie@chelsio.com {
2649ba682f0Skxie@chelsio.com __clear_bit(flag, &(cxgbi_skcb_flags(skb)));
2659ba682f0Skxie@chelsio.com }
2669ba682f0Skxie@chelsio.com
cxgbi_skcb_test_flag(const struct sk_buff * skb,enum cxgbi_skcb_flags flag)26784944d8cSKaren Xie static inline int cxgbi_skcb_test_flag(const struct sk_buff *skb,
2689ba682f0Skxie@chelsio.com enum cxgbi_skcb_flags flag)
2699ba682f0Skxie@chelsio.com {
2709ba682f0Skxie@chelsio.com return test_bit(flag, &(cxgbi_skcb_flags(skb)));
2719ba682f0Skxie@chelsio.com }
2729ba682f0Skxie@chelsio.com
cxgbi_sock_set_flag(struct cxgbi_sock * csk,enum cxgbi_sock_flags flag)2739ba682f0Skxie@chelsio.com static inline void cxgbi_sock_set_flag(struct cxgbi_sock *csk,
2749ba682f0Skxie@chelsio.com enum cxgbi_sock_flags flag)
2759ba682f0Skxie@chelsio.com {
2769ba682f0Skxie@chelsio.com __set_bit(flag, &csk->flags);
2779ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
2789ba682f0Skxie@chelsio.com "csk 0x%p,%u,0x%lx, bit %d.\n",
2799ba682f0Skxie@chelsio.com csk, csk->state, csk->flags, flag);
2809ba682f0Skxie@chelsio.com }
2819ba682f0Skxie@chelsio.com
cxgbi_sock_clear_flag(struct cxgbi_sock * csk,enum cxgbi_sock_flags flag)2829ba682f0Skxie@chelsio.com static inline void cxgbi_sock_clear_flag(struct cxgbi_sock *csk,
2839ba682f0Skxie@chelsio.com enum cxgbi_sock_flags flag)
2849ba682f0Skxie@chelsio.com {
2859ba682f0Skxie@chelsio.com __clear_bit(flag, &csk->flags);
2869ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
2879ba682f0Skxie@chelsio.com "csk 0x%p,%u,0x%lx, bit %d.\n",
2889ba682f0Skxie@chelsio.com csk, csk->state, csk->flags, flag);
2899ba682f0Skxie@chelsio.com }
2909ba682f0Skxie@chelsio.com
cxgbi_sock_flag(struct cxgbi_sock * csk,enum cxgbi_sock_flags flag)2919ba682f0Skxie@chelsio.com static inline int cxgbi_sock_flag(struct cxgbi_sock *csk,
2929ba682f0Skxie@chelsio.com enum cxgbi_sock_flags flag)
2939ba682f0Skxie@chelsio.com {
2949ba682f0Skxie@chelsio.com if (csk == NULL)
2959ba682f0Skxie@chelsio.com return 0;
2969ba682f0Skxie@chelsio.com return test_bit(flag, &csk->flags);
2979ba682f0Skxie@chelsio.com }
2989ba682f0Skxie@chelsio.com
cxgbi_sock_set_state(struct cxgbi_sock * csk,int state)2999ba682f0Skxie@chelsio.com static inline void cxgbi_sock_set_state(struct cxgbi_sock *csk, int state)
3009ba682f0Skxie@chelsio.com {
3019ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
3029ba682f0Skxie@chelsio.com "csk 0x%p,%u,0x%lx, state -> %u.\n",
3039ba682f0Skxie@chelsio.com csk, csk->state, csk->flags, state);
3049ba682f0Skxie@chelsio.com csk->state = state;
3059ba682f0Skxie@chelsio.com }
3069ba682f0Skxie@chelsio.com
cxgbi_sock_free(struct kref * kref)3079ba682f0Skxie@chelsio.com static inline void cxgbi_sock_free(struct kref *kref)
3089ba682f0Skxie@chelsio.com {
3099ba682f0Skxie@chelsio.com struct cxgbi_sock *csk = container_of(kref,
3109ba682f0Skxie@chelsio.com struct cxgbi_sock,
3119ba682f0Skxie@chelsio.com refcnt);
3129ba682f0Skxie@chelsio.com if (csk) {
3139ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
3149ba682f0Skxie@chelsio.com "free csk 0x%p, state %u, flags 0x%lx\n",
3159ba682f0Skxie@chelsio.com csk, csk->state, csk->flags);
3169ba682f0Skxie@chelsio.com kfree(csk);
3179ba682f0Skxie@chelsio.com }
3189ba682f0Skxie@chelsio.com }
3199ba682f0Skxie@chelsio.com
__cxgbi_sock_put(const char * fn,struct cxgbi_sock * csk)3209ba682f0Skxie@chelsio.com static inline void __cxgbi_sock_put(const char *fn, struct cxgbi_sock *csk)
3219ba682f0Skxie@chelsio.com {
3229ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
3239ba682f0Skxie@chelsio.com "%s, put csk 0x%p, ref %u-1.\n",
3242c935bc5SPeter Zijlstra fn, csk, kref_read(&csk->refcnt));
3259ba682f0Skxie@chelsio.com kref_put(&csk->refcnt, cxgbi_sock_free);
3269ba682f0Skxie@chelsio.com }
3279ba682f0Skxie@chelsio.com #define cxgbi_sock_put(csk) __cxgbi_sock_put(__func__, csk)
3289ba682f0Skxie@chelsio.com
__cxgbi_sock_get(const char * fn,struct cxgbi_sock * csk)3299ba682f0Skxie@chelsio.com static inline void __cxgbi_sock_get(const char *fn, struct cxgbi_sock *csk)
3309ba682f0Skxie@chelsio.com {
3319ba682f0Skxie@chelsio.com log_debug(1 << CXGBI_DBG_SOCK,
3329ba682f0Skxie@chelsio.com "%s, get csk 0x%p, ref %u+1.\n",
3332c935bc5SPeter Zijlstra fn, csk, kref_read(&csk->refcnt));
3349ba682f0Skxie@chelsio.com kref_get(&csk->refcnt);
3359ba682f0Skxie@chelsio.com }
3369ba682f0Skxie@chelsio.com #define cxgbi_sock_get(csk) __cxgbi_sock_get(__func__, csk)
3379ba682f0Skxie@chelsio.com
cxgbi_sock_is_closing(struct cxgbi_sock * csk)3389ba682f0Skxie@chelsio.com static inline int cxgbi_sock_is_closing(struct cxgbi_sock *csk)
3399ba682f0Skxie@chelsio.com {
3409ba682f0Skxie@chelsio.com return csk->state >= CTP_ACTIVE_CLOSE;
3419ba682f0Skxie@chelsio.com }
3429ba682f0Skxie@chelsio.com
cxgbi_sock_is_established(struct cxgbi_sock * csk)3439ba682f0Skxie@chelsio.com static inline int cxgbi_sock_is_established(struct cxgbi_sock *csk)
3449ba682f0Skxie@chelsio.com {
3459ba682f0Skxie@chelsio.com return csk->state == CTP_ESTABLISHED;
3469ba682f0Skxie@chelsio.com }
3479ba682f0Skxie@chelsio.com
cxgbi_sock_purge_write_queue(struct cxgbi_sock * csk)3489ba682f0Skxie@chelsio.com static inline void cxgbi_sock_purge_write_queue(struct cxgbi_sock *csk)
3499ba682f0Skxie@chelsio.com {
3509ba682f0Skxie@chelsio.com struct sk_buff *skb;
3519ba682f0Skxie@chelsio.com
3529ba682f0Skxie@chelsio.com while ((skb = __skb_dequeue(&csk->write_queue)))
3539ba682f0Skxie@chelsio.com __kfree_skb(skb);
3549ba682f0Skxie@chelsio.com }
3559ba682f0Skxie@chelsio.com
cxgbi_sock_compute_wscale(unsigned int win)3569ba682f0Skxie@chelsio.com static inline unsigned int cxgbi_sock_compute_wscale(unsigned int win)
3579ba682f0Skxie@chelsio.com {
3589ba682f0Skxie@chelsio.com unsigned int wscale = 0;
3599ba682f0Skxie@chelsio.com
3609ba682f0Skxie@chelsio.com while (wscale < 14 && (65535 << wscale) < win)
3619ba682f0Skxie@chelsio.com wscale++;
3629ba682f0Skxie@chelsio.com return wscale;
3639ba682f0Skxie@chelsio.com }
3649ba682f0Skxie@chelsio.com
alloc_wr(int wrlen,int dlen,gfp_t gfp)36524d3f95aSkxie@chelsio.com static inline struct sk_buff *alloc_wr(int wrlen, int dlen, gfp_t gfp)
3669ba682f0Skxie@chelsio.com {
3679ba682f0Skxie@chelsio.com struct sk_buff *skb = alloc_skb(wrlen + dlen, gfp);
3689ba682f0Skxie@chelsio.com
3699ba682f0Skxie@chelsio.com if (skb) {
3709ba682f0Skxie@chelsio.com __skb_put(skb, wrlen);
3719ba682f0Skxie@chelsio.com memset(skb->head, 0, wrlen + dlen);
3729ba682f0Skxie@chelsio.com } else
37324d3f95aSkxie@chelsio.com pr_info("alloc cpl wr skb %u+%u, OOM.\n", wrlen, dlen);
3749ba682f0Skxie@chelsio.com return skb;
3759ba682f0Skxie@chelsio.com }
3769ba682f0Skxie@chelsio.com
3779ba682f0Skxie@chelsio.com
3789ba682f0Skxie@chelsio.com /*
3799ba682f0Skxie@chelsio.com * The number of WRs needed for an skb depends on the number of fragments
3809ba682f0Skxie@chelsio.com * in the skb and whether it has any payload in its main body. This maps the
3819ba682f0Skxie@chelsio.com * length of the gather list represented by an skb into the # of necessary WRs.
3829ba682f0Skxie@chelsio.com * The extra two fragments are for iscsi bhs and payload padding.
3839ba682f0Skxie@chelsio.com */
3849ba682f0Skxie@chelsio.com #define SKB_WR_LIST_SIZE (MAX_SKB_FRAGS + 2)
3859ba682f0Skxie@chelsio.com
cxgbi_sock_reset_wr_list(struct cxgbi_sock * csk)3869ba682f0Skxie@chelsio.com static inline void cxgbi_sock_reset_wr_list(struct cxgbi_sock *csk)
3879ba682f0Skxie@chelsio.com {
3889ba682f0Skxie@chelsio.com csk->wr_pending_head = csk->wr_pending_tail = NULL;
3899ba682f0Skxie@chelsio.com }
3909ba682f0Skxie@chelsio.com
cxgbi_sock_enqueue_wr(struct cxgbi_sock * csk,struct sk_buff * skb)3919ba682f0Skxie@chelsio.com static inline void cxgbi_sock_enqueue_wr(struct cxgbi_sock *csk,
3929ba682f0Skxie@chelsio.com struct sk_buff *skb)
3939ba682f0Skxie@chelsio.com {
3949ba682f0Skxie@chelsio.com cxgbi_skcb_tx_wr_next(skb) = NULL;
3959ba682f0Skxie@chelsio.com /*
3969ba682f0Skxie@chelsio.com * We want to take an extra reference since both us and the driver
39775b61250SVarun Prakash * need to free the packet before it's really freed.
3989ba682f0Skxie@chelsio.com */
39975b61250SVarun Prakash skb_get(skb);
4009ba682f0Skxie@chelsio.com
4019ba682f0Skxie@chelsio.com if (!csk->wr_pending_head)
4029ba682f0Skxie@chelsio.com csk->wr_pending_head = skb;
4039ba682f0Skxie@chelsio.com else
4049ba682f0Skxie@chelsio.com cxgbi_skcb_tx_wr_next(csk->wr_pending_tail) = skb;
4059ba682f0Skxie@chelsio.com csk->wr_pending_tail = skb;
4069ba682f0Skxie@chelsio.com }
4079ba682f0Skxie@chelsio.com
cxgbi_sock_count_pending_wrs(const struct cxgbi_sock * csk)4089ba682f0Skxie@chelsio.com static inline int cxgbi_sock_count_pending_wrs(const struct cxgbi_sock *csk)
4099ba682f0Skxie@chelsio.com {
4109ba682f0Skxie@chelsio.com int n = 0;
4119ba682f0Skxie@chelsio.com const struct sk_buff *skb = csk->wr_pending_head;
4129ba682f0Skxie@chelsio.com
4139ba682f0Skxie@chelsio.com while (skb) {
4149ba682f0Skxie@chelsio.com n += skb->csum;
4159ba682f0Skxie@chelsio.com skb = cxgbi_skcb_tx_wr_next(skb);
4169ba682f0Skxie@chelsio.com }
4179ba682f0Skxie@chelsio.com return n;
4189ba682f0Skxie@chelsio.com }
4199ba682f0Skxie@chelsio.com
cxgbi_sock_peek_wr(const struct cxgbi_sock * csk)4209ba682f0Skxie@chelsio.com static inline struct sk_buff *cxgbi_sock_peek_wr(const struct cxgbi_sock *csk)
4219ba682f0Skxie@chelsio.com {
4229ba682f0Skxie@chelsio.com return csk->wr_pending_head;
4239ba682f0Skxie@chelsio.com }
4249ba682f0Skxie@chelsio.com
cxgbi_sock_dequeue_wr(struct cxgbi_sock * csk)4259ba682f0Skxie@chelsio.com static inline struct sk_buff *cxgbi_sock_dequeue_wr(struct cxgbi_sock *csk)
4269ba682f0Skxie@chelsio.com {
4279ba682f0Skxie@chelsio.com struct sk_buff *skb = csk->wr_pending_head;
4289ba682f0Skxie@chelsio.com
4299ba682f0Skxie@chelsio.com if (likely(skb)) {
4309ba682f0Skxie@chelsio.com csk->wr_pending_head = cxgbi_skcb_tx_wr_next(skb);
4319ba682f0Skxie@chelsio.com cxgbi_skcb_tx_wr_next(skb) = NULL;
4329ba682f0Skxie@chelsio.com }
4339ba682f0Skxie@chelsio.com return skb;
4349ba682f0Skxie@chelsio.com }
4359ba682f0Skxie@chelsio.com
4369ba682f0Skxie@chelsio.com void cxgbi_sock_check_wr_invariants(const struct cxgbi_sock *);
4379ba682f0Skxie@chelsio.com void cxgbi_sock_purge_wr_queue(struct cxgbi_sock *);
4389ba682f0Skxie@chelsio.com void cxgbi_sock_skb_entail(struct cxgbi_sock *, struct sk_buff *);
4399ba682f0Skxie@chelsio.com void cxgbi_sock_fail_act_open(struct cxgbi_sock *, int);
4409ba682f0Skxie@chelsio.com void cxgbi_sock_act_open_req_arp_failure(void *, struct sk_buff *);
4419ba682f0Skxie@chelsio.com void cxgbi_sock_closed(struct cxgbi_sock *);
4429ba682f0Skxie@chelsio.com void cxgbi_sock_established(struct cxgbi_sock *, unsigned int, unsigned int);
4439ba682f0Skxie@chelsio.com void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *);
4449ba682f0Skxie@chelsio.com void cxgbi_sock_rcv_peer_close(struct cxgbi_sock *);
4459ba682f0Skxie@chelsio.com void cxgbi_sock_rcv_close_conn_rpl(struct cxgbi_sock *, u32);
4469ba682f0Skxie@chelsio.com void cxgbi_sock_rcv_wr_ack(struct cxgbi_sock *, unsigned int, unsigned int,
4479ba682f0Skxie@chelsio.com int);
4489ba682f0Skxie@chelsio.com unsigned int cxgbi_sock_select_mss(struct cxgbi_sock *, unsigned int);
4499ba682f0Skxie@chelsio.com void cxgbi_sock_free_cpl_skbs(struct cxgbi_sock *);
4509ba682f0Skxie@chelsio.com
4519ba682f0Skxie@chelsio.com struct cxgbi_hba {
4529ba682f0Skxie@chelsio.com struct net_device *ndev;
4530b3d8947Skxie@chelsio.com struct net_device *vdev; /* vlan dev */
4549ba682f0Skxie@chelsio.com struct Scsi_Host *shost;
4559ba682f0Skxie@chelsio.com struct cxgbi_device *cdev;
4569ba682f0Skxie@chelsio.com __be32 ipv4addr;
4579ba682f0Skxie@chelsio.com unsigned char port_id;
4589ba682f0Skxie@chelsio.com };
4599ba682f0Skxie@chelsio.com
4609ba682f0Skxie@chelsio.com struct cxgbi_ports_map {
4619ba682f0Skxie@chelsio.com unsigned int max_connect;
4629ba682f0Skxie@chelsio.com unsigned int used;
4639ba682f0Skxie@chelsio.com unsigned short sport_base;
4649ba682f0Skxie@chelsio.com spinlock_t lock;
4659ba682f0Skxie@chelsio.com unsigned int next;
4669ba682f0Skxie@chelsio.com struct cxgbi_sock **port_csk;
4679ba682f0Skxie@chelsio.com };
4689ba682f0Skxie@chelsio.com
4699ba682f0Skxie@chelsio.com #define CXGBI_FLAG_DEV_T3 0x1
4709ba682f0Skxie@chelsio.com #define CXGBI_FLAG_DEV_T4 0x2
4719ba682f0Skxie@chelsio.com #define CXGBI_FLAG_ADAPTER_RESET 0x4
4729ba682f0Skxie@chelsio.com #define CXGBI_FLAG_IPV4_SET 0x10
47371f7a00bSVarun Prakash #define CXGBI_FLAG_USE_PPOD_OFLDQ 0x40
47471f7a00bSVarun Prakash #define CXGBI_FLAG_DDP_OFF 0x100
475e33c2482SVarun Prakash #define CXGBI_FLAG_DEV_ISO_OFF 0x400
47671f7a00bSVarun Prakash
4779ba682f0Skxie@chelsio.com struct cxgbi_device {
4789ba682f0Skxie@chelsio.com struct list_head list_head;
479078efae0SAnish Bhatt struct list_head rcu_node;
4809ba682f0Skxie@chelsio.com unsigned int flags;
4819ba682f0Skxie@chelsio.com struct net_device **ports;
4829ba682f0Skxie@chelsio.com void *lldev;
4839ba682f0Skxie@chelsio.com struct cxgbi_hba **hbas;
4849ba682f0Skxie@chelsio.com const unsigned short *mtus;
4859ba682f0Skxie@chelsio.com unsigned char nmtus;
4869ba682f0Skxie@chelsio.com unsigned char nports;
4879ba682f0Skxie@chelsio.com struct pci_dev *pdev;
4889ba682f0Skxie@chelsio.com struct dentry *debugfs_root;
4899ba682f0Skxie@chelsio.com struct iscsi_transport *itp;
4901fe1fdb0SVarun Prakash struct module *owner;
4919ba682f0Skxie@chelsio.com
4929ba682f0Skxie@chelsio.com unsigned int pfvf;
4939ba682f0Skxie@chelsio.com unsigned int rx_credit_thres;
4949ba682f0Skxie@chelsio.com unsigned int skb_tx_rsvd;
495e33c2482SVarun Prakash u32 skb_iso_txhdr;
4969ba682f0Skxie@chelsio.com unsigned int skb_rx_extra; /* for msg coalesced mode */
4979ba682f0Skxie@chelsio.com unsigned int tx_max_size;
4989ba682f0Skxie@chelsio.com unsigned int rx_max_size;
4996c9e2770SVarun Prakash unsigned int rxq_idx_cntr;
5009ba682f0Skxie@chelsio.com struct cxgbi_ports_map pmap;
5019ba682f0Skxie@chelsio.com
5029ba682f0Skxie@chelsio.com void (*dev_ddp_cleanup)(struct cxgbi_device *);
50371f7a00bSVarun Prakash struct cxgbi_ppm* (*cdev2ppm)(struct cxgbi_device *);
50471f7a00bSVarun Prakash int (*csk_ddp_set_map)(struct cxgbi_ppm *, struct cxgbi_sock *,
50571f7a00bSVarun Prakash struct cxgbi_task_tag_info *);
50671f7a00bSVarun Prakash void (*csk_ddp_clear_map)(struct cxgbi_device *cdev,
50771f7a00bSVarun Prakash struct cxgbi_ppm *,
50871f7a00bSVarun Prakash struct cxgbi_task_tag_info *);
5099ba682f0Skxie@chelsio.com int (*csk_ddp_setup_digest)(struct cxgbi_sock *,
5109e8f1c79SVarun Prakash unsigned int, int, int);
5119ba682f0Skxie@chelsio.com int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *,
5129e8f1c79SVarun Prakash unsigned int, int);
5139ba682f0Skxie@chelsio.com
5149ba682f0Skxie@chelsio.com void (*csk_release_offload_resources)(struct cxgbi_sock *);
5159ba682f0Skxie@chelsio.com int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *);
5169ba682f0Skxie@chelsio.com u32 (*csk_send_rx_credits)(struct cxgbi_sock *, u32);
5179ba682f0Skxie@chelsio.com int (*csk_push_tx_frames)(struct cxgbi_sock *, int);
5189ba682f0Skxie@chelsio.com void (*csk_send_abort_req)(struct cxgbi_sock *);
5199ba682f0Skxie@chelsio.com void (*csk_send_close_req)(struct cxgbi_sock *);
5209ba682f0Skxie@chelsio.com int (*csk_alloc_cpls)(struct cxgbi_sock *);
5219ba682f0Skxie@chelsio.com int (*csk_init_act_open)(struct cxgbi_sock *);
5229ba682f0Skxie@chelsio.com
5239ba682f0Skxie@chelsio.com void *dd_data;
5249ba682f0Skxie@chelsio.com };
5259ba682f0Skxie@chelsio.com #define cxgbi_cdev_priv(cdev) ((cdev)->dd_data)
5269ba682f0Skxie@chelsio.com
5279ba682f0Skxie@chelsio.com struct cxgbi_conn {
5289ba682f0Skxie@chelsio.com struct cxgbi_endpoint *cep;
5299ba682f0Skxie@chelsio.com struct iscsi_conn *iconn;
5309ba682f0Skxie@chelsio.com struct cxgbi_hba *chba;
5319ba682f0Skxie@chelsio.com u32 task_idx_bits;
53271f7a00bSVarun Prakash unsigned int ddp_full;
53371f7a00bSVarun Prakash unsigned int ddp_tag_full;
5349ba682f0Skxie@chelsio.com };
5359ba682f0Skxie@chelsio.com
5369ba682f0Skxie@chelsio.com struct cxgbi_endpoint {
5379ba682f0Skxie@chelsio.com struct cxgbi_conn *cconn;
5389ba682f0Skxie@chelsio.com struct cxgbi_hba *chba;
5399ba682f0Skxie@chelsio.com struct cxgbi_sock *csk;
5409ba682f0Skxie@chelsio.com };
5419ba682f0Skxie@chelsio.com
5429ba682f0Skxie@chelsio.com struct cxgbi_task_data {
543e33c2482SVarun Prakash #define CXGBI_TASK_SGL_CHECKED 0x1
544e33c2482SVarun Prakash #define CXGBI_TASK_SGL_COPY 0x2
545e33c2482SVarun Prakash u8 flags;
5469ba682f0Skxie@chelsio.com unsigned short nr_frags;
547e33c2482SVarun Prakash struct page_frag frags[MAX_SKB_FRAGS];
5489ba682f0Skxie@chelsio.com struct sk_buff *skb;
54971f7a00bSVarun Prakash unsigned int dlen;
5509ba682f0Skxie@chelsio.com unsigned int offset;
5519ba682f0Skxie@chelsio.com unsigned int count;
5529ba682f0Skxie@chelsio.com unsigned int sgoffset;
553e33c2482SVarun Prakash u32 total_count;
554e33c2482SVarun Prakash u32 total_offset;
555e33c2482SVarun Prakash u32 max_xmit_dlength;
55671f7a00bSVarun Prakash struct cxgbi_task_tag_info ttinfo;
5579ba682f0Skxie@chelsio.com };
558e3d2ad8cSkxie@chelsio.com #define iscsi_task_cxgbi_data(task) \
559e3d2ad8cSkxie@chelsio.com ((task)->dd_data + sizeof(struct iscsi_tcp_task))
5609ba682f0Skxie@chelsio.com
561e33c2482SVarun Prakash struct cxgbi_iso_info {
562e33c2482SVarun Prakash #define CXGBI_ISO_INFO_FSLICE 0x1
563e33c2482SVarun Prakash #define CXGBI_ISO_INFO_LSLICE 0x2
564e33c2482SVarun Prakash #define CXGBI_ISO_INFO_IMM_ENABLE 0x4
565e33c2482SVarun Prakash u8 flags;
566e33c2482SVarun Prakash u8 op;
567e33c2482SVarun Prakash u8 ahs;
568e33c2482SVarun Prakash u8 num_pdu;
569e33c2482SVarun Prakash u32 mpdu;
570e33c2482SVarun Prakash u32 burst_size;
571e33c2482SVarun Prakash u32 len;
572e33c2482SVarun Prakash u32 segment_offset;
573e33c2482SVarun Prakash u32 datasn_offset;
574e33c2482SVarun Prakash u32 buffer_offset;
575e33c2482SVarun Prakash };
576e33c2482SVarun Prakash
cxgbi_set_iscsi_ipv4(struct cxgbi_hba * chba,__be32 ipaddr)5779ba682f0Skxie@chelsio.com static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr)
5789ba682f0Skxie@chelsio.com {
5799ba682f0Skxie@chelsio.com if (chba->cdev->flags & CXGBI_FLAG_IPV4_SET)
5809ba682f0Skxie@chelsio.com chba->ipv4addr = ipaddr;
5819ba682f0Skxie@chelsio.com else
5829ba682f0Skxie@chelsio.com pr_info("set iscsi ipv4 NOT supported, using %s ipv4.\n",
5839ba682f0Skxie@chelsio.com chba->ndev->name);
5849ba682f0Skxie@chelsio.com }
5859ba682f0Skxie@chelsio.com
5869ba682f0Skxie@chelsio.com struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int);
5879ba682f0Skxie@chelsio.com void cxgbi_device_unregister(struct cxgbi_device *);
5889ba682f0Skxie@chelsio.com void cxgbi_device_unregister_all(unsigned int flag);
5899ba682f0Skxie@chelsio.com struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
590fc8d0590SAnish Bhatt struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
591078efae0SAnish Bhatt struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
592078efae0SAnish Bhatt int *);
5931abf635dSHannes Reinecke int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
594*80602acaSBart Van Assche const struct scsi_host_template *,
5959ba682f0Skxie@chelsio.com struct scsi_transport_template *);
5969ba682f0Skxie@chelsio.com void cxgbi_hbas_remove(struct cxgbi_device *);
5979ba682f0Skxie@chelsio.com
5989ba682f0Skxie@chelsio.com int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
5999ba682f0Skxie@chelsio.com unsigned int max_conn);
6009ba682f0Skxie@chelsio.com void cxgbi_device_portmap_cleanup(struct cxgbi_device *cdev);
6019ba682f0Skxie@chelsio.com
6029ba682f0Skxie@chelsio.com void cxgbi_conn_tx_open(struct cxgbi_sock *);
6039ba682f0Skxie@chelsio.com void cxgbi_conn_pdu_ready(struct cxgbi_sock *);
6049ba682f0Skxie@chelsio.com int cxgbi_conn_alloc_pdu(struct iscsi_task *, u8);
6059ba682f0Skxie@chelsio.com int cxgbi_conn_init_pdu(struct iscsi_task *, unsigned int , unsigned int);
6069ba682f0Skxie@chelsio.com int cxgbi_conn_xmit_pdu(struct iscsi_task *);
6079ba682f0Skxie@chelsio.com
6089ba682f0Skxie@chelsio.com void cxgbi_cleanup_task(struct iscsi_task *task);
6099ba682f0Skxie@chelsio.com
610587a1f16SAl Viro umode_t cxgbi_attr_is_visible(int param_type, int param);
6119ba682f0Skxie@chelsio.com void cxgbi_get_conn_stats(struct iscsi_cls_conn *, struct iscsi_stats *);
6129ba682f0Skxie@chelsio.com int cxgbi_set_conn_param(struct iscsi_cls_conn *,
6139ba682f0Skxie@chelsio.com enum iscsi_param, char *, int);
614c71b9b66SMike Christie int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param, char *);
6159ba682f0Skxie@chelsio.com struct iscsi_cls_conn *cxgbi_create_conn(struct iscsi_cls_session *, u32);
6169ba682f0Skxie@chelsio.com int cxgbi_bind_conn(struct iscsi_cls_session *,
6179ba682f0Skxie@chelsio.com struct iscsi_cls_conn *, u64, int);
6189ba682f0Skxie@chelsio.com void cxgbi_destroy_session(struct iscsi_cls_session *);
6199ba682f0Skxie@chelsio.com struct iscsi_cls_session *cxgbi_create_session(struct iscsi_endpoint *,
6209ba682f0Skxie@chelsio.com u16, u16, u32);
6219ba682f0Skxie@chelsio.com int cxgbi_set_host_param(struct Scsi_Host *,
6229ba682f0Skxie@chelsio.com enum iscsi_host_param, char *, int);
6239ba682f0Skxie@chelsio.com int cxgbi_get_host_param(struct Scsi_Host *, enum iscsi_host_param, char *);
6249ba682f0Skxie@chelsio.com struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *,
6259ba682f0Skxie@chelsio.com struct sockaddr *, int);
6269ba682f0Skxie@chelsio.com int cxgbi_ep_poll(struct iscsi_endpoint *, int);
6279ba682f0Skxie@chelsio.com void cxgbi_ep_disconnect(struct iscsi_endpoint *);
6289ba682f0Skxie@chelsio.com
6299ba682f0Skxie@chelsio.com int cxgbi_iscsi_init(struct iscsi_transport *,
6309ba682f0Skxie@chelsio.com struct scsi_transport_template **);
6319ba682f0Skxie@chelsio.com void cxgbi_iscsi_cleanup(struct iscsi_transport *,
6329ba682f0Skxie@chelsio.com struct scsi_transport_template **);
6339ba682f0Skxie@chelsio.com void cxgbi_parse_pdu_itt(struct iscsi_conn *, itt_t, int *, int *);
6349ba682f0Skxie@chelsio.com int cxgbi_ddp_init(struct cxgbi_device *, unsigned int, unsigned int,
6359ba682f0Skxie@chelsio.com unsigned int, unsigned int);
6369ba682f0Skxie@chelsio.com int cxgbi_ddp_cleanup(struct cxgbi_device *);
6379ba682f0Skxie@chelsio.com void cxgbi_ddp_page_size_factor(int *);
63871f7a00bSVarun Prakash void cxgbi_ddp_set_one_ppod(struct cxgbi_pagepod *,
63971f7a00bSVarun Prakash struct cxgbi_task_tag_info *,
64071f7a00bSVarun Prakash struct scatterlist **sg_pp, unsigned int *sg_off);
641a248384eSVarun Prakash int cxgbi_ddp_ppm_setup(void **ppm_pp, struct cxgbi_device *cdev,
642a248384eSVarun Prakash struct cxgbi_tag_format *tformat,
643a248384eSVarun Prakash unsigned int iscsi_size, unsigned int llimit,
644a248384eSVarun Prakash unsigned int start, unsigned int rsvd_factor,
645a248384eSVarun Prakash unsigned int edram_start, unsigned int edram_size);
6469ba682f0Skxie@chelsio.com #endif /*__LIBCXGBI_H__*/
647