Subversion Repositories Kolibri OS

Rev

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

Rev 5522 Rev 6011
Line 12... Line 12...
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
12
;;          GNU GENERAL PUBLIC LICENSE                             ;;
13
;;             Version 2, June 1991                                ;;
13
;;             Version 2, June 1991                                ;;
14
;;                                                                 ;;
14
;;                                                                 ;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 16... Line 16...
16
 
16
 
Line 17... Line 17...
17
$Revision: 5522 $
17
$Revision: 6011 $
18
 
18
 
Line 19... Line 19...
19
ETH_FRAME_MINIMUM       = 60
19
ETH_FRAME_MINIMUM       = 60
Line 48... Line 48...
48
uglobal
48
uglobal
49
align 4
49
align 4
50
        ETH_input_event dd ?
50
        ETH_input_event dd ?
51
endg
51
endg
Line 52... Line 52...
52
 
52
 
Line 53... Line 53...
53
macro   ETH_init {
53
macro   eth_init {
54
 
54
 
55
        movi    ebx, 1
55
        movi    ebx, 1
56
        mov     ecx, ETH_process_input
56
        mov     ecx, eth_process_input
57
        call    new_sys_threads
57
        call    new_sys_threads
58
        test    eax, eax
58
        test    eax, eax
59
        jns     @f
59
        jns     @f
Line 60... Line 60...
60
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for ethernet, error %d\n', eax
60
        DEBUGF  DEBUG_NETWORK_ERROR,'K : cannot create kernel thread for ethernet, error %d\n', eax
Line 61... Line 61...
61
  @@:
61
  @@:
62
 
-
 
63
}
62
 
64
 
-
 
65
;-----------------------------------------------------------------
63
}
66
;
64
 
67
; ETH_input
-
 
-
 
65
;-----------------------------------------------------------------;
68
;
66
;                                                                 ;
69
;  This function is called by ethernet drivers,
-
 
-
 
67
; eth_input: This function is called by ethernet drivers.         ;
70
;  It pushes the received ethernet packets onto the ethernet input queue
68
; Push the received ethernet packet onto the ethernet input queue.;
71
;
-
 
-
 
69
;                                                                 ;
72
;  IN:  [esp] = Pointer to buffer
70
;  IN:  [esp] = Pointer to buffer                                 ;
73
;
71
;                                                                 ;
74
;  OUT: /
72
;  OUT: /                                                         ;
Line 75... Line 73...
75
;
73
;                                                                 ;
76
;-----------------------------------------------------------------
74
;-----------------------------------------------------------------;
77
align 4
75
align 4
Line 107... Line 105...
107
 
105
 
108
  .full:
106
  .full:
109
        DEBUGF  DEBUG_NETWORK_ERROR, "ETH incoming queue is full, discarding packet!\n"
107
        DEBUGF  DEBUG_NETWORK_ERROR, "ETH incoming queue is full, discarding packet!\n"
110
        popf
108
        popf
111
        push    eax
109
        push    eax
112
        call    NET_BUFF_free
110
        call    net_buff_free
Line -... Line 111...
-
 
111
        ret
-
 
112
 
-
 
113
 
-
 
114
 
-
 
115
;-----------------------------------------------------------------;
-
 
116
;                                                                 ;
113
        ret
-
 
-
 
117
; eth_process_input: Process packets from ethernet input queue.   ;
-
 
118
;                                                                 ;
-
 
119
;  IN:  /                                                         ;
114
 
120
;                                                                 ;
115
 
121
;  OUT: /                                                         ;
Line 116... Line 122...
116
 
122
;                                                                 ;
117
 
123
;-----------------------------------------------------------------;
118
align 4
124
align 4
119
ETH_process_input:
125
eth_process_input:
Line 161... Line 167...
161
        lea     edx, [eax + sizeof.ETH_header]
167
        lea     edx, [eax + sizeof.ETH_header]
162
        mov     ax, [eax + ETH_header.Type]
168
        mov     ax, [eax + ETH_header.Type]
Line 163... Line 169...
163
 
169
 
164
; Place protocol handlers here
170
; Place protocol handlers here
165
        cmp     ax, ETHER_PROTO_IPv4
171
        cmp     ax, ETHER_PROTO_IPv4
Line 166... Line 172...
166
        je      IPv4_input
172
        je      ipv4_input
