From 37ee4eb551f7ad3f2550ac7a1322064d8dcd3b24 Mon Sep 17 00:00:00 2001 From: Weiyi Chen Date: Mon, 4 Oct 2021 10:33:27 -0700 Subject: [PATCH] dfc: not caching grant for removed bearers If a grant indication for a bearer has "removed" flag set, caching the bearer could lead to data stall for the next data call because modem will not send grant for this bearer during powersave. Do not cache grant for the removed or disabled bearers. Also make sure a bearer is flow enabled when it is associated with a tx queue. Change-Id: I7eca597e3cc7d5a0bfe523201c454fb45e66a3a0 Signed-off-by: Weiyi Chen --- core/dfc_qmi.c | 5 ++++- core/qmi_rmnet.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/core/dfc_qmi.c b/core/dfc_qmi.c index f52d9e3e032f..2b10540564c6 100644 --- a/core/dfc_qmi.c +++ b/core/dfc_qmi.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1003,7 +1004,9 @@ static int dfc_update_fc_map(struct net_device *dev, struct qos_info *qos, u32 adjusted_grant; itm = qmi_rmnet_get_bearer_map(qos, fc_info->bearer_id); - if (!itm) + + /* cache the bearer assuming it is a new bearer */ + if (unlikely(!itm && !is_query && fc_info->num_bytes)) itm = qmi_rmnet_get_bearer_noref(qos, fc_info->bearer_id); if (itm) { diff --git a/core/qmi_rmnet.c b/core/qmi_rmnet.c index 84818c9b8f57..abeda1f4d84d 100644 --- a/core/qmi_rmnet.c +++ b/core/qmi_rmnet.c @@ -1,5 +1,6 @@ /* -* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -401,12 +402,15 @@ static void __qmi_rmnet_update_mq(struct net_device *dev, bearer->mq_idx = itm->mq_idx; } - qmi_rmnet_flow_control(dev, itm->mq_idx, - bearer->grant_size > 0 ? 1 : 0); - + /* Always enable flow for the newly associated bearer */ + if (!bearer->grant_size) { + bearer->grant_size = DEFAULT_GRANT; + bearer->grant_thresh = + qmi_rmnet_grant_per(DEFAULT_GRANT); + } + qmi_rmnet_flow_control(dev, itm->mq_idx, 1); if (dfc_mode == DFC_MODE_SA) - qmi_rmnet_flow_control(dev, bearer->ack_mq_idx, - bearer->grant_size > 0 ? 1 : 0); + qmi_rmnet_flow_control(dev, bearer->ack_mq_idx, 1); } }