~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/scsi/libiscsi_tcp.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * iSCSI over TCP/IP Data-Path lib
  4  *
  5  * Copyright (C) 2008 Mike Christie
  6  * Copyright (C) 2008 Red Hat, Inc.  All rights reserved.
  7  * maintained by open-iscsi@googlegroups.com
  8  */
  9 
 10 #ifndef LIBISCSI_TCP_H
 11 #define LIBISCSI_TCP_H
 12 
 13 #include <scsi/libiscsi.h>
 14 
 15 struct iscsi_tcp_conn;
 16 struct iscsi_segment;
 17 struct sk_buff;
 18 struct ahash_request;
 19 
 20 typedef int iscsi_segment_done_fn_t(struct iscsi_tcp_conn *,
 21                                     struct iscsi_segment *);
 22 
 23 struct iscsi_segment {
 24         unsigned char           *data;
 25         unsigned int            size;
 26         unsigned int            copied;
 27         unsigned int            total_size;
 28         unsigned int            total_copied;
 29 
 30         struct ahash_request    *hash;
 31         unsigned char           padbuf[ISCSI_PAD_LEN];
 32         unsigned char           recv_digest[ISCSI_DIGEST_SIZE];
 33         unsigned char           digest[ISCSI_DIGEST_SIZE];
 34         unsigned int            digest_len;
 35 
 36         struct scatterlist      *sg;
 37         void                    *sg_mapped;
 38         unsigned int            sg_offset;
 39         bool                    atomic_mapped;
 40 
 41         iscsi_segment_done_fn_t *done;
 42 };
 43 
 44 /* Socket connection receive helper */
 45 struct iscsi_tcp_recv {
 46         struct iscsi_hdr        *hdr;
 47         struct iscsi_segment    segment;
 48 
 49         /* Allocate buffer for BHS + AHS */
 50         uint32_t                hdr_buf[64];
 51 
 52         /* copied and flipped values */
 53         int                     datalen;
 54 };
 55 
 56 struct iscsi_tcp_conn {
 57         struct iscsi_conn       *iscsi_conn;
 58         void                    *dd_data;
 59         int                     stop_stage;     /* conn_stop() flag: *
 60                                                  * stop to recover,  *
 61                                                  * stop to terminate */
 62         /* control data */
 63         struct iscsi_tcp_recv   in;             /* TCP receive context */
 64         /* CRC32C (Rx) LLD should set this is they do not offload */
 65         struct ahash_request    *rx_hash;
 66 };
 67 
 68 struct iscsi_tcp_task {
 69         uint32_t                exp_datasn;     /* expected target's R2TSN/DataSN */
 70         int                     data_offset;
 71         struct iscsi_r2t_info   *r2t;           /* in progress solict R2T */
 72         struct iscsi_pool       r2tpool;
 73         struct kfifo            r2tqueue;
 74         void                    *dd_data;
 75         spinlock_t              pool2queue;
 76         spinlock_t              queue2pool;
 77 };
 78 
 79 enum {
 80         ISCSI_TCP_SEGMENT_DONE,         /* curr seg has been processed */
 81         ISCSI_TCP_SKB_DONE,             /* skb is out of data */
 82         ISCSI_TCP_CONN_ERR,             /* iscsi layer has fired a conn err */
 83         ISCSI_TCP_SUSPENDED,            /* conn is suspended */
 84 };
 85 
 86 extern void iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn);
 87 extern int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb,
 88                               unsigned int offset, bool offloaded, int *status);
 89 extern void iscsi_tcp_cleanup_task(struct iscsi_task *task);
 90 extern int iscsi_tcp_task_init(struct iscsi_task *task);
 91 extern int iscsi_tcp_task_xmit(struct iscsi_task *task);
 92 
 93 /* segment helpers */
 94 extern int iscsi_tcp_recv_segment_is_hdr(struct iscsi_tcp_conn *tcp_conn);
 95 extern int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
 96                                   struct iscsi_segment *segment, int recv,
 97                                   unsigned copied);
 98 extern void iscsi_tcp_segment_unmap(struct iscsi_segment *segment);
 99 
100 extern void iscsi_segment_init_linear(struct iscsi_segment *segment,
101                                       void *data, size_t size,
102                                       iscsi_segment_done_fn_t *done,
103                                       struct ahash_request *hash);
104 extern int
105 iscsi_segment_seek_sg(struct iscsi_segment *segment,
106                       struct scatterlist *sg_list, unsigned int sg_count,
107                       unsigned int offset, size_t size,
108                       iscsi_segment_done_fn_t *done,
109                       struct ahash_request *hash);
110 
111 /* digest helpers */
112 extern void iscsi_tcp_dgst_header(struct ahash_request *hash, const void *hdr,
113                                   size_t hdrlen,
114                                   unsigned char digest[ISCSI_DIGEST_SIZE]);
115 extern struct iscsi_cls_conn *
116 iscsi_tcp_conn_setup(struct iscsi_cls_session *cls_session, int dd_data_size,
117                      uint32_t conn_idx);
118 extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn);
119 
120 /* misc helpers */
121 extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session);
122 extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session);
123 extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf);
124 extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn,
125                                      struct iscsi_stats *stats);
126 #endif /* LIBISCSI_TCP_H */
127 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php