PERFORCE change 180333 for review

Alexandre Fiveg afiveg at FreeBSD.org
Tue Jun 29 22:39:26 UTC 2010


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

Change 180333 by afiveg at cottonmouth on 2010/06/29 22:39:01

	Bugfixes: check the taskqueue with delayed tasks after disabling interrupts. Unfortunately, after disabling interrupts some delayed task can be in the queue and they can do some problems (kernel panics)

Affected files ...

.. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#8 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#16 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#14 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#15 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#13 edit
.. //depot/projects/soc2010/ringmap/current/sys/modules/ringmap/Makefile#2 edit
.. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#19 edit
.. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#19 edit
.. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#4 edit
.. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#4 edit
.. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#5 edit

Differences ...

==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#8 (text+ko) ====

@@ -360,7 +360,7 @@
 				return (cnt - ws);
 		}
 
-		curr_slot = R_MODULO(SW_TAIL(ring) + 1);
+		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", curr_slot);
@@ -380,8 +380,12 @@
 
 		(*callback)(user, &pkthdr, datap);
 
+#ifdef __RINGMAP_DEB
+		PRINT_SLOT(ring, ring->cur_slot_user, datap);
+#endif
+
 out:
-		INC_TAIL(ring);
+		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/if_lem.c#16 (text+ko) ====

@@ -1390,8 +1390,11 @@
 			taskqueue_enqueue(adapter->tq, &adapter->rxtx_task);
 
 #ifdef RINGMAP
-		if (adapter->rm != NULL) 
-			wakeup(adapter->rm);
+		if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) {
+			adapter->rm->funcs->sync_head(adapter->dev, adapter->rm->ring);
+			if (adapter->rm != NULL) 
+				wakeup(adapter->rm);
+		}
 #endif 
 
 #if (RINGMAP_TX_ENABLE)
@@ -3578,9 +3581,13 @@
 		if (accept_frame) {
 
 #ifdef RINGMAP
-			if ((adapter->rm != NULL) && (adapter->rm->ring != NULL))
+			if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) {
 				adapter->rm->funcs->delayed_isr_per_packet(adapter->rm->ring, 
 					i);
+#ifdef __RINGMAP_DEB
+				PRINT_SLOT((adapter->rm->ring), (i), (adapter));
+#endif 
+			}
 #endif
 
 #ifndef RINGMAP

==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#14 (text+ko) ====


==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#15 (text+ko) ====

@@ -29,13 +29,92 @@
 void rm_8254_delayed_interrupt(void *);
 int rm_8254_print_ring_pointers(struct adapter *);
 void rm_8254_sync_head_tail(device_t, struct ring *);
+void rm_8254_sync_tail(device_t, struct ring *);
+void rm_8254_sync_head(device_t, struct ring *);
 void rm_8254_delayed_interrupt_per_packet(struct ring *, int);
+struct ring *rm_8254_alloc_ring(device_t);
+void  rm_8254_free_ring(device_t, struct ring *);
 
 extern devclass_t em_devclass;
 extern void	lem_enable_intr(struct adapter *);
 extern void	lem_disable_intr(struct adapter *);
 
 
+
+void  
+rm_8254_free_ring(device_t dev, struct ring *ring)
+{
+	struct adapter *adapter = (struct adapter *)device_get_softc(dev);
+
+	if ( adapter == NULL ) 
+		goto out;
+
+	/* Disable interrupts of adapter */
+	rm_8254_disable_intr(dev);
+
+	/* Check whether we have some tasks in queue */
+	 taskqueue_drain(adapter->tq, &adapter->rxtx_task);
+	
+	if (ring != NULL){
+		contigfree(ring, sizeof(struct ring), M_DEVBUF);
+		ring = NULL;
+	} else {
+		RINGMAP_ERROR(The pointer to ring structure is NULL);
+	}
+out: ;
+}
+
+struct ring *
+rm_8254_alloc_ring(device_t dev)
+{
+	struct ring *ring;
+	struct adapter *adapter = (struct adapter *)device_get_softc(dev);
+
+	if ( adapter == NULL ) {
+		return (NULL);
+	}
+	
+	/* 
+	 * Allocate memory for ring structure 
+	 * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed 
+	 * for memory mapping.  
+	 */
+	ring = (struct ring *) contigmalloc (sizeof(struct ring), 
+			M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0);
+	if (ring == NULL) { 
+		RINGMAP_ERROR(Can not allocate space for ring structure);
+
+		return (NULL);
+	}
+
+	/* Disable interrupts of adapter while allocating the ring */
+	rm_8254_disable_intr(dev);
+
+	/* 
+	 * Before continue look whether any delayed interrupt tasks are 
+	 * in the taskqueue.
+	 */
+	 taskqueue_drain(adapter->tq, &adapter->rxtx_task);
+	
+	/* Set ring fields in the initial state */
+	ring->kern_wait_user = 0;
+    ring->user_wait_kern = 0;
+    ring->interrupts_counter = 0;
+	ring->pkt_counter = 0;
+	ring->size = SLOTS_NUMBER;
+
+	if (rm_8254_init_slots(ring, dev) == -1) { 
+		RINGMAP_ERROR(The ring is not initialized. Device will not be opened!);
+		contigfree(ring, sizeof(struct ring), M_DEVBUF);
+
+		return (NULL);
+	}	
+
+	rm_8254_enable_intr(dev);
+
+	return (ring);
+}
+
 void 
 rm_8254_delayed_interrupt_per_packet(struct ring *ring, int slot_num)
 {
@@ -52,6 +131,7 @@
 	RINGMAP_INTR(end);
 }
 
