Skip to content

Commit

Permalink
drmgr/phb: Add multipath partner device support for remove
Browse files Browse the repository at this point in the history
The PHB node can have "ibm,multipath-partner-drc" property
which means the device can be also configured with multipath
partner path. This property provides the DRC index of the
partner device. For the hotplug removal, both paths should
be removed and the following steps will be executed:

- Find the partner path DRC index from "ibm,multipath-partner-drc"
  property for the specified device
- If the partner path is configured, notify user about the
  removal of partner path if available. Then the user should issue
  issue separate drmgr command to remove the partner path.
- Remove the primary path

Signed-off-by: Haren Myneni <[email protected]>
Signed-off-by: Tyrel Datwyler <[email protected]>
  • Loading branch information
hmyneni authored and tyreld committed Jul 26, 2024
1 parent aa5feef commit 8751abf
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/drmgr/drslot_chrp_phb.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,11 @@ static int disable_os_hp_children(struct dr_node *phb)
*/
static int remove_phb(void)
{
struct dr_node *phb;
struct dr_node *phb, *partner_phb = NULL;
struct dr_node *child;
struct dr_node *hp_list = NULL;
uint32_t partner_drc_index = 0;
char drc_index_str[10];
int rc = 0;

phb = get_node_by_name(usr_drc_name, PHB_NODES);
Expand All @@ -305,6 +307,20 @@ static int remove_phb(void)
goto phb_remove_error;
}

/* Find the multipath partner device index if available */
rc = get_my_partner_drc_index(phb, &partner_drc_index);
if (!rc && partner_drc_index) {
sprintf(drc_index_str, "%d", partner_drc_index);

/* Find the partner phb device */
partner_phb = get_node_by_name(drc_index_str, PHB_NODES);
if (partner_phb) {
printf("Partner adapter location : %s",
partner_phb->drc_name);
printf(" Partner adapter must be removed\n");
}
}

/* Now, disable any hotplug children */
hp_list = get_hp_nodes();

Expand Down Expand Up @@ -358,6 +374,9 @@ static int remove_phb(void)
if (phb)
free_node(phb);

if (partner_phb)
free_node(partner_phb);

if (hp_list)
free_node(hp_list);

Expand Down

0 comments on commit 8751abf

Please sign in to comment.