Skip to content

Commit 37fa37d

Browse files
committed
prov/cxi: break-out cxip.h into multiple headers
Using scripts introduced in HEAD~1, break-out cxip.h into smaller headers, and remove the scripts used to create them.
1 parent 60069d1 commit 37fa37d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4179
-5627
lines changed

prov/cxi/include/cxip.h

Lines changed: 75 additions & 3335 deletions
Large diffs are not rendered by default.

prov/cxi/include/cxip/addr.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_ADDR_H_
8+
#define _CXIP_ADDR_H_
9+
10+
11+
#include <stdint.h>
12+
13+
/* Macros */
14+
#define CXIP_ADDR_EQUAL(a, b) ((a).nic == (b).nic && (a).pid == (b).pid)
15+
16+
#define CXIP_ADDR_VNI_EQUAL(a, b) (CXIP_ADDR_EQUAL(a, b) && (a).vni == (b).vni)
17+
18+
#define CXIP_ADDR_PORT_BITS 6
19+
20+
#define CXIP_ADDR_SWITCH_BITS 5
21+
22+
#define CXIP_ADDR_GROUP_BITS 9
23+
24+
#define CXIP_ADDR_FATTREE_PORT_BITS 6
25+
26+
#define CXIP_ADDR_FATTREE_SWITCH_BITS 14
27+
28+
/* Type definitions */
29+
struct cxip_addr {
30+
uint32_t pid : C_DFA_PID_BITS_MAX;
31+
uint32_t nic : C_DFA_NIC_BITS;
32+
uint32_t pad : 3;
33+
uint16_t vni;
34+
};
35+
36+
#endif /* _CXIP_ADDR_H_ */

prov/cxi/include/cxip/atomic.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_ATOMIC_H_
8+
#define _CXIP_ATOMIC_H_
9+
10+
11+
#include <stdint.h>
12+
#include <stddef.h>
13+
#include <stdbool.h>
14+
15+
/* Forward declarations */
16+
struct cxip_cntr;
17+
struct cxip_txc;
18+
19+
/* Function declarations */
20+
int cxip_amo_common(enum cxip_amo_req_type req_type, struct cxip_txc *txc,
21+
uint32_t tclass, const struct fi_msg_atomic *msg,
22+
const struct fi_ioc *comparev, void **comparedesc,
23+
size_t compare_count, const struct fi_ioc *resultv,
24+
void **resultdesc, size_t result_count, uint64_t flags,
25+
bool triggered, uint64_t trig_thresh,
26+
struct cxip_cntr *trig_cntr, struct cxip_cntr *comp_cntr);
27+
28+
int _cxip_atomic_opcode(enum cxip_amo_req_type req_type, enum fi_datatype dt,
29+
enum fi_op op, int amo_remap_to_pcie_fadd,
30+
enum c_atomic_op *cop, enum c_atomic_type *cdt,
31+
enum c_cswap_op *copswp, unsigned int *cdtlen);
32+
33+
#endif /* _CXIP_ATOMIC_H_ */

prov/cxi/include/cxip/auth.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_AUTH_H_
8+
#define _CXIP_AUTH_H_
9+
10+
11+
/* Function declarations */
12+
int cxip_check_auth_key_info(struct fi_info *info);
13+
14+
int cxip_gen_auth_key(struct fi_info *info, struct cxi_auth_key *key);
15+
16+
#endif /* _CXIP_AUTH_H_ */