+
 /* 
  * This function synchronize the tail and head hardware registers
  * with head and tail software varibles, that are visible from 
@@ -64,13 +144,28 @@
 void 
 rm_8254_sync_head_tail(device_t dev, struct ring *ring)
 {
+	rm_8254_sync_tail(dev, ring);
+	rm_8254_sync_head(dev, ring);
+}
+
+
+void 
+rm_8254_sync_tail(device_t dev, struct ring *ring)
+{
 	struct adapter *adapter;
 	adapter = (struct adapter *)device_get_softc(dev);
 
-	RINGMAP_HW_SYNC_HEAD(adapter, ring); 	/* SW_HEAD <== HW_HEAD */
 	RINGMAP_HW_SYNC_TAIL(adapter, ring);	/* SW_TAIL ==> HW_TAIL */
+}
 
-	adapter->rm->ring->hw_RDT = RINGMAP_HW_READ_TAIL(adapter);
+
+void 
+rm_8254_sync_head(device_t dev, struct ring *ring)
+{
+	struct adapter *adapter;
+	adapter = (struct adapter *)device_get_softc(dev);
+
+	RINGMAP_HW_SYNC_HEAD(adapter, ring);	/* SW_TAIL ==> HW_HEAD */
 }
 
 
@@ -103,7 +198,7 @@
 	 * TODO: we want multithreading, it means we should later 
 	 * sync not one ring but many rings, each per thread
 	 */
-	rm_8254_sync_head_tail(adapter->dev, adapter->rm->ring);
+	rm_8254_sync_tail(adapter->dev, adapter->rm->ring);
 
 
 #ifdef RINGMAP_TIMESTAMP
@@ -329,18 +424,28 @@
 rm_8254_print_ring_pointers(struct adapter *adapter)
 {
 	unsigned int rdt, rdh;
-	struct ringmap *rm = adapter->rm;
+	struct ringmap *rm = NULL;
+
+	if ( (adapter == NULL) || 
+			(adapter->rm == NULL) || 
+			(adapter->rm->ring ) == NULL){
+		RINGMAP_WARN(NULL pointer! Can not print rings pointers);
+
+		return (0);
+	}
+
+	rm = adapter->rm;
 
 	rdh = RINGMAP_HW_READ_HEAD(adapter);
 	rdt = RINGMAP_HW_READ_TAIL(adapter);
 
-	printf("\n  +++++++++  RING POINTERS  ++++++++++++ \n");
-	printf("  +  HW HEAD = %d (KERN POINTER)\n", rdh);
-	printf("  +  HW TAIL = %d (USER POINTER)\n", rdt);
-	printf("  +\n");
-	printf("  +  kernrp = %d \n", rm->ring->kernrp);
-	printf("  +  userrp = %d \n", rm->ring->userrp);
-	printf("  ++++++++++++++++++++++++++++++++++++++ \n\n");
+	printf("\n==  +++++++++  RING POINTERS  ++++++++++++ \n");
+	printf("==  +  HW HEAD = %d (KERN POINTER)\n", rdh);
+	printf("==  +  HW TAIL = %d (USER POINTER)\n", rdt);
+	printf("==  +\n");
+	printf("==  +  kernrp = %d \n", rm->ring->kernrp);
+	printf("==  +  userrp = %d \n", rm->ring->userrp);
+	printf("==  ++++++++++++++++++++++++++++++++++++++ \n\n");
 
 	return (0);
 }

==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#13 (text+ko) ====


