[ofw] [summy patch] Allow basic functionality of RoCE to work

Tzachi Dar tzachid at mellanox.co.il
Mon Dec 27 07:37:36 PST 2010


The following "patch" is a collection of "fixes" that I have created in order to have a basic functionality of RoCE working on windows.

As you will probably see from reading this patch, this is obviously not something that we can checkin, but rather this is a list of places that we need to change in order to get roce to work.

With the changes below, I have the following working:

1)      ND (version 1 - ibal) working.

2)      Ib_send_bw working. (RC + UD)

3)      A basic winverbes test working.

>From the functionality perspective, I still need to have all the nd versions work (nd over winverbies, ND 2), RDMA CM working, more winverbes program working, RDMA-CM working, multicast, ...

As far as I can see, adding more functionality should be relatively the easy part. The real problems that it seems that I'll have are more related to having small fixes to many small factors:


1)      Having both ports working.

2)      Having eth, ib drivers go up and down with different order. This has problems with the caching of gids by the mlx4_bus driver.

3)      Fixing the mtu issues (Ethernet usually works with mtu=1500, while RoCE works better with mtu=2k.

4)      Performance tuning.

5)      Add support for vlans,

6)      Don't handle qp0.

7)      UD support on user mode.

8)      Setup issues.

9)      UI issues.

Please note that the patch below assumes that you have the hw driver that I have submitted to ofw last week. Since it seems that most people did not receive it, please let me know if you need the latest mlx4_bus driver.

Thanks
Tzachi


===================================================================
--- hw/mlx4/kernel/bus/core/cache.c    (revision 6962)
+++ hw/mlx4/kernel/bus/core/cache.c (working copy)
@@ -289,6 +290,18 @@
                                }
                }

+             MLX4_PRINT(TRACE_LEVEL_WARNING, MLX4_DBG_DRV,("First gid that was read is 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+                                             gid_cache->table1->raw[8],
+                                             gid_cache->table1->raw[9],
+                                             gid_cache->table1->raw[10],
+                                             gid_cache->table1->raw[11],
+                                             gid_cache->table1->raw[12],
+                                             gid_cache->table1->raw[13],
+                                             gid_cache->table1->raw[14],
+                                             gid_cache->table1->raw[15]
+                             ));
+
+
                write_lock_irq(&device->cache.lock);

                old_pkey_cache = device->cache.pkey_cache[port - start_port(device)];
Index: hw/mlx4/kernel/bus/drv/drv.c
===================================================================
--- hw/mlx4/kernel/bus/drv/drv.c           (revision 6962)
+++ hw/mlx4/kernel/bus/drv/drv.c        (working copy)
@@ -262,16 +262,19 @@
                number_of_ib_ports = mlx4_count_ib_ports(mdev);
                ASSERT(number_of_ib_ports >=0 && number_of_ib_ports <=2);

-#if 0
+
                //For now we it's either IB or ETH, and we always create LLE if it's ETH
-              if((number_of_ib_ports > 0) && (mdev->caps.port_type[1] == MLX4_PORT_TYPE_IB) ) {
-                              status = __create_child(Device, BUS_HARDWARE_IDS, BUS_HARDWARE_DESCRIPTION, 0 );
+//         if((number_of_ib_ports > 0) && (mdev->caps.port_type[1] == MLX4_PORT_TYPE_IB) ) {
+                             status = __create_child(Device, BUS_HARDWARE_IDS, BUS_HARDWARE_IDS, BUS_HARDWARE_DESCRIPTION, 0 );
                                if (!NT_SUCCESS(status)) {
                                                 MLX4_PRINT_EV(TRACE_LEVEL_ERROR, MLX4_DBG_DRV, ("__create_child (ib)failed with 0x%x\n", status));
+                                             //??????? error
+                             } else {
+                                             ib_created = TRUE;
                                }
-              }
-#endif
+//         }

