1 /*- 2 * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB 3 * 4 * Copyright (c) 2016 - 2023 Intel Corporation 5 * 6 * This software is available to you under a choice of one of two 7 * licenses. You may choose to be licensed under the terms of the GNU 8 * General Public License (GPL) Version 2, available from the file 9 * COPYING in the main directory of this source tree, or the 10 * OpenFabrics.org BSD license below: 11 * 12 * Redistribution and use in source and binary forms, with or 13 * without modification, are permitted provided that the following 14 * conditions are met: 15 * 16 * - Redistributions of source code must retain the above 17 * copyright notice, this list of conditions and the following 18 * disclaimer. 19 * 20 * - Redistributions in binary form must reproduce the above 21 * copyright notice, this list of conditions and the following 22 * disclaimer in the documentation and/or other materials 23 * provided with the distribution. 24 * 25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * SOFTWARE. 33 */ 34 35 #ifndef IRDMA_UDA_H 36 #define IRDMA_UDA_H 37 38 #define IRDMA_UDA_MAX_FSI_MGS 4096 39 #define IRDMA_UDA_MAX_PFS 16 40 #define IRDMA_UDA_MAX_VFS 128 41 42 struct irdma_sc_cqp; 43 44 struct irdma_ah_info { 45 struct irdma_sc_vsi *vsi; 46 u32 pd_idx; 47 u32 dst_arpindex; 48 u32 dest_ip_addr[4]; 49 u32 src_ip_addr[4]; 50 u32 flow_label; 51 u32 ah_idx; 52 u16 vlan_tag; 53 u8 insert_vlan_tag; 54 u8 tc_tos; 55 u8 hop_ttl; 56 u8 mac_addr[ETHER_ADDR_LEN]; 57 bool ah_valid:1; 58 bool ipv4_valid:1; 59 bool do_lpbk:1; 60 }; 61 62 struct irdma_sc_ah { 63 struct irdma_sc_dev *dev; 64 struct irdma_ah_info ah_info; 65 }; 66 67 int irdma_sc_add_mcast_grp(struct irdma_mcast_grp_info *ctx, 68 struct irdma_mcast_grp_ctx_entry_info *mg); 69 int irdma_sc_del_mcast_grp(struct irdma_mcast_grp_info *ctx, 70 struct irdma_mcast_grp_ctx_entry_info *mg); 71 int irdma_sc_access_ah(struct irdma_sc_cqp *cqp, struct irdma_ah_info *info, 72 u32 op, u64 scratch); 73 int irdma_access_mcast_grp(struct irdma_sc_cqp *cqp, 74 struct irdma_mcast_grp_info *info, u32 op, 75 u64 scratch); 76 77 static inline void irdma_sc_init_ah(struct irdma_sc_dev *dev, struct irdma_sc_ah *ah) 78 { 79 ah->dev = dev; 80 } 81 82 static inline int irdma_sc_create_ah(struct irdma_sc_cqp *cqp, 83 struct irdma_ah_info *info, u64 scratch) 84 { 85 return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_CREATE_ADDR_HANDLE, 86 scratch); 87 } 88 89 static inline int irdma_sc_destroy_ah(struct irdma_sc_cqp *cqp, 90 struct irdma_ah_info *info, u64 scratch) 91 { 92 return irdma_sc_access_ah(cqp, info, IRDMA_CQP_OP_DESTROY_ADDR_HANDLE, 93 scratch); 94 } 95 96 static inline int irdma_sc_create_mcast_grp(struct irdma_sc_cqp *cqp, 97 struct irdma_mcast_grp_info *info, 98 u64 scratch) 99 { 100 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_CREATE_MCAST_GRP, 101 scratch); 102 } 103 104 static inline int irdma_sc_modify_mcast_grp(struct irdma_sc_cqp *cqp, 105 struct irdma_mcast_grp_info *info, 106 u64 scratch) 107 { 108 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_MODIFY_MCAST_GRP, 109 scratch); 110 } 111 112 static inline int irdma_sc_destroy_mcast_grp(struct irdma_sc_cqp *cqp, 113 struct irdma_mcast_grp_info *info, 114 u64 scratch) 115 { 116 return irdma_access_mcast_grp(cqp, info, IRDMA_CQP_OP_DESTROY_MCAST_GRP, 117 scratch); 118 } 119 #endif /* IRDMA_UDA_H */ 120