==== //depot/projects/soc2010/ringmap/current/sys/modules/ringmap/Makefile#2 (text+ko) ====


==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#19 (text+ko) ====

@@ -51,8 +51,11 @@
 extern void rm_8254_interrupt(void *);
 extern void rm_8254_delayed_interrupt(void *);
 extern void rm_8254_sync_head_tail(device_t, struct ring *);
+extern void rm_8254_sync_tail(device_t, struct ring *);
+extern void rm_8254_sync_head(device_t, struct ring *);
 extern void rm_8254_delayed_interrupt_per_packet(struct ring *, int);
-
+extern struct ring *rm_8254_alloc_ring(device_t);
+extern void  rm_8254_free_ring(device_t, struct ring *);
 
 d_open_t	ringmap_open;
 d_close_t	ringmap_close;
@@ -123,6 +126,10 @@
 			rm->funcs->delayed_isr_per_packet = 
 				rm_8254_delayed_interrupt_per_packet;
 			rm->funcs->sync_head_tail 		= rm_8254_sync_head_tail;
+			rm->funcs->sync_tail 			= rm_8254_sync_tail;
+			rm->funcs->sync_head 			= rm_8254_sync_head;
+			rm->funcs->alloc_ring			= rm_8254_alloc_ring;
+			rm->funcs->free_ring			= rm_8254_free_ring;
 
 			get_ringmap_p = rm_8254_get_ringmap_p;
 			get_device_p  =	rm_8254_get_device_p;
@@ -184,8 +191,9 @@
 	set_ringmap_funcs(rm, controller_type);
 
 	/* 
-	 * Create char device for communication with user space. User space process
-	 * wich want to capture should first open this device. Then, by syscalls 
+	 * Create char device for communication with user-space. The user-space
+	 * process wich want to capture should first open this device. Then, by
+	 * syscalls 
 	 * on this device it will: 
 	 * - 	get physical adresses of packet buffers for mapping them in its 
 	 * 		virtual memory space 
@@ -247,9 +255,7 @@
 int
 ringmap_open(struct cdev *cdev, int flag, int otyp, struct thread *td)
 {
-	int err = 0;
 	struct ringmap *rm = NULL;
-	struct ring *ring = NULL;
 
 	RINGMAP_FUNC_DEBUG(start);
 
@@ -262,6 +268,7 @@
 	rm = get_ringmap_p(get_device_p(cdev));
 	if (rm == NULL) {
 		RINGMAP_ERROR(Null pointer to ringmap structure);
+
 		return (EIO);
 	}
 	
@@ -271,57 +278,32 @@
 	if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){
 		RINGMAP_ERROR(Sorry! Can not open device more then one time!);
 		atomic_readandclear_int(&rm->open_cnt); 
+
 		return (EIO);
 	}
 
 	if (rm->dev == NULL){
 		RINGMAP_ERROR(Null pointer to device structure of adapter);
 		atomic_readandclear_int(&rm->open_cnt); 
+
 		return (EIO);
 	}
-
-	/* 
-	 * Allocate memory for ring structure 
-	 * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed 
-	 * for memory mapping.  
-	 */
-	ring = (struct ring *) contigmalloc (sizeof(struct ring), 
-			M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0);
-	if (ring == NULL) { 
-		RINGMAP_ERROR(Can not allocate space for ring structure); 
+	
+	/* Allocate ring */
+	rm->ring = rm->funcs->alloc_ring(rm->dev);
+	if (rm->ring == NULL){
+		RINGMAP_ERROR(Null pointer to ring the structure);
+		atomic_readandclear_int(&rm->open_cnt); 
 
-		atomic_readandclear_int(&rm->open_cnt); 
 		return (EIO);
 	}
-	rm->ring 	= ring;
 
 	/* Store pointer to the thread */
 	rm->ring->td = td;
-
-	/* Disable interrupts of adapter */
-	rm->funcs->disable_intr(rm->dev);
 	
-	/* Set ring fields in the initial state */
-	ring->kern_wait_user = 0;
-    ring->user_wait_kern = 0;
-    ring->interrupts_counter = 0;
-	ring->pkt_counter = 0;
-	ring->size = SLOTS_NUMBER;
-
-	if (rm->funcs->init_slots(rm->ring, rm->dev) == -1){ 
-		RINGMAP_ERROR(The ring is not initialized. Device will not be opened!);
-		contigfree(rm->ring, sizeof(struct ring), M_DEVBUF);
-		rm->ring = NULL;
-		
-		atomic_readandclear_int(&rm->open_cnt); 
-		err = EIO;
-	}	
-
-	rm->funcs->enable_intr(rm->dev); 
-
 	RINGMAP_FUNC_DEBUG(end);
 
-	return (err);
+	return (0);
 }
 
 
