All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 10/10][RFC] linux-iscsi driver
@ 2005-01-10 23:04 Mike Christie
  0 siblings, 0 replies; only message in thread
From: Mike Christie @ 2005-01-10 23:04 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

functions to copy iscsi portal info and
a misc iscsi-protocol.h file which holds
defintitions using iscsi.h or will some
day be moved to iscsi.h.

[-- Attachment #2: 10-portal-helpers.patch --]
[-- Type: text/x-patch, Size: 6361 bytes --]

diff -Naurp scsi-misc-2.6.orig/drivers/scsi/iscsi-sfnet/iscsi-portal.c scsi-misc-2.6.patch/drivers/scsi/iscsi-sfnet/iscsi-portal.c
--- scsi-misc-2.6.orig/drivers/scsi/iscsi-sfnet/iscsi-portal.c	1969-12-31 16:00:00.000000000 -0800
+++ scsi-misc-2.6.patch/drivers/scsi/iscsi-sfnet/iscsi-portal.c	2005-01-10 12:35:57.790300833 -0800
@@ -0,0 +1,104 @@
+/*
+ * iSCSI driver for Linux
+ * Copyright (C) 2001 Cisco Systems, Inc.
+ * maintained by linux-iscsi-devel@lists.sourceforge.net
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ *
+ * Portal setup functions
+ */
+#include <linux/kernel.h>
+#include <linux/inet.h>
+#include <linux/in.h>
+
+#include "iscsi-session.h"
+#include "iscsi-ioctl.h"
+#include "iscsi-sfnet.h"
+
+/* caller must hold the session's portal_lock */
+void
+iscsi_set_portal_info(struct iscsi_session *session)
+{
+	/*
+	 * Set the session timeouts and iSCSI op params based on the portal's
+	 * settings. Don't change the address, since a termporary redirect may
+	 * have already changed the address, and we want to use the redirected
+	 * address rather than the portal's address.
+	 */
+	session->login_timeout = session->portal.login_timeout;
+	session->active_timeout = session->portal.active_timeout;
+	session->idle_timeout = session->portal.idle_timeout;
+	session->ping_timeout = session->portal.ping_timeout;
+	session->abort_timeout = session->portal.abort_timeout;
+	session->reset_timeout = session->portal.reset_timeout;
+	session->replacement_timeout = session->portal.replacement_timeout;
+
+	session->initial_r2t = session->portal.initial_r2t;
+	session->immediate_data = session->portal.immediate_data;
+	session->max_recv_data_segment_len =
+		session->portal.max_recv_data_segment_len;
+	session->first_burst_len = session->portal.first_burst_len;
+	session->max_burst_len = session->portal.max_burst_len;
+	session->def_time2wait = session->portal.def_time2wait;
+	session->def_time2retain = session->portal.def_time2retain;
+
+	session->header_digest = session->portal.header_digest;
+	session->data_digest = session->portal.data_digest;
+
+	session->portal_group_tag = session->portal.tag;
+
+	/* TCP options */
+	session->tcp_window_size = session->portal.tcp_window_size;
+	/* FIXME: type_of_service */
+}
+
+/* caller must hold the session's portal_lock */
+void
+iscsi_set_portal(struct iscsi_session *session)
+{
+	/* address */
+	memcpy(&session->addr, &session->portal.addr, sizeof(struct sockaddr));
+	/* timeouts, operational params, other settings */
+	iscsi_set_portal_info(session);
+}
+
+/*
+ * returns 1 if a relogin is required.
+ * caller must hold the session's portal_lock
+ */
+int
+iscsi_update_portal_info(struct iscsi_portal_info *old,
+			 struct iscsi_portal_info *new)
+{
+	int ret = 0;
+
+	/*
+	 * ping_timeout change requires a relogin because we ask the target to
+	 * use it as well with com.cisco.PingTimeout
+	 */
+	if (new->ping_timeout != old->ping_timeout ||
+	    new->initial_r2t != old->initial_r2t ||
+	    new->immediate_data != old->immediate_data ||
+	    new->max_recv_data_segment_len != old->max_recv_data_segment_len ||
+	    new->first_burst_len != old->first_burst_len ||
+	    new->max_burst_len != old->max_burst_len ||
+	    new->def_time2wait != old->def_time2wait ||
+	    new->def_time2retain != old->def_time2retain ||
+	    new->header_digest != old->header_digest ||
+	    new->data_digest != old->data_digest ||
+	    new->tcp_window_size != old->tcp_window_size)
+                ret = 1;
+
+	memcpy(old, new, sizeof(*old));
+	return ret;
+}
diff -Naurp scsi-misc-2.6.orig/drivers/scsi/iscsi-sfnet/iscsi-portal.h scsi-misc-2.6.patch/drivers/scsi/iscsi-sfnet/iscsi-portal.h
--- scsi-misc-2.6.orig/drivers/scsi/iscsi-sfnet/iscsi-portal.h	1969-12-31 16:00:00.000000000 -0800
+++ scsi-misc-2.6.patch/drivers/scsi/iscsi-sfnet/iscsi-portal.h	2005-01-10 12:35:57.791300704 -0800
@@ -0,0 +1,62 @@
+/*
+ * iSCSI driver for Linux
+ * Copyright (C) 2001 Cisco Systems, Inc.
+ * Copyright (C) 2004 Mike Christie
+ * Copyright (C) 2004 IBM Corporation
+ * maintained by linux-iscsi-devel@lists.sourceforge.net
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ *
+ * portal info structure used in ioctls and the kernel module
+ */
+#ifndef ISCSI_PORTAL_H_
+#define ISCSI_PORTAL_H_
+
+#include <linux/socket.h>
+
+struct iscsi_session;
+
+/*
+ * iscsi_portal_info - contains the values userspace had
+ * requested. This differs from the session duplicates
+ * as those are the values we negotiated with the target
+ */
+struct iscsi_portal_info {
+	int	login_timeout;
+	int	active_timeout;
+	int	idle_timeout;
+	int	ping_timeout;
+	int	abort_timeout;
+	int	reset_timeout;
+	int	replacement_timeout;
+	int	initial_r2t;
+	int	immediate_data;
+	int	max_recv_data_segment_len;
+	int	first_burst_len;
+	int	max_burst_len;
+	int	def_time2wait;
+	int	def_time2retain;
+	int	header_digest;
+	int	data_digest;
+	int	tag;
+	int	tcp_window_size;
+	int	type_of_service;
+	/* support ipv4 when we finish the interface */
+	struct sockaddr addr;
+};
+
+extern void iscsi_set_portal_info(struct iscsi_session *session);
+extern void iscsi_set_portal(struct iscsi_session *session);
+extern int iscsi_update_portal_info(struct iscsi_portal_info *old,
+				    struct iscsi_portal_info *new);
+#endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-10 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-10 23:04 [PATCH 10/10][RFC] linux-iscsi driver Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.