Guest User

disad100base

a guest
Mar 30th, 2012
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh /etc/rc.common
  2.  
  3. START=50
  4.  
  5. ad100base_ctrl() { # <dev> <port> <0|1>
  6.     local val=0
  7.  
  8.     swconfig dev $1 set phy $2
  9.  
  10.     # Auto-Negotiation Advertisement
  11.     # 4.7 100BASE-TX
  12.     # 4.8 100BASE-TX full duplex
  13.     swconfig dev $1 set reg 4
  14.     val=$(swconfig dev $1 get val)
  15.     swconfig dev $1 set val $((val^(-$3^val)&0x180))
  16.  
  17.     # 0.9 Restart Auto-Negotiation
  18.     swconfig dev $1 set reg 0
  19.     val=$(swconfig dev $1 get val)
  20.     swconfig dev $1 set val $((val^(-1^val)&0x200))
  21. }
  22.  
  23. start() {
  24.     local port=0
  25.  
  26.     for port in $(seq 0 3)
  27.         do ad100base_ctrl eth0 $port 0
  28.         logger -t switch disabled Auto-Negotiation Advertisement for 100BASE-TX on port $port
  29.     done
  30. }
  31.  
  32. stop() {
  33.     local port=0
  34.  
  35.     for port in $(seq 0 3)
  36.         do ad100base_ctrl eth0 $port 1
  37.         logger -t switch enabled Auto-Negotiation Advertisement for 100BASE-TX on port $port
  38.     done
  39. }
RAW Paste Data