if_igb_netmap.h (228881) | if_igb_netmap.h (229939) |
---|---|
1/* 2 * Copyright (C) 2011 Universita` di Pisa. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26/* | 1/* 2 * Copyright (C) 2011 Universita` di Pisa. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26/* |
27 * $FreeBSD: head/sys/dev/netmap/if_igb_netmap.h 228881 2011-12-25 21:00:56Z luigi $ | 27 * $FreeBSD: head/sys/dev/netmap/if_igb_netmap.h 229939 2012-01-10 19:57:23Z luigi $ |
28 * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ 29 * 30 * netmap modifications for igb 31 * contribured by Ahmed Kooli 32 */ 33 34#include <net/netmap.h> 35#include <sys/selinfo.h> --- 140 unchanged lines hidden (view full) --- 176 if (adapter->hw.mac.type == e1000_82575) 177 olinfo_status |= txr->me << 4; 178 179 while (j != k) { 180 struct netmap_slot *slot = &ring->slot[j]; 181 struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; 182 union e1000_adv_tx_desc *curr = 183 (union e1000_adv_tx_desc *)&txr->tx_base[l]; | 28 * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ 29 * 30 * netmap modifications for igb 31 * contribured by Ahmed Kooli 32 */ 33 34#include <net/netmap.h> 35#include <sys/selinfo.h> --- 140 unchanged lines hidden (view full) --- 176 if (adapter->hw.mac.type == e1000_82575) 177 olinfo_status |= txr->me << 4; 178 179 while (j != k) { 180 struct netmap_slot *slot = &ring->slot[j]; 181 struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; 182 union e1000_adv_tx_desc *curr = 183 (union e1000_adv_tx_desc *)&txr->tx_base[l]; |
184 void *addr = NMB(slot); | 184 uint64_t paddr; 185 void *addr = PNMB(slot, &paddr); |
185 int flags = ((slot->flags & NS_REPORT) || 186 j == 0 || j == report_frequency) ? 187 E1000_ADVTXD_DCMD_RS : 0; 188 int len = slot->len; 189 190 if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { 191 if (do_lock) 192 IGB_TX_UNLOCK(txr); 193 return netmap_ring_reinit(kring); 194 } 195 196 slot->flags &= ~NS_REPORT; 197 // XXX do we need to set the address ? | 186 int flags = ((slot->flags & NS_REPORT) || 187 j == 0 || j == report_frequency) ? 188 E1000_ADVTXD_DCMD_RS : 0; 189 int len = slot->len; 190 191 if (addr == netmap_buffer_base || len > NETMAP_BUF_SIZE) { 192 if (do_lock) 193 IGB_TX_UNLOCK(txr); 194 return netmap_ring_reinit(kring); 195 } 196 197 slot->flags &= ~NS_REPORT; 198 // XXX do we need to set the address ? |
198 curr->read.buffer_addr = htole64(vtophys(addr)); | 199 curr->read.buffer_addr = htole64(paddr); |
199 curr->read.olinfo_status = 200 htole32(olinfo_status | 201 (len<< E1000_ADVTXD_PAYLEN_SHIFT)); 202 curr->read.cmd_type_len = 203 htole32(len | E1000_ADVTXD_DTYP_DATA | 204 E1000_ADVTXD_DCMD_IFCS | 205 E1000_ADVTXD_DCMD_DEXT | 206 E1000_ADVTXD_DCMD_EOP | flags); 207 if (slot->flags & NS_BUF_CHANGED) { 208 /* buffer has changed, reload map */ | 200 curr->read.olinfo_status = 201 htole32(olinfo_status | 202 (len<< E1000_ADVTXD_PAYLEN_SHIFT)); 203 curr->read.cmd_type_len = 204 htole32(len | E1000_ADVTXD_DTYP_DATA | 205 E1000_ADVTXD_DCMD_IFCS | 206 E1000_ADVTXD_DCMD_DEXT | 207 E1000_ADVTXD_DCMD_EOP | flags); 208 if (slot->flags & NS_BUF_CHANGED) { 209 /* buffer has changed, reload map */ |
209 netmap_reload_map(txr->txtag, txbuf->map, 210 addr, na->buff_size); | 210 netmap_reload_map(txr->txtag, txbuf->map, addr); |
211 slot->flags &= ~NS_BUF_CHANGED; 212 } 213 214 bus_dmamap_sync(txr->txtag, txbuf->map, 215 BUS_DMASYNC_PREWRITE); 216 j = (j == lim) ? 0 : j + 1; 217 l = (l == lim) ? 0 : l + 1; 218 n++; --- 93 unchanged lines hidden (view full) --- 312 if (l < 0) 313 l += lim + 1; 314 if (j != k) { /* userspace has read some packets. */ 315 n = 0; 316 while (j != k) { 317 struct netmap_slot *slot = ring->slot + j; 318 union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; 319 struct igb_rx_buf *rxbuf = rxr->rx_buffers + l; | 211 slot->flags &= ~NS_BUF_CHANGED; 212 } 213 214 bus_dmamap_sync(txr->txtag, txbuf->map, 215 BUS_DMASYNC_PREWRITE); 216 j = (j == lim) ? 0 : j + 1; 217 l = (l == lim) ? 0 : l + 1; 218 n++; --- 93 unchanged lines hidden (view full) --- 312 if (l < 0) 313 l += lim + 1; 314 if (j != k) { /* userspace has read some packets. */ 315 n = 0; 316 while (j != k) { 317 struct netmap_slot *slot = ring->slot + j; 318 union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; 319 struct igb_rx_buf *rxbuf = rxr->rx_buffers + l; |
320 void *addr = NMB(slot); | 320 uint64_t paddr; 321 void *addr = PNMB(slot, &paddr); |
321 322 if (addr == netmap_buffer_base) { /* bad buf */ 323 if (do_lock) 324 IGB_RX_UNLOCK(rxr); 325 return netmap_ring_reinit(kring); 326 } 327 328 curr->wb.upper.status_error = 0; | 322 323 if (addr == netmap_buffer_base) { /* bad buf */ 324 if (do_lock) 325 IGB_RX_UNLOCK(rxr); 326 return netmap_ring_reinit(kring); 327 } 328 329 curr->wb.upper.status_error = 0; |
329 curr->read.pkt_addr = htole64(vtophys(addr)); | 330 curr->read.pkt_addr = htole64(paddr); |
330 if (slot->flags & NS_BUF_CHANGED) { | 331 if (slot->flags & NS_BUF_CHANGED) { |
331 netmap_reload_map(rxr->ptag, rxbuf->pmap, 332 addr, na->buff_size); | 332 netmap_reload_map(rxr->ptag, rxbuf->pmap, addr); |
333 slot->flags &= ~NS_BUF_CHANGED; 334 } 335 336 bus_dmamap_sync(rxr->ptag, rxbuf->pmap, 337 BUS_DMASYNC_PREREAD); 338 339 j = (j == lim) ? 0 : j + 1; 340 l = (l == lim) ? 0 : l + 1; --- 18 unchanged lines hidden --- | 333 slot->flags &= ~NS_BUF_CHANGED; 334 } 335 336 bus_dmamap_sync(rxr->ptag, rxbuf->pmap, 337 BUS_DMASYNC_PREREAD); 338 339 j = (j == lim) ? 0 : j + 1; 340 l = (l == lim) ? 0 : l + 1; --- 18 unchanged lines hidden --- |