From owner-p4-projects@FreeBSD.ORG Mon Jun 28 20:09:22 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A397F1065670; Mon, 28 Jun 2010 20:09:22 +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 6734D1065674 for ; Mon, 28 Jun 2010 20:09:22 +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 54E748FC1B for ; Mon, 28 Jun 2010 20:09:22 +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 o5SK9MJw071925 for ; Mon, 28 Jun 2010 20:09:22 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SK9M3q071923 for perforce@freebsd.org; Mon, 28 Jun 2010 20:09:22 GMT (envelope-from afiveg@FreeBSD.org) Date: Mon, 28 Jun 2010 20:09:22 GMT Message-Id: <201006282009.o5SK9M3q071923@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 180303 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: Mon, 28 Jun 2010 20:09:22 -0000 http://p4web.freebsd.org/@@180303?ac=10 Change 180303 by afiveg@cottonmouth on 2010/06/28 20:09:14 Cosmetic bug fixes in libpcap Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap/pcap.h#2 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#15 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#14 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#12 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#18 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#18 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#3 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#3 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#4 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#4 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap/pcap.h#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#7 (text+ko) ==== @@ -363,7 +363,7 @@ curr_slot = R_MODULO(SW_TAIL(ring) + 1); if (!(ring->slot[curr_slot].is_ok)) { #ifdef __RINGMAP_DEB - printf("Slot %d was not accepted by driver!\n"); + printf("Slot %d was not accepted by driver!\n", curr_slot); #endif goto out; } @@ -375,16 +375,16 @@ pkthdr.caplen = pkthdr.len = mb->m_len; datap = (caddr_t)U_PACKET(ring, curr_slot); + ring->pkt_counter++; + --ws; + (*callback)(user, &pkthdr, datap); out: + INC_TAIL(ring); + ring->slot[curr_slot].is_ok = 0; ring->slot[curr_slot].filtered = 0; - - INC_TAIL(ring); - ring->pkt_counter++; - - --ws; } RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#13 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#14 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#12 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#18 (text+ko) ==== @@ -229,6 +229,8 @@ contigfree(rm->funcs, sizeof(struct ringmap_functions), M_DEVBUF); contigfree(rm, sizeof(struct ringmap), M_DEVBUF); + + rm = NULL; RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#18 (text+ko) ==== @@ -231,26 +231,27 @@ */ void (*delayed_isr_per_packet)(struct ring *, int); -/* - * 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: HARDWARE_HEAD => SOFTWARE_HEAD - * set value from hardware HEAD register into the software visible - * HEAD-variable: ring->kernrp. The User-space process shouldn't touch - * the ring->kernrp variable. Only hardware increment the value in the - * HEAD register onto adapters chip while receiving new packets, and only - * driver (kernel) synchronize then hardware HEAD with ring->kernrp. - * - * 2. SYNC_TAIL: SOFTWARE_TAIL => HARDWARE_TAIL - * set value from software TAIL-variable: ring->userrp into the hardware - * TAIL-register. Hardware shouldn't change the content of TAIL-register. - * Software after reading one packet in RAM increment the value of - * ring->userrp. Kernel will check this value and set it into the - * hardware TAIL-register. - */ + /* + * 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: HARDWARE_HEAD => SOFTWARE_HEAD + * set value from hardware HEAD register into the software visible + * HEAD-variable: ring->kernrp. The User-space process shouldn't + * touch the ring->kernrp variable. Only hardware increment the value + * in the HEAD register onto adapters chip while receiving new + * packets, and only driver (kernel) synchronize then hardware HEAD + * with ring->kernrp. + * + * 2. SYNC_TAIL: SOFTWARE_TAIL => HARDWARE_TAIL + * set value from software TAIL-variable: ring->userrp into the + * hardware TAIL-register. Hardware shouldn't change the content of + * TAIL-register. Software after reading one packet in RAM increment + * the value of ring->userrp. Kernel will check this value and set it + * into the hardware TAIL-register. + */ void (*sync_head_tail)(device_t, struct ring *); }; @@ -267,6 +268,7 @@ /* RDT = (userrp - RING_SAFETY_MARGIN) mod SLOTS_NUMBER */ #define IOCTL_SYNC_HEAD_TAIL _IO(RINGMAP_IOC_MAGIC, 2) + /* * Disable interrupts on NIC. In some cases it is safe * to disable interrupts in order to avoid kernel panics @@ -397,7 +399,6 @@ if (__RINGMAP_DEB) printf(WARN_PREFIX"[%s]: " #x "\n", __func__); - #ifdef _KERNEL #define RINGMAP_PRINT_DESC(i) \ printf("[%s] - DESC INFO: desc_num=%d, status=0x%X, pktlen=%d\n[%s] - ADDRESSES: pkt_virt=0x%X (kern), pkt_phys=0x%X\n", \ @@ -427,9 +428,3 @@ pktp[32], \ pktp[59]); #endif - - - - - - ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#3 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#3 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#4 (text+ko) ==== @@ -21,11 +21,10 @@ pcap_t *handle; - +unsigned int pcnt = 0; #define HOWMANY 20 - int main(int argc, char **argv) { @@ -68,5 +67,12 @@ void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) { - printf("got :) \n"); + pcnt++; + + printf("===> Packet %d \n", pcnt); + printf("Packet Length: %d \n", header->len); + printf("Time Stamp: %llu \n", + (header->ts.tv_sec*1000000 + header->ts.tv_usec)); + + printf("\n\n"); } ==== //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#4 (text+ko) ====