+
                for (i = 1; i <= mdev->caps.num_ports; i++) {
                                if (mlx4_is_enabled_port(mdev, i)) {
                                                if(mlx4_is_eth_port(mdev, i)) {
@@ -1342,7 +1345,7 @@
 }


-//#define DONT_START_ON_BOOT
+#define DONT_START_ON_BOOT

 NTSTATUS
 EvtDriverDeviceAdd(
Index: hw/mlx4/kernel/bus/net/main.c
===================================================================
--- hw/mlx4/kernel/bus/net/main.c       (revision 6962)
+++ hw/mlx4/kernel/bus/net/main.c    (working copy)
@@ -2062,6 +2062,8 @@
                                                                count++;
                                                }
                }
+             if (count ==0)
+                             count =1 ;
                return count;
 }

Index: hw/mlx4/kernel/bus/net/port.c
===================================================================
--- hw/mlx4/kernel/bus/net/port.c         (revision 6962)
+++ hw/mlx4/kernel/bus/net/port.c      (working copy)
@@ -84,6 +84,7 @@
                u32 in_mod;
                int err;

+
                mailbox = mlx4_alloc_cmd_mailbox(dev);
                if (IS_ERR(mailbox))
                                return PTR_ERR(mailbox);
@@ -124,6 +125,20 @@
                                tmpgids[0].global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
                }

+
+             MLX4_PRINT(TRACE_LEVEL_WARNING, MLX4_DBG_DRV,("setting gid is 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
+                                             tmpgids[0].raw[8],
+                                             tmpgids[0].raw[9],
+                                             tmpgids[0].raw[10],
+                                             tmpgids[0].raw[11],
+                                             tmpgids[0].raw[12],
+                                             tmpgids[0].raw[13],
+                                             tmpgids[0].raw[14],
+                                             tmpgids[0].raw[15]
+                             ));
+
+
+
                mailbox = mlx4_alloc_cmd_mailbox(dev);
                if (IS_ERR(mailbox)) {
                                err = PTR_ERR(mailbox);
@@ -301,6 +316,21 @@

                //update port guid with mac address
                update_ipv6_gids_win(dev, port, 0, mac);
+
+// TODO: Tzachid 9/12/2009 Need to think of a better way of how to create the LLE
+// interface
+
+#if 0
+             if(!InterlockedExchange(&dev->pdev->ib_hca_created, 1))
+             {
+                             NTSTATUS status = STATUS_SUCCESS;
+                             status = __create_child(dev->pdev->p_wdf_device, BUS_HARDWARE_IDS, BUS_HARDWARE_IDS, BUS_HARDWARE_DESCRIPTION, 0 );
+                             if (!NT_SUCCESS(status)) {
+                                             mlx4_err(dev, "__create_child (ib)failed with 0x%x\n", status);
+                                             dev->pdev->ib_hca_created = FALSE;
+                             }
+             }
+#endif
 out:
                if (err && dev->caps.vep_uc_steering) {
                                mlx4_uc_steer_release(dev, port, mac, *qpn, reserve);
@@ -627,6 +657,7 @@
                                                 case MLX4_SET_PORT_VLAN_TABLE:
                                                 case MLX4_SET_PORT_PRIO_MAP:
                                                 case MLX4_SET_PORT_GID_TABLE:
+                                                            ASSERT(FALSE);
                                                                break;
                                                 default:
                                                                ASSERT(FALSE);
Index: hw/mlx4/kernel/eth/mp_common.cpp
===================================================================
--- hw/mlx4/kernel/eth/mp_common.cpp          (revision 6962)
+++ hw/mlx4/kernel/eth/mp_common.cpp       (working copy)
@@ -2071,7 +2071,7 @@

     }
     // Nothing was found
-
+    ETH_PRINT(TRACE_LEVEL_ERROR, ETH, "Received completion event on bogus CQ cqn = 0x%d\n",cqn);
     return NULL;
 }

Index: hw/mlx4/user/hca/mlx4.h
===================================================================
--- hw/mlx4/user/hca/mlx4.h    (revision 6962)
+++ hw/mlx4/user/hca/mlx4.h (working copy)
@@ -234,9 +234,49 @@
                uint8_t                                                 dgid[16];
 };

