Blob Blame Raw
From 77245b944b7d14a4e139984c3773e994c6ef6703 Mon Sep 17 00:00:00 2001
From: Eddie Wai <eddie.wai@broadcom.com>
Date: Wed, 11 Dec 2013 15:38:12 -0800
Subject: [PATCH] ISCSIUIO: Added tx doorbell override mechanism

Added a new tx doorbell field in the uio path to work with new
bnx2x/cnic drivers that supports VF_RSS.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
---
 iscsiuio/src/unix/libs/bnx2x.c | 13 ++++++++++---
 iscsiuio/src/unix/libs/bnx2x.h |  9 ++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index 36fc48e..748b59d 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -900,8 +900,14 @@ static int bnx2x_open(nic_t *nic)
 		struct client_init_general_data *data = bp->bufs;
 
 		bp->client_id = data->client_id;
-		if (data->reserved0)
-			bp->cid = data->reserved0;
+		if (data->uid.cid)
+			bp->cid = data->uid.cid;
+		if (bp->version.minor >= 78 && bp->version.sub_minor >= 55 &&
+		    data->uid.cid_override_key == UIO_USE_TX_DOORBELL) {
+			bp->tx_doorbell = data->uid.tx_db_off;
+			LOG_INFO(PFX "%s: tx doorbell override offset = 0x%x",
+				 nic->log_name, bp->tx_doorbell);
+		}
 	}
 
 	LOG_INFO(PFX "%s: func 0x%x, pfid 0x%x, client_id 0x%x, cid 0x%x",
@@ -928,7 +934,8 @@ static int bnx2x_open(nic_t *nic)
 		     USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) :
 		     USTORM_RX_PRODS_E1X_OFFSET(bp->port, bp->client_id));
 
-		bp->tx_doorbell = bp->cid * 0x80 + 0x40;
+		if (!bp->tx_doorbell)
+			bp->tx_doorbell = bp->cid * 0x80 + 0x40;
 
 		bp->get_rx_cons = bnx2x_get_rx_60;
 		bp->get_tx_cons = bnx2x_get_tx_60;
diff --git a/iscsiuio/src/unix/libs/bnx2x.h b/iscsiuio/src/unix/libs/bnx2x.h
index 0b74e44..ce55cfc 100644
--- a/iscsiuio/src/unix/libs/bnx2x.h
+++ b/iscsiuio/src/unix/libs/bnx2x.h
@@ -382,6 +382,13 @@ union eth_rx_cqe_70 {
 	struct eth_rx_cqe_next_page_70 next_page_cqe_70;
 };
 
+struct uio_init_data {
+	__u32 cid;
+	__u32 tx_db_off;
+	__u32 cid_override_key;
+#define UIO_USE_TX_DOORBELL	0x017855DB
+};
+
 struct client_init_general_data {
 	__u8 client_id;
 	__u8 statistics_counter_id;
@@ -394,7 +401,7 @@ struct client_init_general_data {
 	__u8 func_id;
 	__u8 cos;
 	__u8 traffic_type;
-	__u32 reserved0;
+	struct uio_init_data uid;
 };
 
 /******************************************************************************
-- 
1.8.3.1