MFC r318895: Fix several problems with mapping code in mps(4).


MFC r318895: Fix several problems with mapping code in mps(4).
MFC r318896: Fix several problems with mapping code in mpr(4).

-Add several comments describing what the mapping code is doing.
-Added a callout timer to improve check for missing devices when discovery has
completed so that missing counts are incremented correctly.
-Fix problems with missing counts not being saved to the HBA.
-Update man pages mps(4) and mpr(4) to include a description of the use
use_phy_num sysctl variable.
-Remove channel field in the mapping structure because it's not used.
-Improve logging by using mps_dprint or mpr_dprint instead of printf and adding
more logging where appropriate.
-Add check for a bad index before writing mapping entries to controller.
-The high missing count check in the mapping table was using the incorrect
initial value, which could lead to a bad result.
-The usage of the IN_USE flag for volume mapping was changed to be more
intuitive, and was not being used correctly.
-The check for a free DPM entry was changed, as this was completely wrong.
-Updates to the missing count for volumes were not being done correctly, so this
function was completely rewritten.
-_mapping_add_to_removal_table() was overly complicated and incorrectly used, so
this function was rewritten.
-Missing counts for all devices were not being incremented properly, so this
functionality was added.
-The search for space in the mapping table for missing enclosures was not
calculating the found space correctly due to not breaking out of a loop when
required, and the num_found variable was not being reset when needed.
-Retries when a device fails to get added due to a full mapping table were
removed because this is unneccessary.
-mps_mapping_is_reinit_required() and mpr_mapping_is_reinit_required() were
removed because they were not being used.
-Some functions were renamed to avoid confusion between Target IDs and SAS IDs.
-_mapping_check_update_ir_mt_idx() was removed because it was overly
complicating volume mapping.
-The setting of the maxtargets variable was changed to include max volumes.
-The setting of the initiator_id variable was changed to be the invalid target
ID after all targets, including volumes. Previously, this was set to the last
valid target ID.
-Don't exclude target IDs of RAID components or check for a reuse of a target ID
for RAID components.
-Some endienness was added.

Approved by: ken, mav


slmJun 1 2017, 4:55 PM
rS319445: MFC r318895: Fix several problems with mapping code in mps(4).