+// inherited
+typedef uint8_t  u8;
+typedef uint16_t  u16;
+typedef uint32_t  u32;
+
+
+
+typedef uint16_t  __le16;
+typedef uint16_t  __be16;
+typedef uint32_t  __le32;
+typedef uint32_t  __be32;
+typedef uint64_t  __le64;
+typedef uint64_t  __be64;
+
+struct mlx4_eth_av {
+             __be32                 port_pd;
+             u8                           reserved1;
+             u8                           smac_idx;
+             u16                         reserved2;
+             u8                           reserved3;
+             u8                           gid_index;
+             u8                           stat_rate;
+             u8                           hop_limit;
+             __be32                 sl_tclass_flowlabel;
+             u8                           dgid[16];
+             u32                         reserved4[2];
+             __be16                 vlan;
+             u8                           mac_0_1[2];
+             u8                           mac_2_5[4];
+};
+
+
+union mlx4_ext_av {
+             struct mlx4_av                  ib;
+             struct mlx4_eth_av         eth;
+};
+
+
 struct mlx4_ah {
                struct ibv_ah                                      ibv_ah;
-              struct mlx4_av                                  av;
+//         struct mlx4_av                                  av;
+             union mlx4_ext_av   av;
+//???  u8                                           gsi_demux_lb;
 };

 #ifdef XRC_SUPPORT
Index: hw/mlx4/user/hca/qp.c
===================================================================
--- hw/mlx4/user/hca/qp.c         (revision 6962)
+++ hw/mlx4/user/hca/qp.c      (working copy)
@@ -154,6 +154,33 @@
                memcpy(dseg->av, &to_mah((struct ibv_ah *)wr->dgrm.ud.h_av)->av, sizeof (struct mlx4_av));
                dseg->dqpn = wr->dgrm.ud.remote_qp;
                dseg->qkey = wr->dgrm.ud.remote_qkey;
+             dseg->vlan = to_mah((struct ib_ah *)wr->dgrm.ud.h_av)->av.eth.vlan;
+             memcpy(dseg->mac_0_1, to_mah((struct ib_ah *)wr->dgrm.ud.h_av)->av.eth.mac_0_1, 6);
+
+#if 0
+
+//??????           00-02-C9-03-9D-18
+
+
+             dseg->mac_0_1[0] = 0;
+             dseg->mac_0_1[1] = 2;
+             dseg->mac_2_5[0] = 0xc9;
+             dseg->mac_2_5[1] = 0x03;
+             dseg->mac_2_5[2] = 0x9d;
+             dseg->mac_2_5[3] = 0x18;
+
+#endif
+
+//00-02-C9-08-EB-10
+
+dseg->mac_0_1[0] = 0;
+dseg->mac_0_1[1] = 2;
+dseg->mac_2_5[0] = 0xc9;
+dseg->mac_2_5[1] = 0x08;
+dseg->mac_2_5[2] = 0xeb;
+dseg->mac_2_5[3] = 0x10;
+
+
 }

 static void __set_data_seg(struct mlx4_wqe_data_seg *dseg, ib_local_ds_t *ds)
Index: hw/mlx4/user/hca/verbs.c
===================================================================
--- hw/mlx4/user/hca/verbs.c   (revision 6962)
+++ hw/mlx4/user/hca/verbs.c                (working copy)
@@ -1107,23 +1107,24 @@
 static void
 __set_av_params(struct mlx4_ah *ah, struct ibv_pd *pd, struct ibv_ah_attr *attr)
 {
-              ah->av.port_pd = cl_hton32(to_mpd(pd)->pdn | (attr->port_num << 24));
-              ah->av.g_slid  = attr->src_path_bits;
-              ah->av.dlid    = cl_hton16(attr->dlid);
+             printf("being caled, are we running on ib?\n");
+             ah->av.ib.port_pd = cl_hton32(to_mpd(pd)->pdn | (attr->port_num << 24));
+             ah->av.ib.g_slid  = attr->src_path_bits;
+             ah->av.ib.dlid    = cl_hton16(attr->dlid);
                if (attr->static_rate) {
-                              ah->av.stat_rate = (uint8_t)(attr->static_rate + MLX4_STAT_RATE_OFFSET);
+                             ah->av.ib.stat_rate = (uint8_t)(attr->static_rate + MLX4_STAT_RATE_OFFSET);
                                /* XXX check rate cap? */
                }
-              ah->av.sl_tclass_flowlabel = cl_hton32(attr->sl << 28);
+             ah->av.ib.sl_tclass_flowlabel = cl_hton32(attr->sl << 28);
                if (attr->is_global)
                {
-                              ah->av.g_slid |= 0x80;
-                              ah->av.gid_index = attr->grh.sgid_index;
-                              ah->av.hop_limit = attr->grh.hop_limit;
-                              ah->av.sl_tclass_flowlabel |=
+                             ah->av.ib.g_slid |= 0x80;
+                             ah->av.ib.gid_index = attr->grh.sgid_index;
+                             ah->av.ib.hop_limit = attr->grh.hop_limit;
+                             ah->av.ib.sl_tclass_flowlabel |=
                                                cl_hton32((attr->grh.traffic_class << 20) |
                                                                    attr->grh.flow_label);
-                              cl_memcpy(ah->av.dgid, attr->grh.dgid.raw, 16);
+                             cl_memcpy(ah->av.ib.dgid, attr->grh.dgid.raw, 16);
                }
 }

