Mercurial > illumos > illumos-gate
comparison usr/src/uts/common/io/idm/idm_so.c @ 14071:da0f6329dac3
3861 tcp buffer size tunables for iscsi connections
Reviewed by: Peng Dai <peng.dai@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
author | Jeff Biseda <jeff.biseda@delphix.com> |
---|---|
date | Wed, 03 Jul 2013 11:54:31 -0800 |
parents | 64ac0ea7036d |
children | dc50d198fe94 |
comparison
equal
deleted
inserted
replaced
14070:d4c9f8eba8fa | 14071:da0f6329dac3 |
---|---|
19 * CDDL HEADER END | 19 * CDDL HEADER END |
20 */ | 20 */ |
21 /* | 21 /* |
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. | 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved. |
23 * Use is subject to license terms. | 23 * Use is subject to license terms. |
24 */ | |
25 /* | |
26 * Copyright (c) 2013 by Delphix. All rights reserved. | |
24 */ | 27 */ |
25 | 28 |
26 #include <sys/conf.h> | 29 #include <sys/conf.h> |
27 #include <sys/stat.h> | 30 #include <sys/stat.h> |
28 #include <sys/file.h> | 31 #include <sys/file.h> |
68 static void idm_so_conn_destroy_common(idm_conn_t *ic); | 71 static void idm_so_conn_destroy_common(idm_conn_t *ic); |
69 static void idm_so_conn_connect_common(idm_conn_t *ic); | 72 static void idm_so_conn_connect_common(idm_conn_t *ic); |
70 | 73 |
71 static void idm_set_ini_preconnect_options(idm_so_conn_t *sc, | 74 static void idm_set_ini_preconnect_options(idm_so_conn_t *sc, |
72 boolean_t boot_conn); | 75 boolean_t boot_conn); |
73 static void idm_set_ini_postconnect_options(idm_so_conn_t *sc); | 76 static void idm_set_postconnect_options(ksocket_t so); |
74 static void idm_set_tgt_connect_options(ksocket_t so); | |
75 static idm_status_t idm_i_so_tx(idm_pdu_t *pdu); | 77 static idm_status_t idm_i_so_tx(idm_pdu_t *pdu); |
76 | 78 |
77 static idm_status_t idm_sorecvdata(idm_conn_t *ic, idm_pdu_t *pdu); | 79 static idm_status_t idm_sorecvdata(idm_conn_t *ic, idm_pdu_t *pdu); |
78 static void idm_so_send_rtt_data(idm_conn_t *ic, idm_task_t *idt, | 80 static void idm_so_send_rtt_data(idm_conn_t *ic, idm_task_t *idt, |
79 idm_buf_t *idb, uint32_t offset, uint32_t length); | 81 idm_buf_t *idb, uint32_t offset, uint32_t length); |
160 idm_so_conn_disconnect, /* it_ini_conn_disconnect */ | 162 idm_so_conn_disconnect, /* it_ini_conn_disconnect */ |
161 idm_so_declare_key_values /* it_declare_key_values */ | 163 idm_so_declare_key_values /* it_declare_key_values */ |
162 }; | 164 }; |
163 | 165 |
164 kmutex_t idm_so_timed_socket_mutex; | 166 kmutex_t idm_so_timed_socket_mutex; |
167 | |
168 int32_t idm_so_sndbuf = IDM_SNDBUF_SIZE; | |
169 int32_t idm_so_rcvbuf = IDM_RCVBUF_SIZE; | |
170 | |
165 /* | 171 /* |
166 * idm_so_init() | 172 * idm_so_init() |
167 * Sockets transport initialization | 173 * Sockets transport initialization |
168 */ | 174 */ |
169 void | 175 void |
705 (char *)&abort, sizeof (int), CRED()); | 711 (char *)&abort, sizeof (int), CRED()); |
706 } | 712 } |
707 } | 713 } |
708 | 714 |
709 static void | 715 static void |
710 idm_set_ini_postconnect_options(idm_so_conn_t *sc) | 716 idm_set_postconnect_options(ksocket_t ks) |
711 { | 717 { |
712 int32_t rcvbuf = IDM_RCVBUF_SIZE; | |
713 int32_t sndbuf = IDM_SNDBUF_SIZE; | |
714 const int on = 1; | |
715 | |
716 /* Set postconnect options */ | |
717 (void) ksocket_setsockopt(sc->ic_so, IPPROTO_TCP, TCP_NODELAY, | |
718 (char *)&on, sizeof (int), CRED()); | |
719 (void) ksocket_setsockopt(sc->ic_so, SOL_SOCKET, SO_RCVBUF, | |
720 (char *)&rcvbuf, sizeof (int), CRED()); | |
721 (void) ksocket_setsockopt(sc->ic_so, SOL_SOCKET, SO_SNDBUF, | |
722 (char *)&sndbuf, sizeof (int), CRED()); | |
723 } | |
724 | |
725 static void | |
726 idm_set_tgt_connect_options(ksocket_t ks) | |
727 { | |
728 int32_t rcvbuf = IDM_RCVBUF_SIZE; | |
729 int32_t sndbuf = IDM_SNDBUF_SIZE; | |
730 const int on = 1; | 718 const int on = 1; |
731 | 719 |
732 /* Set connect options */ | 720 /* Set connect options */ |
733 (void) ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVBUF, | 721 (void) ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVBUF, |
734 (char *)&rcvbuf, sizeof (int), CRED()); | 722 (char *)&idm_so_rcvbuf, sizeof (int), CRED()); |
735 (void) ksocket_setsockopt(ks, SOL_SOCKET, SO_SNDBUF, | 723 (void) ksocket_setsockopt(ks, SOL_SOCKET, SO_SNDBUF, |
736 (char *)&sndbuf, sizeof (int), CRED()); | 724 (char *)&idm_so_sndbuf, sizeof (int), CRED()); |
737 (void) ksocket_setsockopt(ks, IPPROTO_TCP, TCP_NODELAY, | 725 (void) ksocket_setsockopt(ks, IPPROTO_TCP, TCP_NODELAY, |
738 (char *)&on, sizeof (on), CRED()); | 726 (char *)&on, sizeof (on), CRED()); |
739 } | 727 } |
740 | 728 |
741 static uint32_t | 729 static uint32_t |
958 return (IDM_STATUS_FAIL); | 946 return (IDM_STATUS_FAIL); |
959 } | 947 } |
960 | 948 |
961 idm_so_conn_connect_common(ic); | 949 idm_so_conn_connect_common(ic); |
962 | 950 |
963 idm_set_ini_postconnect_options(so_conn); | 951 idm_set_postconnect_options(so_conn->ic_so); |
964 | 952 |
965 return (IDM_STATUS_SUCCESS); | 953 return (IDM_STATUS_SUCCESS); |
966 } | 954 } |
967 | 955 |
968 idm_status_t | 956 idm_status_t |
969 idm_so_tgt_conn_create(idm_conn_t *ic, ksocket_t new_so) | 957 idm_so_tgt_conn_create(idm_conn_t *ic, ksocket_t new_so) |
970 { | 958 { |
971 idm_status_t idmrc; | 959 idm_status_t idmrc; |
972 | 960 |
961 idm_set_postconnect_options(new_so); | |
973 idmrc = idm_so_conn_create_common(ic, new_so); | 962 idmrc = idm_so_conn_create_common(ic, new_so); |
974 | 963 |
975 return (idmrc); | 964 return (idmrc); |
976 } | 965 } |
977 | 966 |
1168 idm_sodestroy(so_svc->is_so); | 1157 idm_sodestroy(so_svc->is_so); |
1169 return (IDM_STATUS_FAIL); | 1158 return (IDM_STATUS_FAIL); |
1170 } | 1159 } |
1171 } | 1160 } |
1172 | 1161 |
1173 idm_set_tgt_connect_options(so_svc->is_so); | 1162 idm_set_postconnect_options(so_svc->is_so); |
1174 | 1163 |
1175 if (ksocket_listen(so_svc->is_so, 5, CRED()) != 0) { | 1164 if (ksocket_listen(so_svc->is_so, 5, CRED()) != 0) { |
1176 mutex_exit(&is->is_mutex); | 1165 mutex_exit(&is->is_mutex); |
1177 idm_soshutdown(so_svc->is_so); | 1166 idm_soshutdown(so_svc->is_so); |
1178 idm_sodestroy(so_svc->is_so); | 1167 idm_sodestroy(so_svc->is_so); |