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