diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-06-08 21:15:35 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-06-08 21:15:35 +0000 |
commit | b41ca882a2269461db5edaadbf199748784859db (patch) | |
tree | 06fdb1a9967a14b025573f6f677c38168d4f2f98 | |
parent | a0b9ab372c5391bfeabb1165489306f75642fb8e (diff) |
more cleanup, removed unused code. we don't do LRO/RSS yet, code can
be added later if we ever support it.
-rw-r--r-- | sys/dev/pci/if_ix.c | 109 | ||||
-rw-r--r-- | sys/dev/pci/if_ix.h | 8 | ||||
-rw-r--r-- | sys/dev/pci/ixgbe.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/ixgbe.h | 44 | ||||
-rw-r--r-- | sys/dev/pci/ixgbe_82598.c | 6 |
5 files changed, 36 insertions, 135 deletions
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index bb3ac276737..05ba2f072a5 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.4 2008/06/08 20:58:42 reyk Exp $ */ +/* $OpenBSD: if_ix.c,v 1.5 2008/06/08 21:15:34 reyk Exp $ */ /****************************************************************************** @@ -115,9 +115,6 @@ int ixgbe_encap(struct tx_ring *, struct mbuf *); #if NVLAN > 0 void ixgbe_enable_hw_vlans(struct ix_softc * sc); #endif -#if 0 -int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); -#endif int ixgbe_dma_malloc(struct ix_softc *, bus_size_t, struct ixgbe_dma_alloc *, int); void ixgbe_dma_free(struct ix_softc *, struct ixgbe_dma_alloc *); @@ -1312,8 +1309,8 @@ ixgbe_allocate_pci_resources(struct ix_softc *sc) sc->num_tx_queues = 1; sc->num_rx_queues = 1; +#ifdef notyet /* Now setup MSI or MSI/X */ -#if 0 sc->msix = ixgbe_setup_msix(sc); #endif sc->hw.back = os; @@ -1392,9 +1389,6 @@ ixgbe_setup_interface(struct ix_softc *sc) strlcpy(ifp->if_xname, sc->dev.dv_xname, IFNAMSIZ); ifp->if_baudrate = IF_Gbps(10); -#if 0 - ifp->if_init = ixgbe_init; -#endif ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ixgbe_ioctl; @@ -2013,7 +2007,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) return (offload); } -#if 0 +#ifdef notyet /********************************************************************** * * Setup work for hardware segmentation offload (TSO) on @@ -2258,7 +2252,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i, struct mbuf *nmp) int size = MCLBYTES; struct ixgbe_rx_buf *rxbuf; -#if 0 +#ifdef notyet /* Are we going to Jumbo clusters? */ if (sc->bigbufs) { size = MJUMPAGESIZE; @@ -2415,10 +2409,6 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr) { struct ix_softc *sc = rxr->sc; struct ixgbe_rx_buf *rxbuf; -#if 0 - struct ifnet *ifp = &sc->arpcom.ac_if; - struct lro_ctrl *lro = &rxr->lro; -#endif int j, rsize, s = 0, i; rsize = roundup2(sc->num_rx_desc * @@ -2462,19 +2452,6 @@ ixgbe_setup_receive_ring(struct rx_ring *rxr) 0, rxr->rxdma.dma_map->dm_mapsize, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#if 0 - /* Now set up the LRO interface */ - if (ixgbe_enable_lro) { - int err = tcp_lro_init(lro); - if (err) { - printf("%s: LRO Initialization failed!\n", ifp->if_xname); - goto fail; - } - printf("%s: RX LRO Initialized\n", ifp->if_xname); - lro->ifp = &sc->arpcom.ac_if; - } -#endif - return (0); fail: /* @@ -2655,11 +2632,9 @@ ixgbe_initialize_receive_units(struct ix_softc *sc) rxcsum |= IXGBE_RXCSUM_PCSD; } -#if 0 - if (ifp->if_capenable & IFCAP_RXCSUM) - rxcsum |= IXGBE_RXCSUM_PCSD; +#if defined(IX_CSUM_OFFLOAD) + rxcsum |= IXGBE_RXCSUM_PCSD; #endif - if (!(rxcsum & IXGBE_RXCSUM_PCSD)) rxcsum |= IXGBE_RXCSUM_IPPCSE; @@ -2684,11 +2659,6 @@ ixgbe_free_receive_structures(struct ix_softc *sc) int i; for (i = 0; i < sc->num_rx_queues; i++, rxr++) { -#if 0 - struct lro_ctrl *lro = &rxr->lro; - /* Free LRO memory */ - tcp_lro_free(lro); -#endif ixgbe_free_receive_buffers(rxr); /* Free the ring memory as well */ ixgbe_dma_free(sc, &rxr->rxdma); @@ -2752,10 +2722,6 @@ ixgbe_rxeof(struct rx_ring *rxr, int count) { struct ix_softc *sc = rxr->sc; struct ifnet *ifp = &sc->arpcom.ac_if; -#if 0 - struct lro_ctrl *lro = &rxr->lro; - struct lro_entry *queued; -#endif struct mbuf *mp; int len, i, eop = 0; uint8_t accept_frame = 0; @@ -2876,19 +2842,12 @@ discard: /* Now send up to the stack */ if (m != NULL) { rxr->next_to_check = i; -#ifdef notyet - /* Use LRO if possible */ - if ((!lro->lro_cnt) || (tcp_lro_rx(lro, m, 0))) { -#endif #if NBPFILTER > 0 - if (ifp->if_bpf) - bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); -#endif - ether_input_mbuf(ifp, m); - i = rxr->next_to_check; -#ifdef notyet - } + if (ifp->if_bpf) + bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif + ether_input_mbuf(ifp, m); + i = rxr->next_to_check; } /* Get next descriptor */ cur = &rxr->rx_base[i]; @@ -2899,19 +2858,6 @@ discard: /* Advance the IXGB's Receive Queue "Tail Pointer" */ IXGBE_WRITE_REG(&sc->hw, IXGBE_RDT(rxr->me), rxr->last_cleaned); -#if 0 - /* - ** Flush any outstanding LRO work - ** this may call into the stack and - ** must not hold a driver lock. - */ - while(!SLIST_EMPTY(&lro->lro_active)) { - queued = SLIST_FIRST(&lro->lro_active); - SLIST_REMOVE_HEAD(&lro->lro_active, next); - tcp_lro_flush(lro, queued); - } -#endif - if (!(staterr & IXGBE_RXD_STAT_DD)) return FALSE; @@ -3184,41 +3130,6 @@ ixgbe_print_hw_stats(struct ix_softc * sc) (long long)sc->stats.gptc, sc->tso_tx); } - -/* - * Set flow control using sysctl: - * Flow control values: - * 0 - off - * 1 - rx pause - * 2 - tx pause - * 3 - full - */ -int -ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS) -{ - int error; - struct ix_softc *sc; - - error = sysctl_handle_int(oidp, &ixgbe_flow_control, 0, req); - - if (error) - return (error); - - sc = (struct ix_softc *) arg1; - switch (ixgbe_flow_control) { - case ixgbe_fc_rx_pause: - case ixgbe_fc_tx_pause: - case ixgbe_fc_full: - sc->hw.fc.type = ixgbe_flow_control; - break; - case ixgbe_fc_none: - default: - sc->hw.fc.type = ixgbe_fc_none; - } - - ixgbe_setup_fc(&sc->hw, 0); - return error; -} #endif #ifndef NO_82598_A0_SUPPORT diff --git a/sys/dev/pci/if_ix.h b/sys/dev/pci/if_ix.h index 26b0bc28b87..71d5e683ee2 100644 --- a/sys/dev/pci/if_ix.h +++ b/sys/dev/pci/if_ix.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.h,v 1.2 2008/06/08 20:33:51 reyk Exp $ */ +/* $OpenBSD: if_ix.h,v 1.3 2008/06/08 21:15:34 reyk Exp $ */ /****************************************************************************** @@ -34,8 +34,8 @@ ******************************************************************************/ /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.h,v 1.4 2008/05/16 18:46:30 jfv Exp $*/ -#ifndef _IXGBE_H_ -#define _IXGBE_H_ +#ifndef _IX_H_ +#define _IX_H_ #include <dev/pci/ixgbe.h> @@ -309,4 +309,4 @@ struct ix_softc { struct ixgbe_hw_stats stats; }; -#endif /* _IXGBE_H_ */ +#endif /* _IX_H_ */ diff --git a/sys/dev/pci/ixgbe.c b/sys/dev/pci/ixgbe.c index 3dad1897262..3cb90154ca2 100644 --- a/sys/dev/pci/ixgbe.c +++ b/sys/dev/pci/ixgbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ixgbe.c,v 1.2 2008/06/08 20:33:51 reyk Exp $ */ +/* $OpenBSD: ixgbe.c,v 1.3 2008/06/08 21:15:34 reyk Exp $ */ /****************************************************************************** @@ -1463,7 +1463,7 @@ static int32_t ixgbe_mta_vector(struct ixgbe_hw *hw, uint8_t *mc_addr) break; default: /* Invalid mc_filter_type */ DEBUGOUT("MC filter type param set incorrectly\n"); - ASSERT(0); + panic("ixgbe"); break; } diff --git a/sys/dev/pci/ixgbe.h b/sys/dev/pci/ixgbe.h index c20dc534813..30fc9bd8633 100644 --- a/sys/dev/pci/ixgbe.h +++ b/sys/dev/pci/ixgbe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ixgbe.h,v 1.2 2008/06/08 20:33:51 reyk Exp $ */ +/* $OpenBSD: ixgbe.h,v 1.3 2008/06/08 21:15:34 reyk Exp $ */ /****************************************************************************** @@ -34,8 +34,8 @@ ******************************************************************************/ /*$FreeBSD: src/sys/dev/ixgbe/ixgbe_osdep.h,v 1.4 2008/05/16 18:46:30 jfv Exp $*/ -#ifndef _IXGBE_OS_H_ -#define _IXGBE_OS_H_ +#ifndef _IXGBE_H_ +#define _IXGBE_H_ #include "bpfilter.h" #include "vlan.h" @@ -76,20 +76,13 @@ #include <uvm/uvm_extern.h> +#include <dev/rndvar.h> + #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> - -#include <dev/rndvar.h> - #include <dev/pci/ixgbe_type.h> -#define ASSERT(x) if(!(x)) panic("IXGBE: x") - -/* The happy-fun DELAY macro is defined in /usr/src/sys/i386/include/clock.h */ -#define usec_delay(x) DELAY(x) -#define msec_delay(x) DELAY(1000*(x)) - #define DBG 0 #define MSGOUT(S, A, B) printf(S "\n", A, B) #define DEBUGFUNC(F) DEBUGOUT(F); @@ -108,18 +101,21 @@ #define DEBUGOUT7(S,A,B,C,D,E,F,G) #endif -#define FALSE 0 -#define TRUE 1 +#define FALSE 0 +#define TRUE 1 #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND -typedef struct device device_t; -#define TUNABLE_INT(x...) -#define DRIVER_MODULE(x...) -#define MODULE_DEPEND(x...) +/* Compat glue */ +#define MJUMPAGESIZE MCLBYTES +#define PCIR_BAR(_x) (0x10 + (_x) * 4) +#define roundup2(size, unit) (((size) + (unit) - 1) & ~((unit) - 1)) +#define usec_delay(x) delay(x) +#define msec_delay(x) delay(1000 * (x)) /* This is needed by the shared code */ struct ixgbe_hw; + extern uint16_t ixgbe_read_pci_cfg(struct ixgbe_hw *, uint32_t); #define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg @@ -135,8 +131,8 @@ struct ixgbe_osdep { struct pci_attach_args *os_pa; }; -#define IXGBE_WRITE_FLUSH(a) IXGBE_READ_REG(a, IXGBE_STATUS) - +#define IXGBE_WRITE_FLUSH(a) \ + IXGBE_READ_REG(a, IXGBE_STATUS) #define IXGBE_READ_REG(a, reg) \ bus_space_read_4(((struct ixgbe_osdep *)(a)->back)->os_memt, \ ((struct ixgbe_osdep *)(a)->back)->os_memh, reg) @@ -150,11 +146,6 @@ struct ixgbe_osdep { bus_space_write_4(((struct ixgbe_osdep *)(a)->back)->os_memt, \ ((struct ixgbe_osdep *)(a)->back)->os_memh, (reg + ((offset) << 2)), value) -/* FreeBSD compat glue */ -#define MJUMPAGESIZE MCLBYTES -#define PCIR_BAR(_x) (0x10 + (_x) * 4) -#define roundup2(size, unit) (((size) + (unit) - 1) & ~((unit) - 1)) - int32_t ixgbe_init_ops_generic(struct ixgbe_hw *hw); int32_t ixgbe_init_hw_generic(struct ixgbe_hw *hw); int32_t ixgbe_start_hw_generic(struct ixgbe_hw *hw); @@ -225,5 +216,4 @@ int32_t ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw, uint16_t *firmware_version); int32_t ixgbe_reset_phy_nl(struct ixgbe_hw *hw); - -#endif /* _IXGBE_OS_H_ */ +#endif /* _IXGBE_H_ */ diff --git a/sys/dev/pci/ixgbe_82598.c b/sys/dev/pci/ixgbe_82598.c index 9f1cad43a6e..be8c130a712 100644 --- a/sys/dev/pci/ixgbe_82598.c +++ b/sys/dev/pci/ixgbe_82598.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ixgbe_82598.c,v 1.2 2008/06/08 20:33:51 reyk Exp $ */ +/* $OpenBSD: ixgbe_82598.c,v 1.3 2008/06/08 21:15:34 reyk Exp $ */ /****************************************************************************** @@ -288,7 +288,7 @@ int32_t ixgbe_setup_fc_82598(struct ixgbe_hw *hw, int32_t packetbuf_num) if (packetbuf_num < 0 || packetbuf_num > 7) { DEBUGOUT1("Invalid packet buffer number [%d], expected range is" " 0-7\n", packetbuf_num); - ASSERT(0); + panic("ixgbe"); } frctl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL); @@ -349,7 +349,7 @@ int32_t ixgbe_setup_fc_82598(struct ixgbe_hw *hw, int32_t packetbuf_num) default: /* We should never get here. The value should be 0-3. */ DEBUGOUT("Flow control param set incorrectly\n"); - ASSERT(0); + panic("ixgbe"); break; } |