prov/cxi/include/cxip/av.h

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_AV_H_
8+
#define _CXIP_AV_H_
9+
10+
11+
#include <stdint.h>
12+
#include <stddef.h>
13+
#include <stdbool.h>
14+
#include <pthread.h>
15+
#include <ofi_list.h>
16+
#include <ofi_atom.h>
17+
18+
/* Forward declarations */
19+
struct cxip_addr;
20+
struct cxip_coll_mc;
21+
struct cxip_domain;
22+
struct cxip_ep;
23+
24+
/* Type definitions */
25+
struct cxip_av_auth_key_entry {
26+
ofi_atomic32_t use_cnt;
27+
ofi_atomic32_t ref_cnt;
28+
UT_hash_handle hh;
29+
struct dlist_entry entry;
30+
struct cxi_auth_key key;
31+
fi_addr_t fi_addr;
32+
};
33+
34+
struct cxip_av_entry {
35+
ofi_atomic32_t use_cnt;
36+
UT_hash_handle hh;
37+
struct cxip_addr addr;
38+
fi_addr_t fi_addr;
39+
struct cxip_av_auth_key_entry *auth_key;
40+
};
41+
42+
struct cxip_av {
43+
struct fid_av av_fid;
44+
struct cxip_domain *domain;
45+
46+
/* List of endpoints bound to this AV. Each bind takes a reference
47+
* as well.
48+
*/
49+
struct dlist_entry ep_list;
50+
ofi_atomic32_t ref;
51+
52+
/* Memory used to implement lookups. Two data structures are used.
53+
* 1. ibuf pool for O(1) lookup on the data path
54+
* 2. hash table for O(1) on the receive path
55+
*/
56+
struct cxip_av_entry *av_entry_hash;
57+
struct ofi_bufpool *av_entry_pool;
58+
ofi_atomic32_t av_entry_cnt;
59+
60+
/* Memory used to support AV authorization key. Three data structures
61+
* are needed.
62+
* 1. ibuf pool for memory allocation and lookup O(1) access.
63+
* 2. hash table for O(1) reverse lookup
64+
* 3. List for iterating
65+
*/
66+
struct cxip_av_auth_key_entry *auth_key_entry_hash;
67+
struct ofi_bufpool *auth_key_entry_pool;
68+
struct dlist_entry auth_key_entry_list;
69+
ofi_atomic32_t auth_key_entry_cnt;
70+
size_t auth_key_entry_max;
71+
72+
/* Single lock is used to protect entire AV. With domain level
73+
* threading, this lock is not used.
74+
*/
75+
bool lockless;
76+
pthread_rwlock_t lock;
77+
78+
/* AV is configured as symmetric. This is an optimization which enables
79+
* endpoints to use logical address.
80+
*/
81+
bool symmetric;
82+
83+
/* Address vector type. */
84+
enum fi_av_type type;
85+
86+
/* Whether or not the AV is operating in FI_AV_AUTH_KEY mode. */
87+
bool av_auth_key;
88+
89+
/* Whether or not the AV was opened with FI_AV_USER_ID. */
90+
bool av_user_id;
91+
};
92+
93+
struct cxip_av_set {
94+
struct fid_av_set av_set_fid;
95+
struct cxip_av *cxi_av; // associated AV
96+
struct cxip_coll_mc *mc_obj; // reference MC
97+
fi_addr_t *fi_addr_ary; // addresses in set
98+
size_t fi_addr_cnt; // count of addresses
99+
struct cxip_comm_key comm_key; // communication key
100+
uint64_t flags;
101+
};
102+
103+
/* Function declarations */
104+
int cxip_av_auth_key_get_vnis(struct cxip_av *av, uint16_t **vni,
105+
size_t *vni_count);
106+
107+
void cxip_av_auth_key_put_vnis(struct cxip_av *av, uint16_t *vni,
108+
size_t vni_count);
109+
110+
extern struct cxip_addr *(*cxip_av_addr_in)(const void *addr);
111+
112+
extern void (*cxip_av_addr_out)(struct cxip_addr *addr_out,
113+
struct cxip_addr *addr);
114+
115+
int cxip_av_lookup_addr(struct cxip_av *av, fi_addr_t fi_addr,
116+
struct cxip_addr *addr);
117+
118+
fi_addr_t cxip_av_lookup_fi_addr(struct cxip_av *av,
119+
const struct cxip_addr *addr);
120+
121+
fi_addr_t cxip_av_lookup_auth_key_fi_addr(struct cxip_av *av, unsigned int vni);
122+
123+
int cxip_av_open(struct fid_domain *domain, struct fi_av_attr *attr,
124+
struct fid_av **av, void *context);
125+
126+
int cxip_av_bind_ep(struct cxip_av *av, struct cxip_ep *ep);
127+
128+
void cxip_av_unbind_ep(struct cxip_av *av, struct cxip_ep *ep);
129+
130+
int cxip_av_set(struct fid_av *av, struct fi_av_set_attr *attr,
131+
struct fid_av_set **av_set_fid, void * context);
132+
133+
#endif /* _CXIP_AV_H_ */

