Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/iscsi Stop advertising more openings after limit is ...



details:   https://anonhg.NetBSD.org/src/rev/3506d292f3db
branches:  trunk
changeset: 1019332:3506d292f3db
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Mar 07 12:30:03 2021 +0000

description:
Stop advertising more openings after limit is reached.

diffstat:

 sys/dev/iscsi/iscsi_main.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 3d1613a930b6 -r 3506d292f3db sys/dev/iscsi/iscsi_main.c
--- a/sys/dev/iscsi/iscsi_main.c        Sun Mar 07 11:32:05 2021 +0000
+++ b/sys/dev/iscsi/iscsi_main.c        Sun Mar 07 12:30:03 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_main.c,v 1.33 2020/05/13 21:59:45 jdolecek Exp $ */
+/*     $NetBSD: iscsi_main.c,v 1.34 2021/03/07 12:30:03 mlelstv Exp $  */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -422,11 +422,12 @@
  * grow_resources
  *    Try to grow openings up to current window size
  */
-static void
+static int
 grow_resources(session_t *sess)
 {
        struct scsipi_adapter *adapt = &sess->s_sc_adapter;
        int win;
+       int rc = -1;
 
        mutex_enter(&sess->s_lock);
        if (sess->s_refcount < CCBS_FOR_SCSIPI &&
@@ -435,10 +436,13 @@
                if (win > sess->s_send_window) {
                        sess->s_send_window++;
                        adapt->adapt_openings++;
+                       rc = 0;
                        DEB(5, ("Grow send window to %d\n", sess->s_send_window));
                }
        }
        mutex_exit(&sess->s_lock);
+
+       return rc;
 }
 
 /******************************************************************************/
@@ -508,7 +512,10 @@
 
        case ADAPTER_REQ_GROW_RESOURCES:
                DEB(5, ("ISCSI: scsipi_request GROW_RESOURCES\n"));
-               grow_resources(sess);
+               if (grow_resources(sess)) {
+                       /* reached maximum */
+                       chan->chan_flags &= ~SCSIPI_CHAN_CANGROW;
+               }
                break;
 
        case ADAPTER_REQ_SET_XFER_MODE:



Home | Main Index | Thread Index | Old Index