@@ -340,18 +322,12 @@
 		return (0);
 	}
 
-	/* Disable interrupts of adapter */
-	rm->funcs->disable_intr(rm->dev);
+	atomic_readandclear_int(&rm->open_cnt); 
 
 	if (rm->ring != NULL){
-		contigfree(rm->ring, sizeof(struct ring), M_DEVBUF);
-		rm->ring = NULL;
-	} else {
-		RINGMAP_ERROR(The pointer to ring structure is NULL);
+		rm->funcs->free_ring(rm->dev, rm->ring);
 	}
 
-	atomic_readandclear_int(&rm->open_cnt); 
-
 	RINGMAP_FUNC_DEBUG(end);
 
     return (0);
@@ -416,25 +392,32 @@
 		/* Enable  Interrupts */
 		case IOCTL_ENABLE_INTR:
 			ringmap->funcs->enable_intr(ringmap->dev);
+			RINGMAP_IOCTL(interrupts schould be enabled);
 		break;
 
 		/* Disable  Interrupts */
 		case IOCTL_DISABLE_INTR:
 			ringmap->funcs->disable_intr(ringmap->dev);
+			RINGMAP_IOCTL(interrupts schould be disabled);
 		break;
 		
 		/* Sleep and wait for new frames */
 		case IOCTL_SLEEP_WAIT:
+			RINGMAP_IOCTL(Sleep and wait for new packets);
 			ringmap->ring->user_wait_kern++;
 			ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring);
 			err_sleep = tsleep(ringmap, (PRI_MIN) | PCATCH, "ioctl", 0);
 		break;
 
-		/* Synchronize sowftware ring-tail with hardware-ring-tail (RDT) */
 		case IOCTL_SYNC_HEAD_TAIL:
 			ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring);
 		break;
 
+		/* Synchronize sowftware ring-tail with hardware-ring-tail (RDT) */
+		case IOCTL_SYNC_TAIL:
+			ringmap->funcs->sync_tail(get_device_p(cdev), ringmap->ring);
+		break;
+
 		default:
 			RINGMAP_ERROR("Undefined command!");
 			return (ENODEV);

==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#19 (text+ko) ====

@@ -64,10 +64,10 @@
 	struct address	packet;
 
 	/* 1 - if accepted by (bpf) filter */
-	int filtered;
+	int volatile filtered;
 
 	/* 1 if accepted by driver and contains no errors */
-	int is_ok;
+	int volatile is_ok;
 
 	/* 
 	 * Next fields are for statistics:
@@ -109,9 +109,6 @@
 	 */
 	unsigned int volatile userrp;
 
-	/* This variable represents the value of Hardware TAIL register */
-	unsigned int hw_RDT;
-
 	/* Number of slots (descriptors a.k.a memory areas for frames) */
 	unsigned int size;
 
@@ -253,6 +250,14 @@
 	 *		into the hardware TAIL-register.
 	 */
 	void (*sync_head_tail)(device_t, struct ring *);
+	void (*sync_tail)(device_t, struct ring *);
+	void (*sync_head)(device_t, struct ring *);
+
+	/* Alloc memory for our ring and initialize the slots */
+	struct ring *(*alloc_ring)(device_t);
+
+	/* Free memory that was allocated for the ring */
+	void (*free_ring)(device_t, struct ring *);
 };
 
 #endif /* _KERNEL */
@@ -266,7 +271,12 @@
  * *************************************/
 #define RINGMAP_IOC_MAGIC	'T'
 
-/* RDT = (userrp - RING_SAFETY_MARGIN) mod SLOTS_NUMBER */
+/* 
+ * Should call the function that synchtonizes hardware TAIL 
+ * with SW_TAIL(ring)
+ */
+#define IOCTL_SYNC_TAIL			_IO(RINGMAP_IOC_MAGIC, 1) 
+
 #define IOCTL_SYNC_HEAD_TAIL	_IO(RINGMAP_IOC_MAGIC, 2) 
 
 /* 
@@ -282,7 +292,7 @@
  * Sleep and wait for new pkts in ring buffer. By this 
  * system call should the user-space process be blocked 
  * and should be awoken from ISR or delayed ISR after the  
- * new packets was received. Additional in kontext of this
+ * new packets was received. Additionaly, in kontext of this
  * syscall hardware HEAD and TAIL registers should be 
  * synchronized with ring->kernerp and ring->userrp
  */
