From patchwork Sun Dec 5 15:04:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657107 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5296C433F5 for ; Sun, 5 Dec 2021 14:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235059AbhLEPAd (ORCPT ); Sun, 5 Dec 2021 10:00:33 -0500 Received: from mga03.intel.com ([134.134.136.65]:20582 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234836AbhLEPAb (ORCPT ); Sun, 5 Dec 2021 10:00:31 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132482" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132482" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507283" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:01 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 1/7] net: wwan: iosm: stop sending unnecessary doorbell Date: Sun, 5 Dec 2021 20:34:49 +0530 Message-Id: <20211205150455.1829929-2-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In TX packet accumulation flow transport layer is giving a doorbell to device even though there is no pending control TX transfer that needs immediate attention. Introduced a new hpda_ctrl_pending variable to keep track of pending control TX transfer. If there is a pending control TX transfer which needs an immediate attention only then give a doorbell to device. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: No Change. --- drivers/net/wwan/iosm/iosm_ipc_imem.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c index 1be07114c85d..644a871585ea 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c @@ -182,9 +182,9 @@ void ipc_imem_hrtimer_stop(struct hrtimer *hr_timer) bool ipc_imem_ul_write_td(struct iosm_imem *ipc_imem) { struct ipc_mem_channel *channel; + bool hpda_ctrl_pending = false; struct sk_buff_head *ul_list; bool hpda_pending = false; - bool forced_hpdu = false; struct ipc_pipe *pipe; int i; @@ -201,15 +201,19 @@ bool ipc_imem_ul_write_td(struct iosm_imem *ipc_imem) ul_list = &channel->ul_list; /* Fill the transfer descriptor with the uplink buffer info. */ - hpda_pending |= ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, + if (!ipc_imem_check_wwan_ips(channel)) { + hpda_ctrl_pending |= + ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, pipe, ul_list); - - /* forced HP update needed for non data channels */ - if (hpda_pending && !ipc_imem_check_wwan_ips(channel)) - forced_hpdu = true; + } else { + hpda_pending |= + ipc_protocol_ul_td_send(ipc_imem->ipc_protocol, + pipe, ul_list); + } } - if (forced_hpdu) { + /* forced HP update needed for non data channels */ + if (hpda_ctrl_pending) { hpda_pending = false; ipc_protocol_doorbell_trigger(ipc_imem->ipc_protocol, IPC_HP_UL_WRITE_TD); From patchwork Sun Dec 5 15:04:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657109 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 907C5C433EF for ; Sun, 5 Dec 2021 14:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235064AbhLEPAg (ORCPT ); Sun, 5 Dec 2021 10:00:36 -0500 Received: from mga03.intel.com ([134.134.136.65]:20582 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234836AbhLEPAe (ORCPT ); Sun, 5 Dec 2021 10:00:34 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132490" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132490" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507289" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:04 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 2/7] net: wwan: iosm: set tx queue len Date: Sun, 5 Dec 2021 20:34:50 +0530 Message-Id: <20211205150455.1829929-3-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Set wwan net dev tx queue len to DEFAULT_TX_QUEUE_LEN. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: Use the common DEFAULT_TX_QUEUE_LEN macro instead of defining the new macro for tx queue length. --- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c index b571d9cedba4..27151148c782 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "iosm_ipc_chnl_cfg.h" #include "iosm_ipc_imem_ops.h" @@ -159,7 +160,7 @@ static void ipc_wwan_setup(struct net_device *iosm_dev) { iosm_dev->header_ops = NULL; iosm_dev->hard_header_len = 0; - iosm_dev->priv_flags |= IFF_NO_QUEUE; + iosm_dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN; iosm_dev->type = ARPHRD_NONE; iosm_dev->mtu = ETH_DATA_LEN; From patchwork Sun Dec 5 15:04:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657111 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05F88C433EF for ; Sun, 5 Dec 2021 14:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235081AbhLEPAi (ORCPT ); Sun, 5 Dec 2021 10:00:38 -0500 Received: from mga03.intel.com ([134.134.136.65]:20582 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234983AbhLEPAh (ORCPT ); Sun, 5 Dec 2021 10:00:37 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132492" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132492" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507295" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:07 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 3/7] net: wwan: iosm: wwan0 net interface nonfunctional after fw flash Date: Sun, 5 Dec 2021 20:34:51 +0530 Message-Id: <20211205150455.1829929-4-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Devlink initialization flow was overwriting the IP traffic channel configuration. This was causing wwan0 network interface to be unusable after fw flash. When device boots to fully functional mode restore the IP channel configuration. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: No Change. --- drivers/net/wwan/iosm/iosm_ipc_imem.c | 7 ++++++- drivers/net/wwan/iosm/iosm_ipc_imem.h | 1 + drivers/net/wwan/iosm/iosm_ipc_imem_ops.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c index 644a871585ea..ac36f9846731 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c @@ -537,6 +537,9 @@ static void ipc_imem_run_state_worker(struct work_struct *instance) return; } + if (test_and_clear_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag)) + ipc_devlink_deinit(ipc_imem->ipc_devlink); + if (!ipc_imem_setup_cp_mux_cap_init(ipc_imem, &mux_cfg)) ipc_imem->mux = ipc_mux_init(&mux_cfg, ipc_imem); @@ -1184,7 +1187,7 @@ void ipc_imem_cleanup(struct iosm_imem *ipc_imem) ipc_port_deinit(ipc_imem->ipc_port); } - if (ipc_imem->ipc_devlink) + if (test_and_clear_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag)) ipc_devlink_deinit(ipc_imem->ipc_devlink); ipc_imem_device_ipc_uninit(ipc_imem); @@ -1348,6 +1351,8 @@ struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id, if (ipc_flash_link_establish(ipc_imem)) goto devlink_channel_fail; + + set_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag); } return ipc_imem; devlink_channel_fail: diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.h b/drivers/net/wwan/iosm/iosm_ipc_imem.h index cec38009c44a..d220f2611621 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.h +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.h @@ -101,6 +101,7 @@ struct ipc_chnl_cfg; #define IOSM_CHIP_INFO_SIZE_MAX 100 #define FULLY_FUNCTIONAL 0 +#define IOSM_DEVLINK_INIT 1 /* List of the supported UL/DL pipes. */ enum ipc_mem_pipes { diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c b/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c index 43f1796a8984..0757fd915437 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c @@ -471,6 +471,7 @@ void ipc_imem_sys_devlink_close(struct iosm_devlink *ipc_devlink) /* Release the pipe resources */ ipc_imem_pipe_cleanup(ipc_imem, &channel->ul_pipe); ipc_imem_pipe_cleanup(ipc_imem, &channel->dl_pipe); + ipc_imem->nr_of_channels--; } void ipc_imem_sys_devlink_notify_rx(struct iosm_devlink *ipc_devlink, From patchwork Sun Dec 5 15:04:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657113 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318D6C433EF for ; Sun, 5 Dec 2021 14:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235085AbhLEPAl (ORCPT ); Sun, 5 Dec 2021 10:00:41 -0500 Received: from mga03.intel.com ([134.134.136.65]:20582 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234983AbhLEPAl (ORCPT ); Sun, 5 Dec 2021 10:00:41 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132496" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132496" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507302" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:10 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 4/7] net: wwan: iosm: release data channel in case no active IP session Date: Sun, 5 Dec 2021 20:34:52 +0530 Message-Id: <20211205150455.1829929-5-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If there is no active IP session (interface up & running) then release the data channel. Use nr_sessions variable to track current active IP sessions. If the count drops to 0, then send pipe close ctrl message to release the data channel. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: Fix checkpath warning - line was exceeding 80. --- drivers/net/wwan/iosm/iosm_ipc_imem.c | 1 - drivers/net/wwan/iosm/iosm_ipc_mux.c | 28 ++++++++++++++-------- drivers/net/wwan/iosm/iosm_ipc_mux.h | 1 - drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 18 +++++++------- 4 files changed, 27 insertions(+), 21 deletions(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c index ac36f9846731..96dcd2445bce 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c @@ -133,7 +133,6 @@ static int ipc_imem_setup_cp_mux_cap_init(struct iosm_imem *ipc_imem, * for channel alloc function. */ cfg->instance_id = IPC_MEM_MUX_IP_CH_IF_ID; - cfg->nr_sessions = IPC_MEM_MUX_IP_SESSION_ENTRIES; return 0; } diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux.c b/drivers/net/wwan/iosm/iosm_ipc_mux.c index c1c77ce699da..8e66ffe92055 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_mux.c +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.c @@ -97,7 +97,7 @@ static bool ipc_mux_session_open(struct iosm_mux *ipc_mux, /* Search for a free session interface id. */ if_id = le32_to_cpu(session_open->if_id); - if (if_id < 0 || if_id >= ipc_mux->nr_sessions) { + if (if_id < 0 || if_id >= IPC_MEM_MUX_IP_SESSION_ENTRIES) { dev_err(ipc_mux->dev, "invalid interface id=%d", if_id); return false; } @@ -129,6 +129,7 @@ static bool ipc_mux_session_open(struct iosm_mux *ipc_mux, /* Save and return the assigned if id. */ session_open->if_id = cpu_to_le32(if_id); + ipc_mux->nr_sessions++; return true; } @@ -151,7 +152,7 @@ static void ipc_mux_session_close(struct iosm_mux *ipc_mux, /* Copy the session interface id. */ if_id = le32_to_cpu(msg->if_id); - if (if_id < 0 || if_id >= ipc_mux->nr_sessions) { + if (if_id < 0 || if_id >= IPC_MEM_MUX_IP_SESSION_ENTRIES) { dev_err(ipc_mux->dev, "invalid session id %d", if_id); return; } @@ -170,6 +171,7 @@ static void ipc_mux_session_close(struct iosm_mux *ipc_mux, ipc_mux->session[if_id].flow_ctl_mask = 0; ipc_mux_session_reset(ipc_mux, if_id); + ipc_mux->nr_sessions--; } static void ipc_mux_channel_close(struct iosm_mux *ipc_mux, @@ -178,7 +180,7 @@ static void ipc_mux_channel_close(struct iosm_mux *ipc_mux, int i; /* Free pending session UL packet. */ - for (i = 0; i < ipc_mux->nr_sessions; i++) + for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++) if (ipc_mux->session[i].wwan) ipc_mux_session_reset(ipc_mux, i); @@ -244,6 +246,11 @@ static int ipc_mux_schedule(struct iosm_mux *ipc_mux, union mux_msg *msg) /* Release an IP session. */ ipc_mux->event = MUX_E_MUX_SESSION_CLOSE; ipc_mux_session_close(ipc_mux, &msg->session_close); + if (!ipc_mux->nr_sessions) { + ipc_mux->event = MUX_E_MUX_CHANNEL_CLOSE; + ipc_mux_channel_close(ipc_mux, + &msg->channel_close); + } ret = ipc_mux->channel_id; goto out; @@ -281,7 +288,6 @@ struct iosm_mux *ipc_mux_init(struct ipc_mux_config *mux_cfg, ipc_mux->protocol = mux_cfg->protocol; ipc_mux->ul_flow = mux_cfg->ul_flow; - ipc_mux->nr_sessions = mux_cfg->nr_sessions; ipc_mux->instance_id = mux_cfg->instance_id; ipc_mux->wwan_q_offset = 0; @@ -340,7 +346,7 @@ static void ipc_mux_restart_tx_for_all_sessions(struct iosm_mux *ipc_mux) struct mux_session *session; int idx; - for (idx = 0; idx < ipc_mux->nr_sessions; idx++) { + for (idx = 0; idx < IPC_MEM_MUX_IP_SESSION_ENTRIES; idx++) { session = &ipc_mux->session[idx]; if (!session->wwan) @@ -365,7 +371,7 @@ static void ipc_mux_stop_netif_for_all_sessions(struct iosm_mux *ipc_mux) struct mux_session *session; int idx; - for (idx = 0; idx < ipc_mux->nr_sessions; idx++) { + for (idx = 0; idx < IPC_MEM_MUX_IP_SESSION_ENTRIES; idx++) { session = &ipc_mux->session[idx]; if (!session->wwan) @@ -387,7 +393,7 @@ void ipc_mux_check_n_restart_tx(struct iosm_mux *ipc_mux) int ipc_mux_get_max_sessions(struct iosm_mux *ipc_mux) { - return ipc_mux ? ipc_mux->nr_sessions : -EFAULT; + return ipc_mux ? IPC_MEM_MUX_IP_SESSION_ENTRIES : -EFAULT; } enum ipc_mux_protocol ipc_mux_get_active_protocol(struct iosm_mux *ipc_mux) @@ -435,9 +441,11 @@ void ipc_mux_deinit(struct iosm_mux *ipc_mux) return; ipc_mux_stop_netif_for_all_sessions(ipc_mux); - channel_close = &mux_msg.channel_close; - channel_close->event = MUX_E_MUX_CHANNEL_CLOSE; - ipc_mux_schedule(ipc_mux, &mux_msg); + if (ipc_mux->state == MUX_S_ACTIVE) { + channel_close = &mux_msg.channel_close; + channel_close->event = MUX_E_MUX_CHANNEL_CLOSE; + ipc_mux_schedule(ipc_mux, &mux_msg); + } /* Empty the ADB free list. */ free_list = &ipc_mux->ul_adb.free_list; diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux.h b/drivers/net/wwan/iosm/iosm_ipc_mux.h index ddd2cd0bd911..88debaa1ed31 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_mux.h +++ b/drivers/net/wwan/iosm/iosm_ipc_mux.h @@ -278,7 +278,6 @@ struct iosm_mux { struct ipc_mux_config { enum ipc_mux_protocol protocol; enum ipc_mux_ul_flow ul_flow; - int nr_sessions; int instance_id; }; diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c index bdb2d32cdb6d..40fb54a0513e 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c +++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c @@ -175,7 +175,7 @@ static int ipc_mux_dl_dlcmds_decode_process(struct iosm_mux *ipc_mux, switch (le32_to_cpu(cmdh->command_type)) { case MUX_LITE_CMD_FLOW_CTL: - if (cmdh->if_id >= ipc_mux->nr_sessions) { + if (cmdh->if_id >= IPC_MEM_MUX_IP_SESSION_ENTRIES) { dev_err(ipc_mux->dev, "if_id [%d] not valid", cmdh->if_id); return -EINVAL; /* No session interface id. */ @@ -307,13 +307,13 @@ static void ipc_mux_dl_fcth_decode(struct iosm_mux *ipc_mux, } if_id = fct->if_id; - if (if_id >= ipc_mux->nr_sessions) { + if (if_id >= IPC_MEM_MUX_IP_SESSION_ENTRIES) { dev_err(ipc_mux->dev, "not supported if_id: %d", if_id); return; } /* Is the session active ? */ - if_id = array_index_nospec(if_id, ipc_mux->nr_sessions); + if_id = array_index_nospec(if_id, IPC_MEM_MUX_IP_SESSION_ENTRIES); wwan = ipc_mux->session[if_id].wwan; if (!wwan) { dev_err(ipc_mux->dev, "session Net ID is NULL"); @@ -355,13 +355,13 @@ static void ipc_mux_dl_adgh_decode(struct iosm_mux *ipc_mux, } if_id = adgh->if_id; - if (if_id >= ipc_mux->nr_sessions) { + if (if_id >= IPC_MEM_MUX_IP_SESSION_ENTRIES) { dev_err(ipc_mux->dev, "invalid if_id while decoding %d", if_id); return; } /* Is the session active ? */ - if_id = array_index_nospec(if_id, ipc_mux->nr_sessions); + if_id = array_index_nospec(if_id, IPC_MEM_MUX_IP_SESSION_ENTRIES); wwan = ipc_mux->session[if_id].wwan; if (!wwan) { dev_err(ipc_mux->dev, "session Net ID is NULL"); @@ -538,7 +538,7 @@ static void ipc_mux_stop_tx_for_all_sessions(struct iosm_mux *ipc_mux) struct mux_session *session; int idx; - for (idx = 0; idx < ipc_mux->nr_sessions; idx++) { + for (idx = 0; idx < IPC_MEM_MUX_IP_SESSION_ENTRIES; idx++) { session = &ipc_mux->session[idx]; if (!session->wwan) @@ -563,7 +563,7 @@ static bool ipc_mux_lite_send_qlt(struct iosm_mux *ipc_mux) qlt_size = offsetof(struct ipc_mem_lite_gen_tbl, vfl) + MUX_QUEUE_LEVEL * sizeof(struct mux_lite_vfl); - for (i = 0; i < ipc_mux->nr_sessions; i++) { + for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++) { session = &ipc_mux->session[i]; if (!session->wwan || session->flow_ctl_mask) @@ -777,13 +777,13 @@ bool ipc_mux_ul_data_encode(struct iosm_mux *ipc_mux) ipc_mux->adb_prep_ongoing = true; - for (i = 0; i < ipc_mux->nr_sessions; i++) { + for (i = 0; i < IPC_MEM_MUX_IP_SESSION_ENTRIES; i++) { session_id = ipc_mux->rr_next_session; session = &ipc_mux->session[session_id]; /* Go to next handle rr_next_session overflow */ ipc_mux->rr_next_session++; - if (ipc_mux->rr_next_session >= ipc_mux->nr_sessions) + if (ipc_mux->rr_next_session >= IPC_MEM_MUX_IP_SESSION_ENTRIES) ipc_mux->rr_next_session = 0; if (!session->wwan || session->flow_ctl_mask || From patchwork Sun Dec 5 15:04:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657115 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F87BC433FE for ; Sun, 5 Dec 2021 14:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235112AbhLEPAq (ORCPT ); Sun, 5 Dec 2021 10:00:46 -0500 Received: from mga03.intel.com ([134.134.136.65]:20597 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235114AbhLEPAp (ORCPT ); Sun, 5 Dec 2021 10:00:45 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132502" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132502" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507307" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:14 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 5/7] net: wwan: iosm: removed unused function decl Date: Sun, 5 Dec 2021 20:34:53 +0530 Message-Id: <20211205150455.1829929-6-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ipc_wwan_tx_flowctrl() is declared in iosm_ipc_wwan.h but is not defined. Removed the dead code. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: No Change. --- drivers/net/wwan/iosm/iosm_ipc_wwan.h | 10 ---------- 1 file changed, 10 deletions(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.h b/drivers/net/wwan/iosm/iosm_ipc_wwan.h index 4925f22dff0a..a23e926398ff 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.h +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.h @@ -42,14 +42,4 @@ int ipc_wwan_receive(struct iosm_wwan *ipc_wwan, struct sk_buff *skb_arg, * */ void ipc_wwan_tx_flowctrl(struct iosm_wwan *ipc_wwan, int id, bool on); - -/** - * ipc_wwan_is_tx_stopped - Checks if Tx stopped for a Interface id. - * @ipc_wwan: Pointer to wwan instance - * @id: Ipc mux channel session id - * - * Return: true if stopped, false otherwise - */ -bool ipc_wwan_is_tx_stopped(struct iosm_wwan *ipc_wwan, int id); - #endif From patchwork Sun Dec 5 15:04:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657117 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEB2C433F5 for ; Sun, 5 Dec 2021 14:57:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbhLEPAr (ORCPT ); Sun, 5 Dec 2021 10:00:47 -0500 Received: from mga03.intel.com ([134.134.136.65]:20600 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235114AbhLEPAr (ORCPT ); Sun, 5 Dec 2021 10:00:47 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132505" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132505" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507324" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:17 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 6/7] net: wwan: iosm: AT port is not working while MBIM TX is ongoing Date: Sun, 5 Dec 2021 20:34:54 +0530 Message-Id: <20211205150455.1829929-7-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org ev_cdev_write_pending flag is preventing a TX message post for AT port while MBIM transfer is ongoing. Removed the unnecessary check around control port TX transfer. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: No Change. --- drivers/net/wwan/iosm/iosm_ipc_imem.c | 1 - drivers/net/wwan/iosm/iosm_ipc_imem.h | 3 --- drivers/net/wwan/iosm/iosm_ipc_imem_ops.c | 6 ------ 3 files changed, 10 deletions(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c index 96dcd2445bce..b947f548983a 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c @@ -1282,7 +1282,6 @@ struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id, ipc_imem->pci_device_id = device_id; - ipc_imem->ev_cdev_write_pending = false; ipc_imem->cp_version = 0; ipc_imem->device_sleep = IPC_HOST_SLEEP_ENTER_SLEEP; diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.h b/drivers/net/wwan/iosm/iosm_ipc_imem.h index d220f2611621..a8ec896f217b 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem.h +++ b/drivers/net/wwan/iosm/iosm_ipc_imem.h @@ -337,8 +337,6 @@ enum ipc_phase { * process the irq actions. * @flag: Flag to monitor the state of driver * @td_update_timer_suspended: if true then td update timer suspend - * @ev_cdev_write_pending: 0 means inform the IPC tasklet to pass - * the accumulated uplink buffers to CP. * @ev_mux_net_transmit_pending:0 means inform the IPC tasklet to pass * @reset_det_n: Reset detect flag * @pcie_wake_n: Pcie wake flag @@ -377,7 +375,6 @@ struct iosm_imem { u8 ev_irq_pending[IPC_IRQ_VECTORS]; unsigned long flag; u8 td_update_timer_suspended:1, - ev_cdev_write_pending:1, ev_mux_net_transmit_pending:1, reset_det_n:1, pcie_wake_n:1; diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c b/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c index 0757fd915437..28dfd4468760 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c +++ b/drivers/net/wwan/iosm/iosm_ipc_imem_ops.c @@ -42,7 +42,6 @@ void ipc_imem_sys_wwan_close(struct iosm_imem *ipc_imem, int if_id, static int ipc_imem_tq_cdev_write(struct iosm_imem *ipc_imem, int arg, void *msg, size_t size) { - ipc_imem->ev_cdev_write_pending = false; ipc_imem_ul_send(ipc_imem); return 0; @@ -51,11 +50,6 @@ static int ipc_imem_tq_cdev_write(struct iosm_imem *ipc_imem, int arg, /* Through tasklet to do sio write. */ static int ipc_imem_call_cdev_write(struct iosm_imem *ipc_imem) { - if (ipc_imem->ev_cdev_write_pending) - return -1; - - ipc_imem->ev_cdev_write_pending = true; - return ipc_task_queue_send_task(ipc_imem, ipc_imem_tq_cdev_write, 0, NULL, 0, false); } From patchwork Sun Dec 5 15:04:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, M Chetan" X-Patchwork-Id: 12657119 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B9AC433F5 for ; Sun, 5 Dec 2021 14:57:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235115AbhLEPAu (ORCPT ); Sun, 5 Dec 2021 10:00:50 -0500 Received: from mga03.intel.com ([134.134.136.65]:20600 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235138AbhLEPAu (ORCPT ); Sun, 5 Dec 2021 10:00:50 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10188"; a="237132509" X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="237132509" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 06:57:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,289,1631602800"; d="scan'208";a="514507330" Received: from ccgwwan-desktop15.iind.intel.com ([10.224.174.19]) by fmsmga007.fm.intel.com with ESMTP; 05 Dec 2021 06:57:20 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com Subject: [PATCH V2 net-next 7/7] net: wwan: iosm: correct open parenthesis alignment Date: Sun, 5 Dec 2021 20:34:55 +0530 Message-Id: <20211205150455.1829929-8-m.chetan.kumar@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> References: <20211205150455.1829929-1-m.chetan.kumar@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix checkpatch warning in iosm_ipc_mmio.c - Alignment should match open parenthesis Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov --- v2: No Change. --- drivers/net/wwan/iosm/iosm_ipc_mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/net/wwan/iosm/iosm_ipc_mmio.c b/drivers/net/wwan/iosm/iosm_ipc_mmio.c index 09f94c123531..f09e5e77a2a5 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_mmio.c +++ b/drivers/net/wwan/iosm/iosm_ipc_mmio.c @@ -192,7 +192,7 @@ void ipc_mmio_config(struct iosm_mmio *ipc_mmio) iowrite64(0, ipc_mmio->base + ipc_mmio->offset.ap_win_end); iowrite64(ipc_mmio->context_info_addr, - ipc_mmio->base + ipc_mmio->offset.context_info); + ipc_mmio->base + ipc_mmio->offset.context_info); } void ipc_mmio_set_psi_addr_and_size(struct iosm_mmio *ipc_mmio, dma_addr_t addr,