All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qedi: Add support for fastpath doorvell recovery
@ 2021-08-04 15:43 Shai Malin
  2021-08-04 19:45   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Shai Malin @ 2021-08-04 15:43 UTC (permalink / raw)
  To: linux-scsi
  Cc: GR-QLogic-Storage-Upstream, smalin, malin1024, Manish Rangankar

Driver fastpath employs doorbells to indicate to the device that work
is available. Each doorbell translates to a message sent to the device
over the pci. These messages are queued by the doorbell queue HW block,
and handled by the HW.
If a sufficient amount of CPU cores are sending messages at a sufficient
rate, the queue can overflow, and messages can be dropped. There are
many entities in the driver which can send doorbell messages.
When overflow happens, a fatal HW attention is indicated, and the
Doorbell HW block stops accepting new doorbell messages until recovery
procedure is done.

When overflow occurs, all doorbells are dropped. Since doorbells are
aggregatives, if more doorbells are sent nothing has to be done.
But if the "last" doorbell is dropped, the doorbelling entity doesn’t know
this happened, and may wait forever for the device to perform the action.
The doorbell recovery mechanism addresses just that - it sends the last
doorbell of every entity.

Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Shai Malin <smalin@marvell.com>
---
 drivers/scsi/qedi/qedi_fw.c    | 14 ++++----------
 drivers/scsi/qedi/qedi_iscsi.c | 33 ++++++++++++++++++++++++++++++++-
 drivers/scsi/qedi/qedi_iscsi.h |  1 +
 3 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index 71333d3c5c86..677a70999d32 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -936,17 +936,11 @@ void qedi_fp_process_cqes(struct qedi_work *work)
 
 static void qedi_ring_doorbell(struct qedi_conn *qedi_conn)
 {
-	struct iscsi_db_data dbell = { 0 };
+	qedi_conn->ep->db_data.sq_prod = qedi_conn->ep->fw_sq_prod_idx
 
-	dbell.agg_flags = 0;
-
-	dbell.params |= DB_DEST_XCM << ISCSI_DB_DATA_DEST_SHIFT;
-	dbell.params |= DB_AGG_CMD_SET << ISCSI_DB_DATA_AGG_CMD_SHIFT;
-	dbell.params |=
-		   DQ_XCM_ISCSI_SQ_PROD_CMD << ISCSI_DB_DATA_AGG_VAL_SEL_SHIFT;
-
-	dbell.sq_prod = qedi_conn->ep->fw_sq_prod_idx;
-	writel(*(u32 *)&dbell, qedi_conn->ep->p_doorbell);
+	/* wmb - Make sure fw idx is coherent */
+	wmb();
+	writel(*(u32 *)&qedi_conn->ep->db_data, qedi_conn->ep->p_doorbell);
 
 	/* Make sure fw write idx is coherent, and include both memory barriers
 	 * as a failsafe as for some architectures the call is the same but on
diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c
index 97f83760da88..2a143c806ae9 100644
--- a/drivers/scsi/qedi/qedi_iscsi.c
+++ b/drivers/scsi/qedi/qedi_iscsi.c
@@ -499,8 +499,9 @@ static u16 qedi_calc_mss(u16 pmtu, u8 is_ipv6, u8 tcp_ts_en, u8 vlan_en)
 
 static int qedi_iscsi_offload_conn(struct qedi_endpoint *qedi_ep)
 {
-	struct qedi_ctx *qedi = qedi_ep->qedi;
 	struct qed_iscsi_params_offload *conn_info;
+	struct qedi_ctx *qedi = qedi_ep->qedi;
+	struct qedi_ep->db_data.params
 	int rval;
 	int i;
 
@@ -577,8 +578,33 @@ static int qedi_iscsi_offload_conn(struct qedi_endpoint *qedi_ep)
 		  "Default cq index [%d], mss [%d]\n",
 		  conn_info->default_cq, conn_info->mss);
 
+	/* Prepare the doorbell parameters */
+	qedi_ep->db_data.agg_flags = 0;
+	qedi_ep->db_data.params = 0;
+	SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_DEST, DB_DEST_XCM);
+	SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_CMD,
+		  DB_AGG_CMD_MAX);
+	SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_VAL_SEL,
+		  DQ_XCM_ISCSI_SQ_PROD_CMD);
+	SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_BYPASS_EN, 1);
+
+	/* register doorbell with doorbell recovery mechanism */
+	rc = qedi_ops->common->db_recovery_add(qedi->cdev,
+					qedi_ep.p_doorbell,
+					&qedi_ep.db_data,
+					DB_REC_WIDTH_32B, DB_REC_KERNEL);
+	if (rc) {
+		kfree(conn_info);
+		return rval;
+	}
+
 	rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
 	if (rval)
