igc(4): Use same size for DMA mapping and allocation for rx bufs
authorjan <jan@openbsd.org>
Thu, 8 Aug 2024 14:58:49 +0000 (14:58 +0000)
committerjan <jan@openbsd.org>
Thu, 8 Aug 2024 14:58:49 +0000 (14:58 +0000)
Also remove the ETHER_ALIGN which leads to corruped mbufs.

ok bluhm@

sys/dev/pci/if_igc.c

index 450f6a5..3d3df85 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_igc.c,v 1.25 2024/05/24 06:02:53 jsg Exp $ */
+/*     $OpenBSD: if_igc.c,v 1.26 2024/08/08 14:58:49 jan Exp $ */
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
  *
@@ -881,7 +881,7 @@ igc_init(void *arg)
        }
        igc_initialize_transmit_unit(sc);
 
-       sc->rx_mbuf_sz = MCLBYTES + ETHER_ALIGN;
+       sc->rx_mbuf_sz = MCLBYTES;
        /* Prepare receive descriptors and buffers. */
        if (igc_setup_receive_structures(sc)) {
                printf("%s: Could not setup receive structures\n",
@@ -2159,7 +2159,7 @@ igc_allocate_receive_buffers(struct igc_rxring *rxr)
        rxbuf = rxr->rx_buffers;
        for (i = 0; i < sc->num_rx_desc; i++, rxbuf++) {
                error = bus_dmamap_create(rxr->rxdma.dma_tag,
-                   MAX_JUMBO_FRAME_SIZE, 1, MAX_JUMBO_FRAME_SIZE, 0,
+                   MAX_JUMBO_FRAME_SIZE, IGC_MAX_SCATTER, MCLBYTES, 0,
                    BUS_DMA_NOWAIT, &rxbuf->map);
                if (error) {
                        printf("%s: Unable to create RX DMA map\n",