On Fri, Jun 09, 2023 at 06:59:57PM +0200, Jan Klemkow wrote: > On Fri, Jun 09, 2023 at 06:11:38PM +0200, Jan Klemkow wrote: > > TSO packets are limited to MAXMCLBYTES (64k). Thus, we don't need to > > allocate IXGBE_TSO_SIZE (256k) per packet for the transmit buffers. > > > > This saves 3/4 of the memory and allows me to pack over 8 ix(8) ports > > into one machine. Otherwise I run out of devbuf in malloc(9). > > fix typo in comment
Use a more precise compare in the CTASSERT condition. ok? Index: dev/pci/if_ix.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_ix.c,v retrieving revision 1.197 diff -u -p -r1.197 if_ix.c --- dev/pci/if_ix.c 1 Jun 2023 09:05:33 -0000 1.197 +++ dev/pci/if_ix.c 9 Jun 2023 16:01:18 -0000 @@ -37,6 +37,12 @@ #include <dev/pci/if_ix.h> #include <dev/pci/ixgbe_type.h> +/* + * Our TCP/IP Stack could not handle packets greater than MAXMCLBYTES. + * This interface could not handle packets greater than IXGBE_TSO_SIZE. + */ +CTASSERT(MAXMCLBYTES <= IXGBE_TSO_SIZE); + /********************************************************************* * Driver version *********************************************************************/ @@ -2263,7 +2269,7 @@ ixgbe_allocate_transmit_buffers(struct t /* Create the descriptor buffer dma maps */ for (i = 0; i < sc->num_tx_desc; i++) { txbuf = &txr->tx_buffers[i]; - error = bus_dmamap_create(txr->txdma.dma_tag, IXGBE_TSO_SIZE, + error = bus_dmamap_create(txr->txdma.dma_tag, MAXMCLBYTES, sc->num_segs, PAGE_SIZE, 0, BUS_DMA_NOWAIT, &txbuf->map);