1d9ad96c1Srg137905 /* 2d9ad96c1Srg137905 * CDDL HEADER START 3d9ad96c1Srg137905 * 4d9ad96c1Srg137905 * The contents of this file are subject to the terms of the 548a34407Srmesta * Common Development and Distribution License (the "License"). 648a34407Srmesta * You may not use this file except in compliance with the License. 7d9ad96c1Srg137905 * 8d9ad96c1Srg137905 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9d9ad96c1Srg137905 * or http://www.opensolaris.org/os/licensing. 10d9ad96c1Srg137905 * See the License for the specific language governing permissions 11d9ad96c1Srg137905 * and limitations under the License. 12d9ad96c1Srg137905 * 13d9ad96c1Srg137905 * When distributing Covered Code, include this CDDL HEADER in each 14d9ad96c1Srg137905 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15d9ad96c1Srg137905 * If applicable, add the following below this CDDL HEADER, with the 16d9ad96c1Srg137905 * fields enclosed by brackets "[]" replaced with your own identifying 17d9ad96c1Srg137905 * information: Portions Copyright [yyyy] [name of copyright owner] 18d9ad96c1Srg137905 * 19d9ad96c1Srg137905 * CDDL HEADER END 20d9ad96c1Srg137905 */ 21*0dfe541eSEvan Layton 22d9ad96c1Srg137905 /* 23b4467216Spf199842 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24d9ad96c1Srg137905 * Use is subject to license terms. 25d9ad96c1Srg137905 */ 26d9ad96c1Srg137905 27*0dfe541eSEvan Layton /* 28*0dfe541eSEvan Layton * Copyright 2018 Nexenta Systems, Inc. 29*0dfe541eSEvan Layton */ 30*0dfe541eSEvan Layton 31d9ad96c1Srg137905 #ifndef _NFS4_DRC_H 32d9ad96c1Srg137905 #define _NFS4_DRC_H 33d9ad96c1Srg137905 34d9ad96c1Srg137905 #ifdef __cplusplus 35d9ad96c1Srg137905 extern "C" { 36d9ad96c1Srg137905 #endif 37d9ad96c1Srg137905 38d9ad96c1Srg137905 /* 39d9ad96c1Srg137905 * NFSv4 Duplicate Request cache. 40d9ad96c1Srg137905 */ 41d9ad96c1Srg137905 typedef struct rfs4_drc { 42d9ad96c1Srg137905 kmutex_t lock; 43d9ad96c1Srg137905 uint32_t dr_hash; 44d9ad96c1Srg137905 uint32_t max_size; 45d9ad96c1Srg137905 uint32_t in_use; 46d9ad96c1Srg137905 list_t dr_cache; 47d9ad96c1Srg137905 list_t *dr_buckets; 48d9ad96c1Srg137905 } rfs4_drc_t; 49d9ad96c1Srg137905 50d9ad96c1Srg137905 /* 51d9ad96c1Srg137905 * NFSv4 Duplicate request cache entry. 52d9ad96c1Srg137905 */ 53d9ad96c1Srg137905 typedef struct rfs4_dupreq { 54d9ad96c1Srg137905 list_node_t dr_bkt_next; 55d9ad96c1Srg137905 list_node_t dr_next; 56d9ad96c1Srg137905 list_t *dr_bkt; 57d9ad96c1Srg137905 rfs4_drc_t *drc; 58d9ad96c1Srg137905 int dr_state; 59d9ad96c1Srg137905 uint32_t dr_xid; 60d9ad96c1Srg137905 struct netbuf dr_addr; 61d9ad96c1Srg137905 COMPOUND4res dr_res; 62d9ad96c1Srg137905 } rfs4_dupreq_t; 63d9ad96c1Srg137905 64d9ad96c1Srg137905 /* 65d9ad96c1Srg137905 * State of rfs4_dupreq. 66d9ad96c1Srg137905 */ 67d9ad96c1Srg137905 #define NFS4_DUP_ERROR -1 68d9ad96c1Srg137905 #define NFS4_NOT_DUP 0 69d9ad96c1Srg137905 #define NFS4_DUP_NEW 1 70d9ad96c1Srg137905 #define NFS4_DUP_PENDING 2 71d9ad96c1Srg137905 #define NFS4_DUP_FREE 3 72d9ad96c1Srg137905 73d9ad96c1Srg137905 #define NFS4_DUP_REPLAY 4 7448a34407Srmesta #define NFS4_DUP_INUSE 5 75d9ad96c1Srg137905 76d9ad96c1Srg137905 extern uint32_t nfs4_drc_max; 77d9ad96c1Srg137905 extern uint32_t nfs4_drc_hash; 78d9ad96c1Srg137905 7948a34407Srmesta rfs4_drc_t *rfs4_init_drc(uint32_t, uint32_t); 80*0dfe541eSEvan Layton void rfs4_fini_drc(void); 81d9ad96c1Srg137905 void rfs4_dr_chstate(rfs4_dupreq_t *, int); 82d9ad96c1Srg137905 rfs4_dupreq_t *rfs4_alloc_dr(rfs4_drc_t *); 83d9ad96c1Srg137905 int rfs4_find_dr(struct svc_req *, rfs4_drc_t *, rfs4_dupreq_t **); 84d9ad96c1Srg137905 85d9ad96c1Srg137905 #ifdef __cplusplus 86d9ad96c1Srg137905 } 87d9ad96c1Srg137905 #endif 88d9ad96c1Srg137905 89d9ad96c1Srg137905 #endif /* _NFS4_DRC_H */ 90