Page MenuHomeFreeBSD

usb/quirk: Optimize USB quirk entry definition more flexible
Needs ReviewPublic

Authored by weike.chen_dell.com on Apr 28 2024, 7:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 9:21 PM
Unknown Object (File)
Nov 22 2024, 5:12 PM
Unknown Object (File)
Sep 7 2024, 12:29 AM
Unknown Object (File)
Sep 3 2024, 3:03 AM
Unknown Object (File)
Aug 30 2024, 10:01 AM
Unknown Object (File)
Aug 30 2024, 10:01 AM
Unknown Object (File)
Aug 30 2024, 10:01 AM
Unknown Object (File)
Aug 30 2024, 9:49 AM
Subscribers

Details

Reviewers
thompsa
emaste
Summary

The max size of USB quirk entry array is hard coded to 384, there are 2 drawbacks:

  1. Flexibility: if the actual size is bigger than 384, it needs be redefined. For our case, we have more than 384 entries.
  2. The number of empty slots is depended on statical entries added.

Changes:

  1. Enable developer to add device entry without caring about the table size.
  2. Always reserve 128 slots for adding device entry dynamically.

Limitation: the max devices which can be added dynamically are 128.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

We make use of the empty slots in some cases, e.g. see usb_quirk_get_entry with do_alloc. How will that be handled?

We make use of the empty slots in some cases, e.g. see usb_quirk_get_entry with do_alloc. How will that be handled?

Good question. How to handle the following case:

  1. The table size is defined to '384', if there are no empty slots, how to handle the case with 'do_alloc'?

It is better to use list to handle the devices added dynamically, or reserve slots to handle adding devices dynamically, like reserve 128 slots?

For our cases, we must add new devices into the table statically, but it is not depended on user space to add them dynamically. As we add so many, now the table size is bigger than 384.

Let me commit another patch to reserve 128 slots for adding devices dynamically.