@@ -9,6 +9,10 @@ use log::debug;
99use mctp:: { AsyncRespChannel , MsgIC } ;
1010
1111use crate :: nvme:: mi:: { NvmSubsystemStatusFlags , PortCapabilityFlags } ;
12+ use crate :: nvme:: {
13+ ControllerAttributeFlags , ControllerMultipathIoNamespaceSharingCapabilityFlags ,
14+ ManagementEndpointCapabilityFlags , NvmSubsystemReportFlags ,
15+ } ;
1216use crate :: {
1317 CommandEffect , CommandEffectError , Controller , ControllerError , ControllerType , Discriminant ,
1418 MAX_CONTROLLERS , MAX_NAMESPACES , NamespaceId , NamespaceIdDisposition , SubsystemError ,
@@ -1385,26 +1389,66 @@ impl RequestHandler for AdminIdentifyRequest {
13851389 fixup. reverse ( ) ;
13861390 fixup
13871391 } ,
1388- cmic : ( ( subsys. ctlrs . len ( ) > 1 ) as u8 ) << 1 // MCTRS
1389- | ( ( subsys. ports . len ( ) > 1 ) as u8 ) , // MPORTS
1392+ cmic : {
1393+ let mut flags = FlagSet :: empty ( ) ;
1394+
1395+ if subsys. ctlrs . len ( ) > 1 {
1396+ flags |=
1397+ ControllerMultipathIoNamespaceSharingCapabilityFlags :: Mctrs ;
1398+ }
1399+
1400+ if subsys. ports . len ( ) > 1 {
1401+ flags |=
1402+ ControllerMultipathIoNamespaceSharingCapabilityFlags :: Mports ;
1403+ }
1404+
1405+ flags
1406+ }
1407+ . into ( ) ,
13901408 mdts : 0 ,
13911409 cntlid : ctlr. id . 0 ,
13921410 ver : 0 ,
13931411 rtd3r : 0 ,
13941412 rtd3e : 0 ,
13951413 oaes : 0 ,
13961414 // TODO: Tie to data model
1397- ctratt : ( ( false as u32 ) << 14 ) // DNVMS
1398- | ( ( false as u32 ) << 13 ) // DEG
1399- | ( ( false as u32 ) << 4 ) // EGS
1400- | ( ( false as u32 ) << 2 ) , // NSETS
1415+ ctratt : {
1416+ let mut flags = FlagSet :: empty ( ) ;
1417+
1418+ flags -= ControllerAttributeFlags :: Nsets ;
1419+ flags -= ControllerAttributeFlags :: Egs ;
1420+ flags -= ControllerAttributeFlags :: Deg ;
1421+ flags -= ControllerAttributeFlags :: Dnvms ;
1422+
1423+ flags
1424+ }
1425+ . into ( ) ,
14011426 cntrltype : ctlr. cntrltype . into ( ) ,
14021427 // TODO: Tie to data model
1403- nvmsr : ( ( false as u8 ) << 1 ) // NVMEE
1404- | ( true as u8 ) , // NVMESD
1428+ nvmsr : { FlagSet :: empty ( ) | NvmSubsystemReportFlags :: Nvmesd } . into ( ) ,
14051429 vwci : 0 ,
1406- mec : ( ( subsys. ports . iter ( ) . any ( |p| matches ! ( p. typ, crate :: PortType :: Pcie ( _) ) ) ) as u8 ) << 1 // PCIEME
1407- | ( subsys. ports . iter ( ) . any ( |p| matches ! ( p. typ, crate :: PortType :: TwoWire ( _) ) ) ) as u8 , // TWPME
1430+ mec : {
1431+ let mut flags = FlagSet :: empty ( ) ;
1432+
1433+ if subsys
1434+ . ports
1435+ . iter ( )
1436+ . any ( |p| matches ! ( p. typ, crate :: PortType :: Pcie ( _) ) )
1437+ {
1438+ flags |= ManagementEndpointCapabilityFlags :: Pcieme ;
1439+ }
1440+
1441+ if subsys
1442+ . ports
1443+ . iter ( )
1444+ . any ( |p| matches ! ( p. typ, crate :: PortType :: TwoWire ( _) ) )
1445+ {
1446+ flags |= ManagementEndpointCapabilityFlags :: Twpme ;
1447+ }
1448+
1449+ flags
1450+ }
1451+ . into ( ) ,
14081452 ocas : 0 ,
14091453 acl : 0 ,
14101454 aerl : 0 ,
0 commit comments