1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
5 * Copyright (c) 2011, 2017, Intel Corporation.
7 * Copyright (c) 2018-2020 Data Direct Networks.
10 /* This file is part of Lustre, http://www.lustre.org/
12 * Author: Amir Shehata
18 #include <lnet/lib-lnet.h>
21 * lnet_udsp_add_policy
22 * Add a policy \new in position \idx
23 * Must be called with api_mutex held
25 int lnet_udsp_add_policy(struct lnet_udsp *new, int idx);
28 * lnet_udsp_get_policy
29 * get a policy in position \idx
30 * Must be called with api_mutex held
32 struct lnet_udsp *lnet_udsp_get_policy(int idx);
35 * lnet_udsp_del_policy
36 * Delete a policy from position \idx
37 * Must be called with api_mutex held
39 int lnet_udsp_del_policy(int idx);
42 * lnet_udsp_apply_policies
43 * apply all stored policies across the system
44 * Must be called with api_mutex held
45 * Must NOT be called with lnet_net_lock held
46 * udsp: NULL to apply on all existing udsps
47 * non-NULL to apply to specified udsp
48 * revert: true to revert policy application
50 int lnet_udsp_apply_policies(struct lnet_udsp *udsp, bool revert);
53 * lnet_udsp_apply_policies_on_lpni
54 * apply all stored policies on specified \lpni
55 * Must be called with api_mutex held
56 * Must be called with LNET_LOCK_EX
58 int lnet_udsp_apply_policies_on_lpni(struct lnet_peer_ni *lpni);
61 * lnet_udsp_apply_policies_on_lpn
62 * Must be called with api_mutex held
63 * apply all stored policies on specified \lpn
64 * Must be called with LNET_LOCK_EX
66 int lnet_udsp_apply_policies_on_lpn(struct lnet_peer_net *lpn);
69 * lnet_udsp_apply_policies_on_ni
70 * apply all stored policies on specified \ni
71 * Must be called with api_mutex held
72 * Must be called with LNET_LOCK_EX
74 int lnet_udsp_apply_policies_on_ni(struct lnet_ni *ni);
77 * lnet_udsp_apply_policies_on_net
78 * apply all stored policies on specified \net
79 * Must be called with api_mutex held
80 * Must be called with LNET_LOCK_EX
82 int lnet_udsp_apply_policies_on_net(struct lnet_net *net);
86 * Allocates a UDSP block and initializes it.
87 * Return NULL if allocation fails
88 * pointer to UDSP otherwise.
90 struct lnet_udsp *lnet_udsp_alloc(void);
94 * Free a UDSP and all its descriptors
96 void lnet_udsp_free(struct lnet_udsp *udsp);
101 * force: true to indicate shutdown in progress
103 void lnet_udsp_destroy(bool shutdown);
107 * Return the size needed to store the marshalled UDSP
109 size_t lnet_get_udsp_size(struct lnet_udsp *udsp);
113 * Marshal the udsp into the bulk memory provided.
114 * Return success/failure.
116 int lnet_udsp_marshal(struct lnet_udsp *udsp,
117 struct lnet_ioctl_udsp *ioc_udsp);
119 * lnet_udsp_demarshal_add
120 * Given a bulk containing a single UDSP,
121 * demarshal and populate a udsp structure then add policy
123 int lnet_udsp_demarshal_add(void *bulk, __u32 bulk_size);
126 * lnet_udsp_get_construct_info
127 * get information of how the UDSP policies impacted the given
130 void lnet_udsp_get_construct_info(struct lnet_ioctl_construct_udsp_info *info,
131 struct lnet_nid *nid);