Whamcloud - gitweb
LU-2667 ptlrpc: Move NRS structures out of lustre_net.h
[fs/lustre-release.git] / lustre / include / lustre_nrs_crr.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License version 2 for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * version 2 along with this program; If not, see
17  * http://www.gnu.org/licenses/gpl-2.0.html
18  *
19  * GPL HEADER END
20  */
21 /*
22  * Copyright (c) 2014, Intel Corporation.
23  *
24  * Copyright 2012 Xyratex Technology Limited
25  */
26 /*
27  *
28  * Network Request Scheduler (NRS) Client Round Robin over NIDs (CRR-N) policy
29  *
30  */
31
32 #ifndef _LUSTRE_NRS_CRR_H
33 #define _LUSTRE_NRS_CRR_H
34
35 /**
36  * \name CRR-N
37  *
38  * CRR-N, Client Round Robin over NIDs
39  * @{
40  */
41
42 /**
43  * private data structure for CRR-N NRS
44  */
45 struct nrs_crrn_net {
46         struct ptlrpc_nrs_resource      cn_res;
47         cfs_binheap_t                  *cn_binheap;
48         cfs_hash_t                     *cn_cli_hash;
49         /**
50          * Used when a new scheduling round commences, in order to synchronize
51          * all clients with the new round number.
52          */
53         __u64                           cn_round;
54         /**
55          * Determines the relevant ordering amongst request batches within a
56          * scheduling round.
57          */
58         __u64                           cn_sequence;
59         /**
60          * Round Robin quantum; the maximum number of RPCs that each request
61          * batch for each client can have in a scheduling round.
62          */
63         __u16                           cn_quantum;
64 };
65
66 /**
67  * Object representing a client in CRR-N, as identified by its NID
68  */
69 struct nrs_crrn_client {
70         struct ptlrpc_nrs_resource      cc_res;
71         struct hlist_node               cc_hnode;
72         lnet_nid_t                      cc_nid;
73         /**
74          * The round number against which this client is currently scheduling
75          * requests.
76          */
77         __u64                           cc_round;
78         /**
79          * The sequence number used for requests scheduled by this client during
80          * the current round number.
81          */
82         __u64                           cc_sequence;
83         atomic_t                        cc_ref;
84         /**
85          * Round Robin quantum; the maximum number of RPCs the client is allowed
86          * to schedule in a single batch of each round.
87          */
88         __u16                           cc_quantum;
89         /**
90          * # of pending requests for this client, on all existing rounds
91          */
92         __u16                           cc_active;
93 };
94
95 /**
96  * CRR-N NRS request definition
97  */
98 struct nrs_crrn_req {
99         /**
100          * Round number for this request; shared with all other requests in the
101          * same batch.
102          */
103         __u64                   cr_round;
104         /**
105          * Sequence number for this request; shared with all other requests in
106          * the same batch.
107          */
108         __u64                   cr_sequence;
109 };
110
111 /**
112  * CRR-N policy operations.
113  */
114 enum nrs_ctl_crr {
115         /**
116          * Read the RR quantum size of a CRR-N policy.
117          */
118         NRS_CTL_CRRN_RD_QUANTUM = PTLRPC_NRS_CTL_1ST_POL_SPEC,
119         /**
120          * Write the RR quantum size of a CRR-N policy.
121          */
122         NRS_CTL_CRRN_WR_QUANTUM,
123 };
124
125 /** @} CRR-N */
126 #endif