Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
3 : : * All rights reserved.
4 : : */
5 : : #ifndef _ENA_ADMIN_H_
6 : : #define _ENA_ADMIN_H_
7 : :
8 : : #define ENA_ADMIN_EXTRA_PROPERTIES_STRING_LEN 32
9 : : #define ENA_ADMIN_EXTRA_PROPERTIES_COUNT 32
10 : :
11 : : #define ENA_ADMIN_RSS_KEY_PARTS 10
12 : :
13 : : #define ENA_ADMIN_CUSTOMER_METRICS_SUPPORT_MASK 0x3F
14 : : #define ENA_ADMIN_CUSTOMER_METRICS_MIN_SUPPORT_MASK 0x1F
15 : :
16 : : /* customer metrics - in correlation with
17 : : * ENA_ADMIN_CUSTOMER_METRICS_SUPPORT_MASK
18 : : */
19 : : enum ena_admin_customer_metrics_id {
20 : : ENA_ADMIN_BW_IN_ALLOWANCE_EXCEEDED = 0,
21 : : ENA_ADMIN_BW_OUT_ALLOWANCE_EXCEEDED = 1,
22 : : ENA_ADMIN_PPS_ALLOWANCE_EXCEEDED = 2,
23 : : ENA_ADMIN_CONNTRACK_ALLOWANCE_EXCEEDED = 3,
24 : : ENA_ADMIN_LINKLOCAL_ALLOWANCE_EXCEEDED = 4,
25 : : ENA_ADMIN_CONNTRACK_ALLOWANCE_AVAILABLE = 5,
26 : : };
27 : :
28 : : enum ena_admin_aq_opcode {
29 : : ENA_ADMIN_CREATE_SQ = 1,
30 : : ENA_ADMIN_DESTROY_SQ = 2,
31 : : ENA_ADMIN_CREATE_CQ = 3,
32 : : ENA_ADMIN_DESTROY_CQ = 4,
33 : : ENA_ADMIN_GET_FEATURE = 8,
34 : : ENA_ADMIN_SET_FEATURE = 9,
35 : : ENA_ADMIN_GET_STATS = 11,
36 : : };
37 : :
38 : : enum ena_admin_aq_completion_status {
39 : : ENA_ADMIN_SUCCESS = 0,
40 : : ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE = 1,
41 : : ENA_ADMIN_BAD_OPCODE = 2,
42 : : ENA_ADMIN_UNSUPPORTED_OPCODE = 3,
43 : : ENA_ADMIN_MALFORMED_REQUEST = 4,
44 : : /* Additional status is provided in ACQ entry extended_status */
45 : : ENA_ADMIN_ILLEGAL_PARAMETER = 5,
46 : : ENA_ADMIN_UNKNOWN_ERROR = 6,
47 : : ENA_ADMIN_RESOURCE_BUSY = 7,
48 : : };
49 : :
50 : : /* subcommands for the set/get feature admin commands */
51 : : enum ena_admin_aq_feature_id {
52 : : ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
53 : : ENA_ADMIN_MAX_QUEUES_NUM = 2,
54 : : ENA_ADMIN_HW_HINTS = 3,
55 : : ENA_ADMIN_LLQ = 4,
56 : : ENA_ADMIN_EXTRA_PROPERTIES_STRINGS = 5,
57 : : ENA_ADMIN_EXTRA_PROPERTIES_FLAGS = 6,
58 : : ENA_ADMIN_MAX_QUEUES_EXT = 7,
59 : : ENA_ADMIN_RSS_HASH_FUNCTION = 10,
60 : : ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
61 : : ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG = 12,
62 : : ENA_ADMIN_MTU = 14,
63 : : ENA_ADMIN_RSS_HASH_INPUT = 18,
64 : : ENA_ADMIN_INTERRUPT_MODERATION = 20,
65 : : ENA_ADMIN_AENQ_CONFIG = 26,
66 : : ENA_ADMIN_LINK_CONFIG = 27,
67 : : ENA_ADMIN_HOST_ATTR_CONFIG = 28,
68 : : ENA_ADMIN_PHC_CONFIG = 29,
69 : : ENA_ADMIN_FEATURES_OPCODE_NUM = 32,
70 : : };
71 : :
72 : : /* feature version for the set/get ENA_ADMIN_LLQ feature admin commands */
73 : : enum ena_admin_llq_feature_version {
74 : : /* legacy base version in older drivers */
75 : : ENA_ADMIN_LLQ_FEATURE_VERSION_0_LEGACY = 0,
76 : : /* support entry_size recommendation by device */
77 : : ENA_ADMIN_LLQ_FEATURE_VERSION_1 = 1,
78 : : };
79 : :
80 : : /* device capabilities */
81 : : enum ena_admin_aq_caps_id {
82 : : ENA_ADMIN_ENI_STATS = 0,
83 : : /* ENA SRD customer metrics */
84 : : ENA_ADMIN_ENA_SRD_INFO = 1,
85 : : ENA_ADMIN_CUSTOMER_METRICS = 2,
86 : : ENA_ADMIN_EXTENDED_RESET_REASONS = 3,
87 : : ENA_ADMIN_CDESC_MBZ = 4,
88 : : };
89 : :
90 : : enum ena_admin_placement_policy_type {
91 : : /* descriptors and headers are in host memory */
92 : : ENA_ADMIN_PLACEMENT_POLICY_HOST = 1,
93 : : /* descriptors and headers are in device memory (a.k.a Low Latency
94 : : * Queue)
95 : : */
96 : : ENA_ADMIN_PLACEMENT_POLICY_DEV = 3,
97 : : };
98 : :
99 : : enum ena_admin_link_types {
100 : : ENA_ADMIN_LINK_SPEED_1G = 0x1,
101 : : ENA_ADMIN_LINK_SPEED_2_HALF_G = 0x2,
102 : : ENA_ADMIN_LINK_SPEED_5G = 0x4,
103 : : ENA_ADMIN_LINK_SPEED_10G = 0x8,
104 : : ENA_ADMIN_LINK_SPEED_25G = 0x10,
105 : : ENA_ADMIN_LINK_SPEED_40G = 0x20,
106 : : ENA_ADMIN_LINK_SPEED_50G = 0x40,
107 : : ENA_ADMIN_LINK_SPEED_100G = 0x80,
108 : : ENA_ADMIN_LINK_SPEED_200G = 0x100,
109 : : ENA_ADMIN_LINK_SPEED_400G = 0x200,
110 : : };
111 : :
112 : : enum ena_admin_completion_policy_type {
113 : : /* completion queue entry for each sq descriptor */
114 : : ENA_ADMIN_COMPLETION_POLICY_DESC = 0,
115 : : /* completion queue entry upon request in sq descriptor */
116 : : ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
117 : : /* current queue head pointer is updated in OS memory upon sq
118 : : * descriptor request
119 : : */
120 : : ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
121 : : /* current queue head pointer is updated in OS memory for each sq
122 : : * descriptor
123 : : */
124 : : ENA_ADMIN_COMPLETION_POLICY_HEAD = 3,
125 : : };
126 : :
127 : : /* basic stats return ena_admin_basic_stats while extanded stats return a
128 : : * buffer (string format) with additional statistics per queue and per
129 : : * device id
130 : : */
131 : : enum ena_admin_get_stats_type {
132 : : ENA_ADMIN_GET_STATS_TYPE_BASIC = 0,
133 : : ENA_ADMIN_GET_STATS_TYPE_EXTENDED = 1,
134 : : /* extra HW stats for specific network interface */
135 : : ENA_ADMIN_GET_STATS_TYPE_ENI = 2,
136 : : /* extra HW stats for ENA SRD */
137 : : ENA_ADMIN_GET_STATS_TYPE_ENA_SRD = 3,
138 : : ENA_ADMIN_GET_STATS_TYPE_CUSTOMER_METRICS = 4,
139 : :
140 : : };
141 : :
142 : : enum ena_admin_get_stats_scope {
143 : : ENA_ADMIN_SPECIFIC_QUEUE = 0,
144 : : ENA_ADMIN_ETH_TRAFFIC = 1,
145 : : };
146 : :
147 : : enum ena_admin_phc_feature_version {
148 : : /* Readless with error_bound */
149 : : ENA_ADMIN_PHC_FEATURE_VERSION_0 = 0,
150 : : };
151 : :
152 : : enum ena_admin_phc_error_flags {
153 : : ENA_ADMIN_PHC_ERROR_FLAG_TIMESTAMP = BIT(0),
154 : : ENA_ADMIN_PHC_ERROR_FLAG_ERROR_BOUND = BIT(1),
155 : : };
156 : :
157 : : /* ENA SRD configuration for ENI */
158 : : enum ena_admin_ena_srd_flags {
159 : : /* Feature enabled */
160 : : ENA_ADMIN_ENA_SRD_ENABLED = BIT(0),
161 : : /* UDP support enabled */
162 : : ENA_ADMIN_ENA_SRD_UDP_ENABLED = BIT(1),
163 : : /* Bypass Rx UDP ordering */
164 : : ENA_ADMIN_ENA_SRD_UDP_ORDERING_BYPASS_ENABLED = BIT(2),
165 : : };
166 : :
167 : : struct ena_admin_aq_common_desc {
168 : : /* 11:0 : command_id
169 : : * 15:12 : reserved12
170 : : */
171 : : uint16_t command_id;
172 : :
173 : : /* as appears in ena_admin_aq_opcode */
174 : : uint8_t opcode;
175 : :
176 : : /* 0 : phase
177 : : * 1 : ctrl_data - control buffer address valid
178 : : * 2 : ctrl_data_indirect - control buffer address
179 : : * points to list of pages with addresses of control
180 : : * buffers
181 : : * 7:3 : reserved3
182 : : */
183 : : uint8_t flags;
184 : : };
185 : :
186 : : /* used in ena_admin_aq_entry. Can point directly to control data, or to a
187 : : * page list chunk. Used also at the end of indirect mode page list chunks,
188 : : * for chaining.
189 : : */
190 : : struct ena_admin_ctrl_buff_info {
191 : : uint32_t length;
192 : :
193 : : struct ena_common_mem_addr address;
194 : : };
195 : :
196 : : struct ena_admin_sq {
197 : : uint16_t sq_idx;
198 : :
199 : : /* 4:0 : reserved
200 : : * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
201 : : */
202 : : uint8_t sq_identity;
203 : :
204 : : uint8_t reserved1;
205 : : };
206 : :
207 : : struct ena_admin_aq_entry {
208 : : struct ena_admin_aq_common_desc aq_common_descriptor;
209 : :
210 : : union {
211 : : uint32_t inline_data_w1[3];
212 : :
213 : : struct ena_admin_ctrl_buff_info control_buffer;
214 : : } u;
215 : :
216 : : uint32_t inline_data_w4[12];
217 : : };
218 : :
219 : : struct ena_admin_acq_common_desc {
220 : : /* command identifier to associate it with the aq descriptor
221 : : * 11:0 : command_id
222 : : * 15:12 : reserved12
223 : : */
224 : : uint16_t command;
225 : :
226 : : uint8_t status;
227 : :
228 : : /* 0 : phase
229 : : * 7:1 : reserved1
230 : : */
231 : : uint8_t flags;
232 : :
233 : : uint16_t extended_status;
234 : :
235 : : /* indicates to the driver which AQ entry has been consumed by the
236 : : * device and could be reused
237 : : */
238 : : uint16_t sq_head_indx;
239 : : };
240 : :
241 : : struct ena_admin_acq_entry {
242 : : struct ena_admin_acq_common_desc acq_common_descriptor;
243 : :
244 : : uint32_t response_specific_data[14];
245 : : };
246 : :
247 : : struct ena_admin_aq_create_sq_cmd {
248 : : struct ena_admin_aq_common_desc aq_common_descriptor;
249 : :
250 : : /* 4:0 : reserved0_w1
251 : : * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
252 : : */
253 : : uint8_t sq_identity;
254 : :
255 : : uint8_t reserved8_w1;
256 : :
257 : : /* 3:0 : placement_policy - Describing where the SQ
258 : : * descriptor ring and the SQ packet headers reside:
259 : : * 0x1 - descriptors and headers are in OS memory,
260 : : * 0x3 - descriptors and headers in device memory
261 : : * (a.k.a Low Latency Queue)
262 : : * 6:4 : completion_policy - Describing what policy
263 : : * to use for generation completion entry (cqe) in
264 : : * the CQ associated with this SQ: 0x0 - cqe for each
265 : : * sq descriptor, 0x1 - cqe upon request in sq
266 : : * descriptor, 0x2 - current queue head pointer is
267 : : * updated in OS memory upon sq descriptor request
268 : : * 0x3 - current queue head pointer is updated in OS
269 : : * memory for each sq descriptor
270 : : * 7 : reserved15_w1
271 : : */
272 : : uint8_t sq_caps_2;
273 : :
274 : : /* 0 : is_physically_contiguous - Described if the
275 : : * queue ring memory is allocated in physical
276 : : * contiguous pages or split.
277 : : * 7:1 : reserved17_w1
278 : : */
279 : : uint8_t sq_caps_3;
280 : :
281 : : /* associated completion queue id. This CQ must be created prior to SQ
282 : : * creation
283 : : */
284 : : uint16_t cq_idx;
285 : :
286 : : /* submission queue depth in entries */
287 : : uint16_t sq_depth;
288 : :
289 : : /* SQ physical base address in OS memory. This field should not be
290 : : * used for Low Latency queues. Has to be page aligned.
291 : : */
292 : : struct ena_common_mem_addr sq_ba;
293 : :
294 : : /* specifies queue head writeback location in OS memory. Valid if
295 : : * completion_policy is set to completion_policy_head_on_demand or
296 : : * completion_policy_head. Has to be cache aligned
297 : : */
298 : : struct ena_common_mem_addr sq_head_writeback;
299 : :
300 : : uint32_t reserved0_w7;
301 : :
302 : : uint32_t reserved0_w8;
303 : : };
304 : :
305 : : enum ena_admin_sq_direction {
306 : : ENA_ADMIN_SQ_DIRECTION_TX = 1,
307 : : ENA_ADMIN_SQ_DIRECTION_RX = 2,
308 : : };
309 : :
310 : : struct ena_admin_acq_create_sq_resp_desc {
311 : : struct ena_admin_acq_common_desc acq_common_desc;
312 : :
313 : : uint16_t sq_idx;
314 : :
315 : : uint16_t reserved;
316 : :
317 : : /* queue doorbell address as an offset to PCIe MMIO REG BAR */
318 : : uint32_t sq_doorbell_offset;
319 : :
320 : : /* low latency queue ring base address as an offset to PCIe MMIO
321 : : * LLQ_MEM BAR
322 : : */
323 : : uint32_t llq_descriptors_offset;
324 : :
325 : : /* low latency queue headers' memory as an offset to PCIe MMIO
326 : : * LLQ_MEM BAR
327 : : */
328 : : uint32_t llq_headers_offset;
329 : : };
330 : :
331 : : struct ena_admin_aq_destroy_sq_cmd {
332 : : struct ena_admin_aq_common_desc aq_common_descriptor;
333 : :
334 : : struct ena_admin_sq sq;
335 : : };
336 : :
337 : : struct ena_admin_acq_destroy_sq_resp_desc {
338 : : struct ena_admin_acq_common_desc acq_common_desc;
339 : : };
340 : :
341 : : struct ena_admin_aq_create_cq_cmd {
342 : : struct ena_admin_aq_common_desc aq_common_descriptor;
343 : :
344 : : /* 4:0 : reserved5
345 : : * 5 : interrupt_mode_enabled - if set, cq operates
346 : : * in interrupt mode, otherwise - polling
347 : : * 7:6 : reserved6
348 : : */
349 : : uint8_t cq_caps_1;
350 : :
351 : : /* 4:0 : cq_entry_size_words - size of CQ entry in
352 : : * 32-bit words, valid values: 4, 8.
353 : : * 7:5 : reserved7
354 : : */
355 : : uint8_t cq_caps_2;
356 : :
357 : : /* completion queue depth in # of entries. must be power of 2 */
358 : : uint16_t cq_depth;
359 : :
360 : : /* msix vector assigned to this cq */
361 : : uint32_t msix_vector;
362 : :
363 : : /* cq physical base address in OS memory. CQ must be physically
364 : : * contiguous
365 : : */
366 : : struct ena_common_mem_addr cq_ba;
367 : : };
368 : :
369 : : struct ena_admin_acq_create_cq_resp_desc {
370 : : struct ena_admin_acq_common_desc acq_common_desc;
371 : :
372 : : uint16_t cq_idx;
373 : :
374 : : /* actual cq depth in number of entries */
375 : : uint16_t cq_actual_depth;
376 : :
377 : : uint32_t numa_node_register_offset;
378 : :
379 : : uint32_t cq_head_db_register_offset;
380 : :
381 : : uint32_t cq_interrupt_unmask_register_offset;
382 : : };
383 : :
384 : : struct ena_admin_aq_destroy_cq_cmd {
385 : : struct ena_admin_aq_common_desc aq_common_descriptor;
386 : :
387 : : uint16_t cq_idx;
388 : :
389 : : uint16_t reserved1;
390 : : };
391 : :
392 : : struct ena_admin_acq_destroy_cq_resp_desc {
393 : : struct ena_admin_acq_common_desc acq_common_desc;
394 : : };
395 : :
396 : : /* ENA AQ Get Statistics command. Extended statistics are placed in control
397 : : * buffer pointed by AQ entry
398 : : */
399 : : struct ena_admin_aq_get_stats_cmd {
400 : : struct ena_admin_aq_common_desc aq_common_descriptor;
401 : :
402 : : union {
403 : : /* command specific inline data */
404 : : uint32_t inline_data_w1[3];
405 : :
406 : : struct ena_admin_ctrl_buff_info control_buffer;
407 : : } u;
408 : :
409 : : /* stats type as defined in enum ena_admin_get_stats_type */
410 : : uint8_t type;
411 : :
412 : : /* stats scope defined in enum ena_admin_get_stats_scope */
413 : : uint8_t scope;
414 : :
415 : : uint16_t reserved3;
416 : :
417 : : /* queue id. used when scope is specific_queue */
418 : : uint16_t queue_idx;
419 : :
420 : : /* device id, value 0xFFFF means mine. only privileged device can get
421 : : * stats of other device
422 : : */
423 : : uint16_t device_id;
424 : :
425 : : /* a bitmap representing the requested metric values */
426 : : uint64_t requested_metrics;
427 : : };
428 : :
429 : : /* Basic Statistics Command. */
430 : : struct ena_admin_basic_stats {
431 : : uint32_t tx_bytes_low;
432 : :
433 : : uint32_t tx_bytes_high;
434 : :
435 : : uint32_t tx_pkts_low;
436 : :
437 : : uint32_t tx_pkts_high;
438 : :
439 : : uint32_t rx_bytes_low;
440 : :
441 : : uint32_t rx_bytes_high;
442 : :
443 : : uint32_t rx_pkts_low;
444 : :
445 : : uint32_t rx_pkts_high;
446 : :
447 : : uint32_t rx_drops_low;
448 : :
449 : : uint32_t rx_drops_high;
450 : :
451 : : uint32_t tx_drops_low;
452 : :
453 : : uint32_t tx_drops_high;
454 : :
455 : : uint32_t rx_overruns_low;
456 : :
457 : : uint32_t rx_overruns_high;
458 : : };
459 : :
460 : : /* ENI Statistics Command. */
461 : : struct ena_admin_eni_stats {
462 : : /* The number of packets shaped due to inbound aggregate BW
463 : : * allowance being exceeded
464 : : */
465 : : uint64_t bw_in_allowance_exceeded;
466 : :
467 : : /* The number of packets shaped due to outbound aggregate BW
468 : : * allowance being exceeded
469 : : */
470 : : uint64_t bw_out_allowance_exceeded;
471 : :
472 : : /* The number of packets shaped due to PPS allowance being exceeded */
473 : : uint64_t pps_allowance_exceeded;
474 : :
475 : : /* The number of packets shaped due to connection tracking
476 : : * allowance being exceeded and leading to failure in establishment
477 : : * of new connections
478 : : */
479 : : uint64_t conntrack_allowance_exceeded;
480 : :
481 : : /* The number of packets shaped due to linklocal packet rate
482 : : * allowance being exceeded
483 : : */
484 : : uint64_t linklocal_allowance_exceeded;
485 : : };
486 : :
487 : : struct ena_admin_ena_srd_stats {
488 : : /* Number of packets transmitted over ENA SRD */
489 : : uint64_t ena_srd_tx_pkts;
490 : :
491 : : /* Number of packets transmitted or could have been
492 : : * transmitted over ENA SRD
493 : : */
494 : : uint64_t ena_srd_eligible_tx_pkts;
495 : :
496 : : /* Number of packets received over ENA SRD */
497 : : uint64_t ena_srd_rx_pkts;
498 : :
499 : : /* Percentage of the ENA SRD resources that is in use */
500 : : uint64_t ena_srd_resource_utilization;
501 : : };
502 : :
503 : : /* ENA SRD Statistics Command */
504 : : struct ena_admin_ena_srd_info {
505 : : /* ENA SRD configuration bitmap. See ena_admin_ena_srd_flags for
506 : : * details
507 : : */
508 : : uint64_t flags;
509 : :
510 : : struct ena_admin_ena_srd_stats ena_srd_stats;
511 : : };
512 : :
513 : : /* Customer Metrics Command. */
514 : : struct ena_admin_customer_metrics {
515 : : /* A bitmap representing the reported customer metrics according to
516 : : * the order they are reported
517 : : */
518 : : uint64_t reported_metrics;
519 : : };
520 : :
521 : : struct ena_admin_acq_get_stats_resp {
522 : : struct ena_admin_acq_common_desc acq_common_desc;
523 : :
524 : : union {
525 : : uint64_t raw[7];
526 : :
527 : : struct ena_admin_basic_stats basic_stats;
528 : :
529 : : struct ena_admin_eni_stats eni_stats;
530 : :
531 : : struct ena_admin_ena_srd_info ena_srd_info;
532 : :
533 : : struct ena_admin_customer_metrics customer_metrics;
534 : : } u;
535 : : };
536 : :
537 : : struct ena_admin_get_set_feature_common_desc {
538 : : /* 1:0 : select - 0x1 - current value; 0x3 - default
539 : : * value
540 : : * 7:3 : reserved3
541 : : */
542 : : uint8_t flags;
543 : :
544 : : /* as appears in ena_admin_aq_feature_id */
545 : : uint8_t feature_id;
546 : :
547 : : /* The driver specifies the max feature version it supports and the
548 : : * device responds with the currently supported feature version. The
549 : : * field is zero based
550 : : */
551 : : uint8_t feature_version;
552 : :
553 : : uint8_t reserved8;
554 : : };
555 : :
556 : : struct ena_admin_device_attr_feature_desc {
557 : : uint32_t impl_id;
558 : :
559 : : uint32_t device_version;
560 : :
561 : : /* bitmap of ena_admin_aq_feature_id, which represents supported
562 : : * subcommands for the set/get feature admin commands.
563 : : */
564 : : uint32_t supported_features;
565 : :
566 : : /* bitmap of ena_admin_aq_caps_id, which represents device
567 : : * capabilities.
568 : : */
569 : : uint32_t capabilities;
570 : :
571 : : /* Indicates how many bits are used physical address access. */
572 : : uint32_t phys_addr_width;
573 : :
574 : : /* Indicates how many bits are used virtual address access. */
575 : : uint32_t virt_addr_width;
576 : :
577 : : /* unicast MAC address (in Network byte order) */
578 : : uint8_t mac_addr[6];
579 : :
580 : : uint8_t reserved7[2];
581 : :
582 : : uint32_t max_mtu;
583 : : };
584 : :
585 : : enum ena_admin_llq_header_location {
586 : : /* header is in descriptor list */
587 : : ENA_ADMIN_INLINE_HEADER = 1,
588 : : /* header in a separate ring, implies 16B descriptor list entry */
589 : : ENA_ADMIN_HEADER_RING = 2,
590 : : };
591 : :
592 : : enum ena_admin_llq_ring_entry_size {
593 : : ENA_ADMIN_LIST_ENTRY_SIZE_128B = 1,
594 : : ENA_ADMIN_LIST_ENTRY_SIZE_192B = 2,
595 : : ENA_ADMIN_LIST_ENTRY_SIZE_256B = 4,
596 : : };
597 : :
598 : : enum ena_admin_llq_num_descs_before_header {
599 : : ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_0 = 0,
600 : : ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_1 = 1,
601 : : ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2 = 2,
602 : : ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_4 = 4,
603 : : ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_8 = 8,
604 : : };
605 : :
606 : : /* packet descriptor list entry always starts with one or more descriptors,
607 : : * followed by a header. The rest of the descriptors are located in the
608 : : * beginning of the subsequent entry. Stride refers to how the rest of the
609 : : * descriptors are placed. This field is relevant only for inline header
610 : : * mode
611 : : */
612 : : enum ena_admin_llq_stride_ctrl {
613 : : ENA_ADMIN_SINGLE_DESC_PER_ENTRY = 1,
614 : : ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY = 2,
615 : : };
616 : :
617 : : enum ena_admin_accel_mode_feat {
618 : : ENA_ADMIN_DISABLE_META_CACHING = 0,
619 : : ENA_ADMIN_LIMIT_TX_BURST = 1,
620 : : };
621 : :
622 : : struct ena_admin_accel_mode_get {
623 : : /* bit field of enum ena_admin_accel_mode_feat */
624 : : uint16_t supported_flags;
625 : :
626 : : /* maximum burst size between two doorbells. The size is in bytes */
627 : : uint16_t max_tx_burst_size;
628 : : };
629 : :
630 : : struct ena_admin_accel_mode_set {
631 : : /* bit field of enum ena_admin_accel_mode_feat */
632 : : uint16_t enabled_flags;
633 : :
634 : : uint16_t reserved;
635 : : };
636 : :
637 : : struct ena_admin_accel_mode_req {
638 : : union {
639 : : uint32_t raw[2];
640 : :
641 : : struct ena_admin_accel_mode_get get;
642 : :
643 : : struct ena_admin_accel_mode_set set;
644 : : } u;
645 : : };
646 : :
647 : : struct ena_admin_feature_llq_desc {
648 : : uint32_t max_llq_num;
649 : :
650 : : uint32_t max_llq_depth;
651 : :
652 : : /* specify the header locations the device supports. bitfield of enum
653 : : * ena_admin_llq_header_location.
654 : : */
655 : : uint16_t header_location_ctrl_supported;
656 : :
657 : : /* the header location the driver selected to use. */
658 : : uint16_t header_location_ctrl_enabled;
659 : :
660 : : /* if inline header is specified - this is the size of descriptor list
661 : : * entry. If header in a separate ring is specified - this is the size
662 : : * of header ring entry. bitfield of enum ena_admin_llq_ring_entry_size.
663 : : * specify the entry sizes the device supports
664 : : */
665 : : uint16_t entry_size_ctrl_supported;
666 : :
667 : : /* the entry size the driver selected to use. */
668 : : uint16_t entry_size_ctrl_enabled;
669 : :
670 : : /* valid only if inline header is specified. First entry associated with
671 : : * the packet includes descriptors and header. Rest of the entries
672 : : * occupied by descriptors. This parameter defines the max number of
673 : : * descriptors precedding the header in the first entry. The field is
674 : : * bitfield of enum ena_admin_llq_num_descs_before_header and specify
675 : : * the values the device supports
676 : : */
677 : : uint16_t desc_num_before_header_supported;
678 : :
679 : : /* the desire field the driver selected to use */
680 : : uint16_t desc_num_before_header_enabled;
681 : :
682 : : /* valid only if inline was chosen. bitfield of enum
683 : : * ena_admin_llq_stride_ctrl
684 : : */
685 : : uint16_t descriptors_stride_ctrl_supported;
686 : :
687 : : /* the stride control the driver selected to use */
688 : : uint16_t descriptors_stride_ctrl_enabled;
689 : :
690 : : /* feature version of device resp to either GET/SET commands. */
691 : : uint8_t feature_version;
692 : :
693 : : /* llq entry size recommended by the device,
694 : : * values correlated to enum ena_admin_llq_ring_entry_size.
695 : : * used only for GET command.
696 : : */
697 : : uint8_t entry_size_recommended;
698 : :
699 : : /* max depth of wide llq, or 0 for N/A */
700 : : uint16_t max_wide_llq_depth;
701 : :
702 : : /* accelerated low latency queues requirement. driver needs to
703 : : * support those requirements in order to use accelerated llq
704 : : */
705 : : struct ena_admin_accel_mode_req accel_mode;
706 : : };
707 : :
708 : : struct ena_admin_queue_ext_feature_fields {
709 : : uint32_t max_tx_sq_num;
710 : :
711 : : uint32_t max_tx_cq_num;
712 : :
713 : : uint32_t max_rx_sq_num;
714 : :
715 : : uint32_t max_rx_cq_num;
716 : :
717 : : uint32_t max_tx_sq_depth;
718 : :
719 : : uint32_t max_tx_cq_depth;
720 : :
721 : : uint32_t max_rx_sq_depth;
722 : :
723 : : uint32_t max_rx_cq_depth;
724 : :
725 : : uint32_t max_tx_header_size;
726 : :
727 : : /* Maximum Descriptors number, including meta descriptor, allowed for a
728 : : * single Tx packet
729 : : */
730 : : uint16_t max_per_packet_tx_descs;
731 : :
732 : : /* Maximum Descriptors number allowed for a single Rx packet */
733 : : uint16_t max_per_packet_rx_descs;
734 : : };
735 : :
736 : : struct ena_admin_queue_feature_desc {
737 : : uint32_t max_sq_num;
738 : :
739 : : uint32_t max_sq_depth;
740 : :
741 : : uint32_t max_cq_num;
742 : :
743 : : uint32_t max_cq_depth;
744 : :
745 : : uint32_t max_legacy_llq_num;
746 : :
747 : : uint32_t max_legacy_llq_depth;
748 : :
749 : : uint32_t max_header_size;
750 : :
751 : : /* Maximum Descriptors number, including meta descriptor, allowed for a
752 : : * single Tx packet
753 : : */
754 : : uint16_t max_packet_tx_descs;
755 : :
756 : : /* Maximum Descriptors number allowed for a single Rx packet */
757 : : uint16_t max_packet_rx_descs;
758 : : };
759 : :
760 : : struct ena_admin_set_feature_mtu_desc {
761 : : /* exclude L2 */
762 : : uint32_t mtu;
763 : : };
764 : :
765 : : struct ena_admin_get_extra_properties_strings_desc {
766 : : uint32_t count;
767 : : };
768 : :
769 : : struct ena_admin_get_extra_properties_flags_desc {
770 : : uint32_t flags;
771 : : };
772 : :
773 : : struct ena_admin_set_feature_host_attr_desc {
774 : : /* host OS info base address in OS memory. host info is 4KB of
775 : : * physically contiguous
776 : : */
777 : : struct ena_common_mem_addr os_info_ba;
778 : :
779 : : /* host debug area base address in OS memory. debug area must be
780 : : * physically contiguous
781 : : */
782 : : struct ena_common_mem_addr debug_ba;
783 : :
784 : : /* debug area size */
785 : : uint32_t debug_area_size;
786 : : };
787 : :
788 : : struct ena_admin_feature_intr_moder_desc {
789 : : /* interrupt delay granularity in usec */
790 : : uint16_t intr_delay_resolution;
791 : :
792 : : uint16_t reserved;
793 : : };
794 : :
795 : : struct ena_admin_get_feature_link_desc {
796 : : /* Link speed in Mb */
797 : : uint32_t speed;
798 : :
799 : : /* bit field of enum ena_admin_link types */
800 : : uint32_t supported;
801 : :
802 : : /* 0 : autoneg
803 : : * 1 : duplex - Full Duplex
804 : : * 31:2 : reserved2
805 : : */
806 : : uint32_t flags;
807 : : };
808 : :
809 : : struct ena_admin_feature_aenq_desc {
810 : : /* bitmask for AENQ groups the device can report */
811 : : uint32_t supported_groups;
812 : :
813 : : /* bitmask for AENQ groups to report */
814 : : uint32_t enabled_groups;
815 : : };
816 : :
817 : : struct ena_admin_feature_offload_desc {
818 : : /* 0 : TX_L3_csum_ipv4
819 : : * 1 : TX_L4_ipv4_csum_part - The checksum field
820 : : * should be initialized with pseudo header checksum
821 : : * 2 : TX_L4_ipv4_csum_full
822 : : * 3 : TX_L4_ipv6_csum_part - The checksum field
823 : : * should be initialized with pseudo header checksum
824 : : * 4 : TX_L4_ipv6_csum_full
825 : : * 5 : tso_ipv4
826 : : * 6 : tso_ipv6
827 : : * 7 : tso_ecn
828 : : */
829 : : uint32_t tx;
830 : :
831 : : /* Receive side supported stateless offload
832 : : * 0 : RX_L3_csum_ipv4 - IPv4 checksum
833 : : * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
834 : : * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
835 : : * 3 : RX_hash - Hash calculation
836 : : */
837 : : uint32_t rx_supported;
838 : :
839 : : uint32_t rx_enabled;
840 : : };
841 : :
842 : : enum ena_admin_hash_functions {
843 : : ENA_ADMIN_TOEPLITZ = 1,
844 : : ENA_ADMIN_CRC32 = 2,
845 : : };
846 : :
847 : : struct ena_admin_feature_rss_flow_hash_control {
848 : : uint32_t key_parts;
849 : :
850 : : uint32_t reserved;
851 : :
852 : : uint32_t key[ENA_ADMIN_RSS_KEY_PARTS];
853 : : };
854 : :
855 : : struct ena_admin_feature_rss_flow_hash_function {
856 : : /* 7:0 : funcs - bitmask of ena_admin_hash_functions */
857 : : uint32_t supported_func;
858 : :
859 : : /* 7:0 : selected_func - bitmask of
860 : : * ena_admin_hash_functions
861 : : */
862 : : uint32_t selected_func;
863 : :
864 : : /* initial value */
865 : : uint32_t init_val;
866 : : };
867 : :
868 : : /* RSS flow hash protocols */
869 : : enum ena_admin_flow_hash_proto {
870 : : ENA_ADMIN_RSS_TCP4 = 0,
871 : : ENA_ADMIN_RSS_UDP4 = 1,
872 : : ENA_ADMIN_RSS_TCP6 = 2,
873 : : ENA_ADMIN_RSS_UDP6 = 3,
874 : : ENA_ADMIN_RSS_IP4 = 4,
875 : : ENA_ADMIN_RSS_IP6 = 5,
876 : : ENA_ADMIN_RSS_IP4_FRAG = 6,
877 : : ENA_ADMIN_RSS_NOT_IP = 7,
878 : : /* TCPv6 with extension header */
879 : : ENA_ADMIN_RSS_TCP6_EX = 8,
880 : : /* IPv6 with extension header */
881 : : ENA_ADMIN_RSS_IP6_EX = 9,
882 : : ENA_ADMIN_RSS_PROTO_NUM = 16,
883 : : };
884 : :
885 : : /* RSS flow hash fields */
886 : : enum ena_admin_flow_hash_fields {
887 : : /* Ethernet Dest Addr */
888 : : ENA_ADMIN_RSS_L2_DA = BIT(0),
889 : : /* Ethernet Src Addr */
890 : : ENA_ADMIN_RSS_L2_SA = BIT(1),
891 : : /* ipv4/6 Dest Addr */
892 : : ENA_ADMIN_RSS_L3_DA = BIT(2),
893 : : /* ipv4/6 Src Addr */
894 : : ENA_ADMIN_RSS_L3_SA = BIT(3),
895 : : /* tcp/udp Dest Port */
896 : : ENA_ADMIN_RSS_L4_DP = BIT(4),
897 : : /* tcp/udp Src Port */
898 : : ENA_ADMIN_RSS_L4_SP = BIT(5),
899 : : };
900 : :
901 : : struct ena_admin_proto_input {
902 : : /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
903 : : uint16_t fields;
904 : :
905 : : uint16_t reserved2;
906 : : };
907 : :
908 : : struct ena_admin_feature_rss_hash_control {
909 : : struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
910 : :
911 : : struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
912 : :
913 : : struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
914 : :
915 : : struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
916 : : };
917 : :
918 : : struct ena_admin_feature_rss_flow_hash_input {
919 : : /* supported hash input sorting
920 : : * 1 : L3_sort - support swap L3 addresses if DA is
921 : : * smaller than SA
922 : : * 2 : L4_sort - support swap L4 ports if DP smaller
923 : : * SP
924 : : */
925 : : uint16_t supported_input_sort;
926 : :
927 : : /* enabled hash input sorting
928 : : * 1 : enable_L3_sort - enable swap L3 addresses if
929 : : * DA smaller than SA
930 : : * 2 : enable_L4_sort - enable swap L4 ports if DP
931 : : * smaller than SP
932 : : */
933 : : uint16_t enabled_input_sort;
934 : : };
935 : :
936 : : struct ena_admin_host_info {
937 : : /* Host OS type defined as ENA_ADMIN_OS_* */
938 : : uint32_t os_type;
939 : :
940 : : /* os distribution string format */
941 : : uint8_t os_dist_str[128];
942 : :
943 : : /* OS distribution numeric format */
944 : : uint32_t os_dist;
945 : :
946 : : /* kernel version string format */
947 : : uint8_t kernel_ver_str[32];
948 : :
949 : : /* Kernel version numeric format */
950 : : uint32_t kernel_ver;
951 : :
952 : : /* 7:0 : major
953 : : * 15:8 : minor
954 : : * 23:16 : sub_minor
955 : : * 31:24 : module_type
956 : : */
957 : : uint32_t driver_version;
958 : :
959 : : /* features bitmap */
960 : : uint32_t supported_network_features[2];
961 : :
962 : : /* ENA spec version of driver */
963 : : uint16_t ena_spec_version;
964 : :
965 : : /* ENA device's Bus, Device and Function
966 : : * 2:0 : function
967 : : * 7:3 : device
968 : : * 15:8 : bus
969 : : */
970 : : uint16_t bdf;
971 : :
972 : : /* Number of CPUs */
973 : : uint16_t num_cpus;
974 : :
975 : : uint16_t reserved;
976 : :
977 : : /* 0 : reserved
978 : : * 1 : rx_offset
979 : : * 2 : interrupt_moderation
980 : : * 3 : rx_buf_mirroring
981 : : * 4 : rss_configurable_function_key
982 : : * 5 : reserved
983 : : * 6 : rx_page_reuse
984 : : * 7 : tx_ipv6_csum_offload
985 : : * 8 : phc
986 : : * 31:9 : reserved
987 : : */
988 : : uint32_t driver_supported_features;
989 : : };
990 : :
991 : : struct ena_admin_rss_ind_table_entry {
992 : : uint16_t cq_idx;
993 : :
994 : : uint16_t reserved;
995 : : };
996 : :
997 : : struct ena_admin_feature_rss_ind_table {
998 : : /* min supported table size (2^min_size) */
999 : : uint16_t min_size;
1000 : :
1001 : : /* max supported table size (2^max_size) */
1002 : : uint16_t max_size;
1003 : :
1004 : : /* table size (2^size) */
1005 : : uint16_t size;
1006 : :
1007 : : /* 0 : one_entry_update - The ENA device supports
1008 : : * setting a single RSS table entry
1009 : : */
1010 : : uint8_t flags;
1011 : :
1012 : : uint8_t reserved;
1013 : :
1014 : : /* index of the inline entry. 0xFFFFFFFF means invalid */
1015 : : uint32_t inline_index;
1016 : :
1017 : : /* used for updating single entry, ignored when setting the entire
1018 : : * table through the control buffer.
1019 : : */
1020 : : struct ena_admin_rss_ind_table_entry inline_entry;
1021 : : };
1022 : :
1023 : : /* When hint value is 0, driver should use it's own predefined value */
1024 : : struct ena_admin_ena_hw_hints {
1025 : : /* value in ms */
1026 : : uint16_t mmio_read_timeout;
1027 : :
1028 : : /* value in ms */
1029 : : uint16_t driver_watchdog_timeout;
1030 : :
1031 : : /* Per packet tx completion timeout. value in ms */
1032 : : uint16_t missing_tx_completion_timeout;
1033 : :
1034 : : uint16_t missed_tx_completion_count_threshold_to_reset;
1035 : :
1036 : : /* value in ms */
1037 : : uint16_t admin_completion_tx_timeout;
1038 : :
1039 : : uint16_t netdev_wd_timeout;
1040 : :
1041 : : uint16_t max_tx_sgl_size;
1042 : :
1043 : : uint16_t max_rx_sgl_size;
1044 : :
1045 : : uint16_t reserved[8];
1046 : : };
1047 : :
1048 : : struct ena_admin_get_feat_cmd {
1049 : : struct ena_admin_aq_common_desc aq_common_descriptor;
1050 : :
1051 : : struct ena_admin_ctrl_buff_info control_buffer;
1052 : :
1053 : : struct ena_admin_get_set_feature_common_desc feat_common;
1054 : :
1055 : : uint32_t raw[11];
1056 : : };
1057 : :
1058 : : struct ena_admin_queue_ext_feature_desc {
1059 : : /* version */
1060 : : uint8_t version;
1061 : :
1062 : : uint8_t reserved1[3];
1063 : :
1064 : : union {
1065 : : struct ena_admin_queue_ext_feature_fields max_queue_ext;
1066 : :
1067 : : uint32_t raw[10];
1068 : : };
1069 : : };
1070 : :
1071 : : struct ena_admin_feature_phc_desc {
1072 : : /* PHC version as defined in enum ena_admin_phc_feature_version,
1073 : : * used only for GET command as max supported PHC version by the device.
1074 : : */
1075 : : uint8_t version;
1076 : :
1077 : : /* Reserved - MBZ */
1078 : : uint8_t reserved1[3];
1079 : :
1080 : : /* PHC doorbell address as an offset to PCIe MMIO REG BAR,
1081 : : * used only for GET command.
1082 : : */
1083 : : uint32_t doorbell_offset;
1084 : :
1085 : : /* Max time for valid PHC retrieval, passing this threshold will
1086 : : * fail the get-time request and block PHC requests for
1087 : : * block_timeout_usec, used only for GET command.
1088 : : */
1089 : : uint32_t expire_timeout_usec;
1090 : :
1091 : : /* PHC requests block period, blocking starts if PHC request expired
1092 : : * in order to prevent floods on busy device,
1093 : : * used only for GET command.
1094 : : */
1095 : : uint32_t block_timeout_usec;
1096 : :
1097 : : /* Shared PHC physical address (ena_admin_phc_resp),
1098 : : * used only for SET command.
1099 : : */
1100 : : struct ena_common_mem_addr output_address;
1101 : :
1102 : : /* Shared PHC Size (ena_admin_phc_resp),
1103 : : * used only for SET command.
1104 : : */
1105 : : uint32_t output_length;
1106 : : };
1107 : :
1108 : : struct ena_admin_get_feat_resp {
1109 : : struct ena_admin_acq_common_desc acq_common_desc;
1110 : :
1111 : : union {
1112 : : uint32_t raw[14];
1113 : :
1114 : : struct ena_admin_device_attr_feature_desc dev_attr;
1115 : :
1116 : : struct ena_admin_feature_llq_desc llq;
1117 : :
1118 : : struct ena_admin_queue_feature_desc max_queue;
1119 : :
1120 : : struct ena_admin_queue_ext_feature_desc max_queue_ext;
1121 : :
1122 : : struct ena_admin_feature_aenq_desc aenq;
1123 : :
1124 : : struct ena_admin_get_feature_link_desc link;
1125 : :
1126 : : struct ena_admin_feature_offload_desc offload;
1127 : :
1128 : : struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
1129 : :
1130 : : struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
1131 : :
1132 : : struct ena_admin_feature_rss_ind_table ind_table;
1133 : :
1134 : : struct ena_admin_feature_intr_moder_desc intr_moderation;
1135 : :
1136 : : struct ena_admin_ena_hw_hints hw_hints;
1137 : :
1138 : : struct ena_admin_feature_phc_desc phc;
1139 : :
1140 : : struct ena_admin_get_extra_properties_strings_desc extra_properties_strings;
1141 : :
1142 : : struct ena_admin_get_extra_properties_flags_desc extra_properties_flags;
1143 : : } u;
1144 : : };
1145 : :
1146 : : struct ena_admin_set_feat_cmd {
1147 : : struct ena_admin_aq_common_desc aq_common_descriptor;
1148 : :
1149 : : struct ena_admin_ctrl_buff_info control_buffer;
1150 : :
1151 : : struct ena_admin_get_set_feature_common_desc feat_common;
1152 : :
1153 : : union {
1154 : : uint32_t raw[11];
1155 : :
1156 : : /* mtu size */
1157 : : struct ena_admin_set_feature_mtu_desc mtu;
1158 : :
1159 : : /* host attributes */
1160 : : struct ena_admin_set_feature_host_attr_desc host_attr;
1161 : :
1162 : : /* AENQ configuration */
1163 : : struct ena_admin_feature_aenq_desc aenq;
1164 : :
1165 : : /* rss flow hash function */
1166 : : struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
1167 : :
1168 : : /* rss flow hash input */
1169 : : struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
1170 : :
1171 : : /* rss indirection table */
1172 : : struct ena_admin_feature_rss_ind_table ind_table;
1173 : :
1174 : : /* LLQ configuration */
1175 : : struct ena_admin_feature_llq_desc llq;
1176 : :
1177 : : /* PHC configuration */
1178 : : struct ena_admin_feature_phc_desc phc;
1179 : : } u;
1180 : : };
1181 : :
1182 : : struct ena_admin_set_feat_resp {
1183 : : struct ena_admin_acq_common_desc acq_common_desc;
1184 : :
1185 : : union {
1186 : : uint32_t raw[14];
1187 : : } u;
1188 : : };
1189 : :
1190 : : struct ena_admin_aenq_common_desc {
1191 : : uint16_t group;
1192 : :
1193 : : uint16_t syndrome;
1194 : :
1195 : : /* 0 : phase
1196 : : * 7:1 : reserved - MBZ
1197 : : */
1198 : : uint8_t flags;
1199 : :
1200 : : uint8_t reserved1[3];
1201 : :
1202 : : uint32_t timestamp_low;
1203 : :
1204 : : uint32_t timestamp_high;
1205 : : };
1206 : :
1207 : : /* asynchronous event notification groups */
1208 : : enum ena_admin_aenq_group {
1209 : : ENA_ADMIN_LINK_CHANGE = 0,
1210 : : ENA_ADMIN_FATAL_ERROR = 1,
1211 : : ENA_ADMIN_WARNING = 2,
1212 : : ENA_ADMIN_NOTIFICATION = 3,
1213 : : ENA_ADMIN_KEEP_ALIVE = 4,
1214 : : ENA_ADMIN_REFRESH_CAPABILITIES = 5,
1215 : : ENA_ADMIN_CONF_NOTIFICATIONS = 6,
1216 : : ENA_ADMIN_DEVICE_REQUEST_RESET = 7,
1217 : : ENA_ADMIN_AENQ_GROUPS_NUM = 8,
1218 : : };
1219 : :
1220 : : enum ena_admin_aenq_notification_syndrome {
1221 : : ENA_ADMIN_UPDATE_HINTS = 2,
1222 : : };
1223 : :
1224 : : struct ena_admin_aenq_entry {
1225 : : struct ena_admin_aenq_common_desc aenq_common_desc;
1226 : :
1227 : : /* command specific inline data */
1228 : : uint32_t inline_data_w4[12];
1229 : : };
1230 : :
1231 : : struct ena_admin_aenq_link_change_desc {
1232 : : struct ena_admin_aenq_common_desc aenq_common_desc;
1233 : :
1234 : : /* 0 : link_status */
1235 : : uint32_t flags;
1236 : : };
1237 : :
1238 : : struct ena_admin_aenq_keep_alive_desc {
1239 : : struct ena_admin_aenq_common_desc aenq_common_desc;
1240 : :
1241 : : uint32_t rx_drops_low;
1242 : :
1243 : : uint32_t rx_drops_high;
1244 : :
1245 : : uint32_t tx_drops_low;
1246 : :
1247 : : uint32_t tx_drops_high;
1248 : :
1249 : : uint32_t rx_overruns_low;
1250 : :
1251 : : uint32_t rx_overruns_high;
1252 : : };
1253 : :
1254 : : struct ena_admin_aenq_conf_notifications_desc {
1255 : : struct ena_admin_aenq_common_desc aenq_common_desc;
1256 : :
1257 : : uint64_t notifications_bitmap;
1258 : :
1259 : : uint64_t reserved;
1260 : : };
1261 : :
1262 : : struct ena_admin_ena_mmio_req_read_less_resp {
1263 : : uint16_t req_id;
1264 : :
1265 : : uint16_t reg_off;
1266 : :
1267 : : /* value is valid when poll is cleared */
1268 : : uint32_t reg_val;
1269 : : };
1270 : :
1271 : : struct ena_admin_phc_resp {
1272 : : /* Request Id, received from DB register */
1273 : : uint16_t req_id;
1274 : :
1275 : : uint8_t reserved1[6];
1276 : :
1277 : : /* PHC timestamp (nsec) */
1278 : : uint64_t timestamp;
1279 : :
1280 : : uint8_t reserved2[8];
1281 : :
1282 : : /* Timestamp error limit (nsec) */
1283 : : uint32_t error_bound;
1284 : :
1285 : : /* Bit field of enum ena_admin_phc_error_flags */
1286 : : uint32_t error_flags;
1287 : :
1288 : : uint8_t reserved3[32];
1289 : : };
1290 : :
1291 : : /* aq_common_desc */
1292 : : #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1293 : : #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK BIT(0)
1294 : : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT 1
1295 : : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK BIT(1)
1296 : : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT 2
1297 : : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK BIT(2)
1298 : :
1299 : : /* sq */
1300 : : #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT 5
1301 : : #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK GENMASK(7, 5)
1302 : :
1303 : : /* acq_common_desc */
1304 : : #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1305 : : #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK BIT(0)
1306 : :
1307 : : /* aq_create_sq_cmd */
1308 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT 5
1309 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK GENMASK(7, 5)
1310 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK GENMASK(3, 0)
1311 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT 4
1312 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK GENMASK(6, 4)
1313 : : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
1314 : :
1315 : : /* aq_create_cq_cmd */
1316 : : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
1317 : : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
1318 : : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
1319 : :
1320 : : /* get_set_feature_common_desc */
1321 : : #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK GENMASK(1, 0)
1322 : :
1323 : : /* get_feature_link_desc */
1324 : : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK BIT(0)
1325 : : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT 1
1326 : : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK BIT(1)
1327 : :
1328 : : /* feature_offload_desc */
1329 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
1330 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
1331 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
1332 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
1333 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
1334 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
1335 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
1336 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
1337 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
1338 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT 5
1339 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK BIT(5)
1340 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT 6
1341 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK BIT(6)
1342 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT 7
1343 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK BIT(7)
1344 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
1345 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
1346 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
1347 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
1348 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
1349 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT 3
1350 : : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK BIT(3)
1351 : :
1352 : : /* feature_rss_flow_hash_function */
1353 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
1354 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK GENMASK(7, 0)
1355 : :
1356 : : /* feature_rss_flow_hash_input */
1357 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
1358 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK BIT(1)
1359 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
1360 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK BIT(2)
1361 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
1362 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
1363 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
1364 : : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
1365 : :
1366 : : /* host_info */
1367 : : #define ENA_ADMIN_HOST_INFO_MAJOR_MASK GENMASK(7, 0)
1368 : : #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT 8
1369 : : #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
1370 : : #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
1371 : : #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
1372 : : #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT 24
1373 : : #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK GENMASK(31, 24)
1374 : : #define ENA_ADMIN_HOST_INFO_FUNCTION_MASK GENMASK(2, 0)
1375 : : #define ENA_ADMIN_HOST_INFO_DEVICE_SHIFT 3
1376 : : #define ENA_ADMIN_HOST_INFO_DEVICE_MASK GENMASK(7, 3)
1377 : : #define ENA_ADMIN_HOST_INFO_BUS_SHIFT 8
1378 : : #define ENA_ADMIN_HOST_INFO_BUS_MASK GENMASK(15, 8)
1379 : : #define ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT 1
1380 : : #define ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK BIT(1)
1381 : : #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT 2
1382 : : #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK BIT(2)
1383 : : #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT 3
1384 : : #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK BIT(3)
1385 : : #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT 4
1386 : : #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK BIT(4)
1387 : : #define ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT 6
1388 : : #define ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK BIT(6)
1389 : : #define ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_SHIFT 7
1390 : : #define ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_MASK BIT(7)
1391 : : #define ENA_ADMIN_HOST_INFO_PHC_SHIFT 8
1392 : : #define ENA_ADMIN_HOST_INFO_PHC_MASK BIT(8)
1393 : :
1394 : : /* feature_rss_ind_table */
1395 : : #define ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK BIT(0)
1396 : :
1397 : : /* aenq_common_desc */
1398 : : #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
1399 : :
1400 : : /* aenq_link_change_desc */
1401 : : #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK BIT(0)
1402 : :
1403 : : #if !defined(DEFS_LINUX_MAINLINE)
1404 : : static inline uint16_t get_ena_admin_aq_common_desc_command_id(const struct ena_admin_aq_common_desc *p)
1405 : : {
1406 : : return p->command_id & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
1407 : : }
1408 : :
1409 : : static inline void set_ena_admin_aq_common_desc_command_id(struct ena_admin_aq_common_desc *p, uint16_t val)
1410 : : {
1411 : : p->command_id |= val & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
1412 : : }
1413 : :
1414 : : static inline uint8_t get_ena_admin_aq_common_desc_phase(const struct ena_admin_aq_common_desc *p)
1415 : : {
1416 : : return p->flags & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
1417 : : }
1418 : :
1419 : : static inline void set_ena_admin_aq_common_desc_phase(struct ena_admin_aq_common_desc *p, uint8_t val)
1420 : : {
1421 : : p->flags |= val & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
1422 : : }
1423 : :
1424 : : static inline uint8_t get_ena_admin_aq_common_desc_ctrl_data(const struct ena_admin_aq_common_desc *p)
1425 : : {
1426 : : return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK) >> ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT;
1427 : : }
1428 : :
1429 : : static inline void set_ena_admin_aq_common_desc_ctrl_data(struct ena_admin_aq_common_desc *p, uint8_t val)
1430 : : {
1431 : : p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT) & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK;
1432 : : }
1433 : :
1434 : : static inline uint8_t get_ena_admin_aq_common_desc_ctrl_data_indirect(const struct ena_admin_aq_common_desc *p)
1435 : : {
1436 : : return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK) >> ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT;
1437 : : }
1438 : :
1439 : : static inline void set_ena_admin_aq_common_desc_ctrl_data_indirect(struct ena_admin_aq_common_desc *p, uint8_t val)
1440 : : {
1441 : : p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT) & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK;
1442 : : }
1443 : :
1444 : : static inline uint8_t get_ena_admin_sq_sq_direction(const struct ena_admin_sq *p)
1445 : : {
1446 : : return (p->sq_identity & ENA_ADMIN_SQ_SQ_DIRECTION_MASK) >> ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT;
1447 : : }
1448 : :
1449 : : static inline void set_ena_admin_sq_sq_direction(struct ena_admin_sq *p, uint8_t val)
1450 : : {
1451 : : p->sq_identity |= (val << ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT) & ENA_ADMIN_SQ_SQ_DIRECTION_MASK;
1452 : : }
1453 : :
1454 : : static inline uint16_t get_ena_admin_acq_common_desc_command_id(const struct ena_admin_acq_common_desc *p)
1455 : : {
1456 : : return p->command & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
1457 : : }
1458 : :
1459 : : static inline void set_ena_admin_acq_common_desc_command_id(struct ena_admin_acq_common_desc *p, uint16_t val)
1460 : : {
1461 : : p->command |= val & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
1462 : : }
1463 : :
1464 : : static inline uint8_t get_ena_admin_acq_common_desc_phase(const struct ena_admin_acq_common_desc *p)
1465 : : {
1466 : : return p->flags & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
1467 : : }
1468 : :
1469 : : static inline void set_ena_admin_acq_common_desc_phase(struct ena_admin_acq_common_desc *p, uint8_t val)
1470 : : {
1471 : : p->flags |= val & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
1472 : : }
1473 : :
1474 : : static inline uint8_t get_ena_admin_aq_create_sq_cmd_sq_direction(const struct ena_admin_aq_create_sq_cmd *p)
1475 : : {
1476 : : return (p->sq_identity & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK) >> ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT;
1477 : : }
1478 : :
1479 : : static inline void set_ena_admin_aq_create_sq_cmd_sq_direction(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
1480 : : {
1481 : : p->sq_identity |= (val << ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT) & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK;
1482 : : }
1483 : :
1484 : : static inline uint8_t get_ena_admin_aq_create_sq_cmd_placement_policy(const struct ena_admin_aq_create_sq_cmd *p)
1485 : : {
1486 : : return p->sq_caps_2 & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
1487 : : }
1488 : :
1489 : : static inline void set_ena_admin_aq_create_sq_cmd_placement_policy(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
1490 : : {
1491 : : p->sq_caps_2 |= val & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
1492 : : }
1493 : :
1494 : : static inline uint8_t get_ena_admin_aq_create_sq_cmd_completion_policy(const struct ena_admin_aq_create_sq_cmd *p)
1495 : : {
1496 : : return (p->sq_caps_2 & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK) >> ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT;
1497 : : }
1498 : :
1499 : : static inline void set_ena_admin_aq_create_sq_cmd_completion_policy(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
1500 : : {
1501 : : p->sq_caps_2 |= (val << ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT) & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK;
1502 : : }
1503 : :
1504 : : static inline uint8_t get_ena_admin_aq_create_sq_cmd_is_physically_contiguous(const struct ena_admin_aq_create_sq_cmd *p)
1505 : : {
1506 : : return p->sq_caps_3 & ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
1507 : : }
1508 : :
1509 : : static inline void set_ena_admin_aq_create_sq_cmd_is_physically_contiguous(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
1510 : : {
1511 : : p->sq_caps_3 |= val & ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
1512 : : }
1513 : :
1514 : : static inline uint8_t get_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(const struct ena_admin_aq_create_cq_cmd *p)
1515 : : {
1516 : : return (p->cq_caps_1 & ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK) >> ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT;
1517 : : }
1518 : :
1519 : : static inline void set_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(struct ena_admin_aq_create_cq_cmd *p, uint8_t val)
1520 : : {
1521 : : p->cq_caps_1 |= (val << ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT) & ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK;
1522 : : }
1523 : :
1524 : : static inline uint8_t get_ena_admin_aq_create_cq_cmd_cq_entry_size_words(const struct ena_admin_aq_create_cq_cmd *p)
1525 : : {
1526 : : return p->cq_caps_2 & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
1527 : : }
1528 : :
1529 : : static inline void set_ena_admin_aq_create_cq_cmd_cq_entry_size_words(struct ena_admin_aq_create_cq_cmd *p, uint8_t val)
1530 : : {
1531 : : p->cq_caps_2 |= val & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
1532 : : }
1533 : :
1534 : : static inline uint8_t get_ena_admin_get_set_feature_common_desc_select(const struct ena_admin_get_set_feature_common_desc *p)
1535 : : {
1536 : : return p->flags & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
1537 : : }
1538 : :
1539 : : static inline void set_ena_admin_get_set_feature_common_desc_select(struct ena_admin_get_set_feature_common_desc *p, uint8_t val)
1540 : : {
1541 : : p->flags |= val & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
1542 : : }
1543 : :
1544 : : static inline uint32_t get_ena_admin_get_feature_link_desc_autoneg(const struct ena_admin_get_feature_link_desc *p)
1545 : : {
1546 : : return p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
1547 : : }
1548 : :
1549 : : static inline void set_ena_admin_get_feature_link_desc_autoneg(struct ena_admin_get_feature_link_desc *p, uint32_t val)
1550 : : {
1551 : : p->flags |= val & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
1552 : : }
1553 : :
1554 : : static inline uint32_t get_ena_admin_get_feature_link_desc_duplex(const struct ena_admin_get_feature_link_desc *p)
1555 : : {
1556 : : return (p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK) >> ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT;
1557 : : }
1558 : :
1559 : : static inline void set_ena_admin_get_feature_link_desc_duplex(struct ena_admin_get_feature_link_desc *p, uint32_t val)
1560 : : {
1561 : : p->flags |= (val << ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT) & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK;
1562 : : }
1563 : :
1564 : : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(const struct ena_admin_feature_offload_desc *p)
1565 : : {
1566 : : return p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
1567 : : }
1568 : :
1569 : : static inline void set_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
1570 : : {
1571 : : p->tx |= val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
1572 : : }
1573 : :
1574 : : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(const struct ena_admin_feature_offload_desc *p)
1575 : : {
1576 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT;
1577 : : }
1578 : :
1579 : : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(struct ena_admin_feature_offload_desc *p, uint32_t val)
1580 : : {
1581 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK;
1582 : : }
1583 : :
1584 : : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(const struct ena_admin_feature_offload_desc *p)
1585 : : {
1586 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT;
1587 : : }
1588 : :
1589 : : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(struct ena_admin_feature_offload_desc *p, uint32_t val)
1590 : : {
1591 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK;
1592 : : }
1593 : :
1594 : : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(const struct ena_admin_feature_offload_desc *p)
1595 : : {
1596 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT;
1597 : : }
1598 : :
1599 : : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(struct ena_admin_feature_offload_desc *p, uint32_t val)
1600 : : {
1601 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK;
1602 : : }
1603 : :
1604 : : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(const struct ena_admin_feature_offload_desc *p)
1605 : : {
1606 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT;
1607 : : }
1608 : :
1609 : : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(struct ena_admin_feature_offload_desc *p, uint32_t val)
1610 : : {
1611 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK;
1612 : : }
1613 : :
1614 : : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ipv4(const struct ena_admin_feature_offload_desc *p)
1615 : : {
1616 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT;
1617 : : }
1618 : :
1619 : : static inline void set_ena_admin_feature_offload_desc_tso_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
1620 : : {
1621 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK;
1622 : : }
1623 : :
1624 : : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ipv6(const struct ena_admin_feature_offload_desc *p)
1625 : : {
1626 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT;
1627 : : }
1628 : :
1629 : : static inline void set_ena_admin_feature_offload_desc_tso_ipv6(struct ena_admin_feature_offload_desc *p, uint32_t val)
1630 : : {
1631 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK;
1632 : : }
1633 : :
1634 : : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ecn(const struct ena_admin_feature_offload_desc *p)
1635 : : {
1636 : : return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT;
1637 : : }
1638 : :
1639 : : static inline void set_ena_admin_feature_offload_desc_tso_ecn(struct ena_admin_feature_offload_desc *p, uint32_t val)
1640 : : {
1641 : : p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK;
1642 : : }
1643 : :
1644 : : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(const struct ena_admin_feature_offload_desc *p)
1645 : : {
1646 : : return p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
1647 : : }
1648 : :
1649 : : static inline void set_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
1650 : : {
1651 : : p->rx_supported |= val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
1652 : : }
1653 : :
1654 : : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(const struct ena_admin_feature_offload_desc *p)
1655 : : {
1656 : : return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT;
1657 : : }
1658 : :
1659 : : static inline void set_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(struct ena_admin_feature_offload_desc *p, uint32_t val)
1660 : : {
1661 : : p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK;
1662 : : }
1663 : :
1664 : : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(const struct ena_admin_feature_offload_desc *p)
1665 : : {
1666 : : return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT;
1667 : : }
1668 : :
1669 : : static inline void set_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(struct ena_admin_feature_offload_desc *p, uint32_t val)
1670 : : {
1671 : : p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK;
1672 : : }
1673 : :
1674 : : static inline uint32_t get_ena_admin_feature_offload_desc_RX_hash(const struct ena_admin_feature_offload_desc *p)
1675 : : {
1676 : : return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT;
1677 : : }
1678 : :
1679 : : static inline void set_ena_admin_feature_offload_desc_RX_hash(struct ena_admin_feature_offload_desc *p, uint32_t val)
1680 : : {
1681 : : p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK;
1682 : : }
1683 : :
1684 : : static inline uint32_t get_ena_admin_feature_rss_flow_hash_function_funcs(const struct ena_admin_feature_rss_flow_hash_function *p)
1685 : : {
1686 : : return p->supported_func & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
1687 : : }
1688 : :
1689 : : static inline void set_ena_admin_feature_rss_flow_hash_function_funcs(struct ena_admin_feature_rss_flow_hash_function *p, uint32_t val)
1690 : : {
1691 : : p->supported_func |= val & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
1692 : : }
1693 : :
1694 : : static inline uint32_t get_ena_admin_feature_rss_flow_hash_function_selected_func(const struct ena_admin_feature_rss_flow_hash_function *p)
1695 : : {
1696 : : return p->selected_func & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
1697 : : }
1698 : :
1699 : : static inline void set_ena_admin_feature_rss_flow_hash_function_selected_func(struct ena_admin_feature_rss_flow_hash_function *p, uint32_t val)
1700 : : {
1701 : : p->selected_func |= val & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
1702 : : }
1703 : :
1704 : : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_L3_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
1705 : : {
1706 : : return (p->supported_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT;
1707 : : }
1708 : :
1709 : : static inline void set_ena_admin_feature_rss_flow_hash_input_L3_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
1710 : : {
1711 : : p->supported_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK;
1712 : : }
1713 : :
1714 : : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_L4_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
1715 : : {
1716 : : return (p->supported_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT;
1717 : : }
1718 : :
1719 : : static inline void set_ena_admin_feature_rss_flow_hash_input_L4_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
1720 : : {
1721 : : p->supported_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK;
1722 : : }
1723 : :
1724 : : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
1725 : : {
1726 : : return (p->enabled_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT;
1727 : : }
1728 : :
1729 : : static inline void set_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
1730 : : {
1731 : : p->enabled_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK;
1732 : : }
1733 : :
1734 : : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
1735 : : {
1736 : : return (p->enabled_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT;
1737 : : }
1738 : :
1739 : : static inline void set_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
1740 : : {
1741 : : p->enabled_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK;
1742 : : }
1743 : :
1744 : : static inline uint32_t get_ena_admin_host_info_major(const struct ena_admin_host_info *p)
1745 : : {
1746 : : return p->driver_version & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
1747 : : }
1748 : :
1749 : : static inline void set_ena_admin_host_info_major(struct ena_admin_host_info *p, uint32_t val)
1750 : : {
1751 : : p->driver_version |= val & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
1752 : : }
1753 : :
1754 : : static inline uint32_t get_ena_admin_host_info_minor(const struct ena_admin_host_info *p)
1755 : : {
1756 : : return (p->driver_version & ENA_ADMIN_HOST_INFO_MINOR_MASK) >> ENA_ADMIN_HOST_INFO_MINOR_SHIFT;
1757 : : }
1758 : :
1759 : : static inline void set_ena_admin_host_info_minor(struct ena_admin_host_info *p, uint32_t val)
1760 : : {
1761 : : p->driver_version |= (val << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) & ENA_ADMIN_HOST_INFO_MINOR_MASK;
1762 : : }
1763 : :
1764 : : static inline uint32_t get_ena_admin_host_info_sub_minor(const struct ena_admin_host_info *p)
1765 : : {
1766 : : return (p->driver_version & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK) >> ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT;
1767 : : }
1768 : :
1769 : : static inline void set_ena_admin_host_info_sub_minor(struct ena_admin_host_info *p, uint32_t val)
1770 : : {
1771 : : p->driver_version |= (val << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT) & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK;
1772 : : }
1773 : :
1774 : : static inline uint32_t get_ena_admin_host_info_module_type(const struct ena_admin_host_info *p)
1775 : : {
1776 : : return (p->driver_version & ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK) >> ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT;
1777 : : }
1778 : :
1779 : : static inline void set_ena_admin_host_info_module_type(struct ena_admin_host_info *p, uint32_t val)
1780 : : {
1781 : : p->driver_version |= (val << ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT) & ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK;
1782 : : }
1783 : :
1784 : : static inline uint16_t get_ena_admin_host_info_function(const struct ena_admin_host_info *p)
1785 : : {
1786 : : return p->bdf & ENA_ADMIN_HOST_INFO_FUNCTION_MASK;
1787 : : }
1788 : :
1789 : : static inline void set_ena_admin_host_info_function(struct ena_admin_host_info *p, uint16_t val)
1790 : : {
1791 : : p->bdf |= val & ENA_ADMIN_HOST_INFO_FUNCTION_MASK;
1792 : : }
1793 : :
1794 : : static inline uint16_t get_ena_admin_host_info_device(const struct ena_admin_host_info *p)
1795 : : {
1796 : : return (p->bdf & ENA_ADMIN_HOST_INFO_DEVICE_MASK) >> ENA_ADMIN_HOST_INFO_DEVICE_SHIFT;
1797 : : }
1798 : :
1799 : : static inline void set_ena_admin_host_info_device(struct ena_admin_host_info *p, uint16_t val)
1800 : : {
1801 : : p->bdf |= (val << ENA_ADMIN_HOST_INFO_DEVICE_SHIFT) & ENA_ADMIN_HOST_INFO_DEVICE_MASK;
1802 : : }
1803 : :
1804 : : static inline uint16_t get_ena_admin_host_info_bus(const struct ena_admin_host_info *p)
1805 : : {
1806 : : return (p->bdf & ENA_ADMIN_HOST_INFO_BUS_MASK) >> ENA_ADMIN_HOST_INFO_BUS_SHIFT;
1807 : : }
1808 : :
1809 : : static inline void set_ena_admin_host_info_bus(struct ena_admin_host_info *p, uint16_t val)
1810 : : {
1811 : : p->bdf |= (val << ENA_ADMIN_HOST_INFO_BUS_SHIFT) & ENA_ADMIN_HOST_INFO_BUS_MASK;
1812 : : }
1813 : :
1814 : : static inline uint32_t get_ena_admin_host_info_rx_offset(const struct ena_admin_host_info *p)
1815 : : {
1816 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK) >> ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT;
1817 : : }
1818 : :
1819 : : static inline void set_ena_admin_host_info_rx_offset(struct ena_admin_host_info *p, uint32_t val)
1820 : : {
1821 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT) & ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK;
1822 : : }
1823 : :
1824 : : static inline uint32_t get_ena_admin_host_info_interrupt_moderation(const struct ena_admin_host_info *p)
1825 : : {
1826 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK) >> ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT;
1827 : : }
1828 : :
1829 : : static inline void set_ena_admin_host_info_interrupt_moderation(struct ena_admin_host_info *p, uint32_t val)
1830 : : {
1831 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT) & ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK;
1832 : : }
1833 : :
1834 : : static inline uint32_t get_ena_admin_host_info_rx_buf_mirroring(const struct ena_admin_host_info *p)
1835 : : {
1836 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK) >> ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT;
1837 : : }
1838 : :
1839 : : static inline void set_ena_admin_host_info_rx_buf_mirroring(struct ena_admin_host_info *p, uint32_t val)
1840 : : {
1841 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT) & ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK;
1842 : : }
1843 : :
1844 : : static inline uint32_t get_ena_admin_host_info_rss_configurable_function_key(const struct ena_admin_host_info *p)
1845 : : {
1846 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK) >> ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT;
1847 : : }
1848 : :
1849 : : static inline void set_ena_admin_host_info_rss_configurable_function_key(struct ena_admin_host_info *p, uint32_t val)
1850 : : {
1851 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT) & ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK;
1852 : : }
1853 : :
1854 : : static inline uint32_t get_ena_admin_host_info_rx_page_reuse(const struct ena_admin_host_info *p)
1855 : : {
1856 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK) >>
1857 : : ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT;
1858 : : }
1859 : :
1860 : : static inline void set_ena_admin_host_info_rx_page_reuse(struct ena_admin_host_info *p,
1861 : : uint32_t val)
1862 : : {
1863 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT) &
1864 : : ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK;
1865 : : }
1866 : :
1867 : : static inline
1868 : : uint32_t get_ena_admin_host_info_tx_ipv6_csum_offload(const struct ena_admin_host_info *p)
1869 : : {
1870 : : return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_MASK) >>
1871 : : ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_SHIFT;
1872 : : }
1873 : :
1874 : : static inline void set_ena_admin_host_info_tx_ipv6_csum_offload(struct ena_admin_host_info *p,
1875 : : uint32_t val)
1876 : : {
1877 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_SHIFT) &
1878 : : ENA_ADMIN_HOST_INFO_TX_IPV6_CSUM_OFFLOAD_MASK;
1879 : : }
1880 : :
1881 : : static inline uint8_t get_ena_admin_feature_rss_ind_table_one_entry_update(const struct ena_admin_feature_rss_ind_table *p)
1882 : : {
1883 : : return p->flags & ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK;
1884 : : }
1885 : :
1886 : : static inline void set_ena_admin_feature_rss_ind_table_one_entry_update(struct ena_admin_feature_rss_ind_table *p, uint8_t val)
1887 : : {
1888 : : p->flags |= val & ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK;
1889 : : }
1890 : :
1891 : : static inline uint32_t get_ena_admin_host_info_phc(const struct ena_admin_host_info *p)
1892 : : {
1893 : : return (p->driver_supported_features &
1894 : : ENA_ADMIN_HOST_INFO_PHC_MASK) >> ENA_ADMIN_HOST_INFO_PHC_SHIFT;
1895 : : }
1896 : :
1897 : : static inline void set_ena_admin_host_info_phc(struct ena_admin_host_info *p, uint32_t val)
1898 : : {
1899 : : p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_PHC_SHIFT) &
1900 : : ENA_ADMIN_HOST_INFO_PHC_MASK;
1901 : : }
1902 : :
1903 : : static inline uint8_t get_ena_admin_aenq_common_desc_phase(const struct ena_admin_aenq_common_desc *p)
1904 : : {
1905 : : return p->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
1906 : : }
1907 : :
1908 : : static inline void set_ena_admin_aenq_common_desc_phase(struct ena_admin_aenq_common_desc *p, uint8_t val)
1909 : : {
1910 : : p->flags |= val & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
1911 : : }
1912 : :
1913 : : static inline uint32_t get_ena_admin_aenq_link_change_desc_link_status(const struct ena_admin_aenq_link_change_desc *p)
1914 : : {
1915 : 0 : return p->flags & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
1916 : : }
1917 : :
1918 : : static inline void set_ena_admin_aenq_link_change_desc_link_status(struct ena_admin_aenq_link_change_desc *p, uint32_t val)
1919 : : {
1920 : : p->flags |= val & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
1921 : : }
1922 : :
1923 : : #endif /* !defined(DEFS_LINUX_MAINLINE) */
1924 : : #endif /* _ENA_ADMIN_H_ */
|