1 /* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB */
2 /* Copyright (c) 2016 - 2021 Intel Corporation */
3 #ifndef IRDMA_UDA_H
4 #define IRDMA_UDA_H
5
6 #define IRDMA_UDA_MAX_FSI_MGS 4096
7 #define IRDMA_UDA_MAX_PFS 16
8 #define IRDMA_UDA_MAX_VFS 128
9
10 struct irdma_sc_cqp;
11
12 struct irdma_ah_info {
13 struct irdma_sc_vsi *vsi;
14 u32 pd_idx;
15 u32 dst_arpindex;
16 u32 dest_ip_addr[4];
17 u32 src_ip_addr[4];
18 u32 flow_label;
19 u32 ah_idx;
20 u16 vlan_tag;
21 u8 insert_vlan_tag;
22 u8 tc_tos;
23 u8 hop_ttl;
24 u8 mac_addr[ETH_ALEN];
25 bool ah_valid:1;
26 bool ipv4_valid:1;
27 bool do_lpbk:1;
28 };
29
30 struct irdma_sc_ah {
31 struct irdma_sc_dev *dev;
32 struct irdma_ah_info ah_info;
33 };
34
35 enum irdma_status_code irdma_sc_add_mcast_grp(struct irdma_mcast_grp_info *ctx,
36 struct irdma_mcast_grp_ctx_entry_info *mg);
37 enum irdma_status_code irdma_sc_del_mcast_grp(struct irdma_mcast_grp_info *ctx,
38 struct irdma_mcast_grp_ctx_entry_info *mg);
39 enum irdma_status_code irdma_sc_access_ah(struct irdma_sc_cqp *cqp, struct irdma_ah_info *info,
40 u32 op, u64 scratch);
41 enum irdma_status_code irdma_access_mcast_grp(struct irdma_sc_cqp *cqp,
42 struct irdma_mcast_grp_info *info,
43 u32 op, u64 scratch);
44
irdma_sc_init_ah(struct irdma_sc_dev * dev,struct irdma_sc_ah * ah)45 static inline void irdma_sc_init_ah(struct irdma_sc_dev *dev, struct irdma_sc_ah *ah)
46 {
47 ah->dev = dev;
48 }
49
irdma_sc_create_ah(struct irdma_sc_cqp * cqp,struct irdma_ah_info * info,u64 scratch)50 static inline enum irdma_status_code irdma_sc_create_ah(struct irdma_sc_cqp *cqp,
51 struct irdma_ah_info *info,
52 u64 scratch)
53 {
54 return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_CREATE_ADDR_HANDLE,
55 scratch);
56 }
57
irdma_sc_destroy_ah(struct irdma_sc_cqp * cqp,struct irdma_ah_info * info,u64 scratch)58 static inline enum irdma_status_code irdma_sc_destroy_ah(struct irdma_sc_cqp *cqp,
59 struct irdma_ah_info *info,
60 u64 scratch)
61 {
62 return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_DESTROY_ADDR_HANDLE,
63 scratch);
64 }
65
irdma_sc_create_mcast_grp(struct irdma_sc_cqp * cqp,struct irdma_mcast_grp_info * info,u64 scratch)66 static inline enum irdma_status_code irdma_sc_create_mcast_grp(struct irdma_sc_cqp *cqp,
67 struct irdma_mcast_grp_info *info,
68 u64 scratch)
69 {
70 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_CREATE_MCAST_GRP,
71 scratch);
72 }
73
irdma_sc_modify_mcast_grp(struct irdma_sc_cqp * cqp,struct irdma_mcast_grp_info * info,u64 scratch)74 static inline enum irdma_status_code irdma_sc_modify_mcast_grp(struct irdma_sc_cqp *cqp,
75 struct irdma_mcast_grp_info *info,
76 u64 scratch)
77 {
78 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_MODIFY_MCAST_GRP,
79 scratch);
80 }
81
irdma_sc_destroy_mcast_grp(struct irdma_sc_cqp * cqp,struct irdma_mcast_grp_info * info,u64 scratch)82 static inline enum irdma_status_code irdma_sc_destroy_mcast_grp(struct irdma_sc_cqp *cqp,
83 struct irdma_mcast_grp_info *info,
84 u64 scratch)
85 {
86 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_DESTROY_MCAST_GRP,
87 scratch);
88 }
89 #endif /* IRDMA_UDA_H */
90