diff options
-rw-r--r-- | sys/dev/pci/if_em.c | 31 | ||||
-rw-r--r-- | sys/dev/pci/if_em.h | 17 |
2 files changed, 15 insertions, 33 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index c0209abea19..d4f81a3b932 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.64 2005/07/13 20:25:46 brad Exp $ */ +/* $OpenBSD: if_em.c,v 1.65 2005/07/16 17:08:02 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include "bpfilter.h" @@ -216,18 +216,6 @@ struct cfdriver em_cd = { }; /********************************************************************* - * Tunable default values. - *********************************************************************/ - -#define E1000_TICKS_TO_USECS(ticks) ((1024 * (ticks) + 500) / 1000) -#define E1000_USECS_TO_TICKS(usecs) ((1000 * (usecs) + 512) / 1024) - -int em_tx_int_delay_dflt = E1000_TICKS_TO_USECS(EM_TIDV); -int em_rx_int_delay_dflt = E1000_TICKS_TO_USECS(EM_RDTR); -int em_tx_abs_int_delay_dflt = E1000_TICKS_TO_USECS(EM_TADV); -int em_rx_abs_int_delay_dflt = E1000_TICKS_TO_USECS(EM_RADV); - -/********************************************************************* * Device identification routine * * em_probe determines if the driver should be loaded on @@ -282,6 +270,10 @@ em_attach(struct device *parent, struct device *self, void *aux) /* Parameters (to be read from user) */ sc->num_tx_desc = EM_MIN_TXD; sc->num_rx_desc = EM_MIN_RXD; + sc->tx_int_delay = EM_TIDV; + sc->tx_abs_int_delay = EM_TADV; + sc->rx_int_delay = EM_RDTR; + sc->rx_abs_int_delay = EM_RADV; sc->hw.autoneg = DO_AUTO_NEG; sc->hw.wait_autoneg_complete = WAIT_FOR_AUTO_NEG_DEFAULT; sc->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; @@ -327,7 +319,6 @@ em_attach(struct device *parent, struct device *self, void *aux) */ sc->hw.report_tx_early = 1; - if (em_allocate_pci_resources(sc)) { printf("%s: Allocation of PCI resources failed\n", sc->sc_dv.dv_xname); @@ -1916,10 +1907,9 @@ em_initialize_transmit_unit(struct em_softc *sc) } E1000_WRITE_REG(&sc->hw, TIPG, reg_tipg); - E1000_WRITE_REG(&sc->hw, TIDV, sc->tx_int_delay.value); + E1000_WRITE_REG(&sc->hw, TIDV, sc->tx_int_delay); if(sc->hw.mac_type >= em_82540) - E1000_WRITE_REG(&sc->hw, TADV, - sc->tx_abs_int_delay.value); + E1000_WRITE_REG(&sc->hw, TADV, sc->tx_abs_int_delay); /* Program the Transmit Control Register */ reg_tctl = E1000_TCTL_PSP | E1000_TCTL_EN | @@ -1936,7 +1926,7 @@ em_initialize_transmit_unit(struct em_softc *sc) /* Setup Transmit Descriptor Settings for this adapter */ sc->txd_cmd = E1000_TXD_CMD_IFCS | E1000_TXD_CMD_RS; - if (sc->tx_int_delay.value > 0) + if (sc->tx_int_delay > 0) sc->txd_cmd |= E1000_TXD_CMD_IDE; return; @@ -2293,11 +2283,10 @@ em_initialize_receive_unit(struct em_softc *sc) /* Set the Receive Delay Timer Register */ E1000_WRITE_REG(&sc->hw, RDTR, - sc->rx_int_delay.value | E1000_RDT_FPDB); + sc->rx_int_delay | E1000_RDT_FPDB); if(sc->hw.mac_type >= em_82540) { - E1000_WRITE_REG(&sc->hw, RADV, - sc->rx_abs_int_delay.value); + E1000_WRITE_REG(&sc->hw, RADV, sc->rx_abs_int_delay); /* Set the interrupt throttling rate. Value is calculated * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) */ diff --git a/sys/dev/pci/if_em.h b/sys/dev/pci/if_em.h index a488becd186..72a22948613 100644 --- a/sys/dev/pci/if_em.h +++ b/sys/dev/pci/if_em.h @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /* $FreeBSD: if_em.h,v 1.26 2004/09/01 23:22:41 pdeuskar Exp $ */ -/* $OpenBSD: if_em.h,v 1.12 2005/07/02 06:15:44 deraadt Exp $ */ +/* $OpenBSD: if_em.h,v 1.13 2005/07/16 17:08:02 brad Exp $ */ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -247,13 +247,6 @@ typedef enum _XSUM_CONTEXT_T { OFFLOAD_UDP_IP } XSUM_CONTEXT_T; -struct em_softc; -struct em_int_delay_info { - struct em_softc *sc; /* Back-pointer to the sc struct */ - int offset; /* Register offset to read/write */ - int value; /* Current value in usecs */ -}; - /* For 82544 PCIX Workaround */ typedef struct _ADDRESS_LENGTH_PAIR { @@ -298,10 +291,10 @@ struct em_softc { u_int16_t link_speed; u_int16_t link_duplex; u_int32_t smartspeed; - struct em_int_delay_info tx_int_delay; - struct em_int_delay_info tx_abs_int_delay; - struct em_int_delay_info rx_int_delay; - struct em_int_delay_info rx_abs_int_delay; + u_int32_t tx_int_delay; + u_int32_t tx_abs_int_delay; + u_int32_t rx_int_delay; + u_int32_t rx_abs_int_delay; XSUM_CONTEXT_T active_checksum_context; |