Page MenuHomeFreeBSD

ena: Add macros which represent LLQ header size in bytes
Needs ReviewPublic

Authored by osamaabb_amazon.com on Aug 20 2024, 8:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 18, 1:42 AM
Unknown Object (File)
Dec 15 2024, 9:21 PM
Unknown Object (File)
Oct 2 2024, 7:05 PM
Unknown Object (File)
Sep 30 2024, 10:42 PM
Unknown Object (File)
Sep 26 2024, 7:06 AM
Unknown Object (File)
Sep 25 2024, 9:56 PM
Unknown Object (File)
Sep 19 2024, 10:37 AM
Unknown Object (File)
Sep 18 2024, 7:24 PM
Subscribers

Details

Reviewers
cperciva
Summary

This commit adds macros which define LLQ entry's
header part size in bytes.

The header part size is calculated by

(LLQ_ENTRY_SIZE - DESC_NUMBER * DESC_LEN)

While DESC_LEN is constant (size of a struct) the other two variables
are received from device and can theoretically change.
For example:

  • LLQ entry size can be either 128 or 256
  • number of descriptors can vary from 1 to 8

Approved by: cperciva
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 59055
Build 55942: arc lint + arc unit

Event Timeline

number of descriptors can vary from 1 to 8

I'm a bit confused by this since in this commit you're fixing it at 2?

number of descriptors can vary from 1 to 8

I'm a bit confused by this since in this commit you're fixing it at 2?

In some not so prevalent cases the device may decide that it needs more than two descriptors, if so then the driver will use as much descriptors in each LLQ entry as asked by the device, however the default value is 2 descriptors hence setting default to 2

number of descriptors can vary from 1 to 8

I'm a bit confused by this since in this commit you're fixing it at 2?

In some not so prevalent cases the device may decide that it needs more than two descriptors, if so then the driver will use as much descriptors in each LLQ entry as asked by the device, however the default value is 2 descriptors hence setting default to 2

Ok, maybe the comment /* we allow 2 DMA descriptors per LLQ entry */ should contain the words "by default" somewhere? Looking at the code makes me think "we're going to have a buffer overflow if we need >2 descriptors"; making it clear that these are just default sizes will help future readers to not be scared like I was.