Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
libiscsi_tcp.c File Reference
#include <linux/types.h>
#include <linux/list.h>
#include <linux/inet.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/blkdev.h>
#include <linux/crypto.h>
#include <linux/delay.h>
#include <linux/kfifo.h>
#include <linux/scatterlist.h>
#include <linux/module.h>
#include <net/tcp.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi.h>
#include <scsi/scsi_transport_iscsi.h>
#include "iscsi_tcp.h"

Go to the source code of this file.


#define ISCSI_DBG_TCP(_conn, dbg_fmt, arg...)


 MODULE_AUTHOR ("Mike Christie <[email protected]>, ""Dmitry Yusupov <[email protected]>, ""Alex Aizman <[email protected]>")
 module_param_named (debug_libiscsi_tcp, iscsi_dbg_libtcp, int, S_IRUGO|S_IWUSR)
 MODULE_PARM_DESC (debug_libiscsi_tcp,"Turn on debugging for libiscsi_tcp ""module. Set to 1 to turn on, and zero to turn off. Default ""is off.")
void iscsi_tcp_segment_unmap (struct iscsi_segment *segment)
 EXPORT_SYMBOL_GPL (iscsi_tcp_segment_unmap)
int iscsi_tcp_segment_done (struct iscsi_tcp_conn *tcp_conn, struct iscsi_segment *segment, int recv, unsigned copied)
 EXPORT_SYMBOL_GPL (iscsi_tcp_segment_done)
void iscsi_tcp_dgst_header (struct hash_desc *hash, const void *hdr, size_t hdrlen, unsigned char digest[ISCSI_DIGEST_SIZE])
 EXPORT_SYMBOL_GPL (iscsi_tcp_dgst_header)
void iscsi_segment_init_linear (struct iscsi_segment *segment, void *data, size_t size, iscsi_segment_done_fn_t *done, struct hash_desc *hash)
 EXPORT_SYMBOL_GPL (iscsi_segment_init_linear)
int iscsi_segment_seek_sg (struct iscsi_segment *segment, struct scatterlist *sg_list, unsigned int sg_count, unsigned int offset, size_t size, iscsi_segment_done_fn_t *done, struct hash_desc *hash)
 EXPORT_SYMBOL_GPL (iscsi_segment_seek_sg)
void iscsi_tcp_hdr_recv_prep (struct iscsi_tcp_conn *tcp_conn)
 EXPORT_SYMBOL_GPL (iscsi_tcp_hdr_recv_prep)
void iscsi_tcp_cleanup_task (struct iscsi_task *task)
 EXPORT_SYMBOL_GPL (iscsi_tcp_cleanup_task)
int iscsi_tcp_recv_segment_is_hdr (struct iscsi_tcp_conn *tcp_conn)
 EXPORT_SYMBOL_GPL (iscsi_tcp_recv_segment_is_hdr)
int iscsi_tcp_recv_skb (struct iscsi_conn *conn, struct sk_buff *skb, unsigned int offset, bool offloaded, int *status)
 EXPORT_SYMBOL_GPL (iscsi_tcp_recv_skb)
int iscsi_tcp_task_init (struct iscsi_task *task)
 EXPORT_SYMBOL_GPL (iscsi_tcp_task_init)
int iscsi_tcp_task_xmit (struct iscsi_task *task)
 EXPORT_SYMBOL_GPL (iscsi_tcp_task_xmit)
struct iscsi_cls_conniscsi_tcp_conn_setup (struct iscsi_cls_session *cls_session, int dd_data_size, uint32_t conn_idx)
 EXPORT_SYMBOL_GPL (iscsi_tcp_conn_setup)
void iscsi_tcp_conn_teardown (struct iscsi_cls_conn *cls_conn)
 EXPORT_SYMBOL_GPL (iscsi_tcp_conn_teardown)
int iscsi_tcp_r2tpool_alloc (struct iscsi_session *session)
 EXPORT_SYMBOL_GPL (iscsi_tcp_r2tpool_alloc)
void iscsi_tcp_r2tpool_free (struct iscsi_session *session)
 EXPORT_SYMBOL_GPL (iscsi_tcp_r2tpool_free)
int iscsi_tcp_set_max_r2t (struct iscsi_conn *conn, char *buf)
 EXPORT_SYMBOL_GPL (iscsi_tcp_set_max_r2t)
void iscsi_tcp_conn_get_stats (struct iscsi_cls_conn *cls_conn, struct iscsi_stats *stats)
 EXPORT_SYMBOL_GPL (iscsi_tcp_conn_get_stats)

Macro Definition Documentation

