PERFORCE change 181088 for review
Alexandre Fiveg
afiveg at FreeBSD.org
Sat Jul 17 13:23:19 UTC 2010
http://p4web.freebsd.org/@@181088?ac=10
Change 181088 by afiveg at ringmap-2 on 2010/07/17 13:22:33
Dummy functions for access to 8259x chips added. Currently they do nothing.
Affected files ...
.. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#20 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#3 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#2 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#1 add
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#2 edit
.. //depot/projects/soc2010/ringmap/current/sys/i386/conf/I686RINGMAP_CURRENT#3 edit
Differences ...
==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#20 (text+ko) ====
@@ -223,7 +223,7 @@
#define EM_MSIX_BAR 3 /* On 82575 */
/* Defines for printing debug information */
-#define DEBUG_INIT 1
+#define DEBUG_INIT 0
#define DEBUG_IOCTL 0
#define DEBUG_HW 0
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#3 (text+ko) ====
@@ -136,9 +136,13 @@
static void ixgbe_free_receive_structures(struct adapter *);
static void ixgbe_free_receive_buffers(struct rx_ring *);
static void ixgbe_setup_hw_rsc(struct rx_ring *);
-
+#ifndef RINGMAP
static void ixgbe_enable_intr(struct adapter *);
static void ixgbe_disable_intr(struct adapter *);
+#else
+void ixgbe_enable_intr(struct adapter *);
+void ixgbe_disable_intr(struct adapter *);
+#endif
static void ixgbe_update_stats_counters(struct adapter *);
static bool ixgbe_txeof(struct tx_ring *);
static bool ixgbe_rxeof(struct ix_queue *, int);
@@ -211,7 +215,11 @@
"ix", ixgbe_methods, sizeof(struct adapter),
};
-static devclass_t ixgbe_devclass;
+#ifndef RINGMAP
+static
+#endif
+devclass_t ixgbe_devclass;
+
DRIVER_MODULE(ixgbe, pci, ixgbe_driver, ixgbe_devclass, 0, 0);
MODULE_DEPEND(ixgbe, pci, 1, 1, 1);
@@ -322,6 +330,10 @@
static int fdir_pballoc = 1;
#endif
+#ifdef RINGMAP
+#include <net/ringmap.h>
+#endif
+
/*********************************************************************
* Device identification routine
*
@@ -4425,7 +4437,10 @@
}
}
-static void
+#ifndef RINGMAP
+static
+#endif
+void
ixgbe_enable_intr(struct adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
@@ -4471,7 +4486,10 @@
return;
}
-static void
+#ifndef RINGMAP
+static
+#endif
+void
ixgbe_disable_intr(struct adapter *adapter)
{
if (adapter->msix_mem)
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#2 (text+ko) ====
@@ -432,6 +432,10 @@
unsigned long link_irq;
struct ixgbe_hw_stats stats;
+
+#ifdef RINGMAP
+ struct ringmap *rm;
+#endif
};
/* Precision Time Sync (IEEE 1588) defines */
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#2 (text+ko) ====
@@ -1,0 +1,273 @@
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/conf.h>
+#include <sys/queue.h>
+#include <sys/taskqueue.h>
+
+#include <machine/bus.h>
+
+#include <net/if.h>
+#include <net/if_var.h>
+#include <net/if_types.h>
+#include <net/if_media.h>
+
+#include <net/ringmap.h>
+
+#include "ixgbe_api.h"
+#include "ixgbe.h"
+#include "ringmap_8259.h"
+
+int rm_8259_set_ringmap_to_adapter(device_t, struct ringmap *);
+struct ringmap * rm_8259_get_ringmap_p(device_t);
+device_t rm_8259_get_device_p(struct cdev *);
+void rm_8259_enable_intr(device_t);
+void rm_8259_disable_intr(device_t);
+int rm_8259_set_slot(struct ring *, device_t, unsigned int);
+void rm_8259_interrupt(void *);
+void rm_8259_delayed_interrupt(void *);
+int rm_8259_print_ring_pointers(struct adapter *);
+void rm_8259_sync_head_tail(device_t);
+void rm_8259_sync_tail(device_t);
+void rm_8259_sync_head(device_t);
+void rm_8259_delayed_interrupt_per_packet(device_t, int);
+
+extern devclass_t ixgbe_devclass;
+extern void ixgbe_enable_intr(struct adapter *);
+extern void ixgbe_disable_intr(struct adapter *);
+extern void ringmap_print_slot(struct ring *, unsigned int);
+extern void print_capt_obj(struct capt_object *);
+
+
+struct ringmap_functions ringmap_f = {
+ rm_8259_set_ringmap_to_adapter,
+ rm_8259_enable_intr,
+ rm_8259_disable_intr,
+ rm_8259_interrupt,
+ rm_8259_delayed_interrupt,
+ rm_8259_delayed_interrupt_per_packet,
+ rm_8259_sync_head_tail,
+ rm_8259_sync_tail,
+ rm_8259_sync_head,
+ rm_8259_set_slot,
+ rm_8259_get_ringmap_p,
+ rm_8259_get_device_p
+};
+
+
+/*
+ * This function synchronize the tail and head hardware registers
+ * with head and tail software varibles, that are visible from
+ * software process.
+ *
+ * Synchronisation rules:
+ * 1. SYNC_HEAD: ring->kernrp = RDH
+ * 2. SYNC_TAIL: RDT = ring->userrp
+ */
+void
+rm_8259_sync_head_tail(device_t dev)
+{
+ rm_8259_sync_tail(dev);
+ rm_8259_sync_head(dev);
+}
+
+
+void
+rm_8259_sync_tail(device_t dev)
+{
+ struct adapter *adapter;
+ adapter = (struct adapter *)device_get_softc(dev);
+
+ RINGMAP_FUNC_DEBUG(start);
+
+
+ RINGMAP_FUNC_DEBUG(end);
+}
+
+
+void
+rm_8259_sync_head(device_t dev)
+{
+ struct adapter *adapter;
+
+ RINGMAP_FUNC_DEBUG(start);
+
+ adapter = (struct adapter *)device_get_softc(dev);
+
+ RINGMAP_LOCK(adapter->rm);
+
+ RINGMAP_UNLOCK(adapter->rm);
+
+ RINGMAP_FUNC_DEBUG(end);
+}
+
+
+/*
+ * This should be called from ISR. Other interrupts are disallowed!
+ * It means the functions must be as small as possible
+ */
+void
+rm_8259_interrupt(void *arg)
+{
+ struct adapter *adapter = (struct adapter *) arg;
+
+ /* count interrupts only if there is capturing object */
+ if ( adapter->rm->open_cnt > 0 )
+ adapter->rm->interrupts_counter++;
+}
+
+
+void
+rm_8259_delayed_interrupt(void *context)
+{
+ struct adapter *adapter = (struct adapter *)context;
+ struct timeval last_ts;
+
+ RINGMAP_INTR(start);
+ RINGMAP_LOCK(adapter->rm);
+
+ getmicrotime(&last_ts);
+ rm_8259_sync_tail(adapter->dev);
+
+
+ RINGMAP_UNLOCK(adapter->rm);
+ RINGMAP_INTR(end);
+}
+
+
+void
+rm_8259_delayed_interrupt_per_packet(device_t dev, int slot_num)
+{
+ struct adapter *adapter = NULL;
+ struct ringmap *rm = NULL;
+
+ adapter = (struct adapter *)device_get_softc(dev);
+ rm = adapter->rm;
+
+ RINGMAP_INTR(start);
+
+ RINGMAP_LOCK(rm);
+
+ RINGMAP_UNLOCK(rm);
+
+ RINGMAP_INTR(end);
+}
+
+
+int
+rm_8259_set_slot(struct ring *ring, device_t dev, unsigned int slot_num)
+{
+ struct adapter *adapter = NULL;
+ adapter = (struct adapter *)device_get_softc(dev);
+
+#if (__RINGMAP_DEB)
+ printf("[%s] Set slot: %d\n", __func__, slot_num);
+#endif
+
+
+ return (0);
+
+}
+
+
+/*
+ * Disable interrupts on adapter
+ */
+void
+rm_8259_disable_intr(device_t dev)
+{
+
+ struct adapter *adapter;
+ adapter = (struct adapter *)device_get_softc(dev);
+
+ /*Use function implemeted in native (em) driver */
+ ixgbe_disable_intr(adapter);
+}
+
+
+/*
+ * Enable interrupts on adapter
+ */
+void
+rm_8259_enable_intr(device_t dev)
+{
+
+ struct adapter *adapter;
+ adapter = (struct adapter *)device_get_softc(dev);
+
+ /*Use function implemeted in native (em) driver */
+ ixgbe_enable_intr(adapter);
+}
+
+
+/*
+ * Get pointer to device structure of adapter using our ringmap char device.
+ * This is a trick. Our cdev must have the same unit number as dev of adapter.
+ * Look in ringmap.c: ringmap_attach() where we create our cdev.
+ */
+device_t
+rm_8259_get_device_p(struct cdev *cdev)
+{
+ struct adapter *adapter;
+
+ adapter = (struct adapter *)devclass_get_softc(ixgbe_devclass, dev2unit(cdev));
+#if (__RINGMAP_DEB)
+ if (adapter == NULL){
+ RINGMAP_WARN(Can not get pointer to adapter structure);
+ }
+#endif
+
+ return (adapter->dev);
+}
+
+
+/*
+ * Set pointer to ringmap in the adapter structure.
+ */
+int
+rm_8259_set_ringmap_to_adapter(device_t dev, struct ringmap *rm)
+{
+ struct adapter *adapter;
+
+ adapter = (struct adapter *)device_get_softc(dev);
+ adapter->rm = rm;
+
+ return (0);
+}
+
+
+/*
+ * Returns pointer to ringmap structure
+ */
+struct ringmap *
+rm_8259_get_ringmap_p(device_t dev)
+{
+ struct adapter *adapter;
+
+ adapter = (struct adapter *)device_get_softc(dev);
+ return (adapter->rm);
+}
+
+
+int
+rm_8259_print_ring_pointers(struct adapter *adapter)
+{
+ unsigned int rdt, rdh;
+ struct ringmap *rm = NULL;
+
+ rm = adapter->rm;
+
+ if (rm == NULL)
+ goto out;
+
+ rdh = 0;
+ rdt = 0;
+
+ printf("\n== +++++++++ RING POINTERS ++++++++++++ \n");
+ printf("== + HW HEAD = %d (KERN POINTER)\n", rdh);
+ printf("== + HW TAIL = %d (USER POINTER)\n", rdt);
+ printf("== ++++++++++++++++++++++++++++++++++++++ \n\n");
+
+out:
+ return (0);
+}
==== //depot/projects/soc2010/ringmap/current/sys/i386/conf/I686RINGMAP_CURRENT#3 (text+ko) ====
@@ -36,12 +36,10 @@
options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
-options RINGMAP
-
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
-#options INET6 # IPv6 communications protocols
+options INET6 # IPv6 communications protocols
options SCTP # Stream Control Transmission Protocol
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
@@ -61,7 +59,7 @@
options GEOM_LABEL # Provides labelization
#options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty)
#options COMPAT_FREEBSD4 # Compatible with FreeBSD4
-#options COMPAT_FREEBSD5 # Compatible with FreeBSD5
+options COMPAT_FREEBSD5 # Compatible with FreeBSD5
options COMPAT_FREEBSD6 # Compatible with FreeBSD6
options COMPAT_FREEBSD7 # Compatible with FreeBSD7
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
@@ -232,7 +230,7 @@
#device fxp # Intel EtherExpress PRO/100B (82557, 82558)
#device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet
#device lge # Level 1 LXT1001 gigabit Ethernet
-device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet
+#device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet
#device nfe # nVidia nForce MCP on-board Ethernet
#device nge # NatSemi DP83820 gigabit Ethernet
##device nve # nVidia nForce MCP on-board Ethernet Networking
More information about the p4-projects
mailing list