Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1077890pxb; Tue, 9 Nov 2021 04:54:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1rtQ/SEVQeuGUfZUPL9ZLNAjsEOxp77tpLn9KFQwox5khqds4s94yQ99AqLtuy0xBXJtv X-Received: by 2002:a17:906:a1c1:: with SMTP id bx1mr9282309ejb.447.1636462440940; Tue, 09 Nov 2021 04:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636462440; cv=none; d=google.com; s=arc-20160816; b=Y44tc2a1VLc+Td0vimh9otxRLxbWJLOQZ5BCa01PIxPhBaLlRxsDE3LMSXrO0qsnhA ait7A3teDNoC3CB55aLET0HgYihqjV8uvB7O4aWiRFY6u2VK0m6WL5R8oH+T1dP5D5k6 XXEX2KXmjY4KpEN9VNKtTz03mNcAyCwYKrj4Fo48+R4C/Zo2xVPQcKwzifusb1A9kfcC e0Wj6K/lH6P/eF4Io/FWZ3dDHU95fBm2onl7AjHFCmnuOkT3Ujxno1EAxvRu0Kdm83cl ysG+BIPvmj4mJ1znvNhcBpPf8b++g4/o+tBctYlgrwXFQ8if9kcyn6xuYfaLk+PUbbpS igYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=qY359uXYjIZMqlKlT3i7/2v2iwXfbnbV3yvaX0zgmbQ=; b=jEnKtK1d1PnsBaEwnjNcXaXxZOlcRd005+lV3gAAtaPy2o+/Z4JvQey54H3jMNFOn8 DSAMhmAZsx0TLC0cX2ed6T32oaLuiOiY+atJfI61ARnHG3RmYjnQvS7gN3pRQEKWzhXa tknR0uuhsLt0q4SyKrR/u2f9uplQ2yEmF+ZlAXp6UI28X7qVJ0/Uc+1vrp7KJeOaBeCi Xvo5QljQAECAr+ETZGLOBf4xGfrP17uH9gCr1MEYUpSGbLWdKt0+QMRvUnd9pF0OoaYi Fkz93SUNO9pM9/4frp0Kh60eyBhlSJiFTyDUdnb8YVd44kXxX9VepfDTM1/sb6k2Dba5 Fvrw== 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 dd14si22074085ejc.136.2021.11.09.04.53.44; Tue, 09 Nov 2021 04:54:00 -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 S239280AbhKIF3k (ORCPT + 68 others); Tue, 9 Nov 2021 00:29:40 -0500 Received: from mga07.intel.com ([134.134.136.100]:20273 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236593AbhKIF3j (ORCPT ); Tue, 9 Nov 2021 00:29:39 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="295819953" X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="295819953" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 21:26:53 -0800 X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="533569381" Received: from rmarti10-mobl1.amr.corp.intel.com (HELO [10.212.187.241]) ([10.212.187.241]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 21:26:53 -0800 Message-ID: <27811a97-6368-dab2-5163-cbd0169b8666@linux.intel.com> Date: Mon, 8 Nov 2021 21:26:37 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH v2 00/14] net: wwan: t7xx: PCIe driver for MediaTek M.2 modem Content-Language: en-US To: Sergey Ryazanov Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Jakub Kicinski , David Miller , Johannes Berg , Loic Poulain , M Chetan Kumar , chandrashekar.devegowda@intel.com, Intel Corporation , chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, amir.hanania@intel.com, Andy Shevchenko , dinesh.sharma@intel.com, eliot.lee@intel.com, mika.westerberg@linux.intel.com, moises.veleta@intel.com, pierre-louis.bossart@intel.com, muralidharan.sethuraman@intel.com, Soumya.Prakash.Mishra@intel.com, sreehari.kancharla@intel.com, suresh.nagaraj@intel.com References: <20211101035635.26999-1-ricardo.martinez@linux.intel.com> From: "Martinez, Ricardo" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 11/6/2021 11:10 AM, Sergey Ryazanov wrote: > Hello Ricardo, > > On Mon, Nov 1, 2021 at 6:57 AM Ricardo Martinez > wrote: ... > Nice work! The driver generally looks good for me. But at the same > time the driver looks a bit raw, needs some style and functionality > improvements, and a lot of cleanup. Please find general thoughts below > and per-patch comments. Thanks for the feedback Sergey, we will work on it. > > A one nitpick that is common for the entire series. Please consider > using a common prefix for all driver function names (e.g. t7xx_) to > make them more specific. This should improve the code readability. > Thus, any reader will know for sure that the called functions belong > to the driver, and not to a generic kernel API. E.g. use the > t7xx_cldma_hw_init() name for the CLDMA initialization function > instead of the too generic cldma_hw_init() name, etc. Does this apply to static functions as well? > > Interestingly, that you are using the common 't7xx_' prefix for all > driver file names. This is Ok, but it does not add to the specifics as > all driver files are already located in a common directory with the > specific name. But function names at the same time lack a common > prefix. > > Another common drawback is that the driver should break as soon as two > modems are connected simultaneously. This should happen due to the use > of multiple _global_ variables that keeps pointers to a modem runtime > state. Out of curiosity, did you test the driver with two or more > modems connected simultaneously? We haven't tested such configurations, we are focusing on platforms with one single modem. > > Next, the driver entirely lacks the multibyte field endians handling. > Looks like it will be unable to run on a big-endians CPU. To fix this, > it is needed to find all the structures that are passed to the modem > and replace the multibyte fields of types u16/u32 with __le16/__le32. > Then examine all the field accesses and use > cpu_to_le{16,32}()/le{16,32}_to_cpu() to update/read field contents. > As soon as you change the types to __le16/__le32, sparse (a static > analyzing utility) will warn you about every unsafe field access. Just > build your kernel with make C=1. > > Ricardo, please consider submitting at the next iteration a patch > series with the driver that will be cleaned from debug stuff and > questionable optimizations. Just a bare minimum functional: AT/MBIM > control ports and network interface for data communications. This will > cut the code in half. What will greatly facilitate the reviewing > process. And then extend the driver functionality with follow up > patches. > > -- > Sergey >