/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1989, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software contributed to Berkeley by7* Rick Macklem at The University of Guelph.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef _NFS_NFSRVCACHE_H_35#define _NFS_NFSRVCACHE_H_3637/*38* Definitions for the server recent request cache39*/40#define NFSRVCACHE_MAX_SIZE 204841#define NFSRVCACHE_MIN_SIZE 644243#define NFSRVCACHE_HASHSIZE 5004445/* Cache table entry. */46struct nfsrvcache {47LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */48LIST_ENTRY(nfsrvcache) rc_ahash; /* ACK hash chain */49TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */50u_int32_t rc_xid; /* rpc id number */51time_t rc_timestamp; /* Time done */52union {53struct mbuf *repmb; /* Reply mbuf list OR */54int repstat; /* Reply status */55} rc_un;56union {57struct {58union nethostaddr haddr; /* Host address */59} udp;60struct {61u_int64_t sockref;62u_int32_t len;63u_int32_t tcpseq;64int16_t refcnt;65u_int16_t cksum;66time_t cachetime;67int acked;68} ot;69} rc_un2;70u_int16_t rc_proc; /* rpc proc number */71u_int16_t rc_flag; /* Flag bits */72};7374#define rc_reply rc_un.repmb75#define rc_status rc_un.repstat76#define rc_inet rc_un2.udp.haddr.had_inet.s_addr77#define rc_inet6 rc_un2.udp.haddr.had_inet678#define rc_haddr rc_un2.udp.haddr79#define rc_sockref rc_un2.ot.sockref80#define rc_tcpseq rc_un2.ot.tcpseq81#define rc_refcnt rc_un2.ot.refcnt82#define rc_reqlen rc_un2.ot.len83#define rc_cksum rc_un2.ot.cksum84#define rc_cachetime rc_un2.ot.cachetime85#define rc_acked rc_un2.ot.acked8687/* TCP ACK values */88#define RC_NO_SEQ 089#define RC_NO_ACK 190#define RC_ACK 291#define RC_NACK 39293/* Return values */94#define RC_DROPIT 095#define RC_REPLY 196#define RC_DOIT 29798/* Flag bits */99#define RC_LOCKED 0x0001100#define RC_WANTED 0x0002101#define RC_REPSTATUS 0x0004102#define RC_REPMBUF 0x0008103#define RC_UDP 0x0010104#define RC_INETIPV6 0x0020105#define RC_INPROG 0x0040106#define RC_NFSV2 0x0100107#define RC_NFSV3 0x0200108#define RC_NFSV4 0x0400109#define RC_NFSVERS (RC_NFSV2 | RC_NFSV3 | RC_NFSV4)110#define RC_REFCNT 0x0800111#define RC_SAMETCPCONN 0x1000112113LIST_HEAD(nfsrvhashhead, nfsrvcache);114115/* The fine-grained locked cache hash table for TCP. */116struct nfsrchash_bucket {117struct mtx mtx;118struct nfsrvhashhead tbl;119};120121#endif /* _NFS_NFSRVCACHE_H_ */122123124