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

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