Re: [PATCH 2/7] BNX2I: Created an active linklist which holds bnx2i endpoints

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

 



On 06/25/2010 08:39 PM, Eddie Wai wrote:
+/**
+ * bnx2i_ep_active_list_add - add an entry to ep active list
+ * @hba:	pointer to adapter instance
+ * @ep:		pointer to endpoint (transport indentifier) structure
+ *
+ * current active conn queue manager
+ */
+static int bnx2i_ep_active_list_add(struct bnx2i_hba *hba,
+				    struct bnx2i_endpoint *ep)
+{
+	write_lock_bh(&hba->ep_rdwr_lock);
+	list_add_tail(&ep->link,&hba->ep_active_list);
+	write_unlock_bh(&hba->ep_rdwr_lock);
+	return 0;
+}

I do not think you need the return here. It is always zero and no one ever checks it.


+
+
+/**
+ * bnx2i_ep_active_list_del - deletes an entry to ep active list
+ * @hba:	pointer to adapter instance
+ * @ep:		pointer to endpoint (transport indentifier) structure
+ *
+ * current active conn queue manager
+ */
+static int bnx2i_ep_active_list_del(struct bnx2i_hba *hba,
+				    struct bnx2i_endpoint *ep)
+{
+	write_lock_bh(&hba->ep_rdwr_lock);
+	list_del_init(&ep->link);
+	write_unlock_bh(&hba->ep_rdwr_lock);
+	return 0;
+}

Same as above.

@@ -1755,6 +1792,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
  	} else
  		rc = cnic->cm_connect(bnx2i_ep->cm_sk,&saddr);

+	bnx2i_ep_active_list_add(hba, bnx2i_ep);
+
  	if (rc)
  		goto release_ep;

This is a little strange. It seems cleaner to just do:

        if (bnx2i_map_ep_dbell_regs(bnx2i_ep))
                goto del_active_ep:

del_active_ep:
	bnx2i_ep_active_list_del(hba, bnx2i_ep);
release_ep:
        if (bnx2i_tear_down_conn(hba, bnx2i_ep)) {
                mutex_unlock(&hba->net_dev_lock);
                return ERR_PTR(rc);



@@ -1764,6 +1803,7 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
  	return ep;

  release_ep:
+	bnx2i_ep_active_list_del(hba, bnx2i_ep);
  	if (bnx2i_tear_down_conn(hba, bnx2i_ep)) {
  		mutex_unlock(&hba->net_dev_lock);
  		return ERR_PTR(rc);
@@ -1931,6 +1971,7 @@ int bnx2i_hw_ep_disconnect(struct bnx2i_endpoint *bnx2i_ep)
  	del_timer_sync(&bnx2i_ep->ofld_timer);

  destroy_conn:
+	bnx2i_ep_active_list_del(hba, bnx2i_ep);
  	if (bnx2i_tear_down_conn(hba, bnx2i_ep))
  		ret = -EINVAL;
  out:

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux