blob: ca6b7bc64de0a41f9fd411f66ab2008e49888258 [file] [log] [blame]
Alex Aizmanc213ca02005-08-04 19:30:31 -07001/*
2 * iSCSI Initiator TCP Transport
3 * Copyright (C) 2004 Dmitry Yusupov
4 * Copyright (C) 2004 Alex Aizman
Mike Christie5bb0b552006-04-06 21:26:46 -05005 * Copyright (C) 2005 - 2006 Mike Christie
6 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
Alex Aizmanc213ca02005-08-04 19:30:31 -07007 * maintained by open-iscsi@googlegroups.com
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * See the file COPYING included with this distribution for more details.
20 */
21
Mike Christie38e1a8f2008-12-02 00:32:12 -060022#ifndef ISCSI_SW_TCP_H
23#define ISCSI_SW_TCP_H
Alex Aizmanc213ca02005-08-04 19:30:31 -070024
Mike Christie5bb0b552006-04-06 21:26:46 -050025#include <scsi/libiscsi.h>
Mike Christie38e1a8f2008-12-02 00:32:12 -060026#include <scsi/libiscsi_tcp.h>
Alex Aizmanc213ca02005-08-04 19:30:31 -070027
Mike Christie5bb0b552006-04-06 21:26:46 -050028struct socket;
Olaf Kirchda32dd62007-12-13 12:43:21 -060029struct iscsi_tcp_conn;
Olaf Kirchda32dd62007-12-13 12:43:21 -060030
31/* Socket connection send helper */
Mike Christie38e1a8f2008-12-02 00:32:12 -060032struct iscsi_sw_tcp_send {
Olaf Kirchda32dd62007-12-13 12:43:21 -060033 struct iscsi_hdr *hdr;
Olaf Kircha8ac6312007-12-13 12:43:35 -060034 struct iscsi_segment segment;
35 struct iscsi_segment data_segment;
Alex Aizmanc213ca02005-08-04 19:30:31 -070036};
37
Mike Christie38e1a8f2008-12-02 00:32:12 -060038struct iscsi_sw_tcp_conn {
Mike Christie5bb0b552006-04-06 21:26:46 -050039 struct iscsi_conn *iscsi_conn;
40 struct socket *sock;
Alex Aizmanc213ca02005-08-04 19:30:31 -070041
Mike Christie38e1a8f2008-12-02 00:32:12 -060042 struct iscsi_sw_tcp_send out;
Alex Aizmanc213ca02005-08-04 19:30:31 -070043 /* old values for socket callbacks */
44 void (*old_data_ready)(struct sock *, int);
45 void (*old_state_change)(struct sock *);
46 void (*old_write_space)(struct sock *);
47
Mike Christiedd8c0d92006-08-31 18:09:28 -040048 /* data and header digests */
James Bottomleyc9802cd2006-09-23 15:33:43 -050049 struct hash_desc tx_hash; /* CRC32C (Tx) */
50 struct hash_desc rx_hash; /* CRC32C (Rx) */
Alex Aizmanc213ca02005-08-04 19:30:31 -070051
Mike Christie5bb0b552006-04-06 21:26:46 -050052 /* MIB custom statistics */
Alex Aizmanc213ca02005-08-04 19:30:31 -070053 uint32_t sendpage_failures_cnt;
54 uint32_t discontiguous_hdr_cnt;
FUJITA Tomonori56851692006-01-13 18:05:44 -060055
Olaf Kircha8ac6312007-12-13 12:43:35 -060056 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
Alex Aizmanc213ca02005-08-04 19:30:31 -070057};
58
Mike Christie38e1a8f2008-12-02 00:32:12 -060059struct iscsi_sw_tcp_hdrbuf {
60 struct iscsi_hdr hdrbuf;
61 char hdrextbuf[ISCSI_MAX_AHS_SIZE +
Boaz Harrosh004d6532007-12-13 12:43:23 -060062 ISCSI_DIGEST_SIZE];
Alex Aizmanc213ca02005-08-04 19:30:31 -070063};
64
Mike Christie38e1a8f2008-12-02 00:32:12 -060065#endif /* ISCSI_SW_TCP_H */