octeontx2-pf: Use hardware register for CQE count
Subsystems (4)
Geetha sowjanya
maintainerPATCH v3 1/1 octeontx2-pf: Use hardware register for CQE count
Current driver uses software CQ head pointer to poll on CQE header in memory to determine if CQE is valid. Software needs to make sure, that the reads of the CQE do not get re-ordered so much that it ends up with an inconsistent view of the CQE. To ensure that DMB barrier after read to first CQE cacheline and before reading of the rest of the CQE is needed. But having barrier for every CQE read will impact the performance, instead use hardware CQ head and tail pointers to find the valid number of CQEs.
---v1->v2:
-Fixed compilation warnings.
v2->v3:
-Fixed changelog.
.../marvell/octeontx2/nic/otx2_common.c | 3 + .../marvell/octeontx2/nic/otx2_common.h | 1 + .../marvell/octeontx2/nic/otx2_txrx.c | 69 +++++++++++++++++-- .../marvell/octeontx2/nic/otx2_txrx.h | 5 ++ include/linux/soc/marvell/octeontx2/asm.h | 14 ++++ 5 files changed, 85 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
@@ -1006,6 +1006,9 @@ int otx2_config_nix_queues(struct otx2_nic *pfvf)return err; } + pfvf->cq_op_addr = (__force u64 *)otx2_get_regaddr (pfvf, +NIX_LF_CQ_OP_STATUS ); +/* Initialize work queue for receive buffer refill */ pfvf->refill_wrk =devm_kcalloc (pfvf->dev, pfvf->qset.cq_cnt,sizeof (struct refill_work ),GFP_KERNEL );
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
@@ -337,6 +337,7 @@ struct otx2_nic {#define OTX2_FLAG_TC_MATCHALL_INGRESS_ENABLED BIT_ULL(13)#define OTX2_FLAG_DMACFLTR_SUPPORT BIT_ULL(14)u64 flags; +u64 *cq_op_addr;struct otx2_qset qset;struct otx2_hw hw;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +62 -7
118 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +5 -0
@@ -56,6 +56,9 @@*/ #define CQ_QCOUNT_DEFAULT 1 +#define CQ_OP_STAT_OP_ERR 63 +#define CQ_OP_STAT_CQ_ERR 46 +struct queue_stats {u64 bytes;u64 pkts;
@@ -122,6 +125,8 @@ struct otx2_cq_queue {u16 pool_ptrs;u32 cqe_cnt;u32 cq_head; +u32 cq_tail; +u32 pend_cqe;void *cqe_base;struct qmem *cqe;struct otx2_pool *rbpool;
include/linux/soc/marvell/octeontx2/asm.h +14 -0
@@ -34,9 +34,23 @@ : [rf] "+r"(val) \ : [rs] "r"(addr)); \ }) + +static inline u64 otx2_atomic64_fetch_add(u64 incr, u64 *ptr) +{ +u64 result; + + asmvolatile (".cpu generic+lse\n" +"ldadda %x[i], %x[r], [%[b]]" + : [r]"=r" (result),"+m" (*ptr) + : [i]"r" (incr), [b]"r" (ptr) + :"memory" ); +return result; +} +#else #define otx2_lmt_flush (ioaddr) ({ 0; })#define cn10k_lmt_flush (val, addr) ({ addr = val; }) +#define otx2_atomic64_fetch_add (incr, ptr) ({ incr; })#endif #endif /* __SOC_OTX2_ASM_H */
Signature · 1 line
2.17.1
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 11 lines · On Tue, 28 Sep 2021 11:25:26 +0530 you wrote:
Current driver uses software CQ head pointer to poll on CQE header in memory to determine if CQE is valid. Software needs to make sure, that the reads of the CQE do not get re-ordered so much that it ends up with an inconsistent view of the CQE. To ensure that DMB barrier after read to first CQE cacheline and before reading of the rest of the CQE is needed. But having barrier for every CQE read will impact the performance, instead use hardware CQ head and tail pointers to find the valid number of CQEs.
[...]
Here is the summary with links:
- [net-next,v3] octeontx2-pf: Use hardware register for CQE count
https://git.kernel.org/netdev/net-next/c/af3826db74d1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html