prov/cxi/include/cxip/cmdq.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_CMDQ_H_
8+
#define _CXIP_CMDQ_H_
9+
10+
11+
#include <stdint.h>
12+
#include <stddef.h>
13+
#include <stdbool.h>
14+
15+
/* Forward declarations */
16+
struct cxip_lni;
17+
18+
/* Type definitions */
19+
struct cxip_cmdq {
20+
struct cxi_cq *dev_cmdq;
21+
struct c_cstate_cmd c_state;
22+
enum cxip_llring_mode llring_mode;
23+
24+
struct cxi_cp *cur_cp;
25+
struct cxi_cp *prev_cp;
26+
struct cxip_lni *lni;
27+
};
28+
29+
/* Function declarations */
30+
int cxip_cmdq_emit_idc_put(struct cxip_cmdq *cmdq,
31+
const struct c_cstate_cmd *c_state,
32+
const struct c_idc_put_cmd *put, const void *buf,
33+
size_t len, uint64_t flags);
34+
35+
int cxip_cmdq_emit_dma(struct cxip_cmdq *cmdq, struct c_full_dma_cmd *dma,
36+
uint64_t flags);
37+
38+
int cxip_cmdq_emic_idc_amo(struct cxip_cmdq *cmdq,
39+
const struct c_cstate_cmd *c_state,
40+
const struct c_idc_amo_cmd *amo, uint64_t flags,
41+
bool fetching, bool flush);
42+
43+
int cxip_cmdq_emit_dma_amo(struct cxip_cmdq *cmdq, struct c_dma_amo_cmd *amo,
44+
uint64_t flags, bool fetching, bool flush);
45+
46+
int cxip_cmdq_emit_idc_msg(struct cxip_cmdq *cmdq,
47+
const struct c_cstate_cmd *c_state,
48+
const struct c_idc_msg_hdr *msg, const void *buf,
49+
size_t len, uint64_t flags);
50+
51+
enum cxi_traffic_class cxip_ofi_to_cxi_tc(uint32_t ofi_tclass);
52+
53+
int cxip_cmdq_cp_set(struct cxip_cmdq *cmdq, uint16_t vni,
54+
enum cxi_traffic_class tc,
55+
enum cxi_traffic_class_type tc_type);
56+
57+
int cxip_cmdq_cp_modify(struct cxip_cmdq *cmdq, uint16_t vni,
58+
enum cxi_traffic_class tc);
59+
60+
int cxip_cmdq_alloc(struct cxip_lni *lni, struct cxi_eq *evtq,
61+
struct cxi_cq_alloc_opts *cq_opts, uint16_t vni,
62+
enum cxi_traffic_class tc,
63+
enum cxi_traffic_class_type tc_type,
64+
struct cxip_cmdq **cmdq);
65+
66+
void cxip_cmdq_free(struct cxip_cmdq *cmdq);
67+
68+
int cxip_cmdq_emit_c_state(struct cxip_cmdq *cmdq,
69+
const struct c_cstate_cmd *cmd);
70+
71+
#endif /* _CXIP_CMDQ_H_ */

prov/cxi/include/cxip/cntr.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only
3+
*
4+
* Copyright (c) 2018-2024 Hewlett Packard Enterprise Development LP
5+
*/
6+
7+
#ifndef _CXIP_CNTR_H_
8+
#define _CXIP_CNTR_H_
9+
10+
11+
#include <stdint.h>
12+
#include <stdbool.h>
13+
#include <ofi_list.h>
14+
#include <ofi_atom.h>
15+
16+
/* Forward declarations */
17+
struct cxip_cmdq;
18+
struct cxip_domain;
19+
20+
/* Type definitions */
21+
struct cxip_cntr {
22+
struct fid_cntr cntr_fid;
23+
struct cxip_domain *domain; // parent domain
24+
ofi_atomic32_t ref;
25+
struct fi_cntr_attr attr; // copy of user or default attributes
26+
struct fid_wait *wait;
27+
/* Contexts to which counter is bound */
28+
struct dlist_entry ctx_list;
29+
30+
/* Triggered cmdq for bound counters */
31+
struct cxip_cmdq *trig_cmdq;
32+
33+
struct ofi_genlock lock;
34+
35+
struct cxi_ct *ct;
36+
struct c_ct_writeback *wb;
37+
uint64_t wb_device;
38+
enum fi_hmem_iface wb_iface;
39+
uint64_t wb_handle;
40+
bool wb_handle_valid;
41+
struct c_ct_writeback lwb;
42+
43+
struct dlist_entry dom_entry;
44+
45+
/* Counter for number of operations which need progress. A separate lock
46+
* is needed since these functions may be called without counter lock held.
47+
*/
48+
struct ofi_genlock progress_count_lock;
49+
int progress_count;
50+
};
51+
52+
/* Function declarations */
53+
int cxip_cntr_mod(struct cxip_cntr *cxi_cntr, uint64_t value, bool set,
54+
bool err);
55+
56+
int cxip_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
57+
struct fid_cntr **cntr, void *context);
58+
59+
#endif /* _CXIP_CNTR_H_ */

0 commit comments

Comments
 (0)