Subversion Repositories Kolibri OS

Rev

Rev 3908 | Rev 5201 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3908 Rev 4265
Line 15... Line 15...
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
$Revision: 3346 $
17
$Revision: 3346 $
-
 
18
 
Line 18... Line 19...
18
 
19
ETH_FRAME_MINIMUM       = 60
Line 19... Line 20...
19
ETH_FRAME_MINIMUM       = 60
20
ETH_QUEUE_SIZE          = 255
20
 
21
 
Line 30... Line 31...
30
 
31
 
Line 31... Line 32...
31
        mac             dp ?
32
        mac             dp ?
Line -... Line 33...
-
 
33
 
-
 
34
ends
-
 
35
 
-
 
36
struct  ETH_queue_entry
-
 
37
 
-
 
38
        device          dd ?
-
 
39
        packet          dd ?
-
 
40
        size            dd ?
32
 
41
 
33
ends
42
ends
Line 34... Line 43...
34
 
43
 
35
iglobal
44
iglobal
Line -... Line 45...
-
 
45
align 4
-
 
46
 
-
 
47
        ETH_BROADCAST   dp  0xffffffffffff
-
 
48
endg
-
 
49
 
-
 
50
uglobal
-
 
51
align 4
-
 
52
        ETH_input_event dd ?
-
 
53
        ETH_queue       rd (ETH_QUEUE_SIZE*sizeof.ETH_queue_entry + sizeof.queue)/4
-
 
54
endg
-
 
55
 
-
 
56
macro   ETH_init {
-
 
57
 
-
 
58
        init_queue ETH_queue
-
 
59
 
-
 
60
        movi    ebx, 1
-
 
61
        mov     ecx, ETH_process_input
-
 
62
        call    new_sys_threads
-
 
63
        test    eax, eax
-
 
64
        jns     @f
36
align 4
65
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for ethernet, error %d\n', eax
37
 
66
  @@:
38
        ETH_BROADCAST   dp  0xffffffffffff
67
 
39
endg
68
}
40
 
69
 
Line 51... Line 80...
51
;  OUT: /
80
;  OUT: /
52
;
81
;
53
;-----------------------------------------------------------------
82
;-----------------------------------------------------------------
54
align 4
83
align 4
55
ETH_input:
84
ETH_input:
-
 
85
 
-
 
86
        push    ebx
56
        mov     eax, [esp]
87
        mov     esi, esp
-
 
88
 
-
 
89
        pushf
-
 
90
        cli
-
 
91
        add_to_queue ETH_queue, ETH_QUEUE_SIZE, sizeof.ETH_queue_entry, .fail
-
 
92
        popf
-
 
93
 
-
 
94
        add     esp, sizeof.ETH_queue_entry
-
 
95
 
-
 
96
        xor     edx, edx
-
 
97
        mov     eax, [ETH_input_event]
-
 
98
        mov     ebx, [eax + EVENT.id]
-
 
99
        xor     esi, esi
-
 
100
        call    raise_event
-
 
101
 
-
 
102
        ret
-
 
103
 
-
 
104
  .fail:
-
 
105
        popf
-
 
106
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH incoming queue is full, discarding packet!\n"
-
 
107
 
-
 
108
        add     esp, sizeof.ETH_queue_entry - 8
-
 
109
        call    NET_packet_free
-
 
110
        add     esp, 4
-
 
111
 
-
 
112
        ret
-
 
113
 
-
 
114
 
-
 
115
 
-
 
116
 
-
 
117
align 4
-
 
118
ETH_process_input:
-
 
119
 
57
        mov     ecx, [esp+4]
120
        xor     esi, esi
-
 
121
        mov     ecx, MANUAL_DESTROY
-
 
122
        call    create_event
-
 
123
        mov     [ETH_input_event], eax
-
 
124
 
-
 
125
  .wait:
-
 
126
        mov     eax, [ETH_input_event]
-
 
127
        mov     ebx, [eax + EVENT.id]
-
 
128
        call    wait_event
-
 
129
 
-
 
130
  .loop:
-
 
131
        get_from_queue ETH_queue, ETH_QUEUE_SIZE, sizeof.ETH_queue_entry, .wait
-
 
132
 
-
 
133
        mov     eax, [esi + ETH_queue_entry.packet]
-
 
134
        mov     ecx, [esi + ETH_queue_entry.size]
-
 
135
        mov     ebx, [esi + ETH_queue_entry.device]
-
 
136
 
-
 
137
        pushd   .loop   ; return address
-
 
138
        push    ecx eax
Line 58... Line 139...
58
 
139
 
59
        DEBUGF  DEBUG_NETWORK_VERBOSE,"ETH_input: size=%u\n", ecx
140
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: size=%u\n", ecx
60
        sub     ecx, sizeof.ETH_header
141
        sub     ecx, sizeof.ETH_header
Line 76... Line 157...
76
        je      PPPoE_discovery_input
157
        je      PPPoE_discovery_input
Line 77... Line 158...
77
 
158
 
78
        cmp     ax, ETHER_PROTO_PPP_SESSION
159
        cmp     ax, ETHER_PROTO_PPP_SESSION
Line 79... Line 160...
79
        je      PPPoE_session_input
160
        je      PPPoE_session_input
Line 80... Line 161...
80
 
161
 
81
        DEBUGF  DEBUG_NETWORK_ERROR, "ETH_input: Unknown packet type=%x\n", ax
162
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax
82
 
163
 
83
  .dump:
164
  .dump: