From: Adheer Chandravanshi <[email protected]>

Handle the Multi Function mode correctly when dealing with bnx2x driver.

Signed-off-by: Adheer Chandravanshi <[email protected]>
---
 iscsiuio/src/unix/libs/bnx2x.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c
index 1495762..a364d76 100644
--- a/iscsiuio/src/unix/libs/bnx2x.c
+++ b/iscsiuio/src/unix/libs/bnx2x.c
@@ -672,6 +672,9 @@ static int bnx2x_open(nic_t *nic)
        uint32_t bus;
        uint32_t slot;
        uint32_t func;
+       uint32_t mode;
+       __u32 proto_offset;
+       __u32 ovtag_offset;
 
        /*  Sanity Check: validate the parameters */
        if (nic == NULL) {
@@ -1002,9 +1005,11 @@ static int bnx2x_open(nic_t *nic)
                        mf_cfg_addr = bp->shmem_base + 0x7e4;
 
                /* shared_feat_cfg.config */
-               val = bnx2x_rd32(bp, bp->shmem_base + 0x354);
-               /* SI mode */
-               if ((val & 0x700) == 0x300) {
+               mode = bnx2x_rd32(bp, bp->shmem_base + 0x354);
+               mode &= 0x700;
+               LOG_DEBUG(PFX "%s: mode = 0x%x", nic->log_name, mode);
+               switch (mode) {
+               case 0x300: /* SI mode */
                        mac_offset = 0xe4 + (bp->func * 0x28) + 4;
                        val = bnx2x_rd32(bp, mf_cfg_addr + mac_offset);
                        mac[0] = (__u8) (val >> 8);
@@ -1027,9 +1032,13 @@ static int bnx2x_open(nic_t *nic)
                                rc = -ENOTSUP;
                                goto open_error;
                        }
-               } else if ((val & 0x700) == 0) {
-                       __u32 proto_offset = 0x24 + (bp->func * 0x18);
-                       __u32 ovtag_offset = proto_offset + 0xc;
+                       break;
+
+               case 0x0: /* MF SD mode */
+               case 0x500:
+               case 0x600:
+                       proto_offset = 0x24 + (bp->func * 0x18);
+                       ovtag_offset = proto_offset + 0xc;
 
                        rc = -ENOTSUP;
                        val = bnx2x_rd32(bp, mf_cfg_addr + ovtag_offset);
@@ -1057,7 +1066,7 @@ static int bnx2x_open(nic_t *nic)
                        mac[4] = (__u8) (val >> 8);
                        mac[5] = (__u8) val;
                        memcpy(nic->mac_addr, mac, 6);
-
+                       break;
                }
        }
 SF:
-- 
1.7.1

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to