Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe9ad36c authored by Roshan Pius's avatar Roshan Pius
Browse files

wifi(interface): Add wifi debug packet fate related interface

The packet fate debug mechanism is used to track the state of all the
packets transmitted/received during the association process.

Also,
Add the various debug capabilities in the respective interfaces.
All ring buffer, driver/firmware dump, etc related capabilities are in
IWifiChip object.
The packet fate capability is exposed in IWifiStaIface object.

Bug: 32221997
Test: ./hardware/interfaces/update-makefiles.sh
Change-Id: Ic6bf49d682b70a1cdcd18c69fc25a544921bd548
parent e3a02b07
Loading
Loading
Loading
Loading
+204 −0
Original line number Diff line number Diff line
@@ -1542,6 +1542,40 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugPacketFateFrameInfo)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugPacketFateFrameInfo.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugPacketFateFrameInfo

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugPacketFateFrameType)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugPacketFateFrameType.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugPacketFateFrameType

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRingBufferFlags)
#
@@ -1746,6 +1780,74 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRxPacketFate)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugRxPacketFate.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugRxPacketFate

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRxPacketFateReport)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugRxPacketFateReport.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugRxPacketFateReport

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugTxPacketFate)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugTxPacketFate.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugTxPacketFate

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugTxPacketFateReport)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugTxPacketFateReport.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugTxPacketFateReport

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiInformationElement)
#
@@ -3667,6 +3769,40 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugPacketFateFrameInfo)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugPacketFateFrameInfo.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugPacketFateFrameInfo

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugPacketFateFrameType)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugPacketFateFrameType.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugPacketFateFrameType

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRingBufferFlags)
#
@@ -3871,6 +4007,74 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRxPacketFate)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugRxPacketFate.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugRxPacketFate

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugRxPacketFateReport)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugRxPacketFateReport.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugRxPacketFateReport

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugTxPacketFate)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugTxPacketFate.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugTxPacketFate

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiDebugTxPacketFateReport)
#
GEN := $(intermediates)/android/hardware/wifi/1.0/WifiDebugTxPacketFateReport.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava -randroid.hardware:hardware/interfaces \
        android.hardware.wifi@1.0::types.WifiDebugTxPacketFateReport

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (WifiInformationElement)
#
+48 −0
Original line number Diff line number Diff line
@@ -130,6 +130,37 @@ interface IWifiChip {
    string firmwareDescription;
  };

  /**
   * Capabilities exposed by this chip.
   */
  enum ChipCapabilityMask : uint32_t {
    /**
     * Memory dump of Firmware.
     */
    DEBUG_MEMORY_FIRMWARE_DUMP_SUPPORTED = 1 << 0,
    /**
     * Memory dump of Driver.
     */
    DEBUG_MEMORY_DRIVER_DUMP_SUPPORTED = 1 << 1,
    /**
     * Connectivity events reported via debug ring buffer.
     */
    DEBUG_RING_BUFFER_CONNECT_EVENT_SUPPORTED = 1 << 2,
    /**
     * Power events reported via debug ring buffer.
     */
    DEBUG_RING_BUFFER_POWER_EVENT_SUPPORTED = 1 << 3,
    /**
     * Wakelock events reported via debug ring buffer.
     */
    DEBUG_RING_BUFFER_WAKELOCK_EVENT_SUPPORTED = 1 << 4,
    /**
     * Vendor data reported via debug ring buffer.
     * This mostly contains firmware event logs.
     */
    DEBUG_RING_BUFFER_VENDOR_DATA_SUPPORTED = 1 << 5,
  };

  /**
   * Get the id assigned to this chip.
   *
@@ -155,6 +186,19 @@ interface IWifiChip {
   */
  registerEventCallback(IWifiChipEventCallback callback) generates (WifiStatus status);

  /**
   * Get the capabilities supported by this chip.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   * @return capabilities Bitset of |ChipCapabilityMask| values.
   */
  getCapabilities() generates (WifiStatus status, uint32_t capabilities);

  /**
   * Get the set of operation modes that the chip supports.
   *
@@ -464,6 +508,7 @@ interface IWifiChip {
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.NOT_AVAILABLE|,
   *         |WifiStatusCode.UNKNOWN|
   * @return ringBuffers Vector of |WifiDebugRingBufferStatus| corresponding to the
@@ -486,6 +531,7 @@ interface IWifiChip {
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.NOT_AVAILABLE|,
   *         |WifiStatusCode.UNKNOWN|
   */
