Module Name:    src
Committed By:   riastradh
Date:           Wed Jun 12 16:51:54 UTC 2024

Modified Files:
        src/sys/dev/pci: ld_virtio.c

Log Message:
ld@virtio(4): Fix maximum size parameters.

- SEG_MAX is the maximum number of segments.
- SIZE_MAX is the maximum number of bytes in a single segment.

The maximum transfer size is, therefore, SEG_MAX * SIZE_MAX.

=> Don't add two extra segments in the dmamap vr_payload for the
   header and status -- we already have a separate dmamap vr_cmdsts
   for that.

=> Don't recalculate payload dmamap parameters based on division by
   NBPG, just use the ones specified by the host.

=> Allow SIZE_MAX below MAXPHYS as long as SIZE_MAX*SEG_MAX >=
   MAXPHYS.

Even though ldattach clamps ld->sc_maxxfer to MAXPHYS, make sure to
clamp it in ld_virtio_attach before ld_virtio_alloc_reqs since it
determines the dmamap sizes and bounce buffer allocation and there's
no sense in allocating those larger than ld will use anyway.

PR kern/58338


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/ld_virtio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to