Date: Thu, 29 Jul 2010 14:28:23 GMT From: Alexandre Fiveg <afiveg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 181556 for review Message-ID: <201007291428.o6TESN0n078446@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181556?ac=10 Change 181556 by afiveg@ringmap-2 on 2010/07/29 14:27:34 The RINGMAP hooks are removed from ixgbe_handle_que() ixgbe_msix_que() to the *_rxeof function. The same will be done for if_lem. The *_rxeof is the best place for interrupt ringmap-code because this function will called always independent of th interrupt-modell (legacy , msi, etc...) Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#25 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#10 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#9 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#39 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#39 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap_kernel.h#9 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#20 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#21 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#15 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/close.c#8 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/ioctl.c#8 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/main.c#10 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/mmap.c#10 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/open.c#10 edit .. //depot/projects/soc2010/ringmap/tests/ringmap/tests.h#8 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#25 (text+ko) ==== @@ -248,7 +248,8 @@ } again: - + + if ( RING_IS_EMPTY(ring) ) { #if (__RINGMAP_DEB) @@ -295,6 +296,7 @@ ring->pkt_counter++; --ws; + PRINT_PKT_BYTES(datap, curr_slot); (*callback)(user, &pkthdr, datap); #if (__RINGMAP_DEB) ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.c#10 (text+ko) ==== @@ -1322,12 +1322,6 @@ struct ifnet *ifp = adapter->ifp; bool more; -#ifdef RINGMAP - struct capt_object *co = NULL; - - adapter->rm->funcs->delayed_isr(que); -#endif - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { more = ixgbe_rxeof(que, adapter->rx_process_limit); @@ -1342,19 +1336,6 @@ #endif IXGBE_TX_UNLOCK(txr); -#ifdef RINGMAP - IXGBE_RX_LOCK(que->rxr); - adapter->rm->funcs->sync_head(que); - IXGBE_RX_UNLOCK(que->rxr); - - /* TODO: don't wake up the all threads, only our thread! */ - SLIST_FOREACH(co, &adapter->rm->object_list, objects) { - if (RING_NOT_EMPTY(co->ring)){ - wakeup(co->ring); - } - } -#endif - if (more) { taskqueue_enqueue(que->tq, &que->que_task); return; @@ -3447,9 +3428,8 @@ **********************************************************************/ #ifndef RINGMAP static -#else +#endif void -#endif ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit) { struct adapter *adapter = rxr->adapter; @@ -3460,11 +3440,11 @@ struct ixgbe_rx_buf *rxbuf; #ifndef RINGMAP struct mbuf *mh, *mp; + int i, nsegs, error, cleaned; #else - struct mbuf *mp; + int i, nsegs, cleaned; #endif - int i, nsegs, error, cleaned; i = rxr->next_to_refresh; cleaned = -1; /* Signify no completions */ @@ -3499,9 +3479,6 @@ if (rxbuf->m_pack == NULL) { mp = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); -#else - mp = rxbuf->m_pack; -#endif if (mp == NULL) goto update; mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; @@ -3516,10 +3493,24 @@ goto update; } 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 + bus_dmamap_load_mbuf_sg(rxr->ptag, + rxbuf->pmap, rxbuf->m_pack, pseg, &nsegs, BUS_DMA_NOWAIT); + + rxr->rx_base[i].read.pkt_addr = + htole64(pseg[0].ds_addr); + + printf("[%s] rxbuf->m_pack [%d] : 0x%X\n", + __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 #ifndef RINGMAP } #endif @@ -3533,9 +3524,9 @@ /* This is the work marker for refresh */ rxr->next_to_refresh = i; } +#ifndef RINGMAP update: -#ifndef RINGMAP if (cleaned != -1) /* If we refreshed some, bump tail */ IXGBE_WRITE_REG(&adapter->hw, IXGBE_RDT(rxr->me), cleaned); @@ -3796,6 +3787,13 @@ rxbuf->pmap, BUS_DMASYNC_PREREAD); /* Update descriptor */ rxr->rx_base[j].read.pkt_addr = htole64(pseg[0].ds_addr); + +//#ifdef RINGMAP +//#if (__RINGMAP_DEB) +// printf("[%s] pkt phys addr [%d] : 0x%llX\n", +// __func__, j, htole64(pseg[0].ds_addr)); +//#endif +//#endif } @@ -4174,6 +4172,11 @@ IXGBE_RX_LOCK(rxr); +#ifdef RINGMAP + struct capt_object *co = NULL; + adapter->rm->funcs->delayed_isr(que); +#endif + for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; u32 rsc, ptype; @@ -4201,6 +4204,20 @@ mh = rbuf->m_head; mp = rbuf->m_pack; +#ifdef RINGMAP + bus_dmamap_sync(rxr->ptag, rbuf->pmap, + BUS_DMASYNC_POSTREAD); + + bus_dmamap_unload(rxr->ptag, rbuf->pmap); + +#if (__RINGMAP_DEB) + printf("[%s] mp = 0x%X\n", __func__, (unsigned int)mp); + printf("[%s] mp->m_data = 0x%X\n", __func__, (unsigned int)mp->m_data); + printf("[%s] pckt phys addr [%d] : 0x%llX\n", + __func__, i, rxr->rx_base[i].read.pkt_addr); + PRINT_PKT_BYTES(mp->m_data, i); +#endif +#endif plen = le16toh(cur->wb.upper.length); ptype = le32toh(cur->wb.lower.lo_dword.data) & IXGBE_RXDADV_PKTTYPE_MASK; @@ -4339,7 +4356,7 @@ sendmp->m_pkthdr.ether_vtag = vtag; sendmp->m_flags |= M_VLANTAG; } - } + } /* Pass the head pointer on */ if (eop == 0) { nbuf->fmp = sendmp; @@ -4393,6 +4410,17 @@ } } +#ifdef RINGMAP + adapter->rm->funcs->sync_head(que); + + /* TODO: Only our co not all */ + SLIST_FOREACH(co, &adapter->rm->object_list, objects) { + if (RING_NOT_EMPTY(co->ring)){ + wakeup(co->ring); + } + } +#endif + /* Refresh any remaining buf structs */ if (processed != 0) { ixgbe_refresh_mbufs(rxr, i); ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ixgbe.h#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_8259.h#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/ixgbe/ringmap_ixgbe.c#9 (text+ko) ==== @@ -4,8 +4,10 @@ #include <sys/conf.h> #include <sys/queue.h> #include <sys/taskqueue.h> +#include <sys/endian.h> #include <machine/bus.h> +#include <machine/atomic.h> #include <net/if.h> #include <net/if_var.h> @@ -109,6 +111,7 @@ struct adapter *adapter = que->adapter; struct capt_object *co = NULL; + RINGMAP_LOCK(adapter->rm); co = get_capt_obj(que); if (co != NULL) { @@ -164,6 +167,7 @@ struct ixgbe_rx_buf *rxbuf; struct ringmap *rm = adapter->rm;; struct capt_object *co = NULL; + char c; RINGMAP_INTR(start); @@ -178,20 +182,34 @@ co = get_capt_obj(que); if (co != NULL) { + co->ring->slot[slot_num].intr_num = co->ring->intr_num; co->ring->slot[slot_num].ts = co->ring->last_ts; co->ring->slot[slot_num].is_ok = 1; rxbuf = &que->rxr->rx_buffers[slot_num]; - bus_dmamap_sync(que->rxr->htag, rxbuf->hmap, - BUS_DMASYNC_POSTREAD); + #if (RINGMAP_INTR_DEB) + rxbuf->m_pack = (struct mbuf *)K_MBUF(co->ring, slot_num); + rxbuf->m_pack->m_data = (void *)K_PACKET(co->ring, slot_num); + que->rxr->rx_base[slot_num].read.pkt_addr = + htole64(vtophys(K_PACKET(co->ring, slot_num))); + printf("---------------------------------------------------- \n"); printf(RINGMAP_PREFIX"[%s] Slot = %d\n", __func__, slot_num); PRINT_SLOT(co->ring, slot_num); PRINT_RING_PTRS(co->ring); + + printf("[%s] rxbuf->m_pack [%d] : 0x%X\n", + __func__, slot_num, (unsigned int)rxbuf->m_pack); + printf("[%s] pckt phys addr [%d] : 0x%llX\n", + __func__, slot_num, + 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#39 (text+ko) ==== @@ -109,6 +109,10 @@ /* set the pointer to ringmap into the adapters structure */ rm->funcs->set_ringmap_to_adapter(dev, rm); +#if (__RINGMAP_DEB) + printf("Page Size: %d \n", PAGE_SIZE); +#endif + RINGMAP_FUNC_DEBUG(end); return (0); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#39 (text+ko) ==== @@ -285,8 +285,8 @@ #define PRINT_PKT_BYTES(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]); + printf("=+= [%s] SOME BYTES FROM PKT: %hhd %hhd %hhd %hhd %hhd %hhd %hhd\n", \ + __func__, pktp[0], pktp[1], pktp[2], pktp[30], pktp[31], pktp[32], pktp[33]); #define PRINT_PACKET_ADDR(ring, i) \ do { \ @@ -298,9 +298,9 @@ #define PRINT_MBUF_ADDR(ring, i) \ do { \ - printf("=+= mbuf.user=0x%X, mbuf.phys=0x%X, mbuf.kern=0x%X\n", \ + printf("=+= mbuf.user=0x%X, mbuf.phys=0x%llX, mbuf.kern=0x%X\n", \ (unsigned int)ring->slot[i].mbuf.user, \ - (unsigned int)ring->slot[i].mbuf.phys, \ + (long long unsigned int)ring->slot[i].mbuf.phys, \ (unsigned int)ring->slot[i].mbuf.kern); \ } while (0); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap_kernel.h#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#20 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#21 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/close.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/ioctl.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/main.c#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/mmap.c#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/open.c#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/ringmap/tests.h#8 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007291428.o6TESN0n078446>