FDP Utils

class Utils(main_api)

Utility functions for the FDP API, used via the FDP class.

Example

from fdp import FDP
f = FDP(..)
create_placement_identifier(phndl, rgid=None, rgif=None)

Convenience function to create a Placement Identifier from a single Placement Handle Index and Reclaim Group Identifier.

The format of the 2-byte Placement Identifier is dependent on the Reclaim Group Identifier found in the FDP Configuration Descriptor applied to the Endurance Group. This function is intended to serve as a wrapper around the bitwise operations needed to create a Placement Identifier.

If there is only a single Reclaim Group (NRG == 1) in the current FDP Configuration, then the format of the Placement Identifier is entirely defined by the Placement Handle (See Figure PIDRG_NORGI: Placement Identifier Format without Reclaim Group Identifier)

If there is more than one Reclaim Group (NRG > 1), then the format of the Placement Identifier is based on the Reclaim Group Identifier Format (See Figure PIDRG: Placement Identifier Format with a non-zero RGIF)

In cases where NRG > 1, it is necessary to specify both a Reclaim Group Identifier and the Reclaim Group Identifier Format, in addition to a Placement Handle.

Parameters:
  • phndl (int) – Placement Handle. A Placement Handle is a namespace’s reference to a single Reclaim Unit Handle

  • rgid (int) – Reclaim Group Identifier. Index of the Reclaim Group referenced by the Placement Identifier

  • rgif (int) – Reclaim Group Identifier Format. Specifies the most-significant bits in the Placement Identifier that specifies the Reclaim Group Identifier

Returns:

pid – Placement Identifier. The Placement Identifier for the format used in the current FDP Configuration.

Return type:

int

enable_fdp(dut, flag=1, endgid=1)

Enables or disables Flexible Data Placement in the specified Endurance Group, and deletes all namespaces associated with the Endurance Group prior to doing so.

After the value of the Flexible Data Placement feature is changed, restore the previous namespace configuration.

Parameters:
  • dut (DUT) – DUT object

  • flag (int) – FDP Toggle Flag. This bit specifies if the Flexible Data Placement (i.e., capability) is enabled or disabled. If this bit is set to ‘1’, then Flexible Data Placement is enabled. If this bit is cleared to ‘0’, then Flexible Data Placement is disabled.

  • endgid (int) – Endurance Group Identifier If Endurance Groups are supported, then this field specifies the identifier for the Endurance Group used for this Feature.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

Return type:

dict

enable_fdp_event(nsid, events, flag, handle=0)

Enables or disables a specified sequence of FDP events associated with a specific Reclaim Unit Handle.

Parameters:
  • nsid (int) – Namespace Identifier. The NSID associated with the list of FDP events.

  • events (list) – The list of FDP Events to enable/disable.

  • flag (int) – FDP Event Toggle Flag. If set to ‘1’, then the FDP events specified in events are enabled. If set to ‘0’ then the FDP events specified in events are disabled. If the FDP Event Enable bit is already set to flag, then no change will occur.

  • handle (int) – Placement Handle (PHNDL) The Placement Handle associated with the Reclaim Unit Handle affected by this command.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

Return type:

dict

get_endgid(nsid=None)

Return the Endurance Group Identifier (ENDGID) of the namespace specified by the NSID. Use dut.lun if no NSID is provided.

If Endurance Groups are not supported, or the specified NSID does not exist, return a value of 1h.

Parameters:
  • dut (DUT) – DUT object.

  • nsid (int) – Optionally specify the NSID of the namespace to query Endurance Group information from.

Returns:

endgid

Return type:

int Endurance Group Identifier (ENDGID) of the specified namespace

placement_handle_of(pid, rgif=0)

Convenience function to extract the Placement Handle (PHNDL) from a Placement Identifier (PI).

Parameters:
  • pid (int) – Placement Identifier (PID).

  • rgif (int) – Reclaim Group Identifier Format (RGIF) Specifies the number of most-significant bits in the Placement Identifier that contain the Reclaim Group Identifier

Returns:

The Placement Handle associated with the provided Placement Identifier.

Return type:

int

update_handles(handles, nsid, identifiers=None)

SLATED FOR DEPRECATION

Convenience function for I/O Management Send Operation 01h Reclaim Unit Handle Update.

param handles:

A list of Placement Handles. The handles will be parsed in the order they are placed in the list.

For example, if handles = [1, 2, 3] Handle 1 at index 0 will be assigned to the first Placement Identifier. Handle 2 at index 1 will be assigned to the second Placement Identifier. and so on.

type handles:

list

param nsid:

Namespace Identifier. The NSID associated with the list of FDP events.

type nsid:

int

param identifiers:

A list of Reclaim Group Identifiers specifying the Reclaim Group used by the command.

If identifiers is specified, then the Reclaim Group Identifiers will be parsed in the order they are placed in the list. If identifiers is not specified, or if len(identifiers) is less than len(handles), then the Reclaim Group Identifiers field will be cleared to 0h.

For example, if identifiers = [2, 3, 2] and handles = [1, 2, 3] RGID 2 and Handle 1 will be assigned to the first Placement Identifier. RGID 3 and Handle 2 will be assigned to the second Placement Identifier. and so on.

If identifiers = [1] and handles [1, 2, 3] RGID 1 and Handle 1 will be assigned to the first Placement Identifier. Handles 2 and 3 will be assigned to their respective Placement Identifiers with the RGID field cleared to 0h.

type identifiers:

list

returns:
status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

data: dict

The parsed bytes returned by the controller

rtype:

dict

update_identifiers(nsid, identifiers)

Convenience function for I/O Management Send Operation 01h Reclaim Unit Handle Update.

Parameters:
  • nsid (int) – Namespace Identifier.

  • identifiers (list[int]) – Placement Identifiers. A list of integers representing the Placement Identifier List of the I/O Management Send command. Each Placement Identifier is assumed to be 2-byte Placement Identifier in little-endian format.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

data: dict

The parsed bytes returned by the controller

Return type:

dict