2010年10月22日 星期五

MII, GMII, RGMII

基本上,這三個的作用是一樣的
同樣都是連結MAC層和PHY層的介面。區別在於編碼、速度、使用的腳位數、I/O clock的頻率不同。

MII:這是IEEE 802.3u制定出來,應用在Fast Ethernet上,連
接Data link layer中的MAC層和Physical Layer中的PHY層的溝通介面。全名為(Media Independent Interface)。
(這樣的說法有點瑕庛,因為Data link layer有分為MAC層和LLC層,但Physical Layer沒有分其它的層別,統稱為PHY層)

MII使用8B/10B之編碼。所以運作在125Mbps時,可以傳送包含檔頭的100Mbps的資料。
(想成有八條水管,同時有125Mbps的資料流進來,通過了一個闡道,要流到十條水管裡去,這十條水管的平均流速就是125Mbps*8/10=100Mbps。)

IC對PHY做讀寫的時候用一組訊號:MDC(Management Data Control)與MDIO(Management Data Input/Output)。
輸出和輸入各有四個bit的匯流排: Tx[0:3]、Rx[0:3](輸出是指IC到PHY、輸入是指PHY到IC)

MII對於Data Sampling reference用的兩組clock,頻率為25MHz,
這兩個訊號為Tx_CLK和Rx_CLK。(Ethernet頻率為2.5MHz)

通知對方準備輸入資料的輸出和輸入的啟動訊號為:Tx_EN、Rx_EN
輸出、輸入訊號的錯誤通知訊號為:Tx_ER、Rx_ER
得到有效輸入資料的通知訊號為:RX_DV
網路上出現擁塞的Colision訊號為:Col作為carrier回覆用的訊號為:CRS(請參考CSMA/CD)
MII實作的電路電壓可用+5V或是+3.3V

GMII: Gigabit Media Independent Interface,可支授到1Gbps,不同於MII,輸出和輸入各有8bit
Tx:GTXCLK、TxCLK、TxD[0:7]、TxEN、TxER
Rx:RxCLK、RxD[0:7]、RxDV、RxER、COL、CRS、MDC、MDIO

RGMII: Reduced Gigabit Media Independent Interface,顧名思義就是GMII的縮小版(因為減少了PIN腳位數)
和GMII一樣可以支援10/1O0/1000Mbps,只有定義12個訊號,比GMII還少一半:RxC、RxD[0:3]、Rx_CTL、TxC、TxD[0:3]、Tx_CTL

IC控制訊號一樣是透過MDC、MDIO

2010年10月20日 星期三

EtherType for some common protocols

EtherType Protocol
0x0800 Internet Protocol, Version 4 (IPv4)
0x0806 Address Resolution Protocol (ARP)
0x0842 Wake-on-LAN Magic Packet, as used by ether-wake and Sleep Proxy Service
0x1337 SYN-3 heartbeat protocol (SYNdog)
0x8035 Reverse Address Resolution Protocol (RARP)
0x809B AppleTalk (Ethertalk)
0x80F3 AppleTalk Address Resolution Protocol (AARP)
0x8100 VLAN-tagged frame (IEEE 802.1Q)
0x8137 Novell IPX (alt)
0x8138 Novell
0x86DD Internet Protocol, Version 6 (IPv6)
0x8808 MAC Control
0x8809 Slow Protocols (IEEE 802.3)
0x8819 CobraNet
0x8847 MPLS unicast
0x8848 MPLS multicast
0x8863 PPPoE Discovery Stage
0x8864 PPPoE Session Stage
0x886F Microsoft NLB heartbeat [3]
0x8870 Jumbo Frames
0x888E EAP over LAN (IEEE 802.1X)
0x8892 PROFINET Protocol
0x889A HyperSCSI (SCSI over Ethernet)
0x88A2 ATA over Ethernet
0x88A4 EtherCAT Protocol
0x88A8 Provider Bridging (IEEE 802.1ad)
0x88AB Ethernet Powerlink
0x88CC LLDP
0x88CD SERCOS III
0x88D8 Circuit Emulation Services over Ethernet (MEF-8)
0x88E1 HomePlug
0x88E5 MAC security (IEEE 802.1AE)
0x88F7 Precision Time Protocol (IEEE 1588)
0x8902 IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
0x8906 Fibre Channel over Ethernet
0x8914 FCoE Initialization Protocol
0x9100 Q-in-Q
0xCAFE Veritas Low Latency Transport (LLT)