+		/* delete doorbell from doorbell recovery mechanism */
+		rc = qedi_ops->common->db_recovery_del(qedi->cdev,
+						       qedi_ep.p_doorbell,
+						       &qedi_ep.db_data);
+
 		QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
 			 rval, qedi_ep);
 
@@ -1100,6 +1126,11 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)
 		break;
 	}
 
+	/* delete doorbell from doorbell recovery mechanism */
+	rc = qedi_ops->common->db_recovery_del(qedi->cdev,
+					       qedi_ep.p_doorbell,
+					       &qedi_ep.db_data);
+
 	if (!abrt_conn)
 		wait_delay += qedi->pf_params.iscsi_pf_params.two_msl_timer;
 
diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h
index 758735209e15..a31c5de74754 100644
--- a/drivers/scsi/qedi/qedi_iscsi.h
+++ b/drivers/scsi/qedi/qedi_iscsi.h
@@ -80,6 +80,7 @@ struct qedi_endpoint {
 	u32 handle;
 	u32 fw_cid;
 	void __iomem *p_doorbell;
+	struct iscsi_db_data db_data;
 
 	/* Send queue management */
 	struct iscsi_wqe *sq;
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedi: Add support for fastpath doorvell recovery
  2021-08-04 15:43 [PATCH] scsi: qedi: Add support for fastpath doorvell recovery Shai Malin
@ 2021-08-04 19:45   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-04 19:45 UTC (permalink / raw)
  To: Shai Malin, linux-scsi
  Cc: kbuild-all, GR-QLogic-Storage-Upstream, smalin, malin1024,
	Manish Rangankar

[-- Attachment #1: Type: text/plain, Size: 8958 bytes --]

Hi Shai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on scsi/for-next]
[also build test ERROR on mkp-scsi/for-next v5.14-rc4 next-20210804]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Shai-Malin/scsi-qedi-Add-support-for-fastpath-doorvell-recovery/20210804-234654
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/10706db207ac7784bf30729cba2c3ced86920e8a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shai-Malin/scsi-qedi-Add-support-for-fastpath-doorvell-recovery/20210804-234654
        git checkout 10706db207ac7784bf30729cba2c3ced86920e8a
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/scsi/qedi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_iscsi_offload_conn':
>> drivers/scsi/qedi/qedi_iscsi.c:504:16: error: expected identifier or '(' before '->' token
     504 |  struct qedi_ep->db_data.params
         |                ^~
>> drivers/scsi/qedi/qedi_iscsi.c:592:2: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
     592 |  rc = qedi_ops->common->db_recovery_add(qedi->cdev,
         |  ^~
         |  rq
   drivers/scsi/qedi/qedi_iscsi.c:592:2: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/scsi/qedi/qedi_iscsi.c:593:13: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     593 |      qedi_ep.p_doorbell,
         |             ^
         |             ->
   drivers/scsi/qedi/qedi_iscsi.c:594:14: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     594 |      &qedi_ep.db_data,
         |              ^
         |              ->
>> drivers/scsi/qedi/qedi_iscsi.c:598:10: error: 'rval' undeclared (first use in this function)
     598 |   return rval;
         |          ^~~~
   drivers/scsi/qedi/qedi_iscsi.c:605:21: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     605 |              qedi_ep.p_doorbell,
         |                     ^
         |                     ->
   drivers/scsi/qedi/qedi_iscsi.c:606:22: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     606 |              &qedi_ep.db_data);
         |                      ^
         |                      ->
   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_ep_disconnect':
   drivers/scsi/qedi/qedi_iscsi.c:1130:2: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
    1130 |  rc = qedi_ops->common->db_recovery_del(qedi->cdev,
         |  ^~
         |  rq
   drivers/scsi/qedi/qedi_iscsi.c:1131:20: error: 'qedi_ep' is a pointer; did you mean to use '->'?
    1131 |             qedi_ep.p_doorbell,
         |                    ^
         |                    ->
   drivers/scsi/qedi/qedi_iscsi.c:1132:21: error: 'qedi_ep' is a pointer; did you mean to use '->'?
    1132 |             &qedi_ep.db_data);
         |                     ^
         |                     ->
   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_iscsi_offload_conn':
   drivers/scsi/qedi/qedi_iscsi.c:613:1: error: control reaches end of non-void function [-Werror=return-type]
     613 | }
         | ^
   cc1: some warnings being treated as errors
