net: stmmac: configure tx queue weight
This patch adds TX queues weight programming. Signed-off-by: Joao Pinto <jpinto@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d0a9c9f9c6
commit
6a3a7193b2
|
@ -462,6 +462,9 @@ struct stmmac_ops {
|
||||||
void (*prog_mtl_rx_algorithms)(struct mac_device_info *hw, u32 rx_alg);
|
void (*prog_mtl_rx_algorithms)(struct mac_device_info *hw, u32 rx_alg);
|
||||||
/* Program TX Algorithms */
|
/* Program TX Algorithms */
|
||||||
void (*prog_mtl_tx_algorithms)(struct mac_device_info *hw, u32 tx_alg);
|
void (*prog_mtl_tx_algorithms)(struct mac_device_info *hw, u32 tx_alg);
|
||||||
|
/* Set MTL TX queues weight */
|
||||||
|
void (*set_mtl_tx_queue_weight)(struct mac_device_info *hw,
|
||||||
|
u32 weight, u32 queue);
|
||||||
/* Dump MAC registers */
|
/* Dump MAC registers */
|
||||||
void (*dump_regs)(struct mac_device_info *hw, u32 *reg_space);
|
void (*dump_regs)(struct mac_device_info *hw, u32 *reg_space);
|
||||||
/* Handle extra events on specific interrupts hw dependent */
|
/* Handle extra events on specific interrupts hw dependent */
|
||||||
|
|
|
@ -226,6 +226,13 @@ enum power_event {
|
||||||
#define MTL_OP_MODE_RTC_96 (2 << MTL_OP_MODE_RTC_SHIFT)
|
#define MTL_OP_MODE_RTC_96 (2 << MTL_OP_MODE_RTC_SHIFT)
|
||||||
#define MTL_OP_MODE_RTC_128 (3 << MTL_OP_MODE_RTC_SHIFT)
|
#define MTL_OP_MODE_RTC_128 (3 << MTL_OP_MODE_RTC_SHIFT)
|
||||||
|
|
||||||
|
/* MTL Queue Quantum Weight */
|
||||||
|
#define MTL_TXQ_WEIGHT_BASE_ADDR 0x00000d18
|
||||||
|
#define MTL_TXQ_WEIGHT_BASE_OFFSET 0x40
|
||||||
|
#define MTL_TXQX_WEIGHT_BASE_ADDR(x) (MTL_TXQ_WEIGHT_BASE_ADDR + \
|
||||||
|
((x) * MTL_TXQ_WEIGHT_BASE_OFFSET))
|
||||||
|
#define MTL_TXQ_WEIGHT_ISCQW_MASK GENMASK(20, 0)
|
||||||
|
|
||||||
/* MTL debug */
|
/* MTL debug */
|
||||||
#define MTL_DEBUG_TXSTSFSTS BIT(5)
|
#define MTL_DEBUG_TXSTSFSTS BIT(5)
|
||||||
#define MTL_DEBUG_TXFSTS BIT(4)
|
#define MTL_DEBUG_TXFSTS BIT(4)
|
||||||
|
|
|
@ -116,6 +116,17 @@ static void dwmac4_prog_mtl_tx_algorithms(struct mac_device_info *hw,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dwmac4_set_mtl_tx_queue_weight(struct mac_device_info *hw,
|
||||||
|
u32 weight, u32 queue)
|
||||||
|
{
|
||||||
|
void __iomem *ioaddr = hw->pcsr;
|
||||||
|
u32 value = readl(ioaddr + MTL_TXQX_WEIGHT_BASE_ADDR(queue));
|
||||||
|
|
||||||
|
value &= ~MTL_TXQ_WEIGHT_ISCQW_MASK;
|
||||||
|
value |= weight & MTL_TXQ_WEIGHT_ISCQW_MASK;
|
||||||
|
writel(value, ioaddr + MTL_TXQX_WEIGHT_BASE_ADDR(queue));
|
||||||
|
}
|
||||||
|
|
||||||
static void dwmac4_dump_regs(struct mac_device_info *hw, u32 *reg_space)
|
static void dwmac4_dump_regs(struct mac_device_info *hw, u32 *reg_space)
|
||||||
{
|
{
|
||||||
void __iomem *ioaddr = hw->pcsr;
|
void __iomem *ioaddr = hw->pcsr;
|
||||||
|
@ -505,6 +516,7 @@ static const struct stmmac_ops dwmac4_ops = {
|
||||||
.rx_queue_enable = dwmac4_rx_queue_enable,
|
.rx_queue_enable = dwmac4_rx_queue_enable,
|
||||||
.prog_mtl_rx_algorithms = dwmac4_prog_mtl_rx_algorithms,
|
.prog_mtl_rx_algorithms = dwmac4_prog_mtl_rx_algorithms,
|
||||||
.prog_mtl_tx_algorithms = dwmac4_prog_mtl_tx_algorithms,
|
.prog_mtl_tx_algorithms = dwmac4_prog_mtl_tx_algorithms,
|
||||||
|
.set_mtl_tx_queue_weight = dwmac4_set_mtl_tx_queue_weight,
|
||||||
.dump_regs = dwmac4_dump_regs,
|
.dump_regs = dwmac4_dump_regs,
|
||||||
.host_irq_status = dwmac4_irq_status,
|
.host_irq_status = dwmac4_irq_status,
|
||||||
.flow_ctrl = dwmac4_flow_ctrl,
|
.flow_ctrl = dwmac4_flow_ctrl,
|
||||||
|
|
|
@ -1647,6 +1647,23 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
|
||||||
add_timer(&priv->txtimer);
|
add_timer(&priv->txtimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stmmac_set_tx_queue_weight - Set TX queue weight
|
||||||
|
* @priv: driver private structure
|
||||||
|
* Description: It is used for setting TX queues weight
|
||||||
|
*/
|
||||||
|
static void stmmac_set_tx_queue_weight(struct stmmac_priv *priv)
|
||||||
|
{
|
||||||
|
u32 tx_queues_count = priv->plat->tx_queues_to_use;
|
||||||
|
u32 weight;
|
||||||
|
u32 queue;
|
||||||
|
|
||||||
|
for (queue = 0; queue < tx_queues_count; queue++) {
|
||||||
|
weight = priv->plat->tx_queues_cfg[queue].weight;
|
||||||
|
priv->hw->mac->set_mtl_tx_queue_weight(priv->hw, weight, queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stmmac_mtl_configuration - Configure MTL
|
* stmmac_mtl_configuration - Configure MTL
|
||||||
* @priv: driver private structure
|
* @priv: driver private structure
|
||||||
|
@ -1657,6 +1674,9 @@ static void stmmac_mtl_configuration(struct stmmac_priv *priv)
|
||||||
u32 rx_queues_count = priv->plat->rx_queues_to_use;
|
u32 rx_queues_count = priv->plat->rx_queues_to_use;
|
||||||
u32 tx_queues_count = priv->plat->tx_queues_to_use;
|
u32 tx_queues_count = priv->plat->tx_queues_to_use;
|
||||||
|
|
||||||
|
if (tx_queues_count > 1 && priv->hw->mac->set_mtl_tx_queue_weight)
|
||||||
|
stmmac_set_tx_queue_weight(priv);
|
||||||
|
|
||||||
/* Configure MTL RX algorithms */
|
/* Configure MTL RX algorithms */
|
||||||
if (rx_queues_count > 1 && priv->hw->mac->prog_mtl_rx_algorithms)
|
if (rx_queues_count > 1 && priv->hw->mac->prog_mtl_rx_algorithms)
|
||||||
priv->hw->mac->prog_mtl_rx_algorithms(priv->hw,
|
priv->hw->mac->prog_mtl_rx_algorithms(priv->hw,
|
||||||
|
|
Loading…
Reference in New Issue