Debian Codegraph @

ptl_ips/ips_path_rec.h

raw
1 /*
2 * Copyright (c) 2013. Intel Corporation. All rights reserved.
3 * 2009,2010. QLogic Corporation. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33
34 #ifndef _IPS_PATH_REC_H_
35 #define _IPS_PATH_REC_H_
36
37 #include <search.h>
38
39 /* Default size of path record hash table */
40 #define DF_PATH_REC_HASH_SIZE 2047
41
42 /* Default size of CCT table. Must be multiple of 64 */
43 #define DF_CCT_TABLE_SIZE 128
44
45 /* CCT max IPD delay. QLE73XX is limited to 32us */
46 #define DF_CCT_MAX_IPD_DELAY_US 21
47
48 /* CCA divisor shift */
49 #define CCA_DIVISOR_SHIFT 14
50
51 /* CCA ipd mask */
52 #define CCA_IPD_MASK 0x3FFF
53
54 /* A lot of these are IBTA specific defines that are available in other header
55 * files. To minimize dependencies with PSM build process they are listed
56 * here. Most of this is used to implement IBTA compliance features with PSM
57 * like path record querye etc.
58 */
59
60 enum ibta_mtu {
61 IBTA_MTU_256 = 1,
62 IBTA_MTU_512 = 2,
63 IBTA_MTU_1024 = 3,
64 IBTA_MTU_2048 = 4,
65 IBTA_MTU_4096 = 5
66 };
67
68 typedef enum {
69 IBTA_RATE_PORT_CURRENT = 0,
70 IBTA_RATE_2_5_GBPS = 2,
71 IBTA_RATE_5_GBPS = 5,
72 IBTA_RATE_10_GBPS = 3,
73 IBTA_RATE_20_GBPS = 6,
74 IBTA_RATE_30_GBPS = 4,
75 IBTA_RATE_40_GBPS = 7,
76 IBTA_RATE_60_GBPS = 8,
77 IBTA_RATE_80_GBPS = 9,
78 IBTA_RATE_120_GBPS = 10
79 } ibta_rate;
80
81 static inline int ibta_mtu_enum_to_int(enum ibta_mtu mtu)
82 {
83 switch (mtu) {
84 case IBTA_MTU_256: return 256;
85 case IBTA_MTU_512: return 512;
86 case IBTA_MTU_1024: return 1024;
87 case IBTA_MTU_2048: return 2048;
88 case IBTA_MTU_4096: return 4096;
89 default: return -1;
90 }
91 }
92
93 /* This is same as ob_path_rec from ib_types.h. Listed here to be self
94 * contained to minimize dependencies during build etc.
95 */
96 typedef struct _ibta_path_rec {
97 uint64_t service_id; /* net order */
98 uint8_t dgid[16];
99 uint8_t sgid[16];
100 uint16_t dlid; /* net order */
101 uint16_t slid; /* net order */
102 uint32_t hop_flow_raw; /* net order */
103 uint8_t tclass;
104 uint8_t num_path;
105 uint16_t pkey; /* net order */
106 uint16_t qos_class_sl; /* net order */
107 uint8_t mtu; /* IBTA encoded */
108 uint8_t rate; /* IBTA encoded */
109 uint8_t pkt_life; /* IBTA encoded */
110 uint8_t preference;
111 uint8_t resv2[6];
112 } ibta_path_rec_t;
113
114 /*
115 * PSM IPS path record components for endpoint.
116 */
117 struct ips_proto;
118 typedef struct ips_path_rec {
119 uint16_t epr_slid; /* For Torus/non zero LMC fabrics this can be diff */
120 uint16_t epr_dlid;
121 uint16_t epr_mtu;
122 uint16_t epr_pkey;
123 uint8_t epr_sl;
124 uint8_t epr_static_rate;
125 uint16_t epr_static_ipd; /* Static rate IPD from path record */
126
127 /* IBTA CCA parameters per path */
128 struct ips_proto *proto;
129 uint16_t epr_ccti;
130 uint16_t epr_ccti_min;
131 psmi_timer epr_timer_cca; /* Congestion timer for epr_ccti increment. */
132 uint16_t epr_active_ipd; /* The current active IPD. max(static,cct) */
133 uint8_t epr_cca_divisor; /* CCA divisor [14:15] in CCT entry */
134 uint8_t epr_pad;
135
136 /* TODO: The endpoint timeout should also adjust based on epr_ird */
137 uint32_t epr_timeout_ack_factor;
138 uint64_t epr_timeout_ack;
139 uint64_t epr_timeout_ack_max;
140 } ips_path_rec_t;
141
142 typedef struct _ips_opp_path_rec {
143 ibta_path_rec_t opp_response;
144 ips_path_rec_t ips;
145 } ips_opp_path_rec_t;
146
147 psm_error_t ips_opp_init(struct ips_proto *proto);
148
149 #endif