@@ -563,7 +563,8 @@ static int pax_check_ep_pdfid(struct switchtec_dev *dev, uint16_t pdfid)
563563 return NOT_FOUND ;
564564}
565565
566- static int pax_check_pdfid_type (struct switchtec_dev * dev , uint16_t pdfid )
566+ static int pax_check_pdfid_type (struct switchtec_dev * dev , uint16_t pdfid ,
567+ int * pax_id )
567568{
568569 int i ;
569570 int ret = NOT_FOUND ;
@@ -599,8 +600,10 @@ static int pax_check_pdfid_type(struct switchtec_dev *dev, uint16_t pdfid)
599600 continue ;
600601
601602 ret = pax_check_ep_pdfid (dev , pdfid );
602- if (ret != NOT_FOUND )
603+ if (ret != NOT_FOUND ) {
604+ * pax_id = i ;
603605 break ;
606+ }
604607 }
605608 }
606609
@@ -650,6 +653,7 @@ static int switchtec_vf_reset(int argc, char **argv, struct command *command,
650653 char device_str [64 ];
651654 char pdfid_str [64 ];
652655 struct switchtec_dev * dev ;
656+ int pax_id = SWITCHTEC_PAX_ID_LOCAL ;
653657 const char * desc = "Perform a Function Level Reset (FLR) on a Virtual Function" ;
654658 const char * force = "The \"I know what I'm doing\" flag, skip confirmation before sending command" ;
655659 struct config {
@@ -705,7 +709,7 @@ static int switchtec_vf_reset(int argc, char **argv, struct command *command,
705709 return - ENODEV ;
706710 }
707711
708- ret = pax_check_pdfid_type (dev , pdfid );
712+ ret = pax_check_pdfid_type (dev , pdfid , & pax_id );
709713 if (ret == IS_PF ) {
710714 fprintf (stderr ,
711715 "vf-reset error: the given device %s is a Physical Function\n" ,
@@ -718,7 +722,7 @@ static int switchtec_vf_reset(int argc, char **argv, struct command *command,
718722 goto close ;
719723 }
720724
721- ret = switchtec_set_pax_id (dev , SWITCHTEC_PAX_ID_LOCAL );
725+ ret = switchtec_set_pax_id (dev , pax_id );
722726 if (ret ) {
723727 switchtec_perror ("vf-reset" );
724728 goto close ;
0 commit comments