Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/gve/gve_adminq.h
| /*- | /*- | ||||
| * SPDX-License-Identifier: BSD-3-Clause | * SPDX-License-Identifier: BSD-3-Clause | ||||
| * | * | ||||
| * Copyright (c) 2023 Google LLC | * Copyright (c) 2023-2024 Google LLC | ||||
| * | * | ||||
| * Redistribution and use in source and binary forms, with or without modification, | * Redistribution and use in source and binary forms, with or without modification, | ||||
| * are permitted provided that the following conditions are met: | * are permitted provided that the following conditions are met: | ||||
| * | * | ||||
| * 1. Redistributions of source code must retain the above copyright notice, this | * 1. Redistributions of source code must retain the above copyright notice, this | ||||
| * list of conditions and the following disclaimer. | * list of conditions and the following disclaimer. | ||||
| * | * | ||||
| * 2. Redistributions in binary form must reproduce the above copyright notice, | * 2. Redistributions in binary form must reproduce the above copyright notice, | ||||
| ▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | struct gve_device_option_gqi_qpl { | ||||
| __be32 supported_features_mask; | __be32 supported_features_mask; | ||||
| }; | }; | ||||
| _Static_assert(sizeof(struct gve_device_option_gqi_qpl) == 4, | _Static_assert(sizeof(struct gve_device_option_gqi_qpl) == 4, | ||||
| "gve: bad admin queue struct length"); | "gve: bad admin queue struct length"); | ||||
| struct gve_device_option_dqo_rda { | struct gve_device_option_dqo_rda { | ||||
| __be32 supported_features_mask; | __be32 supported_features_mask; | ||||
| __be16 tx_comp_ring_entries; | |||||
| __be16 rx_buff_ring_entries; | |||||
| }; | }; | ||||
| _Static_assert(sizeof(struct gve_device_option_dqo_rda) == 4, | _Static_assert(sizeof(struct gve_device_option_dqo_rda) == 8, | ||||
| "gve: bad admin queue struct length"); | "gve: bad admin queue struct length"); | ||||
| struct gve_device_option_modify_ring { | struct gve_device_option_modify_ring { | ||||
| __be32 supported_features_mask; | __be32 supported_features_mask; | ||||
| __be16 max_rx_ring_size; | __be16 max_rx_ring_size; | ||||
| __be16 max_tx_ring_size; | __be16 max_tx_ring_size; | ||||
| }; | }; | ||||
| Show All 40 Lines | |||||
| #define GVE_VERSION_STR_LEN 128 | #define GVE_VERSION_STR_LEN 128 | ||||
| enum gve_driver_capability { | enum gve_driver_capability { | ||||
| gve_driver_capability_gqi_qpl = 0, | gve_driver_capability_gqi_qpl = 0, | ||||
| gve_driver_capability_gqi_rda = 1, | gve_driver_capability_gqi_rda = 1, | ||||
| gve_driver_capability_dqo_qpl = 2, /* reserved for future use */ | gve_driver_capability_dqo_qpl = 2, /* reserved for future use */ | ||||
| gve_driver_capability_dqo_rda = 3, | gve_driver_capability_dqo_rda = 3, | ||||
| gve_driver_capability_alt_miss_compl = 4, | |||||
| }; | }; | ||||
| #define GVE_CAP1(a) BIT((int) a) | #define GVE_CAP1(a) BIT((int) a) | ||||
| #define GVE_CAP2(a) BIT(((int) a) - 64) | #define GVE_CAP2(a) BIT(((int) a) - 64) | ||||
| #define GVE_CAP3(a) BIT(((int) a) - 128) | #define GVE_CAP3(a) BIT(((int) a) - 128) | ||||
| #define GVE_CAP4(a) BIT(((int) a) - 192) | #define GVE_CAP4(a) BIT(((int) a) - 192) | ||||
| /* | /* | ||||
| * The following four defines describe 256 compatibility bits. | * The following four defines describe 256 compatibility bits. | ||||
| * Only a few bits (as shown in `gve_driver_compatibility`) are currently | * Only a few bits (as shown in `gve_driver_compatibility`) are currently | ||||
| * defined. The rest are reserved for future use. | * defined. The rest are reserved for future use. | ||||
| */ | */ | ||||
| #define GVE_DRIVER_CAPABILITY_FLAGS1 (GVE_CAP1(gve_driver_capability_gqi_qpl)) | #define GVE_DRIVER_CAPABILITY_FLAGS1 \ | ||||
| (GVE_CAP1(gve_driver_capability_gqi_qpl) | \ | |||||
| GVE_CAP1(gve_driver_capability_dqo_rda)) | |||||
| #define GVE_DRIVER_CAPABILITY_FLAGS2 0x0 | #define GVE_DRIVER_CAPABILITY_FLAGS2 0x0 | ||||
| #define GVE_DRIVER_CAPABILITY_FLAGS3 0x0 | #define GVE_DRIVER_CAPABILITY_FLAGS3 0x0 | ||||
| #define GVE_DRIVER_CAPABILITY_FLAGS4 0x0 | #define GVE_DRIVER_CAPABILITY_FLAGS4 0x0 | ||||
| struct gve_driver_info { | struct gve_driver_info { | ||||
| uint8_t os_type; | uint8_t os_type; | ||||
| uint8_t driver_major; | uint8_t driver_major; | ||||
| uint8_t driver_minor; | uint8_t driver_minor; | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | struct gve_adminq_create_tx_queue { | ||||
| __be16 tx_ring_size; | __be16 tx_ring_size; | ||||
| __be16 tx_comp_ring_size; | __be16 tx_comp_ring_size; | ||||
| uint8_t padding[4]; | uint8_t padding[4]; | ||||
| }; | }; | ||||
| _Static_assert(sizeof(struct gve_adminq_create_tx_queue) == 48, | _Static_assert(sizeof(struct gve_adminq_create_tx_queue) == 48, | ||||
| "gve: bad admin queue struct length"); | "gve: bad admin queue struct length"); | ||||
| #define GVE_RAW_ADDRESSING_QPL_ID 0xFFFFFFFF | |||||
| struct gve_adminq_create_rx_queue { | struct gve_adminq_create_rx_queue { | ||||
| __be32 queue_id; | __be32 queue_id; | ||||
| __be32 index; | __be32 index; | ||||
| __be32 reserved; | __be32 reserved; | ||||
| __be32 ntfy_id; | __be32 ntfy_id; | ||||
| __be64 queue_resources_addr; | __be64 queue_resources_addr; | ||||
| __be64 rx_desc_ring_addr; | __be64 rx_desc_ring_addr; | ||||
| __be64 rx_data_ring_addr; | __be64 rx_data_ring_addr; | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | struct stats { | ||||
| __be32 stat_name; | __be32 stat_name; | ||||
| __be32 queue_id; | __be32 queue_id; | ||||
| __be64 value; | __be64 value; | ||||
| }; | }; | ||||
| _Static_assert(sizeof(struct stats) == 16, | _Static_assert(sizeof(struct stats) == 16, | ||||
| "gve: bad admin queue struct length"); | "gve: bad admin queue struct length"); | ||||
| /* These are control path types for PTYPE which are the same as the data path | |||||
| * types. | |||||
| */ | |||||
| struct gve_ptype_entry { | |||||
| uint8_t l3_type; | |||||
| uint8_t l4_type; | |||||
| }; | |||||
| struct gve_ptype_map { | |||||
| struct gve_ptype_entry ptypes[1 << 10]; /* PTYPES are always 10 bits. */ | |||||
| }; | |||||
| struct gve_adminq_get_ptype_map { | |||||
| __be64 ptype_map_len; | |||||
| __be64 ptype_map_addr; | |||||
| }; | |||||
| struct gve_adminq_command { | struct gve_adminq_command { | ||||
| __be32 opcode; | __be32 opcode; | ||||
| __be32 status; | __be32 status; | ||||
| union { | union { | ||||
| struct gve_adminq_configure_device_resources | struct gve_adminq_configure_device_resources | ||||
| configure_device_resources; | configure_device_resources; | ||||
| struct gve_adminq_create_tx_queue create_tx_queue; | struct gve_adminq_create_tx_queue create_tx_queue; | ||||
| struct gve_adminq_create_rx_queue create_rx_queue; | struct gve_adminq_create_rx_queue create_rx_queue; | ||||
| struct gve_adminq_destroy_tx_queue destroy_tx_queue; | struct gve_adminq_destroy_tx_queue destroy_tx_queue; | ||||
| struct gve_adminq_destroy_rx_queue destroy_rx_queue; | struct gve_adminq_destroy_rx_queue destroy_rx_queue; | ||||
| struct gve_adminq_describe_device describe_device; | struct gve_adminq_describe_device describe_device; | ||||
| struct gve_adminq_register_page_list reg_page_list; | struct gve_adminq_register_page_list reg_page_list; | ||||
| struct gve_adminq_unregister_page_list unreg_page_list; | struct gve_adminq_unregister_page_list unreg_page_list; | ||||
| struct gve_adminq_set_driver_parameter set_driver_param; | struct gve_adminq_set_driver_parameter set_driver_param; | ||||
| struct gve_adminq_verify_driver_compatibility | struct gve_adminq_verify_driver_compatibility | ||||
| verify_driver_compatibility; | verify_driver_compatibility; | ||||
| struct gve_adminq_get_ptype_map get_ptype_map; | |||||
| uint8_t reserved[56]; | uint8_t reserved[56]; | ||||
| }; | }; | ||||
| }; | }; | ||||
| _Static_assert(sizeof(struct gve_adminq_command) == 64, | _Static_assert(sizeof(struct gve_adminq_command) == 64, | ||||
| "gve: bad admin queue struct length"); | "gve: bad admin queue struct length"); | ||||
| enum gve_l3_type { | |||||
| /* Must be zero so zero initialized LUT is unknown. */ | |||||
| GVE_L3_TYPE_UNKNOWN = 0, | |||||
| GVE_L3_TYPE_OTHER, | |||||
| GVE_L3_TYPE_IPV4, | |||||
| GVE_L3_TYPE_IPV6, | |||||
| }; | |||||
| enum gve_l4_type { | |||||
| /* Must be zero so zero initialized LUT is unknown. */ | |||||
| GVE_L4_TYPE_UNKNOWN = 0, | |||||
| GVE_L4_TYPE_OTHER, | |||||
| GVE_L4_TYPE_TCP, | |||||
| GVE_L4_TYPE_UDP, | |||||
| GVE_L4_TYPE_ICMP, | |||||
| GVE_L4_TYPE_SCTP, | |||||
| }; | |||||
| int gve_adminq_create_rx_queues(struct gve_priv *priv, uint32_t num_queues); | int gve_adminq_create_rx_queues(struct gve_priv *priv, uint32_t num_queues); | ||||
| int gve_adminq_create_tx_queues(struct gve_priv *priv, uint32_t num_queues); | int gve_adminq_create_tx_queues(struct gve_priv *priv, uint32_t num_queues); | ||||
| int gve_adminq_destroy_tx_queues(struct gve_priv *priv, uint32_t num_queues); | int gve_adminq_destroy_tx_queues(struct gve_priv *priv, uint32_t num_queues); | ||||
| int gve_adminq_destroy_rx_queues(struct gve_priv *priv, uint32_t num_queues); | int gve_adminq_destroy_rx_queues(struct gve_priv *priv, uint32_t num_queues); | ||||
| int gve_adminq_set_mtu(struct gve_priv *priv, uint32_t mtu); | int gve_adminq_set_mtu(struct gve_priv *priv, uint32_t mtu); | ||||
| int gve_adminq_alloc(struct gve_priv *priv); | int gve_adminq_alloc(struct gve_priv *priv); | ||||
| void gve_reset_adminq(struct gve_priv *priv); | void gve_reset_adminq(struct gve_priv *priv); | ||||
| int gve_adminq_describe_device(struct gve_priv *priv); | int gve_adminq_describe_device(struct gve_priv *priv); | ||||
| int gve_adminq_configure_device_resources(struct gve_priv *priv); | int gve_adminq_configure_device_resources(struct gve_priv *priv); | ||||
| int gve_adminq_deconfigure_device_resources(struct gve_priv *priv); | int gve_adminq_deconfigure_device_resources(struct gve_priv *priv); | ||||
| void gve_release_adminq(struct gve_priv *priv); | void gve_release_adminq(struct gve_priv *priv); | ||||
| int gve_adminq_register_page_list(struct gve_priv *priv, | int gve_adminq_register_page_list(struct gve_priv *priv, | ||||
| struct gve_queue_page_list *qpl); | struct gve_queue_page_list *qpl); | ||||
| int gve_adminq_unregister_page_list(struct gve_priv *priv, uint32_t page_list_id); | int gve_adminq_unregister_page_list(struct gve_priv *priv, uint32_t page_list_id); | ||||
| int gve_adminq_verify_driver_compatibility(struct gve_priv *priv, | int gve_adminq_verify_driver_compatibility(struct gve_priv *priv, | ||||
| uint64_t driver_info_len, vm_paddr_t driver_info_addr); | uint64_t driver_info_len, vm_paddr_t driver_info_addr); | ||||
| int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv, | |||||
| struct gve_ptype_lut *ptype_lut); | |||||
| #endif /* _GVE_AQ_H_ */ | #endif /* _GVE_AQ_H_ */ | ||||