From 7a327bbae72ee16ec254399244e16ff536545162 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 | 4 +++- core/qmi_rmnet.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/core/dfc_qmi.c b/core/dfc_qmi.c index 2438b016b6..edf2a8d4cb 100644 --- a/core/dfc_qmi.c +++ b/core/dfc_qmi.c @@ -1003,7 +1003,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 6fd652f03e..6ae7fb629b 100644 --- a/core/qmi_rmnet.c +++ b/core/qmi_rmnet.c @@ -412,12 +412,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); } }