mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
- Fixed kern/123696 by increasing firmware timeout value from 100 to 1000.
- Fixed a problem on i386 architecture when using split header/jumbo frame firmware caused by hardware alignment requirements. - Added #define BCE_USE_SPLIT_HEADER to allow the feature to be enabled/ disabled. Enabled by default. PR: kern/123696 MFC after: 2 weeks
This commit is contained in:
parent
5bbaa5cf02
commit
680ece5918
2 changed files with 193 additions and 54 deletions
|
|
@ -82,6 +82,11 @@ __FBSDID("$FreeBSD$");
|
|||
int bce_debug_bootcode_running_failure = 0;
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* BCE Build Time Options */
|
||||
/****************************************************************************/
|
||||
#define BCE_USE_SPLIT_HEADER 1
|
||||
/* #define BCE_NVRAM_WRITE_SUPPORT 1 */
|
||||
|
||||
/****************************************************************************/
|
||||
/* PCI Device ID Table */
|
||||
|
|
@ -224,16 +229,22 @@ static u32 bce_ctx_rd (struct bce_softc *, u32, u32);
|
|||
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);
|
||||
static void bce_dump_pg_mbuf_chain (struct bce_softc *, u16, int);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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 *);
|
||||
static void bce_dump_pgbd (struct bce_softc *, int, struct rx_bd *);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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 *);
|
||||
static void bce_dump_ctx (struct bce_softc *, u16);
|
||||
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);
|
||||
static void bce_dump_pg_chain (struct bce_softc *, u16, int);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
static void bce_dump_pg_chain (struct bce_softc *, u16, int);
|
||||
#endif
|
||||
static void bce_dump_status_block (struct bce_softc *);
|
||||
static void bce_dump_stats_block (struct bce_softc *);
|
||||
static void bce_dump_driver_state (struct bce_softc *);
|
||||
|
|
@ -294,7 +305,9 @@ static int bce_reset (struct bce_softc *, u32);
|
|||
static int bce_chipinit (struct bce_softc *);
|
||||
static int bce_blockinit (struct bce_softc *);
|
||||
static int bce_get_rx_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *, u32 *);
|
||||
static int bce_get_pg_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
static int bce_get_pg_buf (struct bce_softc *, struct mbuf *, u16 *, u16 *);
|
||||
#endif
|
||||
|
||||
static int bce_init_tx_chain (struct bce_softc *);
|
||||
static void bce_free_tx_chain (struct bce_softc *);
|
||||
|
|
@ -302,10 +315,12 @@ static void bce_free_tx_chain (struct bce_softc *);
|
|||
static int bce_init_rx_chain (struct bce_softc *);
|
||||
static void bce_fill_rx_chain (struct bce_softc *);
|
||||
static void bce_free_rx_chain (struct bce_softc *);
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
static int bce_init_pg_chain (struct bce_softc *);
|
||||
static void bce_fill_pg_chain (struct bce_softc *);
|
||||
static void bce_free_pg_chain (struct bce_softc *);
|
||||
static void bce_free_pg_chain (struct bce_softc *);
|
||||
#endif
|
||||
|
||||
static int bce_tx_encap (struct bce_softc *, struct mbuf **);
|
||||
static void bce_start_locked (struct ifnet *);
|
||||
|
|
@ -778,10 +793,18 @@ bce_attach(device_t dev)
|
|||
/* Use standard mbuf sizes for buffer allocation. */
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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) -
|
||||
(MSIZE - MHLEN);
|
||||
sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size -
|
||||
sc->rx_bd_mbuf_align_pad;
|
||||
sc->pg_bd_mbuf_alloc_size = MCLBYTES;
|
||||
#else
|
||||
sc->rx_bd_mbuf_alloc_size = MCLBYTES;
|
||||
#endif
|
||||
sc->pg_bd_mbuf_alloc_size = MCLBYTES;
|
||||
sc->rx_bd_mbuf_align_pad = roundup2(MCLBYTES, 16) - MCLBYTES;
|
||||
sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size -
|
||||
sc->rx_bd_mbuf_align_pad;
|
||||
#endif
|
||||
|
||||
ifp->if_snd.ifq_drv_maxlen = USABLE_TX_BD;
|
||||
IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
|
||||
|
|
@ -856,6 +879,9 @@ bce_attach(device_t dev)
|
|||
((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? "32-bit" : "64-bit"),
|
||||
sc->bus_speed_mhz);
|
||||
printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
printf("SPLT ");
|
||||
#endif
|
||||
if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
|
||||
printf("MFW ");
|
||||
if (sc->bce_flags & BCE_USING_MSI_FLAG)
|
||||
|
|
@ -2246,6 +2272,7 @@ bce_dma_free(struct bce_softc *sc)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* Free, unmap and destroy all page buffer descriptor chain pages. */
|
||||
for (i = 0; i < PG_PAGES; i++ ) {
|
||||
if (sc->pg_bd_chain[i] != NULL) {
|
||||
|
|
@ -2272,6 +2299,7 @@ bce_dma_free(struct bce_softc *sc)
|
|||
bus_dma_tag_destroy(sc->pg_bd_chain_tag);
|
||||
sc->pg_bd_chain_tag = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Unload and destroy the TX mbuf maps. */
|
||||
|
|
@ -2308,6 +2336,7 @@ bce_dma_free(struct bce_softc *sc)
|
|||
sc->rx_mbuf_tag = NULL;
|
||||
}
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* Unload and destroy the page mbuf maps. */
|
||||
for (i = 0; i < TOTAL_PG_BD; i++) {
|
||||
if (sc->pg_mbuf_map[i] != NULL) {
|
||||
|
|
@ -2324,6 +2353,7 @@ bce_dma_free(struct bce_softc *sc)
|
|||
bus_dma_tag_destroy(sc->pg_mbuf_tag);
|
||||
sc->pg_mbuf_tag = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Destroy the parent tag */
|
||||
if (sc->parent_tag != NULL) {
|
||||
|
|
@ -2376,7 +2406,21 @@ bce_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
|||
/* Allocate any DMA memory needed by the driver. */
|
||||
/* */
|
||||
/* Allocates DMA memory needed for the various global structures needed by */
|
||||
/* hardware. */
|
||||
/* hardware. */
|
||||
/* */
|
||||
/* Memory alignment requirements: */
|
||||
/* -----------------+----------+----------+ */
|
||||
/* Data Structure | 5706 | 5708 | */
|
||||
/* -----------------+----------+----------+ */
|
||||
/* Status Block | 8 bytes | 8 bytes | */
|
||||
/* Statistics Block | 8 bytes | 8 bytes | */
|
||||
/* RX Buffers | 16 bytes | 16 bytes | */
|
||||
/* PG Buffers | none | none | */
|
||||
/* TX Buffers | none | none | */
|
||||
/* Chain Pages(1) | 4KiB | 4KiB | */
|
||||
/* -----------------+----------+----------+ */
|
||||
/* */
|
||||
/* (1) Must align with CPU page size (BCM_PAGE_SZIE). */
|
||||
/* */
|
||||
/* Returns: */
|
||||
/* 0 for success, positive value for failure. */
|
||||
|
|
@ -2683,8 +2727,12 @@ bce_dma_alloc(device_t dev)
|
|||
/*
|
||||
* Create a DMA tag for RX mbufs.
|
||||
*/
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ?
|
||||
MCLBYTES : sc->rx_bd_mbuf_alloc_size);
|
||||
MCLBYTES : sc->rx_bd_mbuf_alloc_size);
|
||||
#else
|
||||
max_size = max_seg_size = MJUM9BYTES;
|
||||
#endif
|
||||
|
||||
if (bus_dma_tag_create(sc->parent_tag,
|
||||
1,
|
||||
|
|
@ -2715,6 +2763,7 @@ bce_dma_alloc(device_t dev)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/*
|
||||
* Create a DMA tag for the page buffer descriptor chain,
|
||||
* allocate and clear the memory, and fetch the physical
|
||||
|
|
@ -2777,7 +2826,7 @@ bce_dma_alloc(device_t dev)
|
|||
* Create a DMA tag for page mbufs.
|
||||
*/
|
||||
max_size = max_seg_size = ((sc->pg_bd_mbuf_alloc_size < MCLBYTES) ?
|
||||
MCLBYTES : sc->rx_bd_mbuf_alloc_size);
|
||||
MCLBYTES : sc->pg_bd_mbuf_alloc_size);
|
||||
|
||||
if (bus_dma_tag_create(sc->parent_tag,
|
||||
1,
|
||||
|
|
@ -2807,6 +2856,7 @@ bce_dma_alloc(device_t dev)
|
|||
goto bce_dma_alloc_exit;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bce_dma_alloc_exit:
|
||||
DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__);
|
||||
|
|
@ -3449,7 +3499,9 @@ bce_stop(struct bce_softc *sc)
|
|||
bce_disable_intr(sc);
|
||||
|
||||
/* Free RX buffers. */
|
||||
bce_free_pg_chain(sc);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
bce_free_pg_chain(sc);
|
||||
#endif
|
||||
bce_free_rx_chain(sc);
|
||||
|
||||
/* Free TX buffers. */
|
||||
|
|
@ -3811,8 +3863,12 @@ bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod,
|
|||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
|
||||
#else
|
||||
m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
|
||||
if (sc->rx_bd_mbuf_alloc_size == MCLBYTES)
|
||||
m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
|
||||
else
|
||||
m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, sc->rx_bd_mbuf_alloc_size);
|
||||
#endif
|
||||
|
||||
if (m_new == NULL) {
|
||||
sc->mbuf_alloc_failed++;
|
||||
rc = ENOBUFS;
|
||||
|
|
@ -3825,9 +3881,12 @@ bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod,
|
|||
m_new = m;
|
||||
}
|
||||
|
||||
/* Make sure we have a valid packet header. */
|
||||
M_ASSERTPKTHDR(m_new);
|
||||
|
||||
m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size;
|
||||
/* Initialize the mbuf size and pad if necessary for alignment. */
|
||||
m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size;
|
||||
m_adj(m_new, sc->rx_bd_mbuf_align_pad);
|
||||
|
||||
/* ToDo: Consider calling m_fragment() to test error handling. */
|
||||
|
||||
|
|
@ -3838,8 +3897,8 @@ bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod,
|
|||
|
||||
/* Handle any mapping errors. */
|
||||
if (error) {
|
||||
BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain!\n",
|
||||
__FILE__, __LINE__);
|
||||
BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain (%d)!\n",
|
||||
__FILE__, __LINE__, error);
|
||||
|
||||
m_freem(m_new);
|
||||
DBRUN(sc->debug_rx_mbuf_alloc--);
|
||||
|
|
@ -3861,7 +3920,7 @@ bce_get_rx_buf(struct bce_softc *sc, struct mbuf *m, u16 *prod,
|
|||
rxbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr));
|
||||
rxbd->rx_bd_len = htole32(segs[0].ds_len);
|
||||
rxbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END);
|
||||
*prod_bseq += segs[0].ds_len;
|
||||
*prod_bseq += segs[0].ds_len;
|
||||
|
||||
/* Save the mbuf and update our counter. */
|
||||
sc->rx_mbuf_ptr[*chain_prod] = m_new;
|
||||
|
|
@ -3881,6 +3940,7 @@ bce_get_rx_buf_exit:
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Encapsulate an mbuf cluster into the page chain. */
|
||||
/* */
|
||||
|
|
@ -3991,6 +4051,7 @@ bce_get_pg_buf_exit:
|
|||
|
||||
return(rc);
|
||||
}
|
||||
#endif /* BCE_USE_SPLIT_HEADER */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -4234,8 +4295,10 @@ bce_free_rx_chain(struct bce_softc *sc)
|
|||
|
||||
DBPRINT(sc, BCE_VERBOSE_RESET, "Entering %s()\n", __FUNCTION__);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* Clear the jumbo page chain support. */
|
||||
CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, 0);
|
||||
CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, 0);
|
||||
#endif
|
||||
|
||||
/* Free any mbufs still in the RX mbuf chain. */
|
||||
for (i = 0; i < TOTAL_RX_BD; i++) {
|
||||
|
|
@ -4264,6 +4327,7 @@ bce_free_rx_chain(struct bce_softc *sc)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Allocate memory and initialize the page data structures. */
|
||||
/* Assumes that bce_init_rx_chain() has not already been called. */
|
||||
|
|
@ -4312,7 +4376,11 @@ bce_init_pg_chain(struct bce_softc *sc)
|
|||
CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_NX_PG_BDHADDR_LO, val);
|
||||
|
||||
/* Configure the rx_bd and page chain mbuf cluster size. */
|
||||
val = (sc->rx_bd_mbuf_alloc_size << 16) | sc->pg_bd_mbuf_alloc_size;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
val = (sc->rx_bd_mbuf_data_len << 16) | sc->pg_bd_mbuf_alloc_size;
|
||||
#else
|
||||
val = (sc->rx_bd_mbuf_data_len << 16);
|
||||
#endif
|
||||
CTX_WR(sc, GET_CID_ADDR(RX_CID), BCE_L2CTX_PG_BUF_SIZE, val);
|
||||
|
||||
/* Configure the context reserved for jumbo support. */
|
||||
|
|
@ -4413,6 +4481,7 @@ bce_free_pg_chain(struct bce_softc *sc)
|
|||
|
||||
DBPRINT(sc, BCE_EXCESSIVE_RESET, "Exiting %s()\n", __FUNCTION__);
|
||||
}
|
||||
#endif /* BCE_USE_SPLIT_HEADER */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -4567,9 +4636,13 @@ bce_rx_intr(struct bce_softc *sc)
|
|||
{
|
||||
struct ifnet *ifp = sc->bce_ifp;
|
||||
struct l2_fhdr *l2fhdr;
|
||||
unsigned int pages, pkt_len, rem_len;
|
||||
u16 sw_rx_cons, sw_rx_cons_idx, sw_pg_cons, sw_pg_cons_idx, hw_rx_cons;
|
||||
unsigned int pkt_len;
|
||||
u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons;
|
||||
u32 status;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
unsigned int pages, rem_len;
|
||||
u16 sw_pg_cons, sw_pg_cons_idx;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BCE_DEBUG
|
||||
|
|
@ -4583,17 +4656,21 @@ bce_rx_intr(struct bce_softc *sc)
|
|||
bus_dmamap_sync(sc->rx_bd_chain_tag,
|
||||
sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* 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,
|
||||
sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
|
||||
sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
|
||||
#endif
|
||||
|
||||
/* Get the hardware's view of the RX consumer index. */
|
||||
hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc);
|
||||
|
||||
/* Get working copies of the driver's view of the consumer indices. */
|
||||
sw_rx_cons = sc->rx_cons;
|
||||
sw_pg_cons = sc->pg_cons;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
sw_pg_cons = sc->pg_cons;
|
||||
#endif
|
||||
|
||||
DBPRINT(sc, BCE_INFO_RECV, "%s(enter): rx_prod = 0x%04X, "
|
||||
"rx_cons = 0x%04X, rx_prod_bseq = 0x%08X\n",
|
||||
|
|
@ -4656,10 +4733,12 @@ bce_rx_intr(struct bce_softc *sc)
|
|||
*/
|
||||
m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN);
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/*
|
||||
* Check whether the received frame fits in a single
|
||||
* mbuf or not (i.e. packet data + FCS <=
|
||||
* sc->rx_bd_mbuf_alloc_size bytes).
|
||||
* sc->rx_bd_mbuf_data_len bytes).
|
||||
*/
|
||||
if (pkt_len > m0->m_len) {
|
||||
/*
|
||||
|
|
@ -4737,7 +4816,8 @@ bce_rx_intr(struct bce_softc *sc)
|
|||
|
||||
/* Set the total packet length. */
|
||||
m0->m_pkthdr.len = m0->m_len = pkt_len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove the trailing Ethernet FCS. */
|
||||
m_adj(m0, -ETHER_CRC_LEN);
|
||||
|
|
@ -4825,7 +4905,9 @@ 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;
|
||||
sc->pg_cons = sw_pg_cons;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
sc->pg_cons = sw_pg_cons;
|
||||
#endif
|
||||
|
||||
BCE_UNLOCK(sc);
|
||||
(*ifp->if_input)(ifp, m0);
|
||||
|
|
@ -4833,7 +4915,9 @@ bce_rx_int_next_rx:
|
|||
|
||||
/* Recover our place. */
|
||||
sw_rx_cons = sc->rx_cons;
|
||||
sw_pg_cons = sc->pg_cons;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
sw_pg_cons = sc->pg_cons;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Refresh hw_cons to see if there's new work */
|
||||
|
|
@ -4842,8 +4926,10 @@ bce_rx_int_next_rx:
|
|||
}
|
||||
|
||||
/* No new packets to process. Refill the RX and page chains and exit. */
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
sc->pg_cons = sw_pg_cons;
|
||||
bce_fill_pg_chain(sc);
|
||||
bce_fill_pg_chain(sc);
|
||||
#endif
|
||||
|
||||
sc->rx_cons = sw_rx_cons;
|
||||
bce_fill_rx_chain(sc);
|
||||
|
|
@ -4852,9 +4938,11 @@ bce_rx_int_next_rx:
|
|||
bus_dmamap_sync(sc->rx_bd_chain_tag,
|
||||
sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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);
|
||||
sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
|
||||
#endif
|
||||
|
||||
DBPRINT(sc, BCE_INFO_RECV, "%s(exit): rx_prod = 0x%04X, "
|
||||
"rx_cons = 0x%04X, rx_prod_bseq = 0x%08X\n",
|
||||
|
|
@ -5089,12 +5177,19 @@ bce_init_locked(struct bce_softc *sc)
|
|||
bcopy(IF_LLADDR(sc->bce_ifp), sc->eaddr, ETHER_ADDR_LEN);
|
||||
bce_set_mac_addr(sc);
|
||||
|
||||
/* Calculate and program the hardware Ethernet MTU size. */
|
||||
if (ifp->if_mtu <= sc->pg_bd_mbuf_alloc_size)
|
||||
/* Be generous on receive if we have room. */
|
||||
ether_mtu = sc->pg_bd_mbuf_alloc_size;
|
||||
/*
|
||||
* Calculate and program the hardware Ethernet MTU
|
||||
* size. Be generous on the receive if we have room.
|
||||
*/
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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
|
||||
if (ifp->if_mtu <= sc->rx_bd_mbuf_data_len)
|
||||
ether_mtu = sc->rx_bd_mbuf_data_len;
|
||||
#endif
|
||||
else
|
||||
ether_mtu = ifp->if_mtu;
|
||||
ether_mtu = ifp->if_mtu;
|
||||
|
||||
ether_mtu += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN;
|
||||
|
||||
|
|
@ -5110,14 +5205,18 @@ bce_init_locked(struct bce_softc *sc)
|
|||
REG_WR(sc, BCE_EMAC_RX_MTU_SIZE, ether_mtu);
|
||||
|
||||
DBPRINT(sc, BCE_INFO_LOAD,
|
||||
"%s(): rx_bd_mbuf_alloc_size = %d, pg_bd_mbuf_alloc_size = %d\n",
|
||||
__FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->pg_bd_mbuf_alloc_size);
|
||||
"%s(): rx_bd_mbuf_alloc_size = %d, rx_bce_mbuf_data_len = %d, "
|
||||
"rx_bd_mbuf_align_pad = %d, pg_bd_mbuf_alloc_size = %d\n",
|
||||
__FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len,
|
||||
sc->rx_bd_mbuf_align_pad, sc->pg_bd_mbuf_alloc_size);
|
||||
|
||||
/* Program appropriate promiscuous/multicast filtering. */
|
||||
bce_set_rx_mode(sc);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* Init page buffer descriptor chain. */
|
||||
bce_init_pg_chain(sc);
|
||||
bce_init_pg_chain(sc);
|
||||
#endif
|
||||
|
||||
/* Init RX buffer descriptor chain. */
|
||||
bce_init_rx_chain(sc);
|
||||
|
|
@ -5583,7 +5682,24 @@ bce_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
|||
|
||||
BCE_LOCK(sc);
|
||||
ifp->if_mtu = ifr->ifr_mtu;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/* No buffer allocation size changes are necessary. */
|
||||
#else
|
||||
/* Recalculate our buffer allocation sizes. */
|
||||
if ((ifp->if_mtu + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN) > MCLBYTES) {
|
||||
sc->rx_bd_mbuf_alloc_size = MJUM9BYTES;
|
||||
sc->rx_bd_mbuf_align_pad = roundup2(MJUM9BYTES, 16) - MJUM9BYTES;
|
||||
sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size -
|
||||
sc->rx_bd_mbuf_align_pad;
|
||||
} else {
|
||||
sc->rx_bd_mbuf_alloc_size = MCLBYTES;
|
||||
sc->rx_bd_mbuf_align_pad = roundup2(MCLBYTES, 16) - MCLBYTES;
|
||||
sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size -
|
||||
sc->rx_bd_mbuf_align_pad;
|
||||
}
|
||||
#endif
|
||||
|
||||
bce_init_locked(sc);
|
||||
BCE_UNLOCK(sc);
|
||||
break;
|
||||
|
|
@ -6233,7 +6349,9 @@ bce_tick(void *xsc)
|
|||
bce_stats_update(sc);
|
||||
|
||||
/* Top off the receive and page chains. */
|
||||
bce_fill_pg_chain(sc);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
bce_fill_pg_chain(sc);
|
||||
#endif
|
||||
bce_fill_rx_chain(sc);
|
||||
|
||||
/* Check that chip hasn't hung. */
|
||||
|
|
@ -6406,6 +6524,7 @@ bce_sysctl_dump_tx_chain(SYSCTL_HANDLER_ARGS)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Provides a sysctl interface to allow dumping the page chain. */
|
||||
/* */
|
||||
|
|
@ -6431,7 +6550,8 @@ bce_sysctl_dump_pg_chain(SYSCTL_HANDLER_ARGS)
|
|||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -6923,10 +7043,12 @@ bce_add_sysctls(struct bce_softc *sc)
|
|||
(void *)sc, 0,
|
||||
bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain");
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
|
||||
"dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW,
|
||||
(void *)sc, 0,
|
||||
bce_sysctl_dump_pg_chain, "I", "Dump page chain");
|
||||
bce_sysctl_dump_pg_chain, "I", "Dump page chain");
|
||||
#endif
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
|
||||
"breakpoint", CTLTYPE_INT | CTLFLAG_RW,
|
||||
|
|
@ -7104,6 +7226,7 @@ bce_dump_rx_mbuf_chain(struct bce_softc *sc, u16 chain_prod, int count)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Prints out the mbufs in the mbuf page chain. */
|
||||
/* */
|
||||
|
|
@ -7132,7 +7255,8 @@ bce_dump_pg_mbuf_chain(struct bce_softc *sc, u16 chain_prod, int count)
|
|||
"----------------------------"
|
||||
"----------------"
|
||||
"----------------------------\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -7226,6 +7350,7 @@ bce_dump_rxbd(struct bce_softc *sc, int idx, struct rx_bd *rxbd)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Prints out a rx_bd structure in the page chain. */
|
||||
/* */
|
||||
|
|
@ -7248,7 +7373,8 @@ bce_dump_pgbd(struct bce_softc *sc, int idx, struct rx_bd *pgbd)
|
|||
"flags = 0x%08X\n", idx,
|
||||
pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo,
|
||||
pgbd->rx_bd_len, pgbd->rx_bd_flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -7612,6 +7738,7 @@ bce_dump_rx_chain(struct bce_softc *sc, u16 rx_prod, int count)
|
|||
}
|
||||
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
/****************************************************************************/
|
||||
/* Prints out the page chain. */
|
||||
/* */
|
||||
|
|
@ -7654,7 +7781,8 @@ bce_dump_pg_chain(struct bce_softc *sc, u16 pg_prod, int count)
|
|||
"----------------------------"
|
||||
"----------------"
|
||||
"----------------------------\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
|
@ -8091,11 +8219,13 @@ bce_dump_driver_state(struct bce_softc *sc)
|
|||
"0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n",
|
||||
val_hi, val_lo);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
val_hi = BCE_ADDR_HI(sc->pg_bd_chain);
|
||||
val_lo = BCE_ADDR_LO(sc->pg_bd_chain);
|
||||
BCE_PRINTF(
|
||||
"0x%08X:%08X - (sc->pg_bd_chain) page chain virtual address\n",
|
||||
val_hi, val_lo);
|
||||
val_hi, val_lo);
|
||||
#endif
|
||||
|
||||
val_hi = BCE_ADDR_HI(sc->tx_mbuf_ptr);
|
||||
val_lo = BCE_ADDR_LO(sc->tx_mbuf_ptr);
|
||||
|
|
@ -8109,11 +8239,13 @@ bce_dump_driver_state(struct bce_softc *sc)
|
|||
"0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n",
|
||||
val_hi, val_lo);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr);
|
||||
val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr);
|
||||
BCE_PRINTF(
|
||||
"0x%08X:%08X - (sc->pg_mbuf_ptr) page mbuf chain virtual address\n",
|
||||
val_hi, val_lo);
|
||||
val_hi, val_lo);
|
||||
#endif
|
||||
|
||||
BCE_PRINTF(" 0x%08X - (sc->interrupts_generated) h/w intrs\n",
|
||||
sc->interrupts_generated);
|
||||
|
|
@ -8160,6 +8292,7 @@ bce_dump_driver_state(struct bce_softc *sc)
|
|||
BCE_PRINTF(" 0x%08X - (sc->free_rx_bd) free rx_bd's\n",
|
||||
sc->free_rx_bd);
|
||||
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_prod) page producer index\n",
|
||||
sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod));
|
||||
|
||||
|
|
@ -8174,6 +8307,7 @@ bce_dump_driver_state(struct bce_softc *sc)
|
|||
|
||||
BCE_PRINTF("0x%08X/%08X - (sc->pg_low_watermark) page low watermark\n",
|
||||
sc->pg_low_watermark, sc->max_pg_bd);
|
||||
#endif
|
||||
|
||||
BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed) "
|
||||
"mbuf alloc failures\n",
|
||||
|
|
@ -8482,16 +8616,13 @@ bce_breakpoint(struct bce_softc *sc)
|
|||
bce_unfreeze_controller(sc);
|
||||
bce_dump_txbd(sc, 0, NULL);
|
||||
bce_dump_rxbd(sc, 0, NULL);
|
||||
bce_dump_pgbd(sc, 0, NULL);
|
||||
bce_dump_tx_mbuf_chain(sc, 0, USABLE_TX_BD);
|
||||
bce_dump_rx_mbuf_chain(sc, 0, USABLE_RX_BD);
|
||||
bce_dump_pg_mbuf_chain(sc, 0, USABLE_PG_BD);
|
||||
bce_dump_l2fhdr(sc, 0, NULL);
|
||||
bce_dump_ctx(sc, RX_CID);
|
||||
bce_dump_ftqs(sc);
|
||||
bce_dump_tx_chain(sc, 0, USABLE_TX_BD);
|
||||
bce_dump_rx_chain(sc, 0, USABLE_RX_BD);
|
||||
bce_dump_pg_chain(sc, 0, USABLE_PG_BD);
|
||||
bce_dump_status_block(sc);
|
||||
bce_dump_stats_block(sc);
|
||||
bce_dump_driver_state(sc);
|
||||
|
|
@ -8500,6 +8631,11 @@ bce_breakpoint(struct bce_softc *sc)
|
|||
bce_dump_txp_state(sc);
|
||||
bce_dump_rxp_state(sc);
|
||||
bce_dump_tpat_state(sc);
|
||||
#ifdef BCE_USE_SPLIT_HEADER
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
bce_dump_status_block(sc);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@
|
|||
|
||||
/****************************************************************************/
|
||||
/* Debugging macros and definitions. */
|
||||
/****************************************************************************/
|
||||
/****************************************************************************/
|
||||
/* #define BCE_DEBUG 1 */
|
||||
|
||||
#define BCE_CP_LOAD 0x00000001
|
||||
#define BCE_CP_SEND 0x00000002
|
||||
#define BCE_CP_RECV 0x00000004
|
||||
|
|
@ -466,7 +468,7 @@ struct flash_spec {
|
|||
* running and there won't be any firmware-driver synchronization during a
|
||||
* driver reset.
|
||||
*/
|
||||
#define FW_ACK_TIME_OUT_MS 100
|
||||
#define FW_ACK_TIME_OUT_MS 1000
|
||||
|
||||
|
||||
#define BCE_DRV_RESET_SIGNATURE 0x00000000
|
||||
|
|
@ -4924,8 +4926,7 @@ struct fw_info {
|
|||
#define BCE_MAX_JUMBO_ETHER_MTU 9018
|
||||
#define BCE_MAX_JUMBO_ETHER_MTU_VLAN 9022
|
||||
|
||||
// #define BCE_MAX_MTU ETHER_MAX_LEN_JUMBO + ETHER_VLAN_ENCAP_LEN /* 9022 */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* BCE Device State Data Structure */
|
||||
/****************************************************************************/
|
||||
|
|
@ -5047,7 +5048,9 @@ struct bce_softc
|
|||
|
||||
/* Frame size and mbuf allocation size for RX frames. */
|
||||
u32 max_frame_size;
|
||||
int rx_bd_mbuf_alloc_size;
|
||||
int rx_bd_mbuf_alloc_size;
|
||||
int rx_bd_mbuf_data_len;
|
||||
int rx_bd_mbuf_align_pad;
|
||||
int pg_bd_mbuf_alloc_size;
|
||||
|
||||
/* Receive mode settings (i.e promiscuous, multicast, etc.). */
|
||||
|
|
|
|||
Loading…
Reference in a new issue