liquidio: fix inaccurate count of napi-processed rx packets reported to Octeon
Subsystems (3)
PATCH 1/1 liquidio: fix inaccurate count of napi-processed rx packets reported to Octeon
From: Prasad Kanneganti <[email protected]>
lio_enable_irq (called by napi poll) is reporting to Octeon an inaccurate count of processed rx packets causing Octeon to eventually stop forwarding packets to the host. Fix it by using this formula for an accurate count:
processed rx packets = droq->pkt_count - droq->pkts_pending
Also increase SOFT_COMMAND_BUFFER_SIZE to match what the firmware expects.
--- drivers/net/ethernet/cavium/liquidio/octeon_device.c | 6 ++++-- drivers/net/ethernet/cavium/liquidio/octeon_iq.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/cavium/liquidio/octeon_device.c +4 -2
@@ -1429,13 +1429,15 @@ int lio_get_device_id(void *dev)void lio_enable_irq (struct octeon_droq *droq,struct octeon_instr_queue *iq) {u64 instr_cnt; +u32 pkts_pend;struct octeon_device *oct =NULL ;/* the whole thing needs to be atomic, ideally */ if (droq) { + pkts_pend = (u32 )atomic_read (&droq->pkts_pending);spin_lock_bh (&droq->lock); -writel (droq->pkt_count, droq->pkts_sent_reg); - droq->pkt_count =0 ; +writel (droq->pkt_count - pkts_pend, droq->pkts_sent_reg); + droq->pkt_count = pkts_pend;/* this write needs to be flushed before we release the lock */ mmiowb ();spin_unlock_bh (&droq->lock);
drivers/net/ethernet/cavium/liquidio/octeon_iq.h +1 -1
@@ -251,7 +251,7 @@ union octeon_instr_64B {/** The size of each buffer in soft command buffer pool */ -#define SOFT_COMMAND_BUFFER_SIZE 1536 +#define SOFT_COMMAND_BUFFER_SIZE 2048struct octeon_soft_command {/** Soft command buffer info. */
From: Felix Manlunas <[email protected]>
Date: Thu, 25 May 2017 10:54:29 -0700
Quoted 6 lines
From: Prasad Kanneganti <[email protected]>
lio_enable_irq(called by napi poll) is reporting to Octeon an inaccurate count of processed rx packets causing Octeon to eventually stop forwarding packets to the host. Fix it by using this formula for an accurate count:
Quoted 6 lines
processed rx packets = droq->pkt_count - droq->pkts_pendingAlso increase
SOFT_COMMAND_BUFFER_SIZEto match what the firmware expects.Signed-off-by Prasad Kanneganti <[email protected]>Signed-off-by Felix Manlunas <[email protected]>
Applied.