--
   drivers/scsi/qedi/qedi_fw.c: In function 'qedi_ring_doorbell':
>> drivers/scsi/qedi/qedi_fw.c:939:64: error: expected ';' before 'asm'
     939 |  qedi_conn->ep->db_data.sq_prod = qedi_conn->ep->fw_sq_prod_idx
         |                                                                ^
         |                                                                ;


vim +504 drivers/scsi/qedi/qedi_iscsi.c

   499	
   500	static int qedi_iscsi_offload_conn(struct qedi_endpoint *qedi_ep)
   501	{
   502		struct qed_iscsi_params_offload *conn_info;
   503		struct qedi_ctx *qedi = qedi_ep->qedi;
 > 504		struct qedi_ep->db_data.params
   505		int rval;
   506		int i;
   507	
   508		conn_info = kzalloc(sizeof(*conn_info), GFP_KERNEL);
   509		if (!conn_info) {
   510			QEDI_ERR(&qedi->dbg_ctx,
   511				 "Failed to allocate memory ep=%p\n", qedi_ep);
   512			return -ENOMEM;
   513		}
   514	
   515		ether_addr_copy(conn_info->src.mac, qedi_ep->src_mac);
   516		ether_addr_copy(conn_info->dst.mac, qedi_ep->dst_mac);
   517	
   518		conn_info->src.ip[0] = ntohl(qedi_ep->src_addr[0]);
   519		conn_info->dst.ip[0] = ntohl(qedi_ep->dst_addr[0]);
   520	
   521		if (qedi_ep->ip_type == TCP_IPV4) {
   522			conn_info->ip_version = 0;
   523			QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
   524				  "After ntohl: src_addr=%pI4, dst_addr=%pI4\n",
   525				  qedi_ep->src_addr, qedi_ep->dst_addr);
   526		} else {
   527			for (i = 1; i < 4; i++) {
   528				conn_info->src.ip[i] = ntohl(qedi_ep->src_addr[i]);
   529				conn_info->dst.ip[i] = ntohl(qedi_ep->dst_addr[i]);
   530			}
   531	
   532			conn_info->ip_version = 1;
   533			QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
   534				  "After ntohl: src_addr=%pI6, dst_addr=%pI6\n",
   535				  qedi_ep->src_addr, qedi_ep->dst_addr);
   536		}
   537	
   538		conn_info->src.port = qedi_ep->src_port;
   539		conn_info->dst.port = qedi_ep->dst_port;
   540	
   541		conn_info->layer_code = ISCSI_SLOW_PATH_LAYER_CODE;
   542		conn_info->sq_pbl_addr = qedi_ep->sq_pbl_dma;
   543		conn_info->vlan_id = qedi_ep->vlan_id;
   544	
   545		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_TS_EN, 1);
   546		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_EN, 1);
   547		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_CNT_EN, 1);
   548		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_KA_EN, 1);
   549	
   550		conn_info->default_cq = (qedi_ep->fw_cid % qedi->num_queues);
   551	
   552		conn_info->ka_max_probe_cnt = DEF_KA_MAX_PROBE_COUNT;
   553		conn_info->dup_ack_theshold = 3;
   554		conn_info->rcv_wnd = 65535;
   555	
   556		conn_info->ss_thresh = 65535;
   557		conn_info->srtt = 300;
   558		conn_info->rtt_var = 150;
   559		conn_info->flow_label = 0;
   560		conn_info->ka_timeout = DEF_KA_TIMEOUT;
   561		conn_info->ka_interval = DEF_KA_INTERVAL;
   562		conn_info->max_rt_time = DEF_MAX_RT_TIME;
   563		conn_info->ttl = DEF_TTL;
   564		conn_info->tos_or_tc = DEF_TOS;
   565		conn_info->remote_port = qedi_ep->dst_port;
   566		conn_info->local_port = qedi_ep->src_port;
   567	
   568		conn_info->mss = qedi_calc_mss(qedi_ep->pmtu,
   569					       (qedi_ep->ip_type == TCP_IPV6),
   570					       1, (qedi_ep->vlan_id != 0));
   571	
   572		conn_info->cwnd = DEF_MAX_CWND * conn_info->mss;
   573		conn_info->rcv_wnd_scale = 4;
   574		conn_info->da_timeout_value = 200;
   575		conn_info->ack_frequency = 2;
   576	
   577		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
   578			  "Default cq index [%d], mss [%d]\n",
   579			  conn_info->default_cq, conn_info->mss);
   580	
   581		/* Prepare the doorbell parameters */
   582		qedi_ep->db_data.agg_flags = 0;
   583		qedi_ep->db_data.params = 0;
   584		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_DEST, DB_DEST_XCM);
   585		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_CMD,
   586			  DB_AGG_CMD_MAX);
   587		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_VAL_SEL,
   588			  DQ_XCM_ISCSI_SQ_PROD_CMD);
   589		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_BYPASS_EN, 1);
   590	
   591		/* register doorbell with doorbell recovery mechanism */
 > 592		rc = qedi_ops->common->db_recovery_add(qedi->cdev,
 > 593						qedi_ep.p_doorbell,
   594						&qedi_ep.db_data,
   595						DB_REC_WIDTH_32B, DB_REC_KERNEL);
   596		if (rc) {
   597			kfree(conn_info);
 > 598			return rval;
   599		}
   600	
   601		rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
   602		if (rval)
   603			/* delete doorbell from doorbell recovery mechanism */
   604			rc = qedi_ops->common->db_recovery_del(qedi->cdev,
   605							       qedi_ep.p_doorbell,
   606							       &qedi_ep.db_data);
   607	
   608			QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
   609				 rval, qedi_ep);
   610	
   611		kfree(conn_info);
   612		return rval;
   613	}
   614	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 64450 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qedi: Add support for fastpath doorvell recovery
