gdma_resources/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Resource definitions for MANA/GDMA devices.
5
6#![forbid(unsafe_code)]
7
8use mesh::MeshPayload;
9use net_backend_resources::mac_address::MacAddress;
10use vm_resource::Resource;
11use vm_resource::ResourceId;
12use vm_resource::kind::NetEndpointHandleKind;
13use vm_resource::kind::PciDeviceHandleKind;
14
15/// A resource handle to a GDMA device.
16#[derive(MeshPayload)]
17pub struct GdmaDeviceHandle {
18    /// The vports to instantiate on the NIC.
19    pub vports: Vec<VportDefinition>,
20}
21
22impl ResourceId<PciDeviceHandleKind> for GdmaDeviceHandle {
23    const ID: &'static str = "gdma";
24}
25
26/// A basic NIC vport definition.
27#[derive(MeshPayload)]
28pub struct VportDefinition {
29    /// The vport's MAC address.
30    pub mac_address: MacAddress,
31    /// The backend network endpoint for the vport.
32    pub endpoint: Resource<NetEndpointHandleKind>,
33}