From patchwork Thu Aug 22 09:33:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jijie Shao X-Patchwork-Id: 13773139 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A747F183088; Thu, 22 Aug 2024 09:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724319583; cv=none; b=gViaqjKtOzbUBN158hPjCLqMqGz+4ob6PrGyF1539s2leCMi1u19wL+B+R4leMW91For5p5Ke5aaTCnr3H91VXBgiL6qXo5tGdkaIutW+F/AyOucXJzX0jRNw4TVH1Y7ovd8k2Sw0diBQ5mrVxjUzm1ZNUqcfPfqxz1dlCk+xVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724319583; c=relaxed/simple; bh=IaBV2fy+tOz4b95RBhGxRaNp0ZxSUJwHNOjBGVcRa+g=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S5N+e6SrCguXh1MJXDXAIxml8HB45UJBF9RrFCBWfuoeLfJ5jjmaKVHyHzE4vl1fK8GPDOB9a9WpB1+qH1zIDlB9nlpjGp2Je213HfQ9ySMeysM2A7bxMgM0mwbcE49wJ2yAXDaiU+r5wMkEtdXe1bJkxHwnm18U0WS3D1bFRMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WqJ7K2jczzyR0r; Thu, 22 Aug 2024 17:39:09 +0800 (CST) Received: from kwepemm000007.china.huawei.com (unknown [7.193.23.189]) by mail.maildlp.com (Postfix) with ESMTPS id 10E21140360; Thu, 22 Aug 2024 17:39:33 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 22 Aug 2024 17:39:32 +0800 From: Jijie Shao To: , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH V3 net-next 00/11] Add support of HIBMCGE Ethernet Driver Date: Thu, 22 Aug 2024 17:33:23 +0800 Message-ID: <20240822093334.1687011-1-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm000007.china.huawei.com (7.193.23.189) X-Patchwork-Delegate: kuba@kernel.org This patch set adds the support of Hisilicon BMC Gigabit Ethernet Driver. This patch set includes basic Rx/Tx functionality. It also includes the registration and interrupt codes. This work provides the initial support to the HIBMCGE and would incrementally add features or enhancements. --- ChangeLog: v2 -> v3: - Add "select PHYLIB" in Kconfig, reported by Jakub. - Use ndo_validate_addr() instead of is_valid_ether_addr() in dev_set_mac_address(), suggested by Jakub and Andrew. v2: https://lore.kernel.org/all/20240820140154.137876-1-shaojijie@huawei.com/ v1 -> v2: - fix build errors reported by kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202408192219.zrGff7n1-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202408200026.q20EuSHC-lkp@intel.com/ v1: https://lore.kernel.org/all/20240819071229.2489506-1-shaojijie@huawei.com/ RFC v2 -> v1: - Use FIELD_PREP/FIELD_GET instead of union, suggested by Andrew. - Delete unnecessary defensive code, suggested by Andrew. - A few other minor changes. RFC v2: https://lore.kernel.org/all/20240813135640.1694993-1-shaojijie@huawei.com/ RFC v1 -> RFC v2: - Replace linkmode_copy() with phy_remove_link_mode() to simplify the PHY configuration process, suggested by Andrew. - Delete hbg_get_link_status() from the scheduled task, suggested by Andrew. - Delete validation for mtu in hbg_net_change_mtu(), suggested by Andrew. - Delete validation for mac address in hbg_net_set_mac_address(), suggested by Andrew. - Use napi_complete_done() to simplify the process, suggested by Joe Damato. - Use ethtool_op_get_link(), phy_ethtool_get_link_ksettings(), and phy_ethtool_set_link_ksettings() to simplify the code, suggested by Andrew. - Add the null pointer check on the return value of pcim_iomap_table(), suggested by Jonathan. - Add the check on the return value of phy_connect_direct(), suggested by Jonathan. - Adjusted the layout to place the fields and register definitions in one place, suggested by Jonathan. - Replace request_irq with devm_request_irq, suggested by Jonathan. - Replace BIT_MASK() with BIT(), suggested by Jonathan. - Introduce irq_handle in struct hbg_irq_info in advance to reduce code changes, suggested by Jonathan. - Delete workqueue for this patch set, suggested by Jonathan. - Support to compile this driver on all arch in Kconfig, suggested by Andrew and Jonathan. - Add a patch to add is_valid_ether_addr check in dev_set_mac_address, suggested by Andrew. - Use macro instead of inline to fix the warning about compile-time constant in FIELD_PREP(), reported by Simon Horman. - A few other minor changes. RFC v1: https://lore.kernel.org/all/20240731094245.1967834-1-shaojijie@huawei.com/ --- Jijie Shao (11): net: hibmcge: Add pci table supported in this module net: hibmcge: Add read/write registers supported through the bar space net: hibmcge: Add mdio and hardware configuration supported in this module net: hibmcge: Add interrupt supported in this module net: hibmcge: Implement some .ndo functions net: hibmcge: Implement .ndo_start_xmit function net: hibmcge: Implement rx_poll function to receive packets net: hibmcge: Implement some ethtool_ops functions net: hibmcge: Add a Makefile and update Kconfig for hibmcge net: hibmcge: Add maintainer for hibmcge net: add ndo_validate_addr check in dev_set_mac_address MAINTAINERS | 7 + drivers/net/ethernet/hisilicon/Kconfig | 16 +- drivers/net/ethernet/hisilicon/Makefile | 1 + .../net/ethernet/hisilicon/hibmcge/Makefile | 10 + .../ethernet/hisilicon/hibmcge/hbg_common.h | 138 ++++++ .../ethernet/hisilicon/hibmcge/hbg_ethtool.c | 17 + .../ethernet/hisilicon/hibmcge/hbg_ethtool.h | 11 + .../net/ethernet/hisilicon/hibmcge/hbg_hw.c | 285 ++++++++++++ .../net/ethernet/hisilicon/hibmcge/hbg_hw.h | 57 +++ .../net/ethernet/hisilicon/hibmcge/hbg_irq.c | 123 ++++++ .../net/ethernet/hisilicon/hibmcge/hbg_irq.h | 11 + .../net/ethernet/hisilicon/hibmcge/hbg_main.c | 241 ++++++++++ .../net/ethernet/hisilicon/hibmcge/hbg_mdio.c | 251 +++++++++++ .../net/ethernet/hisilicon/hibmcge/hbg_mdio.h | 13 + .../net/ethernet/hisilicon/hibmcge/hbg_reg.h | 143 ++++++ .../net/ethernet/hisilicon/hibmcge/hbg_txrx.c | 418 ++++++++++++++++++ .../net/ethernet/hisilicon/hibmcge/hbg_txrx.h | 37 ++ net/core/dev.c | 5 + 18 files changed, 1783 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/Makefile create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_common.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_mdio.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_reg.h create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c create mode 100644 drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.h