@ 2021-08-04 19:45   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-08-04 19:45 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9166 bytes --]

Hi Shai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on scsi/for-next]
[also build test ERROR on mkp-scsi/for-next v5.14-rc4 next-20210804]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Shai-Malin/scsi-qedi-Add-support-for-fastpath-doorvell-recovery/20210804-234654
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/10706db207ac7784bf30729cba2c3ced86920e8a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shai-Malin/scsi-qedi-Add-support-for-fastpath-doorvell-recovery/20210804-234654
        git checkout 10706db207ac7784bf30729cba2c3ced86920e8a
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/scsi/qedi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_iscsi_offload_conn':
>> drivers/scsi/qedi/qedi_iscsi.c:504:16: error: expected identifier or '(' before '->' token
     504 |  struct qedi_ep->db_data.params
         |                ^~
>> drivers/scsi/qedi/qedi_iscsi.c:592:2: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
     592 |  rc = qedi_ops->common->db_recovery_add(qedi->cdev,
         |  ^~
         |  rq
   drivers/scsi/qedi/qedi_iscsi.c:592:2: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/scsi/qedi/qedi_iscsi.c:593:13: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     593 |      qedi_ep.p_doorbell,
         |             ^
         |             ->
   drivers/scsi/qedi/qedi_iscsi.c:594:14: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     594 |      &qedi_ep.db_data,
         |              ^
         |              ->
>> drivers/scsi/qedi/qedi_iscsi.c:598:10: error: 'rval' undeclared (first use in this function)
     598 |   return rval;
         |          ^~~~
   drivers/scsi/qedi/qedi_iscsi.c:605:21: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     605 |              qedi_ep.p_doorbell,
         |                     ^
         |                     ->
   drivers/scsi/qedi/qedi_iscsi.c:606:22: error: 'qedi_ep' is a pointer; did you mean to use '->'?
     606 |              &qedi_ep.db_data);
         |                      ^
         |                      ->
   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_ep_disconnect':
   drivers/scsi/qedi/qedi_iscsi.c:1130:2: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
    1130 |  rc = qedi_ops->common->db_recovery_del(qedi->cdev,
         |  ^~
         |  rq
   drivers/scsi/qedi/qedi_iscsi.c:1131:20: error: 'qedi_ep' is a pointer; did you mean to use '->'?
    1131 |             qedi_ep.p_doorbell,
         |                    ^
         |                    ->
   drivers/scsi/qedi/qedi_iscsi.c:1132:21: error: 'qedi_ep' is a pointer; did you mean to use '->'?
    1132 |             &qedi_ep.db_data);
         |                     ^
         |                     ->
   drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_iscsi_offload_conn':
   drivers/scsi/qedi/qedi_iscsi.c:613:1: error: control reaches end of non-void function [-Werror=return-type]
     613 | }
         | ^
   cc1: some warnings being treated as errors
