Blame SOURCES/open-iscsi-2.0.876-60-qedi-Use-uio-BD-index-instead-on-buffer-index.patch

e88930
From e34658ca383a0d1d2e455a4c5bb55ce06790ba97 Mon Sep 17 00:00:00 2001
e88930
From: Manish Rangankar <manish.rangankar@cavium.com>
e88930
Date: Tue, 20 Nov 2018 00:15:01 -0500
e88930
Subject: [PATCH] qedi: Use uio BD index instead on buffer index.
e88930
e88930
1. Use HW BD prod index to read packet buffer descriptor.
e88930
2. Use BD producer and consumer index to check for new data instead
e88930
   of UIO ring buffer index.
e88930
e88930
NOTE - This patch has dependency on upstream qedi driver v8.33.0.21,
e88930
commit "qedi: Move LL2 producer index processing in BH.",
e88930
(https://marc.info/?l=linux-scsi&m=154271028608808)
e88930
e88930
Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com>
e88930
---
e88930
 iscsiuio/src/unix/libs/qedi.c | 12 +++++++++---
e88930
 1 file changed, 9 insertions(+), 3 deletions(-)
e88930
e88930
diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
e88930
index 3aa2de7155e8..b7595d5223eb 100644
e88930
--- a/iscsiuio/src/unix/libs/qedi.c
e88930
+++ b/iscsiuio/src/unix/libs/qedi.c
e88930
@@ -994,7 +994,7 @@ static int qedi_read(nic_t *nic, packet_t *pkt)
e88930
 	void *rx_pkt;
e88930
 	int rc = 0;
e88930
 	uint32_t sw_cons, bd_cons;
e88930
-	uint32_t hw_prod;
e88930
+	uint32_t hw_prod, bd_prod;
e88930
 	uint32_t rx_pkt_idx;
e88930
 	int len;
e88930
 	struct qedi_rx_bd *rx_bd;
e88930
@@ -1013,14 +1013,20 @@ static int qedi_read(nic_t *nic, packet_t *pkt)
e88930
 	msync(bp->rx_comp_ring, nic->page_size, MS_SYNC);
e88930
 	uctrl = (struct qedi_uio_ctrl *)bp->uctrl_map;
e88930
 	hw_prod = uctrl->hw_rx_prod;
e88930
+	bd_prod = uctrl->hw_rx_bd_prod;
e88930
 	sw_cons = uctrl->host_rx_cons;
e88930
 	bd_cons = uctrl->host_rx_bd_cons;
e88930
-	rx_bd = bp->rx_comp_ring + (bd_cons * sizeof(*rx_bd));
e88930
+	rx_bd = bp->rx_comp_ring + (bd_prod * sizeof(*rx_bd));
e88930
 	len = rx_bd->rx_pkt_len;
e88930
 	rx_pkt_idx = rx_bd->rx_pkt_index;
e88930
 	vlan_id = rx_bd->vlan_id;
e88930
 
e88930
-	if (sw_cons != hw_prod) {
e88930
+	LOG_DEBUG(PFX "%s:hw_prod %d bd_prod %d, rx_pkt_idx %d, rxlen %d",
e88930
+		  nic->log_name, hw_prod, bd_prod, rx_bd->rx_pkt_index, len);
e88930
+	LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %d",
e88930
+		  nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD);
e88930
+
e88930
+	if (bd_cons != bd_prod) {
e88930
 		LOG_DEBUG(PFX "%s: clearing rx interrupt: %d %d",
e88930
 			  nic->log_name, sw_cons, hw_prod);
e88930
 		rc = 1;
e88930
-- 
e88930
2.17.2
e88930