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

Commit d5ae0829 authored by junyulai's avatar junyulai Committed by Automerger Merge Worker
Browse files

[SP14] Add HAL to set warning quota to tehtering offload hardware am: 4011f47a

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1212191

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3fabd586479cb6bf633cfba65560f49c2933af0a
parents 241e5a49 4011f47a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.tetheroffload.control</name>
        <version>1.0</version>
        <version>1.1</version>
        <interface>
            <name>IOffloadControl</name>
            <instance>default</instance>
+16 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.tetheroffload.control@1.1",
    root: "android.hardware",
    srcs: [
        "types.hal",
        "IOffloadControl.hal",
        "ITetheringOffloadCallback.hal",
    ],
    interfaces: [
        "android.hardware.tetheroffload.control@1.0",
        "android.hidl.base@1.0",
    ],
    gen_java: true,
}
+82 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tetheroffload.control@1.1;

import @1.0::IOffloadControl;

/**
 * Interface used to control the lifecycle of tethering offload. Note that callbacks of 1.1 HAL
 * can be registered with the existing callback registration methods from 1.0 HAL.
 */
interface IOffloadControl extends @1.0::IOffloadControl {
    /**
     * Instruct hardware to send callbacks after certain number of bytes have been transferred in
     * either direction on this upstream interface.
     *
     * The specified quota bytes must be applied to all traffic on the given upstream interface.
     * This includes hardware forwarded traffic, software forwarded traffic, and AP-originated
     * traffic. IPv4 and IPv6 traffic both count towards the same quota. IP headers are included
     * in the byte count quota, but, link-layer headers are not.
     *
     * This API may only be called while offload is occurring on this upstream. The hardware
     * management process MUST NOT store the values when offload is not started and applies once
     * offload is started. This is because the quota values would likely become stale over
     * time and would not reflect any new traffic that has occurred.
     *
     * This API replaces {@link @1.0::IOffloadControl::setDataLimit}, the framework would always
     * calls this API if 1.1 HAL is supported. Otherwise, calls the other one. Thus, no
     * interaction between the two APIs need to be addressed. However, the hardware implementation
     * still needs to keep functionality of both in case of shipping with older framework that
     * doesn't support 1.1 HAL.
     *
     * The specified quota bytes MUST replace any previous quotas set by
     * {@code setDataWarningAndLimit} specified on the same interface. It may be interpreted as
     * "tell me when either <warningBytes> or <limitBytes> bytes have been transferred
     * (in either direction), and stop offload when <limitBytes> bytes have been transferred,
     * starting now and counting from zero on <upstream>."
     *
     * Once the {@code warningBytes} is reached, the callback registered in initOffload must be
     * called with {@code OFFLOAD_WARNING_REACHED} to indicate this event. Once the event fires
     * for this upstream, no further {@code OFFLOAD_WARNING_REACHED} event will be fired for this
     * upstream unless this method is called again with the same interface. Note that there is
     * no need to call initOffload again to resume offload if stopOffload was not called by the
     * client.
     *
     * Similarly, Once the {@code limitBytes} is reached, the callback registered in initOffload
     * must be called with {@code OFFLOAD_STOPPED_LIMIT_REACHED} to indicate this event. Once
     * the event fires for this upstream, no further {@code OFFLOAD_STOPPED_LIMIT_REACHED}
     * event will be fired for this upstream unless this method is called again with the same
     * interface. However, unlike {@code warningBytes}, when {@code limitBytes} is reached,
     * all offload must be stopped. If offload is desired again, the hardware management
     * process must be completely reprogrammed by calling setUpstreamParameters and
     * addDownstream again.
     *
     * Note that when one of the quota bytes is reached, the other one is still considered valid
     * unless this method is called again with the same interface.
     *
     * @param upstream Upstream interface name that quota must apply to.
     * @param warningBytes The quota of warning, defined as the number of bytes, starting from
     *                     zero and counting from now.
     * @param limitBytes The quota of limit, defined as the number of bytes, starting from zero
     *                   and counting from now.
     *
     * @return success true if quota is applied, false otherwise
     * @return errMsg a human readable string if error has occurred.
     */
    setDataWarningAndLimit(string upstream, uint64_t warningBytes, uint64_t limitBytes)
        generates (bool success, string errMsg);
};
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tetheroffload.control@1.1;

import @1.0::ITetheringOffloadCallback;
import OffloadCallbackEvent;

/**
 * Callback providing information about status of hardware management process
 * as well as providing a way to keep offloaded connections from timing out.
 */
interface ITetheringOffloadCallback extends @1.0::ITetheringOffloadCallback {
    /**
     * Called when an asynchronous event is generated by the hardware
     * management process. Events which are common for 1.0 and 1.1 HAL
     * MUST be fired on both 1.0 and 1.1 callback.
     */
    oneway onEvent_1_1(OffloadCallbackEvent event);
};
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tetheroffload.control@1.1;

import @1.0::OffloadCallbackEvent;

enum OffloadCallbackEvent : @1.0::OffloadCallbackEvent {
    /**
     * This event is fired when the quota, applied in setDataWarning, has expired. It is
     * recommended that the client query for statistics immediately after receiving this event.
     * Note that hardware acceleration must not be stopped upon receiving this event.
     */
    OFFLOAD_WARNING_REACHED = 6,
};