iscsi_tcp.c (3eb66e91a25497065c5322b1268cbc3953642227) iscsi_tcp.c (ae3d56d81507c33024ba7c1eae2ef433aa9bc0d5)
1/*
2 * iSCSI Initiator over TCP/IP Data-Path
3 *
4 * Copyright (C) 2004 Dmitry Yusupov
5 * Copyright (C) 2004 Alex Aizman
6 * Copyright (C) 2005 - 2006 Mike Christie
7 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
8 * maintained by open-iscsi@googlegroups.com

--- 30 unchanged lines hidden (view full) ---

39#include <linux/module.h>
40#include <linux/backing-dev.h>
41#include <net/tcp.h>
42#include <scsi/scsi_cmnd.h>
43#include <scsi/scsi_device.h>
44#include <scsi/scsi_host.h>
45#include <scsi/scsi.h>
46#include <scsi/scsi_transport_iscsi.h>
1/*
2 * iSCSI Initiator over TCP/IP Data-Path
3 *
4 * Copyright (C) 2004 Dmitry Yusupov
5 * Copyright (C) 2004 Alex Aizman
6 * Copyright (C) 2005 - 2006 Mike Christie
7 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
8 * maintained by open-iscsi@googlegroups.com

--- 30 unchanged lines hidden (view full) ---

39#include <linux/module.h>
40#include <linux/backing-dev.h>
41#include <net/tcp.h>
42#include <scsi/scsi_cmnd.h>
43#include <scsi/scsi_device.h>
44#include <scsi/scsi_host.h>
45#include <scsi/scsi.h>
46#include <scsi/scsi_transport_iscsi.h>
47#include <trace/events/iscsi.h>
47
48#include "iscsi_tcp.h"
49
50MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
51 "Dmitry Yusupov <dmitry_yus@yahoo.com>, "
52 "Alex Aizman <itn780@yahoo.com>");
53MODULE_DESCRIPTION("iSCSI/TCP data-path");
54MODULE_LICENSE("GPL");

--- 12 unchanged lines hidden (view full) ---

67 "Set to 1 to turn on, and zero to turn off. Default is off.");
68
69#define ISCSI_SW_TCP_DBG(_conn, dbg_fmt, arg...) \
70 do { \
71 if (iscsi_sw_tcp_dbg) \
72 iscsi_conn_printk(KERN_INFO, _conn, \
73 "%s " dbg_fmt, \
74 __func__, ##arg); \
48
49#include "iscsi_tcp.h"
50
51MODULE_AUTHOR("Mike Christie <michaelc@cs.wisc.edu>, "
52 "Dmitry Yusupov <dmitry_yus@yahoo.com>, "
53 "Alex Aizman <itn780@yahoo.com>");
54MODULE_DESCRIPTION("iSCSI/TCP data-path");
55MODULE_LICENSE("GPL");

--- 12 unchanged lines hidden (view full) ---

68 "Set to 1 to turn on, and zero to turn off. Default is off.");
69
70#define ISCSI_SW_TCP_DBG(_conn, dbg_fmt, arg...) \
71 do { \
72 if (iscsi_sw_tcp_dbg) \
73 iscsi_conn_printk(KERN_INFO, _conn, \
74 "%s " dbg_fmt, \
75 __func__, ##arg); \
76 iscsi_dbg_trace(trace_iscsi_dbg_sw_tcp, \
77 &(_conn)->cls_conn->dev, \
78 "%s " dbg_fmt, __func__, ##arg);\
75 } while (0);
76
77
78/**
79 * iscsi_sw_tcp_recv - TCP receive in sendfile fashion
80 * @rd_desc: read descriptor
81 * @skb: socket buffer
82 * @offset: offset in skb

--- 426 unchanged lines hidden (view full) ---

509 iscsi_sw_tcp_send_hdr_prep(conn, task->hdr, task->hdr_len);
510
511 if (!count)
512 return 0;
513
514 if (!task->sc)
515 iscsi_sw_tcp_send_linear_data_prep(conn, task->data, count);
516 else {
79 } while (0);
80
81
82/**
83 * iscsi_sw_tcp_recv - TCP receive in sendfile fashion
84 * @rd_desc: read descriptor
85 * @skb: socket buffer
86 * @offset: offset in skb

--- 426 unchanged lines hidden (view full) ---

513 iscsi_sw_tcp_send_hdr_prep(conn, task->hdr, task->hdr_len);
514
515 if (!count)
516 return 0;
517
518 if (!task->sc)
519 iscsi_sw_tcp_send_linear_data_prep(conn, task->data, count);
520 else {
517 struct scsi_data_buffer *sdb = scsi_out(task->sc);
521 struct scsi_data_buffer *sdb = &task->sc->sdb;
518
519 err = iscsi_sw_tcp_send_data_prep(conn, sdb->table.sgl,
520 sdb->table.nents, offset,
521 count);
522 }
523
524 if (err) {
525 /* got invalid offset/len */

