]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
IB/srp: Get rid of "Target has req_lim 0" messages
authorRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:33 +0000 (20:37 -0700)
committerRoland Dreier <rolandd@cisco.com>
Sun, 18 Jun 2006 03:37:33 +0000 (20:37 -0700)
It's perfectly valid for a connection to an SRP target to have a
request limit of 0, so get rid of the message about it, which can spam
kernel logs even with printk_ratelimit().  Keep a count of such events
in a "zero_req_lim" SCSI host attribute instead, so someone who cares
can look at the statistics.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/srp/ib_srp.c
drivers/infiniband/ulp/srp/ib_srp.h

index 4ba790f54a243205d2a8b31c42ff81fdcbe0a7a5..f1401e1f2f97e59806471eba7f99439d64f1a0eb 100644 (file)
@@ -894,12 +894,8 @@ static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target)
        if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE)
                return NULL;
 
-       if (unlikely(target->req_lim < 1)) {
-               if (printk_ratelimit())
-                       printk(KERN_DEBUG PFX "Target has req_lim %d\n",
-                              target->req_lim);
-               return NULL;
-       }
+       if (unlikely(target->req_lim < 1))
+               ++target->zero_req_lim;
 
        return target->tx_ring[target->tx_head & SRP_SQ_SIZE];
 }
@@ -1422,11 +1418,23 @@ static ssize_t show_dgid(struct class_device *cdev, char *buf)
                       be16_to_cpu(((__be16 *) target->path.dgid.raw)[7]));
 }
 
+static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
+{
+       struct srp_target_port *target = host_to_target(class_to_shost(cdev));
+
+       if (target->state == SRP_TARGET_DEAD ||
+           target->state == SRP_TARGET_REMOVED)
+               return -ENODEV;
+
+       return sprintf(buf, "%d\n", target->zero_req_lim);
+}
+
 static CLASS_DEVICE_ATTR(id_ext,       S_IRUGO, show_id_ext,           NULL);
 static CLASS_DEVICE_ATTR(ioc_guid,     S_IRUGO, show_ioc_guid,         NULL);
 static CLASS_DEVICE_ATTR(service_id,   S_IRUGO, show_service_id,       NULL);
 static CLASS_DEVICE_ATTR(pkey,         S_IRUGO, show_pkey,             NULL);
 static CLASS_DEVICE_ATTR(dgid,         S_IRUGO, show_dgid,             NULL);
+static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim,     NULL);
 
 static struct class_device_attribute *srp_host_attrs[] = {
        &class_device_attr_id_ext,
@@ -1434,6 +1442,7 @@ static struct class_device_attribute *srp_host_attrs[] = {
        &class_device_attr_service_id,
        &class_device_attr_pkey,
        &class_device_attr_dgid,
+       &class_device_attr_zero_req_lim,
        NULL
 };
 
index 033a44772ae3f868e698dc07ab61c285f7b65f3e..ad45e4856e1cf67f167bd2c44146dbf27a7668bc 100644 (file)
@@ -138,6 +138,8 @@ struct srp_target_port {
        int                     max_ti_iu_len;
        s32                     req_lim;
 
+       int                     zero_req_lim;
+
        unsigned                rx_head;
        struct srp_iu          *rx_ring[SRP_RQ_SIZE];