@@ -506,6 +552,8 @@ interface IWifiChip {
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.NOT_AVAILABLE|,
   *         |WifiStatusCode.UNKNOWN|
   */
+94 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ interface IWifiStaIface extends IWifiIface {
     * If set indicates that the link layer stats APIs are supported.
     */
    LINK_LAYER_STATS = 1 << 2,
    /**
     * Tracks connection packets' fate.
     */
    DEBUG_PACKET_FATE_SUPPORTED = 1 << 3
  };

  /**
@@ -195,6 +199,7 @@ interface IWifiStaIface extends IWifiIface {
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   */
@@ -230,6 +235,7 @@ interface IWifiStaIface extends IWifiIface {
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   */
@@ -245,9 +251,97 @@ interface IWifiStaIface extends IWifiIface {
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   * @return stats Instance of |LinkLayerStats|.
   */
  getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);

  /**
   * API to start packet fate monitoring.
   * - Once stared, monitoring must remain active until HAL is unloaded.
   * - When HAL is unloaded, all packet fate buffers must be cleared.
   * - The packet fates are used to monitor the state of packets transmitted/
   *   received during association.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   */
  startDebugPacketFateMonitoring() generates (WifiStatus status);

  /**
   * API to stop packet fate monitoring.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   */
  stopDebugPacketFateMonitoring() generates (WifiStatus status);

  /**
   * API to retrieve fates of outbound packets.
   * - HAL implementation must return the fates of
   *   all the frames transmitted for the most recent association.
   *   The fate reports must follow the same order as their respective
   *   packets.
   * - HAL implementation may choose (but is not required) to include
   *   reports for management frames.
   * - Packets reported by firmware, but not recognized by driver,
   *   must be included. However, the ordering of the corresponding
   *   reports is at the discretion of HAL implementation.
   * - Framework must be able to call this API multiple times for the same
   *   association.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   * @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
   *         to the packet fates.
   */
  getDebugTxPacketFates()
      generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);

  /**
   * API to retrieve fates of inbound packets.
   * - HAL implementation must return the fates of
   *   all the frames received for the most recent association.
   *   The fate reports must follow the same order as their respective
   *   packets.
   * - HAL implementation may choose (but is not required) to include
   *   reports for management frames.
   * - Packets reported by firmware, but not recognized by driver,
   *   must be included. However, the ordering of the corresponding
   *   reports is at the discretion of HAL implementation.
   * - Framework must be able to call this API multiple times for the same
   *   association.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
   *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
   *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
   *         |WifiStatusCode.ERROR_NOT_STARTED|,
   *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
   *         |WifiStatusCode.ERROR_UNKNOWN|
   * @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
   *         to the packet fates.
   */
  getDebugRxPacketFates()
      generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
};
+176 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ enum WifiStatusCode : uint32_t {
  ERROR_WIFI_RTT_CONTROLLER_INVALID,
  ERROR_NOT_SUPPORTED,
  ERROR_NOT_AVAILABLE,
  ERROR_NOT_STARTED,
  ERROR_INVALID_ARGS,
  ERROR_UNKNOWN
};
@@ -2887,3 +2888,178 @@ enum WifiDebugRingBufferVerboseLevel : uint32_t {
   */
  EXCESSIVE = 3
};

/**
 * Enum describing the fate of the TX packets.
 */
enum WifiDebugTxPacketFate : uint32_t {
  /**
   * Sent over air and ACKed.
   */
  ACKED,
  /**
   * Sent over air but not ACKed. (Normal for broadcast/multicast.)
   */
  SENT,
  /**
   * Queued within firmware, but not yet sent over air.
   */
  FW_QUEUED,
  /**
   * Dropped by firmware as invalid. E.g. bad source address, bad checksum,
   * or invalid for current state.
   */
  FW_DROP_INVALID,
  /**
   * Dropped by firmware due to lack of buffer space.
   */
  FW_DROP_NOBUFS,
  /**
   * Dropped by firmware for any other reason. Includes frames that  were sent
   * by driver to firmware, but unaccounted for by  firmware.
   */
  FW_DROP_OTHER,
  /**
   * Queued within driver, not yet sent to firmware.
   */
  DRV_QUEUED,
  /**
   * Dropped by driver as invalid. E.g. bad source address, or invalid for
   * current state.
   */
  DRV_DROP_INVALID,
  /**
   * Dropped by driver due to lack of buffer space.
   */
  DRV_DROP_NOBUFS,
  /**
   * Dropped by driver for any other reason.
   */
  DRV_DROP_OTHER,
};