--- 417 unchanged lines hidden (view full) ---

943 default:
944 return 0;
945 }
946 }
947
948 return 0;
949}
950
522
523 err = iscsi_sw_tcp_send_data_prep(conn, sdb->table.sgl,
524 sdb->table.nents, offset,
525 count);
526 }
527
528 if (err) {
529 /* got invalid offset/len */

--- 417 unchanged lines hidden (view full) ---

947 default:
948 return 0;
949 }
950 }
951
952 return 0;
953}
954
951static int iscsi_sw_tcp_slave_alloc(struct scsi_device *sdev)
952{
953 blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue);
954 return 0;
955}
956
957static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev)
958{
959 struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(sdev->host);
960 struct iscsi_session *session = tcp_sw_host->session;
961 struct iscsi_conn *conn = session->leadconn;
962
963 if (conn->datadgst_en)
964 sdev->request_queue->backing_dev_info->capabilities

--- 10 unchanged lines hidden (view full) ---

975 .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1,
976 .sg_tablesize = 4096,
977 .max_sectors = 0xFFFF,
978 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
979 .eh_timed_out = iscsi_eh_cmd_timed_out,
980 .eh_abort_handler = iscsi_eh_abort,
981 .eh_device_reset_handler= iscsi_eh_device_reset,
982 .eh_target_reset_handler = iscsi_eh_recover_target,
955static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev)
956{
957 struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(sdev->host);
958 struct iscsi_session *session = tcp_sw_host->session;
959 struct iscsi_conn *conn = session->leadconn;
960
961 if (conn->datadgst_en)
962 sdev->request_queue->backing_dev_info->capabilities

--- 10 unchanged lines hidden (view full) ---

973 .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1,
974 .sg_tablesize = 4096,
975 .max_sectors = 0xFFFF,
976 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
977 .eh_timed_out = iscsi_eh_cmd_timed_out,
978 .eh_abort_handler = iscsi_eh_abort,
979 .eh_device_reset_handler= iscsi_eh_device_reset,
980 .eh_target_reset_handler = iscsi_eh_recover_target,
983 .use_clustering = DISABLE_CLUSTERING,
984 .slave_alloc = iscsi_sw_tcp_slave_alloc,
981 .dma_boundary = PAGE_SIZE - 1,
985 .slave_configure = iscsi_sw_tcp_slave_configure,
986 .target_alloc = iscsi_target_alloc,
987 .proc_name = "iscsi_tcp",
988 .this_id = -1,
989 .track_queue_depth = 1,
990};
991
992static struct iscsi_transport iscsi_sw_tcp_transport = {

--- 58 unchanged lines hidden ---
982 .slave_configure = iscsi_sw_tcp_slave_configure,
983 .target_alloc = iscsi_target_alloc,
984 .proc_name = "iscsi_tcp",
985 .this_id = -1,
986 .track_queue_depth = 1,
987};
988
989static struct iscsi_transport iscsi_sw_tcp_transport = {

--- 58 unchanged lines hidden ---