Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: stmmac: dwmac-loongson: Move queue number init to common function

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.

Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Huacai Chen and committed by
David S. Miller
f438eee2 5c3bf6cb

+9 -31
+9 -31
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
··· 83 83 static void loongson_default_data(struct pci_dev *pdev, 84 84 struct plat_stmmacenet_data *plat) 85 85 { 86 + struct loongson_data *ld = plat->bsp_priv; 87 + 86 88 /* Get bus_id, this can be overwritten later */ 87 89 plat->bus_id = pci_dev_id(pdev); 88 90 ··· 118 116 119 117 plat->dma_cfg->pbl = 32; 120 118 plat->dma_cfg->pblx8 = true; 121 - } 122 - 123 - static int loongson_gmac_data(struct pci_dev *pdev, 124 - struct plat_stmmacenet_data *plat) 125 - { 126 - struct loongson_data *ld; 127 - int i; 128 - 129 - ld = plat->bsp_priv; 130 - 131 - loongson_default_data(pdev, plat); 132 119 133 120 if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) { 134 121 plat->rx_queues_to_use = CHANNEL_NUM; ··· 126 135 /* Only channel 0 supports checksum, 127 136 * so turn off checksum to enable multiple channels. 128 137 */ 129 - for (i = 1; i < CHANNEL_NUM; i++) 138 + for (int i = 1; i < CHANNEL_NUM; i++) 130 139 plat->tx_queues_cfg[i].coe_unsupported = 1; 131 140 } else { 132 141 plat->tx_queues_to_use = 1; 133 142 plat->rx_queues_to_use = 1; 134 143 } 144 + } 145 + 146 + static int loongson_gmac_data(struct pci_dev *pdev, 147 + struct plat_stmmacenet_data *plat) 148 + { 149 + loongson_default_data(pdev, plat); 135 150 136 151 plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID; 137 152 ··· 169 172 static int loongson_gnet_data(struct pci_dev *pdev, 170 173 struct plat_stmmacenet_data *plat) 171 174 { 172 - struct loongson_data *ld; 173 - int i; 174 - 175 - ld = plat->bsp_priv; 176 - 177 175 loongson_default_data(pdev, plat); 178 - 179 - if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) { 180 - plat->rx_queues_to_use = CHANNEL_NUM; 181 - plat->tx_queues_to_use = CHANNEL_NUM; 182 - 183 - /* Only channel 0 supports checksum, 184 - * so turn off checksum to enable multiple channels. 185 - */ 186 - for (i = 1; i < CHANNEL_NUM; i++) 187 - plat->tx_queues_cfg[i].coe_unsupported = 1; 188 - } else { 189 - plat->tx_queues_to_use = 1; 190 - plat->rx_queues_to_use = 1; 191 - } 192 176 193 177 plat->phy_interface = PHY_INTERFACE_MODE_GMII; 194 178 plat->mdio_bus_data->phy_mask = ~(u32)BIT(2);