/**
 * Enum describing the fate of the TX packets.
 */
enum WifiDebugRxPacketFate : uint32_t {
  /**
   * Valid and delivered to network stack (e.g., netif_rx()).
   */
  SUCCESS,
  /**
   * Queued within firmware, but not yet sent to driver.
   */
  FW_QUEUED,
  /**
   * Dropped by firmware due to host-programmable filters.
   */
  FW_DROP_FILTER,
  /**
   * Dropped by firmware as invalid. E.g. bad checksum, decrypt failed,
   * or invalid for current state.
   */
  FW_DROP_INVALID,
  /**
   * Dropped by firmware due to lack of buffer space.
   */
  FW_DROP_NOBUFS,
  /**
   * Dropped by firmware for any other reason.
   */
  FW_DROP_OTHER,
  /**
   * Queued within driver, not yet delivered to network stack.
   */
  DRV_QUEUED,
  /**
   * Dropped by driver due to filter rules.
   */
  DRV_DROP_FILTER,
  /**
   * Dropped by driver as invalid. E.g. not permitted in current state.
   */
  DRV_DROP_INVALID,
  /**
   * Dropped by driver due to lack of buffer space.
   */
  DRV_DROP_NOBUFS,
  /**
   * Dropped by driver for any other reason.
   */
  DRV_DROP_OTHER,
};

/**
 * Type of frame transmitted/received.
 */
enum WifiDebugPacketFateFrameType : uint32_t {
  UNKNOWN,
  ETHERNET_II,
  MGMT_80211,
};

/**
 * Information regarding the frame transmitted/received.
 */
struct WifiDebugPacketFateFrameInfo {
  /**
   * The type of MAC-layer frame that this frame_info holds.
   * - For data frames, use FRAME_TYPE_ETHERNET_II.
   * - For management frames, use FRAME_TYPE_80211_MGMT.
   * - If the type of the frame is unknown, use FRAME_TYPE_UNKNOWN.
   */
  WifiDebugPacketFateFrameType frameType;
  /**
   * The number of bytes included in |frameContent|.
   * If the frame  contents are missing (e.g. RX frame dropped in firmware),
   * |frameLen| must be set to 0.
   */
  uint64_t frameLen;
  /**
   * Host clock when this frame was received by the driver (either  outbound
   * from the host network stack, or inbound from the firmware).
   * - The timestamp must be taken from a clock which includes time the host
   *   spent suspended (e.g. ktime_get_boottime()).
   * - If no host timestamp is available (e.g. RX frame was dropped in firmware),
   *   this field must be set to 0.
   */
  TimeStampInUs driverTimestampUsec;
  /**
   * Firmware clock when this frame was received by the firmware
   * (either outbound from the host, or inbound from a remote  station).
   * - The timestamp must be taken from a clock which includes time firmware
   *   spent suspended (if applicable).
   * - If no firmware timestamp is available (e.g. TX frame was dropped by
   *   driver), this field must be set to 0.
   * - Consumers of |frameInfo| must not assume any synchronization between
   *   driver and firmware clocks.
   */
  TimeStampInUs firmwareTimestampUsec;
  /**
   * Actual frame content. This is the raw bytes of the corresponding packet.
   * - Should be provided for TX frames originated by the host.
   * - Should be provided for RX frames received by the driver.
   * - Optionally provided for TX frames originated by firmware.
   *   (At discretion of HAL implementation.)
   * - Optionally provided for RX frames dropped in firmware.
   *   (At discretion of HAL implementation.)
   * - If frame content is not provided, |frameLen| must be set to 0.
   */
  vec<uint8_t> frameContent;
};

/**
 * Struct describing packet fate report for each Rx frame.
 */
struct WifiDebugTxPacketFateReport {
  WifiDebugTxPacketFate fate;
  WifiDebugPacketFateFrameInfo frameInf;
};

/**
 * Struct describing packet fate report for each Rx frame.
 */
struct WifiDebugRxPacketFateReport {
  WifiDebugRxPacketFate fate;
  WifiDebugPacketFateFrameInfo frameInfo;
};