[mlx4] Apply mlx4_0290_mcast_loopback.patch
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 15 May 2008 07:28:01 +0000 (07:28 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 15 May 2008 07:28:01 +0000 (07:28 +0000)
(Make sure that loop-back packets are droped by hw/fw). Off by default.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1173 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/drv/drv.c
hw/mlx4/kernel/bus/drv/mlx4_bus.inf
hw/mlx4/kernel/bus/net/mcg.c
hw/mlx4/kernel/bus/net/mlx4.h

index 51e2335..e27b822 100644 (file)
@@ -843,6 +843,9 @@ __read_registry(WDFDRIVER *hDriver)
        // "Enable Quality of Service support in the HCA if > 0, (default 1)"\r
        DECLARE_CONST_UNICODE_STRING(enableQoS, L"EnableQoS");  \r
 \r
+       // "Block multicast loopback packets if > 0 (default 1)"\r
+       DECLARE_CONST_UNICODE_STRING(BlockMcastLB, L"BlockMcastLoopBack");      \r
+\r
        ULONG value;\r
        WDFKEY hKey = NULL;\r
        NTSTATUS status = STATUS_SUCCESS;\r
@@ -897,6 +900,12 @@ __read_registry(WDFDRIVER *hDriver)
                else\r
                        g.enable_qos = 1;\r
 \r
+               status = WdfRegistryQueryULong(hKey, &BlockMcastLB, &value);\r
+               if (NT_SUCCESS (status)) \r
+                       g.mlx4_blck_lb = value;\r
+               else\r
+                       g.mlx4_blck_lb = 1;\r
+\r
                WdfRegistryClose(hKey);\r
                status = STATUS_SUCCESS;\r
        }\r
index 996240a..2c9c465 100644 (file)
@@ -147,6 +147,7 @@ HKR,"Parameters","LogNumMcg",%REG_DWORD%,0x0000000D
 HKR,"Parameters","LogNumMpt",%REG_DWORD%,0x00000011\r
 HKR,"Parameters","LogNumMtt",%REG_DWORD%,0x00000014\r
 HKR,"Parameters","EnableQoS",%REG_DWORD%,0x00000001\r
+HKR,"Parameters","BlockMcastLoopBack",%REG_DWORD%,0x00000000\r
 \r
 HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\E51BB6E2-914A-4e21-93C0-192F4801BBFF","Flags",%REG_DWORD%,0xffff\r
 HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\E51BB6E2-914A-4e21-93C0-192F4801BBFF","Level",%REG_DWORD%,0x3\r
index 6a020ea..f079751 100644 (file)
@@ -204,13 +204,15 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16])
        }
 
        for (i = 0; i < members_count; ++i)
-               if (mgm->qp[i] == cpu_to_be32(qp->qpn)) {
+               if ((int)(be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn) {
                        mlx4_dbg(dev, "QP %06x already a member of MGM\n", qp->qpn);
                        err = 0;
                        goto out;
                }
 
-       mgm->qp[members_count++] = cpu_to_be32(qp->qpn);
+       mgm->qp[members_count++] = cpu_to_be32((qp->qpn & MGM_QPN_MASK) |
+                                              (!!g.mlx4_blck_lb << MGM_BLCK_LB_BIT));
+
        mgm->members_count       = cpu_to_be32(members_count);
 
        err = mlx4_WRITE_MCG(dev, index, mailbox);
@@ -285,7 +287,7 @@ int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16])
 
        members_count = be32_to_cpu(mgm->members_count);
        for (loc = -1, i = 0; i < (int)members_count; ++i)
-               if (mgm->qp[i] == cpu_to_be32(qp->qpn))
+               if ((int)(be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn)
                        loc = i;
 
        if (loc == -1) {
index f1a47a3..a03d39c 100644 (file)
@@ -73,6 +73,7 @@ typedef struct _GLOBALS {
        int mod_num_mtt;
 
        int enable_qos;
+       int mlx4_blck_lb;
 } GLOBALS;
 #pragma warning(default:4201) // nameless struct/union
 
@@ -114,6 +115,9 @@ enum {
        MLX4_NUM_CMPTS          = MLX4_CMPT_NUM_TYPE << MLX4_CMPT_SHIFT
 };
 
+#define MGM_QPN_MASK       0x00FFFFFF
+#define MGM_BLCK_LB_BIT    30
+
 struct mlx4_bitmap {
        u32                     last;
        u32                     top;