Index: if_mcx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_mcx.c,v retrieving revision 1.44 diff -u -p -r1.44 if_mcx.c --- if_mcx.c 24 Apr 2020 07:28:37 -0000 1.44 +++ if_mcx.c 20 May 2020 03:35:46 -0000 @@ -1949,6 +1949,7 @@ struct mcx_softc { uint32_t sc_eq_cons; struct mcx_dmamem sc_eq_mem; int sc_hardmtu; + int sc_rxbufsz; struct task sc_port_change; @@ -3853,6 +3854,7 @@ mcx_set_port_mtu(struct mcx_softc *sc, i } sc->sc_hardmtu = mtu; + sc->sc_rxbufsz = roundup(mtu + ETHER_ALIGN, sizeof(long)); return 0; } @@ -5504,7 +5506,7 @@ free: int mcx_rx_fill_slots(struct mcx_softc *sc, void *ring, struct mcx_slot *slots, - uint *prod, int bufsize, uint nslots) + uint *prod, uint nslots) { struct mcx_rq_entry *rqe; struct mcx_slot *ms; @@ -5516,12 +5518,13 @@ mcx_rx_fill_slots(struct mcx_softc *sc, rqe = ring; for (fills = 0; fills < nslots; fills++) { ms = &slots[slot]; - m = MCLGETI(NULL, M_DONTWAIT, NULL, bufsize + ETHER_ALIGN); + m = MCLGETI(NULL, M_DONTWAIT, NULL, sc->sc_rxbufsz); if (m == NULL) break; + m->m_data += (m->m_ext.ext_size - sc->sc_rxbufsz); m->m_data += ETHER_ALIGN; - m->m_len = m->m_pkthdr.len = bufsize; + m->m_len = m->m_pkthdr.len = sc->sc_hardmtu; if (bus_dmamap_load_mbuf(sc->sc_dmat, ms->ms_map, m, BUS_DMA_NOWAIT) != 0) { m_freem(m); @@ -5529,7 +5532,8 @@ mcx_rx_fill_slots(struct mcx_softc *sc, } ms->ms_m = m; - rqe[slot].rqe_byte_count = htobe32(bufsize); + rqe[slot].rqe_byte_count = + htobe32(ms->ms_map->dm_segs[0].ds_len); rqe[slot].rqe_addr = htobe64(ms->ms_map->dm_segs[0].ds_addr); rqe[slot].rqe_lkey = htobe32(sc->sc_lkey); @@ -5559,7 +5563,7 @@ mcx_rx_fill(struct mcx_softc *sc) return (1); slots = mcx_rx_fill_slots(sc, MCX_DMA_KVA(&sc->sc_rq_mem), - sc->sc_rx_slots, &sc->sc_rx_prod, sc->sc_hardmtu, slots); + sc->sc_rx_slots, &sc->sc_rx_prod, slots); if_rxr_put(&sc->sc_rxr, slots); return (0); }