]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Sep 2011 22:06:33 +0000 (15:06 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Sep 2011 22:06:33 +0000 (15:06 -0700)
queue-3.0/bnx2fc-fix-kernel-panic-when-deleting-npiv-ports.patch [new file with mode: 0644]
queue-3.0/bnx2fc-scsi_dma_unmap-not-invoked-on-io-completions.patch [new file with mode: 0644]
queue-3.0/cnic-bnx2-check-iscsi-support-early-in-bnx2_init_one.patch [new file with mode: 0644]
queue-3.0/cnic-fix-interrupt-logic.patch [new file with mode: 0644]
queue-3.0/cnic-fix-race-conditions-with-firmware.patch [new file with mode: 0644]
queue-3.0/cnic-improve-netdev_up-event-handling.patch [new file with mode: 0644]
queue-3.0/cnic-randomize-initial-tcp-port-for-iscsi-connections.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/bnx2fc-fix-kernel-panic-when-deleting-npiv-ports.patch b/queue-3.0/bnx2fc-fix-kernel-panic-when-deleting-npiv-ports.patch
new file mode 100644 (file)
index 0000000..31b01ec
--- /dev/null
@@ -0,0 +1,200 @@
+From d36b3279e157641c345b12eddb3db78fb42da80f Mon Sep 17 00:00:00 2001
+From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+Date: Fri, 27 May 2011 11:47:27 -0700
+Subject: [SCSI] bnx2fc: Fix kernel panic when deleting NPIV ports
+
+From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+
+commit d36b3279e157641c345b12eddb3db78fb42da80f upstream.
+
+Deleting NPIV port causes a kernel panic when the NPIV port is in the same zone
+as the physical port and shares the same LUN. This happens due to the fact that
+vport destroy and unsolicited ELS are scheduled to run on the same workqueue,
+and vport destroy destroys the lport and the unsolicited ELS tries to access
+the invalid lport.  This patch fixes this issue by maintaining a list of valid
+lports and verifying if the lport is valid or not before accessing it.
+
+Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/bnx2fc/bnx2fc.h      |    8 +++++++-
+ drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   28 +++++++++++++++++++++++++++-
+ drivers/scsi/bnx2fc/bnx2fc_hwi.c  |   24 +++++++++++++++++++++++-
+ 3 files changed, 57 insertions(+), 3 deletions(-)
+
+--- a/drivers/scsi/bnx2fc/bnx2fc.h
++++ b/drivers/scsi/bnx2fc/bnx2fc.h
+@@ -152,7 +152,6 @@ struct bnx2fc_percpu_s {
+       spinlock_t fp_work_lock;
+ };
+-
+ struct bnx2fc_hba {
+       struct list_head link;
+       struct cnic_dev *cnic;
+@@ -179,6 +178,7 @@ struct bnx2fc_hba {
+               #define BNX2FC_CTLR_INIT_DONE           1
+               #define BNX2FC_CREATE_DONE              2
+       struct fcoe_ctlr ctlr;
++      struct list_head vports;
+       u8 vlan_enabled;
+       int vlan_id;
+       u32 next_conn_id;
+@@ -232,6 +232,11 @@ struct bnx2fc_hba {
+ #define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_hba, ctlr)
++struct bnx2fc_lport {
++      struct list_head list;
++      struct fc_lport *lport;
++};
++
+ struct bnx2fc_cmd_mgr {
+       struct bnx2fc_hba *hba;
+       u16 next_idx;
+@@ -423,6 +428,7 @@ struct bnx2fc_work {
+ struct bnx2fc_unsol_els {
+       struct fc_lport *lport;
+       struct fc_frame *fp;
++      struct bnx2fc_hba *hba;
+       struct work_struct unsol_els_work;
+ };
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+@@ -1225,6 +1225,7 @@ static int bnx2fc_interface_setup(struct
+       hba->ctlr.get_src_addr = bnx2fc_get_src_mac;
+       set_bit(BNX2FC_CTLR_INIT_DONE, &hba->init_done);
++      INIT_LIST_HEAD(&hba->vports);
+       rc = bnx2fc_netdev_setup(hba);
+       if (rc)
+               goto setup_err;
+@@ -1261,8 +1262,15 @@ static struct fc_lport *bnx2fc_if_create
+       struct fcoe_port        *port;
+       struct Scsi_Host        *shost;
+       struct fc_vport         *vport = dev_to_vport(parent);
++      struct bnx2fc_lport     *blport;
+       int                     rc = 0;
++      blport = kzalloc(sizeof(struct bnx2fc_lport), GFP_KERNEL);
++      if (!blport) {
++              BNX2FC_HBA_DBG(hba->ctlr.lp, "Unable to alloc bnx2fc_lport\n");
++              return NULL;
++      }
++
+       /* Allocate Scsi_Host structure */
+       if (!npiv)
+               lport = libfc_host_alloc(&bnx2fc_shost_template, sizeof(*port));
+@@ -1271,7 +1279,7 @@ static struct fc_lport *bnx2fc_if_create
+       if (!lport) {
+               printk(KERN_ERR PFX "could not allocate scsi host structure\n");
+-              return NULL;
++              goto free_blport;
+       }
+       shost = lport->host;
+       port = lport_priv(lport);
+@@ -1327,12 +1335,20 @@ static struct fc_lport *bnx2fc_if_create
+       }
+       bnx2fc_interface_get(hba);
++
++      spin_lock_bh(&hba->hba_lock);
++      blport->lport = lport;
++      list_add_tail(&blport->list, &hba->vports);
++      spin_unlock_bh(&hba->hba_lock);
++
+       return lport;
+ shost_err:
+       scsi_remove_host(shost);
+ lp_config_err:
+       scsi_host_put(lport->host);
++free_blport:
++      kfree(blport);
+       return NULL;
+ }
+@@ -1348,6 +1364,7 @@ static void bnx2fc_if_destroy(struct fc_
+ {
+       struct fcoe_port *port = lport_priv(lport);
+       struct bnx2fc_hba *hba = port->priv;
++      struct bnx2fc_lport *blport, *tmp;
+       BNX2FC_HBA_DBG(hba->ctlr.lp, "ENTERED bnx2fc_if_destroy\n");
+       /* Stop the transmit retry timer */
+@@ -1372,6 +1389,15 @@ static void bnx2fc_if_destroy(struct fc_
+       /* Free memory used by statistical counters */
+       fc_lport_free_stats(lport);
++      spin_lock_bh(&hba->hba_lock);
++      list_for_each_entry_safe(blport, tmp, &hba->vports, list) {
++              if (blport->lport == lport) {
++                      list_del(&blport->list);
++                      kfree(blport);
++              }
++      }
++      spin_unlock_bh(&hba->hba_lock);
++
+       /* Release Scsi_Host */
+       scsi_host_put(lport->host);
+--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+@@ -480,16 +480,36 @@ int bnx2fc_send_session_destroy_req(stru
+       return rc;
+ }
++static bool is_valid_lport(struct bnx2fc_hba *hba, struct fc_lport *lport)
++{
++      struct bnx2fc_lport *blport;
++
++      spin_lock_bh(&hba->hba_lock);
++      list_for_each_entry(blport, &hba->vports, list) {
++              if (blport->lport == lport) {
++                      spin_unlock_bh(&hba->hba_lock);
++                      return true;
++              }
++      }
++      spin_unlock_bh(&hba->hba_lock);
++      return false;
++
++}
++
++
+ static void bnx2fc_unsol_els_work(struct work_struct *work)
+ {
+       struct bnx2fc_unsol_els *unsol_els;
+       struct fc_lport *lport;
++      struct bnx2fc_hba *hba;
+       struct fc_frame *fp;
+       unsol_els = container_of(work, struct bnx2fc_unsol_els, unsol_els_work);
+       lport = unsol_els->lport;
+       fp = unsol_els->fp;
+-      fc_exch_recv(lport, fp);
++      hba = unsol_els->hba;
++      if (is_valid_lport(hba, lport))
++              fc_exch_recv(lport, fp);
+       kfree(unsol_els);
+ }
+@@ -499,6 +519,7 @@ void bnx2fc_process_l2_frame_compl(struc
+ {
+       struct fcoe_port *port = tgt->port;
+       struct fc_lport *lport = port->lport;
++      struct bnx2fc_hba *hba = port->priv;
+       struct bnx2fc_unsol_els *unsol_els;
+       struct fc_frame_header *fh;
+       struct fc_frame *fp;
+@@ -559,6 +580,7 @@ void bnx2fc_process_l2_frame_compl(struc
+               fr_eof(fp) = FC_EOF_T;
+               fr_crc(fp) = cpu_to_le32(~crc);
+               unsol_els->lport = lport;
++              unsol_els->hba = hba;
+               unsol_els->fp = fp;
+               INIT_WORK(&unsol_els->unsol_els_work, bnx2fc_unsol_els_work);
+               queue_work(bnx2fc_wq, &unsol_els->unsol_els_work);
diff --git a/queue-3.0/bnx2fc-scsi_dma_unmap-not-invoked-on-io-completions.patch b/queue-3.0/bnx2fc-scsi_dma_unmap-not-invoked-on-io-completions.patch
new file mode 100644 (file)
index 0000000..e880526
--- /dev/null
@@ -0,0 +1,37 @@
+From b5a95fe7ef464a67fab6ff870aa740739e788f90 Mon Sep 17 00:00:00 2001
+From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+Date: Fri, 27 May 2011 11:47:26 -0700
+Subject: [SCSI] bnx2fc: scsi_dma_unmap() not invoked on IO completions
+
+From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+
+commit b5a95fe7ef464a67fab6ff870aa740739e788f90 upstream.
+
+Do not set io_req->sc_cmd to NULL until bnx2fc_unmap_sg_list() is called to
+enable it to unmap the DMA mappings.
+
+Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+
+---
+ drivers/scsi/bnx2fc/bnx2fc_io.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
+@@ -1734,7 +1734,6 @@ void bnx2fc_process_scsi_cmd_compl(struc
+               printk(KERN_ERR PFX "SCp.ptr is NULL\n");
+               return;
+       }
+-      io_req->sc_cmd = NULL;
+       if (io_req->on_active_queue) {
+               list_del_init(&io_req->link);
+@@ -1754,6 +1753,7 @@ void bnx2fc_process_scsi_cmd_compl(struc
+       }
+       bnx2fc_unmap_sg_list(io_req);
++      io_req->sc_cmd = NULL;
+       switch (io_req->fcp_status) {
+       case FC_GOOD:
diff --git a/queue-3.0/cnic-bnx2-check-iscsi-support-early-in-bnx2_init_one.patch b/queue-3.0/cnic-bnx2-check-iscsi-support-early-in-bnx2_init_one.patch
new file mode 100644 (file)
index 0000000..aeaf45b
--- /dev/null
@@ -0,0 +1,86 @@
+From 7625eb2f2fff7bfae41d3119b472c20b48874895 Mon Sep 17 00:00:00 2001
+From: Michael Chan <mchan@broadcom.com>
+Date: Wed, 8 Jun 2011 19:29:36 +0000
+Subject: cnic, bnx2: Check iSCSI support early in bnx2_init_one()
+
+From: Michael Chan <mchan@broadcom.com>
+
+commit 7625eb2f2fff7bfae41d3119b472c20b48874895 upstream.
+
+Based on earlier patch from Neil Horman <nhorman@tuxdriver.com>
+
+If iSCSI is not supported on a bnx2 device, bnx2_cnic_probe() will
+return NULL and the cnic device will not be visible to bnx2i.  This
+will prevent bnx2i from registering and then unregistering during
+cnic_start() and cause the warning message:
+
+bnx2 0003:01:00.1: eth1: Failed waiting for ULP up call to complete
+
+Signed-off-by: Michael Chan <mchan@broadcom.com>
+Cc: Neil Horman <nhorman@tuxdriver.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/bnx2.c |    7 +++++++
+ drivers/net/cnic.c |   12 ++----------
+ 2 files changed, 9 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/bnx2.c
++++ b/drivers/net/bnx2.c
+@@ -416,6 +416,9 @@ struct cnic_eth_dev *bnx2_cnic_probe(str
+       struct bnx2 *bp = netdev_priv(dev);
+       struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
++      if (!cp->max_iscsi_conn)
++              return NULL;
++
+       cp->drv_owner = THIS_MODULE;
+       cp->chip_id = bp->chip_id;
+       cp->pdev = bp->pdev;
+@@ -8177,6 +8180,10 @@ bnx2_init_board(struct pci_dev *pdev, st
+       bp->timer.data = (unsigned long) bp;
+       bp->timer.function = bnx2_timer;
++#ifdef BCM_CNIC
++      bp->cnic_eth_dev.max_iscsi_conn =
++              bnx2_reg_rd_ind(bp, BNX2_FW_MAX_ISCSI_CONN);
++#endif
+       pci_save_state(pdev);
+       return 0;
+--- a/drivers/net/cnic.c
++++ b/drivers/net/cnic.c
+@@ -4225,14 +4225,6 @@ static void cnic_enable_bnx2_int(struct
+               BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx);
+ }
+-static void cnic_get_bnx2_iscsi_info(struct cnic_dev *dev)
+-{
+-      u32 max_conn;
+-
+-      max_conn = cnic_reg_rd_ind(dev, BNX2_FW_MAX_ISCSI_CONN);
+-      dev->max_iscsi_conn = max_conn;
+-}
+-
+ static void cnic_disable_bnx2_int_sync(struct cnic_dev *dev)
+ {
+       struct cnic_local *cp = dev->cnic_priv;
+@@ -4557,8 +4549,6 @@ static int cnic_start_bnx2_hw(struct cni
+               return err;
+       }
+-      cnic_get_bnx2_iscsi_info(dev);
+-
+       return 0;
+ }
+@@ -5224,6 +5214,8 @@ static struct cnic_dev *init_bnx2_cnic(s
+       cdev->pcidev = pdev;
+       cp->chip_id = ethdev->chip_id;
++      cdev->max_iscsi_conn = ethdev->max_iscsi_conn;
++
+       cp->cnic_ops = &cnic_bnx2_ops;
+       cp->start_hw = cnic_start_bnx2_hw;
+       cp->stop_hw = cnic_stop_bnx2_hw;
diff --git a/queue-3.0/cnic-fix-interrupt-logic.patch b/queue-3.0/cnic-fix-interrupt-logic.patch
new file mode 100644 (file)
index 0000000..447e777
--- /dev/null
@@ -0,0 +1,51 @@
+From 93736656138e6d2f39f19c1d68f9ef81cfc9dd66 Mon Sep 17 00:00:00 2001
+From: Michael Chan <mchan@broadcom.com>
+Date: Wed, 8 Jun 2011 19:29:32 +0000
+Subject: cnic: Fix interrupt logic
+
+From: Michael Chan <mchan@broadcom.com>
+
+commit 93736656138e6d2f39f19c1d68f9ef81cfc9dd66 upstream.
+
+We need to keep looping until cnic_get_kcqes() returns 0.  cnic_get_kcqes()
+returns a maximum of 64 entries.  If there are more entries in the queue
+and we don't loop back, the remaining entries may not be serviced for a
+long time.
+
+Signed-off-by: Michael Chan <mchan@broadcom.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/cnic.c |   13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/cnic.c
++++ b/drivers/net/cnic.c
+@@ -2778,13 +2778,10 @@ static u32 cnic_service_bnx2_queues(stru
+               /* Tell compiler that status_blk fields can change. */
+               barrier();
+-              if (status_idx != *cp->kcq1.status_idx_ptr) {
+-                      status_idx = (u16) *cp->kcq1.status_idx_ptr;
+-                      /* status block index must be read first */
+-                      rmb();
+-                      cp->kwq_con_idx = *cp->kwq_con_idx_ptr;
+-              } else
+-                      break;
++              status_idx = (u16) *cp->kcq1.status_idx_ptr;
++              /* status block index must be read first */
++              rmb();
++              cp->kwq_con_idx = *cp->kwq_con_idx_ptr;
+       }
+       CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx);
+@@ -2908,8 +2905,6 @@ static u32 cnic_service_bnx2x_kcq(struct
+               /* Tell compiler that sblk fields can change. */
+               barrier();
+-              if (last_status == *info->status_idx_ptr)
+-                      break;
+               last_status = *info->status_idx_ptr;
+               /* status block index must be read before reading the KCQ */
diff --git a/queue-3.0/cnic-fix-race-conditions-with-firmware.patch b/queue-3.0/cnic-fix-race-conditions-with-firmware.patch
new file mode 100644 (file)
index 0000000..c66e462
--- /dev/null
@@ -0,0 +1,57 @@
+From 101c40c8cb0d10c30f423805f9f5b7a75956832d Mon Sep 17 00:00:00 2001
+From: Michael Chan <mchan@broadcom.com>
+Date: Wed, 8 Jun 2011 19:29:33 +0000
+Subject: cnic: Fix race conditions with firmware
+
+From: Michael Chan <mchan@broadcom.com>
+
+commit 101c40c8cb0d10c30f423805f9f5b7a75956832d upstream.
+
+During iSCSI connection terminations, if the target is also terminating
+at about the same time, the firmware may not complete the driver's
+request to close or reset the connection.  This is fixed by handling
+other events (instead of the expected completion event) as an indication
+that the driver's request has been rejected.
+
+Signed-off-by: Michael Chan <mchan@broadcom.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/cnic.c |   14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/cnic.c
++++ b/drivers/net/cnic.c
+@@ -3767,7 +3767,13 @@ static void cnic_cm_process_kcqe(struct
+               break;
+       case L4_KCQE_OPCODE_VALUE_CLOSE_RECEIVED:
+-              cnic_cm_upcall(cp, csk, opcode);
++              /* after we already sent CLOSE_REQ */
++              if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags) &&
++                  !test_bit(SK_F_OFFLD_COMPLETE, &csk->flags) &&
++                  csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)
++                      cp->close_conn(csk, L4_KCQE_OPCODE_VALUE_RESET_COMP);
++              else
++                      cnic_cm_upcall(cp, csk, opcode);
+               break;
+       }
+       csk_put(csk);
+@@ -3821,12 +3827,14 @@ static int cnic_ready_to_close(struct cn
+       }
+       /* 1. If event opcode matches the expected event in csk->state
+-       * 2. If the expected event is CLOSE_COMP, we accept any event
++       * 2. If the expected event is CLOSE_COMP or RESET_COMP, we accept any
++       *    event
+        * 3. If the expected event is 0, meaning the connection was never
+        *    never established, we accept the opcode from cm_abort.
+        */
+       if (opcode == csk->state || csk->state == 0 ||
+-          csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP) {
++          csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP ||
++          csk->state == L4_KCQE_OPCODE_VALUE_RESET_COMP) {
+               if (!test_and_set_bit(SK_F_CLOSING, &csk->flags)) {
+                       if (csk->state == 0)
+                               csk->state = opcode;
diff --git a/queue-3.0/cnic-improve-netdev_up-event-handling.patch b/queue-3.0/cnic-improve-netdev_up-event-handling.patch
new file mode 100644 (file)
index 0000000..d31a4a1
--- /dev/null
@@ -0,0 +1,44 @@
+From db1d350fcb156b58f66a67680617077bcacfe6fc Mon Sep 17 00:00:00 2001
+From: Michael Chan <mchan@broadcom.com>
+Date: Wed, 8 Jun 2011 19:29:35 +0000
+Subject: cnic: Improve NETDEV_UP event handling
+
+From: Michael Chan <mchan@broadcom.com>
+
+commit db1d350fcb156b58f66a67680617077bcacfe6fc upstream.
+
+During NETDEV_UP, we use symbol_get() to get the net driver's cnic
+probe function.  This sometimes doesn't work if NETDEV_UP happens
+right after NETDEV_REGISTER and the net driver is still running module
+init code.  As a result, the cnic device may not be discovered.  We
+fix this by probing on all NETDEV events if the device's netif_running
+state is up.
+
+Signed-off-by: Michael Chan <mchan@broadcom.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/cnic.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/cnic.c
++++ b/drivers/net/cnic.c
+@@ -5342,7 +5342,7 @@ static int cnic_netdev_event(struct noti
+       dev = cnic_from_netdev(netdev);
+-      if (!dev && (event == NETDEV_REGISTER || event == NETDEV_UP)) {
++      if (!dev && (event == NETDEV_REGISTER || netif_running(netdev))) {
+               /* Check for the hot-plug device */
+               dev = is_cnic_dev(netdev);
+               if (dev) {
+@@ -5358,7 +5358,7 @@ static int cnic_netdev_event(struct noti
+               else if (event == NETDEV_UNREGISTER)
+                       cnic_ulp_exit(dev);
+-              if (event == NETDEV_UP) {
++              if (event == NETDEV_UP || (new_dev && netif_running(netdev))) {
+                       if (cnic_register_netdev(dev) != 0) {
+                               cnic_put(dev);
+                               goto done;
diff --git a/queue-3.0/cnic-randomize-initial-tcp-port-for-iscsi-connections.patch b/queue-3.0/cnic-randomize-initial-tcp-port-for-iscsi-connections.patch
new file mode 100644 (file)
index 0000000..e225ad4
--- /dev/null
@@ -0,0 +1,74 @@
+From 11f23aa8ccd56786f0a6f04211cf59b3fab2ce08 Mon Sep 17 00:00:00 2001
+From: Eddie Wai <eddie.wai@broadcom.com>
+Date: Wed, 8 Jun 2011 19:29:34 +0000
+Subject: cnic: Randomize initial TCP port for iSCSI connections
+
+From: Eddie Wai <eddie.wai@broadcom.com>
+
+commit 11f23aa8ccd56786f0a6f04211cf59b3fab2ce08 upstream.
+
+This reduces the likelihood of port re-use when re-loading the driver.
+
+Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
+Signed-off-by: Michael Chan <mchan@broadcom.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/cnic.c |   14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/cnic.c
++++ b/drivers/net/cnic.c
+@@ -605,11 +605,12 @@ static int cnic_unregister_device(struct
+ }
+ EXPORT_SYMBOL(cnic_unregister_driver);
+-static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id)
++static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
++                          u32 next)
+ {
+       id_tbl->start = start_id;
+       id_tbl->max = size;
+-      id_tbl->next = 0;
++      id_tbl->next = next;
+       spin_lock_init(&id_tbl->lock);
+       id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL);
+       if (!id_tbl->table)
+@@ -3804,14 +3805,17 @@ static void cnic_cm_free_mem(struct cnic
+ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
+ {
+       struct cnic_local *cp = dev->cnic_priv;
++      u32 port_id;
+       cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
+                             GFP_KERNEL);
+       if (!cp->csk_tbl)
+               return -ENOMEM;
++      get_random_bytes(&port_id, sizeof(port_id));
++      port_id %= CNIC_LOCAL_PORT_RANGE;
+       if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
+-                           CNIC_LOCAL_PORT_MIN)) {
++                           CNIC_LOCAL_PORT_MIN, port_id)) {
+               cnic_cm_free_mem(dev);
+               return -ENOMEM;
+       }
+@@ -4829,7 +4833,7 @@ static int cnic_start_bnx2x_hw(struct cn
+       pfid = cp->pfid;
+       ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ,
+-                             cp->iscsi_start_cid);
++                             cp->iscsi_start_cid, 0);
+       if (ret)
+               return -ENOMEM;
+@@ -4837,7 +4841,7 @@ static int cnic_start_bnx2x_hw(struct cn
+       if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
+               ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl,
+                                       BNX2X_FCOE_NUM_CONNECTIONS,
+-                                      cp->fcoe_start_cid);
++                                      cp->fcoe_start_cid, 0);
+               if (ret)
+                       return -ENOMEM;
index 2916c8022b02e3bd56702d170b109ffcc7c8f367..ceb122848d48472d02135e9a85e690b49a613954 100644 (file)
@@ -211,3 +211,10 @@ alsa-fm801-fix-double-free-in-case-of-error-in-tuner-detection.patch
 alsa-fm801-gracefully-handle-failure-of-tuner-auto-detect.patch
 btrfs-fix-d_off-in-the-first-dirent.patch
 pci-don-t-crash-when-reading-mpss-from-root-complex.patch
+cnic-fix-interrupt-logic.patch
+cnic-fix-race-conditions-with-firmware.patch
+cnic-randomize-initial-tcp-port-for-iscsi-connections.patch
+cnic-improve-netdev_up-event-handling.patch
+cnic-bnx2-check-iscsi-support-early-in-bnx2_init_one.patch
+bnx2fc-fix-kernel-panic-when-deleting-npiv-ports.patch
+bnx2fc-scsi_dma_unmap-not-invoked-on-io-completions.patch