Index: hw/mlx4/user/hca/wqe.h
===================================================================
--- hw/mlx4/user/hca/wqe.h     (revision 6962)
+++ hw/mlx4/user/hca/wqe.h  (working copy)
@@ -78,7 +78,9 @@
                uint32_t                               av[8];
                uint32_t                               dqpn;
                uint32_t                               qkey;
-              uint32_t                               reserved[2];
+             uint16_t                               vlan; //__be16 ??????
+             uint8_t                                 mac_0_1[2];
+             uint8_t                                 mac_2_5[4];
 };

 struct mlx4_wqe_data_seg {
Index: hw/mthca/kernel/hca_data.h
===================================================================
--- hw/mthca/kernel/hca_data.h             (revision 6962)
+++ hw/mthca/kernel/hca_data.h          (working copy)
@@ -170,7 +170,7 @@

 }             mlnx_cache_t;

-typedef struct _ib_ca {
+typedef struct _ib_cay {
                ENUM_MARK           mark;
                KSPIN_LOCK                                      event_list_lock;
                LIST_ENTRY                                        event_list;
@@ -212,7 +212,7 @@
                uint16_t                                               mcast_lid;
 } mlnx_mcast_t;

-typedef struct _mlnx_hca_t {
+typedef struct _mlnx_hca_tx {
                cl_list_item_t    list_item;                                             // to include in the HCA chain
                net64_t                                                guid;                                                                      // HCA node Guid
                struct mthca_dev *mdev;                            // VP Driver device
Index: hw/mthca/user/mlnx_ual_data.h
===================================================================
--- hw/mthca/user/mlnx_ual_data.h      (revision 6962)
+++ hw/mthca/user/mlnx_ual_data.h   (working copy)
@@ -38,7 +38,7 @@
 typedef uint8_t IB_gid_t[16]; /* GID (aka IPv6) H-to-L (big) (network) endianess */
 typedef uint32_t IB_ts_t;

-typedef struct _ib_ca
+typedef struct _ib_cax
 {
                struct ibv_context *ibv_ctx;
 } mlnx_ual_hobul_t;
Index: inc/user/iba/ibat.h
===================================================================
--- inc/user/iba/ibat.h    (revision 6962)
+++ inc/user/iba/ibat.h (working copy)
@@ -45,6 +45,9 @@
 namespace IBAT
 {

+HRESULT Init();
+
+
 HRESULT
 Resolve(
     __in const struct sockaddr* pSrcAddr,
Index: tests/ndtests/ndrping/ndrping.cpp
===================================================================
--- tests/ndtests/ndrping/ndrping.cpp   (revision 6962)
+++ tests/ndtests/ndrping/ndrping.cpp                (working copy)
@@ -612,8 +612,8 @@
         QueueDepth,
         1,
         nSge,
-        0,
-        0,
+        16,
+        16,
         NULL,
         &pEndpoint
         );
Index: tools/perftests/user/send_bw/send_bw.c
===================================================================
--- tools/perftests/user/send_bw/send_bw.c   (revision 6962)
+++ tools/perftests/user/send_bw/send_bw.c                (working copy)
@@ -422,7 +422,9 @@

                                if(user_parm->use_grh){
                                                av_attr.grh_valid = 1;
-                                              av_attr.grh.ver_class_flow = ib_grh_set_ver_class_flow(6, 0 ,0);
+                                             av_attr.grh.ver_class_flow = 0; //???????????? what is this
+                                             av_attr.grh.ver_class_flow = ib_grh_set_ver_class_flow(
+                                             6, 0 ,0);//?????? p_path->traffic_class, conn_req_path_get_flow_lbl( p_path ) );
                                                av_attr.grh.resv1 = 0;
                                                av_attr.grh.resv2 = 0;
                                                av_attr.grh.hop_limit = 1;
@@ -546,7 +548,7 @@
                                my_dest[i].psn = cl_hton32(rand() & 0xffffff);
                                if (!my_dest[i].lid) {
                                                fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
-                                              return 1;
+//??                                     return 1;
                                }
                                my_dest[i].qpn = ctx->qp_attr[i].num;
                                /* TBD this should be changed inot VA and different key to each qp */
Index: ulp/libibverbs/examples/pingpong.c
===================================================================
--- ulp/libibverbs/examples/pingpong.c                (revision 6962)
+++ ulp/libibverbs/examples/pingpong.c             (working copy)
@@ -50,3 +50,25 @@

                return attr.lid;
 }
+
+void str2gid(char *grh, union ibv_gid *gid)
+{
+             char tmp;
+
+             tmp = grh[8];
+             grh[8] = 0;
+             (*((ULONG*)&gid->raw[0])) = htonl(strtoul(grh, NULL, 16));
+             grh[8] = tmp;
+
+             tmp = grh[16];
+             grh[16] = 0;
+             (*((ULONG*)&gid->raw[4])) = htonl(strtoul(grh + 8, NULL, 16));
+             grh[16] = tmp;
+
+             tmp = grh[24];
+             grh[24] = 0;
+             (*((ULONG*)&gid->raw[8])) = htonl(strtoul(grh + 16, NULL, 16));
+             grh[24] = tmp;
+
+             (*((ULONG*)&gid->raw[12])) = htonl(strtoul(grh + 24, NULL, 16));
+}
Index: ulp/libibverbs/examples/pingpong.h
===================================================================
--- ulp/libibverbs/examples/pingpong.h               (revision 6962)
+++ ulp/libibverbs/examples/pingpong.h            (working copy)
@@ -34,5 +34,6 @@

 enum ibv_mtu pp_mtu_to_enum(int mtu);
 uint16_t pp_get_local_lid(struct ibv_context *context, int port);
+void str2gid(char *grh, union ibv_gid *gid);

 #endif /* IBV_PINGPONG_H */
Index: ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c
===================================================================
--- ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c              (revision 6962)
+++ ulp/libibverbs/examples/rc_pingpong/rc_pingpong.c           (working copy)
@@ -44,6 +44,8 @@
                PINGPONG_SEND_WRID = 2,
 };

+char                                     *grh = NULL;
+
 struct pingpong_context {
                struct ibv_context                           *context;
                struct ibv_comp_channel             *channel;
@@ -55,6 +57,8 @@
                int                                                                                           size;
                int                                                                                           rx_depth;
                int                                                                                           pending;
+             struct ibv_port_attr     portinfo;
+             union ibv_gid                     dgid;
 };

 struct pingpong_dest {
@@ -69,6 +73,7 @@
 {
                struct ibv_qp_attr attr;

+             attr.port_num           = (uint8_t)port;
                attr.qp_state                                     = IBV_QPS_RTR;
                attr.path_mtu                                   = mtu;
                attr.dest_qp_num                          = dest->qpn;
@@ -81,6 +86,15 @@
                attr.ah_attr.src_path_bits           = 0;
                attr.ah_attr.port_num                  = (uint8_t) port;

+             if(grh)
+             {
+                             str2gid(grh, &ctx->dgid);
+                             attr.ah_attr.is_global = 1;
+                             attr.ah_attr.grh.hop_limit = 1;
+                             attr.ah_attr.grh.dgid = ctx->dgid;
+                             attr.ah_attr.grh.sgid_index = 0;
+             }
+
                if (ibv_modify_qp(ctx->qp, &attr,
                                                  IBV_QP_STATE              |
                                                  IBV_QP_AV                 |
@@ -499,7 +513,7 @@
                while (1) {
                                int c;

-                              c = getopt(argc, argv, "h:p:d:i:s:m:r:n:l:e");
+        c = getopt(argc, argv, "h:p:d:i:s:m:r:n:l:g:e");
                                if (c == -1)
                                                break;

@@ -555,6 +569,10 @@
                                                servername = _strdup(optarg);
                                                break;

+                             case 'g':
+                                             grh = _strdup(optarg);
+                                             break;
+
                                default:
                                                usage(argv[0]);
                                                return 1;
@@ -606,7 +624,7 @@
                my_dest.psn = rand() & 0xffffff;
                if (!my_dest.lid) {
                                fprintf(stderr, "Couldn't get local LID\n");
-                              return 1;
+                             //return 1;
                }

                printf("  local address:  LID 0x%04x, QPN 0x%06x, PSN 0x%06x\n",
Index: ulp/nd/user/NdConnector.cpp
===================================================================
--- ulp/nd/user/NdConnector.cpp           (revision 6962)
+++ ulp/nd/user/NdConnector.cpp        (working copy)
@@ -247,6 +247,20 @@
     return hr;
 }

+    ib_gid_t SwapGid(UINT64 In1, UINT64 In2) {
+        ib_gid_t Ret;
+        int i;
+        UCHAR *pIn1 = (UCHAR *)&In1;
+        UCHAR *pIn2 = (UCHAR *)&In2;
+        for (i=0; i < 8; i++) {
+            Ret.raw[15-i] = pIn2[i];
+            Ret.raw[7-i] = pIn1[i];
+        }
+        return Ret;
+
+    }
+
+
 //
 // Connects an endpoint to the specified destinaton address.
 //
@@ -269,6 +283,7 @@
     __inout OVERLAPPED* pOverlapped
     )
 {
+    HRESULT hr;
     ND_ENTER( ND_DBG_NDI );

     if( AddressLength < sizeof(struct sockaddr) )
@@ -309,7 +324,9 @@
     ioctl.pdata.src_port = _byteswap_ushort( m_LocalPort );

     // Resolve the GIDs.
-   HRESULT hr = IBAT::Resolve(
+
+#if 0
+   hr = IBAT::Resolve(
         &m_pParent->m_Addr.unspec,
         pAddress,
         (IBAT_PATH_BLOB*)&ioctl.path
@@ -336,7 +353,71 @@
         }
         return hr;
     }
+#else

+
+#if 0
+
+    ioctl.path.dgid = SwapGid(0xfe80000000000000,0x0202c9fffe039d18);
+//    ioctl.path.sgid = SwapGid(0xfe80000000000000,0x0002c90300039cf1); //???? ethernet
+    ioctl.path.sgid = SwapGid(0xfe80000000000000,0x0202c9fffe039cf0);
+
+
+
+//                                                 0002:c903:0003:9cf1
+//    ioctl.path.sgid = SwapGid(0xfe80000000000000,0x0002c90300039cf1); //???? ibibibib
+
+
+#endif
+
+
+        ioctl.path.service_id = 0;
+
+
+        ioctl.path.dgid = SwapGid(0xfe80000000000000,0x0202c9fffe08eb10);
+    //    ioctl.path.sgid = SwapGid(0xfe80000000000000,0x0002c90300039cf1); //???? ethernet
+        ioctl.path.sgid = SwapGid(0xfe80000000000000,0x0202c9fffe08cb10);
+
+
+
+
+    ioctl.path.dlid = 0;//????????????????5; // full the cm, not anymore ?????
+    ioctl.path.slid = 0;//0x200;   //////// ibibibibibi
+    ioctl.path.hop_flow_raw = 2;
+    ioctl.path.tclass = 0;
+    ioctl.path.num_path = 0;
+    ioctl.path.pkey = 0;
+    ioctl.path.qos_class_sl = 0;
+    ioctl.path.mtu = IB_MTU_LEN_1024;
+    ioctl.path.rate =  IB_PATH_RECORD_RATE_10_GBS;;
+    ioctl.path.pkt_life = 0;
+    ioctl.path.preference = 0;
+    for(int j=0;j<6;j++) {
+        ioctl.path.resv2[j] = 0;
+    }
+    ioctl.transport = RDMA_TRANSPORT_RDMAOE;
+
+
+/*
+             ib_net64_t                                                          service_id;
+             ib_gid_t                                                               dgid;
+             ib_gid_t                                                               sgid;
+             ib_net16_t                                                          dlid;
+             ib_net16_t                                                          slid;
+             ib_net32_t                                                          hop_flow_raw;
+             uint8_t                                                                 tclass;
+             uint8_t                                                                 num_path;
+             ib_net16_t                                                          pkey;
+             ib_net16_t                                                          qos_class_sl;
+             uint8_t                                                                 mtu;
+             uint8_t                                                                 rate;
+             uint8_t                                                                 pkt_life;
+             uint8_t                                                                 preference;
+             uint16_t                                                               resv1;
+             uint32_t                                                               resv2;
+*/
+#endif
+
     switch( ((struct sockaddr_in*)pAddress)->sin_family )
     {
     case AF_INET:
Index: ulp/nd/user/NdProv.cpp
===================================================================
--- ulp/nd/user/NdProv.cpp       (revision 6962)
+++ ulp/nd/user/NdProv.cpp    (working copy)
@@ -253,6 +253,18 @@
         return S_OK;
     }

+    UINT64 SwapGuid(UINT64 In) {
+        UINT64 Ret = 0;
+        UCHAR *pIn = (UCHAR *)&In;
+        UCHAR *pRet = (UCHAR *)&Ret;
+        int i;
+        for (i=0; i < 8; i++) {
+            pRet[7-i] = pIn[i];
+        }
+        return Ret;
+
+    }
+
     HRESULT CProvider::OpenAdapter(
             __in_bcount(AddressLength) const struct sockaddr* pAddress,
             __in SIZE_T AddressLength,
@@ -295,8 +307,10 @@
         HANDLE hIbatDev = CreateFileW( IBAT_WIN32_NAME,
             MAXIMUM_ALLOWED, 0, NULL,
             OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
-        if( hIbatDev == INVALID_HANDLE_VALUE )
+        if( hIbatDev == INVALID_HANDLE_VALUE ) {
+            ND_PRINT( TRACE_LEVEL_ERROR, ND_DBG_ERR ,("Opening IBAT failed, is openib running?\n "));
             return ND_NO_MEMORY;
+        }

         IBAT_PORT_RECORD out;
         DWORD size;
@@ -304,8 +318,22 @@
             &in, sizeof(in), &out, sizeof(out), &size, NULL );

         CloseHandle( hIbatDev );
-        if( !fSuccess || size == 0 )
-            return ND_INVALID_ADDRESS;
+        if( !fSuccess || size == 0 ) {
+            char temp[100];
+            gethostname(temp,100);
+            if(!strcmp(temp,"sw328")) {
+                out.CaGuid =   SwapGuid(0x0002c9030008eb10);
+                out.PortGuid = SwapGuid(0x0202c9fffe08eb10);
+                out.PortNum = 1;
+                out.PKey = IB_DEFAULT_PKEY;
+            } else {
+                out.CaGuid =   SwapGuid(0x0002c9030008eb20);
+                out.PortGuid = SwapGuid(0x0202c9fffe08cb10);
+                out.PortNum = 1;
+                out.PKey = IB_DEFAULT_PKEY;
+            }
+//            return ND_INVALID_ADDRESS;
+        }

         return CAdapter::Create( this, pAddress, &out, ppAdapter );
     }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20101227/a894db7f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roce_fast.diff
Type: application/octet-stream
Size: 19629 bytes
Desc: roce_fast.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20101227/a894db7f/attachment.obj>


More information about the ofw mailing list