Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1009995lqm; Thu, 2 May 2024 02:31:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7OxJTgK5ctOfYH1oIT5qDfzRMcLZYFY+AB7wA8OncCbGMNaabJVmhfvXtbJh7+ngq3Hy+nUBaC0qloobgz8tW2IR4WL9/El2AWB65bA== X-Google-Smtp-Source: AGHT+IEMfBn/03MAMh2Z3hJoZwBacq0AtmHvJLhoofyC23P1g/Oe/KRmqT3iHKMTtuN8+ALx/J9E X-Received: by 2002:a17:903:2304:b0:1ea:964f:9b0b with SMTP id d4-20020a170903230400b001ea964f9b0bmr3888868plh.5.1714642264126; Thu, 02 May 2024 02:31:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714642264; cv=pass; d=google.com; s=arc-20160816; b=o7L9O65JMuLs9+AmFdHB2XjbcSOG7gZ5AxigqxyjPK/0q00k4yy7waGcWG4LpZdD9E bXoXaRSVwOoml4Mz9cB/0fBC8aZdWIqe2TcMYY2sbDPYjT6YUoiDNUCnNn0MZv2H1Q/5 f9noDanVceFlW0a+EXWBMEc3UNvxhHH6abxdNST6wyhEUWWC8s7IM/wl9Y9kSeXNPFZG L17ismGVsreN5A77qCt8YK8I3Uwx1E2VpEjII9YCtbnIOdV4CiJZTtQd8A5g3IMdWAuA oTaxNDDooPlAlHsm1zQIA0+2nO5S85AuB+PbDrsoRrTcKKyWUXFpR0INrx0wqHBLVb/A hfwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=JNoA+lEDrly/YUcp98UweisbJXEAo7IAo3WgWHao9A8=; fh=7fGmPDBGig1mWQld28CGpF1raS0K9tsA2ebmmPmAFKc=; b=XOkUc8OUsqD6LZzm1Lr3rYCkswdlZgYZ4WPUvA+HmGy5/ztYxexwnpQujwRvW5Xapf +dURPc3d2XHXUZAR24xQi0q8gDAY/eJyOUzuEPoVeOGbvTU83ZRb5vv7ApwoECVH5H4r xm8YPj5HSpam5qH0TTf9XvmpdrJnO7yOzq5h38CcGbA5unaLXjrxRzEDCFTN2qpPiz4T XoLrbRmsrKTBiFBKbKiUMCTYLlOyPJGYsUW2ymjzGMnewZHygb/kQ5f34sMUOOQZLKRe zOedQXZc6YeTDzwSJNvx13Vciu3Lg6LCGWwpIQK15Fl/wIeUXC+0c0hSM5fq52//QHvH saAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-166197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166197-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc13-20020a1709032b0d00b001eb3dafebaasi683991plb.67.2024.05.02.02.31.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 02:31:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-166197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166197-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 84BC7285C65 for ; Thu, 2 May 2024 09:20:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1780354FB8; Thu, 2 May 2024 09:19:37 +0000 (UTC) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 268CE54BE7; Thu, 2 May 2024 09:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714641576; cv=none; b=NYTzpKIv0i/g9b+NEQ1knF3YGZiiplhV9zlNjj+gDZN8P3+/rGpqpsBfJcyWQZL7vCrpdW5enpAXYW9H1uY4tdkIbbYNxOxFMyxOAhYCNW9A9UUQHGgvCLI2Er317AFMYi2dLiP9dDz9zvJjNwP6fFKZLxMSDkPL8D7HBc9Pc4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714641576; c=relaxed/simple; bh=SGYPtRW6iBf8mBHh0qDfuYqiwMqL1utxVOaxNqH3anA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=I5KcTMkT93jf8Ee6TpicUAILaCmcrTIN0JdQmpN1BhPtUyaryLlmCsKtZUnyu/3C47n7PUQVPfh5AlxmmeBoqzJxYGzBbVDbSihPwHKI0cH0DiCCWdHgLX3uFyUegSVgYeofhN1xQw/gmKGCwLOOHpvnPHJHUKG1vYd4M6TcR8Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4429J1p442330621, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 4429J1p442330621 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 May 2024 17:19:02 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 2 May 2024 17:19:02 +0800 Received: from RTDOMAIN (172.21.210.160) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 2 May 2024 17:19:01 +0800 From: Justin Lai To: CC: , , , , , , , , , "Justin Lai" Subject: [PATCH net-next v17 00/13] Add Realtek automotive PCIe driver Date: Thu, 2 May 2024 17:18:34 +0800 Message-ID: <20240502091847.65181-1-justinlai0215@realtek.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback This series includes adding realtek automotive ethernet driver and adding rtase ethernet driver entry in MAINTAINERS file. This ethernet device driver for the PCIe interface of Realtek Automotive Ethernet Switch,applicable to RTL9054, RTL9068, RTL9072, RTL9075, RTL9068, RTL9071. v1 -> v2: - Remove redundent debug message. - Modify coding rule. - Remove other function codes not related to netdev. v2 -> v3: - Remove SR-IOV function - We will add the SR-IOV function together when uploading the vf driver in the future. - Remove other unnecessary code and macro. v3 -> v4: - Remove function prototype - Our driver does not use recursion, so we have reordered the code and removed the function prototypes. - Define macro precisely - Improve macro code readability to make the source code cleaner. v4 -> v5: - Modify ethtool function - Remove some unnecessary code. - Don't use inline function - Let the compiler decide. v5 -> v6: - Some old macro definitions have been removed and replaced with the lastest usage. - Replace s32 with int to ensure consistency. - Clearly point out the objects of the service and remove unnecessary struct. v6 -> v7: - Split this driver into multiple patches. - Reorganize this driver code and remove redundant code to make this driver more concise. v7 -> v8: - Add the function to calculate time mitigation and the function to calculate packet number mitigation. Users can use these two functions to calculate the reg value that needs to be set for the mitigation value they want to set. - This device is usually used in automotive embedded systems. The page pool api will use more memory in receiving packets and requires more verification, so we currently do not plan to use it in this patch. v8 -> v9: - Declare functions that are not extern as static functions and increase the size of the character array named name in the rtase_int_vector struct to correct the build warning noticed by the kernel test robot. v9 -> v10: - Currently we change to use the page pool api. However, when we allocate more than one page to an rx buffer, it will cause system errors in some cases. Therefore, we set the rx buffer to fixed size with 3776 (PAGE_SIZE - SKB_DATA_ALIGN(sizeof(skb_shared_info) )), and the maximum value of mtu is set to 3754(rx buffer size - VLAN_ETH_HLEN - ETH_FCS_LEN). - When ndo_tx_timeout is called, it will dump some device information, which can be used for debugging. - When the mtu is greater than 1500, the device supports checksums but not TSO. - Fix compiler warnning. v10 -> v11: - Added error handling of rtase_init_ring(). - Modify the error related to asymmetric pause in rtase_get_settings. - Fix compiler error. v11 -> v12: - Use pm_sleep_ptr and related macros. - Remove multicast filter limit. - Remove VLAN support and CBS offload functions. - Remove redundent code. - Fix compiler warnning. v12 -> v13: - Fixed the compiler warning of unuse rtase_suspend() and rtase_resume() when there is no define CONFIG_PM_SLEEP. v13 -> v14: - Remove unuse include. - call eth_hw_addr_random() to generate random MAC and set device flag - use pci_enable_msix_exact() instead of pci_enable_msix_range() - If dev->dma_mask is non-NULL, dma_set_mask_and_coherent with a 64-bit mask will never fail, so remove the part that determines the 32-bit mask. - set dev->pcpu_stat_type before register_netdev() and core will allocate stats - call NAPI instance at the right location v14 -> v15: - In rtase_open, when the request interrupt fails, all request interrupts are freed. - When calling netif_device_detach, there is no need to call netif_stop_queue. - Call netif_tx_disable() instead of stop_queue(), it takes the tx lock so there is no need to worry about the packets being transmitted. - In rtase_tx_handler, napi budget is no longer used, but a customized tx budget is used. - Use the start / stop macros from include/net/netdev_queues.h. - Remove redundent code. v15 -> v16: - Re-upload v15 patch set v16 -> v17: - Prefix the names of some rtase-specific macros, structs, and enums. - Fix the abnormal problem when returning page_pool resources. Justin Lai (13): rtase: Add pci table supported in this module rtase: Implement the .ndo_open function rtase: Implement the rtase_down function rtase: Implement the interrupt routine and rtase_poll rtase: Implement hardware configuration function rtase: Implement .ndo_start_xmit function rtase: Implement a function to receive packets rtase: Implement net_device_ops rtase: Implement pci_driver suspend and resume function rtase: Implement ethtool function rtase: Add a Makefile in the rtase folder realtek: Update the Makefile and Kconfig in the realtek folder MAINTAINERS: Add the rtase ethernet driver entry MAINTAINERS | 7 + drivers/net/ethernet/realtek/Kconfig | 17 + drivers/net/ethernet/realtek/Makefile | 1 + drivers/net/ethernet/realtek/rtase/Makefile | 10 + drivers/net/ethernet/realtek/rtase/rtase.h | 326 +++ .../net/ethernet/realtek/rtase/rtase_main.c | 2326 +++++++++++++++++ 6 files changed, 2687 insertions(+) create mode 100644 drivers/net/ethernet/realtek/rtase/Makefile create mode 100644 drivers/net/ethernet/realtek/rtase/rtase.h create mode 100644 drivers/net/ethernet/realtek/rtase/rtase_main.c -- 2.34.1