-
Notifications
You must be signed in to change notification settings - Fork 131
/
sriovfecclusterconfig_types.go
223 lines (189 loc) · 7.75 KB
/
sriovfecclusterconfig_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2020-2021 Intel Corporation
package v2
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type SyncStatus string
var (
// InProgressSync indicates that the synchronization of the CR is in progress
InProgressSync SyncStatus = "InProgress"
// SucceededSync indicates that the synchronization of the CR succeeded
SucceededSync SyncStatus = "Succeeded"
// FailedSync indicates that the synchronization of the CR failed
FailedSync SyncStatus = "Failed"
// IgnoredSync indicates that the CR is ignored
IgnoredSync SyncStatus = "Ignored"
)
func (udq *UplinkDownlinkQueues) String() string {
return fmt.Sprintf("%d,%d,%d,%d,%d,%d,%d,%d", udq.VF0, udq.VF1, udq.VF2, udq.VF3,
udq.VF4, udq.VF5, udq.VF6, udq.VF7)
}
type UplinkDownlinkQueues struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF0 int `json:"vf0"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF1 int `json:"vf1"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF2 int `json:"vf2"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF3 int `json:"vf3"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF4 int `json:"vf4"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF5 int `json:"vf5"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF6 int `json:"vf6"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
VF7 int `json:"vf7"`
}
type UplinkDownlink struct {
// +kubebuilder:validation:Minimum=0
Bandwidth int `json:"bandwidth"`
// +kubebuilder:validation:Minimum=0
LoadBalance int `json:"loadBalance"`
Queues UplinkDownlinkQueues `json:"queues"`
}
// N3000BBDevConfig specifies variables to configure N3000 with
type N3000BBDevConfig struct {
// +kubebuilder:validation:Enum=FPGA_5GNR;FPGA_LTE
NetworkType string `json:"networkType"`
PFMode bool `json:"pfMode"`
// +kubebuilder:validation:Minimum=0
FLRTimeOut int `json:"flrTimeout"`
Downlink UplinkDownlink `json:"downlink"`
Uplink UplinkDownlink `json:"uplink"`
}
type QueueGroupConfig struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=8
NumQueueGroups int `json:"numQueueGroups"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=16
NumAqsPerGroups int `json:"numAqsPerGroups"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=12
AqDepthLog2 int `json:"aqDepthLog2"`
}
// ACC100BBDevConfig specifies variables to configure ACC100 with
type ACC100BBDevConfig struct {
PFMode bool `json:"pfMode"`
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=16
NumVfBundles int `json:"numVfBundles"`
// +kubebuilder:validation:Minimum=1024
// +kubebuilder:validation:Maximum=1024
MaxQueueSize int `json:"maxQueueSize"`
Uplink4G QueueGroupConfig `json:"uplink4G"`
Downlink4G QueueGroupConfig `json:"downlink4G"`
Uplink5G QueueGroupConfig `json:"uplink5G"`
Downlink5G QueueGroupConfig `json:"downlink5G"`
}
// BBDevConfig is a struct containing configuration for various FEC cards
type BBDevConfig struct {
N3000 *N3000BBDevConfig `json:"n3000,omitempty"`
ACC100 *ACC100BBDevConfig `json:"acc100,omitempty"`
}
// PhysicalFunctionConfig defines a possible configuration of a single Physical Function (PF), i.e. card
type PhysicalFunctionConfig struct {
// PFDriver to bound the PFs to
PFDriver string `json:"pfDriver"`
// VFDriver to bound the VFs to
VFDriver string `json:"vfDriver"`
// VFAmount is an amount of VFs to be created
// +kubebuilder:validation:Minimum=0
VFAmount int `json:"vfAmount"`
// BBDevConfig is a config for PF's queues
BBDevConfig BBDevConfig `json:"bbDevConfig"`
}
type PhysicalFunctionConfigExt struct {
// PCIAdress is a Physical Functions's PCI address that will be configured according to this spec
// +kubebuilder:validation:Pattern=`^[a-fA-F0-9]{4}:[a-fA-F0-9]{2}:[01][a-fA-F0-9]\.[0-7]$`
PCIAddress string `json:"pciAddress"`
// PFDriver to bound the PFs to
PFDriver string `json:"pfDriver"`
// VFDriver to bound the VFs to
VFDriver string `json:"vfDriver"`
// VFAmount is an amount of VFs to be created
// +kubebuilder:validation:Minimum=0
VFAmount int `json:"vfAmount"`
// BBDevConfig is a config for PF's queues
BBDevConfig BBDevConfig `json:"bbDevConfig"`
}
// SriovFecClusterConfigSpec defines the desired state of SriovFecClusterConfig
type SriovFecClusterConfigSpec struct {
// List of node configurations. This element is deprecated and should not be use because it will be removed in next release of sriov-fec operator.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
Nodes []NodeConfig `json:"nodes,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Selector describes target node for this spec
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Selector describes target accelerator for this spec
AcceleratorSelector AcceleratorSelector `json:"acceleratorSelector,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Physical function (card) config
PhysicalFunction PhysicalFunctionConfig `json:"physicalFunction,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Higher priority policies can override lower ones.
Priority int `json:"priority,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
// Skips drain process when true; default false. Should be true if operator is running on SNO
DrainSkip bool `json:"drainSkip,omitempty"`
}
type AcceleratorSelector struct {
VendorID string `json:"vendorID,omitempty"`
DeviceID string `json:"deviceID,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Pattern=`^[a-fA-F0-9]{4}:[a-fA-F0-9]{2}:[01][a-fA-F0-9]\.[0-7]$`
PCIAddress string `json:"pciAddress,omitempty"`
PFDriver string `json:"driver,omitempty"`
MaxVFs int `json:"maxVirtualFunctions,omitempty"`
}
// SriovFecClusterConfigStatus defines the observed state of SriovFecClusterConfig
type SriovFecClusterConfigStatus struct {
// Indicates the synchronization status of the CR
// +operator-sdk:csv:customresourcedefinitions:type=status
SyncStatus SyncStatus `json:"syncStatus,omitempty"`
LastSyncError string `json:"lastSyncError,omitempty"`
}
type NodeConfig struct {
// Name of the node
NodeName string `json:"nodeName"`
// List of physical functions (cards) configs
// +operator-sdk:csv:customresourcedefinitions:type=spec
PhysicalFunctions []PhysicalFunctionConfigExt `json:"physicalFunctions"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SyncStatus",type=string,JSONPath=`.status.syncStatus`
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=sfcc
// SriovFecClusterConfig is the Schema for the sriovfecclusterconfigs API
// +operator-sdk:csv:customresourcedefinitions:displayName="SriovFecClusterConfig",resources={{SriovFecNodeConfig,v2,node}}
type SriovFecClusterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec SriovFecClusterConfigSpec `json:"spec,omitempty"`
Status SriovFecClusterConfigStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// SriovFecClusterConfigList contains a list of SriovFecClusterConfig
type SriovFecClusterConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SriovFecClusterConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&SriovFecClusterConfig{}, &SriovFecClusterConfigList{})
}