Date: Thu, 19 Feb 2015 14:28:48 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r279001 - in stable/10: sys/dev/iscsi usr.sbin/ctld usr.sbin/iscsid Message-ID: <201502191428.t1JESmUW099827@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Feb 19 14:28:47 2015 New Revision: 279001 URL: https://svnweb.freebsd.org/changeset/base/279001 Log: MFC r274853: For both iSCSI initiator and target increase socket buffer sizes before establishing connection. This is a workaround for Chelsio TOE driver, that does not update socket buffer size in hardware after connection established, and unless that is done beforehand, kernel code will stuck, attempting to send/receive full PDU at once. Modified: stable/10/sys/dev/iscsi/icl.c stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/iscsid/iscsid.c stable/10/usr.sbin/iscsid/iscsid.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iscsi/icl.c ============================================================================== --- stable/10/sys/dev/iscsi/icl.c Thu Feb 19 14:26:49 2015 (r279000) +++ stable/10/sys/dev/iscsi/icl.c Thu Feb 19 14:28:47 2015 (r279001) @@ -1204,6 +1204,8 @@ icl_conn_start(struct icl_conn *ic) icl_conn_close(ic); return (error); } + ic->ic_socket->so_snd.sb_flags |= SB_AUTOSIZE; + ic->ic_socket->so_rcv.sb_flags |= SB_AUTOSIZE; /* * Disable Nagle. Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Thu Feb 19 14:26:49 2015 (r279000) +++ stable/10/usr.sbin/ctld/ctld.c Thu Feb 19 14:28:47 2015 (r279001) @@ -1604,7 +1604,7 @@ conf_apply(struct conf *oldconf, struct struct portal *oldp, *newp; struct isns *oldns, *newns; pid_t otherpid; - int changed, cumulated_error = 0, error; + int changed, cumulated_error = 0, error, sockbuf; int one = 1; if (oldconf->conf_debug != newconf->conf_debug) { @@ -1901,6 +1901,16 @@ conf_apply(struct conf *oldconf, struct cumulated_error++; continue; } + sockbuf = SOCKBUF_SIZE; + if (setsockopt(newp->p_socket, SOL_SOCKET, SO_RCVBUF, + &sockbuf, sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_RCVBUF) failed " + "for %s", newp->p_listen); + sockbuf = SOCKBUF_SIZE; + if (setsockopt(newp->p_socket, SOL_SOCKET, SO_SNDBUF, + &sockbuf, sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_SNDBUF) failed " + "for %s", newp->p_listen); error = setsockopt(newp->p_socket, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); if (error != 0) { Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Thu Feb 19 14:26:49 2015 (r279000) +++ stable/10/usr.sbin/ctld/ctld.h Thu Feb 19 14:28:47 2015 (r279001) @@ -48,6 +48,7 @@ #define MAX_NAME_LEN 223 #define MAX_DATA_SEGMENT_LENGTH (128 * 1024) #define MAX_BURST_LENGTH 16776192 +#define SOCKBUF_SIZE 1048576 struct auth { TAILQ_ENTRY(auth) a_next; Modified: stable/10/usr.sbin/iscsid/iscsid.c ============================================================================== --- stable/10/usr.sbin/iscsid/iscsid.c Thu Feb 19 14:26:49 2015 (r279000) +++ stable/10/usr.sbin/iscsid/iscsid.c Thu Feb 19 14:28:47 2015 (r279001) @@ -160,7 +160,7 @@ connection_new(unsigned int session_id, #ifdef ICL_KERNEL_PROXY struct iscsi_daemon_connect idc; #endif - int error; + int error, sockbuf; conn = calloc(1, sizeof(*conn)); if (conn == NULL) @@ -237,6 +237,14 @@ connection_new(unsigned int session_id, fail(conn, strerror(errno)); log_err(1, "failed to create socket for %s", from_addr); } + sockbuf = SOCKBUF_SIZE; + if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_RCVBUF, + &sockbuf, sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_RCVBUF) failed"); + sockbuf = SOCKBUF_SIZE; + if (setsockopt(conn->conn_socket, SOL_SOCKET, SO_SNDBUF, + &sockbuf, sizeof(sockbuf)) == -1) + log_warn("setsockopt(SO_SNDBUF) failed"); if (from_ai != NULL) { error = bind(conn->conn_socket, from_ai->ai_addr, from_ai->ai_addrlen); Modified: stable/10/usr.sbin/iscsid/iscsid.h ============================================================================== --- stable/10/usr.sbin/iscsid/iscsid.h Thu Feb 19 14:26:49 2015 (r279000) +++ stable/10/usr.sbin/iscsid/iscsid.h Thu Feb 19 14:28:47 2015 (r279001) @@ -44,6 +44,7 @@ #define CONN_DIGEST_CRC32C 1 #define CONN_MUTUAL_CHALLENGE_LEN 1024 +#define SOCKBUF_SIZE 1048576 struct connection { int conn_iscsi_fd;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502191428.t1JESmUW099827>