2010年10月14日 星期四

Z Shell (zsh) 的特色 與 安裝



特色:

  1. Acts extremely similar to bash.
  2. Typo correction.
  3. Phenomenally intelligent tab completion.
安裝:

$ sudo yum install zsh
$ curl http://stuff.mit.edu/~jdong/misc/zshrc > ~/.zshrc
$ chsh -s /bin/zsh
 
P.S 須調整時區 將 .zshrc 中的 TZ 設為 Asia/Taipei 即可. 
 
REBOOT
 

2010年10月13日 星期三

Kismet

Kismet is an 802.11 layer2 wireless network detector, sniffer, and intrusion detection system. Kismet will work with any wireless card which supports raw monitoring (rfmon) mode, and (with appropriate hardware) can sniff 802.11b, 802.11a, 802.11g, and 802.11n traffic. Kismet also supports plugins which allow sniffing other media such as DECT.

Kismet identifies networks by passively collecting packets and detecting standard named networks, detecting (and given time, decloaking) hidden networks, and infering the presence of nonbeaconing networks via data traffic.

Kismet 是一個 802.11 layer2 的無線網路偵測、嗅探及入侵偵測系統,只要是 Linux 支援的無線網卡,幾乎都可以用。Kismet 可以 sniff 的封包有 802.11b/a/b/g/n。 




2010年10月6日 星期三

U-Boot Porting Guide

[Based on messages by Jerry Van Baren in the U-Boot-Users mailing
list, October 2002]


int main (int argc, char *argv[])
{
    sighandler_t no_more_time;

    signal (SIGALRM, no_more_time);
    alarm (PROJECT_DEADLINE - toSec (3 * WEEK));

    if (available_money > available_manpower) {
        pay consultant to port U-Boot;
        return 0;
    }

    Download latest U-Boot source;

    Subscribe to u-boot-users mailing list;

    if (clueless) {
        email ("Hi, I am new to U-Boot, how do I get started?");
    }

    while (learning) {
        Read the README file in the top level directory;
        Read http://www.denx.de/twiki/bin/view/DULG/Manual ;
        Read the source, Luke;
    }

    if (available_money > toLocalCurrency ($2500)) {
        Buy a BDI2000;
    } else {
        Add a lot of aggravation and time;
    }

    Create your own board support subdirectory;

    Create your own board config file;

    while (!running) {
        do {
            Add / modify source code;
        } until (compiles);
        Debug;
        if (clueless)
            email ("Hi, I am having problems...");
    }
    Send patch file to Wolfgang;

    return 0;
}

void no_more_time (int sig)
{
      hire_a_guru();
}

2010年10月5日 星期二

WinPcap

WinPcap是Windows平臺下一個專業網路資料包捕獲開發包,是為Libpcap在 Windows平臺下實現資料包的捕獲而設計的。在設計WinPcap時參照了Libpcap,使用方法與LibPcap相似。使用WinPcap開發 包,可以把在Linux下基於Libpcap的程式很容易地移植到Windows平臺下。WinPcap是在BSD許可證下發佈地,它主要由加利福尼亞地 Lawrence Berkeley Laboratory開發。WinPcap地下載網址為:http://winpcap.polito.it/ 。目前有不少軟體都使用了WinPcap開發包,其中最為著名的是Ethereal。它是一個免費的網路通訊協定分析軟體,其對資料包解析的細緻程度甚至 高於業界著名的Sniffer和WildPackets;

WinPcap有三個模組構成:
第一個模組NPF(Netgroup Packet Filter),是一個虛擬裝置驅動程式檔。它的功能是過濾資料包,並把這些資料包原封不動地傳給使用者態模組,這個過程中包括了一些作業系統特有的代 碼。
第二個模組packet.dll是一組用戶級的函式程式庫,為win32平臺提供了一個公共的介面。不同版本的Windows系統都有自己的 內核模組和使用者層模組。Packet.dll用於解決這些不同。調用Packet.dll的程式可以運行在不同版本的Windows平臺上,而無需重新 編譯。
第三個模組資料包高級驅動程式庫(wpcap.dll)與作業系統無關,它提供了更加高層、抽象的函數,含有諸如產生篩檢程式,用戶級緩衝 等高級功能。

How to repair and clone disk with ddrescue

  ddrescue  is a tool that can be used to repair and clone disks on a  Linux system . This includes hard drives, partitions, DVD discs, flas...