Validation against prtconf ?

Regards,

Mark A. Lane


On 07/02/2013, at 15:34, Boyd Adamson <b...@boydadamson.com> wrote:

> I have found this little hack to be invaluable in the last 12 months:
> 
> ovmsprdct10# identify_nics 
> LINK            DEVICE     LOC                  STATE      PATH
> backup0         nxge11     PCIE2                unknown    
> /pci@400/pci@2/pci@0/pci@4/network@0,3
> datasub0        nxge4      PCIE4                up         
> /pci@400/pci@2/pci@0/pci@0/network@0
> datasub1        nxge5      PCIE4                up         
> /pci@400/pci@2/pci@0/pci@0/network@0,1
> datasub2        nxge6      PCIE4                up         
> /pci@400/pci@2/pci@0/pci@0/network@0,2
> datasub3        nxge7      PCIE4                up         
> /pci@400/pci@2/pci@0/pci@0/network@0,3
> net0            igb0       /SYS/MB              unknown    
> /pci@400/pci@1/pci@0/pci@4/network@0
> net1            igb1       /SYS/MB              unknown    
> /pci@400/pci@1/pci@0/pci@4/network@0,1
> net2            igb2       /SYS/MB              unknown    
> /pci@500/pci@1/pci@0/pci@5/network@0
> net3            igb3       /SYS/MB              unknown    
> /pci@500/pci@1/pci@0/pci@5/network@0,1
> net4            nxge0      PCIE6                unknown    
> /pci@400/pci@1/pci@0/pci@8/network@0
> net5            nxge1      PCIE6                unknown    
> /pci@400/pci@1/pci@0/pci@8/network@0,1
> net6            nxge2      PCIE6                unknown    
> /pci@400/pci@1/pci@0/pci@8/network@0,2
> net7            nxge3      PCIE6                unknown    
> /pci@400/pci@1/pci@0/pci@8/network@0,3
> net12           nxge8      PCIE2                unknown    
> /pci@400/pci@2/pci@0/pci@4/network@0
> net13           nxge9      PCIE2                unknown    
> /pci@400/pci@2/pci@0/pci@4/network@0,1
> net14           nxge10     PCIE2                unknown    
> /pci@400/pci@2/pci@0/pci@4/network@0,2
> net16           nxge12     PCIE7                unknown    
> /pci@500/pci@1/pci@0/pci@6/network@0
> net17           nxge13     PCIE7                unknown    
> /pci@500/pci@1/pci@0/pci@6/network@0,1
> net18           nxge14     PCIE7                unknown    
> /pci@500/pci@1/pci@0/pci@6/network@0,2
> net19           nxge15     PCIE7                unknown    
> /pci@500/pci@1/pci@0/pci@6/network@0,3
> net20           nxge16     PCIE5                unknown    
> /pci@500/pci@2/pci@0/pci@0/network@0
> net21           nxge17     PCIE5                unknown    
> /pci@500/pci@2/pci@0/pci@0/network@0,1
> net22           nxge18     PCIE5                unknown    
> /pci@500/pci@2/pci@0/pci@0/network@0,2
> net23           nxge19     PCIE5                unknown    
> /pci@500/pci@2/pci@0/pci@0/network@0,3
> net24           nxge20     PCIE3                unknown    
> /pci@500/pci@2/pci@0/pci@6/network@0
> net25           nxge21     PCIE3                unknown    
> /pci@500/pci@2/pci@0/pci@6/network@0,1
> net26           nxge22     PCIE3                unknown    
> /pci@500/pci@2/pci@0/pci@6/network@0,2
> net27           nxge23     PCIE3                unknown    
> /pci@500/pci@2/pci@0/pci@6/network@0,3
> net28           usbecm2                         up         
> /pci@400/pci@1/pci@0/pci@b/pci@0/usb@0,2/hub@2/hub@3/communications@3
> 
> identify_links is:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> # Parse path_to_inst
> open(PTI, "</etc/path_to_inst");
> 
> my ($phys, $inst, $drv);
> my %paths;
> 
> while (<PTI>) {
>     chomp;
>     next if /^ *#/;
>     ($phys, $inst, $drv) = split;
>     $phys =~ s/"//g;
>     $drv =~ s/"//g;
>     
>     $paths{"${drv}${inst}"} = $phys;
> }
> 
> my($link, $device, $loc, $state);
> 
> open(DLADM, "dladm show-phys -p -o link,device,loc,state |");
> 
> my $formatstr = "%-15s %-10s %-20s %-10s %s\n";
> printf $formatstr, "LINK", "DEVICE", "LOC", "STATE", "PATH";
> 
> my %results;
> 
> while (<DLADM>) {
>     chomp;
>     ($link, $device, $loc, $state) = split /:/; 
> 
>     # "nxge0" -> "nxge", "0"
>     #($driver, $instance) = $device =~ /(\D+)(\d+)/;
>     
>     $results{$link}{device} = $device;
>     $results{$link}{loc} = $loc;
>     $results{$link}{path} = $paths{$device};
>     $results{$link}{state} = $state;
> }
> 
> sub devcompare {
>     my ($adriver, $ainstance) = $a =~ /(\D+)(\d+)/;
>     my ($bdriver, $binstance) = $b =~ /(\D+)(\d+)/;
> 
>     return ($adriver cmp $bdriver || $ainstance <=> $binstance);
> }
> 
> for my $l (sort devcompare keys %results) {
>     printf $formatstr, $l, $results{$l}{device}, $results{$l}{loc}, 
> $results{$l}{state}, $results{$l}{path};
> }
> 
> On Thu, Feb 7, 2013 at 3:29 PM, Andre van Eyssen <an...@purplecow.org> wrote:
>> On Thu, 7 Feb 2013, Boyd Adamson wrote:
>> 
>>> Dladm rename-link is your friend
>> 
>> Stop ruining rants with facts! ;-)
>> 
>> 
>> -- 
>> Andre van Eyssen.
>> mail: an...@purplecow.org          jabber: an...@interact.purplecow.org
>> purplecow.org: UNIX for the masses http://www2.purplecow.org
>> purplecow.org: PCOWpix             http://pix.purplecow.org
> 
> _______________________________________________
> ug-msosug mailing list
> ug-msosug@opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/ug-msosug
_______________________________________________
ug-msosug mailing list
ug-msosug@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/ug-msosug

Reply via email to