diff options
author | mav <mav@FreeBSD.org> | 2014-11-22 15:09:18 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-11-22 15:09:18 +0000 |
commit | 2efae2e6b18d927420b0efb91643ae5aaecb550a (patch) | |
tree | aeb65e65f9fc0f17e3b1102476294ff7d9c3f021 /usr.sbin/iscsid | |
parent | bc2cba33a9b7b0a543aa63d3146154bd5eb8ce22 (diff) | |
download | FreeBSD-src-2efae2e6b18d927420b0efb91643ae5aaecb550a.zip FreeBSD-src-2efae2e6b18d927420b0efb91643ae5aaecb550a.tar.gz |
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.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 10 | ||||
-rw-r--r-- | usr.sbin/iscsid/iscsid.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index a7f489e..a6feb6a 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -160,7 +160,7 @@ connection_new(unsigned int session_id, const uint8_t isid[8], uint16_t tsih, #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, const uint8_t isid[8], uint16_t tsih, 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); diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h index b05c222..9ad3325 100644 --- a/usr.sbin/iscsid/iscsid.h +++ b/usr.sbin/iscsid/iscsid.h @@ -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; |