[SCSI] aacraid driver update
[deliverable/linux.git] / drivers / scsi / cxgb3i / cxgb3i.h
CommitLineData
c3673464
KX
1/*
2 * cxgb3i.h: Chelsio S3xx iSCSI driver.
3 *
4 * Copyright (c) 2008 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 */
12
13#ifndef __CXGB3I_H__
14#define __CXGB3I_H__
15
16#include <linux/module.h>
17#include <linux/moduleparam.h>
18#include <linux/errno.h>
19#include <linux/types.h>
20#include <linux/list.h>
21#include <linux/netdevice.h>
22#include <linux/scatterlist.h>
949847d1 23#include <linux/skbuff.h>
c3673464
KX
24#include <scsi/libiscsi_tcp.h>
25
26/* from cxgb3 LLD */
27#include "common.h"
28#include "t3_cpl.h"
29#include "t3cdev.h"
30#include "cxgb3_ctl_defs.h"
31#include "cxgb3_offload.h"
32#include "firmware_exports.h"
33
34#include "cxgb3i_offload.h"
35#include "cxgb3i_ddp.h"
36
37#define CXGB3I_SCSI_QDEPTH_DFLT 128
38#define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN
39#define CXGB3I_MAX_LUN 512
40#define ISCSI_PDU_NONPAYLOAD_MAX \
41 (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE + 2*ISCSI_DIGEST_SIZE)
42
43struct cxgb3i_adapter;
44struct cxgb3i_hba;
45struct cxgb3i_endpoint;
46
47/**
48 * struct cxgb3i_hba - cxgb3i iscsi structure (per port)
49 *
50 * @snic: cxgb3i adapter containing this port
51 * @ndev: pointer to netdev structure
52 * @shost: pointer to scsi host structure
53 */
54struct cxgb3i_hba {
55 struct cxgb3i_adapter *snic;
56 struct net_device *ndev;
57 struct Scsi_Host *shost;
58};
59
60/**
61 * struct cxgb3i_adapter - cxgb3i adapter structure (per pci)
62 *
63 * @listhead: list head to link elements
64 * @lock: lock for this structure
65 * @tdev: pointer to t3cdev used by cxgb3 driver
66 * @pdev: pointer to pci dev
67 * @hba_cnt: # of hbas (the same as # of ports)
68 * @hba: all the hbas on this adapter
69 * @tx_max_size: max. tx packet size supported
70 * @rx_max_size: max. rx packet size supported
71 * @tag_format: ddp tag format settings
72 */
73struct cxgb3i_adapter {
74 struct list_head list_head;
75 spinlock_t lock;
76 struct t3cdev *tdev;
77 struct pci_dev *pdev;
78 unsigned char hba_cnt;
79 struct cxgb3i_hba *hba[MAX_NPORTS];
80
81 unsigned int tx_max_size;
82 unsigned int rx_max_size;
83
84 struct cxgb3i_tag_format tag_format;
85};
86
87/**
88 * struct cxgb3i_conn - cxgb3i iscsi connection
89 *
90 * @listhead: list head to link elements
91 * @cep: pointer to iscsi_endpoint structure
92 * @conn: pointer to iscsi_conn structure
93 * @hba: pointer to the hba this conn. is going through
94 * @task_idx_bits: # of bits needed for session->cmds_max
95 */
96struct cxgb3i_conn {
97 struct list_head list_head;
98 struct cxgb3i_endpoint *cep;
99 struct iscsi_conn *conn;
100 struct cxgb3i_hba *hba;
101 unsigned int task_idx_bits;
102};
103
104/**
105 * struct cxgb3i_endpoint - iscsi tcp endpoint
106 *
107 * @c3cn: the h/w tcp connection representation
108 * @hba: pointer to the hba this conn. is going through
109 * @cconn: pointer to the associated cxgb3i iscsi connection
110 */
111struct cxgb3i_endpoint {
112 struct s3_conn *c3cn;
113 struct cxgb3i_hba *hba;
114 struct cxgb3i_conn *cconn;
115};
116
949847d1
KX
117/**
118 * struct cxgb3i_task_data - private iscsi task data
119 *
120 * @nr_frags: # of coalesced page frags (from scsi sgl)
121 * @frags: coalesced page frags (from scsi sgl)
122 * @skb: tx pdu skb
123 * @offset: data offset for the next pdu
124 * @count: max. possible pdu payload
125 * @sgoffset: offset to the first sg entry for a given offset
126 */
127#define MAX_PDU_FRAGS ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
128struct cxgb3i_task_data {
129 unsigned short nr_frags;
130 skb_frag_t frags[MAX_PDU_FRAGS];
131 struct sk_buff *skb;
132 unsigned int offset;
133 unsigned int count;
134 unsigned int sgoffset;
135};
136
c3673464
KX
137int cxgb3i_iscsi_init(void);
138void cxgb3i_iscsi_cleanup(void);
139
140struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *);
141void cxgb3i_adapter_remove(struct t3cdev *);
142int cxgb3i_adapter_ulp_init(struct cxgb3i_adapter *);
143void cxgb3i_adapter_ulp_cleanup(struct cxgb3i_adapter *);
144
145struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *);
146struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *,
147 struct net_device *);
148void cxgb3i_hba_host_remove(struct cxgb3i_hba *);
149
150int cxgb3i_pdu_init(void);
151void cxgb3i_pdu_cleanup(void);
152void cxgb3i_conn_cleanup_task(struct iscsi_task *);
153int cxgb3i_conn_alloc_pdu(struct iscsi_task *, u8);
154int cxgb3i_conn_init_pdu(struct iscsi_task *, unsigned int, unsigned int);
155int cxgb3i_conn_xmit_pdu(struct iscsi_task *);
156
157void cxgb3i_release_itt(struct iscsi_task *task, itt_t hdr_itt);
158int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt);
159
160#endif
This page took 0.071162 seconds and 5 git commands to generate.