PERFORCE change 180425 for review

Alexandre Fiveg afiveg at FreeBSD.org
Sat Jul 3 05:59:07 UTC 2010


http://p4web.freebsd.org/@@180425?ac=10

Change 180425 by afiveg at 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) ====



More information about the p4-projects mailing list