--
   drivers/scsi/qedi/qedi_fw.c: In function 'qedi_ring_doorbell':
>> drivers/scsi/qedi/qedi_fw.c:939:64: error: expected ';' before 'asm'
     939 |  qedi_conn->ep->db_data.sq_prod = qedi_conn->ep->fw_sq_prod_idx
         |                                                                ^
         |                                                                ;


vim +504 drivers/scsi/qedi/qedi_iscsi.c

   499	
   500	static int qedi_iscsi_offload_conn(struct qedi_endpoint *qedi_ep)
   501	{
   502		struct qed_iscsi_params_offload *conn_info;
   503		struct qedi_ctx *qedi = qedi_ep->qedi;
 > 504		struct qedi_ep->db_data.params
   505		int rval;
   506		int i;
   507	
   508		conn_info = kzalloc(sizeof(*conn_info), GFP_KERNEL);
   509		if (!conn_info) {
   510			QEDI_ERR(&qedi->dbg_ctx,
   511				 "Failed to allocate memory ep=%p\n", qedi_ep);
   512			return -ENOMEM;
   513		}
   514	
   515		ether_addr_copy(conn_info->src.mac, qedi_ep->src_mac);
   516		ether_addr_copy(conn_info->dst.mac, qedi_ep->dst_mac);
   517	
   518		conn_info->src.ip[0] = ntohl(qedi_ep->src_addr[0]);
   519		conn_info->dst.ip[0] = ntohl(qedi_ep->dst_addr[0]);
   520	
   521		if (qedi_ep->ip_type == TCP_IPV4) {
   522			conn_info->ip_version = 0;
   523			QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
   524				  "After ntohl: src_addr=%pI4, dst_addr=%pI4\n",
   525				  qedi_ep->src_addr, qedi_ep->dst_addr);
   526		} else {
   527			for (i = 1; i < 4; i++) {
   528				conn_info->src.ip[i] = ntohl(qedi_ep->src_addr[i]);
   529				conn_info->dst.ip[i] = ntohl(qedi_ep->dst_addr[i]);
   530			}
   531	
   532			conn_info->ip_version = 1;
   533			QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
   534				  "After ntohl: src_addr=%pI6, dst_addr=%pI6\n",
   535				  qedi_ep->src_addr, qedi_ep->dst_addr);
   536		}
   537	
   538		conn_info->src.port = qedi_ep->src_port;
   539		conn_info->dst.port = qedi_ep->dst_port;
   540	
   541		conn_info->layer_code = ISCSI_SLOW_PATH_LAYER_CODE;
   542		conn_info->sq_pbl_addr = qedi_ep->sq_pbl_dma;
   543		conn_info->vlan_id = qedi_ep->vlan_id;
   544	
   545		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_TS_EN, 1);
   546		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_EN, 1);
   547		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_DA_CNT_EN, 1);
   548		SET_FIELD(conn_info->tcp_flags, TCP_OFFLOAD_PARAMS_KA_EN, 1);
   549	
   550		conn_info->default_cq = (qedi_ep->fw_cid % qedi->num_queues);
   551	
   552		conn_info->ka_max_probe_cnt = DEF_KA_MAX_PROBE_COUNT;
   553		conn_info->dup_ack_theshold = 3;
   554		conn_info->rcv_wnd = 65535;
   555	
   556		conn_info->ss_thresh = 65535;
   557		conn_info->srtt = 300;
   558		conn_info->rtt_var = 150;
   559		conn_info->flow_label = 0;
   560		conn_info->ka_timeout = DEF_KA_TIMEOUT;
   561		conn_info->ka_interval = DEF_KA_INTERVAL;
   562		conn_info->max_rt_time = DEF_MAX_RT_TIME;
   563		conn_info->ttl = DEF_TTL;
   564		conn_info->tos_or_tc = DEF_TOS;
   565		conn_info->remote_port = qedi_ep->dst_port;
   566		conn_info->local_port = qedi_ep->src_port;
   567	
   568		conn_info->mss = qedi_calc_mss(qedi_ep->pmtu,
   569					       (qedi_ep->ip_type == TCP_IPV6),
   570					       1, (qedi_ep->vlan_id != 0));
   571	
   572		conn_info->cwnd = DEF_MAX_CWND * conn_info->mss;
   573		conn_info->rcv_wnd_scale = 4;
   574		conn_info->da_timeout_value = 200;
   575		conn_info->ack_frequency = 2;
   576	
   577		QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
   578			  "Default cq index [%d], mss [%d]\n",
   579			  conn_info->default_cq, conn_info->mss);
   580	
   581		/* Prepare the doorbell parameters */
   582		qedi_ep->db_data.agg_flags = 0;
   583		qedi_ep->db_data.params = 0;
   584		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_DEST, DB_DEST_XCM);
   585		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_CMD,
   586			  DB_AGG_CMD_MAX);
   587		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_AGG_VAL_SEL,
   588			  DQ_XCM_ISCSI_SQ_PROD_CMD);
   589		SET_FIELD(qedi_ep->db_data.params, ISCSI_DB_DATA_BYPASS_EN, 1);
   590	
   591		/* register doorbell with doorbell recovery mechanism */
 > 592		rc = qedi_ops->common->db_recovery_add(qedi->cdev,
 > 593						qedi_ep.p_doorbell,
   594						&qedi_ep.db_data,
   595						DB_REC_WIDTH_32B, DB_REC_KERNEL);
   596		if (rc) {
   597			kfree(conn_info);
 > 598			return rval;
   599		}
   600	
   601		rval = qedi_ops->offload_conn(qedi->cdev, qedi_ep->handle, conn_info);
   602		if (rval)
   603			/* delete doorbell from doorbell recovery mechanism */
   604			rc = qedi_ops->common->db_recovery_del(qedi->cdev,
   605							       qedi_ep.p_doorbell,
   606							       &qedi_ep.db_data);
   607	
   608			QEDI_ERR(&qedi->dbg_ctx, "offload_conn returned %d, ep=%p\n",
   609				 rval, qedi_ep);
   610	
   611		kfree(conn_info);
   612		return rval;
   613	}
   614	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 64450 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 15:43 [PATCH] scsi: qedi: Add support for fastpath doorvell recovery Shai Malin
2021-08-04 19:45 ` kernel test robot
2021-08-04 19:45   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.