[ofw] patch: Use tFirst method on interrupts

Tzachi Dar tzachid at mellanox.co.il
Mon Jul 21 08:56:46 PDT 2008


The following patch changes the default behavior of mlx4 from tLast to
tFirst.
 
Assuming that interrupt moderation is set to x us than:
 
tLast method means that an interrupt is generated after x us that no
packet arrives. (that is if packets continue to arrive, no interrupt
will be generated).
tFirst method means that an interrupt is generated after x us from the
first packet. (even if packets continue to arrive).
 
Index: Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/fw.c
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 2835)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/fw.c (revision 2836)
@@ -712,6 +712,12 @@
 #else
 #error Host endianness not defined
 #endif
+
+ if (g.mod_interrupt_from_first) {
+  // Bit 30,31 tell the moderation method, 0 default, 1 from first
packet
+  *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1 << 30);
+ }
+
  /* Check port for UD address vector: */
  *(inbox + INIT_HCA_FLAGS_OFFSET / 4) |= cpu_to_be32(1);
 
Index: Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/mlx4.h
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/mlx4.h (revision 2835)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/bus/net/mlx4.h (revision 2836)
@@ -88,6 +88,7 @@
  int mod_enable_qos;
  int mod_mlx4_blck_lb;
  enum mlx4_port_type mod_port_type[MLX4_MAX_PORTS];
+ int mod_interrupt_from_first;
 
  int mod_msi_enable;
  int mod_msi_num_vector;
Index: Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/mlx4_bus.inf
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/mlx4_bus.inf (revision
2835)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/mlx4_bus.inf (revision
2836)
@@ -184,14 +184,15 @@
 HKR,"Parameters","LogNumMpt",%REG_DWORD%,0x00000012
 HKR,"Parameters","LogNumMtt",%REG_DWORD%,0x00000014
 HKR,"Parameters","EnableQoS",%REG_DWORD%,0x00000001
+HKR,"Parameters","BlockMcastLoopBack",%REG_DWORD%,0x00000000
+HKR,"Parameters","InterruptFromFirstPacket",%REG_DWORD%,0x00000001
+
 HKR,"Parameters","NumMac",%REG_DWORD%,0x00000001
 HKR,"Parameters","NumVlan",%REG_DWORD%,0x00000000
 HKR,"Parameters","UsePrio",%REG_DWORD%,0x00000000
 HKR,"Parameters","PortType",%REG_SZ%,"ib,ib"
 
 
-HKR,"Parameters","BlockMcastLoopBack",%REG_DWORD%,0x00000000
-
 
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: Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c
===================================================================
--- Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 2835)
+++ Q:/projinf4/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 2836)
@@ -894,9 +894,6 @@
  // "log maximum number of memory translation table segments per HCA"
  DECLARE_CONST_UNICODE_STRING(numMtt, L"LogNumMtt"); 
 
- // "Enable Quality of Service support in the HCA if > 0, (default 1)"
- DECLARE_CONST_UNICODE_STRING(enableQoS, L"EnableQoS"); 
-
  // "Maximum number of MACs per ETH port (1-127, default 1"
  DECLARE_CONST_UNICODE_STRING(numMac, L"NumMac"); 
 
@@ -906,9 +903,15 @@
  // "Enable steering by VLAN priority on ETH ports (0/1, default 0)"
  DECLARE_CONST_UNICODE_STRING(usePrio, L"UsePrio"); 
 
+ // "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"); 
 
+ // "Measure the interrupt from the first packet (default 1)"
+ DECLARE_CONST_UNICODE_STRING(InterruptFromFirstPacket,
L"InterruptFromFirstPacket"); 
+
  // "Ports L2 type (ib/eth/auto, entry per port, comma seperated,
default ib for all)"
  DECLARE_CONST_UNICODE_STRING(PortType, L"PortType");
 
@@ -970,12 +973,6 @@
   if (NT_SUCCESS (status)) 
    g.mod_num_mtt = value;
 
-  status = WdfRegistryQueryULong(hKey, &enableQoS, &value);
-  if (NT_SUCCESS (status)) 
-   g.mod_enable_qos = value;
-  else
-   g.mod_enable_qos = 1;
-
   status = WdfRegistryQueryULong(hKey, &numMac, &value);
   if (NT_SUCCESS (status)) 
    g.mod_num_mac = value;
@@ -994,12 +991,26 @@
   else
    g.mod_use_prio = 0;
 
+  status = WdfRegistryQueryULong(hKey, &enableQoS, &value);
+  if (NT_SUCCESS (status)) 
+   g.mod_enable_qos = value;
+  else
+   g.mod_enable_qos = 1;
+
+
   status = WdfRegistryQueryULong(hKey, &BlockMcastLB, &value);
   if (NT_SUCCESS (status)) 
    g.mod_mlx4_blck_lb = value;
   else
    g.mod_mlx4_blck_lb = 1;
 
+  status = WdfRegistryQueryULong(hKey, &InterruptFromFirstPacket,
&value);
+  if (NT_SUCCESS (status)) 
+   g.mod_interrupt_from_first = value;
+  else
+   g.mod_interrupt_from_first = 1;
+
+
   status = WdfRegistryQueryULong(hKey, &MsiEnable, &value);
   if (NT_SUCCESS (status)) 
    g.mod_msi_enable = value;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080721/84c68353/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tfirst.diff
Type: application/octet-stream
Size: 4668 bytes
Desc: tfirst.diff
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080721/84c68353/attachment.obj>


More information about the ofw mailing list