5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 #include <exec/types.h>
22 #include <exec/resident.h>
24 #include <exec/ports.h>
25 #include <exec/errors.h>
27 #include <devices/sana2.h>
28 #include <devices/sana2specialstats.h>
29 #include <devices/newstyle.h>
31 #include <utility/utility.h>
32 #include <utility/tagitem.h>
33 #include <utility/hooks.h>
35 #include <proto/exec.h>
36 #include <proto/dos.h>
37 #include <proto/battclock.h>
41 #include "e1000_osdep.h"
43 #include "e1000_defines.h"
44 #include "e1000_api.h"
47 #include LC_LIBDEFS_FILE
49 #define KNOWN_EVENTS \
50 (S2EVENT_ERROR | S2EVENT_TX | S2EVENT_RX | S2EVENT_ONLINE \
51 | S2EVENT_OFFLINE | S2EVENT_BUFF | S2EVENT_HARDWARE | S2EVENT_SOFTWARE)
53 static BOOL
CmdInvalid(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
54 static BOOL
CmdRead(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
55 static BOOL
CmdWrite(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
56 static BOOL
CmdFlush(LIBBASETYPEPTR LIBBASE
, struct IORequest
*request
);
57 static BOOL
CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
58 static BOOL
CmdGetStationAddress(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
59 static BOOL
CmdConfigInterface(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
60 static BOOL
CmdBroadcast(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
61 static BOOL
CmdTrackType(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
62 static BOOL
CmdUntrackType(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
63 static BOOL
CmdGetTypeStats(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
64 static BOOL
CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
65 static BOOL
CmdDeviceQuery(LIBBASETYPEPTR LIBBASE
, struct IOStdReq
*request
);
66 static BOOL
CmdOnEvent(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
67 static BOOL
CmdReadOrphan(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
68 static BOOL
CmdOnline(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
69 static BOOL
CmdOffline(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
70 static BOOL
CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
71 static BOOL
CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
);
73 static const UWORD supported_commands
[] =
81 S2_ADDMULTICASTADDRESS
,
82 S2_DELMULTICASTADDRESS
,
88 // S2_GETSPECIALSTATS,
95 S2_ADDMULTICASTADDRESSES
,
96 S2_DELMULTICASTADDRESSES
,
100 void handle_request(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
104 switch(request
->ios2_Req
.io_Command
)
107 complete
= CmdRead(LIBBASE
, request
);
112 complete
= CmdWrite(LIBBASE
, request
);
116 complete
= CmdFlush(LIBBASE
, (struct IORequest
*)request
);
120 complete
= CmdS2DeviceQuery(LIBBASE
, request
);
123 case S2_GETSTATIONADDRESS
:
124 complete
= CmdGetStationAddress(LIBBASE
, request
);
127 case S2_CONFIGINTERFACE
:
128 complete
= CmdConfigInterface(LIBBASE
, request
);
132 complete
= CmdBroadcast(LIBBASE
, request
);
136 complete
= CmdTrackType(LIBBASE
, request
);
140 complete
= CmdUntrackType(LIBBASE
, request
);
143 case S2_GETTYPESTATS
:
144 complete
= CmdGetTypeStats(LIBBASE
, request
);
147 case S2_GETGLOBALSTATS
:
148 complete
= CmdGetGlobalStats(LIBBASE
, request
);
152 complete
= CmdOnEvent(LIBBASE
, request
);
156 complete
= CmdReadOrphan(LIBBASE
, request
);
160 complete
= CmdOnline(LIBBASE
, request
);
164 complete
= CmdOffline(LIBBASE
, request
);
167 case S2_ADDMULTICASTADDRESS
:
168 case S2_ADDMULTICASTADDRESSES
:
169 complete
= CmdAddMulticastAddresses(LIBBASE
, request
);
172 case S2_DELMULTICASTADDRESS
:
173 case S2_DELMULTICASTADDRESSES
:
174 complete
= CmdDelMulticastAddresses(LIBBASE
, request
);
177 case NSCMD_DEVICEQUERY
:
178 complete
= CmdDeviceQuery(LIBBASE
, (struct IOStdReq
*)request
);
182 complete
= CmdInvalid(LIBBASE
, request
);
185 if(complete
&& (request
->ios2_Req
.io_Flags
& IOF_QUICK
) == 0)
186 ReplyMsg((APTR
)request
);
188 ReleaseSemaphore(&((struct e1000Unit
*)request
->ios2_Req
.io_Unit
)->e1ku_unit_lock
);
191 static BOOL
CmdInvalid(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
193 request
->ios2_Req
.io_Error
= IOERR_NOCMD
;
194 request
->ios2_WireError
= S2WERR_GENERIC_ERROR
;
199 static BOOL
CmdRead(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
201 struct e1000Unit
*unit
;
202 struct Opener
*opener
;
203 BOOL complete
= FALSE
;
205 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
207 D(bug("[%s]: CmdRead()\n", unit
->e1ku_name
));
209 if((unit
->e1ku_ifflags
& IFF_UP
) != 0)
211 opener
= request
->ios2_BufferManagement
;
212 request
->ios2_Req
.io_Flags
&= ~IOF_QUICK
;
213 PutMsg(&opener
->read_port
, (struct Message
*)request
);
217 request
->ios2_Req
.io_Error
= S2ERR_OUTOFSERVICE
;
218 request
->ios2_WireError
= S2WERR_UNIT_OFFLINE
;
227 static BOOL
CmdWrite(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
229 struct e1000Unit
*unit
;
231 ULONG wire_error
= S2WERR_GENERIC_ERROR
;
232 BOOL complete
= FALSE
;
234 /* Check request is valid */
236 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
238 D(bug("[%s]: CmdWrite()\n", unit
->e1ku_name
));
240 if((unit
->e1ku_ifflags
& IFF_UP
) == 0)
242 error
= S2ERR_OUTOFSERVICE
;
243 wire_error
= S2WERR_UNIT_OFFLINE
;
245 else if((request
->ios2_Req
.io_Command
== S2_MULTICAST
) &&
246 ((request
->ios2_DstAddr
[0] & 0x1) == 0))
248 error
= S2ERR_BAD_ADDRESS
;
249 wire_error
= S2WERR_BAD_MULTICAST
;
252 /* Queue request for sending */
255 request
->ios2_Req
.io_Flags
&= ~IOF_QUICK
;
256 PutMsg(unit
->e1ku_request_ports
[WRITE_QUEUE
], (APTR
)request
);
260 request
->ios2_Req
.io_Error
= error
;
261 request
->ios2_WireError
= wire_error
;
270 static BOOL
CmdFlush(LIBBASETYPEPTR LIBBASE
, struct IORequest
*request
)
272 FlushUnit(LIBBASE
, (APTR
)request
->io_Unit
, EVENT_QUEUE
, IOERR_ABORTED
);
276 static BOOL
CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
278 struct e1000Unit
*unit
= (APTR
)request
->ios2_Req
.io_Unit
;
279 struct Sana2DeviceQuery
*info
;
280 ULONG size_available
, size
;
281 UWORD lnk_speed
= 0, lnk_duplex
= 0;
282 D(bug("[%s]: CmdS2DeviceQuery()\n", unit
->e1ku_name
));
284 /* Copy device info */
285 info
= request
->ios2_StatData
;
286 size
= size_available
= info
->SizeAvailable
;
287 if(size
> sizeof(struct Sana2DeviceQuery
))
288 size
= sizeof(struct Sana2DeviceQuery
);
290 CopyMem(&unit
->e1ku_Sana2Info
, info
, size
);
292 e1000_get_speed_and_duplex((struct e1000_hw
*)unit
->e1ku_Private00
, &lnk_speed
, &lnk_duplex
);
294 info
->BPS
= (1000000 * lnk_speed
);
295 info
->MTU
= unit
->e1ku_mtu
;
296 info
->HardwareType
= S2WireType_Ethernet
;
297 info
->SizeAvailable
= size_available
;
298 info
->SizeSupplied
= size
;
305 static BOOL
CmdGetStationAddress(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
307 struct e1000Unit
*unit
;
311 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
313 D(bug("[%s]: CmdGetStationAddress()\n", unit
->e1ku_name
));
315 CopyMem(unit
->e1ku_dev_addr
, request
->ios2_SrcAddr
, ETH_ADDRESSSIZE
);
316 CopyMem(unit
->e1ku_org_addr
, request
->ios2_DstAddr
, ETH_ADDRESSSIZE
);
323 static BOOL
CmdConfigInterface(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
325 struct e1000Unit
*unit
;
327 /* Configure adapter */
329 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
331 D(bug("[%s]: CmdConfigInterface()\n", unit
->e1ku_name
));
333 if((unit
->e1ku_ifflags
& IFF_CONFIGURED
) == 0)
335 CopyMem(request
->ios2_SrcAddr
, unit
->e1ku_dev_addr
, ETH_ADDRESSSIZE
);
336 e1000func_set_mac(unit
);
337 unit
->e1ku_ifflags
|= IFF_CONFIGURED
;
341 request
->ios2_Req
.io_Error
= S2ERR_BAD_STATE
;
342 request
->ios2_WireError
= S2WERR_IS_CONFIGURED
;
350 static BOOL
CmdBroadcast(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
352 /* Fill in the broadcast address as destination */
353 memset(request
->ios2_DstAddr
, 0xff, SANA2_MAX_ADDR_BYTES
);
355 /* Queue the write as normal */
357 return CmdWrite(LIBBASE
, request
);
360 static BOOL
CmdTrackType(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
362 struct e1000Unit
*unit
;
363 struct Opener
*opener
;
364 ULONG packet_type
, wire_error
=0;
365 struct TypeTracker
*tracker
;
366 struct TypeStats
*initial_stats
;
369 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
371 D(bug("[%s]: CmdTrackType()\n", unit
->e1ku_name
));
373 packet_type
= request
->ios2_PacketType
;
375 /* Get global tracker */
377 tracker
= (struct TypeTracker
*)
378 FindTypeStats(LIBBASE
, unit
, &unit
->e1ku_type_trackers
, packet_type
);
381 tracker
->user_count
++;
385 AllocMem(sizeof(struct TypeTracker
), MEMF_PUBLIC
|MEMF_CLEAR
);
388 tracker
->packet_type
= packet_type
;
389 tracker
->user_count
= 1;
392 AddTail((APTR
)&unit
->e1ku_type_trackers
, (APTR
)tracker
);
397 /* Store initial figures for this opener */
399 opener
= request
->ios2_BufferManagement
;
400 initial_stats
= FindTypeStats(LIBBASE
, unit
, &opener
->initial_stats
, packet_type
);
402 if(initial_stats
!= NULL
)
404 error
= S2ERR_BAD_STATE
;
405 wire_error
= S2WERR_ALREADY_TRACKED
;
410 initial_stats
= AllocMem(sizeof(struct TypeStats
), MEMF_PUBLIC
);
411 if(initial_stats
== NULL
)
413 error
= S2ERR_NO_RESOURCES
;
414 wire_error
= S2WERR_GENERIC_ERROR
;
420 CopyMem(tracker
, initial_stats
, sizeof(struct TypeStats
));
421 AddTail((APTR
)&opener
->initial_stats
, (APTR
)initial_stats
);
426 request
->ios2_Req
.io_Error
= error
;
427 request
->ios2_WireError
= wire_error
;
431 static BOOL
CmdUntrackType(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
433 struct e1000Unit
*unit
;
434 struct Opener
*opener
;
436 struct TypeTracker
*tracker
;
437 struct TypeStats
*initial_stats
;
439 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
441 D(bug("[%s]: CmdUntrackType()\n", unit
->e1ku_name
));
443 packet_type
= request
->ios2_PacketType
;
445 /* Get global tracker and initial figures */
447 tracker
= (struct TypeTracker
*)
448 FindTypeStats(LIBBASE
, unit
, &unit
->e1ku_type_trackers
, packet_type
);
449 opener
= request
->ios2_BufferManagement
;
450 initial_stats
= FindTypeStats(LIBBASE
, unit
, &opener
->initial_stats
, packet_type
);
452 /* Decrement tracker usage and free unused structures */
454 if(initial_stats
!= NULL
)
456 if((--tracker
->user_count
) == 0)
459 Remove((APTR
)tracker
);
461 FreeMem(tracker
, sizeof(struct TypeTracker
));
464 Remove((APTR
)initial_stats
);
465 FreeMem(initial_stats
, sizeof(struct TypeStats
));
469 request
->ios2_Req
.io_Error
= S2ERR_BAD_STATE
;
470 request
->ios2_WireError
= S2WERR_NOT_TRACKED
;
478 static BOOL
CmdGetTypeStats(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
480 struct e1000Unit
*unit
;
481 struct Opener
*opener
;
483 struct TypeStats
*initial_stats
, *tracker
;
484 struct Sana2PacketTypeStats
*stats
;
486 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
488 D(bug("[%s]: CmdGetTypeStats()\n", unit
->e1ku_name
));
490 packet_type
= request
->ios2_PacketType
;
492 /* Get global tracker and initial figures */
494 tracker
= FindTypeStats(LIBBASE
, unit
, &unit
->e1ku_type_trackers
, packet_type
);
495 opener
= request
->ios2_BufferManagement
;
496 initial_stats
= FindTypeStats(LIBBASE
, unit
, &opener
->initial_stats
, packet_type
);
498 /* Copy and adjust figures */
499 if(initial_stats
!= NULL
)
501 stats
= request
->ios2_StatData
;
502 CopyMem(&tracker
->stats
, stats
, sizeof(struct Sana2PacketTypeStats
));
503 stats
->PacketsSent
-= initial_stats
->stats
.PacketsSent
;
504 stats
->PacketsReceived
-= initial_stats
->stats
.PacketsReceived
;
505 stats
->BytesSent
-= initial_stats
->stats
.BytesSent
;
506 stats
->BytesReceived
-= initial_stats
->stats
.BytesReceived
;
507 stats
->PacketsDropped
-= initial_stats
->stats
.PacketsDropped
;
511 request
->ios2_Req
.io_Error
= S2ERR_BAD_STATE
;
512 request
->ios2_WireError
= S2WERR_NOT_TRACKED
;
520 static BOOL
CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
522 struct e1000Unit
*unit
;
524 /* Update and copy stats */
526 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
528 D(bug("[%s]: CmdGetGlobalStats()\n", unit
->e1ku_name
));
530 CopyMem(&unit
->e1ku_stats
, request
->ios2_StatData
,
531 sizeof(struct Sana2DeviceStats
));
538 static BOOL
CmdDeviceQuery(LIBBASETYPEPTR LIBBASE
, struct IOStdReq
*request
)
540 struct NSDeviceQueryResult
*info
;
542 /* Set structure size twice */
544 info
= request
->io_Data
;
545 request
->io_Actual
= info
->SizeAvailable
=
546 offsetof(struct NSDeviceQueryResult
, SupportedCommands
) + sizeof(APTR
);
548 /* Report device details */
550 info
->DeviceType
= NSDEVTYPE_SANA2
;
551 info
->DeviceSubType
= 0;
553 info
->SupportedCommands
= (APTR
)supported_commands
;
560 static BOOL
CmdOnEvent(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
562 struct e1000Unit
*unit
;
563 ULONG events
, wanted_events
;
564 BOOL complete
= FALSE
;
566 /* Check if we understand the event types */
568 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
569 D(bug("[%s]: CmdOnEvent()\n", unit
->e1ku_name
));
571 wanted_events
= request
->ios2_WireError
;
572 if((wanted_events
& ~KNOWN_EVENTS
) != 0)
574 request
->ios2_Req
.io_Error
= S2ERR_NOT_SUPPORTED
;
575 events
= S2WERR_BAD_EVENT
;
579 if((unit
->e1ku_ifflags
& IFF_UP
) != 0)
580 events
= S2EVENT_ONLINE
;
582 events
= S2EVENT_OFFLINE
;
584 events
&= wanted_events
;
587 /* Reply request if a wanted event has already occurred */
591 request
->ios2_WireError
= events
;
596 request
->ios2_Req
.io_Flags
&= ~IOF_QUICK
;
597 PutMsg(unit
->e1ku_request_ports
[EVENT_QUEUE
], (APTR
)request
);
605 static BOOL
CmdReadOrphan(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
607 struct e1000Unit
*unit
;
610 BOOL complete
= FALSE
;
612 /* Check request is valid */
614 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
615 D(bug("[%s]: CmdReadOrphan()\n", unit
->e1ku_name
));
617 if((unit
->e1ku_ifflags
& IFF_UP
) == 0)
619 error
= S2ERR_OUTOFSERVICE
;
620 wire_error
= S2WERR_UNIT_OFFLINE
;
627 request
->ios2_Req
.io_Flags
&= ~IOF_QUICK
;
628 PutMsg(unit
->e1ku_request_ports
[ADOPT_QUEUE
], (struct Message
*)request
);
632 request
->ios2_Req
.io_Error
= error
;
633 request
->ios2_WireError
= wire_error
;
642 static BOOL
CmdOnline(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
644 struct e1000Unit
*unit
= (struct e1000Unit
*)request
->ios2_Req
.io_Unit
;
645 ULONG wire_error
= 0, rctl
, tctl
;
649 D(bug("[%s]: CmdOnline()\n", unit
->e1ku_name
));
651 /* Check request is valid */
652 if((unit
->e1ku_ifflags
& IFF_CONFIGURED
) == 0)
654 error
= S2ERR_BAD_STATE
;
655 wire_error
= S2WERR_NOT_CONFIGURED
;
658 /* Clear global and special stats and put adapter back online */
660 if((error
== 0) && ((unit
->e1ku_ifflags
& IFF_UP
) == 0))
662 unit
->e1ku_stats
.PacketsReceived
= 0;
663 unit
->e1ku_stats
.PacketsSent
= 0;
664 unit
->e1ku_stats
.BadData
= 0;
665 unit
->e1ku_stats
.Overruns
= 0;
666 unit
->e1ku_stats
.UnknownTypesReceived
= 0;
667 unit
->e1ku_stats
.Reconfigurations
= 0;
669 for(i
= 0; i
< SANA2_SPECIAL_STAT_COUNT
; i
++)
670 unit
->e1ku_special_stats
[i
] = 0;
672 tctl
= E1000_READ_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_TCTL
);
673 tctl
|= E1000_TCTL_EN
;
674 E1000_WRITE_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_TCTL
, tctl
);
676 rctl
= E1000_READ_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_RCTL
);
677 rctl
|= E1000_RCTL_EN
;
678 E1000_WRITE_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_RCTL
, rctl
);
680 e1000func_irq_enable(unit
);
682 D(bug("[%s]: CmdOnline: Causing Link Status Change..\n", unit
->e1ku_name
));
683 /* fire a link status change interrupt to start the watchdog */
684 E1000_WRITE_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_ICS
, E1000_ICS_LSC
);
686 D(bug("[%s]: CmdOnline: Reporting Interface is ONLINE..\n", unit
->e1ku_name
));
687 unit
->e1ku_ifflags
|= IFF_UP
;
688 ReportEvents(LIBBASE
, unit
, S2EVENT_ONLINE
);
693 request
->ios2_Req
.io_Error
= error
;
694 request
->ios2_WireError
= wire_error
;
698 static BOOL
CmdOffline(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
700 struct e1000Unit
*unit
;
702 /* Put adapter offline */
704 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
706 D(bug("[%s]: CmdOffline()\n", unit
->e1ku_name
));
708 if((unit
->e1ku_ifflags
& IFF_UP
) != 0)
710 unit
->e1ku_ifflags
&= ~IFF_UP
;
712 tctl
= E1000_READ_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_TCTL
);
713 tctl
&= ~E1000_TCTL_EN
;
714 E1000_WRITE_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_TCTL
, tctl
);
716 rctl
= E1000_READ_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_RCTL
);
717 rctl
&= ~E1000_RCTL_EN
;
718 E1000_WRITE_REG((struct e1000_hw
*)unit
->e1ku_Private00
, E1000_RCTL
, rctl
);
720 e1000func_irq_disable(unit
);
722 D(bug("[%s]: CmdOnline: Reporting Interface is OFFLINE..\n", unit
->e1ku_name
));
724 ReportEvents(LIBBASE
, unit
, S2EVENT_OFFLINE
);
731 static BOOL
CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
733 struct e1000Unit
*unit
;
734 UBYTE
*lower_bound
, *upper_bound
;
736 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
738 D(bug("[%s]: CmdAddMulticastAddresses()\n", unit
->e1ku_name
));
740 lower_bound
= request
->ios2_SrcAddr
;
741 if(request
->ios2_Req
.io_Command
== S2_ADDMULTICASTADDRESS
)
742 upper_bound
= lower_bound
;
744 upper_bound
= request
->ios2_DstAddr
;
746 if(!AddMulticastRange(LIBBASE
, unit
, lower_bound
, upper_bound
))
748 request
->ios2_Req
.io_Error
= S2ERR_NO_RESOURCES
;
749 request
->ios2_WireError
= S2WERR_GENERIC_ERROR
;
757 static BOOL
CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE
, struct IOSana2Req
*request
)
759 struct e1000Unit
*unit
;
760 UBYTE
*lower_bound
, *upper_bound
;
762 unit
= (APTR
)request
->ios2_Req
.io_Unit
;
764 D(bug("[%s]: CmdDelMulticastAddresses()\n", unit
->e1ku_name
));
766 lower_bound
= request
->ios2_SrcAddr
;
767 if(request
->ios2_Req
.io_Command
== S2_DELMULTICASTADDRESS
)
768 upper_bound
= lower_bound
;
770 upper_bound
= request
->ios2_DstAddr
;
772 if(!RemMulticastRange(LIBBASE
, unit
, lower_bound
, upper_bound
))
774 request
->ios2_Req
.io_Error
= S2ERR_BAD_STATE
;
775 request
->ios2_WireError
= S2WERR_BAD_MULTICAST
;