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