Date: Mon, 30 Nov 2009 11:29:50 -0800 From: Maxim Sobolev <sobomax@FreeBSD.org> To: Stanislav Sedov <stas@FreeBSD.org> Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-7@FreeBSD.org Subject: Re: svn: stable/7/sys: conf dev/bce Message-ID: <4B141D2E.1000203@FreeBSD.org> In-Reply-To: <200911151143.nAFBhTSD036619@svn.freebsd.org> References: <200911151143.nAFBhTSD036619@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Is the option related to Jumbo Frames in any way? If not, IMHO the name should be changed to avoid any confusion. -Maxim Stanislav Sedov wrote: > Author: stas > Date: Sun Nov 15 11:43:28 2009 > New Revision: 199289 > URL: http://svn.freebsd.org/changeset/base/199289 > > Log: > - MFC r198320: > Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header > in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not > into if_bce.c anyway. It is disabled by default. > > PR: If a GNATS PR is affected by the change. > > Submitted by: If someone else sent in the change. > > Reviewed by: If someone else reviewed your modification. > > Approved by: If you needed approval for this commit. > > Obtained from: If the change is from a third party. > > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > > Security: Vulnerability reference (one per line) or description. > > Empty fields above will be automatically removed. > > _M 7/sys > M 7/sys/conf/NOTES > M 7/sys/conf/options > M 7/sys/dev/bce/if_bce.c > M 7/sys/dev/bce/if_bcereg.h > _M 7/sys/contrib/pf > > Modified: > stable/7/sys/conf/NOTES > stable/7/sys/conf/options > stable/7/sys/dev/bce/if_bce.c > stable/7/sys/dev/bce/if_bcereg.h > Directory Properties: > stable/7/sys/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > > Modified: stable/7/sys/conf/NOTES > ============================================================================== > --- stable/7/sys/conf/NOTES Sun Nov 15 11:30:59 2009 (r199288) > +++ stable/7/sys/conf/NOTES Sun Nov 15 11:43:28 2009 (r199289) > @@ -1929,6 +1929,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: stable/7/sys/conf/options > ============================================================================== > --- stable/7/sys/conf/options Sun Nov 15 11:30:59 2009 (r199288) > +++ stable/7/sys/conf/options Sun Nov 15 11:43:28 2009 (r199289) > @@ -493,6 +493,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: stable/7/sys/dev/bce/if_bce.c > ============================================================================== > --- stable/7/sys/dev/bce/if_bce.c Sun Nov 15 11:30:59 2009 (r199288) > +++ stable/7/sys/dev/bce/if_bce.c Sun Nov 15 11:43:28 2009 (r199289) > @@ -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 *); > @@ -391,7 +391,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 *); > @@ -597,7 +597,7 @@ bce_print_adapter_info(struct bce_softc > > /* Firmware version and device features. */ > printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver); > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > printf("SPLT "); > #endif > if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) > @@ -1013,7 +1013,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) - > @@ -2753,7 +2753,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) { > @@ -2817,7 +2817,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) { > @@ -3263,7 +3263,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 > @@ -3304,7 +3304,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 > @@ -4393,7 +4393,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); > @@ -4831,7 +4831,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) > @@ -4912,7 +4912,7 @@ bce_get_rx_buf_exit: > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Encapsulate an mbuf cluster into the page chain. */ > /* */ > @@ -5021,7 +5021,7 @@ bce_get_pg_buf_exit: > > return(rc); > } > -#endif /* ZERO_COPY_SOCKETS */ > +#endif /* BCE_JUMBO_HDRSPLIT */ > > /****************************************************************************/ > /* Initialize the TX context memory. */ > @@ -5377,7 +5377,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. */ > @@ -5541,7 +5541,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 */ > > > /****************************************************************************/ > @@ -5714,7 +5714,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 > @@ -5730,7 +5730,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, > @@ -5742,7 +5742,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 > > @@ -5803,7 +5803,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 <= > @@ -5977,7 +5977,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 > > @@ -5987,7 +5987,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 > } > @@ -5998,7 +5998,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 > @@ -6011,7 +6011,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); > @@ -6257,7 +6257,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 > @@ -6289,7 +6289,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); > > @@ -6802,7 +6802,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. */ > @@ -7505,7 +7505,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); > @@ -7685,7 +7685,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. */ > /* */ > @@ -8313,7 +8313,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, > @@ -8608,7 +8608,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. */ > /* */ > @@ -8732,7 +8732,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. */ > /* */ > @@ -9219,7 +9219,7 @@ bce_dump_rx_chain(struct bce_softc *sc, > } > > > -#ifdef ZERO_COPY_SOCKETS > +#ifdef BCE_JUMBO_HDRSPLIT > /****************************************************************************/ > /* Prints out the page chain. */ > /* */ > @@ -9700,7 +9700,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( > @@ -9720,7 +9720,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( > @@ -9773,7 +9773,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)); > > @@ -10279,7 +10279,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: stable/7/sys/dev/bce/if_bcereg.h > ============================================================================== > --- stable/7/sys/dev/bce/if_bcereg.h Sun Nov 15 11:30:59 2009 (r199288) > +++ stable/7/sys/dev/bce/if_bcereg.h Sun Nov 15 11:43:28 2009 (r199289) > @@ -6205,7 +6205,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. > @@ -6227,7 +6227,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 > > @@ -6505,7 +6505,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 > @@ -6522,7 +6522,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 > > @@ -6544,7 +6544,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]; > @@ -6581,7 +6581,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 > > @@ -6593,7 +6593,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]; > @@ -6605,7 +6605,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 > @@ -6693,7 +6693,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 > > @@ -6710,7 +6710,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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B141D2E.1000203>