[ofw] patch: [mlx4] Add minor function (is_power_of_2) and fix compilation issues on C++.

Tzachi Dar tzachid at mellanox.co.il
Wed May 21 06:51:58 PDT 2008


and also: 

[mlx4] Add 2 more functions for interface with Ethernet.

 
Index: mlx4/kernel/bus/drv/drv.c
===================================================================
--- mlx4/kernel/bus/drv/drv.c (revision 1197)
+++ mlx4/kernel/bus/drv/drv.c (working copy)
@@ -683,6 +683,14 @@
 
 #endif
 
+inline void InitBusIsr(
+     struct VipBusIfc* pVipBusIfc
+    )
+{
+    memset(pVipBusIfc, 0, sizeof(struct VipBusIfc));
+    KeInitializeEvent(&pVipBusIfc->NicData.ConfigChangeEvent,
SynchronizationEvent, TRUE);
+}
+
 NTSTATUS
 EvtDeviceAdd(
  IN WDFDRIVER        Driver,
@@ -767,6 +775,11 @@
  p_fdo->FdoDevice = device;
 
  //
+ // Init the BusIsr data
+ //
+ InitBusIsr(&p_fdo->mtnic_Ifc);
+
+ //
  // Purpose of this lock is documented in PlugInDevice routine below.
  //
  WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
Index: mlx4/kernel/bus/inc/bus_intf.h
===================================================================
--- mlx4/kernel/bus/inc/bus_intf.h (revision 1197)
+++ mlx4/kernel/bus/inc/bus_intf.h (working copy)
@@ -6,16 +6,21 @@
 // Interface for work with MLX4 IB driver
 //
 
-#pragma warning(disable:4201) // nameless struct/union
+struct mlx4_interface;
+typedef int (*MLX4_REGISTER_INTERFACE)(struct mlx4_interface *intf);
+typedef VOID (*MLX4_UNREGISTER_INTERFACE)(struct mlx4_interface *intf);
+
 typedef struct _MLX4_BUS_IB_INTERFACE{
  INTERFACE i;
  struct ib_device  * p_ibdev;
  struct pci_dev   * pdev;
  int       is_livefish;
+ MLX4_REGISTER_INTERFACE     register_interface;
+ MLX4_UNREGISTER_INTERFACE   unregister_interface;
  ULONG      port_id;
  struct VipBusIfc   *pVipBusIfc;
  
 } MLX4_BUS_IB_INTERFACE, *PMLX4_BUS_IB_INTERFACE;
-#pragma warning(default:4201) // nameless struct/union
 
 
+
Index: mlx4/kernel/inc/l2w_bit.h
===================================================================
--- mlx4/kernel/inc/l2w_bit.h (revision 1197)
+++ mlx4/kernel/inc/l2w_bit.h (working copy)
@@ -184,3 +184,9 @@
  return fls(val) - 1;
 }
 
+static inline BOOLEAN is_power_of_2(unsigned long n)
+{
+ return (!!n & !(n & (n-1))) ? TRUE : FALSE;
+}
+
+
Index: mlx4/kernel/inc/l2w_list.h
===================================================================
--- mlx4/kernel/inc/l2w_list.h (revision 1197)
+++ mlx4/kernel/inc/l2w_list.h (working copy)
@@ -38,14 +38,14 @@
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 */
-static inline void __list_add(struct list_head *new,
+static inline void __list_add(struct list_head *new1,
                              struct list_head *prev,
                              struct list_head *next)
 {
-       next->prev = new;
-       new->next = next;
-       new->prev = prev;
-       prev->next = new;
+       next->prev = new1;
+       new1->next = next;
+       new1->prev = prev;
+       prev->next = new1;
 }
 
 /**
@@ -56,9 +56,9 @@
 * Insert a new entry after the specified head.
 * This is good for implementing stacks.
 */
-static inline void list_add(struct list_head *new, struct list_head
*head)
+static inline void list_add(struct list_head *new1, struct list_head
*head)
 {
-       __list_add(new, head, head->next);
+       __list_add(new1, head, head->next);
 }
 
 /**
@@ -69,9 +69,9 @@
 * Insert a new entry before the specified head.
 * This is useful for implementing queues.
 */
-static inline void list_add_tail(struct list_head *new, struct
list_head *head)
+static inline void list_add_tail(struct list_head *new1, struct
list_head *head)
 {
-       __list_add(new, head->prev, head);
+       __list_add(new1, head->prev, head);
 }
 
  /*
@@ -96,8 +96,8 @@
 static inline void list_del(struct list_head *entry)
 {
         __list_del(entry->prev, entry->next);
-        entry->next = LIST_POISON1;
-        entry->prev = LIST_POISON2;
+        entry->next = (struct list_head *)LIST_POISON1;
+        entry->prev = (struct list_head *)LIST_POISON2;
 }
 
 /**
@@ -192,3 +192,4 @@
        &pos->member != (head);                  \
        pos = n, n = list_entry(n->member.next, type_n, member))
 
+
Index: mlx4/kernel/inc/l2w_pci.h
===================================================================
--- mlx4/kernel/inc/l2w_pci.h (revision 1197)
+++ mlx4/kernel/inc/l2w_pci.h (working copy)
@@ -25,7 +25,7 @@
 #define HCA(v, d, t) \
  { PCI_VENDOR_ID_##v, DEVID_HERMON_##d, t }
 
-static struct pci_device_id {
+struct pci_device_id {
  USHORT  vendor;
  USHORT  device;
  hca_type_t driver_data;
@@ -106,3 +106,4 @@
 #define __raw_writes  writes
 #define __raw_writeb  writeb
 
+
Index: mlx4/kernel/inc/l2w_sync.h
===================================================================
--- mlx4/kernel/inc/l2w_sync.h (revision 1197)
+++ mlx4/kernel/inc/l2w_sync.h (working copy)
@@ -5,6 +5,9 @@
 #define LONG_MAX      2147483647L   /* maximum (signed) long value */
 #endif
 
+#ifndef ULONG_MAX
+#define ULONG_MAX 4294967295UL
+#endif
 
 //
 // mutex wrapper
@@ -162,3 +165,4 @@
  KeFlushQueuedDpcs();
 }
 
+

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080521/237286bd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mlx4_inc.patch
Type: application/octet-stream
Size: 4935 bytes
Desc: mlx4_inc.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080521/237286bd/attachment.obj>


More information about the ofw mailing list