remove conditional code for an obsolete feature. if_ptnet now does better.
This commit is contained in:
parent
e29e5601c8
commit
0cf1b34fe2
@ -39,7 +39,6 @@
|
||||
*/
|
||||
// #define BATCH_DISPATCH
|
||||
// #define NIC_SEND_COMBINING
|
||||
// #define NIC_PARAVIRT /* enable virtio-like synchronization */
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
@ -486,10 +485,6 @@ lem_attach(device_t dev)
|
||||
lem_add_rx_process_limit(adapter, "batch_enable",
|
||||
"driver rx batch", &adapter->batch_enable, 0);
|
||||
#endif /* BATCH_DISPATCH */
|
||||
#ifdef NIC_PARAVIRT
|
||||
lem_add_rx_process_limit(adapter, "rx_retries",
|
||||
"driver rx retries", &adapter->rx_retries, 0);
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
/* Sysctl for setting the interface flow control */
|
||||
lem_set_flow_cntrl(adapter, "flow_control",
|
||||
@ -548,49 +543,6 @@ lem_attach(device_t dev)
|
||||
*/
|
||||
adapter->hw.mac.report_tx_early = 1;
|
||||
|
||||
#ifdef NIC_PARAVIRT
|
||||
device_printf(dev, "driver supports paravirt, subdev 0x%x\n",
|
||||
adapter->hw.subsystem_device_id);
|
||||
if (adapter->hw.subsystem_device_id == E1000_PARA_SUBDEV) {
|
||||
uint64_t bus_addr;
|
||||
|
||||
device_printf(dev, "paravirt support on dev %p\n", adapter);
|
||||
tsize = 4096; // XXX one page for the csb
|
||||
if (lem_dma_malloc(adapter, tsize, &adapter->csb_mem, BUS_DMA_NOWAIT)) {
|
||||
device_printf(dev, "Unable to allocate csb memory\n");
|
||||
error = ENOMEM;
|
||||
goto err_csb;
|
||||
}
|
||||
/* Setup the Base of the CSB */
|
||||
adapter->csb = (struct paravirt_csb *)adapter->csb_mem.dma_vaddr;
|
||||
/* force the first kick */
|
||||
adapter->csb->host_need_txkick = 1; /* txring empty */
|
||||
adapter->csb->guest_need_rxkick = 1; /* no rx packets */
|
||||
bus_addr = adapter->csb_mem.dma_paddr;
|
||||
lem_add_rx_process_limit(adapter, "csb_on",
|
||||
"enable paravirt.", &adapter->csb->guest_csb_on, 0);
|
||||
lem_add_rx_process_limit(adapter, "txc_lim",
|
||||
"txc_lim", &adapter->csb->host_txcycles_lim, 1);
|
||||
|
||||
/* some stats */
|
||||
#define PA_SC(name, var, val) \
|
||||
lem_add_rx_process_limit(adapter, name, name, var, val)
|
||||
PA_SC("host_need_txkick",&adapter->csb->host_need_txkick, 1);
|
||||
PA_SC("host_rxkick_at",&adapter->csb->host_rxkick_at, ~0);
|
||||
PA_SC("guest_need_txkick",&adapter->csb->guest_need_txkick, 0);
|
||||
PA_SC("guest_need_rxkick",&adapter->csb->guest_need_rxkick, 1);
|
||||
PA_SC("tdt_reg_count",&adapter->tdt_reg_count, 0);
|
||||
PA_SC("tdt_csb_count",&adapter->tdt_csb_count, 0);
|
||||
PA_SC("tdt_int_count",&adapter->tdt_int_count, 0);
|
||||
PA_SC("guest_need_kick_count",&adapter->guest_need_kick_count, 0);
|
||||
/* tell the host where the block is */
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_CSBAH,
|
||||
(u32)(bus_addr >> 32));
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_CSBAL,
|
||||
(u32)bus_addr);
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
tsize = roundup2(adapter->num_tx_desc * sizeof(struct e1000_tx_desc),
|
||||
EM_DBA_ALIGN);
|
||||
|
||||
@ -749,11 +701,6 @@ err_hw_init:
|
||||
err_rx_desc:
|
||||
lem_dma_free(adapter, &adapter->txdma);
|
||||
err_tx_desc:
|
||||
#ifdef NIC_PARAVIRT
|
||||
lem_dma_free(adapter, &adapter->csb_mem);
|
||||
err_csb:
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
err_pci:
|
||||
if (adapter->ifp != (void *)NULL)
|
||||
if_free(adapter->ifp);
|
||||
@ -841,12 +788,6 @@ lem_detach(device_t dev)
|
||||
adapter->rx_desc_base = NULL;
|
||||
}
|
||||
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (adapter->csb) {
|
||||
lem_dma_free(adapter, &adapter->csb_mem);
|
||||
adapter->csb = NULL;
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
lem_release_hw_control(adapter);
|
||||
free(adapter->mta, M_DEVBUF);
|
||||
EM_TX_LOCK_DESTROY(adapter);
|
||||
@ -956,16 +897,6 @@ lem_start_locked(if_t ifp)
|
||||
}
|
||||
if (adapter->num_tx_desc_avail <= EM_TX_OP_THRESHOLD)
|
||||
if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0);
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE && adapter->csb &&
|
||||
adapter->csb->guest_csb_on &&
|
||||
!(adapter->csb->guest_need_txkick & 1)) {
|
||||
adapter->csb->guest_need_txkick = 1;
|
||||
adapter->guest_need_kick_count++;
|
||||
// XXX memory barrier
|
||||
lem_txeof(adapter); // XXX possibly clear IFF_DRV_OACTIVE
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1813,24 +1744,6 @@ lem_xmit(struct adapter *adapter, struct mbuf **m_headp)
|
||||
bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map,
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (adapter->csb) {
|
||||
adapter->csb->guest_tdt = i;
|
||||
/* XXX memory barrier ? */
|
||||
if (adapter->csb->guest_csb_on &&
|
||||
!(adapter->csb->host_need_txkick & 1)) {
|
||||
/* XXX maybe useless
|
||||
* clean the ring. maybe do it before ?
|
||||
* maybe a little bit of histeresys ?
|
||||
*/
|
||||
if (adapter->num_tx_desc_avail <= 64) {// XXX
|
||||
lem_txeof(adapter);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
#ifdef NIC_SEND_COMBINING
|
||||
if (adapter->sc_enable) {
|
||||
if (adapter->shadow_tdt & MIT_PENDING_INT) {
|
||||
@ -2086,20 +1999,6 @@ lem_local_timer(void *arg)
|
||||
|
||||
lem_smartspeed(adapter);
|
||||
|
||||
#ifdef NIC_PARAVIRT
|
||||
/* recover space if needed */
|
||||
if (adapter->csb && adapter->csb->guest_csb_on &&
|
||||
(adapter->watchdog_check == TRUE) &&
|
||||
(ticks - adapter->watchdog_time > EM_WATCHDOG) &&
|
||||
(adapter->num_tx_desc_avail != adapter->num_tx_desc) ) {
|
||||
lem_txeof(adapter);
|
||||
/*
|
||||
* lem_txeof() normally (except when space in the queue
|
||||
* runs low XXX) cleans watchdog_check so that
|
||||
* we do not hung.
|
||||
*/
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
/*
|
||||
* We check the watchdog: the time since
|
||||
* the last TX descriptor was cleaned.
|
||||
@ -3176,12 +3075,6 @@ lem_txeof(struct adapter *adapter)
|
||||
*/
|
||||
if (adapter->num_tx_desc_avail > EM_TX_CLEANUP_THRESHOLD) {
|
||||
if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (adapter->csb) { // XXX also csb_on ?
|
||||
adapter->csb->guest_need_txkick = 2; /* acked */
|
||||
// XXX memory barrier
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
if (adapter->num_tx_desc_avail == adapter->num_tx_desc) {
|
||||
adapter->watchdog_check = FALSE;
|
||||
return;
|
||||
@ -3570,15 +3463,6 @@ lem_rxeof(struct adapter *adapter, int count, int *done)
|
||||
#ifdef BATCH_DISPATCH
|
||||
struct mbuf *mh = NULL, *mt = NULL;
|
||||
#endif /* BATCH_DISPATCH */
|
||||
#ifdef NIC_PARAVIRT
|
||||
int retries = 0;
|
||||
struct paravirt_csb* csb = adapter->csb;
|
||||
int csb_mode = csb && csb->guest_csb_on;
|
||||
|
||||
//ND("clear guest_rxkick at %d", adapter->next_rx_desc_to_check);
|
||||
if (csb_mode && csb->guest_need_rxkick)
|
||||
csb->guest_need_rxkick = 0;
|
||||
#endif /* NIC_PARAVIRT */
|
||||
EM_RX_LOCK(adapter);
|
||||
|
||||
#ifdef BATCH_DISPATCH
|
||||
@ -3596,45 +3480,20 @@ lem_rxeof(struct adapter *adapter, int count, int *done)
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
#if 1 // XXX optimization ?
|
||||
if (!((current_desc->status) & E1000_RXD_STAT_DD)) {
|
||||
if (done != NULL)
|
||||
*done = rx_sent;
|
||||
EM_RX_UNLOCK(adapter);
|
||||
return (FALSE);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
while (count != 0 && if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
|
||||
struct mbuf *m = NULL;
|
||||
|
||||
status = current_desc->status;
|
||||
if ((status & E1000_RXD_STAT_DD) == 0) {
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (csb_mode) {
|
||||
/* buffer not ready yet. Retry a few times before giving up */
|
||||
if (++retries <= adapter->rx_retries) {
|
||||
continue;
|
||||
}
|
||||
if (csb->guest_need_rxkick == 0) {
|
||||
// ND("set guest_rxkick at %d", adapter->next_rx_desc_to_check);
|
||||
csb->guest_need_rxkick = 1;
|
||||
// XXX memory barrier, status volatile ?
|
||||
continue; /* double check */
|
||||
}
|
||||
}
|
||||
/* no buffer ready, give up */
|
||||
#endif /* NIC_PARAVIRT */
|
||||
break;
|
||||
}
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (csb_mode) {
|
||||
if (csb->guest_need_rxkick)
|
||||
// ND("clear again guest_rxkick at %d", adapter->next_rx_desc_to_check);
|
||||
csb->guest_need_rxkick = 0;
|
||||
retries = 0;
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
|
||||
mp = adapter->rx_buffer_area[i].m_head;
|
||||
/*
|
||||
@ -3759,18 +3618,6 @@ discard:
|
||||
bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map,
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (csb_mode) {
|
||||
/* the buffer at i has been already replaced by lem_get_buf()
|
||||
* so it is safe to set guest_rdt = i and possibly send a kick.
|
||||
* XXX see if we can optimize it later.
|
||||
*/
|
||||
csb->guest_rdt = i;
|
||||
// XXX memory barrier
|
||||
if (i == csb->host_rxkick_at)
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i);
|
||||
}
|
||||
#endif /* NIC_PARAVIRT */
|
||||
/* Advance our pointers to the next descriptor. */
|
||||
if (++i == adapter->num_rx_desc)
|
||||
i = 0;
|
||||
@ -3817,9 +3664,6 @@ discard:
|
||||
/* Advance the E1000's Receive Queue #0 "Tail Pointer". */
|
||||
if (--i < 0)
|
||||
i = adapter->num_rx_desc - 1;
|
||||
#ifdef NIC_PARAVIRT
|
||||
if (!csb_mode) /* filter out writes */
|
||||
#endif /* NIC_PARAVIRT */
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i);
|
||||
if (done != NULL)
|
||||
*done = rx_sent;
|
||||
|
Loading…
x
Reference in New Issue
Block a user