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

Commit c3a86422 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Android (Google) Code Review
Browse files

Merge "Limit the time PAN can occupy the BTU stack thread" into lmp-dev

parents 17d9ebbd 97529fc1
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -428,6 +428,8 @@ int btpan_tap_open()
    BTM_GetLocalDeviceAddr (local_addr);
    if(tap_if_up(TAP_IF_NAME, local_addr) == 0)
    {
        int flags = fcntl(fd, F_GETFL, 0);
        fcntl(fd, F_SETFL, flags | O_NONBLOCK);
        return fd;
    }
    BTIF_TRACE_ERROR("can not bring up tap interface:%s", TAP_IF_NAME);
@@ -678,8 +680,10 @@ static void btu_exec_tap_fd_read(void *p_param) {
    if (fd == -1 || fd != btpan_cb.tap_fd)
        return;

    // Keep sending until someone either turns off BTIF or disables data the flow.
    while (btif_is_enabled() && btpan_cb.flow) {
    // Don't occupy BTU context too long, avoid GKI buffer overruns and
    // give other profiles a chance to run by limiting the amount of memory
    // PAN can use from the shared pool buffer.
    for(int i = 0; i < PAN_POOL_MAX && btif_is_enabled() && btpan_cb.flow; i++) {
        BT_HDR *buffer = (BT_HDR *)GKI_getpoolbuf(PAN_POOL_ID);
        if (!buffer) {
            BTIF_TRACE_WARNING("%s unable to allocate buffer for packet.", __func__);
+2 −0
Original line number Diff line number Diff line
@@ -533,6 +533,8 @@

#ifndef PAN_POOL_ID
#define PAN_POOL_ID                 GKI_POOL_ID_3
/* Maximum amount of the shared buffer to allocate for PAN */
#define PAN_POOL_MAX                (GKI_BUF3_MAX / 4)
#endif

/* UNV pool for read/write serialization */