Whamcloud - gitweb
LU-2667 ptlrpc: Move NRS structures out of lustre_net.h
[fs/lustre-release.git] / lustre / include / lustre_nrs.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)
29  *
30  */
31
32 #ifndef _LUSTRE_NRS_H
33 #define _LUSTRE_NRS_H
34
35 /**
36  * \defgroup nrs Network Request Scheduler
37  * @{
38  */
39 struct ptlrpc_nrs_policy;
40 struct ptlrpc_nrs_resource;
41 struct ptlrpc_nrs_request;
42
43 /**
44  * NRS control operations.
45  *
46  * These are common for all policies.
47  */
48 enum ptlrpc_nrs_ctl {
49         /**
50          * Not a valid opcode.
51          */
52         PTLRPC_NRS_CTL_INVALID,
53         /**
54          * Activate the policy.
55          */
56         PTLRPC_NRS_CTL_START,
57         /**
58          * Reserved for multiple primary policies, which may be a possibility
59          * in the future.
60          */
61         PTLRPC_NRS_CTL_STOP,
62         /**
63          * Policies can start using opcodes from this value and onwards for
64          * their own purposes; the assigned value itself is arbitrary.
65          */
66         PTLRPC_NRS_CTL_1ST_POL_SPEC = 0x20,
67 };
68
69 /**
70  * NRS policy operations.
71  *
72  * These determine the behaviour of a policy, and are called in response to
73  * NRS core events.
74  */
75 struct ptlrpc_nrs_pol_ops {
76         /**
77          * Called during policy registration; this operation is optional.
78          *
79          * \param[in,out] policy The policy being initialized
80          */
81         int     (*op_policy_init) (struct ptlrpc_nrs_policy *policy);
82         /**
83          * Called during policy unregistration; this operation is optional.
84          *
85          * \param[in,out] policy The policy being unregistered/finalized
86          */
87         void    (*op_policy_fini) (struct ptlrpc_nrs_policy *policy);
88         /**
89          * Called when activating a policy via lprocfs; policies allocate and
90          * initialize their resources here; this operation is optional.
91          *
92          * \param[in,out] policy The policy being started
93          * \param[in,out] arg A generic char buffer
94          *
95          * \see nrs_policy_start_locked()
96          */
97         int     (*op_policy_start) (struct ptlrpc_nrs_policy *policy,
98                                     char *arg);
99         /**
100          * Called when deactivating a policy via lprocfs; policies deallocate
101          * their resources here; this operation is optional
102          *
103          * \param[in,out] policy The policy being stopped
104          *
105          * \see nrs_policy_stop0()
106          */
107         void    (*op_policy_stop) (struct ptlrpc_nrs_policy *policy);
108         /**
109          * Used for policy-specific operations; i.e. not generic ones like
110          * \e PTLRPC_NRS_CTL_START and \e PTLRPC_NRS_CTL_GET_INFO; analogous
111          * to an ioctl; this operation is optional.
112          *
113          * \param[in,out]        policy The policy carrying out operation \a opc
114          * \param[in]     opc    The command operation being carried out
115          * \param[in,out] arg    An generic buffer for communication between the
116          *                       user and the control operation
117          *
118          * \retval -ve error
119          * \retval   0 success
120          *
121          * \see ptlrpc_nrs_policy_control()
122          */
123         int     (*op_policy_ctl) (struct ptlrpc_nrs_policy *policy,
124                                   enum ptlrpc_nrs_ctl opc, void *arg);
125
126         /**
127          * Called when obtaining references to the resources of the resource
128          * hierarchy for a request that has arrived for handling at the PTLRPC
129          * service. Policies should return -ve for requests they do not wish
130          * to handle. This operation is mandatory.
131          *
132          * \param[in,out] policy  The policy we're getting resources for.
133          * \param[in,out] nrq     The request we are getting resources for.
134          * \param[in]     parent  The parent resource of the resource being
135          *                        requested; set to NULL if none.
136          * \param[out]    resp    The resource is to be returned here; the
137          *                        fallback policy in an NRS head should
138          *                        \e always return a non-NULL pointer value.
139          * \param[in]  moving_req When set, signifies that this is an attempt
140          *                        to obtain resources for a request being moved
141          *                        to the high-priority NRS head by
142          *                        ldlm_lock_reorder_req().
143          *                        This implies two things:
144          *                        1. We are under obd_export::exp_rpc_lock and
145          *                        so should not sleep.
146          *                        2. We should not perform non-idempotent or can
147          *                        skip performing idempotent operations that
148          *                        were carried out when resources were first
149          *                        taken for the request when it was initialized
150          *                        in ptlrpc_nrs_req_initialize().
151          *
152          * \retval 0, +ve The level of the returned resource in the resource
153          *                hierarchy; currently only 0 (for a non-leaf resource)
154          *                and 1 (for a leaf resource) are supported by the
155          *                framework.
156          * \retval -ve    error
157          *
158          * \see ptlrpc_nrs_req_initialize()
159          * \see ptlrpc_nrs_hpreq_add_nolock()
160          * \see ptlrpc_nrs_req_hp_move()
161          */
162         int     (*op_res_get) (struct ptlrpc_nrs_policy *policy,
163                                struct ptlrpc_nrs_request *nrq,
164                                const struct ptlrpc_nrs_resource *parent,
165                                struct ptlrpc_nrs_resource **resp,
166                                bool moving_req);
167         /**
168          * Called when releasing references taken for resources in the resource
169          * hierarchy for the request; this operation is optional.
170          *
171          * \param[in,out] policy The policy the resource belongs to
172          * \param[in] res        The resource to be freed
173          *
174          * \see ptlrpc_nrs_req_finalize()
175          * \see ptlrpc_nrs_hpreq_add_nolock()
176          * \see ptlrpc_nrs_req_hp_move()
177          */
178         void    (*op_res_put) (struct ptlrpc_nrs_policy *policy,
179                                const struct ptlrpc_nrs_resource *res);
180
181         /**
182          * Obtains a request for handling from the policy, and optionally
183          * removes the request from the policy; this operation is mandatory.
184          *
185          * \param[in,out] policy The policy to poll
186          * \param[in]     peek   When set, signifies that we just want to
187          *                       examine the request, and not handle it, so the
188          *                       request is not removed from the policy.
189          * \param[in]     force  When set, it will force a policy to return a
190          *                       request if it has one queued.
191          *
192          * \retval NULL No request available for handling
193          * \retval valid-pointer The request polled for handling
194          *
195          * \see ptlrpc_nrs_req_get_nolock()
196          */
197         struct ptlrpc_nrs_request *
198                 (*op_req_get) (struct ptlrpc_nrs_policy *policy, bool peek,
199                                bool force);
200         /**
201          * Called when attempting to add a request to a policy for later
202          * handling; this operation is mandatory.
203          *
204          * \param[in,out] policy  The policy on which to enqueue \a nrq
205          * \param[in,out] nrq The request to enqueue
206          *
207          * \retval 0    success
208          * \retval != 0 error
209          *
210          * \see ptlrpc_nrs_req_add_nolock()
211          */
212         int     (*op_req_enqueue) (struct ptlrpc_nrs_policy *policy,
213                                    struct ptlrpc_nrs_request *nrq);
214         /**
215          * Removes a request from the policy's set of pending requests. Normally
216          * called after a request has been polled successfully from the policy
217          * for handling; this operation is mandatory.
218          *
219          * \param[in,out] policy The policy the request \a nrq belongs to
220          * \param[in,out] nrq    The request to dequeue
221          *
222          * \see ptlrpc_nrs_req_del_nolock()
223          */
224         void    (*op_req_dequeue) (struct ptlrpc_nrs_policy *policy,
225                                    struct ptlrpc_nrs_request *nrq);
226         /**
227          * Called after the request being carried out. Could be used for
228          * job/resource control; this operation is optional.
229          *
230          * \param[in,out] policy The policy which is stopping to handle request
231          *                       \a nrq
232          * \param[in,out] nrq    The request
233          *
234          * \pre assert_spin_locked(&svcpt->scp_req_lock)
235          *
236          * \see ptlrpc_nrs_req_stop_nolock()
237          */
238         void    (*op_req_stop) (struct ptlrpc_nrs_policy *policy,
239                                 struct ptlrpc_nrs_request *nrq);
240         /**
241          * Registers the policy's lprocfs interface with a PTLRPC service.
242          *
243          * \param[in] svc The service
244          *
245          * \retval 0    success
246          * \retval != 0 error
247          */
248         int     (*op_lprocfs_init) (struct ptlrpc_service *svc);
249         /**
250          * Unegisters the policy's lprocfs interface with a PTLRPC service.
251          *
252          * In cases of failed policy registration in
253          * \e ptlrpc_nrs_policy_register(), this function may be called for a
254          * service which has not registered the policy successfully, so
255          * implementations of this method should make sure their operations are
256          * safe in such cases.
257          *
258          * \param[in] svc The service
259          */
260         void    (*op_lprocfs_fini) (struct ptlrpc_service *svc);
261 };
262
263 /**
264  * Policy flags
265  */
266 enum nrs_policy_flags {
267         /**
268          * Fallback policy, use this flag only on a single supported policy per
269          * service. The flag cannot be used on policies that use
270          * \e PTLRPC_NRS_FL_REG_EXTERN
271          */
272         PTLRPC_NRS_FL_FALLBACK          = (1 << 0),
273         /**
274          * Start policy immediately after registering.
275          */
276         PTLRPC_NRS_FL_REG_START         = (1 << 1),
277         /**
278          * This is a policy registering from a module different to the one NRS
279          * core ships in (currently ptlrpc).
280          */
281         PTLRPC_NRS_FL_REG_EXTERN        = (1 << 2),
282 };
283
284 /**
285  * NRS queue type.
286  *
287  * Denotes whether an NRS instance is for handling normal or high-priority
288  * RPCs, or whether an operation pertains to one or both of the NRS instances
289  * in a service.
290  */
291 enum ptlrpc_nrs_queue_type {
292         PTLRPC_NRS_QUEUE_REG    = (1 << 0),
293         PTLRPC_NRS_QUEUE_HP     = (1 << 1),
294         PTLRPC_NRS_QUEUE_BOTH   = (PTLRPC_NRS_QUEUE_REG | PTLRPC_NRS_QUEUE_HP)
295 };
296
297 /**
298  * NRS head
299  *
300  * A PTLRPC service has at least one NRS head instance for handling normal
301  * priority RPCs, and may optionally have a second NRS head instance for
302  * handling high-priority RPCs. Each NRS head maintains a list of available
303  * policies, of which one and only one policy is acting as the fallback policy,
304  * and optionally a different policy may be acting as the primary policy. For
305  * all RPCs handled by this NRS head instance, NRS core will first attempt to
306  * enqueue the RPC using the primary policy (if any). The fallback policy is
307  * used in the following cases:
308  * - when there was no primary policy in the
309  *   ptlrpc_nrs_pol_state::NRS_POL_STATE_STARTED state at the time the request
310  *   was initialized.
311  * - when the primary policy that was at the
312  *   ptlrpc_nrs_pol_state::PTLRPC_NRS_POL_STATE_STARTED state at the time the
313  *   RPC was initialized, denoted it did not wish, or for some other reason was
314  *   not able to handle the request, by returning a non-valid NRS resource
315  *   reference.
316  * - when the primary policy that was at the
317  *   ptlrpc_nrs_pol_state::PTLRPC_NRS_POL_STATE_STARTED state at the time the
318  *   RPC was initialized, fails later during the request enqueueing stage.
319  *
320  * \see nrs_resource_get_safe()
321  * \see nrs_request_enqueue()
322  */
323 struct ptlrpc_nrs {
324         spinlock_t                      nrs_lock;
325         /** XXX Possibly replace svcpt->scp_req_lock with another lock here. */
326         /**
327          * List of registered policies
328          */
329         struct list_head                nrs_policy_list;
330         /**
331          * List of policies with queued requests. Policies that have any
332          * outstanding requests are queued here, and this list is queried
333          * in a round-robin manner from NRS core when obtaining a request
334          * for handling. This ensures that requests from policies that at some
335          * point transition away from the
336          * ptlrpc_nrs_pol_state::NRS_POL_STATE_STARTED state are drained.
337          */
338         struct list_head                nrs_policy_queued;
339         /**
340          * Service partition for this NRS head
341          */
342         struct ptlrpc_service_part     *nrs_svcpt;
343         /**
344          * Primary policy, which is the preferred policy for handling RPCs
345          */
346         struct ptlrpc_nrs_policy       *nrs_policy_primary;
347         /**
348          * Fallback policy, which is the backup policy for handling RPCs
349          */
350         struct ptlrpc_nrs_policy       *nrs_policy_fallback;
351         /**
352          * This NRS head handles either HP or regular requests
353          */
354         enum ptlrpc_nrs_queue_type      nrs_queue_type;
355         /**
356          * # queued requests from all policies in this NRS head
357          */
358         unsigned long                   nrs_req_queued;
359         /**
360          * # scheduled requests from all policies in this NRS head
361          */
362         unsigned long                   nrs_req_started;
363         /**
364          * # policies on this NRS
365          */
366         unsigned                        nrs_num_pols;
367         /**
368          * This NRS head is in progress of starting a policy
369          */
370         unsigned                        nrs_policy_starting:1;
371         /**
372          * In progress of shutting down the whole NRS head; used during
373          * unregistration
374          */
375         unsigned                        nrs_stopping:1;
376         /**
377          * NRS policy is throttling reqeust
378          */
379         unsigned                        nrs_throttling:1;
380 };
381
382 #define NRS_POL_NAME_MAX                16
383
384 struct ptlrpc_nrs_pol_desc;
385
386 /**
387  * Service compatibility predicate; this determines whether a policy is adequate
388  * for handling RPCs of a particular PTLRPC service.
389  *
390  * XXX:This should give the same result during policy registration and
391  * unregistration, and for all partitions of a service; so the result should not
392  * depend on temporal service or other properties, that may influence the
393  * result.
394  */
395 typedef bool (*nrs_pol_desc_compat_t) (const struct ptlrpc_service *svc,
396                                        const struct ptlrpc_nrs_pol_desc *desc);
397
398 struct ptlrpc_nrs_pol_conf {
399         /**
400          * Human-readable policy name
401          */
402         char                               nc_name[NRS_POL_NAME_MAX];
403         /**
404          * NRS operations for this policy
405          */
406         const struct ptlrpc_nrs_pol_ops   *nc_ops;
407         /**
408          * Service compatibility predicate
409          */
410         nrs_pol_desc_compat_t              nc_compat;
411         /**
412          * Set for policies that support a single ptlrpc service, i.e. ones that
413          * have \a pd_compat set to nrs_policy_compat_one(). The variable value
414          * depicts the name of the single service that such policies are
415          * compatible with.
416          */
417         const char                        *nc_compat_svc_name;
418         /**
419          * Owner module for this policy descriptor; policies registering from a
420          * different module to the one the NRS framework is held within
421          * (currently ptlrpc), should set this field to THIS_MODULE.
422          */
423         struct module                     *nc_owner;
424         /**
425          * Policy registration flags; a bitmast of \e nrs_policy_flags
426          */
427         unsigned                           nc_flags;
428 };
429
430 /**
431  * NRS policy registering descriptor
432  *
433  * Is used to hold a description of a policy that can be passed to NRS core in
434  * order to register the policy with NRS heads in different PTLRPC services.
435  */
436 struct ptlrpc_nrs_pol_desc {
437         /**
438          * Human-readable policy name
439          */
440         char                                    pd_name[NRS_POL_NAME_MAX];
441         /**
442          * Link into nrs_core::nrs_policies
443          */
444         struct list_head                        pd_list;
445         /**
446          * NRS operations for this policy
447          */
448         const struct ptlrpc_nrs_pol_ops        *pd_ops;
449         /**
450          * Service compatibility predicate
451          */
452         nrs_pol_desc_compat_t                   pd_compat;
453         /**
454          * Set for policies that are compatible with only one PTLRPC service.
455          *
456          * \see ptlrpc_nrs_pol_conf::nc_compat_svc_name
457          */
458         const char                             *pd_compat_svc_name;
459         /**
460          * Owner module for this policy descriptor.
461          *
462          * We need to hold a reference to the module whenever we might make use
463          * of any of the module's contents, i.e.
464          * - If one or more instances of the policy are at a state where they
465          *   might be handling a request, i.e.
466          *   ptlrpc_nrs_pol_state::NRS_POL_STATE_STARTED or
467          *   ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPING as we will have to
468          *   call into the policy's ptlrpc_nrs_pol_ops() handlers. A reference
469          *   is taken on the module when
470          *   \e ptlrpc_nrs_pol_desc::pd_refs becomes 1, and released when it
471          *   becomes 0, so that we hold only one reference to the module maximum
472          *   at any time.
473          *
474          *   We do not need to hold a reference to the module, even though we
475          *   might use code and data from the module, in the following cases:
476          * - During external policy registration, because this should happen in
477          *   the module's init() function, in which case the module is safe from
478          *   removal because a reference is being held on the module by the
479          *   kernel, and iirc kmod (and I guess module-init-tools also) will
480          *   serialize any racing processes properly anyway.
481          * - During external policy unregistration, because this should happen
482          *   in a module's exit() function, and any attempts to start a policy
483          *   instance would need to take a reference on the module, and this is
484          *   not possible once we have reached the point where the exit()
485          *   handler is called.
486          * - During service registration and unregistration, as service setup
487          *   and cleanup, and policy registration, unregistration and policy
488          *   instance starting, are serialized by \e nrs_core::nrs_mutex, so
489          *   as long as users adhere to the convention of registering policies
490          *   in init() and unregistering them in module exit() functions, there
491          *   should not be a race between these operations.
492          * - During any policy-specific lprocfs operations, because a reference
493          *   is held by the kernel on a proc entry that has been entered by a
494          *   syscall, so as long as proc entries are removed during
495          *   unregistration time, then unregistration and lprocfs operations
496          *   will be properly serialized.
497          */
498         struct module                          *pd_owner;
499         /**
500          * Bitmask of \e nrs_policy_flags
501          */
502         unsigned                                pd_flags;
503         /**
504          * # of references on this descriptor
505          */
506         atomic_t                                pd_refs;
507 };
508
509 /**
510  * NRS policy state
511  *
512  * Policies transition from one state to the other during their lifetime
513  */
514 enum ptlrpc_nrs_pol_state {
515         /**
516          * Not a valid policy state.
517          */
518         NRS_POL_STATE_INVALID,
519         /**
520          * Policies are at this state either at the start of their life, or
521          * transition here when the user selects a different policy to act
522          * as the primary one.
523          */
524         NRS_POL_STATE_STOPPED,
525         /**
526          * Policy is progress of stopping
527          */
528         NRS_POL_STATE_STOPPING,
529         /**
530          * Policy is in progress of starting
531          */
532         NRS_POL_STATE_STARTING,
533         /**
534          * A policy is in this state in two cases:
535          * - it is the fallback policy, which is always in this state.
536          * - it has been activated by the user; i.e. it is the primary policy,
537          */
538         NRS_POL_STATE_STARTED,
539 };
540
541 /**
542  * NRS policy information
543  *
544  * Used for obtaining information for the status of a policy via lprocfs
545  */
546 struct ptlrpc_nrs_pol_info {
547         /**
548          * Policy name
549          */
550         char                            pi_name[NRS_POL_NAME_MAX];
551         /**
552          * Current policy state
553          */
554         enum ptlrpc_nrs_pol_state       pi_state;
555         /**
556          * # RPCs enqueued for later dispatching by the policy
557          */
558         long                            pi_req_queued;
559         /**
560          * # RPCs started for dispatch by the policy
561          */
562         long                            pi_req_started;
563         /**
564          * Is this a fallback policy?
565          */
566         unsigned                        pi_fallback:1;
567 };
568
569 /**
570  * NRS policy
571  *
572  * There is one instance of this for each policy in each NRS head of each
573  * PTLRPC service partition.
574  */
575 struct ptlrpc_nrs_policy {
576         /**
577          * Linkage into the NRS head's list of policies,
578          * ptlrpc_nrs:nrs_policy_list
579          */
580         struct list_head                pol_list;
581         /**
582          * Linkage into the NRS head's list of policies with enqueued
583          * requests ptlrpc_nrs:nrs_policy_queued
584          */
585         struct list_head                pol_list_queued;
586         /**
587          * Current state of this policy
588          */
589         enum ptlrpc_nrs_pol_state       pol_state;
590         /**
591          * Bitmask of nrs_policy_flags
592          */
593         unsigned                        pol_flags;
594         /**
595          * # RPCs enqueued for later dispatching by the policy
596          */
597         long                            pol_req_queued;
598         /**
599          * # RPCs started for dispatch by the policy
600          */
601         long                            pol_req_started;
602         /**
603          * Usage Reference count taken on the policy instance
604          */
605         long                            pol_ref;
606         /**
607          * The NRS head this policy has been created at
608          */
609         struct ptlrpc_nrs              *pol_nrs;
610         /**
611          * Private policy data; varies by policy type
612          */
613         void                           *pol_private;
614         /**
615          * Policy descriptor for this policy instance.
616          */
617         struct ptlrpc_nrs_pol_desc     *pol_desc;
618 };
619
620 /**
621  * NRS resource
622  *
623  * Resources are embedded into two types of NRS entities:
624  * - Inside NRS policies, in the policy's private data in
625  *   ptlrpc_nrs_policy::pol_private
626  * - In objects that act as prime-level scheduling entities in different NRS
627  *   policies; e.g. on a policy that performs round robin or similar order
628  *   scheduling across client NIDs, there would be one NRS resource per unique
629  *   client NID. On a policy which performs round robin scheduling across
630  *   backend filesystem objects, there would be one resource associated with
631  *   each of the backend filesystem objects partaking in the scheduling
632  *   performed by the policy.
633  *
634  * NRS resources share a parent-child relationship, in which resources embedded
635  * in policy instances are the parent entities, with all scheduling entities
636  * a policy schedules across being the children, thus forming a simple resource
637  * hierarchy. This hierarchy may be extended with one or more levels in the
638  * future if the ability to have more than one primary policy is added.
639  *
640  * Upon request initialization, references to the then active NRS policies are
641  * taken and used to later handle the dispatching of the request with one of
642  * these policies.
643  *
644  * \see nrs_resource_get_safe()
645  * \see ptlrpc_nrs_req_add()
646  */
647 struct ptlrpc_nrs_resource {
648         /**
649          * This NRS resource's parent; is NULL for resources embedded in NRS
650          * policy instances; i.e. those are top-level ones.
651          */
652         struct ptlrpc_nrs_resource     *res_parent;
653         /**
654          * The policy associated with this resource.
655          */
656         struct ptlrpc_nrs_policy       *res_policy;
657 };
658
659 enum {
660         NRS_RES_FALLBACK,
661         NRS_RES_PRIMARY,
662         NRS_RES_MAX
663 };
664
665 #include <lustre_nrs_fifo.h>
666 #include <lustre_nrs_tbf.h>
667 #include <lustre_nrs_crr.h>
668 #include <lustre_nrs_orr.h>
669
670 /**
671  * NRS request
672  *
673  * Instances of this object exist embedded within ptlrpc_request; the main
674  * purpose of this object is to hold references to the request's resources
675  * for the lifetime of the request, and to hold properties that policies use
676  * use for determining the request's scheduling priority.
677  * */
678 struct ptlrpc_nrs_request {
679         /**
680          * The request's resource hierarchy.
681          */
682         struct ptlrpc_nrs_resource     *nr_res_ptrs[NRS_RES_MAX];
683         /**
684          * Index into ptlrpc_nrs_request::nr_res_ptrs of the resource of the
685          * policy that was used to enqueue the request.
686          *
687          * \see nrs_request_enqueue()
688          */
689         unsigned                        nr_res_idx;
690         unsigned                        nr_initialized:1;
691         unsigned                        nr_enqueued:1;
692         unsigned                        nr_started:1;
693         unsigned                        nr_finalized:1;
694         cfs_binheap_node_t              nr_node;
695
696         /**
697          * Policy-specific fields, used for determining a request's scheduling
698          * priority, and other supporting functionality.
699          */
700         union {
701                 /**
702                  * Fields for the FIFO policy
703                  */
704                 struct nrs_fifo_req     fifo;
705                 /**
706                  * CRR-N request defintion
707                  */
708                 struct nrs_crrn_req     crr;
709                 /** ORR and TRR share the same request definition */
710                 struct nrs_orr_req      orr;
711                 /**
712                  * TBF request definition
713                  */
714                 struct nrs_tbf_req      tbf;
715         } nr_u;
716         /**
717          * Externally-registering policies may want to use this to allocate
718          * their own request properties.
719          */
720         void                           *ext;
721 };
722
723 /** @} nrs */
724 #endif