@@ -298,8 +308,8 @@
 #define SW_HEAD(ringp)  ((ringp)->kernrp)
 
 /* 
- * The hardware HEAD and TAIL are defined in the hardware dependent 
- * header files 
+ * The macroses for accessing to the hardware HEAD and TAIL are defined in the
+ * hardware dependent header files 
  */
 
 #define RING_MODULO(a,b)								\
@@ -324,7 +334,7 @@
 	((SW_TAIL(ringp) == SW_HEAD(ringp)) ? SLOTS_NUMBER : 	\
 	R_DISTANCE(SW_TAIL(ringp), SW_HEAD(ringp)))
 
-#define INC_TAIL(ringp)									\
+#define SW_INCR_TAIL(ringp)									\
 	(SW_TAIL(ringp)) = R_MODULO(SW_TAIL(ringp) + 1);
 
 #define RING_IS_EMPTY(ringp)					\
@@ -400,31 +410,42 @@
 
 
 #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", \
-				__func__, 												\
-				i, 														\
-				(unsigned int)(adapter->rx_desc_base[i].status) & 255, 	\
-				adapter->rx_desc_base[i].length,						\
-				__func__, 												\
-				(unsigned int)adapter->rx_buffer_area[i].m_head->m_data,\
-				(unsigned int)adapter->rx_desc_base[i].buffer_addr);
+#define RINGMAP_PRINT_DESC(adapter, 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", 				\
+		__func__, 												\
+		i, 														\
+		(unsigned int)(adapter->rx_desc_base[i].status) & 255, 	\
+		adapter->rx_desc_base[i].length,						\
+		__func__, 												\
+		(unsigned int)adapter->rx_buffer_area[i].m_head->m_data,\
+		(unsigned int)adapter->rx_desc_base[i].buffer_addr);
 
-#define FIVEG_PRINT_SOME_BYTES_FROM_PKT(i)							\
-   printf("[%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", 	\
-		   __func__,	\
-		   adapter->rx_buffer_area[i].m_head->m_data[0],	\
-		   adapter->rx_buffer_area[i].m_head->m_data[1],	\
-		   adapter->rx_buffer_area[i].m_head->m_data[16],	\
-		   adapter->rx_buffer_area[i].m_head->m_data[32],	\
-		   adapter->rx_buffer_area[i].m_head->m_data[59]);	
+#define PRINT_SOME_BYTES_FROM_PKT(adapter, i)								\
+   printf("=+= [%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", 	\
+	   __func__,										\
+	   adapter->rx_buffer_area[i].m_head->m_data[0],	\
+	   adapter->rx_buffer_area[i].m_head->m_data[1],	\
+	   adapter->rx_buffer_area[i].m_head->m_data[16],	\
+	   adapter->rx_buffer_area[i].m_head->m_data[32],	\
+	   adapter->rx_buffer_area[i].m_head->m_data[59]);	
 #else 
-#define FIVEG_PRINT_SOME_BYTES_FROM_PKT(pktp)						\
-   printf("[%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", 	\
-		   __func__,	\
-		   pktp[0],		\
-		   pktp[1],		\
-		   pktp[16],	\
-		   pktp[32],	\
-		   pktp[59]);	
+#define PRINT_SOME_BYTES_FROM_PKT(pktp, i)								\
+   printf("=+= [%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", 	\
+	   __func__,	\
+	   pktp[0],		\
+	   pktp[1],		\
+	   pktp[16],	\
+	   pktp[32],	\
+	   pktp[59]);	
 #endif
+
+#define PRINT_SLOT(ring, i, arg)										\
+	if (((ring) != NULL) && ((arg) != NULL) && ((i) < SLOTS_NUMBER)){ 	\
+		printf("\n=+= =============================\n");				\
+		printf("=+= Kernel slot: %d \n", (ring)->cur_slot_kern);		\
+		printf("=+= Intrr num:  %llu\n", (ring)->slot[(i)].intr_num);	\
+		printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec)));								\
+		printf("=+= Accepted: %d\n", (ring)->slot[(i)].is_ok);			\
+		PRINT_SOME_BYTES_FROM_PKT((arg), (i));							\
+		printf("=+= =============================\n\n");				\
+	}

==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#4 (text+ko) ====


==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#4 (text+ko) ====


==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#5 (text+ko) ====

@@ -68,11 +68,5 @@
 got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet)
 {
 	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");
+	printf("===> [%s] Packet %d \n", __func__, pcnt);
 }


More information about the p4-projects mailing list