[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <329a7e1e-d3dc-4dcc-9599-828b6ff1a0f1@linux.dev>
Date: Mon, 21 Apr 2025 09:21:45 +0800
From: Yanteng Si <si.yanteng@...ux.dev>
To: Huacai Chen <chenhuacai@...ngson.cn>, Huacai Chen
<chenhuacai@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: Feiyang Chen <chris.chenfeiyang@...il.com>, loongarch@...ts.linux.dev,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Henry Chen <chenx97@...c.io>, Biao Dong <dongbiao@...ngson.cn>,
Baoqi Zhang <zhangbaoqi@...ngson.cn>
Subject: Re: [PATCH net-next V2 1/3] net: stmmac: dwmac-loongson: Move queue
number init to common function
在 4/16/25 10:41 PM, Huacai Chen 写道:
> Currently, the tx and rx queue number initialization is duplicated in
> loongson_gmac_data() and loongson_gnet_data(), so move it to the common
> function loongson_default_data().
>
> This is a preparation for later patches.
>
> Tested-by: Henry Chen <chenx97@...c.io>
> Tested-by: Biao Dong <dongbiao@...ngson.cn>
> Signed-off-by: Baoqi Zhang <zhangbaoqi@...ngson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
Reviewed-by: Yanteng Si <si.yanteng@...ux.dev>
Thanks,
Yanteng
> ---
> .../ethernet/stmicro/stmmac/dwmac-loongson.c | 54 ++++++-------------
> 1 file changed, 16 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 1a93787056a7..2fb7a137b312 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -83,6 +83,8 @@ struct stmmac_pci_info {
> static void loongson_default_data(struct pci_dev *pdev,
> struct plat_stmmacenet_data *plat)
> {
> + struct loongson_data *ld = plat->bsp_priv;
> +
> /* Get bus_id, this can be overwritten later */
> plat->bus_id = pci_dev_id(pdev);
>
> @@ -116,32 +118,27 @@ static void loongson_default_data(struct pci_dev *pdev,
>
> plat->dma_cfg->pbl = 32;
> plat->dma_cfg->pblx8 = true;
> +
> + if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
> + plat->rx_queues_to_use = CHANNEL_NUM;
> + plat->tx_queues_to_use = CHANNEL_NUM;
> +
> + /* Only channel 0 supports checksum,
> + * so turn off checksum to enable multiple channels.
> + */
> + for (int i = 1; i < CHANNEL_NUM; i++)
> + plat->tx_queues_cfg[i].coe_unsupported = 1;
> + } else {
> + plat->tx_queues_to_use = 1;
> + plat->rx_queues_to_use = 1;
> + }
> }
>
> static int loongson_gmac_data(struct pci_dev *pdev,
> struct plat_stmmacenet_data *plat)
> {
> - struct loongson_data *ld;
> - int i;
> -
> - ld = plat->bsp_priv;
> -
> loongson_default_data(pdev, plat);
>
> - if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
> - plat->rx_queues_to_use = CHANNEL_NUM;
> - plat->tx_queues_to_use = CHANNEL_NUM;
> -
> - /* Only channel 0 supports checksum,
> - * so turn off checksum to enable multiple channels.
> - */
> - for (i = 1; i < CHANNEL_NUM; i++)
> - plat->tx_queues_cfg[i].coe_unsupported = 1;
> - } else {
> - plat->tx_queues_to_use = 1;
> - plat->rx_queues_to_use = 1;
> - }
> -
> plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID;
>
> return 0;
> @@ -172,27 +169,8 @@ static void loongson_gnet_fix_speed(void *priv, int speed, unsigned int mode)
> static int loongson_gnet_data(struct pci_dev *pdev,
> struct plat_stmmacenet_data *plat)
> {
> - struct loongson_data *ld;
> - int i;
> -
> - ld = plat->bsp_priv;
> -
> loongson_default_data(pdev, plat);
>
> - if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
> - plat->rx_queues_to_use = CHANNEL_NUM;
> - plat->tx_queues_to_use = CHANNEL_NUM;
> -
> - /* Only channel 0 supports checksum,
> - * so turn off checksum to enable multiple channels.
> - */
> - for (i = 1; i < CHANNEL_NUM; i++)
> - plat->tx_queues_cfg[i].coe_unsupported = 1;
> - } else {
> - plat->tx_queues_to_use = 1;
> - plat->rx_queues_to_use = 1;
> - }
> -
> plat->phy_interface = PHY_INTERFACE_MODE_GMII;
> plat->mdio_bus_data->phy_mask = ~(u32)BIT(2);
> plat->fix_mac_speed = loongson_gnet_fix_speed;
Powered by blists - more mailing lists