Date: Tue, 03 Nov 2009 19:29:25 +0000 From: Tom Judge <tom@tomjudge.com> To: Stanislav Sedov <stas@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198320 - in head/sys: conf dev/bce Message-ID: <4AF08495.5040507@tomjudge.com> In-Reply-To: <200910211247.n9LCl9Ab099426@svn.freebsd.org> References: <200910211247.n9LCl9Ab099426@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Stanislav, Any chance this can be MFC'd to stable/8, stable/7 and releng/8.0? Tom Stanislav Sedov wrote: > Author: stas > Date: Wed Oct 21 12:47:09 2009 > New Revision: 198320 > URL: http://svn.freebsd.org/changeset/base/198320 > > Log: > - Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header > splitting in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not > propagated into if_bce.c anyway. It is disabled by default. > > Approved by: davidch > MFC after: 3 days > > Modified: > head/sys/conf/NOTES > head/sys/conf/options > head/sys/dev/bce/if_bce.c > head/sys/dev/bce/if_bcereg.h > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Wed Oct 21 12:42:25 2009 (r198319) > +++ head/sys/conf/NOTES Wed Oct 21 12:47:09 2009 (r198320) > @@ -1985,6 +1985,12 @@ device lmc > # only works for Tigon II chips, and has no effect for Tigon I chips. > options TI_JUMBO_HDRSPLIT > > +# > +# Use header splitting feature on bce(4) adapters. > +# This may help to reduce the amount of jumbo-sized memory buffers used. > +# > +options BCE_JUMBO_HDRSPLIT > + > # These two options allow manipulating the mbuf cluster size and mbuf size, > # respectively. Be very careful with NIC driver modules when changing > # these from their default values, because that can potentially cause a > > Modified: head/sys/conf/options > ============================================================================== > --- head/sys/conf/options Wed Oct 21 12:42:25 2009 (r198319) > +++ head/sys/conf/options Wed Oct 21 12:47:09 2009 (r198320) > @@ -511,6 +511,7 @@ DRM_DEBUG opt_drm.h > ZERO_COPY_SOCKETS opt_zero.h > TI_PRIVATE_JUMBOS opt_ti.h > TI_JUMBO_HDRSPLIT opt_ti.h > +BCE_JUMBO_HDRSPLIT opt_bce.h > > # XXX Conflict: # of devices vs network protocol (Native ATM). > # This makes "atm.h" unusable. > > Modified: head/sys/dev/bce/if_bce.c > ============================================================================== > --- head/sys/dev/bce/if_bce.c Wed Oct 21 12:42:25 2009 (r198319) > +++ head/sys/dev/bce/if_bce.c Wed Oct 21 12:47:09 2009 (r198320) > @@ -293,12 +293,12 @@ static void bce_dump_enet (str > static void bce_dump_mbuf (struct bce_softc *, struct mbuf *); > static void bce_dump_tx_mbuf_chain (struct bce_softc *, u16, int); > static void bce_dump_rx_mbuf_chain (struct bce_softc *, u16, int); > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > static void bce_dump_pg_mbuf_chain (struct bce_softc *, u16, int); > #endif > static void bce_dump_txbd (struct bce_softc *, int, struct tx_bd *); > static void bce_dump_rxbd (struct bce_softc *, int, struct rx_bd *); > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > static void bce_dump_pgbd (struct bce_softc *, int, struct rx_bd *); > #endif > static void bce_dump_l2fhdr (struct bce_softc *, int, struct l2_fhdr *); > @@ -306,7 +306,7 @@ static void bce_dump_ctx (struct bce_s > static void bce_dump_ftqs (struct bce_softc *); > static void bce_dump_tx_chain (struct bce_softc *, u16, int); > static void bce_dump_rx_chain (struct bce_softc *, u16, int); > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > static void bce_dump_pg_chain (struct bce_softc *, u16, int); > #endif > static void bce_dump_status_block (struct bce_softc *); > @@ -393,7 +393,7 @@ static int bce_init_rx_chain (struct b > static void bce_fill_rx_chain (struct bce_softc *); > static void bce_free_rx_chain (struct bce_softc *); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > static int bce_get_pg_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *); > static int bce_init_pg_chain (struct bce_softc *); > static void bce_fill_pg_chain (struct bce_softc *); > @@ -602,7 +602,7 @@ bce_print_adapter_info(struct bce_softc > /* Firmware version and device features. */ > printf("B/C (%s); Flags (", sc->bce_bc_ver); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > printf("SPLT "); > i++; > #endif > @@ -1066,7 +1066,7 @@ bce_attach(device_t dev) > * This may change later if the MTU size is set to > * something other than 1500. > */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > sc->rx_bd_mbuf_alloc_size = MHLEN; > /* Make sure offset is 16 byte aligned for hardware. */ > sc->rx_bd_mbuf_align_pad = roundup2((MSIZE - MHLEN), 16) - > @@ -2835,7 +2835,7 @@ bce_dma_free(struct bce_softc *sc) > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* Free, unmap and destroy all page buffer descriptor chain pages. */ > for (i = 0; i < PG_PAGES; i++ ) { > if (sc->pg_bd_chain[i] != NULL) { > @@ -2899,7 +2899,7 @@ bce_dma_free(struct bce_softc *sc) > sc->rx_mbuf_tag = NULL; > } > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* Unload and destroy the page mbuf maps. */ > for (i = 0; i < TOTAL_PG_BD; i++) { > if (sc->pg_mbuf_map[i] != NULL) { > @@ -3345,7 +3345,7 @@ bce_dma_alloc(device_t dev) > /* > * Create a DMA tag for RX mbufs. > */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? > MCLBYTES : sc->rx_bd_mbuf_alloc_size); > #else > @@ -3386,7 +3386,7 @@ bce_dma_alloc(device_t dev) > } > } > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* > * Create a DMA tag for the page buffer descriptor chain, > * allocate and clear the memory, and fetch the physical > @@ -4473,7 +4473,7 @@ bce_stop(struct bce_softc *sc) > bce_disable_intr(sc); > > /* Free RX buffers. */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > bce_free_pg_chain(sc); > #endif > bce_free_rx_chain(sc); > @@ -4910,7 +4910,7 @@ bce_get_rx_buf(struct bce_softc *sc, str > goto bce_get_rx_buf_exit); > > /* This is a new mbuf allocation. */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > MGETHDR(m_new, M_DONTWAIT, MT_DATA); > #else > if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) > @@ -4991,7 +4991,7 @@ bce_get_rx_buf_exit: > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Encapsulate an mbuf cluster into the page chain. */ > /* */ > @@ -5100,7 +5100,7 @@ bce_get_pg_buf_exit: > > return(rc); > } > -#endif /* ZERO_COPY_SOCKETS */ > +#endif /* BCE_JUMBO_HDRSPLIT */ > > /****************************************************************************/ > /* Initialize the TX context memory. */ > @@ -5456,7 +5456,7 @@ bce_free_rx_chain(struct bce_softc *sc) > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Allocate memory and initialize the page data structures. */ > /* Assumes that bce_init_rx_chain() has not already been called. */ > @@ -5620,7 +5620,7 @@ bce_free_pg_chain(struct bce_softc *sc) > > DBEXIT(BCE_VERBOSE_RESET | BCE_VERBOSE_RECV | BCE_VERBOSE_UNLOAD); > } > -#endif /* ZERO_COPY_SOCKETS */ > +#endif /* BCE_JUMBO_HDRSPLIT */ > > > /****************************************************************************/ > @@ -5793,7 +5793,7 @@ bce_rx_intr(struct bce_softc *sc) > unsigned int pkt_len; > u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons; > u32 status; > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > unsigned int rem_len; > u16 sw_pg_cons, sw_pg_cons_idx; > #endif > @@ -5809,7 +5809,7 @@ bce_rx_intr(struct bce_softc *sc) > bus_dmamap_sync(sc->rx_bd_chain_tag, > sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTREAD); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* Prepare the page chain pages to be accessed by the host CPU. */ > for (int i = 0; i < PG_PAGES; i++) > bus_dmamap_sync(sc->pg_bd_chain_tag, > @@ -5821,7 +5821,7 @@ bce_rx_intr(struct bce_softc *sc) > > /* Get working copies of the driver's view of the consumer indices. */ > sw_rx_cons = sc->rx_cons; > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > sw_pg_cons = sc->pg_cons; > #endif > > @@ -5882,7 +5882,7 @@ bce_rx_intr(struct bce_softc *sc) > */ > m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* > * Check whether the received frame fits in a single > * mbuf or not (i.e. packet data + FCS <= > @@ -6056,7 +6056,7 @@ bce_rx_int_next_rx: > if (m0) { > /* Make sure we don't lose our place when we release the lock. */ > sc->rx_cons = sw_rx_cons; > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > sc->pg_cons = sw_pg_cons; > #endif > > @@ -6066,7 +6066,7 @@ bce_rx_int_next_rx: > > /* Recover our place. */ > sw_rx_cons = sc->rx_cons; > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > sw_pg_cons = sc->pg_cons; > #endif > } > @@ -6077,7 +6077,7 @@ bce_rx_int_next_rx: > } > > /* No new packets to process. Refill the RX and page chains and exit. */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > sc->pg_cons = sw_pg_cons; > bce_fill_pg_chain(sc); > #endif > @@ -6090,7 +6090,7 @@ bce_rx_int_next_rx: > bus_dmamap_sync(sc->rx_bd_chain_tag, > sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > for (int i = 0; i < PG_PAGES; i++) > bus_dmamap_sync(sc->pg_bd_chain_tag, > sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE); > @@ -6336,7 +6336,7 @@ bce_init_locked(struct bce_softc *sc) > * Calculate and program the hardware Ethernet MTU > * size. Be generous on the receive if we have room. > */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > if (ifp->if_mtu <= (sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size)) > ether_mtu = sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size; > #else > @@ -6368,7 +6368,7 @@ bce_init_locked(struct bce_softc *sc) > /* Program appropriate promiscuous/multicast filtering. */ > bce_set_rx_mode(sc); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n", > __FUNCTION__, sc->pg_bd_mbuf_alloc_size); > > @@ -6881,7 +6881,7 @@ bce_ioctl(struct ifnet *ifp, u_long comm > BCE_LOCK(sc); > ifp->if_mtu = ifr->ifr_mtu; > ifp->if_drv_flags &= ~IFF_DRV_RUNNING; > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* No buffer allocation size changes are necessary. */ > #else > /* Recalculate our buffer allocation sizes. */ > @@ -7584,7 +7584,7 @@ bce_tick(void *xsc) > bce_stats_update(sc); > > /* Top off the receive and page chains. */ > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > bce_fill_pg_chain(sc); > #endif > bce_fill_rx_chain(sc); > @@ -7764,7 +7764,7 @@ bce_sysctl_dump_tx_chain(SYSCTL_HANDLER_ > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Provides a sysctl interface to allow dumping the page chain. */ > /* */ > @@ -8392,7 +8392,7 @@ bce_add_sysctls(struct bce_softc *sc) > (void *)sc, 0, > bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain"); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > SYSCTL_ADD_PROC(ctx, children, OID_AUTO, > "dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW, > (void *)sc, 0, > @@ -8687,7 +8687,7 @@ bce_dump_rx_mbuf_chain(struct bce_softc > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Prints out the mbufs in the mbuf page chain. */ > /* */ > @@ -8811,7 +8811,7 @@ bce_dump_rxbd(struct bce_softc *sc, int > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Prints out a rx_bd structure in the page chain. */ > /* */ > @@ -9298,7 +9298,7 @@ bce_dump_rx_chain(struct bce_softc *sc, > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Prints out the page chain. */ > /* */ > @@ -9779,7 +9779,7 @@ bce_dump_driver_state(struct bce_softc * > "0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n", > val_hi, val_lo); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > val_hi = BCE_ADDR_HI(sc->pg_bd_chain); > val_lo = BCE_ADDR_LO(sc->pg_bd_chain); > BCE_PRINTF( > @@ -9799,7 +9799,7 @@ bce_dump_driver_state(struct bce_softc * > "0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n", > val_hi, val_lo); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr); > val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr); > BCE_PRINTF( > @@ -9852,7 +9852,7 @@ bce_dump_driver_state(struct bce_softc * > BCE_PRINTF(" 0x%08X - (sc->free_rx_bd) free rx_bd's\n", > sc->free_rx_bd); > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_prod) page producer index\n", > sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod)); > > @@ -10358,7 +10358,7 @@ bce_breakpoint(struct bce_softc *sc) > bce_dump_tpat_state(sc, 0); > bce_dump_cp_state(sc, 0); > bce_dump_com_state(sc, 0); > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > bce_dump_pgbd(sc, 0, NULL); > bce_dump_pg_mbuf_chain(sc, 0, USABLE_PG_BD); > bce_dump_pg_chain(sc, 0, USABLE_PG_BD); > > Modified: head/sys/dev/bce/if_bcereg.h > ============================================================================== > --- head/sys/dev/bce/if_bcereg.h Wed Oct 21 12:42:25 2009 (r198319) > +++ head/sys/dev/bce/if_bcereg.h Wed Oct 21 12:47:09 2009 (r198320) > @@ -6216,7 +6216,7 @@ struct l2_fhdr { > #define RX_PAGE(x) (((x) & ~USABLE_RX_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4)) > #define RX_IDX(x) ((x) & USABLE_RX_BD_PER_PAGE) > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* > * To accomodate jumbo frames, the page chain should > * be 4 times larger than the receive chain. > @@ -6238,7 +6238,7 @@ struct l2_fhdr { > #define PG_PAGE(x) (((x) & ~USABLE_PG_BD_PER_PAGE) >> (BCM_PAGE_BITS - 4)) > #define PG_IDX(x) ((x) & USABLE_PG_BD_PER_PAGE) > > -#endif /* ZERO_COPY_SOCKETS */ > +#endif /* BCE_JUMBO_HDRSPLIT */ > > #define CTX_INIT_RETRY_COUNT 10 > > @@ -6517,7 +6517,7 @@ struct bce_softc > u16 tx_cons; > u32 tx_prod_bseq; /* Counts the bytes used. */ > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > u16 pg_prod; > u16 pg_cons; > #endif > @@ -6534,7 +6534,7 @@ struct bce_softc > int rx_bd_mbuf_data_len; > int rx_bd_mbuf_align_pad; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > int pg_bd_mbuf_alloc_size; > #endif > > @@ -6556,7 +6556,7 @@ struct bce_softc > struct rx_bd *rx_bd_chain[RX_PAGES]; > bus_addr_t rx_bd_chain_paddr[RX_PAGES]; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* H/W maintained page buffer descriptor chain structure. */ > bus_dma_tag_t pg_bd_chain_tag; > bus_dmamap_t pg_bd_chain_map[PG_PAGES]; > @@ -6593,7 +6593,7 @@ struct bce_softc > bus_dma_tag_t rx_mbuf_tag; > bus_dma_tag_t tx_mbuf_tag; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > bus_dma_tag_t pg_mbuf_tag; > #endif > > @@ -6605,7 +6605,7 @@ struct bce_softc > bus_dmamap_t rx_mbuf_map[TOTAL_RX_BD]; > struct mbuf *rx_mbuf_ptr[TOTAL_RX_BD]; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /* S/W maintained mbuf page chain structure. */ > bus_dmamap_t pg_mbuf_map[TOTAL_PG_BD]; > struct mbuf *pg_mbuf_ptr[TOTAL_PG_BD]; > @@ -6617,7 +6617,7 @@ struct bce_softc > u16 used_tx_bd; > u16 max_tx_bd; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > u16 free_pg_bd; > u16 max_pg_bd; > #endif > @@ -6705,7 +6705,7 @@ struct bce_softc > int debug_tx_mbuf_alloc; > int debug_rx_mbuf_alloc; > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > int debug_pg_mbuf_alloc; > #endif > > @@ -6722,7 +6722,7 @@ struct bce_softc > u32 rx_low_watermark; /* Lowest number of rx_bd's free. */ > u32 rx_empty_count; /* Number of times the RX chain was empty. */ > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > u32 pg_low_watermark; /* Lowest number of pages free. */ > u32 pg_empty_count; /* Number of times the page chain was empty. */ > #endif > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AF08495.5040507>