blob: 791453195099c0f67a4299d5e4ec0596e5df8a0a [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Alex Aizmanc213ca02005-08-04 19:30:31 -07002/*
3 * iSCSI Initiator TCP Transport
4 * Copyright (C) 2004 Dmitry Yusupov
5 * Copyright (C) 2004 Alex Aizman
Mike Christie5bb0b552006-04-06 21:26:46 -05006 * Copyright (C) 2005 - 2006 Mike Christie
7 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
Alex Aizmanc213ca02005-08-04 19:30:31 -07008 * maintained by open-iscsi@googlegroups.com
9 *
Alex Aizmanc213ca02005-08-04 19:30:31 -070010 * See the file COPYING included with this distribution for more details.
11 */
12
Mike Christie38e1a8f2008-12-02 00:32:12 -060013#ifndef ISCSI_SW_TCP_H
14#define ISCSI_SW_TCP_H
Alex Aizmanc213ca02005-08-04 19:30:31 -070015
Mike Christie5bb0b552006-04-06 21:26:46 -050016#include <scsi/libiscsi.h>
Mike Christie38e1a8f2008-12-02 00:32:12 -060017#include <scsi/libiscsi_tcp.h>
Alex Aizmanc213ca02005-08-04 19:30:31 -070018
Mike Christie5bb0b552006-04-06 21:26:46 -050019struct socket;
Olaf Kirchda32dd62007-12-13 12:43:21 -060020struct iscsi_tcp_conn;
Olaf Kirchda32dd62007-12-13 12:43:21 -060021
22/* Socket connection send helper */
Mike Christie38e1a8f2008-12-02 00:32:12 -060023struct iscsi_sw_tcp_send {
Olaf Kirchda32dd62007-12-13 12:43:21 -060024 struct iscsi_hdr *hdr;
Olaf Kircha8ac6312007-12-13 12:43:35 -060025 struct iscsi_segment segment;
26 struct iscsi_segment data_segment;
Alex Aizmanc213ca02005-08-04 19:30:31 -070027};
28
Mike Christie38e1a8f2008-12-02 00:32:12 -060029struct iscsi_sw_tcp_conn {
Mike Christie5bb0b552006-04-06 21:26:46 -050030 struct socket *sock;
Alex Aizmanc213ca02005-08-04 19:30:31 -070031
Mike Christie38e1a8f2008-12-02 00:32:12 -060032 struct iscsi_sw_tcp_send out;
Alex Aizmanc213ca02005-08-04 19:30:31 -070033 /* old values for socket callbacks */
David S. Miller676d2362014-04-11 16:15:36 -040034 void (*old_data_ready)(struct sock *);
Alex Aizmanc213ca02005-08-04 19:30:31 -070035 void (*old_state_change)(struct sock *);
36 void (*old_write_space)(struct sock *);
37
Mike Christiedd8c0d92006-08-31 18:09:28 -040038 /* data and header digests */
Herbert Xu5d6ac292016-01-24 21:19:41 +080039 struct ahash_request *tx_hash; /* CRC32C (Tx) */
40 struct ahash_request *rx_hash; /* CRC32C (Rx) */
Alex Aizmanc213ca02005-08-04 19:30:31 -070041
Mike Christie5bb0b552006-04-06 21:26:46 -050042 /* MIB custom statistics */
Alex Aizmanc213ca02005-08-04 19:30:31 -070043 uint32_t sendpage_failures_cnt;
44 uint32_t discontiguous_hdr_cnt;
FUJITA Tomonori56851692006-01-13 18:05:44 -060045
Olaf Kircha8ac6312007-12-13 12:43:35 -060046 ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
Alex Aizmanc213ca02005-08-04 19:30:31 -070047};
48
Mike Christiea79af8a2011-02-16 15:04:36 -060049struct iscsi_sw_tcp_host {
50 struct iscsi_session *session;
51};
52
Mike Christie38e1a8f2008-12-02 00:32:12 -060053struct iscsi_sw_tcp_hdrbuf {
54 struct iscsi_hdr hdrbuf;
55 char hdrextbuf[ISCSI_MAX_AHS_SIZE +
Boaz Harrosh004d6532007-12-13 12:43:23 -060056 ISCSI_DIGEST_SIZE];
Alex Aizmanc213ca02005-08-04 19:30:31 -070057};
58
Mike Christie38e1a8f2008-12-02 00:32:12 -060059#endif /* ISCSI_SW_TCP_H */