[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4292a69-6956-4028-b5a2-c1b54893718f@lunn.ch>
Date: Mon, 9 Dec 2024 14:40:55 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Tian Xin <tianx@...silicon.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, weihg@...silicon.com
Subject: Re: [PATCH 08/16] net-next/yunsilicon: Add ethernet interface
On Mon, Dec 09, 2024 at 03:10:53PM +0800, Tian Xin wrote:
> From: Xin Tian <tianx@...silicon.com>
>
> Build a basic netdevice driver
>
> Signed-off-by: Xin Tian <tianx@...silicon.com>
> Signed-off-by: Honggang Wei <weihg@...silicon.com>
> Signed-off-by: Lei Yan <jacky@...silicon.com>
> ---
> drivers/net/ethernet/yunsilicon/Makefile | 2 +-
> .../ethernet/yunsilicon/xsc/common/xsc_core.h | 1 +
> .../net/ethernet/yunsilicon/xsc/net/main.c | 135 ++++++++++++++++++
> .../net/ethernet/yunsilicon/xsc/net/xsc_eth.h | 16 +++
> .../yunsilicon/xsc/net/xsc_eth_common.h | 15 ++
> 5 files changed, 168 insertions(+), 1 deletion(-)
> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/main.c
> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth.h
> create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_common.h
>
> diff --git a/drivers/net/ethernet/yunsilicon/Makefile b/drivers/net/ethernet/yunsilicon/Makefile
> index 950fd2663..c1d3e3398 100644
> --- a/drivers/net/ethernet/yunsilicon/Makefile
> +++ b/drivers/net/ethernet/yunsilicon/Makefile
> @@ -4,5 +4,5 @@
> # Makefile for the Yunsilicon device drivers.
> #
>
> -# obj-$(CONFIG_YUNSILICON_XSC_ETH) += xsc/net/
> +obj-$(CONFIG_YUNSILICON_XSC_ETH) += xsc/net/
> obj-$(CONFIG_YUNSILICON_XSC_PCI) += xsc/pci/
> \ No newline at end of file
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> index 88d4c5654..5d2b28e2e 100644
> --- a/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> +++ b/drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h
> @@ -498,6 +498,7 @@ struct xsc_core_device {
> struct pci_dev *pdev;
> struct device *device;
> struct xsc_priv priv;
> + void *netdev;
> void *eth_priv;
> struct xsc_dev_resource *dev_res;
>
> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
> new file mode 100644
> index 000000000..243ec7ced
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
> @@ -0,0 +1,135 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (C) 2021 - 2023, Shanghai Yunsilicon Technology Co., Ltd.
> + * All rights reserved.
> + */
> +
> +#include <linux/reboot.h>
reboot.h in an ethernet driver?
> +static int xsc_net_reboot_event_handler(struct notifier_block *nb, unsigned long action, void *data)
> +{
> + pr_info("xsc net driver recv %lu event\n", action);
> + xsc_remove_eth_driver();
> +
> + return NOTIFY_OK;
> +}
> +
> +struct notifier_block xsc_net_nb = {
> + .notifier_call = xsc_net_reboot_event_handler,
> + .next = NULL,
> + .priority = 1,
> +};
This needs a comment explanation why this driver needs something
special during reboot.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists