3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
24 */
25 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
27 /*
28 * Portions of this source code were derived from Berkeley
29 * 4.3 BSD under license from the Regents of the University of
30 * California.
31 */
32
33 /*
34 * Server side of RPC over RDMA in the kernel.
35 */
36
37 #include <sys/param.h>
38 #include <sys/types.h>
39 #include <sys/user.h>
40 #include <sys/sysmacros.h>
41 #include <sys/proc.h>
42 #include <sys/file.h>
1122 return (NULL);
1123 }
1124
1125 /* ARGSUSED */
1126 static void
1127 svc_rdma_kfreeres(SVCXPRT *clone_xprt)
1128 {
1129 }
1130
1131 /*
1132 * the dup cacheing routines below provide a cache of non-failure
1133 * transaction id's. rpc service routines can use this to detect
1134 * retransmissions and re-send a non-failure response.
1135 */
1136
1137 /*
1138 * MAXDUPREQS is the number of cached items. It should be adjusted
1139 * to the service load so that there is likely to be a response entry
1140 * when the first retransmission comes in.
1141 */
1142 #define MAXDUPREQS 1024
1143
1144 /*
1145 * This should be appropriately scaled to MAXDUPREQS.
1146 */
1147 #define DRHASHSZ 257
1148
1149 #if ((DRHASHSZ & (DRHASHSZ - 1)) == 0)
1150 #define XIDHASH(xid) ((xid) & (DRHASHSZ - 1))
1151 #else
1152 #define XIDHASH(xid) ((xid) % DRHASHSZ)
1153 #endif
1154 #define DRHASH(dr) XIDHASH((dr)->dr_xid)
1155 #define REQTOXID(req) ((req)->rq_xprt->xp_xid)
1156
1157 static int rdmandupreqs = 0;
1158 int rdmamaxdupreqs = MAXDUPREQS;
1159 static kmutex_t rdmadupreq_lock;
1160 static struct dupreq *rdmadrhashtbl[DRHASHSZ];
1161 static int rdmadrhashstat[DRHASHSZ];
1162
1163 static void unhash(struct dupreq *);
1164
1165 /*
1166 * rdmadrmru points to the head of a circular linked list in lru order.
1167 * rdmadrmru->dr_next == drlru
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29 * Portions of this source code were derived from Berkeley
30 * 4.3 BSD under license from the Regents of the University of
31 * California.
32 */
33
34 /*
35 * Server side of RPC over RDMA in the kernel.
36 */
37
38 #include <sys/param.h>
39 #include <sys/types.h>
40 #include <sys/user.h>
41 #include <sys/sysmacros.h>
42 #include <sys/proc.h>
43 #include <sys/file.h>
1123 return (NULL);
1124 }
1125
1126 /* ARGSUSED */
1127 static void
1128 svc_rdma_kfreeres(SVCXPRT *clone_xprt)
1129 {
1130 }
1131
1132 /*
1133 * the dup cacheing routines below provide a cache of non-failure
1134 * transaction id's. rpc service routines can use this to detect
1135 * retransmissions and re-send a non-failure response.
1136 */
1137
1138 /*
1139 * MAXDUPREQS is the number of cached items. It should be adjusted
1140 * to the service load so that there is likely to be a response entry
1141 * when the first retransmission comes in.
1142 */
1143 #define MAXDUPREQS 8192
1144
1145 /*
1146 * This should be appropriately scaled to MAXDUPREQS.
1147 */
1148 #define DRHASHSZ 2053
1149
1150 #if ((DRHASHSZ & (DRHASHSZ - 1)) == 0)
1151 #define XIDHASH(xid) ((xid) & (DRHASHSZ - 1))
1152 #else
1153 #define XIDHASH(xid) ((xid) % DRHASHSZ)
1154 #endif
1155 #define DRHASH(dr) XIDHASH((dr)->dr_xid)
1156 #define REQTOXID(req) ((req)->rq_xprt->xp_xid)
1157
1158 static int rdmandupreqs = 0;
1159 int rdmamaxdupreqs = MAXDUPREQS;
1160 static kmutex_t rdmadupreq_lock;
1161 static struct dupreq *rdmadrhashtbl[DRHASHSZ];
1162 static int rdmadrhashstat[DRHASHSZ];
1163
1164 static void unhash(struct dupreq *);
1165
1166 /*
1167 * rdmadrmru points to the head of a circular linked list in lru order.
1168 * rdmadrmru->dr_next == drlru
|