2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
4 * Copyright (c) 2011, 2017, Intel Corporation.
6 * Copyright (c) 2018-2020 Data Direct Networks.
8 * This file is part of Lustre, https://wiki.whamcloud.com/
10 * Portals is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Portals is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * version 2 along with this program; If not, see
21 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Author: Amir Shehata
29 #include <lnet/lib-lnet.h>
32 * lnet_udsp_add_policy
33 * Add a policy \new in position \idx
34 * Must be called with api_mutex held
36 int lnet_udsp_add_policy(struct lnet_udsp *new, int idx);
39 * lnet_udsp_get_policy
40 * get a policy in position \idx
41 * Must be called with api_mutex held
43 struct lnet_udsp *lnet_udsp_get_policy(int idx);
46 * lnet_udsp_del_policy
47 * Delete a policy from position \idx
48 * Must be called with api_mutex held
50 int lnet_udsp_del_policy(int idx);
53 * lnet_udsp_apply_policies
54 * apply all stored policies across the system
55 * Must be called with api_mutex held
56 * Must NOT be called with lnet_net_lock held
57 * udsp: NULL to apply on all existing udsps
58 * non-NULL to apply to specified udsp
59 * revert: true to revert policy application
61 int lnet_udsp_apply_policies(struct lnet_udsp *udsp, bool revert);
64 * lnet_udsp_apply_policies_on_lpni
65 * apply all stored policies on specified \lpni
66 * Must be called with api_mutex held
67 * Must be called with LNET_LOCK_EX
69 int lnet_udsp_apply_policies_on_lpni(struct lnet_peer_ni *lpni);
72 * lnet_udsp_apply_policies_on_lpn
73 * Must be called with api_mutex held
74 * apply all stored policies on specified \lpn
75 * Must be called with LNET_LOCK_EX
77 int lnet_udsp_apply_policies_on_lpn(struct lnet_peer_net *lpn);
80 * lnet_udsp_apply_policies_on_ni
81 * apply all stored policies on specified \ni
82 * Must be called with api_mutex held
83 * Must be called with LNET_LOCK_EX
85 int lnet_udsp_apply_policies_on_ni(struct lnet_ni *ni);
88 * lnet_udsp_apply_policies_on_net
89 * apply all stored policies on specified \net
90 * Must be called with api_mutex held
91 * Must be called with LNET_LOCK_EX
93 int lnet_udsp_apply_policies_on_net(struct lnet_net *net);
97 * Allocates a UDSP block and initializes it.
98 * Return NULL if allocation fails
99 * pointer to UDSP otherwise.
101 struct lnet_udsp *lnet_udsp_alloc(void);
105 * Free a UDSP and all its descriptors
107 void lnet_udsp_free(struct lnet_udsp *udsp);
112 * force: true to indicate shutdown in progress
114 void lnet_udsp_destroy(bool shutdown);
118 * Return the size needed to store the marshalled UDSP
120 size_t lnet_get_udsp_size(struct lnet_udsp *udsp);
124 * Marshal the udsp into the bulk memory provided.
125 * Return success/failure.
127 int lnet_udsp_marshal(struct lnet_udsp *udsp,
128 struct lnet_ioctl_udsp *ioc_udsp);
130 * lnet_udsp_demarshal_add
131 * Given a bulk containing a single UDSP,
132 * demarshal and populate a udsp structure then add policy
134 int lnet_udsp_demarshal_add(void *bulk, __u32 bulk_size);
137 * lnet_udsp_get_construct_info
138 * get information of how the UDSP policies impacted the given
141 void lnet_udsp_get_construct_info(struct lnet_ioctl_construct_udsp_info *info);