xref: /openbmc/linux/drivers/infiniband/hw/irdma/uda.h (revision 9a29f5fc)
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 int irdma_sc_add_mcast_grp(struct irdma_mcast_grp_info *ctx,
36 			   struct irdma_mcast_grp_ctx_entry_info *mg);
37 int irdma_sc_del_mcast_grp(struct irdma_mcast_grp_info *ctx,
38 			   struct irdma_mcast_grp_ctx_entry_info *mg);
39 int irdma_sc_access_ah(struct irdma_sc_cqp *cqp, struct irdma_ah_info *info,
40 		       u32 op, u64 scratch);
41 int irdma_access_mcast_grp(struct irdma_sc_cqp *cqp,
42 			   struct irdma_mcast_grp_info *info, u32 op,
43 			   u64 scratch);
44 
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 
50 static inline int irdma_sc_create_ah(struct irdma_sc_cqp *cqp,
51 				     struct irdma_ah_info *info, u64 scratch)
52 {
53 	return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_CREATE_ADDR_HANDLE,
54 				  scratch);
55 }
56 
57 static inline int irdma_sc_destroy_ah(struct irdma_sc_cqp *cqp,
58 				      struct irdma_ah_info *info, u64 scratch)
59 {
60 	return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_DESTROY_ADDR_HANDLE,
61 				  scratch);
62 }
63 
64 static inline int irdma_sc_create_mcast_grp(struct irdma_sc_cqp *cqp,
65 					    struct irdma_mcast_grp_info *info,
66 					    u64 scratch)
67 {
68 	return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_CREATE_MCAST_GRP,
69 				      scratch);
70 }
71 
72 static inline int irdma_sc_modify_mcast_grp(struct irdma_sc_cqp *cqp,
73 					    struct irdma_mcast_grp_info *info,
74 					    u64 scratch)
75 {
76 	return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_MODIFY_MCAST_GRP,
77 				      scratch);
78 }
79 
80 static inline int irdma_sc_destroy_mcast_grp(struct irdma_sc_cqp *cqp,
81 					     struct irdma_mcast_grp_info *info,
82 					     u64 scratch)
83 {
84 	return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_DESTROY_MCAST_GRP,
85 				      scratch);
86 }
87 #endif /* IRDMA_UDA_H */
88