[ofw] multicast loopback patch

Tzachi Dar tzachid at mellanox.co.il
Mon May 5 13:59:00 PDT 2008


 
Here is the description of mlx4_0290_mcast_loopback.patch
mlx4: enable discarding/passing multicast loopback packets by FW/HW.
 
Multicast (and broadcast) loopback is handled by the network stack
meaning that
all MC or BC packets that need to return into receive sockets on the
machine are
duplicated and put in the rx path handling by the ip network stack.
The HCA loops all multicast outgoing packets so that any attached QP can
get
these multicast packets as well.
 
The IPoIB module needs to discard all those self QP loopback packets and
does
so by comparing the SLID and QPN.
 
This patch controls the ConnectX HCA multicast packets block loopback
(blck_lb) for self QP.
 
The patch is designed to enable or disable blocking of all multicast
packets on self QP
in FW/HW on all QPs created on the ConnectX HCA.
 
Inter QP multicast packets on the relevant HCA will still be delivered.
 
The /sys/module/mlx4_core/block_loopback attribute controls the policy
flag.
Its default value is blocking-enabled (non-zero).
The flag can be read and set/unset through sysfs.
 
Signed-off-by: Alex Rosenbaum <alexr at voltaire.com>
Signed-off-by: Merav Havuv <meravh at voltaire.com>
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

The following is it's windows porting.
Please note, I have run a few tests that show that things work correctly
(no regression). I'll still have to run tests that will show that
performance is improved.
 
Thanks
Tzachi
 
Index: kernel/bus/drv/drv.c
===================================================================
--- kernel/bus/drv/drv.c (revision 2386)
+++ kernel/bus/drv/drv.c (working copy)
@@ -843,6 +843,9 @@
  // "Enable Quality of Service support in the HCA if > 0, (default 1)"
  DECLARE_CONST_UNICODE_STRING(enableQoS, L"EnableQoS"); 
 
+ // "Block multicast loopback packets if > 0 (default 1)"
+ DECLARE_CONST_UNICODE_STRING(BlockMcastLB, L"BlockMcastLoopBack"); 
+
  ULONG value;
  WDFKEY hKey = NULL;
  NTSTATUS status = STATUS_SUCCESS;
@@ -897,6 +900,12 @@
   else
    g.enable_qos = 1;
 
+  status = WdfRegistryQueryULong(hKey, &BlockMcastLB, &value);
+  if (NT_SUCCESS (status)) 
+   g.mlx4_blck_lb = value;
+  else
+   g.mlx4_blck_lb = 1;
+
   WdfRegistryClose(hKey);
   status = STATUS_SUCCESS;
  }
Index: kernel/bus/drv/mlx4_bus.inf
===================================================================
--- kernel/bus/drv/mlx4_bus.inf (revision 2386)
+++ kernel/bus/drv/mlx4_bus.inf (working copy)
@@ -147,6 +147,7 @@
 HKR,"Parameters","LogNumMpt",%REG_DWORD%,0x00000011
 HKR,"Parameters","LogNumMtt",%REG_DWORD%,0x00000014
 HKR,"Parameters","EnableQoS",%REG_DWORD%,0x00000001
+HKR,"Parameters","BlockMcastLoopBack",%REG_DWORD%,0x00000001
 
 
HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\E51BB6E2-914A-4e
21-93C0-192F4801BBFF","Flags",%REG_DWORD%,0xffff
 
HKLM,"System\CurrentControlSet\Control\WMI\GlobalLogger\E51BB6E2-914A-4e
21-93C0-192F4801BBFF","Level",%REG_DWORD%,0x3
Index: kernel/bus/net/mcg.c
===================================================================
--- kernel/bus/net/mcg.c (revision 2386)
+++ kernel/bus/net/mcg.c (working copy)
@@ -204,13 +204,15 @@
  }
 
  for (i = 0; i < members_count; ++i)
-  if (mgm->qp[i] == cpu_to_be32(qp->qpn)) {
+  if ((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 @@
 
  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 ((be32_to_cpu(mgm->qp[i]) & MGM_QPN_MASK) == qp->qpn)
    loc = i;
 
  if (loc == -1) {
Index: kernel/bus/net/mlx4.h
===================================================================
--- kernel/bus/net/mlx4.h (revision 2386)
+++ kernel/bus/net/mlx4.h (working copy)
@@ -73,6 +73,7 @@
  int mod_num_mtt;
 
  int enable_qos;
+ int mlx4_blck_lb;
 } GLOBALS;
 #pragma warning(default:4201) // nameless struct/union
 
@@ -114,6 +115,9 @@
  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;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080505/557519c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcast_loopback.patch
Type: application/octet-stream
Size: 3055 bytes
Desc: mcast_loopback.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080505/557519c2/attachment.obj>


More information about the ofw mailing list