Date: Sat, 17 Jul 2010 19:10:45 GMT From: Alexandre Fiveg <afiveg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 181115 for review Message-ID: <201007171910.o6HJAj0v001054@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181115?ac=10 Change 181115 by afiveg@ringmap-2 on 2010/07/17 19:10:20 ringmap_attach() _detach() ported to ixgbe and work properly. Next, working with interrupts. Affected files ... .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#3 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#2 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#3 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#33 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#33 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#4 (text+ko) ==== @@ -38,6 +38,10 @@ #include "ixgbe.h" +#ifdef RINGMAP +#include <net/ringmap.h> +#endif + /********************************************************************* * Set this to one to display debug statistics *********************************************************************/ @@ -153,7 +157,11 @@ static void ixgbe_print_hw_stats(struct adapter *); static void ixgbe_print_debug_info(struct adapter *); static void ixgbe_update_link_status(struct adapter *); + +#ifndef RINGMAP static void ixgbe_refresh_mbufs(struct rx_ring *, int); +#endif + static int ixgbe_xmit(struct tx_ring *, struct mbuf **); static int ixgbe_sysctl_stats(SYSCTL_HANDLER_ARGS); static int ixgbe_sysctl_debug(SYSCTL_HANDLER_ARGS); @@ -198,6 +206,15 @@ static void ixgbe_reinit_fdir(void *, int); #endif + +#ifdef RINGMAP +extern int ringmap_attach (device_t, struct ringmap_functions *); +extern int ringmap_detach (device_t); + +extern struct ringmap_functions ringmap_f; +#endif + + /********************************************************************* * FreeBSD Device Interface Entry Points *********************************************************************/ @@ -212,7 +229,11 @@ }; static driver_t ixgbe_driver = { +#ifndef RINGMAP "ix", ixgbe_methods, sizeof(struct adapter), +#else + "ringmap", ixgbe_methods, sizeof(struct adapter), +#endif }; #ifndef RINGMAP @@ -220,10 +241,15 @@ #endif devclass_t ixgbe_devclass; +#ifndef RINGMAP DRIVER_MODULE(ixgbe, pci, ixgbe_driver, ixgbe_devclass, 0, 0); - MODULE_DEPEND(ixgbe, pci, 1, 1, 1); MODULE_DEPEND(ixgbe, ether, 1, 1, 1); +#else +DRIVER_MODULE(ringmap, pci, ixgbe_driver, ixgbe_devclass, 0, 0); +MODULE_DEPEND(ringmap, pci, 1, 1, 1); +MODULE_DEPEND(ringmap, ether, 1, 1, 1); +#endif /* ** TUNEABLE PARAMETERS: @@ -330,9 +356,6 @@ static int fdir_pballoc = 1; #endif -#ifdef RINGMAP -#include <net/ringmap.h> -#endif /********************************************************************* * Device identification routine @@ -632,6 +655,11 @@ ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD; IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); + +#ifdef RINGMAP + ringmap_attach(dev, &ringmap_f); +#endif + INIT_DEBUGOUT("ixgbe_attach: end"); return (0); err_late: @@ -662,6 +690,10 @@ INIT_DEBUGOUT("ixgbe_detach: begin"); +#ifdef RINGMAP + ringmap_detach (dev); +#endif + /* Make sure VLANS are not using driver */ if (adapter->ifp->if_vlantrunk != NULL) { device_printf(dev,"Vlan in use, detach first\n"); @@ -1285,8 +1317,13 @@ struct ifnet *ifp = adapter->ifp; bool more; +#ifdef RINGMAP + struct capt_object *co = NULL; +#endif + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { more = ixgbe_rxeof(que, adapter->rx_process_limit); + IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); #if __FreeBSD_version >= 800000 @@ -1297,6 +1334,19 @@ ixgbe_start_locked(txr, ifp); #endif IXGBE_TX_UNLOCK(txr); + +#ifdef RINGMAP + adapter->rm->funcs->sync_head(adapter->dev); + + /* Wakeup threads with not empty rings */ + SLIST_FOREACH(co, &adapter->rm->object_list, objects) { + if (RING_NOT_EMPTY(co->ring)){ + wakeup(co->ring); + } + } +#endif + + if (more) { taskqueue_enqueue(que->tq, &que->que_task); return; @@ -1377,8 +1427,13 @@ bool more_tx, more_rx; u32 newitr = 0; +#ifdef RINGMAP + struct capt_object *co = NULL; + adapter->rm->funcs->delayed_isr(adapter); +#endif ++que->irqs; + more_rx = ixgbe_rxeof(que, adapter->rx_process_limit); IXGBE_TX_LOCK(txr); @@ -1387,6 +1442,18 @@ more_rx = ixgbe_rxeof(que, adapter->rx_process_limit); +#ifdef RINGMAP + adapter->rm->funcs->sync_head(adapter->dev); + + /* Wakeup threads with not empty rings */ + SLIST_FOREACH(co, &adapter->rm->object_list, objects) { + if (RING_NOT_EMPTY(co->ring)){ + wakeup(co->ring); + } + } +#endif + + /* Do AIM now? */ if (ixgbe_enable_aim == FALSE) @@ -2048,7 +2115,6 @@ device_t dev = adapter->dev; struct ix_queue *que = adapter->queues; int error, rid = 0; - /* MSI RID at 1 */ if (adapter->msix == 1) rid = 1; @@ -2114,6 +2180,9 @@ struct ix_queue *que = adapter->queues; int error, rid, vector = 0; +/*TODO: remove it ASAP */ + RINGMAP_FUNC_DEBUG(start); + for (int i = 0; i < adapter->num_queues; i++, vector++, que++) { rid = vector + 1; que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -3367,6 +3436,7 @@ * be recalled to try again. * **********************************************************************/ +#ifndef RINGMAP static void ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) { @@ -3440,6 +3510,7 @@ IXGBE_RDT(rxr->me), cleaned); return; } +#endif /* !RINGMAP */ /********************************************************************* * @@ -4258,6 +4329,10 @@ if (++i == adapter->num_rx_desc) i = 0; + +#ifndef RINGMAP +/* RINGMAP: Do not send packet to the IP-stack. Andd do not refresh */ + /* Now send to the stack or do LRO */ if (sendmp != NULL) ixgbe_rx_input(rxr, ifp, sendmp, ptype); @@ -4267,13 +4342,20 @@ ixgbe_refresh_mbufs(rxr, i); processed = 0; } +#else + if (adapter->rm != NULL) + adapter->rm->funcs->delayed_isr_per_packet(adapter->dev, + R_MODULO(i-1)); +#endif } +#ifndef RINGMAP /* Refresh any remaining buf structs */ if (processed != 0) { ixgbe_refresh_mbufs(rxr, i); processed = 0; } +#endif rxr->next_to_check = i; ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#3 (text+ko) ==== @@ -119,8 +119,15 @@ * against the system mbuf pool limit, you can tune nmbclusters * to adjust for this. */ + +#ifndef RINGMAP #define DEFAULT_RXD 1024 #define PERFORM_RXD 2048 +#else +#define DEFAULT_RXD SLOTS_NUMBER +#define PERFORM_RXD SLOTS_NUMBER +#endif + #define MAX_RXD 4096 #define MIN_RXD 64 ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#3 (text+ko) ==== @@ -55,6 +55,25 @@ }; +/* + * 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; + +#if (__RINGMAP_DEB) + printf(RINGMAP_PREFIX"Number of queeus on adapter: %d\n", + adapter->num_queues); +#endif + return (0); +} + + /* * This function synchronize the tail and head hardware registers * with head and tail software varibles, that are visible from @@ -78,10 +97,8 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_FUNC_DEBUG(start); - RINGMAP_FUNC_DEBUG(end); } @@ -90,7 +107,6 @@ { struct adapter *adapter; - RINGMAP_FUNC_DEBUG(start); adapter = (struct adapter *)device_get_softc(dev); @@ -98,7 +114,6 @@ RINGMAP_UNLOCK(adapter->rm); - RINGMAP_FUNC_DEBUG(end); } @@ -123,15 +138,15 @@ 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); - + if ( adapter->rm->open_cnt > 0 ) { + adapter->rm->interrupts_counter++; + getmicrotime(&last_ts); + rm_8259_sync_tail(adapter->dev); + } RINGMAP_UNLOCK(adapter->rm); - RINGMAP_INTR(end); } @@ -221,19 +236,6 @@ } -/* - * 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); -} /* ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#33 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#33 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007171910.o6HJAj0v001054>