167
 
173
 
Line 168... Line 174...
168
        cmp     ax, ETHER_PROTO_ARP
174
        cmp     ax, ETHER_PROTO_ARP
169
        je      ARP_input
175
        je      arp_input
Line 170... Line 176...
170
 
176
 
171
;        cmp     ax, ETHER_PROTO_IPv6
177
;        cmp     ax, ETHER_PROTO_IPv6
Line 172... Line 178...
172
;        je      IPv6_input
178
;        je      ipv6_input
173
 
179
 
Line 174... Line 180...
174
;        cmp     ax, ETHER_PROTO_PPP_DISCOVERY
180
;        cmp     ax, ETHER_PROTO_PPP_DISCOVERY
Line 175... Line 181...
175
;        je      PPPoE_discovery_input
181
;        je      pppoe_discovery_input
176
 
182
 
177
;        cmp     ax, ETHER_PROTO_PPP_SESSION
183
;        cmp     ax, ETHER_PROTO_PPP_SESSION
178
;        je      PPPoE_session_input
184
;        je      pppoe_session_input
Line 179... Line -...
179
 
-
 
180
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax
185
 
181
 
-
 
182
  .dump:
186
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: Unknown packet type=%x\n", ax
-
 
187
 
-
 
188
  .dump:
-
 
189
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: dumping\n"
-
 
190
        call    net_buff_free
183
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_input: dumping\n"
191
        ret
184
        call    NET_BUFF_free
192
 
185
        ret
193
 
186
 
194
 
187
;-----------------------------------------------------------------
-
 
-
 
195
;-----------------------------------------------------------------;
188
;
196
;                                                                 ;
189
; ETH_output
197
; eth_output                                                      ;
190
;
198
;                                                                 ;
191
; IN:  ax = protocol
199
;  IN:  ax = protocol                                             ;
192
;     ebx = device ptr
-
 
-
 
200
;       ebx = device ptr                                          ;
193
;     ecx = payload size
201
;       ecx = payload size                                        ;
194
;     edx = pointer to destination mac
202
;       edx = pointer to destination mac                          ;
195
;
203
;                                                                 ;
Line 196... Line 204...
196
; OUT: eax = start of net frame / 0 on error
204
;  OUT: eax = start of net frame / 0 on error                     ;
Line 197... Line 205...
197
;      ebx = device ptr
205
;       ebx = device ptr                                          ;
198
;      ecx = payload size
206
;       ecx = payload size                                        ;
Line 199... Line 207...
199
;      edi = start of payload
207
;       edi = start of payload                                    ;
200
;
208
;                                                                 ;
Line 201... Line 209...
201
;-----------------------------------------------------------------
209
;-----------------------------------------------------------------;
202
align 4
210
align 4
203
ETH_output:
211
eth_output:
204
 
212
 
205
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx
213
        DEBUGF  DEBUG_NETWORK_VERBOSE, "ETH_output: size=%u device=%x\n", ecx, ebx
206
 
214
 
207
        cmp     ecx, [ebx + ETH_DEVICE.mtu]
215
        cmp     ecx, [ebx + ETH_DEVICE.mtu]
Line 255... Line 263...
255
        xor     eax, eax
263
        xor     eax, eax
256
        ret
264
        ret
Line 257... Line 265...
257
 
265
 
258
 
-
 
259
 
-
 
260
;-----------------------------------------------------------------
-
 
-
 
266
 
261
;
267
 
262
; ETH_API
-
 
-
 
268
;-----------------------------------------------------------------;
263
;
269
;                                                                 ;
264
; This function is called by system function 76
270
; eth_api: Part of system function 76.                            ;
265
;
271
;                                                                 ;
266
; IN:  subfunction number in bl
-
 
-
 
272
;  IN:  bl = subfunction number                                   ;
267
;      device number in bh
273
;       bh = device number                                        ;
268
;      ecx, edx, .. depends on subfunction
-
 
-
 
274
;       ecx, edx, .. depends on subfunction                       ;
269
;
275
;                                                                 ;
270
; OUT:
276
; OUT:  depends on subfunction                                    ;
271
;
277
;                                                                 ;
Line 272... Line 278...
272
;-----------------------------------------------------------------
278
;-----------------------------------------------------------------;
273
align 4
279
align 4
274
ETH_api:
280
eth_api:
275
 
281