net: systemport: Implement RX coalescing control knobs
Similarly to the TX path, allow the RX path to be configured with both 'rx-frames' and 'rx-usecs' coalescing parameters. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b1a15e8643
commit
d0634868d3
@ -467,6 +467,11 @@ static int bcm_sysport_get_coalesce(struct net_device *dev,
|
|||||||
ec->tx_coalesce_usecs = (reg >> RING_TIMEOUT_SHIFT) * 8192 / 1000;
|
ec->tx_coalesce_usecs = (reg >> RING_TIMEOUT_SHIFT) * 8192 / 1000;
|
||||||
ec->tx_max_coalesced_frames = reg & RING_INTR_THRESH_MASK;
|
ec->tx_max_coalesced_frames = reg & RING_INTR_THRESH_MASK;
|
||||||
|
|
||||||
|
reg = rdma_readl(priv, RDMA_MBDONE_INTR);
|
||||||
|
|
||||||
|
ec->rx_coalesce_usecs = (reg >> RDMA_TIMEOUT_SHIFT) * 8192 / 1000;
|
||||||
|
ec->rx_max_coalesced_frames = reg & RDMA_INTR_THRESH_MASK;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,16 +482,18 @@ static int bcm_sysport_set_coalesce(struct net_device *dev,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
||||||
/* Base system clock is 125Mhz, TDMA timeout is this reference clock
|
/* Base system clock is 125Mhz, DMA timeout is this reference clock
|
||||||
* divided by 1024, which yield roughly 8.192 us, our maximum value
|
* divided by 1024, which yield roughly 8.192 us, our maximum value has
|
||||||
* has to fit in the RING_TIMEOUT_MASK (16 bits).
|
* to fit in the RING_TIMEOUT_MASK (16 bits).
|
||||||
*/
|
*/
|
||||||
if (ec->tx_max_coalesced_frames > RING_INTR_THRESH_MASK ||
|
if (ec->tx_max_coalesced_frames > RING_INTR_THRESH_MASK ||
|
||||||
ec->tx_coalesce_usecs > (RING_TIMEOUT_MASK * 8) + 1)
|
ec->tx_coalesce_usecs > (RING_TIMEOUT_MASK * 8) + 1 ||
|
||||||
|
ec->rx_max_coalesced_frames > RDMA_INTR_THRESH_MASK ||
|
||||||
|
ec->rx_coalesce_usecs > (RDMA_TIMEOUT_MASK * 8) + 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (ec->tx_coalesce_usecs == 0 &&
|
if ((ec->tx_coalesce_usecs == 0 && ec->tx_max_coalesced_frames == 0) ||
|
||||||
ec->tx_max_coalesced_frames == 0)
|
(ec->rx_coalesce_usecs == 0 && ec->rx_max_coalesced_frames == 0))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < dev->num_tx_queues; i++) {
|
for (i = 0; i < dev->num_tx_queues; i++) {
|
||||||
@ -499,6 +506,14 @@ static int bcm_sysport_set_coalesce(struct net_device *dev,
|
|||||||
tdma_writel(priv, reg, TDMA_DESC_RING_INTR_CONTROL(i));
|
tdma_writel(priv, reg, TDMA_DESC_RING_INTR_CONTROL(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reg = rdma_readl(priv, RDMA_MBDONE_INTR);
|
||||||
|
reg &= ~(RDMA_INTR_THRESH_MASK |
|
||||||
|
RDMA_TIMEOUT_MASK << RDMA_TIMEOUT_SHIFT);
|
||||||
|
reg |= ec->rx_max_coalesced_frames;
|
||||||
|
reg |= DIV_ROUND_UP(ec->rx_coalesce_usecs * 1000, 8192) <<
|
||||||
|
RDMA_TIMEOUT_SHIFT;
|
||||||
|
rdma_writel(priv, reg, RDMA_MBDONE_INTR);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ struct bcm_rsb {
|
|||||||
#define RDMA_END_ADDR_LO 0x102c
|
#define RDMA_END_ADDR_LO 0x102c
|
||||||
|
|
||||||
#define RDMA_MBDONE_INTR 0x1030
|
#define RDMA_MBDONE_INTR 0x1030
|
||||||
#define RDMA_INTR_THRESH_MASK 0xff
|
#define RDMA_INTR_THRESH_MASK 0x1ff
|
||||||
#define RDMA_TIMEOUT_SHIFT 16
|
#define RDMA_TIMEOUT_SHIFT 16
|
||||||
#define RDMA_TIMEOUT_MASK 0xffff
|
#define RDMA_TIMEOUT_MASK 0xffff
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user