Index: dev/ic/mfi.c =================================================================== RCS file: /cvs/src/sys/dev/ic/mfi.c,v retrieving revision 1.157 diff -u -p -r1.157 mfi.c --- dev/ic/mfi.c 14 Sep 2014 14:17:24 -0000 1.157 +++ dev/ic/mfi.c 10 Oct 2014 10:09:52 -0000 @@ -791,7 +791,7 @@ mfi_attach(struct mfi_softc *sc, enum mf sc->sc_link.adapter_buswidth = sc->sc_info.mci_max_lds; sc->sc_link.adapter_target = -1; sc->sc_link.luns = 1; - sc->sc_link.openings = sc->sc_max_cmds - 1; + sc->sc_link.openings = 2; // sc->sc_max_cmds - 1; sc->sc_link.pool = &sc->sc_iopool; bzero(&saa, sizeof(saa)); Index: dev/pci/if_bnx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_bnx.c,v retrieving revision 1.107 diff -u -p -r1.107 if_bnx.c --- dev/pci/if_bnx.c 18 Jul 2014 07:11:04 -0000 1.107 +++ dev/pci/if_bnx.c 10 Oct 2014 10:09:52 -0000 @@ -848,6 +848,8 @@ bnx_attachhook(void *xsc) sc->bnx_rx_ticks = 18; #endif + sc->mbuf_alloc_size = BNX_MAX_JUMBO_MRU; + /* Update statistics once every second. */ sc->bnx_stats_ticks = 1000000 & 0xffff00; @@ -878,6 +880,7 @@ bnx_attachhook(void *xsc) ifp->if_ioctl = bnx_ioctl; ifp->if_start = bnx_start; ifp->if_watchdog = bnx_watchdog; + ifp->if_hardmtu = BNX_MAX_JUMBO_MTU; IFQ_SET_MAXLEN(&ifp->if_snd, USABLE_TX_BD - 1); IFQ_SET_READY(&ifp->if_snd); bcopy(sc->eaddr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); @@ -890,8 +893,6 @@ bnx_attachhook(void *xsc) ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif - sc->mbuf_alloc_size = BNX_MAX_MRU; - printf("%s: address %s\n", sc->bnx_dev.dv_xname, ether_sprintf(sc->arpcom.ac_enaddr)); @@ -2647,8 +2648,8 @@ bnx_dma_alloc(struct bnx_softc *sc) * Create DMA maps for the Rx buffer mbufs. */ for (i = 0; i < TOTAL_RX_BD; i++) { - if (bus_dmamap_create(sc->bnx_dmatag, BNX_MAX_MRU, - BNX_MAX_SEGMENTS, BNX_MAX_MRU, 0, BUS_DMA_NOWAIT, + if (bus_dmamap_create(sc->bnx_dmatag, sc->mbuf_alloc_size, + 1, sc->mbuf_alloc_size, 0, BUS_DMA_NOWAIT, &sc->rx_mbuf_map[i])) { printf(": Could not create Rx mbuf %d DMA map!\n", i); rc = ENOMEM; @@ -3663,10 +3664,10 @@ bnx_get_buf(struct bnx_softc *sc, u_int1 *prod_bseq); /* This is a new mbuf allocation. */ - m = MCLGETI(NULL, M_DONTWAIT, NULL, MCLBYTES); + m = MCLGETI(NULL, M_DONTWAIT, NULL, sc->mbuf_alloc_size); if (!m) return (0); - m->m_len = m->m_pkthdr.len = MCLBYTES; + m->m_len = m->m_pkthdr.len = sc->mbuf_alloc_size; /* the chip aligns the ip header for us, no need to m_adj */ /* Map the mbuf cluster into device memory. */ @@ -3979,6 +3980,16 @@ bnx_init_rx_context(struct bnx_softc *sc REG_WR(sc, BNX_MQ_MAP_L2_5, val | BNX_MQ_MAP_L2_5_ARM); } + CTX_WR(sc, GET_CID_ADDR(RX_CID), BNX_L2CTX_RX_PG_BUF_SIZE, 0); + + /* Configure the rx_bd and page chain mbuf cluster size. */ + val = (sc->mbuf_alloc_size << 16); + CTX_WR(sc, GET_CID_ADDR(RX_CID), BNX_L2CTX_RX_PG_BUF_SIZE, val); + + /* Configure the context reserved for jumbo support. */ + CTX_WR(sc, GET_CID_ADDR(RX_CID), BNX_L2CTX_RX_RBDC_KEY, + BNX_L2CTX_RX_RBDC_JUMBO_KEY); + /* Point the hardware to the first page in the chain. */ val = (u_int32_t)((u_int64_t)sc->rx_bd_chain_paddr[0] >> 32); CTX_WR(sc, GET_CID_ADDR(RX_CID), BNX_L2CTX_NX_BDHADDR_HI, val); @@ -4746,7 +4757,7 @@ bnx_init(void *xsc) bnx_set_mac_addr(sc); /* Calculate and program the Ethernet MRU size. */ - ether_mtu = BNX_MAX_STD_ETHER_MTU_VLAN; + ether_mtu = BNX_MAX_JUMBO_ETHER_MTU; DBPRINT(sc, BNX_INFO, "%s(): setting MRU = %d\n", __FUNCTION__, ether_mtu); @@ -5134,7 +5145,7 @@ bnx_ioctl(struct ifnet *ifp, u_long comm case SIOCGIFRXR: error = if_rxr_ioctl((struct if_rxrinfo *)ifr->ifr_data, - NULL, MCLBYTES, &sc->rx_ring); + NULL, sc->mbuf_alloc_size, &sc->rx_ring); break; default: Index: dev/pci/mfii.c =================================================================== RCS file: /cvs/src/sys/dev/pci/mfii.c,v retrieving revision 1.18 diff -u -p -r1.18 mfii.c --- dev/pci/mfii.c 30 Sep 2014 18:02:33 -0000 1.18 +++ dev/pci/mfii.c 10 Oct 2014 10:09:52 -0000 @@ -326,7 +326,9 @@ int mfii_pd_scsi_cmd_cdb(struct mfii_s #define mfii_fw_state(_sc) mfii_read((_sc), MFI_OSP) static const struct pci_matchid mfii_devices[] = { - { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_2208 } + { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_2208 }, + { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_3008 }, + { PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_3108 } }; int Index: net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v retrieving revision 1.301 diff -u -p -r1.301 if.c --- net/if.c 30 Sep 2014 08:27:57 -0000 1.301 +++ net/if.c 10 Oct 2014 10:09:52 -0000 @@ -147,7 +147,6 @@ int if_setgroupattribs(caddr_t); int if_clone_list(struct if_clonereq *); struct if_clone *if_clone_lookup(const char *, int *); -void if_congestion_clear(void *); int if_group_egress_build(void); void if_link_state_change_task(void *, void *); @@ -179,7 +178,6 @@ struct pool ifaddr_item_pl; struct timeout net_tick_to; void net_tick(void *); -int net_livelocked(void); /* * Network interface utility routines. @@ -805,36 +803,6 @@ if_clone_list(struct if_clonereq *ifcr) } return (error); -} - -/* - * set queue congestion marker and register timeout to clear it - */ -void -if_congestion(struct ifqueue *ifq) -{ - /* Not currently needed, all callers check this */ - if (ifq->ifq_congestion) - return; - - ifq->ifq_congestion = malloc(sizeof(struct timeout), M_TEMP, M_NOWAIT); - if (ifq->ifq_congestion == NULL) - return; - timeout_set(ifq->ifq_congestion, if_congestion_clear, ifq); - timeout_add(ifq->ifq_congestion, hz / 100); -} - -/* - * clear the congestion flag - */ -void -if_congestion_clear(void *arg) -{ - struct ifqueue *ifq = arg; - struct timeout *to = ifq->ifq_congestion; - - ifq->ifq_congestion = NULL; - free(to, M_TEMP, 0); } #define equal(a1, a2) \ Index: net/if_ppp.c =================================================================== RCS file: /cvs/src/sys/net/if_ppp.c,v retrieving revision 1.76 diff -u -p -r1.76 if_ppp.c --- net/if_ppp.c 22 Jul 2014 11:06:09 -0000 1.76 +++ net/if_ppp.c 10 Oct 2014 10:09:52 -0000 @@ -1498,8 +1498,6 @@ ppp_inproc(struct ppp_softc *sc, struct if (sc->sc_flags & SC_DEBUG) printf("%s: input queue full\n", ifp->if_xname); ifp->if_iqdrops++; - if (!inq->ifq_congestion) - if_congestion(inq); goto bad; } IF_ENQUEUE(inq, m); Index: net/if_spppsubr.c =================================================================== RCS file: /cvs/src/sys/net/if_spppsubr.c,v retrieving revision 1.125 diff -u -p -r1.125 if_spppsubr.c --- net/if_spppsubr.c 22 Jul 2014 11:06:09 -0000 1.125 +++ net/if_spppsubr.c 10 Oct 2014 10:09:52 -0000 @@ -626,8 +626,6 @@ sppp_input(struct ifnet *ifp, struct mbu if (debug) log(LOG_DEBUG, SPP_FMT "protocol queue overflow\n", SPP_ARGS(ifp)); - if (!inq->ifq_congestion) - if_congestion(inq); goto drop; } IF_ENQUEUE(inq, m); Index: net/if_tun.c =================================================================== RCS file: /cvs/src/sys/net/if_tun.c,v retrieving revision 1.128 diff -u -p -r1.128 if_tun.c --- net/if_tun.c 8 Sep 2014 06:24:13 -0000 1.128 +++ net/if_tun.c 10 Oct 2014 10:09:52 -0000 @@ -916,8 +916,6 @@ tunwrite(dev_t dev, struct uio *uio, int splx(s); ifp->if_collisions++; m_freem(top); - if (!ifq->ifq_congestion) - if_congestion(ifq); return (ENOBUFS); } IF_ENQUEUE(ifq, top); Index: net/if_var.h =================================================================== RCS file: /cvs/src/sys/net/if_var.h,v retrieving revision 1.12 diff -u -p -r1.12 if_var.h --- net/if_var.h 8 Jul 2014 04:02:14 -0000 1.12 +++ net/if_var.h 10 Oct 2014 10:09:52 -0000 @@ -105,7 +105,6 @@ struct ifqueue { int ifq_maxlen; int ifq_drops; struct hfsc_if *ifq_hfsc; - struct timeout *ifq_congestion; }; /* @@ -248,8 +247,6 @@ do { \ if (IF_QFULL(ifq)) { \ IF_DROP(ifq); \ m_freem(m); \ - if (!(ifq)->ifq_congestion) \ - if_congestion(ifq); \ } else \ IF_ENQUEUE(ifq, m); \ } while (/* CONSTCOND */0) @@ -436,7 +433,6 @@ void if_clone_detach(struct if_clone *); int if_clone_create(const char *); int if_clone_destroy(const char *); -void if_congestion(struct ifqueue *); int sysctl_ifq(int *, u_int, void *, size_t *, void *, size_t, struct ifqueue *); @@ -449,6 +445,8 @@ void ifa_add(struct ifnet *, struct ifad void ifa_del(struct ifnet *, struct ifaddr *); void ifa_update_broadaddr(struct ifnet *, struct ifaddr *, struct sockaddr *); + +int net_livelocked(void); void if_rxr_init(struct if_rxring *, u_int, u_int); u_int if_rxr_get(struct if_rxring *, u_int); Index: net/pf.c =================================================================== RCS file: /cvs/src/sys/net/pf.c,v retrieving revision 1.888 diff -u -p -r1.888 pf.c --- net/pf.c 8 Oct 2014 07:37:01 -0000 1.888 +++ net/pf.c 10 Oct 2014 10:09:52 -0000 @@ -222,7 +222,6 @@ int pf_compare_state_keys(struct pf_s struct pf_state *pf_find_state(struct pfi_kif *, struct pf_state_key_cmp *, u_int, struct mbuf *); int pf_src_connlimit(struct pf_state **); -int pf_check_congestion(struct ifqueue *); int pf_match_rcvif(struct mbuf *, struct pf_rule *); void pf_step_into_anchor(int *, struct pf_ruleset **, struct pf_rule **, struct pf_rule **); @@ -3133,7 +3132,7 @@ pf_test_rule(struct pf_pdesc *pd, struct ifq = &ip6intrq; #endif - if (pd->dir == PF_IN && pf_check_congestion(ifq)) { + if (pd->dir == PF_IN && net_livelocked()) { REASON_SET(&reason, PFRES_CONGEST); return (PF_DROP); } @@ -6722,15 +6721,6 @@ done: } return (action); -} - -int -pf_check_congestion(struct ifqueue *ifq) -{ - if (ifq->ifq_congestion) - return (1); - else - return (0); } void Index: net/pipex.c =================================================================== RCS file: /cvs/src/sys/net/pipex.c,v retrieving revision 1.55 diff -u -p -r1.55 pipex.c --- net/pipex.c 22 Jul 2014 11:06:10 -0000 1.55 +++ net/pipex.c 10 Oct 2014 10:09:52 -0000 @@ -1189,8 +1189,6 @@ pipex_ip_input(struct mbuf *m0, struct p if (IF_QFULL(&ipintrq)) { IF_DROP(&ipintrq); ifp->if_collisions++; - if (!ipintrq.ifq_congestion) - if_congestion(&ipintrq); splx(s); goto drop; } @@ -1264,8 +1262,6 @@ pipex_ip6_input(struct mbuf *m0, struct if (IF_QFULL(&ip6intrq)) { IF_DROP(&ip6intrq); ifp->if_collisions++; - if (!ip6intrq.ifq_congestion) - if_congestion(&ip6intrq); splx(s); goto drop; } Index: scsi/mpath.c =================================================================== RCS file: /cvs/src/sys/scsi/mpath.c,v retrieving revision 1.37 diff -u -p -r1.37 mpath.c --- scsi/mpath.c 14 Sep 2014 14:17:26 -0000 1.37 +++ scsi/mpath.c 10 Oct 2014 10:09:52 -0000 @@ -340,7 +340,7 @@ mpath_done(struct scsi_xfer *mxs) void mpath_failover(struct mpath_dev *d) { - if (!scsi_pending_start(&d->d_mtx, &d->d_failover)) + if (!scsi_pending_start(&d->d_failover)) return; mpath_failover_start(d); @@ -389,7 +389,7 @@ mpath_path_status(struct mpath_path *p, if (status == MPATH_S_ACTIVE) { scsi_xsh_add(&p->p_xsh); - if (!scsi_pending_finish(&d->d_mtx, &d->d_failover)) + if (!scsi_pending_finish(&d->d_failover)) mpath_failover_start(d); } else mpath_failover_check(d); Index: scsi/scsi_base.c =================================================================== RCS file: /cvs/src/sys/scsi/scsi_base.c,v retrieving revision 1.217 diff -u -p -r1.217 scsi_base.c --- scsi/scsi_base.c 20 Sep 2014 16:18:23 -0000 1.217 +++ scsi/scsi_base.c 10 Oct 2014 10:09:52 -0000 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -201,33 +202,20 @@ scsi_plug_detach(void *xp, void *null) } int -scsi_pending_start(struct mutex *mtx, u_int *running) +scsi_pending_start(u_int *running) { - int rv = 1; - - mtx_enter(mtx); - (*running)++; - if ((*running) > 1) - rv = 0; - mtx_leave(mtx); - - return (rv); + return (atomic_inc_int_nv(running) == 1); } int -scsi_pending_finish(struct mutex *mtx, u_int *running) +scsi_pending_finish(u_int *running) { - int rv = 1; + if (atomic_cas_uint(running, 1, 0) == 1) + return (1); - mtx_enter(mtx); - (*running)--; - if ((*running) > 0) { - (*running) = 1; - rv = 0; - } - mtx_leave(mtx); + *running = 1; - return (rv); + return (0); } void @@ -409,7 +397,7 @@ scsi_iopool_run(struct scsi_iopool *iopl struct scsi_iohandler *ioh; void *io; - if (!scsi_pending_start(&iopl->mtx, &iopl->running)) + if (!scsi_pending_start(&iopl->running)) return; do { while (scsi_ioh_pending(iopl)) { @@ -425,7 +413,7 @@ scsi_iopool_run(struct scsi_iopool *iopl ioh->handler(ioh->cookie, io); } - } while (!scsi_pending_finish(&iopl->mtx, &iopl->running)); + } while (!scsi_pending_finish(&iopl->running)); } /* @@ -568,7 +556,7 @@ scsi_xsh_runqueue(struct scsi_link *link struct scsi_iohandler *ioh; int runq; - if (!scsi_pending_start(&link->pool->mtx, &link->running)) + if (!scsi_pending_start(&link->running)) return; do { runq = 0; @@ -589,7 +577,7 @@ scsi_xsh_runqueue(struct scsi_link *link if (runq) scsi_iopool_run(link->pool); - } while (!scsi_pending_finish(&link->pool->mtx, &link->running)); + } while (!scsi_pending_finish(&link->running)); } void Index: scsi/scsiconf.h =================================================================== RCS file: /cvs/src/sys/scsi/scsiconf.h,v retrieving revision 1.162 diff -u -p -r1.162 scsiconf.h --- scsi/scsiconf.h 9 Sep 2014 20:30:08 -0000 1.162 +++ scsi/scsiconf.h 10 Oct 2014 10:09:52 -0000 @@ -570,8 +570,8 @@ int scsi_xsh_del(struct scsi_xshandler * /* * utility functions */ -int scsi_pending_start(struct mutex *, u_int *); -int scsi_pending_finish(struct mutex *, u_int *); +int scsi_pending_start(u_int *); +int scsi_pending_finish(u_int *); /* * Utility functions for SCSI HBA emulation.