blob: 666fe09378fa580d62f2625f174f85bec7ece228 [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 socket *sock;
Alex Aizmanc213ca02005-08-04 19:30:31 -070040
Mike Christie38e1a8f2008-12-02 00:32:12 -060041 struct iscsi_sw_tcp_send out;
Alex Aizmanc213ca02005-08-04 19:30:31 -070042 /* old values for socket callbacks */
43 void (*old_data_ready)(struct sock *, int);
44 void (*old_state_change)(struct sock *);
45 void (*old_write_space)(struct sock *);
46
Mike Christiedd8c0d92006-08-31 18:09:28 -040047 /* data and header digests */
James Bottomleyc9802cd2006-09-23 15:33:43 -050048 struct hash_desc tx_hash; /* CRC32C (Tx) */
49 struct hash_desc rx_hash; /* CRC32C (Rx) */
Alex Aizmanc213ca02005-08-04 19:30:31 -070050
Mike Christie5bb0b552006-04-06 21:26:46 -050051 /* MIB custom statistics */
Alex Aizmanc213ca02005-08-04 19:30:31 -070052 uint32_t sendpage_failures_cnt;
53 uint32_t discontiguous_hdr_cnt;
FUJITA Tomonori56851692006-01-13 18:05:44 -060054
Olaf Kircha8ac6312007-12-13 12:43:35 -060055 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
Alex Aizmanc213ca02005-08-04 19:30:31 -070056};
57
Mike Christiea79af8a2011-02-16 15:04:36 -060058struct iscsi_sw_tcp_host {
59 struct iscsi_session *session;
60};
61
Mike Christie38e1a8f2008-12-02 00:32:12 -060062struct iscsi_sw_tcp_hdrbuf {
63 struct iscsi_hdr hdrbuf;
64 char hdrextbuf[ISCSI_MAX_AHS_SIZE +
Boaz Harrosh004d6532007-12-13 12:43:23 -060065 ISCSI_DIGEST_SIZE];
Alex Aizmanc213ca02005-08-04 19:30:31 -070066};
67
Mike Christie38e1a8f2008-12-02 00:32:12 -060068#endif /* ISCSI_SW_TCP_H */