#define ISCSI_DBG_TCP (   _conn,
do { \
if (iscsi_dbg_libtcp) \
iscsi_conn_printk(KERN_INFO, _conn, \
"%s " dbg_fmt, \
__func__, ##arg); \
} while (0);

Definition at line 62 of file libiscsi_tcp.c.

Function Documentation

EXPORT_SYMBOL_GPL ( iscsi_tcp_segment_unmap  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_segment_done  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_dgst_header  )
EXPORT_SYMBOL_GPL ( iscsi_segment_init_linear  )
EXPORT_SYMBOL_GPL ( iscsi_segment_seek_sg  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_hdr_recv_prep  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_cleanup_task  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_recv_segment_is_hdr  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_recv_skb  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_task_init  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_task_xmit  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_conn_setup  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_conn_teardown  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_r2tpool_alloc  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_r2tpool_free  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_set_max_r2t  )
EXPORT_SYMBOL_GPL ( iscsi_tcp_conn_get_stats  )
void iscsi_segment_init_linear ( struct iscsi_segment segment,
void data,
size_t  size,
iscsi_segment_done_fn_t done,
struct hash_desc hash 

Definition at line 357 of file libiscsi_tcp.c.

int iscsi_segment_seek_sg ( struct iscsi_segment segment,
struct scatterlist sg_list,
unsigned int  sg_count,
unsigned int  offset,
size_t  size,
iscsi_segment_done_fn_t done,
struct hash_desc hash 

Definition at line 368 of file libiscsi_tcp.c.

void iscsi_tcp_cleanup_task ( struct iscsi_task task)

iscsi_tcp_cleanup_task - free tcp_task resources : iscsi task

must be called with session lock

Definition at line 451 of file libiscsi_tcp.c.

void iscsi_tcp_conn_get_stats ( struct iscsi_cls_conn cls_conn,
struct iscsi_stats stats 

Definition at line 1191 of file libiscsi_tcp.c.

struct iscsi_cls_conn* iscsi_tcp_conn_setup ( struct iscsi_cls_session cls_session,
int  dd_data_size,
uint32_t  conn_idx 

Definition at line 1080 of file libiscsi_tcp.c.

void iscsi_tcp_conn_teardown ( struct iscsi_cls_conn cls_conn)

Definition at line 1106 of file libiscsi_tcp.c.

void iscsi_tcp_dgst_header ( struct hash_desc hash,
const void hdr,
size_t  hdrlen,
unsigned char  digest[ISCSI_DIGEST_SIZE] 

Definition at line 313 of file libiscsi_tcp.c.

void iscsi_tcp_hdr_recv_prep ( struct iscsi_tcp_conn tcp_conn)

iscsi_tcp_hdr_recv_prep - prep segment for hdr reception : iscsi connection to prep for

This function always passes NULL for the hash argument, because when this function is called we do not yet know the final size of the header and want to delay the digest processing until we know that.

Definition at line 397 of file libiscsi_tcp.c.

int iscsi_tcp_r2tpool_alloc ( struct iscsi_session session)

Definition at line 1112 of file libiscsi_tcp.c.

void iscsi_tcp_r2tpool_free ( struct iscsi_session session)

Definition at line 1159 of file libiscsi_tcp.c.

int iscsi_tcp_recv_segment_is_hdr ( struct iscsi_tcp_conn tcp_conn)

iscsi_tcp_recv_segment_is_hdr - tests if we are reading in a header : iscsi tcp conn

returns non zero if we are currently processing or setup to process a header.

Definition at line 855 of file libiscsi_tcp.c.

int iscsi_tcp_recv_skb ( struct iscsi_conn conn,
struct sk_buff skb,
unsigned int  offset,
bool  offloaded,
int status 

iscsi_tcp_recv_skb - Process skb : iscsi connection : network buffer with header and/or data segment : offset in skb : bool indicating if transfer was offloaded

Will return status of transfer in status. And will return number of bytes copied.

Definition at line 871 of file libiscsi_tcp.c.

int iscsi_tcp_segment_done ( struct iscsi_tcp_conn tcp_conn,
struct iscsi_segment segment,
int  recv,
unsigned  copied 

iscsi_tcp_segment_done - check whether the segment is complete : iscsi tcp connection : iscsi segment to check : set to one of this is called from the recv path : number of bytes copied

Check if we're done receiving this segment. If the receive buffer is full but we expect more data, move on to the next entry in the scatterlist.

If the amount of data we received isn't a multiple of 4, we will transparently receive the pad bytes, too.

This function must be re-entrant.

Definition at line 192 of file libiscsi_tcp.c.

void iscsi_tcp_segment_unmap ( struct iscsi_segment segment)

Definition at line 148 of file libiscsi_tcp.c.

int iscsi_tcp_set_max_r2t ( struct iscsi_conn conn,
char buf 

Definition at line 1173 of file libiscsi_tcp.c.

int iscsi_tcp_task_init ( struct iscsi_task task)

iscsi_tcp_task_init - Initialize iSCSI SCSI_READ or SCSI_WRITE commands : iscsi connection : scsi command task : scsi command

Definition at line 950 of file libiscsi_tcp.c.

int iscsi_tcp_task_xmit ( struct iscsi_task task)

iscsi_tcp_task_xmit - xmit normal PDU task : iscsi command task

We're expected to return 0 when everything was transmitted successfully, -EAGAIN if there's still data in the queue, or != 0 for any other kind of error.

Definition at line 1027 of file libiscsi_tcp.c.

MODULE_AUTHOR ( "Mike Christie <[email protected] ,
""Dmitry Yusupov< dmitry_yus >  ,
""Alex Aizman< itn780 >"   
module_param_named ( debug_libiscsi_tcp  ,
iscsi_dbg_libtcp  ,
int  ,
MODULE_PARM_DESC ( debug_libiscsi_tcp  ,
"Turn on debugging for libiscsi_tcp ""module. Set to 1 to turn  on,
and zero to turn off.Default""is off."