PERFORCE change 181596 for review
Alexandre Fiveg
afiveg at FreeBSD.org
Fri Jul 30 13:04:33 UTC 2010
http://p4web.freebsd.org/@@181596?ac=10
Change 181596 by afiveg at ringmap-2 on 2010/07/30 13:04:11
The coherence problem is not solved. I will start from the begining with ixgbe.
Affected files ...
.. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#27 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#12 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#11 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#10 edit
.. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#11 edit
.. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#41 edit
.. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#41 edit
.. //depot/projects/soc2010/ringmap/current/sys/net/ringmap_kernel.h#11 edit
.. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#22 edit
.. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#23 edit
.. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#17 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/close.c#10 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/ioctl.c#10 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/main.c#12 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/mmap.c#12 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/open.c#12 edit
.. //depot/projects/soc2010/ringmap/tests/ringmap/tests.h#10 edit
Differences ...
==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#27 (text+ko) ====
@@ -247,18 +247,14 @@
return (-2);
}
-again:
-
+ while ( RING_IS_EMPTY(ring) ) {
- if ( RING_IS_EMPTY(ring) ) {
-
#if (__RINGMAP_DEB)
PRINT_RING_PTRS(ring);
RINGMAP_FUNC_DEBUG(Ring is empty. Sleep...);
#endif
/* Sleep and wait for new incoming packets */
ioctl(ringmap_cdev_fd, IOCTL_SLEEP_WAIT);
- goto again;
}
#if (__RINGMAP_DEB)
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#12 (text+ko) ====
@@ -3474,12 +3474,16 @@
}
rxbuf->m_pack = mp;
#endif
- bus_dmamap_sync(rxr->ptag, rxbuf->pmap,
- BUS_DMASYNC_PREREAD);
#ifndef RINGMAP
rxr->rx_base[i].read.pkt_addr =
htole64(pseg[0].ds_addr);
#else
+
+ rxbuf->m_pack->m_pkthdr.len = rxbuf->m_pack->m_len =
+ adapter->rx_mbuf_sz;
+
+ rxbuf->m_pack->m_flags |= M_PKTHDR;
+
bus_dmamap_load_mbuf_sg(rxr->ptag,
rxbuf->pmap, rxbuf->m_pack, pseg, &nsegs, BUS_DMA_NOWAIT);
@@ -3490,7 +3494,13 @@
__func__, i, (unsigned int)rxbuf->m_pack);
printf("[%s] pckt phys addr [%d] : 0x%llX\n",
__func__, i, rxr->rx_base[i].read.pkt_addr);
-#endif
+
+#endif
+
+ bus_dmamap_sync(rxr->ptag, rxbuf->pmap,
+ BUS_DMASYNC_PREREAD);
+
+
#ifndef RINGMAP
}
#endif
@@ -4180,6 +4190,15 @@
mp = rbuf->m_pack;
#ifdef RINGMAP
+ if (pmap_change_attr((vm_offset_t)mp,
+ PAGE_SIZE, PAT_UNCACHEABLE) != 0) {
+ RINGMAP_ERROR(Can not change page attributes);
+ }
+ if (pmap_change_attr((vm_offset_t)mp->m_data,
+ PAGE_SIZE, PAT_UNCACHEABLE) != 0) {
+ RINGMAP_ERROR(Can not change page attributes);
+ }
+
bus_dmamap_sync(rxr->ptag, rbuf->pmap,
BUS_DMASYNC_POSTREAD);
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#11 (text+ko) ====
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#10 (text+ko) ====
==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#11 (text+ko) ====
@@ -167,7 +167,6 @@
struct ixgbe_rx_buf *rxbuf;
struct ringmap *rm = adapter->rm;;
struct capt_object *co = NULL;
- char c;
RINGMAP_INTR(start);
@@ -207,9 +206,6 @@
que->rxr->rx_base[slot_num].read.pkt_addr);
printf("---------------------------------------------------- \n");
#endif
- /* touch the packet buffer */
- c = rxbuf->m_pack->m_data[30];
- rxbuf->m_pack->m_data[30] = rxbuf->m_pack->m_data[30];
}
}
==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#41 (text+ko) ====
@@ -503,10 +503,11 @@
* come the new packets. It means, before we are going to sleep
* it makes a sence to check if we really must do it :)
*/
- if (RING_IS_EMPTY(co->ring)) {
+ while (RING_IS_EMPTY(co->ring)) {
RINGMAP_IOCTL(Sleep and wait for new packets);
- err_sleep = tsleep(co->ring, (PRI_MAX_ITHD) | PCATCH, "ioctl", 0);
+ err_sleep = tsleep(co->ring,
+ (PRI_MAX_ITHD) | PCATCH, "ioctl", 0);
}
break;
==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#41 (text+ko) ====
@@ -1,3 +1,5 @@
+#define RING_SAFTY_MARGIN 2
+
/*
* value for number of descriptors (a.k.a. slots in the ringbuffer)
*/
@@ -213,10 +215,10 @@
(SW_TAIL(ringp)) = R_MODULO(SW_TAIL(ringp) + 1);
#define RING_IS_EMPTY(ringp) \
- ((SW_TAIL_TO_HEAD_DIST(ringp)) == 1)
+ ((SW_TAIL_TO_HEAD_DIST(ringp)) <= RING_SAFTY_MARGIN)
#define RING_NOT_EMPTY(ringp) \
- ((SW_TAIL_TO_HEAD_DIST(ringp)) != 1)
+ ((SW_TAIL_TO_HEAD_DIST(ringp)) > RING_SAFTY_MARGIN)
#define RING_IS_FULL(ringp) \
((SW_HEAD_TO_TAIL_DIST(ringp)) == 0)
@@ -285,7 +287,7 @@
#define PRINT_PKT_BYTES(pktp, i) \
- printf("=+= [%s] SOME BYTES FROM PKT: %hhd %hhd %hhd %hhd %hhd %hhd %hhd\n", \
+ printf("=+= [%s] SOME BYTES FROM PKT: %hhu %hhu %hhu %hhu %hhu %hhu %hhu\n", \
__func__, pktp[0], pktp[1], pktp[2], pktp[30], pktp[31], pktp[32], pktp[33]);
#define PRINT_PACKET_ADDR(ring, i) \
==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap_kernel.h#11 (text+ko) ====
==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#22 (text+ko) ====
==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#23 (text+ko) ====
==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#17 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/close.c#10 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/ioctl.c#10 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/main.c#12 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/mmap.c#12 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/open.c#12 (text+ko) ====
==== //depot/projects/soc2010/ringmap/tests/ringmap/tests.h#10 (text+ko) ====
More information about the p4-projects
mailing list