^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * iSCSI Initiator TCP Transport
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2004 Dmitry Yusupov
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2004 Alex Aizman
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2005 - 2006 Mike Christie
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * maintained by open-iscsi@googlegroups.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * See the file COPYING included with this distribution for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #ifndef ISCSI_SW_TCP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define ISCSI_SW_TCP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <scsi/libiscsi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <scsi/libiscsi_tcp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct socket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct iscsi_tcp_conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* Socket connection send helper */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct iscsi_sw_tcp_send {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct iscsi_hdr *hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) struct iscsi_segment segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct iscsi_segment data_segment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct iscsi_sw_tcp_conn {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct socket *sock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct iscsi_sw_tcp_send out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* old values for socket callbacks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) void (*old_data_ready)(struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) void (*old_state_change)(struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void (*old_write_space)(struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* data and header digests */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct ahash_request *tx_hash; /* CRC32C (Tx) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct ahash_request *rx_hash; /* CRC32C (Rx) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* MIB custom statistics */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) uint32_t sendpage_failures_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) uint32_t discontiguous_hdr_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct iscsi_sw_tcp_host {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct iscsi_session *session;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct iscsi_sw_tcp_hdrbuf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct iscsi_hdr hdrbuf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) char hdrextbuf[ISCSI_MAX_AHS_SIZE +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ISCSI_DIGEST_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif /* ISCSI_SW_TCP_H */