All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yanteng Si <si.yanteng@linux.dev>
To: Huacai Chen <chenhuacai@loongson.cn>,
	Huacai Chen <chenhuacai@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Feiyang Chen <chris.chenfeiyang@gmail.com>,
	loongarch@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Henry Chen <chenx97@aosc.io>,
	Biao Dong <dongbiao@loongson.cn>,
	Baoqi Zhang <zhangbaoqi@loongson.cn>
Subject: Re: [PATCH net-next V2 1/3] net: stmmac: dwmac-loongson: Move queue number init to common function
Date: Mon, 21 Apr 2025 09:21:45 +0800	[thread overview]
Message-ID: <329a7e1e-d3dc-4dcc-9599-828b6ff1a0f1@linux.dev> (raw)
In-Reply-To: <20250416144132.3857990-2-chenhuacai@loongson.cn>


在 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@aosc.io>
> Tested-by: Biao Dong <dongbiao@loongson.cn>
> Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Reviewed-by: Yanteng Si <si.yanteng@linux.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;

  reply	other threads:[~2025-04-21  1:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 14:41 [PATCH net-next V2 0/3] net: stmmac: dwmac-loongson: Add Loongson-2K3000 support Huacai Chen
2025-04-16 14:41 ` [PATCH net-next V2 1/3] net: stmmac: dwmac-loongson: Move queue number init to common function Huacai Chen
2025-04-21  1:21   ` Yanteng Si [this message]
2025-04-16 14:41 ` [PATCH net-next V2 2/3] net: stmmac: dwmac-loongson: Add new multi-chan IP core support Huacai Chen
2025-04-21  2:03   ` Yanteng Si
2025-04-21  4:20     ` Huacai Chen
2025-04-22  2:29       ` Yanteng Si
2025-04-22 13:27         ` Paolo Abeni
2025-04-23  1:01           ` Huacai Chen
2025-04-16 14:41 ` [PATCH net-next V2 3/3] net: stmmac: dwmac-loongson: Add new GMAC's PCI device ID support Huacai Chen
2025-04-21  2:09   ` Yanteng Si
2025-04-21  2:14 ` [PATCH net-next V2 0/3] net: stmmac: dwmac-loongson: Add Loongson-2K3000 support Yanteng Si

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=329a7e1e-d3dc-4dcc-9599-828b6ff1a0f1@linux.dev \
    --to=si.yanteng@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=chenx97@aosc.io \
    --cc=chris.chenfeiyang@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dongbiao@loongson.cn \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zhangbaoqi@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.