Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking nic speed.. ndd kstat question

Status
Not open for further replies.

dandan123

Technical User
Sep 9, 2005
505
US
I've always been using ndd to check nic speeds, but recently one of my colleagues told me that kstat is more accurate. However when I checked kstat on one of my servers it's output conflicts with what I get on ndd -

kstat -m hme -i 1 | grep link
link_down_cnt 0
link_duplex 0
link_up 1

kstat -m hme -i 1 | grep -i speed
ifspeed 100000000

ndd /dev/hme
name to get/set ? link_speed
value ?
length ?
1
name to get/set ? link_mode
value ?
length ?
1

ndd indicates its 100/full, while kstat indicates its 100/half ?

I have ndd commands in /etc/system to set it to 100/full so I'm pretty sure it's set to 100/full.

What do you guys think ?
 
I didn't know about kstat, that's useful information, thanks! Looks like it's similar to netstat -k (e.g. netstat -k hme0).

Are you sure they're both looking at the same hme though? ndd will default to instance 0, whereas you are specifying instance 1 with the kstat command?

Annihilannic.
 
I set ndd to instance 1 first, anyway ndd shows the same values for both hme0 and 1.
 
Hmm... same on one of our systems:

[tt]# nddgetall /dev/hme 0
Setting instance to 0
transceiver_inuse: 0
link_status: 1
link_speed: 1
link_mode: 1
...

# kstat -m hme -i 0 | grep link
link_down_cnt 0
link_duplex 0
link_up 1
#[/tt]

Maybe link_duplex is 1 when it's half-duplex?

Annihilannic.
 
netstat -k gives the same values as for kstat -
link_duplex 0 and ifspeed 100000000

So which one is correct ? ndd or knstat/netstat ? or am I interpreting it incorrectly ?

netstat -k hme1
hme1:
ipackets 8997010 ierrors 0 opackets 4840 oerrors 0 collisions 0
defer 0 framing 0 crc 0 sqe 0 code_violations 0 len_errors 0
ifspeed 100000000 buff 0 oflo 0 uflo 0 missed 0 tx_late_collisions 0
retry_error 0 first_collisions 0 nocarrier 0 nocanput 0
allocbfail 0 runt 0 jabber 0 babble 0 tmd_error 0 tx_late_error 0
rx_late_error 0 slv_parity_error 0 tx_parity_error 0 rx_parity_error 0
slv_error_ack 0 tx_error_ack 0 rx_error_ack 0 tx_tag_error 0
rx_tag_error 0 eop_error 0 no_tmds 0 no_tbufs 0 no_rbufs 0
rx_late_collisions 0 rbytes 1690337883 obytes 209485 multircv 0 multixmt 0
brdcstrcv 8989369 brdcstxmt 20 norcvbuf 0 noxmtbuf 0 newfree 0
ipackets64 8997010 opackets64 4840 rbytes64 1690337883 obytes64 209485 align_errors 0
fcs_errors 0 sqe_errors 0 defer_xmts 0 ex_collisions 0
macxmt_errors 0 carrier_errors 0 toolong_errors 0 macrcv_errors 0
link_duplex 0 inits 4 rxinits 0 txinits 0 dmarh_inits 0
dmaxh_inits 0 link_down_cnt 0 phy_failures 0 xcvr_vendor 24605
asic_rev 193 link_up 1
 
Yep:

Code:
#!/bin/ksh
if [ $# -lt 1 ]
then
        echo "usage: nddgetall device [instance]"
else
        if [ -c $1 ]
        then
                if [ $# -eq 2 ]
                then
                        echo "Setting instance to $2"
                        ndd -set $1 instance $2
                fi
                for p in `ndd -get $1 \? | awk 'BEGIN {getline}{print $1}'`
                do
                        echo "$p: \c"
                        ndd -get $1 $p
                done
        else
                echo $1 is not a character special device.
        fi
fi

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top