[Bug 271238] mpr (LSI SAS3816) driver not finding all devices in HP D6020 enclosures

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 25 Nov 2024 22:46:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271238

--- Comment #8 from Peter Eriksson <pen@lysator.liu.se> ---
Hmm. I added some debugging printf's to the mpr driver and rebooted. It says:

> mpr0: mpr_mapping_initialize: Mapping table has a max of 2622 entries and DPM has a max of 128 entries.
> mpr0: _mapping_process_dpm_pg0: Start copy of 128 DPM entries into the mapping table.
> mpr0: _mapping_find_enc_map_space: Looking for space in the mapping table for added enclosure. [max_num_phy_ids=16, skip_count=0, eot=2622]
> mpr0: _mapping_find_enc_map_space: Found space in the mapping for enclosure at map index 16.
> mpr0: _mapping_get_dev_info: Initialize 18 map entries for the enclosure, starting at map index  16.
> mpr0: _mapping_flush_dpm_pages: Flushing DPM entry 0.


And then it preceeds and adds 35 drives (there are 35 drives in each drawer/on
each expander).

> mpr0: Handle 0x005f SAS Address from SAS device page0 = 5001438041bb92bc
> mpr0: mprsas_add_device: Target ID for added device is 33.
> mpr0: Found device <4441<SspInit,SspTarg,SepDev>,End Device> <12.0Gbps> handle<0x005f> enclosureHandle<0x0002> slot 17
> mpr0: At enclosure level 0 and connector name (C1  )
> mpr0: Target id 0x21 added
> 
> mpr0: _mapping_find_enc_map_space: Looking for space in the mapping table for added enclosure. [max_num_phy_ids=16, skip_count=0, eot=2622]
> mpr0: _mapping_find_enc_map_space: Found space in the mapping for enclosure at map index 34.
> mpr0: _mapping_get_dev_info: Initialize 18 map entries for the enclosure, starting at map index  34.
> mpr0: _mapping_flush_dpm_pages: Flushing DPM entry 1.

Then it adds 18 more map entries starting at 16+18. And promply starts reusing
stuff... I wonder if things wouldn't work better it it would add 35 entries and
start the next group at 16+35 instead...

I wonder where it gets that number 18 from.


Aha!

root@:/ # mprutil show enclosures
Slots      Logical ID     SEPHandle  EncHandle    Type
  17    300062b218119a40    0000       0001     Direct Attached SES-2
  18    5001438041bb9280    005f       0002     External SES-2
  18    5001438041bb0000    0061       0003     External SES-2
  18    5001438030897600    009c       0004     External SES-2
  18    5001438030889a80    009d       0005     External SES-2

There it is... Each drawer has 35 drive slots.

And the comes from this code in mpr_mapping.c line 2285:

               if ((ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_MASK_MAPPING_MODE) ==
                    MPI2_IOCPAGE8_FLAGS_ENCLOSURE_SLOT_MAPPING) {
                        /*                                                      
                         * The dev_idx for an enclosure is the start index. If  
                         * the start index is within the controller's default   
                         * enclosure area, set the number of slots for this     
                         * enclosure to the max allowed. Otherwise, it should
be                                                                        
                         * a normal enclosure and the number of slots is in the 
                         * DPM entry's Mapping Information.                     
                         */
                       if (dev_idx < (sc->num_rsvd_entries +
                            max_num_phy_ids)) {
                                slot_id = 0;
                                if (ioc_pg8_flags &
                                    MPI2_IOCPAGE8_FLAGS_DA_START_SLOT_1)
                                        slot_id = 1;
                                num_slots = max_num_phy_ids;
                        } else {
                                slot_id = 0;
                                num_slots = dpm_entry->MappingInformation &
                                    MPI2_DRVMAP0_MAPINFO_SLOT_MASK;
                                num_slots >>= MPI2_DRVMAP0_MAPINFO_SLOT_SHIFT;
                        }

-- 
You are receiving this mail because:
You are on the CC list for the bug.