revert between 56095 -> 55830 in arch
[AROS.git] / workbench / devs / networks / emac / handler.c
blobfe3a75d21ccac43157a9855954de968d3dce1fc2
1 /*
2 This program is free software; you can redistribute it and/or modify
3 it under the terms of the GNU General Public License as published by
4 the Free Software Foundation; either version 2 of the License, or
5 (at your option) any later version.
7 This program is distributed in the hope that it will be useful, but
8 WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
15 MA 02111-1307, USA.
18 #define DEBUG 1
19 #include <aros/debug.h>
21 #include <exec/types.h>
22 #include <exec/resident.h>
23 #include <exec/io.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>
39 #include <stdlib.h>
41 #include "emac.h"
42 #include LC_LIBDEFS_FILE
44 #define KNOWN_EVENTS \
45 (S2EVENT_ERROR | S2EVENT_TX | S2EVENT_RX | S2EVENT_ONLINE \
46 | S2EVENT_OFFLINE | S2EVENT_BUFF | S2EVENT_HARDWARE | S2EVENT_SOFTWARE)
48 static BOOL CmdInvalid(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
49 static BOOL CmdRead(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
50 static BOOL CmdWrite(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
51 static BOOL CmdFlush(LIBBASETYPEPTR LIBBASE, struct IORequest *request);
52 static BOOL CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
53 static BOOL CmdGetStationAddress(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
54 static BOOL CmdConfigInterface(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
55 static BOOL CmdBroadcast(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
56 static BOOL CmdTrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
57 static BOOL CmdUntrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
58 static BOOL CmdGetTypeStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
59 static BOOL CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
60 static BOOL CmdDeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOStdReq *request);
61 static BOOL CmdOnEvent(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
62 static BOOL CmdReadOrphan(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
63 static BOOL CmdOnline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
64 static BOOL CmdOffline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
65 static BOOL CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
66 static BOOL CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
68 static const UWORD supported_commands[] =
70 CMD_READ,
71 CMD_WRITE,
72 CMD_FLUSH,
73 S2_DEVICEQUERY,
74 S2_GETSTATIONADDRESS,
75 S2_CONFIGINTERFACE,
76 S2_ADDMULTICASTADDRESS,
77 S2_DELMULTICASTADDRESS,
78 S2_MULTICAST,
79 S2_BROADCAST,
80 S2_TRACKTYPE,
81 S2_UNTRACKTYPE,
82 S2_GETTYPESTATS,
83 // S2_GETSPECIALSTATS,
84 S2_GETGLOBALSTATS,
85 S2_ONEVENT,
86 S2_READORPHAN,
87 S2_ONLINE,
88 S2_OFFLINE,
89 NSCMD_DEVICEQUERY,
90 S2_ADDMULTICASTADDRESSES,
91 S2_DELMULTICASTADDRESSES,
95 void handle_request(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
97 BOOL complete;
99 switch(request->ios2_Req.io_Command)
101 case CMD_READ:
102 complete = CmdRead(LIBBASE, request);
103 break;
105 case CMD_WRITE:
106 case S2_MULTICAST:
107 complete = CmdWrite(LIBBASE, request);
108 break;
110 case CMD_FLUSH:
111 complete = CmdFlush(LIBBASE, (struct IORequest *)request);
112 break;
114 case S2_DEVICEQUERY:
115 complete = CmdS2DeviceQuery(LIBBASE, request);
116 break;
118 case S2_GETSTATIONADDRESS:
119 complete = CmdGetStationAddress(LIBBASE, request);
120 break;
122 case S2_CONFIGINTERFACE:
123 complete = CmdConfigInterface(LIBBASE, request);
124 break;
126 case S2_BROADCAST:
127 complete = CmdBroadcast(LIBBASE, request);
128 break;
130 case S2_TRACKTYPE:
131 complete = CmdTrackType(LIBBASE, request);
132 break;
134 case S2_UNTRACKTYPE:
135 complete = CmdUntrackType(LIBBASE, request);
136 break;
138 case S2_GETTYPESTATS:
139 complete = CmdGetTypeStats(LIBBASE, request);
140 break;
142 case S2_GETGLOBALSTATS:
143 complete = CmdGetGlobalStats(LIBBASE, request);
144 break;
146 case S2_ONEVENT:
147 complete = CmdOnEvent(LIBBASE, request);
148 break;
150 case S2_READORPHAN:
151 complete = CmdReadOrphan(LIBBASE, request);
152 break;
154 case S2_ONLINE:
155 complete = CmdOnline(LIBBASE, request);
156 break;
158 case S2_OFFLINE:
159 complete = CmdOffline(LIBBASE, request);
160 break;
162 case S2_ADDMULTICASTADDRESS:
163 case S2_ADDMULTICASTADDRESSES:
164 complete = CmdAddMulticastAddresses(LIBBASE, request);
165 break;
167 case S2_DELMULTICASTADDRESS:
168 case S2_DELMULTICASTADDRESSES:
169 complete = CmdDelMulticastAddresses(LIBBASE, request);
170 break;
172 case NSCMD_DEVICEQUERY:
173 complete = CmdDeviceQuery(LIBBASE, (struct IOStdReq *)request);
174 break;
176 default:
177 complete = CmdInvalid(LIBBASE, request);
180 if(complete && (request->ios2_Req.io_Flags & IOF_QUICK) == 0)
181 ReplyMsg((APTR)request);
183 ReleaseSemaphore(&((struct EMACUnit *)request->ios2_Req.io_Unit)->eu_Lock);
186 static BOOL CmdInvalid(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
188 request->ios2_Req.io_Error = IOERR_NOCMD;
189 request->ios2_WireError = S2WERR_GENERIC_ERROR;
191 return TRUE;
194 static BOOL CmdRead(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
196 struct EMACUnit *unit;
197 struct Opener *opener;
198 BOOL complete = FALSE;
200 unit = (APTR)request->ios2_Req.io_Unit;
202 D(bug("[EMAC%d] S2CmdRead()\n", unit->eu_UnitNum));
204 if((unit->eu_Flags & IFF_UP) != 0)
206 opener = request->ios2_BufferManagement;
207 request->ios2_Req.io_Flags &= ~IOF_QUICK;
208 PutMsg(&opener->read_port, (struct Message *)request);
210 else
212 request->ios2_Req.io_Error = S2ERR_OUTOFSERVICE;
213 request->ios2_WireError = S2WERR_UNIT_OFFLINE;
214 complete = TRUE;
217 /* Return */
219 return complete;
222 static BOOL CmdWrite(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
224 struct EMACUnit *unit;
225 BYTE error = 0;
226 ULONG wire_error = S2WERR_GENERIC_ERROR;
227 BOOL complete = FALSE;
229 /* Check request is valid */
231 unit = (APTR)request->ios2_Req.io_Unit;
233 D(bug("[EMAC%d] S2CmdWrite()\n", unit->eu_UnitNum));
235 if((unit->eu_Flags & IFF_UP) == 0)
237 error = S2ERR_OUTOFSERVICE;
238 wire_error = S2WERR_UNIT_OFFLINE;
240 else if((request->ios2_Req.io_Command == S2_MULTICAST) &&
241 ((request->ios2_DstAddr[0] & 0x1) == 0))
243 error = S2ERR_BAD_ADDRESS;
244 wire_error = S2WERR_BAD_MULTICAST;
247 /* Queue request for sending */
249 if(error == 0) {
250 request->ios2_Req.io_Flags &= ~IOF_QUICK;
251 PutMsg(unit->eu_RequestPorts[WRITE_QUEUE], (APTR)request);
253 else
255 request->ios2_Req.io_Error = error;
256 request->ios2_WireError = wire_error;
257 complete = TRUE;
260 /* Return */
262 return complete;
265 static BOOL CmdFlush(LIBBASETYPEPTR LIBBASE, struct IORequest *request)
267 // TODO: Implement CmdFlush!!!!!!!!!
268 // FlushUnit(LIBBASE, (APTR)request->io_Unit, EVENT_QUEUE, IOERR_ABORTED);
269 return TRUE;
272 static BOOL CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
274 struct EMACUnit *unit = (APTR)request->ios2_Req.io_Unit;
275 //struct fe_priv *np = unit->pcnu_fe_priv;
276 struct Sana2DeviceQuery *info;
277 ULONG size_available, size;
279 D(bug("[EMAC%d] S2CmdDeviceQuery()\n", unit->eu_UnitNum));
281 /* Copy device info */
283 info = request->ios2_StatData;
284 size = size_available = info->SizeAvailable;
285 if(size > sizeof(struct Sana2DeviceQuery))
286 size = sizeof(struct Sana2DeviceQuery);
288 CopyMem(&LIBBASE->emb_Sana2Info, info, size);
290 info->BPS = 100000000;
291 info->MTU = ETH_MTU;
292 info->HardwareType = S2WireType_Ethernet;
293 info->SizeAvailable = size_available;
294 info->SizeSupplied = size;
296 /* Return */
298 return TRUE;
301 static BOOL CmdGetStationAddress(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
303 struct EMACUnit *unit;
305 /* Copy addresses */
307 unit = (APTR)request->ios2_Req.io_Unit;
309 D(bug("[EMAC%d] S2CmdGetStationAddress()\n", unit->eu_UnitNum));
311 CopyMem(unit->eu_DevAddr, request->ios2_SrcAddr, ETH_ADDRESSSIZE);
312 CopyMem(unit->eu_OrgAddr, request->ios2_DstAddr, ETH_ADDRESSSIZE);
314 /* Return */
316 return TRUE;
319 static BOOL CmdConfigInterface(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
321 struct EMACUnit *unit;
323 /* Configure adapter */
325 unit = (APTR)request->ios2_Req.io_Unit;
327 D(bug("[EMAC%d] S2CmdConfigInterface()\n", unit->eu_UnitNum));
329 if((unit->eu_Flags & IFF_CONFIGURED) == 0)
331 CopyMem(request->ios2_SrcAddr, unit->eu_DevAddr, ETH_ADDRESSSIZE);
332 unit->set_mac_address(unit);
333 unit->eu_Flags |= IFF_CONFIGURED;
335 else
337 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
338 request->ios2_WireError = S2WERR_IS_CONFIGURED;
341 /* Return */
343 return TRUE;
346 static BOOL CmdBroadcast(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
348 UWORD i;
350 /* Fill in the broadcast address as destination */
352 for(i = 0; i < ETH_ADDRESSSIZE; i++)
353 request->ios2_DstAddr[i] = 0xff;
355 /* Queue the write as normal */
357 return CmdWrite(LIBBASE, request);
360 static BOOL CmdTrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
362 struct EMACUnit *unit;
363 struct Opener *opener;
364 ULONG packet_type, wire_error=0;
365 struct TypeTracker *tracker;
366 struct TypeStats *initial_stats;
367 BYTE error = 0;
369 unit = (APTR)request->ios2_Req.io_Unit;
371 D(bug("[EMAC%d] S2CmdTrackType(%d)\n", unit->eu_UnitNum, request->ios2_PacketType));
373 packet_type = request->ios2_PacketType;
375 /* Get global tracker */
376 tracker = (struct TypeTracker *)
377 FindTypeStats(LIBBASE, unit, &unit->eu_TypeTrackers, packet_type);
379 if(tracker != NULL)
380 tracker->user_count++;
381 else
383 tracker =
384 AllocMem(sizeof(struct TypeTracker), MEMF_PUBLIC|MEMF_CLEAR);
385 if(tracker != NULL)
387 tracker->packet_type = packet_type;
388 tracker->user_count = 1;
390 Disable();
391 AddTail((APTR)&unit->eu_TypeTrackers, (APTR)tracker);
392 Enable();
396 /* Store initial figures for this opener */
398 opener = request->ios2_BufferManagement;
399 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
400 if(initial_stats != NULL)
402 error = S2ERR_BAD_STATE;
403 wire_error = S2WERR_ALREADY_TRACKED;
406 if(error == 0)
408 initial_stats = AllocMem(sizeof(struct TypeStats), MEMF_PUBLIC);
409 if(initial_stats == NULL)
411 error = S2ERR_NO_RESOURCES;
412 wire_error = S2WERR_GENERIC_ERROR;
416 if(error == 0)
418 CopyMem(tracker, initial_stats, sizeof(struct TypeStats));
419 AddTail((APTR)&opener->initial_stats, (APTR)initial_stats);
422 /* Return */
424 request->ios2_Req.io_Error = error;
425 request->ios2_WireError = wire_error;
426 return TRUE;
429 static BOOL CmdUntrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
431 struct EMACUnit *unit;
432 struct Opener *opener;
433 ULONG packet_type;
434 struct TypeTracker *tracker;
435 struct TypeStats *initial_stats;
437 unit = (APTR)request->ios2_Req.io_Unit;
439 D(bug("[EMAC%d] S2CmdUntrackType()\n", unit->eu_UnitNum));
441 packet_type = request->ios2_PacketType;
443 /* Get global tracker and initial figures */
445 tracker = (struct TypeTracker *)
446 FindTypeStats(LIBBASE, unit, &unit->eu_TypeTrackers, packet_type);
447 opener = request->ios2_BufferManagement;
448 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
450 /* Decrement tracker usage and free unused structures */
452 if(initial_stats != NULL)
454 if((--tracker->user_count) == 0)
456 Disable();
457 Remove((APTR)tracker);
458 Enable();
459 FreeMem(tracker, sizeof(struct TypeTracker));
462 Remove((APTR)initial_stats);
463 FreeMem(initial_stats, sizeof(struct TypeStats));
465 else
467 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
468 request->ios2_WireError = S2WERR_NOT_TRACKED;
471 /* Return */
473 return TRUE;
476 static BOOL CmdGetTypeStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
478 struct EMACUnit *unit;
479 struct Opener *opener;
480 ULONG packet_type;
481 struct TypeStats *initial_stats, *tracker;
482 struct Sana2PacketTypeStats *stats;
484 unit = (APTR)request->ios2_Req.io_Unit;
486 D(bug("[EMAC%d] S2CmdGetTypeStats()\n", unit->eu_UnitNum));
488 packet_type = request->ios2_PacketType;
490 /* Get global tracker and initial figures */
492 tracker = FindTypeStats(LIBBASE, unit, &unit->eu_TypeTrackers, packet_type);
493 opener = request->ios2_BufferManagement;
494 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
496 /* Copy and adjust figures */
497 if(initial_stats != NULL)
499 stats = request->ios2_StatData;
500 CopyMem(&tracker->stats, stats, sizeof(struct Sana2PacketTypeStats));
501 stats->PacketsSent -= initial_stats->stats.PacketsSent;
502 stats->PacketsReceived -= initial_stats->stats.PacketsReceived;
503 stats->BytesSent -= initial_stats->stats.BytesSent;
504 stats->BytesReceived -= initial_stats->stats.BytesReceived;
505 stats->PacketsDropped -= initial_stats->stats.PacketsDropped;
507 else
509 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
510 request->ios2_WireError = S2WERR_NOT_TRACKED;
513 /* Return */
515 return TRUE;
518 static BOOL CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
520 struct EMACUnit *unit;
522 /* Update and copy stats */
524 unit = (APTR)request->ios2_Req.io_Unit;
526 D(bug("[EMAC%d] S2CmdGetGlobalStats()\n", unit->eu_UnitNum));
528 CopyMem(&unit->eu_Stats, request->ios2_StatData,
529 sizeof(struct Sana2DeviceStats));
531 /* Return */
533 return TRUE;
536 static BOOL CmdDeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOStdReq *request)
538 struct NSDeviceQueryResult *info;
540 /* Set structure size twice */
542 info = request->io_Data;
543 request->io_Actual = info->SizeAvailable =
544 offsetof(struct NSDeviceQueryResult, SupportedCommands) + sizeof(APTR);
546 /* Report device details */
548 info->DeviceType = NSDEVTYPE_SANA2;
549 info->DeviceSubType = 0;
551 info->SupportedCommands = (APTR)supported_commands;
553 /* Return */
555 return TRUE;
559 static BOOL CmdOnEvent(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
561 struct EMACUnit *unit;
562 ULONG events, wanted_events;
563 BOOL complete = FALSE;
565 /* Check if we understand the event types */
567 unit = (struct EMACUnit *)request->ios2_Req.io_Unit;
569 D(bug("[EMAC%d] S2CmdOnEvent()\n", unit->eu_UnitNum));
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;
577 else
579 if((unit->eu_Flags & IFF_UP) != 0)
580 events = S2EVENT_ONLINE;
581 else
582 events = S2EVENT_OFFLINE;
584 events &= wanted_events;
587 /* Reply request if a wanted event has already occurred */
589 if(events != 0)
591 request->ios2_WireError = events;
592 complete = TRUE;
594 else
596 request->ios2_Req.io_Flags &= ~IOF_QUICK;
597 PutMsg(unit->eu_RequestPorts[EVENT_QUEUE], (APTR)request);
600 /* Return */
602 return complete;
605 static BOOL CmdReadOrphan(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
607 struct EMACUnit *unit;
608 BYTE error = 0;
609 ULONG wire_error;
610 BOOL complete = FALSE;
612 /* Check request is valid */
614 unit = (struct EMACUnit *)request->ios2_Req.io_Unit;
616 D(bug("[EMAC%d] S2CmdReadOrphan()\n", unit->eu_UnitNum));
618 if((unit->eu_Flags & IFF_UP) == 0)
620 error = S2ERR_OUTOFSERVICE;
621 wire_error = S2WERR_UNIT_OFFLINE;
624 /* Queue request */
626 if(error == 0)
628 request->ios2_Req.io_Flags &= ~IOF_QUICK;
629 PutMsg(unit->eu_RequestPorts[ADOPT_QUEUE], (struct Message *)request);
631 else
633 request->ios2_Req.io_Error = error;
634 request->ios2_WireError = wire_error;
635 complete = TRUE;
638 /* Return */
640 return complete;
643 static BOOL CmdOnline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
645 struct EMACUnit *unit = (struct EMACUnit *)request->ios2_Req.io_Unit;
646 BYTE error = 0;
647 ULONG wire_error = 0;
648 UWORD i;
650 D(bug("[EMAC%d] S2CmdOnline()\n", unit->eu_UnitNum));
652 /* Check request is valid */
653 if((unit->eu_Flags & IFF_CONFIGURED) == 0)
655 error = S2ERR_BAD_STATE;
656 wire_error = S2WERR_NOT_CONFIGURED;
659 /* Clear global and special stats and put adapter back online */
661 if((error == 0) && ((unit->eu_Flags & IFF_UP) == 0))
663 unit->eu_Stats.PacketsReceived = 0;
664 unit->eu_Stats.PacketsSent = 0;
665 unit->eu_Stats.BadData = 0;
666 unit->eu_Stats.Overruns = 0;
667 unit->eu_Stats.UnknownTypesReceived = 0;
668 unit->eu_Stats.Reconfigurations = 0;
670 for(i = 0; i < STAT_COUNT; i++)
671 unit->eu_SpecialStats[i] = 0;
673 if (unit->start(unit)) {
674 error = S2ERR_OUTOFSERVICE;
675 wire_error = S2WERR_GENERIC_ERROR;
679 /* Return */
681 request->ios2_Req.io_Error = error;
682 request->ios2_WireError = wire_error;
683 return TRUE;
686 static BOOL CmdOffline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
688 struct EMACUnit *unit;
690 /* Put adapter offline */
692 unit = (APTR)request->ios2_Req.io_Unit;
694 D(bug("[EMAC%d] S2CmdOffline()\n", unit->eu_UnitNum));
696 if((unit->eu_Flags & IFF_UP) != 0)
697 unit->stop(unit);
699 /* Return */
700 return TRUE;
703 static BOOL CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
705 struct EMACUnit *unit;
706 UBYTE *lower_bound, *upper_bound;
708 unit = (APTR)request->ios2_Req.io_Unit;
710 D(bug("[EMAC%d] S2CmdAddMulticastAddresses()\n", unit->eu_UnitNum));
712 lower_bound = request->ios2_SrcAddr;
713 if(request->ios2_Req.io_Command == S2_ADDMULTICASTADDRESS)
714 upper_bound = lower_bound;
715 else
716 upper_bound = request->ios2_DstAddr;
718 if(!AddMulticastRange(LIBBASE, unit, lower_bound, upper_bound))
720 request->ios2_Req.io_Error = S2ERR_NO_RESOURCES;
721 request->ios2_WireError = S2WERR_GENERIC_ERROR;
724 /* Return */
726 return TRUE;
730 static BOOL CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
732 struct EMACUnit *unit;
733 UBYTE *lower_bound, *upper_bound;
735 unit = (APTR)request->ios2_Req.io_Unit;
737 D(bug("[EMAC%d] S2CmdDelMulticastAddresses()\n", unit->eu_UnitNum));
739 lower_bound = request->ios2_SrcAddr;
740 if(request->ios2_Req.io_Command == S2_DELMULTICASTADDRESS)
741 upper_bound = lower_bound;
742 else
743 upper_bound = request->ios2_DstAddr;
745 if(!RemMulticastRange(LIBBASE, unit, lower_bound, upper_bound))
747 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
748 request->ios2_WireError = S2WERR_BAD_MULTICAST;
751 /* Return */
753 return TRUE;