1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright(c) 2017 Intel Corporation.
10 * hfi1_exp_tid_set_init - initialize exp_tid_set
13 static void hfi1_exp_tid_set_init(struct exp_tid_set *set)
15 INIT_LIST_HEAD(&set->list);
20 * hfi1_exp_tid_group_init - initialize rcd expected receive
23 void hfi1_exp_tid_group_init(struct hfi1_ctxtdata *rcd)
25 hfi1_exp_tid_set_init(&rcd->tid_group_list);
26 hfi1_exp_tid_set_init(&rcd->tid_used_list);
27 hfi1_exp_tid_set_init(&rcd->tid_full_list);
31 * hfi1_alloc_ctxt_rcv_groups - initialize expected receive groups
32 * @rcd: the context to add the groupings to
34 int hfi1_alloc_ctxt_rcv_groups(struct hfi1_ctxtdata *rcd)
36 struct hfi1_devdata *dd = rcd->dd;
38 struct tid_group *grp;
42 ngroups = rcd->expected_count / dd->rcv_entries.group_size;
44 kcalloc_node(ngroups, sizeof(*rcd->groups),
45 GFP_KERNEL, rcd->numa_id);
48 tidbase = rcd->expected_base;
49 for (i = 0; i < ngroups; i++) {
50 grp = &rcd->groups[i];
51 grp->size = dd->rcv_entries.group_size;
53 tid_group_add_tail(grp, &rcd->tid_group_list);
54 tidbase += dd->rcv_entries.group_size;
61 * hfi1_free_ctxt_rcv_groups - free expected receive groups
62 * @rcd: the context to free
64 * The routine dismantles the expect receive linked
65 * list and clears any tids associated with the receive
68 * This should only be called for kernel contexts and the
69 * a base user context.
71 void hfi1_free_ctxt_rcv_groups(struct hfi1_ctxtdata *rcd)
75 hfi1_exp_tid_group_init(rcd);