Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp851191pxu; Mon, 23 Nov 2020 05:54:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJXrdYogwwJ4iWT2l+0jGjpLRmJIf6T/qi/T54xCZDG6Q+zMQ/RzEAZhlj+XxrxEkly7ZO X-Received: by 2002:a50:9e05:: with SMTP id z5mr45243794ede.231.1606139648394; Mon, 23 Nov 2020 05:54:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606139648; cv=none; d=google.com; s=arc-20160816; b=oSFFz9JF7OyJtjZ8wYj4EKoeL2VZWzK8ds8i2GqUOzWOztRTIFy2Jx8I170hNH+AhA Roy4Uoz/ynA1l45FggWOiD6apjT3Tynun+fJ93PLwcgCMCiI/0+yqb0XWW8xSl6B6Juv 6uEKUja3fBd8U4LWM0VlR/tz3/lh1BgvzVNQjGnKQ6OBseP7CfGStSAGsqv+DtTnBHcQ 5UghQVcxWZXERmlLBK2Hs9wA+5FtOiQ2UjRBWKZnXQEzo4HpJFcPVCBqmPqaTbNjdecX D3ETAW130wyvpXjFjP+kclR18CGOU4mE87fkti7XS8gAMdbWIkQtmreohIjyePoAP1tG fSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=6VcuEk67+8QszccbssCuRLCvz5H8o+D0jtZORsj2wSM=; b=Oc3HmHwr6xTtk2YtICCNyyTmzOrCKDEsyuRaRJQFf7UIQVA+8S/V+cQ00FpjoFcf/H +coAh8Hs3kbGkKr4ZTJRvh9KJNe/DuZORrWhxWr5UMfkujeWDOLuwQp80Z9gHFx/YgQ/ tH5N5zcs4FMyIKV0W7Sl6RbBDb4Ro1SAL9LFXQfkOnub6AWf21U9YGLEMFlClaqpjaHM s3M2KGuFf6e5OVrul8+f4i3qaTYuvSl/D2jCsdi0SX9v97TzLn+tXAqhKzBPRxOVS0dc n1Ip5OsM2zDNf0+KKynbY/eS3SRAOETYzEckxr6hLvjwQY/MqH7G1FoWo1rzzcl2nqC7 utYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si6631830ejd.405.2020.11.23.05.53.45; Mon, 23 Nov 2020 05:54:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730420AbgKWNwI (ORCPT + 99 others); Mon, 23 Nov 2020 08:52:08 -0500 Received: from mga14.intel.com ([192.55.52.115]:1467 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729455AbgKWNwI (ORCPT ); Mon, 23 Nov 2020 08:52:08 -0500 IronPort-SDR: 9oNPYpQ/hQ7GONH9hdopINc2cjMN1ZIUm4mTI4BJu7rP0RlsRy2zUsSJIY6KoEfIBCarCfFQwQ qO+Pww0bj5og== X-IronPort-AV: E=McAfee;i="6000,8403,9813"; a="170981443" X-IronPort-AV: E=Sophos;i="5.78,363,1599548400"; d="scan'208";a="170981443" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2020 05:52:07 -0800 IronPort-SDR: ivSJz+DRauJHWcZOiHlUVA1pmrYSRG6vabiZ5FJSg/rB/j8ltufTPMUR/GfAKgOsUPhFDAzD1g 80lljeIl+CbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,363,1599548400"; d="scan'208";a="370035530" Received: from bgsxx0031.iind.intel.com ([10.106.222.40]) by orsmga007.jf.intel.com with ESMTP; 23 Nov 2020 05:52:05 -0800 From: M Chetan Kumar To: netdev@vger.kernel.org, linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, krishna.c.sudi@intel.com, m.chetan.kumar@intel.com Subject: [RFC 06/18] net: iosm: channel configuration Date: Mon, 23 Nov 2020 19:21:11 +0530 Message-Id: <20201123135123.48892-7-m.chetan.kumar@intel.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20201123135123.48892-1-m.chetan.kumar@intel.com> References: <20201123135123.48892-1-m.chetan.kumar@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Defines pipes & channel configurations like channel type, pipe mappings, No. of transfer descriptors and transfer buffer size etc. Signed-off-by: M Chetan Kumar --- drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c | 87 +++++++++++++++++++++++++++++++ drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h | 57 ++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c create mode 100644 drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h diff --git a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c new file mode 100644 index 000000000000..d1d239218494 --- /dev/null +++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 Intel Corporation. + */ + +#include "iosm_ipc_chnl_cfg.h" + +/* Max. sizes of a downlink buffers */ +#define IPC_MEM_MAX_DL_FLASH_BUF_SIZE (16 * 1024) +#define IPC_MEM_MAX_DL_LOOPBACK_SIZE (1 * 1024 * 1024) +#define IPC_MEM_MAX_DL_AT_BUF_SIZE 2048 +#define IPC_MEM_MAX_DL_RPC_BUF_SIZE (32 * 1024) +#define IPC_MEM_MAX_DL_MBIM_BUF_SIZE IPC_MEM_MAX_DL_RPC_BUF_SIZE + +/* Max. transfer descriptors for a pipe. */ +#define IPC_MEM_MAX_TDS_FLASH_DL 3 +#define IPC_MEM_MAX_TDS_FLASH_UL 6 +#define IPC_MEM_MAX_TDS_AT 4 +#define IPC_MEM_MAX_TDS_RPC 4 +#define IPC_MEM_MAX_TDS_MBIM IPC_MEM_MAX_TDS_RPC +#define IPC_MEM_MAX_TDS_LOOPBACK 11 + +/* Accumulation backoff usec */ +#define IRQ_ACC_BACKOFF_OFF 0 + +/* MUX acc backoff 1ms */ +#define IRQ_ACC_BACKOFF_MUX 1000 + +/* Modem channel configuration table + * Always reserve element zero for flash channel. + */ +static struct ipc_chnl_cfg modem_cfg[] = { + /* FLASH Channel */ + { IPC_MEM_FLASH_CH_ID, IPC_MEM_PIPE_0, IPC_MEM_PIPE_1, + IPC_MEM_MAX_TDS_FLASH_UL, IPC_MEM_MAX_TDS_FLASH_DL, + IPC_MEM_MAX_DL_FLASH_BUF_SIZE }, + /* MBIM Channel */ + { IPC_MEM_MBIM_CTRL_CH_ID, IPC_MEM_PIPE_12, IPC_MEM_PIPE_13, + IPC_MEM_MAX_TDS_MBIM, IPC_MEM_MAX_TDS_MBIM, + IPC_MEM_MAX_DL_MBIM_BUF_SIZE }, + /* RPC - 0 */ + { IPC_WWAN_DSS_ID_0, IPC_MEM_PIPE_2, IPC_MEM_PIPE_3, + IPC_MEM_MAX_TDS_RPC, IPC_MEM_MAX_TDS_RPC, + IPC_MEM_MAX_DL_RPC_BUF_SIZE }, + /* IAT0 */ + { IPC_WWAN_DSS_ID_1, IPC_MEM_PIPE_4, IPC_MEM_PIPE_5, IPC_MEM_MAX_TDS_AT, + IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_DL_AT_BUF_SIZE }, + /* IAT1 */ + { IPC_WWAN_DSS_ID_2, IPC_MEM_PIPE_8, IPC_MEM_PIPE_9, IPC_MEM_MAX_TDS_AT, + IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_DL_AT_BUF_SIZE }, + /* Loopback */ + { IPC_WWAN_DSS_ID_3, IPC_MEM_PIPE_10, IPC_MEM_PIPE_11, + IPC_MEM_MAX_TDS_LOOPBACK, IPC_MEM_MAX_TDS_LOOPBACK, + IPC_MEM_MAX_DL_LOOPBACK_SIZE }, + /* Trace */ + { IPC_WWAN_DSS_ID_4, IPC_MEM_PIPE_6, IPC_MEM_PIPE_7, IPC_MEM_TDS_TRC, + IPC_MEM_TDS_TRC, IPC_MEM_MAX_DL_TRC_BUF_SIZE }, + /* IP Mux */ + { IPC_MEM_MUX_IP_CH_VLAN_ID, IPC_MEM_PIPE_0, IPC_MEM_PIPE_1, + IPC_MEM_MAX_TDS_MUX_LITE_UL, IPC_MEM_MAX_TDS_MUX_LITE_DL, + IPC_MEM_MAX_DL_MUX_LITE_BUF_SIZE }, +}; + +int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index, + enum ipc_mux_protocol mux_protocol) +{ + int array_size = ARRAY_SIZE(modem_cfg); + + if (index >= array_size) { + pr_err("index: %d and array_size %d", index, array_size); + return -1; + } + + if (index == IPC_MEM_MUX_IP_CH_VLAN_ID) + chnl_cfg->accumulation_backoff = IRQ_ACC_BACKOFF_MUX; + else + chnl_cfg->accumulation_backoff = IRQ_ACC_BACKOFF_OFF; + + chnl_cfg->ul_nr_of_entries = modem_cfg[index].ul_nr_of_entries; + chnl_cfg->dl_nr_of_entries = modem_cfg[index].dl_nr_of_entries; + chnl_cfg->dl_buf_size = modem_cfg[index].dl_buf_size; + chnl_cfg->id = modem_cfg[index].id; + chnl_cfg->ul_pipe = modem_cfg[index].ul_pipe; + chnl_cfg->dl_pipe = modem_cfg[index].dl_pipe; + + return 0; +} diff --git a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h new file mode 100644 index 000000000000..42ba4e4849bb --- /dev/null +++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0-only + * + * Copyright (C) 2020 Intel Corporation + */ + +#ifndef IOSM_IPC_CHNL_CFG_H +#define IOSM_IPC_CHNL_CFG_H + +#include "iosm_ipc_mux.h" + +/* Number of TDs on the trace channel */ +#define IPC_MEM_TDS_TRC 32 + +/* Trace channel TD buffer size. */ +#define IPC_MEM_MAX_DL_TRC_BUF_SIZE 8192 + +/* Type of the WWAN ID */ +enum ipc_wwan_id { + IPC_WWAN_DSS_ID_0 = 257, + IPC_WWAN_DSS_ID_1, + IPC_WWAN_DSS_ID_2, + IPC_WWAN_DSS_ID_3, + IPC_WWAN_DSS_ID_4, +}; + +/** + * struct ipc_chnl_cfg - IPC channel configuration structure + * @id: VLAN ID + * @ul_pipe: Uplink datastream + * @dl_pipe: Downlink datastream + * @ul_nr_of_entries: Number of Transfer descriptor uplink pipe + * @dl_nr_of_entries: Number of Transfer descriptor downlink pipe + * @dl_buf_size: Downlink buffer size + * @accumulation_backoff: Time in usec for data accumalation + */ +struct ipc_chnl_cfg { + int id; + u32 ul_pipe; + u32 dl_pipe; + u32 ul_nr_of_entries; + u32 dl_nr_of_entries; + u32 dl_buf_size; + u32 accumulation_backoff; +}; + +/** + * ipc_chnl_cfg_get - Get pipe configuration. + * @chnl_cfg: Array of ipc_chnl_cfg struct + * @index: Channel index (upto MAX_CHANNELS) + * @mux_protocol: Active mux protocol + * + * Return: 0 on success and -1 on failure + */ +int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index, + enum ipc_mux_protocol mux_protocol); + +#endif -- 2.12.3