From owner-p4-projects@FreeBSD.ORG Sat Jul 3 05:59:07 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5EE791065672; Sat, 3 Jul 2010 05:59:07 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B257106566B for ; Sat, 3 Jul 2010 05:59:07 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EC1488FC0C for ; Sat, 3 Jul 2010 05:59:06 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o635x6xk055513 for ; Sat, 3 Jul 2010 05:59:06 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o635x6n3055511 for perforce@freebsd.org; Sat, 3 Jul 2010 05:59:06 GMT (envelope-from afiveg@FreeBSD.org) Date: Sat, 3 Jul 2010 05:59:06 GMT Message-Id: <201007030559.o635x6n3055511@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180425 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 05:59:07 -0000 http://p4web.freebsd.org/@@180425?ac=10 Change 180425 by afiveg@cottonmouth on 2010/07/03 05:58:58 Multithreading done! ringmap works in -current corectly! Proofed with tcpdump Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#6 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#6 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#8 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#10 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#21 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#19 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#20 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#18 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#10 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#24 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#24 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#8 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#9 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#4 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#13 (text+ko) ==== @@ -382,7 +382,6 @@ out: SW_INCR_TAIL(ring); - ring->slot[curr_slot].is_ok = 0; ring->slot[curr_slot].filtered = 0; } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#21 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#19 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#20 (text+ko) ==== @@ -32,6 +32,7 @@ void rm_8254_sync_tail(device_t, struct ring *); void rm_8254_sync_head(device_t); void rm_8254_delayed_interrupt_per_packet(device_t, int); +struct ring * rm_8254_find_next(struct adapter *); struct ring *rm_8254_alloc_ring(device_t); extern devclass_t em_devclass; @@ -110,7 +111,7 @@ struct adapter *adapter = (struct adapter *)context; struct capt_instance *ci = NULL; -// RINGMAP_INTR(start); + RINGMAP_INTR(start); RINGMAP_LOCK(adapter->rm); @@ -120,7 +121,7 @@ #endif if (ci->ring != NULL) { /* TODO: find the next ring */ - rm_8254_sync_tail(adapter->dev, ci->ring); + rm_8254_sync_tail(adapter->dev, rm_8254_find_next(adapter)); #ifdef RINGMAP_TIMESTAMP getmicrotime(&ci->ring->last_ts); #endif @@ -129,9 +130,29 @@ RINGMAP_UNLOCK(adapter->rm); -// RINGMAP_INTR(end); + RINGMAP_INTR(end); } +struct ring * +rm_8254_find_next(struct adapter *adapter) +{ + unsigned int rdh, rdt, dist, min_dist = SLOTS_NUMBER; + struct ringmap *rm = adapter->rm; + struct capt_instance *ci = NULL, *min_ci = NULL; + + rdh = RINGMAP_HW_READ_HEAD(adapter); + + SLIST_FOREACH(ci, &rm->instance_list, next_instance) { + rdt = ci->ring->userrp; + dist = R_DISTANCE(rdh, rdt); + if (dist <= min_dist) { + dist = min_dist; + min_ci = ci; + } + } + + return (min_ci->ring); +} void rm_8254_delayed_interrupt_per_packet(device_t dev, int slot_num) ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#18 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#24 (text+ko) ==== @@ -350,28 +350,19 @@ devfs_get_cdevpriv((void **)&ci); #ifdef __RINGMAP_DEB - printf("[%s] currthread->proc->pid: %d \n", __func__, curthread->td_proc->p_pid); printf("[%s] ci->td->proc->pid: %d\n", __func__, ci->td->td_proc->p_pid); - printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); #endif -// if (ci->ring != NULL) -// contigfree(ci->ring, sizeof(struct ring), M_DEVBUF); -// ci->ring = NULL; -// -// /* Remove the capturing instance from list */ -// SLIST_REMOVE(&rm->instance_list, ci, capt_instance, next_instance); -// FREE(ci, M_DEVBUF); -// ci = NULL; -// rm->open_cnt--; + + rm->open_cnt--; +#ifdef __RINGMAP_DEB SLIST_FOREACH(ki, &rm->instance_list, next_instance) { -#ifdef __RINGMAP_DEB printf("[%s] Aufter dealocation: ", __func__); printf("[%s] ki->td->proc->pid: %d\n", __func__, ki->td->td_proc->p_pid); printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ki->ring); + } #endif - } RINGMAP_UNLOCK(rm); @@ -433,7 +424,7 @@ struct ringmap *ringmap = NULL; struct capt_instance *ci; -// RINGMAP_IOCTL(start); + RINGMAP_IOCTL(start); ringmap = get_ringmap_p(get_device_p(cdev)); if ( ringmap == NULL ){ @@ -464,7 +455,7 @@ /* Sleep and wait for new packets */ case IOCTL_SLEEP_WAIT: -// RINGMAP_IOCTL(Sleep and wait for new packets); + RINGMAP_IOCTL(Sleep and wait for new packets); ci->ring->user_wait_kern++; ringmap->funcs->sync_head_tail(ringmap->dev, ci->ring); @@ -493,7 +484,7 @@ return (ENODEV); } -// RINGMAP_IOCTL(end); + RINGMAP_IOCTL(end); return (err); } ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#24 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#4 (text+ko) ====