aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2018-12-20 01:00:21 +0000
committerNavdeep Parhar <np@FreeBSD.org>2018-12-20 01:00:21 +0000
commitb562884d6387994782ab40fd107ddd94c371f25a (patch)
tree43c7a0b805c8479eb1449dce598633b57b8b8493
parent121684b714cf5ef11aadc05b7e91b908540a0f94 (diff)
downloadsrc-b562884d6387994782ab40fd107ddd94c371f25a.tar.gz
src-b562884d6387994782ab40fd107ddd94c371f25a.zip
cxgbe/iw_cxgbe: Add a knob for testing that lets iWARP connections cycle
through 4-tuples quickly. Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications
Notes
Notes: svn path=/head/; revision=342270
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/cm.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c
index 92ab27f44da4..33b054f3fdd0 100644
--- a/sys/dev/cxgbe/iw_cxgbe/cm.c
+++ b/sys/dev/cxgbe/iw_cxgbe/cm.c
@@ -1273,6 +1273,9 @@ int inline_threshold = 128;
SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, inline_threshold, CTLFLAG_RWTUN, &inline_threshold, 0,
"inline vs dsgl threshold (default=128)");
+static int reuseaddr = 0;
+SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, reuseaddr, CTLFLAG_RWTUN, &reuseaddr, 0,
+ "Enable SO_REUSEADDR & SO_REUSEPORT socket options on all iWARP client connections(default = 0)");
static void
start_ep_timer(struct c4iw_ep *ep)
@@ -2519,8 +2522,9 @@ static int
c4iw_sock_create(struct sockaddr_storage *laddr, struct socket **so)
{
int ret;
- int size;
+ int size, on;
struct socket *sock = NULL;
+ struct sockopt sopt;
ret = sock_create_kern(laddr->ss_family,
SOCK_STREAM, IPPROTO_TCP, &sock);
@@ -2530,6 +2534,33 @@ c4iw_sock_create(struct sockaddr_storage *laddr, struct socket **so)
return ret;
}
+ if (reuseaddr) {
+ bzero(&sopt, sizeof(struct sockopt));
+ sopt.sopt_dir = SOPT_SET;
+ sopt.sopt_level = SOL_SOCKET;
+ sopt.sopt_name = SO_REUSEADDR;
+ on = 1;
+ sopt.sopt_val = &on;
+ sopt.sopt_valsize = sizeof(on);
+ ret = sosetopt(sock, &sopt);
+ if (ret != 0) {
+ log(LOG_ERR, "%s: sosetopt(%p, SO_REUSEADDR) "
+ "failed with %d.\n", __func__, sock, ret);
+ }
+ bzero(&sopt, sizeof(struct sockopt));
+ sopt.sopt_dir = SOPT_SET;
+ sopt.sopt_level = SOL_SOCKET;
+ sopt.sopt_name = SO_REUSEPORT;
+ on = 1;
+ sopt.sopt_val = &on;
+ sopt.sopt_valsize = sizeof(on);
+ ret = sosetopt(sock, &sopt);
+ if (ret != 0) {
+ log(LOG_ERR, "%s: sosetopt(%p, SO_REUSEPORT) "
+ "failed with %d.\n", __func__, sock, ret);
+ }
+ }
+
ret = sobind(sock, (struct sockaddr *)laddr, curthread);
if (ret) {
CTR2(KTR_IW_CXGBE, "%s:Failed to bind socket. err %p",