1 /******************************************************************************
4 * Project: GEnesis, PCI Gigabit Ethernet Adapter
5 * Version: $Revision: 1.68 $
6 * Date: $Date: 2003/01/31 15:26:56 $
7 * Purpose: Manage links on SK-NET Adapters, esp. redundant ones.
9 ******************************************************************************/
11 /******************************************************************************
13 * (C)Copyright 1998-2001 SysKonnect GmbH.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * The information in this file is provided "AS IS" without warranty.
22 ******************************************************************************/
24 /******************************************************************************
29 * Revision 1.68 2003/01/31 15:26:56 rschmidt
30 * Added init for local variables in RlmtInit().
32 * Revision 1.67 2003/01/31 14:12:41 mkunz
33 * single port adapter runs now with two identical MAC addresses
35 * Revision 1.66 2002/09/23 15:14:19 rwahl
36 * - Reset broadcast timestamp on link down.
37 * - Editorial corrections.
39 * Revision 1.65 2002/07/22 14:29:48 rwahl
40 * - Removed BRK statement from debug check.
42 * Revision 1.64 2001/11/28 19:36:14 rwahl
43 * - RLMT Packets sent to an invalid MAC address in CLP/CLPSS mode
45 * - Reworked fix for port switching in CLS mode (#10639)
46 * (no dependency to RLMT module).
47 * - Enabled dbg output for entry/exit of event functions.
48 * - Editorial changes.
50 * Revision 1.63 2001/10/26 07:53:18 afischer
51 * Port switching bug in `check local link` mode
53 * Revision 1.62 2001/07/03 12:16:30 mkunz
54 * New Flag ChgBcPrio (Change priority of last broadcast received)
56 * Revision 1.61 2001/03/14 12:52:08 rassmann
57 * Fixed reporting of active port up/down to PNMI.
59 * Revision 1.60 2001/02/21 16:02:25 gklug
60 * fix: when RLMT starts set Active Port for PNMI
62 * Revision 1.59 2001/02/16 14:38:19 rassmann
63 * Initializing some pointers earlier in the init phase.
64 * Rx Mbufs are freed if the net which they belong to is stopped.
66 * Revision 1.58 2001/02/14 14:06:31 rassmann
69 * Revision 1.57 2001/02/05 14:25:26 rassmann
70 * Prepared RLMT for transparent operation.
72 * Revision 1.56 2001/01/30 10:29:09 rassmann
73 * Not checking switching befor RlmtStart.
76 * Revision 1.55 2001/01/22 13:41:38 rassmann
77 * Supporting two nets on dual-port adapters.
79 * Revision 1.54 2000/11/30 13:25:07 rassmann
80 * Setting SK_TICK_INCR to 1 by default.
82 * Revision 1.53 2000/11/30 10:48:07 cgoos
83 * Changed definition of SK_RLMT_BC_DELTA.
85 * Revision 1.52 2000/11/27 12:50:03 rassmann
86 * Checking ports after receiving broadcasts.
88 * Revision 1.51 2000/11/17 08:58:00 rassmann
89 * Moved CheckSwitch from SK_RLMT_PACKET_RECEIVED to SK_RLMT_TIM event.
91 * Revision 1.50 2000/11/09 12:24:34 rassmann
92 * Indicating that segmentation check is not running anymore after
94 * Restarting segmentation timer after segmentation log.
97 * Revision 1.49 1999/11/22 13:38:02 cgoos
98 * Changed license header to GPL.
99 * Added initialization to some variables to avoid compiler warnings.
101 * Revision 1.48 1999/10/04 14:01:17 rassmann
102 * Corrected reaction to reception of BPDU frames (#10441).
104 * Revision 1.47 1999/07/20 12:53:36 rassmann
105 * Fixed documentation errors for lookahead macros.
107 * Revision 1.46 1999/05/28 13:29:16 rassmann
108 * Replaced C++-style comment.
110 * Revision 1.45 1999/05/28 13:28:08 rassmann
111 * Corrected syntax error (xxx).
113 * Revision 1.44 1999/05/28 11:15:54 rassmann
114 * Changed behaviour to reflect Design Spec v1.2.
115 * Controlling Link LED(s).
116 * Introduced RLMT Packet Version field in RLMT Packet.
117 * Newstyle lookahead macros (checking meta-information before looking at
120 * Revision 1.43 1999/01/28 13:12:43 rassmann
121 * Corrected Lookahead (bug introduced in previous Rev.).
123 * Revision 1.42 1999/01/28 12:50:41 rassmann
124 * Not using broadcast time stamps in CheckLinkState mode.
126 * Revision 1.41 1999/01/27 14:13:02 rassmann
127 * Monitoring broadcast traffic.
128 * Switching more reliably and not too early if switch is
129 * configured for spanning tree.
131 * Revision 1.40 1999/01/22 13:17:30 rassmann
132 * Informing PNMI of NET_UP.
133 * Clearing RLMT multicast addresses before setting them for the first time.
134 * Reporting segmentation earlier, setting a "quiet time"
137 * Revision 1.39 1998/12/10 15:29:53 rassmann
138 * Corrected SuspectStatus in SkRlmtBuildCheckChain().
139 * Corrected CHECK_SEG mode.
141 * Revision 1.38 1998/12/08 13:11:23 rassmann
142 * Stopping SegTimer at RlmtStop.
144 * Revision 1.37 1998/12/07 16:51:42 rassmann
145 * Corrected comments.
147 * Revision 1.36 1998/12/04 10:58:56 rassmann
148 * Setting next pointer to NULL when receiving.
150 * Revision 1.35 1998/12/03 16:12:42 rassmann
151 * Ignoring/correcting illegal PrefPort values.
153 * Revision 1.34 1998/12/01 11:45:35 rassmann
156 * Revision 1.33 1998/12/01 10:29:32 rassmann
157 * Starting standby ports before getting the net up.
158 * Checking if a port is started when the link comes up.
160 * Revision 1.32 1998/11/30 16:19:50 rassmann
161 * New default for PortNoRx.
163 * Revision 1.31 1998/11/27 19:17:13 rassmann
164 * Corrected handling of LINK_DOWN coming shortly after LINK_UP.
166 * Revision 1.30 1998/11/24 12:37:31 rassmann
167 * Implemented segmentation check.
169 * Revision 1.29 1998/11/18 13:04:32 rassmann
170 * Secured PortUpTimer event.
171 * Waiting longer before starting standby port(s).
173 * Revision 1.28 1998/11/17 13:43:04 rassmann
174 * Handling (logical) tx failure.
175 * Sending packet on logical address after PORT_SWITCH.
177 * Revision 1.27 1998/11/13 17:09:50 rassmann
178 * Secured some events against being called in wrong state.
180 * Revision 1.26 1998/11/13 16:56:54 rassmann
181 * Added macro version of SkRlmtLookaheadPacket.
183 * Revision 1.25 1998/11/06 18:06:04 rassmann
184 * Corrected timing when RLMT checks fail.
185 * Clearing tx counter earlier in periodical checks.
187 * Revision 1.24 1998/11/05 10:37:27 rassmann
188 * Checking destination address in Lookahead.
190 * Revision 1.23 1998/11/03 13:53:49 rassmann
191 * RLMT should switch now (at least in mode 3).
193 * Revision 1.22 1998/10/29 14:34:49 rassmann
194 * Clearing SK_RLMT struct at startup.
195 * Initializing PortsUp during SK_RLMT_START.
197 * Revision 1.21 1998/10/28 11:30:17 rassmann
198 * Default mode is now SK_RLMT_CHECK_LOC_LINK.
200 * Revision 1.20 1998/10/26 16:02:03 rassmann
201 * Ignoring LINK_DOWN for links that are down.
203 * Revision 1.19 1998/10/22 15:54:01 rassmann
204 * Corrected EtherLen.
205 * Starting Link Check when second port comes up.
207 * Revision 1.18 1998/10/22 11:39:50 rassmann
208 * Corrected signed/unsigned mismatches.
209 * Corrected receive list handling and address recognition.
211 * Revision 1.17 1998/10/19 17:01:20 rassmann
212 * More detailed checking of received packets.
214 * Revision 1.16 1998/10/15 15:16:34 rassmann
215 * Finished Spanning Tree checking.
218 * Revision 1.15 1998/09/24 19:16:07 rassmann
220 * Introduced Timer for PORT_DOWN due to no RX.
222 * Revision 1.14 1998/09/18 20:27:14 rassmann
223 * Added address override.
225 * Revision 1.13 1998/09/16 11:31:48 rassmann
226 * Including skdrv1st.h again. :(
228 * Revision 1.12 1998/09/16 11:09:50 rassmann
229 * Syntax corrections.
231 * Revision 1.11 1998/09/15 12:32:03 rassmann
234 * Revision 1.10 1998/09/15 11:28:49 rassmann
235 * Syntax corrections.
237 * Revision 1.9 1998/09/14 17:07:37 rassmann
238 * Added code for port checking via LAN.
239 * Changed Mbuf definition.
241 * Revision 1.8 1998/09/07 11:14:14 rassmann
242 * Syntax corrections.
244 * Revision 1.7 1998/09/07 09:06:07 rassmann
245 * Syntax corrections.
247 * Revision 1.6 1998/09/04 19:41:33 rassmann
248 * Syntax corrections.
249 * Started entering code for checking local links.
251 * Revision 1.5 1998/09/04 12:14:27 rassmann
254 * Revision 1.4 1998/09/02 16:55:28 rassmann
255 * Updated to reflect new DRV/HWAC/RLMT interface.
257 * Revision 1.3 1998/08/27 14:29:03 rassmann
260 * Revision 1.2 1998/08/27 14:26:24 rassmann
263 * Revision 1.1 1998/08/21 08:26:49 rassmann
264 * First public version.
266 ******************************************************************************/
268 /******************************************************************************
272 * This module contains code for Link ManagemenT (LMT) of SK-NET Adapters.
273 * It is mainly intended for adapters with more than one link.
274 * For such adapters, this module realizes Redundant Link ManagemenT (RLMT).
276 * Include File Hierarchy:
281 ******************************************************************************/
288 static const char SysKonnectFileId[] =
289 "@(#) $Id: skrlmt.c,v 1.68 2003/01/31 15:26:56 rschmidt Exp $ (C) SysKonnect.";
290 #endif /* !defined(lint) */
295 #error C++ is not yet supported.
297 #endif /* cplusplus */
299 #include "h/skdrv1st.h"
300 #include "h/skdrv2nd.h"
302 /* defines ********************************************************************/
304 #ifndef SK_HWAC_LINK_LED
305 #define SK_HWAC_LINK_LED(a,b,c,d)
306 #endif /* !defined(SK_HWAC_LINK_LED) */
309 #define RLMT_STATIC static
313 #ifndef SK_LITTLE_ENDIAN
319 #else /* SK_LITTLE_ENDIAN */
325 #endif /* SK_LITTLE_ENDIAN */
329 /* ----- Private timeout values ----- */
331 #define SK_RLMT_MIN_TO_VAL 125000 /* 1/8 sec. */
332 #define SK_RLMT_DEF_TO_VAL 1000000 /* 1 sec. */
333 #define SK_RLMT_PORTDOWN_TIM_VAL 900000 /* another 0.9 sec. */
334 #define SK_RLMT_PORTSTART_TIM_VAL 100000 /* 0.1 sec. */
335 #define SK_RLMT_PORTUP_TIM_VAL 2500000 /* 2.5 sec. */
336 #define SK_RLMT_SEG_TO_VAL 900000000 /* 15 min. */
338 /* Assume tick counter increment is 1 - may be set OS-dependent. */
340 #define SK_TICK_INCR SK_CONSTU64(1)
341 #endif /* !defined(SK_TICK_INCR) */
344 * Amount that a time stamp must be later to be recognized as "substantially
345 * later". This is about 1/128 sec, but above 1 tick counter increment.
347 #define SK_RLMT_BC_DELTA (1 + ((SK_TICKS_PER_SEC >> 7) > SK_TICK_INCR ? \
348 (SK_TICKS_PER_SEC >> 7) : SK_TICK_INCR))
350 /* ----- Private RLMT defaults ----- */
352 #define SK_RLMT_DEF_PREF_PORT 0 /* "Lower" port. */
353 #define SK_RLMT_DEF_MODE SK_RLMT_CHECK_LINK /* Default RLMT Mode. */
355 /* ----- Private RLMT checking states ----- */
357 #define SK_RLMT_RCS_SEG 1 /* RLMT Check State: check seg. */
358 #define SK_RLMT_RCS_START_SEG 2 /* RLMT Check State: start check seg. */
359 #define SK_RLMT_RCS_SEND_SEG 4 /* RLMT Check State: send BPDU packet */
360 #define SK_RLMT_RCS_REPORT_SEG 8 /* RLMT Check State: report seg. */
362 /* ----- Private PORT checking states ----- */
364 #define SK_RLMT_PCS_TX 1 /* Port Check State: check tx. */
365 #define SK_RLMT_PCS_RX 2 /* Port Check State: check rx. */
367 /* ----- Private PORT events ----- */
369 /* Note: Update simulation when changing these. */
370 #define SK_RLMT_PORTSTART_TIM 1100 /* Port start timeout. */
371 #define SK_RLMT_PORTUP_TIM 1101 /* Port can now go up. */
372 #define SK_RLMT_PORTDOWN_RX_TIM 1102 /* Port did not receive once ... */
373 #define SK_RLMT_PORTDOWN 1103 /* Port went down. */
374 #define SK_RLMT_PORTDOWN_TX_TIM 1104 /* Partner did not receive ... */
376 /* ----- Private RLMT events ----- */
378 /* Note: Update simulation when changing these. */
379 #define SK_RLMT_TIM 2100 /* RLMT timeout. */
380 #define SK_RLMT_SEG_TIM 2101 /* RLMT segmentation check timeout. */
382 #define TO_SHORTEN(tim) ((tim) / 2)
384 /* Error numbers and messages. */
385 #define SKERR_RLMT_E001 (SK_ERRBASE_RLMT + 0)
386 #define SKERR_RLMT_E001_MSG "No Packet."
387 #define SKERR_RLMT_E002 (SKERR_RLMT_E001 + 1)
388 #define SKERR_RLMT_E002_MSG "Short Packet."
389 #define SKERR_RLMT_E003 (SKERR_RLMT_E002 + 1)
390 #define SKERR_RLMT_E003_MSG "Unknown RLMT event."
391 #define SKERR_RLMT_E004 (SKERR_RLMT_E003 + 1)
392 #define SKERR_RLMT_E004_MSG "PortsUp incorrect."
393 #define SKERR_RLMT_E005 (SKERR_RLMT_E004 + 1)
394 #define SKERR_RLMT_E005_MSG \
395 "Net seems to be segmented (different root bridges are reported on the ports)."
396 #define SKERR_RLMT_E006 (SKERR_RLMT_E005 + 1)
397 #define SKERR_RLMT_E006_MSG "Duplicate MAC Address detected."
398 #define SKERR_RLMT_E007 (SKERR_RLMT_E006 + 1)
399 #define SKERR_RLMT_E007_MSG "LinksUp incorrect."
400 #define SKERR_RLMT_E008 (SKERR_RLMT_E007 + 1)
401 #define SKERR_RLMT_E008_MSG "Port not started but link came up."
402 #define SKERR_RLMT_E009 (SKERR_RLMT_E008 + 1)
403 #define SKERR_RLMT_E009_MSG "Corrected illegal setting of Preferred Port."
404 #define SKERR_RLMT_E010 (SKERR_RLMT_E009 + 1)
405 #define SKERR_RLMT_E010_MSG "Ignored illegal Preferred Port."
407 /* LLC field values. */
408 #define LLC_COMMAND_RESPONSE_BIT 1
409 #define LLC_TEST_COMMAND 0xE3
412 /* RLMT Packet fields. */
413 #define SK_RLMT_DSAP 0
414 #define SK_RLMT_SSAP 0
415 #define SK_RLMT_CTRL (LLC_TEST_COMMAND)
416 #define SK_RLMT_INDICATOR0 0x53 /* S */
417 #define SK_RLMT_INDICATOR1 0x4B /* K */
418 #define SK_RLMT_INDICATOR2 0x2D /* - */
419 #define SK_RLMT_INDICATOR3 0x52 /* R */
420 #define SK_RLMT_INDICATOR4 0x4C /* L */
421 #define SK_RLMT_INDICATOR5 0x4D /* M */
422 #define SK_RLMT_INDICATOR6 0x54 /* T */
423 #define SK_RLMT_PACKET_VERSION 0
425 /* RLMT SPT Flag values. */
426 #define SK_RLMT_SPT_FLAG_CHANGE 0x01
427 #define SK_RLMT_SPT_FLAG_CHANGE_ACK 0x80
429 /* RLMT SPT Packet fields. */
430 #define SK_RLMT_SPT_DSAP 0x42
431 #define SK_RLMT_SPT_SSAP 0x42
432 #define SK_RLMT_SPT_CTRL (LLC_UI)
433 #define SK_RLMT_SPT_PROTOCOL_ID0 0x00
434 #define SK_RLMT_SPT_PROTOCOL_ID1 0x00
435 #define SK_RLMT_SPT_PROTOCOL_VERSION_ID 0x00
436 #define SK_RLMT_SPT_BPDU_TYPE 0x00
437 #define SK_RLMT_SPT_FLAGS 0x00 /* ?? */
438 #define SK_RLMT_SPT_ROOT_ID0 0xFF /* Lowest possible priority. */
439 #define SK_RLMT_SPT_ROOT_ID1 0xFF /* Lowest possible priority. */
441 /* Remaining 6 bytes will be the current port address. */
442 #define SK_RLMT_SPT_ROOT_PATH_COST0 0x00
443 #define SK_RLMT_SPT_ROOT_PATH_COST1 0x00
444 #define SK_RLMT_SPT_ROOT_PATH_COST2 0x00
445 #define SK_RLMT_SPT_ROOT_PATH_COST3 0x00
446 #define SK_RLMT_SPT_BRIDGE_ID0 0xFF /* Lowest possible priority. */
447 #define SK_RLMT_SPT_BRIDGE_ID1 0xFF /* Lowest possible priority. */
449 /* Remaining 6 bytes will be the current port address. */
450 #define SK_RLMT_SPT_PORT_ID0 0xFF /* Lowest possible priority. */
451 #define SK_RLMT_SPT_PORT_ID1 0xFF /* Lowest possible priority. */
452 #define SK_RLMT_SPT_MSG_AGE0 0x00
453 #define SK_RLMT_SPT_MSG_AGE1 0x00
454 #define SK_RLMT_SPT_MAX_AGE0 0x00
455 #define SK_RLMT_SPT_MAX_AGE1 0xFF
456 #define SK_RLMT_SPT_HELLO_TIME0 0x00
457 #define SK_RLMT_SPT_HELLO_TIME1 0xFF
458 #define SK_RLMT_SPT_FWD_DELAY0 0x00
459 #define SK_RLMT_SPT_FWD_DELAY1 0x40
462 #define SK_RLMT_MIN_PACKET_SIZE 34
463 #define SK_RLMT_MAX_PACKET_SIZE (SK_RLMT_MAX_TX_BUF_SIZE)
464 #define SK_PACKET_DATA_LEN (SK_RLMT_MAX_PACKET_SIZE - \
465 SK_RLMT_MIN_PACKET_SIZE)
467 /* ----- RLMT packet types ----- */
468 #define SK_PACKET_ANNOUNCE 1 /* Port announcement. */
469 #define SK_PACKET_ALIVE 2 /* Alive packet to port. */
470 #define SK_PACKET_ADDR_CHANGED 3 /* Port address changed. */
471 #define SK_PACKET_CHECK_TX 4 /* Check your tx line. */
473 #ifdef SK_LITTLE_ENDIAN
474 #define SK_U16_TO_NETWORK_ORDER(Val,Addr) { \
475 SK_U8 *_Addr = (SK_U8*)(Addr); \
476 SK_U16 _Val = (SK_U16)(Val); \
477 *_Addr++ = (SK_U8)(_Val >> 8); \
478 *_Addr = (SK_U8)(_Val & 0xFF); \
480 #endif /* SK_LITTLE_ENDIAN */
483 #define SK_U16_TO_NETWORK_ORDER(Val,Addr) (*(SK_U16*)(Addr) = (SK_U16)(Val))
484 #endif /* SK_BIG_ENDIAN */
486 #define AUTONEG_FAILED SK_FALSE
487 #define AUTONEG_SUCCESS SK_TRUE
490 /* typedefs *******************************************************************/
492 /* RLMT packet. Length: SK_RLMT_MAX_PACKET_SIZE (60) bytes. */
493 typedef struct s_RlmtPacket {
494 SK_U8 DstAddr[SK_MAC_ADDR_LEN];
495 SK_U8 SrcAddr[SK_MAC_ADDR_LEN];
501 SK_U8 RlmtPacketType[2];
503 SK_U8 Random[4]; /* Random value of requesting(!) station. */
504 SK_U8 RlmtPacketVersion[2]; /* RLMT Packet version. */
505 SK_U8 Data[SK_PACKET_DATA_LEN];
508 typedef struct s_SpTreeRlmtPacket {
509 SK_U8 DstAddr[SK_MAC_ADDR_LEN];
510 SK_U8 SrcAddr[SK_MAC_ADDR_LEN];
516 SK_U8 ProtocolVersionId;
520 SK_U8 RootPathCost[4];
526 SK_U8 ForwardDelay[2];
529 /* global variables ***********************************************************/
531 SK_MAC_ADDR SkRlmtMcAddr = {{0x01, 0x00, 0x5A, 0x52, 0x4C, 0x4D}};
532 SK_MAC_ADDR BridgeMcAddr = {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}};
533 SK_MAC_ADDR BcAddr = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
535 /* local variables ************************************************************/
539 /* functions ******************************************************************/
541 RLMT_STATIC void SkRlmtCheckSwitch(
545 RLMT_STATIC void SkRlmtCheckSeg(
549 RLMT_STATIC void SkRlmtEvtSetNets(
554 /******************************************************************************
556 * SkRlmtInit - initialize data, set state to init
563 * This routine initializes all RLMT-related variables to a known state.
564 * The initial state is SK_RLMT_RS_INIT.
565 * All ports are initialized to SK_RLMT_PS_INIT.
577 * Determine the adapter's random value.
578 * Set the hw registers, the "logical MAC address", the
579 * RLMT multicast address, and eventually the BPDU multicast address.
588 SK_AC *pAC, /* Adapter Context */
589 SK_IOC IoC, /* I/O Context */
590 int Level) /* Initialization Level */
595 SK_MAC_ADDR VirtualMacAddress;
596 SK_MAC_ADDR PhysicalAMacAddress;
597 SK_BOOL VirtualMacAddressSet;
598 SK_BOOL PhysicalAMacAddressSet;
600 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_INIT,
601 ("RLMT Init level %d.\n", Level))
604 case SK_INIT_DATA: /* Initialize data structures. */
605 SK_MEMSET((char *)&pAC->Rlmt, 0, sizeof(SK_RLMT));
607 for (i = 0; i < SK_MAX_MACS; i++) {
608 pAC->Rlmt.Port[i].PortState = SK_RLMT_PS_INIT;
609 pAC->Rlmt.Port[i].LinkDown = SK_TRUE;
610 pAC->Rlmt.Port[i].PortDown = SK_TRUE;
611 pAC->Rlmt.Port[i].PortStarted = SK_FALSE;
612 pAC->Rlmt.Port[i].PortNoRx = SK_FALSE;
613 pAC->Rlmt.Port[i].RootIdSet = SK_FALSE;
614 pAC->Rlmt.Port[i].PortNumber = i;
615 pAC->Rlmt.Port[i].Net = &pAC->Rlmt.Net[0];
616 pAC->Rlmt.Port[i].AddrPort = &pAC->Addr.Port[i];
619 pAC->Rlmt.NumNets = 1;
620 for (i = 0; i < SK_MAX_NETS; i++) {
621 pAC->Rlmt.Net[i].RlmtState = SK_RLMT_RS_INIT;
622 pAC->Rlmt.Net[i].RootIdSet = SK_FALSE;
623 pAC->Rlmt.Net[i].PrefPort = SK_RLMT_DEF_PREF_PORT;
624 pAC->Rlmt.Net[i].Preference = 0xFFFFFFFF; /* Automatic. */
626 pAC->Rlmt.Net[i].ActivePort = pAC->Rlmt.Net[i].PrefPort;
627 pAC->Rlmt.Net[i].RlmtMode = SK_RLMT_DEF_MODE;
628 pAC->Rlmt.Net[i].TimeoutValue = SK_RLMT_DEF_TO_VAL;
629 pAC->Rlmt.Net[i].NetNumber = i;
632 pAC->Rlmt.Net[0].Port[0] = &pAC->Rlmt.Port[0];
633 pAC->Rlmt.Net[0].Port[1] = &pAC->Rlmt.Port[1];
635 pAC->Rlmt.Net[1].Port[0] = &pAC->Rlmt.Port[1];
636 #endif /* SK_MAX_NETS > 1 */
639 case SK_INIT_IO: /* GIMacsFound first available here. */
640 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_INIT,
641 ("RLMT: %d MACs were detected.\n", pAC->GIni.GIMacsFound))
643 pAC->Rlmt.Net[0].NumPorts = pAC->GIni.GIMacsFound;
645 /* Initialize HW registers? */
646 if (pAC->GIni.GIMacsFound == 1) {
647 Para.Para32[0] = SK_RLMT_MODE_CLS;
649 (void)SkRlmtEvent(pAC, IoC, SK_RLMT_MODE_CHANGE, Para);
654 /* Ensure RLMT is set to one net. */
655 if (pAC->Rlmt.NumNets > 1) {
658 SkRlmtEvtSetNets(pAC, IoC, Para);
661 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
662 Random = SkOsGetTime(pAC);
663 *(SK_U32*)&pAC->Rlmt.Port[i].Random = *(SK_U32*)&Random;
665 for (j = 0; j < 4; j++) {
666 pAC->Rlmt.Port[i].Random[j] ^= pAC->Rlmt.Port[i].AddrPort->
667 CurrentMacAddress.a[SK_MAC_ADDR_LEN - 1 - j];
670 (void)SkAddrMcClear(pAC, IoC, i, SK_ADDR_PERMANENT | SK_MC_SW_ONLY);
672 /* Add RLMT MC address. */
673 (void)SkAddrMcAdd(pAC, IoC, i, &SkRlmtMcAddr, SK_ADDR_PERMANENT);
675 if (pAC->Rlmt.Net[0].RlmtMode & SK_RLMT_CHECK_SEG) {
676 /* Add BPDU MC address. */
677 (void)SkAddrMcAdd(pAC, IoC, i, &BridgeMcAddr, SK_ADDR_PERMANENT);
680 (void)SkAddrMcUpdate(pAC, IoC, i);
683 VirtualMacAddressSet = SK_FALSE;
684 /* Read virtual MAC address from Control Register File. */
685 for (j = 0; j < SK_MAC_ADDR_LEN; j++) {
687 SK_IN8(IoC, B2_MAC_1 + j, &VirtualMacAddress.a[j]);
688 VirtualMacAddressSet |= VirtualMacAddress.a[j];
691 PhysicalAMacAddressSet = SK_FALSE;
692 /* Read physical MAC address for MAC A from Control Register File. */
693 for (j = 0; j < SK_MAC_ADDR_LEN; j++) {
695 SK_IN8(IoC, B2_MAC_2 + j, &PhysicalAMacAddress.a[j]);
696 PhysicalAMacAddressSet |= PhysicalAMacAddress.a[j];
699 /* check if the two mac addresses contain reasonable values */
700 if (!VirtualMacAddressSet || !PhysicalAMacAddressSet) {
702 pAC->Rlmt.RlmtOff = SK_TRUE;
705 /* if the two mac addresses are equal switch off the RLMT_PRE_LOOKAHEAD
706 and the RLMT_LOOKAHEAD macros */
707 else if (SK_ADDR_EQUAL(PhysicalAMacAddress.a, VirtualMacAddress.a)) {
709 pAC->Rlmt.RlmtOff = SK_TRUE;
712 pAC->Rlmt.RlmtOff = SK_FALSE;
723 /******************************************************************************
725 * SkRlmtBuildCheckChain - build the check chain
728 * This routine builds the local check chain:
729 * - Each port that is up checks the next port.
730 * - The last port that is up checks the first port that is up.
733 * - Currently only local ports are considered when building the chain.
734 * - Currently the SuspectState is just reset;
735 * it would be better to save it ...
743 RLMT_STATIC void SkRlmtBuildCheckChain(
744 SK_AC *pAC, /* Adapter Context */
745 SK_U32 NetIdx) /* Net Number */
749 SK_RLMT_PORT * FirstMacUp;
750 SK_RLMT_PORT * PrevMacUp;
755 if (!(pAC->Rlmt.Net[NetIdx].RlmtMode & SK_RLMT_CHECK_LOC_LINK)) {
756 for (i = 0; i < pAC->Rlmt.Net[i].NumPorts; i++) {
757 pAC->Rlmt.Net[NetIdx].Port[i]->PortsChecked = 0;
762 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
763 ("SkRlmtBuildCheckChain.\n"))
767 for (i = 0; i < pAC->Rlmt.Net[NetIdx].NumPorts; i++) {
768 pAC->Rlmt.Net[NetIdx].Port[i]->PortsChecked = 0;
769 pAC->Rlmt.Net[NetIdx].Port[i]->PortsSuspect = 0;
770 pAC->Rlmt.Net[NetIdx].Port[i]->CheckingState &=
771 ~(SK_RLMT_PCS_RX | SK_RLMT_PCS_TX);
774 * If more than two links are detected we should consider
775 * checking at least two other ports:
776 * 1. the next port that is not LinkDown and
777 * 2. the next port that is not PortDown.
779 if (!pAC->Rlmt.Net[NetIdx].Port[i]->LinkDown) {
780 if (NumMacsUp == 0) {
781 FirstMacUp = pAC->Rlmt.Net[NetIdx].Port[i];
784 PrevMacUp->PortCheck[
785 pAC->Rlmt.Net[NetIdx].Port[i]->PortsChecked].CheckAddr =
786 pAC->Rlmt.Net[NetIdx].Port[i]->AddrPort->CurrentMacAddress;
787 PrevMacUp->PortCheck[
788 PrevMacUp->PortsChecked].SuspectTx = SK_FALSE;
789 PrevMacUp->PortsChecked++;
791 PrevMacUp = pAC->Rlmt.Net[NetIdx].Port[i];
797 PrevMacUp->PortCheck[PrevMacUp->PortsChecked].CheckAddr =
798 FirstMacUp->AddrPort->CurrentMacAddress;
799 PrevMacUp->PortCheck[PrevMacUp->PortsChecked].SuspectTx =
801 PrevMacUp->PortsChecked++;
805 for (i = 0; i < pAC->Rlmt.Net[NetIdx].NumPorts; i++) {
806 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
807 ("Port %d checks %d other ports: %2X.\n", i,
808 pAC->Rlmt.Net[NetIdx].Port[i]->PortsChecked,
809 pAC->Rlmt.Net[NetIdx].Port[i]->PortCheck[0].CheckAddr.a[5]))
814 } /* SkRlmtBuildCheckChain */
817 /******************************************************************************
819 * SkRlmtBuildPacket - build an RLMT packet
822 * This routine sets up an RLMT packet.
828 * NULL or pointer to RLMT mbuf
830 RLMT_STATIC SK_MBUF *SkRlmtBuildPacket(
831 SK_AC *pAC, /* Adapter Context */
832 SK_IOC IoC, /* I/O Context */
833 SK_U32 PortNumber, /* Sending port */
834 SK_U16 PacketType, /* RLMT packet type */
835 SK_MAC_ADDR *SrcAddr, /* Source address */
836 SK_MAC_ADDR *DestAddr) /* Destination address */
841 SK_RLMT_PACKET *pPacket;
847 for (i = 0; i < SK_MAC_ADDR_LEN; ++i) {
848 CheckSrc |= SrcAddr->a[i];
849 CheckDest |= DestAddr->a[i];
852 if ((CheckSrc == 0) || (CheckDest == 0)) {
853 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_ERR,
854 ("SkRlmtBuildPacket: Invalid %s%saddr.\n",
855 (CheckSrc == 0 ? "Src" : ""), (CheckDest == 0 ? "Dest" : "")))
859 if ((pMb = SkDrvAllocRlmtMbuf(pAC, IoC, SK_RLMT_MAX_PACKET_SIZE)) != NULL) {
860 pPacket = (SK_RLMT_PACKET*)pMb->pData;
861 for (i = 0; i < SK_MAC_ADDR_LEN; i++) {
862 pPacket->DstAddr[i] = DestAddr->a[i];
863 pPacket->SrcAddr[i] = SrcAddr->a[i];
865 pPacket->DSap = SK_RLMT_DSAP;
866 pPacket->SSap = SK_RLMT_SSAP;
867 pPacket->Ctrl = SK_RLMT_CTRL;
868 pPacket->Indicator[0] = SK_RLMT_INDICATOR0;
869 pPacket->Indicator[1] = SK_RLMT_INDICATOR1;
870 pPacket->Indicator[2] = SK_RLMT_INDICATOR2;
871 pPacket->Indicator[3] = SK_RLMT_INDICATOR3;
872 pPacket->Indicator[4] = SK_RLMT_INDICATOR4;
873 pPacket->Indicator[5] = SK_RLMT_INDICATOR5;
874 pPacket->Indicator[6] = SK_RLMT_INDICATOR6;
876 SK_U16_TO_NETWORK_ORDER(PacketType, &pPacket->RlmtPacketType[0]);
878 for (i = 0; i < 4; i++) {
879 pPacket->Random[i] = pAC->Rlmt.Port[PortNumber].Random[i];
882 SK_U16_TO_NETWORK_ORDER(
883 SK_RLMT_PACKET_VERSION, &pPacket->RlmtPacketVersion[0]);
885 for (i = 0; i < SK_PACKET_DATA_LEN; i++) {
886 pPacket->Data[i] = 0x00;
889 Length = SK_RLMT_MAX_PACKET_SIZE; /* Or smaller. */
890 pMb->Length = Length;
891 pMb->PortIdx = PortNumber;
893 SK_U16_TO_NETWORK_ORDER(Length, &pPacket->TypeLen[0]);
895 if (PacketType == SK_PACKET_ALIVE) {
896 pAC->Rlmt.Port[PortNumber].TxHelloCts++;
901 } /* SkRlmtBuildPacket */
904 /******************************************************************************
906 * SkRlmtBuildSpanningTreePacket - build spanning tree check packet
909 * This routine sets up a BPDU packet for spanning tree check.
915 * NULL or pointer to RLMT mbuf
917 RLMT_STATIC SK_MBUF *SkRlmtBuildSpanningTreePacket(
918 SK_AC *pAC, /* Adapter Context */
919 SK_IOC IoC, /* I/O Context */
920 SK_U32 PortNumber) /* Sending port */
925 SK_SPTREE_PACKET *pSPacket;
927 if ((pMb = SkDrvAllocRlmtMbuf(pAC, IoC, SK_RLMT_MAX_PACKET_SIZE)) !=
929 pSPacket = (SK_SPTREE_PACKET*)pMb->pData;
930 for (i = 0; i < SK_MAC_ADDR_LEN; i++) {
931 pSPacket->DstAddr[i] = BridgeMcAddr.a[i];
932 pSPacket->SrcAddr[i] =
933 pAC->Addr.Port[PortNumber].CurrentMacAddress.a[i];
935 pSPacket->DSap = SK_RLMT_SPT_DSAP;
936 pSPacket->SSap = SK_RLMT_SPT_SSAP;
937 pSPacket->Ctrl = SK_RLMT_SPT_CTRL;
939 pSPacket->ProtocolId[0] = SK_RLMT_SPT_PROTOCOL_ID0;
940 pSPacket->ProtocolId[1] = SK_RLMT_SPT_PROTOCOL_ID1;
941 pSPacket->ProtocolVersionId = SK_RLMT_SPT_PROTOCOL_VERSION_ID;
942 pSPacket->BpduType = SK_RLMT_SPT_BPDU_TYPE;
943 pSPacket->Flags = SK_RLMT_SPT_FLAGS;
944 pSPacket->RootId[0] = SK_RLMT_SPT_ROOT_ID0;
945 pSPacket->RootId[1] = SK_RLMT_SPT_ROOT_ID1;
946 pSPacket->RootPathCost[0] = SK_RLMT_SPT_ROOT_PATH_COST0;
947 pSPacket->RootPathCost[1] = SK_RLMT_SPT_ROOT_PATH_COST1;
948 pSPacket->RootPathCost[2] = SK_RLMT_SPT_ROOT_PATH_COST2;
949 pSPacket->RootPathCost[3] = SK_RLMT_SPT_ROOT_PATH_COST3;
950 pSPacket->BridgeId[0] = SK_RLMT_SPT_BRIDGE_ID0;
951 pSPacket->BridgeId[1] = SK_RLMT_SPT_BRIDGE_ID1;
954 * Use logical MAC address as bridge ID and filter these packets
957 for (i = 0; i < SK_MAC_ADDR_LEN; i++) {
958 pSPacket->BridgeId[i + 2] = pSPacket->RootId[i + 2] =
959 pAC->Addr.Net[pAC->Rlmt.Port[PortNumber].Net->NetNumber].
960 CurrentMacAddress.a[i];
962 pSPacket->PortId[0] = SK_RLMT_SPT_PORT_ID0;
963 pSPacket->PortId[1] = SK_RLMT_SPT_PORT_ID1;
964 pSPacket->MessageAge[0] = SK_RLMT_SPT_MSG_AGE0;
965 pSPacket->MessageAge[1] = SK_RLMT_SPT_MSG_AGE1;
966 pSPacket->MaxAge[0] = SK_RLMT_SPT_MAX_AGE0;
967 pSPacket->MaxAge[1] = SK_RLMT_SPT_MAX_AGE1;
968 pSPacket->HelloTime[0] = SK_RLMT_SPT_HELLO_TIME0;
969 pSPacket->HelloTime[1] = SK_RLMT_SPT_HELLO_TIME1;
970 pSPacket->ForwardDelay[0] = SK_RLMT_SPT_FWD_DELAY0;
971 pSPacket->ForwardDelay[1] = SK_RLMT_SPT_FWD_DELAY1;
973 Length = SK_RLMT_MAX_PACKET_SIZE; /* Or smaller. */
974 pMb->Length = Length;
975 pMb->PortIdx = PortNumber;
977 SK_U16_TO_NETWORK_ORDER(Length, &pSPacket->TypeLen[0]);
979 pAC->Rlmt.Port[PortNumber].TxSpHelloReqCts++;
983 } /* SkRlmtBuildSpanningTreePacket */
986 /******************************************************************************
988 * SkRlmtSend - build and send check packets
991 * Depending on the RLMT state and the checking state, several packets
992 * are sent through the indicated port.
1000 RLMT_STATIC void SkRlmtSend(
1001 SK_AC *pAC, /* Adapter Context */
1002 SK_IOC IoC, /* I/O Context */
1003 SK_U32 PortNumber) /* Sending port */
1007 SK_RLMT_PORT *pRPort;
1009 pRPort = &pAC->Rlmt.Port[PortNumber];
1010 if (pAC->Rlmt.Port[PortNumber].Net->RlmtMode & SK_RLMT_CHECK_LOC_LINK) {
1011 if (pRPort->CheckingState & (SK_RLMT_PCS_TX | SK_RLMT_PCS_RX)) {
1012 /* Port is suspicious. Send the RLMT packet to the RLMT mc addr. */
1013 if ((Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC, PortNumber,
1014 SK_PACKET_ALIVE, &pAC->Addr.Port[PortNumber].CurrentMacAddress,
1015 &SkRlmtMcAddr)) != NULL) {
1016 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1021 * Send a directed RLMT packet to all ports that are
1022 * checked by the indicated port.
1024 for (j = 0; j < pRPort->PortsChecked; j++) {
1025 if ((Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC, PortNumber,
1026 SK_PACKET_ALIVE, &pAC->Addr.Port[PortNumber].CurrentMacAddress,
1027 &pRPort->PortCheck[j].CheckAddr)) != NULL) {
1028 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1034 if ((pAC->Rlmt.Port[PortNumber].Net->RlmtMode & SK_RLMT_CHECK_SEG) &&
1035 (pAC->Rlmt.Port[PortNumber].Net->CheckingState & SK_RLMT_RCS_SEND_SEG)) {
1037 * Send a BPDU packet to make a connected switch tell us
1038 * the correct root bridge.
1040 if ((Para.pParaPtr =
1041 SkRlmtBuildSpanningTreePacket(pAC, IoC, PortNumber)) != NULL) {
1042 pAC->Rlmt.Port[PortNumber].Net->CheckingState &= ~SK_RLMT_RCS_SEND_SEG;
1043 pRPort->RootIdSet = SK_FALSE;
1045 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1046 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_TX,
1047 ("SkRlmtSend: BPDU Packet on Port %u.\n", PortNumber))
1054 /******************************************************************************
1056 * SkRlmtPortReceives - check if port is (going) down and bring it up
1059 * This routine checks if a port who received a non-BPDU packet
1060 * needs to go up or needs to be stopped going down.
1063 * runtime, pageable?
1068 RLMT_STATIC void SkRlmtPortReceives(
1069 SK_AC *pAC, /* Adapter Context */
1070 SK_IOC IoC, /* I/O Context */
1071 SK_U32 PortNumber) /* Port to check */
1073 SK_RLMT_PORT *pRPort;
1076 pRPort = &pAC->Rlmt.Port[PortNumber];
1077 pRPort->PortNoRx = SK_FALSE;
1079 if ((pRPort->PortState == SK_RLMT_PS_DOWN) &&
1080 !(pRPort->CheckingState & SK_RLMT_PCS_TX)) {
1082 * Port is marked down (rx), but received a non-BPDU packet.
1085 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1086 ("SkRlmtPacketReceive: Received on PortDown.\n"))
1088 pRPort->PortState = SK_RLMT_PS_GOING_UP;
1089 pRPort->GuTimeStamp = SkOsGetTime(pAC);
1090 Para.Para32[0] = PortNumber;
1091 Para.Para32[1] = (SK_U32)-1;
1092 SkTimerStart(pAC, IoC, &pRPort->UpTimer, SK_RLMT_PORTUP_TIM_VAL,
1093 SKGE_RLMT, SK_RLMT_PORTUP_TIM, Para);
1094 pRPort->CheckingState &= ~SK_RLMT_PCS_RX;
1095 /* pAC->Rlmt.CheckSwitch = SK_TRUE; */
1096 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
1097 } /* PortDown && !SuspectTx */
1098 else if (pRPort->CheckingState & SK_RLMT_PCS_RX) {
1099 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1100 ("SkRlmtPacketReceive: Stop bringing port down.\n"))
1101 SkTimerStop(pAC, IoC, &pRPort->DownRxTimer);
1102 pRPort->CheckingState &= ~SK_RLMT_PCS_RX;
1103 /* pAC->Rlmt.CheckSwitch = SK_TRUE; */
1104 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
1105 } /* PortGoingDown */
1108 } /* SkRlmtPortReceives */
1111 /******************************************************************************
1113 * SkRlmtPacketReceive - receive a packet for closer examination
1116 * This routine examines a packet more closely than SK_RLMT_LOOKAHEAD.
1119 * runtime, pageable?
1124 RLMT_STATIC void SkRlmtPacketReceive(
1125 SK_AC *pAC, /* Adapter Context */
1126 SK_IOC IoC, /* I/O Context */
1127 SK_MBUF *pMb) /* Received packet */
1130 extern void DumpData(char *p, int size);
1136 SK_ADDR_PORT *pAPort;
1137 SK_RLMT_PORT *pRPort;
1138 SK_RLMT_PACKET *pRPacket;
1139 SK_SPTREE_PACKET *pSPacket;
1142 PortNumber = pMb->PortIdx;
1143 pAPort = &pAC->Addr.Port[PortNumber];
1144 pRPort = &pAC->Rlmt.Port[PortNumber];
1146 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1147 ("SkRlmtPacketReceive: PortNumber == %d.\n", PortNumber))
1149 pRPacket = (SK_RLMT_PACKET*)pMb->pData;
1150 pSPacket = (SK_SPTREE_PACKET*)pRPacket;
1153 DumpData((char *)pRPacket, 32);
1156 if ((pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot) != 0) {
1157 SkRlmtPortReceives(pAC, IoC, PortNumber);
1160 /* Check destination address. */
1162 if (!SK_ADDR_EQUAL(pAPort->CurrentMacAddress.a, pRPacket->DstAddr) &&
1163 !SK_ADDR_EQUAL(SkRlmtMcAddr.a, pRPacket->DstAddr) &&
1164 !SK_ADDR_EQUAL(BridgeMcAddr.a, pRPacket->DstAddr)) {
1166 /* Not sent to current MAC or registered MC address => Trash it. */
1167 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1168 ("SkRlmtPacketReceive: Not for me.\n"))
1170 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1173 else if (SK_ADDR_EQUAL(pAPort->CurrentMacAddress.a, pRPacket->SrcAddr)) {
1176 * Was sent by same port (may happen during port switching
1177 * or in case of duplicate MAC addresses).
1181 * Check for duplicate address here:
1182 * If Packet.Random != My.Random => DupAddr.
1184 for (i = 3; i >= 0; i--) {
1185 if (pRPort->Random[i] != pRPacket->Random[i]) {
1191 * CAUTION: Do not check for duplicate MAC address in RLMT Alive Reply
1192 * packets (they have the LLC_COMMAND_RESPONSE_BIT set in
1195 if (i >= 0 && pRPacket->DSap == SK_RLMT_DSAP &&
1196 pRPacket->Ctrl == SK_RLMT_CTRL &&
1197 pRPacket->SSap == SK_RLMT_SSAP &&
1198 pRPacket->Indicator[0] == SK_RLMT_INDICATOR0 &&
1199 pRPacket->Indicator[1] == SK_RLMT_INDICATOR1 &&
1200 pRPacket->Indicator[2] == SK_RLMT_INDICATOR2 &&
1201 pRPacket->Indicator[3] == SK_RLMT_INDICATOR3 &&
1202 pRPacket->Indicator[4] == SK_RLMT_INDICATOR4 &&
1203 pRPacket->Indicator[5] == SK_RLMT_INDICATOR5 &&
1204 pRPacket->Indicator[6] == SK_RLMT_INDICATOR6) {
1205 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1206 ("SkRlmtPacketReceive: Duplicate MAC Address.\n"))
1208 /* Error Log entry. */
1209 SK_ERR_LOG(pAC, SK_ERRCL_COMM, SKERR_RLMT_E006, SKERR_RLMT_E006_MSG);
1212 /* Simply trash it. */
1213 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1214 ("SkRlmtPacketReceive: Sent by me.\n"))
1217 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1221 /* Check SuspectTx entries. */
1222 if (pRPort->PortsSuspect > 0) {
1223 for (j = 0; j < pRPort->PortsChecked; j++) {
1224 if (pRPort->PortCheck[j].SuspectTx &&
1226 pRPacket->SrcAddr, pRPort->PortCheck[j].CheckAddr.a)) {
1227 pRPort->PortCheck[j].SuspectTx = SK_FALSE;
1228 pRPort->PortsSuspect--;
1234 /* Determine type of packet. */
1235 if (pRPacket->DSap == SK_RLMT_DSAP &&
1236 pRPacket->Ctrl == SK_RLMT_CTRL &&
1237 (pRPacket->SSap & ~LLC_COMMAND_RESPONSE_BIT) == SK_RLMT_SSAP &&
1238 pRPacket->Indicator[0] == SK_RLMT_INDICATOR0 &&
1239 pRPacket->Indicator[1] == SK_RLMT_INDICATOR1 &&
1240 pRPacket->Indicator[2] == SK_RLMT_INDICATOR2 &&
1241 pRPacket->Indicator[3] == SK_RLMT_INDICATOR3 &&
1242 pRPacket->Indicator[4] == SK_RLMT_INDICATOR4 &&
1243 pRPacket->Indicator[5] == SK_RLMT_INDICATOR5 &&
1244 pRPacket->Indicator[6] == SK_RLMT_INDICATOR6) {
1246 /* It's an RLMT packet. */
1247 PacketType = (SK_U16)((pRPacket->RlmtPacketType[0] << 8) |
1248 pRPacket->RlmtPacketType[1]);
1250 switch (PacketType) {
1251 case SK_PACKET_ANNOUNCE: /* Not yet used. */
1253 /* Build the check chain. */
1254 SkRlmtBuildCheckChain(pAC);
1257 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1258 ("SkRlmtPacketReceive: Announce.\n"))
1260 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1263 case SK_PACKET_ALIVE:
1264 if (pRPacket->SSap & LLC_COMMAND_RESPONSE_BIT) {
1265 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1266 ("SkRlmtPacketReceive: Alive Reply.\n"))
1268 if (!(pAC->Addr.Port[PortNumber].PromMode & SK_PROM_MODE_LLC) ||
1270 pRPacket->DstAddr, pAPort->CurrentMacAddress.a)) {
1271 /* Obviously we could send something. */
1272 if (pRPort->CheckingState & SK_RLMT_PCS_TX) {
1273 pRPort->CheckingState &= ~SK_RLMT_PCS_TX;
1274 SkTimerStop(pAC, IoC, &pRPort->DownTxTimer);
1277 if ((pRPort->PortState == SK_RLMT_PS_DOWN) &&
1278 !(pRPort->CheckingState & SK_RLMT_PCS_RX)) {
1279 pRPort->PortState = SK_RLMT_PS_GOING_UP;
1280 pRPort->GuTimeStamp = SkOsGetTime(pAC);
1282 SkTimerStop(pAC, IoC, &pRPort->DownTxTimer);
1284 Para.Para32[0] = PortNumber;
1285 Para.Para32[1] = (SK_U32)-1;
1286 SkTimerStart(pAC, IoC, &pRPort->UpTimer,
1287 SK_RLMT_PORTUP_TIM_VAL, SKGE_RLMT,
1288 SK_RLMT_PORTUP_TIM, Para);
1292 /* Mark sending port as alive? */
1293 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1295 else { /* Alive Request Packet. */
1296 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1297 ("SkRlmtPacketReceive: Alive Request.\n"))
1299 pRPort->RxHelloCts++;
1302 for (i = 0; i < SK_MAC_ADDR_LEN; i++) {
1303 pRPacket->DstAddr[i] = pRPacket->SrcAddr[i];
1304 pRPacket->SrcAddr[i] =
1305 pAC->Addr.Port[PortNumber].CurrentMacAddress.a[i];
1307 pRPacket->SSap |= LLC_COMMAND_RESPONSE_BIT;
1309 Para.pParaPtr = pMb;
1310 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1314 case SK_PACKET_CHECK_TX:
1315 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1316 ("SkRlmtPacketReceive: Check your tx line.\n"))
1318 /* A port checking us requests us to check our tx line. */
1319 pRPort->CheckingState |= SK_RLMT_PCS_TX;
1321 /* Start PortDownTx timer. */
1322 Para.Para32[0] = PortNumber;
1323 Para.Para32[1] = (SK_U32)-1;
1324 SkTimerStart(pAC, IoC, &pRPort->DownTxTimer,
1325 SK_RLMT_PORTDOWN_TIM_VAL, SKGE_RLMT,
1326 SK_RLMT_PORTDOWN_TX_TIM, Para);
1328 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1330 if ((Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC, PortNumber,
1331 SK_PACKET_ALIVE, &pAC->Addr.Port[PortNumber].CurrentMacAddress,
1332 &SkRlmtMcAddr)) != NULL) {
1333 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1337 case SK_PACKET_ADDR_CHANGED:
1338 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1339 ("SkRlmtPacketReceive: Address Change.\n"))
1341 /* Build the check chain. */
1342 SkRlmtBuildCheckChain(pAC, pRPort->Net->NetNumber);
1343 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1347 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1348 ("SkRlmtPacketReceive: Unknown RLMT packet.\n"))
1351 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1354 else if (pSPacket->DSap == SK_RLMT_SPT_DSAP &&
1355 pSPacket->Ctrl == SK_RLMT_SPT_CTRL &&
1356 (pSPacket->SSap & ~LLC_COMMAND_RESPONSE_BIT) == SK_RLMT_SPT_SSAP) {
1357 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1358 ("SkRlmtPacketReceive: BPDU Packet.\n"))
1360 /* Spanning Tree packet. */
1361 pRPort->RxSpHelloCts++;
1363 if (!SK_ADDR_EQUAL(&pSPacket->RootId[2], &pAC->Addr.Net[pAC->Rlmt.
1364 Port[PortNumber].Net->NetNumber].CurrentMacAddress.a[0])) {
1366 * Check segmentation if a new root bridge is set and
1367 * the segmentation check is not currently running.
1369 if (!SK_ADDR_EQUAL(&pSPacket->RootId[2], &pRPort->Root.Id[2]) &&
1370 (pAC->Rlmt.Port[PortNumber].Net->LinksUp > 1) &&
1371 (pAC->Rlmt.Port[PortNumber].Net->RlmtMode & SK_RLMT_CHECK_SEG)
1372 != 0 && (pAC->Rlmt.Port[PortNumber].Net->CheckingState &
1373 SK_RLMT_RCS_SEG) == 0) {
1374 pAC->Rlmt.Port[PortNumber].Net->CheckingState |=
1375 SK_RLMT_RCS_START_SEG | SK_RLMT_RCS_SEND_SEG;
1378 /* Store tree view of this port. */
1379 for (i = 0; i < 8; i++) {
1380 pRPort->Root.Id[i] = pSPacket->RootId[i];
1382 pRPort->RootIdSet = SK_TRUE;
1384 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_DUMP,
1385 ("Root ID %d: %02x %02x %02x %02x %02x %02x %02x %02x.\n",
1387 pRPort->Root.Id[0], pRPort->Root.Id[1],
1388 pRPort->Root.Id[2], pRPort->Root.Id[3],
1389 pRPort->Root.Id[4], pRPort->Root.Id[5],
1390 pRPort->Root.Id[6], pRPort->Root.Id[7]))
1393 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1394 if ((pAC->Rlmt.Port[PortNumber].Net->CheckingState &
1395 SK_RLMT_RCS_REPORT_SEG) != 0) {
1396 SkRlmtCheckSeg(pAC, IoC, pAC->Rlmt.Port[PortNumber].Net->NetNumber);
1400 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX,
1401 ("SkRlmtPacketReceive: Unknown Packet Type.\n"))
1403 /* Unknown packet. */
1404 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
1407 } /* SkRlmtPacketReceive */
1410 /******************************************************************************
1412 * SkRlmtCheckPort - check if a port works
1415 * This routine checks if a port whose link is up received something
1416 * and if it seems to transmit successfully.
1418 * # PortState: PsInit, PsLinkDown, PsDown, PsGoingUp, PsUp
1419 * # PortCheckingState (Bitfield): ChkTx, ChkRx, ChkSeg
1420 * # RlmtCheckingState (Bitfield): ChkSeg, StartChkSeg, ReportSeg
1422 * if (Rx - RxBpdu == 0) { # No rx.
1423 * if (state == PsUp) {
1424 * PortCheckingState |= ChkRx
1426 * if (ModeCheckSeg && (Timeout ==
1427 * TO_SHORTEN(RLMT_DEFAULT_TIMEOUT))) {
1428 * RlmtCheckingState |= ChkSeg)
1429 * PortCheckingState |= ChkSeg
1431 * NewTimeout = TO_SHORTEN(Timeout)
1432 * if (NewTimeout < RLMT_MIN_TIMEOUT) {
1433 * NewTimeout = RLMT_MIN_TIMEOUT
1434 * PortState = PsDown
1438 * else { # something was received
1439 * # Set counter to 0 at LinkDown?
1440 * # No - rx may be reported after LinkDown ???
1441 * PortCheckingState &= ~ChkRx
1442 * NewTimeout = RLMT_DEFAULT_TIMEOUT
1445 * is my tx line bad? --
1446 * send RLMT multicast and report
1447 * back internally? (only possible
1448 * between ports on same adapter)
1452 * - tx line of port set to check me
1454 * - no other port/adapter available or set
1456 * - adapter checking me has a longer
1458 * ??? anything that can be done here?
1463 * runtime, pageable?
1466 * New timeout value.
1468 RLMT_STATIC SK_U32 SkRlmtCheckPort(
1469 SK_AC *pAC, /* Adapter Context */
1470 SK_IOC IoC, /* I/O Context */
1471 SK_U32 PortNumber) /* Port to check */
1475 SK_RLMT_PORT *pRPort;
1478 pRPort = &pAC->Rlmt.Port[PortNumber];
1480 if ((pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot) == 0) {
1481 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1482 ("SkRlmtCheckPort %d: No (%d) receives in last time slot.\n",
1483 PortNumber, pRPort->PacketsPerTimeSlot))
1486 * Check segmentation if there was no receive at least twice
1487 * in a row (PortNoRx is already set) and the segmentation
1488 * check is not currently running.
1491 if (pRPort->PortNoRx && (pAC->Rlmt.Port[PortNumber].Net->LinksUp > 1) &&
1492 (pAC->Rlmt.Port[PortNumber].Net->RlmtMode & SK_RLMT_CHECK_SEG) &&
1493 !(pAC->Rlmt.Port[PortNumber].Net->CheckingState & SK_RLMT_RCS_SEG)) {
1494 pAC->Rlmt.Port[PortNumber].Net->CheckingState |=
1495 SK_RLMT_RCS_START_SEG | SK_RLMT_RCS_SEND_SEG;
1498 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1499 ("SkRlmtCheckPort: PortsSuspect %d, PcsRx %d.\n",
1500 pRPort->PortsSuspect, pRPort->CheckingState & SK_RLMT_PCS_RX))
1502 if (pRPort->PortState != SK_RLMT_PS_DOWN) {
1503 NewTimeout = TO_SHORTEN(pAC->Rlmt.Port[PortNumber].Net->TimeoutValue);
1504 if (NewTimeout < SK_RLMT_MIN_TO_VAL) {
1505 NewTimeout = SK_RLMT_MIN_TO_VAL;
1508 if (!(pRPort->CheckingState & SK_RLMT_PCS_RX)) {
1509 Para.Para32[0] = PortNumber;
1510 pRPort->CheckingState |= SK_RLMT_PCS_RX;
1513 * What shall we do if the port checked by this one receives
1514 * our request frames? What's bad - our rx line or his tx line?
1516 Para.Para32[1] = (SK_U32)-1;
1517 SkTimerStart(pAC, IoC, &pRPort->DownRxTimer,
1518 SK_RLMT_PORTDOWN_TIM_VAL, SKGE_RLMT,
1519 SK_RLMT_PORTDOWN_RX_TIM, Para);
1521 for (i = 0; i < pRPort->PortsChecked; i++) {
1522 if (pRPort->PortCheck[i].SuspectTx) {
1525 pRPort->PortCheck[i].SuspectTx = SK_TRUE;
1526 pRPort->PortsSuspect++;
1527 if ((Para.pParaPtr =
1528 SkRlmtBuildPacket(pAC, IoC, PortNumber, SK_PACKET_CHECK_TX,
1529 &pAC->Addr.Port[PortNumber].CurrentMacAddress,
1530 &pRPort->PortCheck[i].CheckAddr)) != NULL) {
1531 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1536 else { /* PortDown -- or all partners suspect. */
1537 NewTimeout = SK_RLMT_DEF_TO_VAL;
1539 pRPort->PortNoRx = SK_TRUE;
1541 else { /* A non-BPDU packet was received. */
1542 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1543 ("SkRlmtCheckPort %d: %d (%d) receives in last time slot.\n",
1545 pRPort->PacketsPerTimeSlot - pRPort->BpduPacketsPerTimeSlot,
1546 pRPort->PacketsPerTimeSlot))
1548 SkRlmtPortReceives(pAC, IoC, PortNumber);
1549 if (pAC->Rlmt.CheckSwitch) {
1550 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
1553 NewTimeout = SK_RLMT_DEF_TO_VAL;
1556 return (NewTimeout);
1557 } /* SkRlmtCheckPort */
1560 /******************************************************************************
1562 * SkRlmtSelectBcRx - select new active port, criteria 1 (CLP)
1565 * This routine selects the port that received a broadcast frame
1566 * substantially later than all other ports.
1569 * runtime, pageable?
1574 RLMT_STATIC SK_BOOL SkRlmtSelectBcRx(
1575 SK_AC *pAC, /* Adapter Context */
1576 SK_IOC IoC, /* I/O Context */
1577 SK_U32 Active, /* Active port */
1578 SK_U32 PrefPort, /* Preferred port */
1579 SK_U32 *pSelect) /* New active port */
1585 BcTimeStamp = 0; /* Not totally necessary, but feeling better. */
1586 PortFound = SK_FALSE;
1588 /* Select port with the latest TimeStamp. */
1589 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1591 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1592 ("TimeStamp Port %d (Down: %d, NoRx: %d): %08x %08x.\n",
1594 pAC->Rlmt.Port[i].PortDown, pAC->Rlmt.Port[i].PortNoRx,
1595 *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_HI32),
1596 *((SK_U32*)(&pAC->Rlmt.Port[i].BcTimeStamp) + OFFS_LO32)))
1598 if (!pAC->Rlmt.Port[i].PortDown && !pAC->Rlmt.Port[i].PortNoRx) {
1599 if (!PortFound || pAC->Rlmt.Port[i].BcTimeStamp > BcTimeStamp) {
1600 BcTimeStamp = pAC->Rlmt.Port[i].BcTimeStamp;
1602 PortFound = SK_TRUE;
1608 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1609 ("Port %d received the last broadcast.\n", *pSelect))
1611 /* Look if another port's time stamp is similar. */
1612 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1613 if (i == *pSelect) {
1616 if (!pAC->Rlmt.Port[i].PortDown && !pAC->Rlmt.Port[i].PortNoRx &&
1617 (pAC->Rlmt.Port[i].BcTimeStamp >
1618 BcTimeStamp - SK_RLMT_BC_DELTA ||
1619 pAC->Rlmt.Port[i].BcTimeStamp +
1620 SK_RLMT_BC_DELTA > BcTimeStamp)) {
1621 PortFound = SK_FALSE;
1623 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1624 ("Port %d received a broadcast at a similar time.\n", i))
1632 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1633 ("SK_RLMT_SELECT_BCRX found Port %d receiving the substantially "
1634 "latest broadcast (%u).\n",
1636 BcTimeStamp - pAC->Rlmt.Port[1 - *pSelect].BcTimeStamp))
1641 } /* SkRlmtSelectBcRx */
1644 /******************************************************************************
1646 * SkRlmtSelectNotSuspect - select new active port, criteria 2 (CLP)
1649 * This routine selects a good port (it is PortUp && !SuspectRx).
1652 * runtime, pageable?
1657 RLMT_STATIC SK_BOOL SkRlmtSelectNotSuspect(
1658 SK_AC *pAC, /* Adapter Context */
1659 SK_IOC IoC, /* I/O Context */
1660 SK_U32 Active, /* Active port */
1661 SK_U32 PrefPort, /* Preferred port */
1662 SK_U32 *pSelect) /* New active port */
1667 PortFound = SK_FALSE;
1669 /* Select first port that is PortUp && !SuspectRx. */
1670 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1671 if (!pAC->Rlmt.Port[i].PortDown &&
1672 !(pAC->Rlmt.Port[i].CheckingState & SK_RLMT_PCS_RX)) {
1674 if (!pAC->Rlmt.Port[Active].PortDown &&
1675 !(pAC->Rlmt.Port[Active].CheckingState & SK_RLMT_PCS_RX)) {
1678 if (!pAC->Rlmt.Port[PrefPort].PortDown &&
1679 !(pAC->Rlmt.Port[PrefPort].CheckingState & SK_RLMT_PCS_RX)) {
1680 *pSelect = PrefPort;
1682 PortFound = SK_TRUE;
1683 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1684 ("SK_RLMT_SELECT_NOTSUSPECT found Port %d up and not check RX.\n",
1690 } /* SkRlmtSelectNotSuspect */
1693 /******************************************************************************
1695 * SkRlmtSelectUp - select new active port, criteria 3, 4 (CLP)
1698 * This routine selects a port that is up.
1701 * runtime, pageable?
1706 RLMT_STATIC SK_BOOL SkRlmtSelectUp(
1707 SK_AC *pAC, /* Adapter Context */
1708 SK_IOC IoC, /* I/O Context */
1709 SK_U32 Active, /* Active port */
1710 SK_U32 PrefPort, /* Preferred port */
1711 SK_U32 *pSelect, /* New active port */
1712 SK_BOOL AutoNegDone) /* Successfully auto-negotiated? */
1717 PortFound = SK_FALSE;
1719 /* Select first port that is PortUp. */
1720 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1721 if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_UP &&
1722 pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) {
1724 if (pAC->Rlmt.Port[Active].PortState == SK_RLMT_PS_UP &&
1725 pAC->GIni.GP[Active].PAutoNegFail != AutoNegDone) {
1728 if (pAC->Rlmt.Port[PrefPort].PortState == SK_RLMT_PS_UP &&
1729 pAC->GIni.GP[PrefPort].PAutoNegFail != AutoNegDone) {
1730 *pSelect = PrefPort;
1732 PortFound = SK_TRUE;
1733 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1734 ("SK_RLMT_SELECT_UP found Port %d up.\n", *pSelect))
1739 } /* SkRlmtSelectUp */
1742 /******************************************************************************
1744 * SkRlmtSelectGoingUp - select new active port, criteria 5, 6 (CLP)
1747 * This routine selects the port that is going up for the longest time.
1750 * runtime, pageable?
1755 RLMT_STATIC SK_BOOL SkRlmtSelectGoingUp(
1756 SK_AC *pAC, /* Adapter Context */
1757 SK_IOC IoC, /* I/O Context */
1758 SK_U32 Active, /* Active port */
1759 SK_U32 PrefPort, /* Preferred port */
1760 SK_U32 *pSelect, /* New active port */
1761 SK_BOOL AutoNegDone) /* Successfully auto-negotiated? */
1768 PortFound = SK_FALSE;
1770 /* Select port that is PortGoingUp for the longest time. */
1771 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1772 if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_GOING_UP &&
1773 pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) {
1774 GuTimeStamp = pAC->Rlmt.Port[i].GuTimeStamp;
1776 PortFound = SK_TRUE;
1785 for (i = *pSelect + 1; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1786 if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_GOING_UP &&
1787 pAC->Rlmt.Port[i].GuTimeStamp < GuTimeStamp &&
1788 pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) {
1789 GuTimeStamp = pAC->Rlmt.Port[i].GuTimeStamp;
1794 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1795 ("SK_RLMT_SELECT_GOINGUP found Port %d going up.\n", *pSelect))
1797 } /* SkRlmtSelectGoingUp */
1800 /******************************************************************************
1802 * SkRlmtSelectDown - select new active port, criteria 7, 8 (CLP)
1805 * This routine selects a port that is down.
1808 * runtime, pageable?
1813 RLMT_STATIC SK_BOOL SkRlmtSelectDown(
1814 SK_AC *pAC, /* Adapter Context */
1815 SK_IOC IoC, /* I/O Context */
1816 SK_U32 Active, /* Active port */
1817 SK_U32 PrefPort, /* Preferred port */
1818 SK_U32 *pSelect, /* New active port */
1819 SK_BOOL AutoNegDone) /* Successfully auto-negotiated? */
1824 PortFound = SK_FALSE;
1826 /* Select first port that is PortDown. */
1827 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
1828 if (pAC->Rlmt.Port[i].PortState == SK_RLMT_PS_DOWN &&
1829 pAC->GIni.GP[i].PAutoNegFail != AutoNegDone) {
1831 if (pAC->Rlmt.Port[Active].PortState == SK_RLMT_PS_DOWN &&
1832 pAC->GIni.GP[Active].PAutoNegFail != AutoNegDone) {
1835 if (pAC->Rlmt.Port[PrefPort].PortState == SK_RLMT_PS_DOWN &&
1836 pAC->GIni.GP[PrefPort].PAutoNegFail != AutoNegDone) {
1837 *pSelect = PrefPort;
1839 PortFound = SK_TRUE;
1840 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
1841 ("SK_RLMT_SELECT_DOWN found Port %d down.\n", *pSelect))
1846 } /* SkRlmtSelectDown */
1849 /******************************************************************************
1851 * SkRlmtCheckSwitch - select new active port and switch to it
1854 * This routine decides which port should be the active one and queues
1855 * port switching if necessary.
1858 * runtime, pageable?
1863 RLMT_STATIC void SkRlmtCheckSwitch(
1864 SK_AC *pAC, /* Adapter Context */
1865 SK_IOC IoC, /* I/O Context */
1866 SK_U32 NetIdx) /* Net index */
1874 Active = pAC->Rlmt.Net[NetIdx].ActivePort; /* Index of active port. */
1875 PrefPort = pAC->Rlmt.Net[NetIdx].PrefPort; /* Index of preferred port. */
1876 PortFound = SK_FALSE;
1877 pAC->Rlmt.CheckSwitch = SK_FALSE;
1879 #if 0 /* RW 2001/10/18 - active port becomes always prefered one */
1880 if (pAC->Rlmt.Net[NetIdx].Preference == 0xFFFFFFFF) { /* Automatic */
1881 /* disable auto-fail back */
1886 if (pAC->Rlmt.Net[NetIdx].LinksUp == 0) {
1887 /* Last link went down - shut down the net. */
1888 pAC->Rlmt.Net[NetIdx].RlmtState = SK_RLMT_RS_NET_DOWN;
1889 Para.Para32[0] = SK_RLMT_NET_DOWN_TEMP;
1890 Para.Para32[1] = NetIdx;
1891 SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_DOWN, Para);
1893 Para.Para32[0] = pAC->Rlmt.Net[NetIdx].
1894 Port[pAC->Rlmt.Net[NetIdx].ActivePort]->PortNumber;
1895 Para.Para32[1] = NetIdx;
1896 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_ACTIVE_DOWN, Para);
1898 } /* pAC->Rlmt.LinksUp == 0 */
1899 else if (pAC->Rlmt.Net[NetIdx].LinksUp == 1 &&
1900 pAC->Rlmt.Net[NetIdx].RlmtState == SK_RLMT_RS_NET_DOWN) {
1901 /* First link came up - get the net up. */
1902 pAC->Rlmt.Net[NetIdx].RlmtState = SK_RLMT_RS_NET_UP;
1905 * If pAC->Rlmt.ActivePort != Para.Para32[0],
1906 * the DRV switches to the port that came up.
1908 for (i = 0; i < pAC->Rlmt.Net[NetIdx].NumPorts; i++) {
1909 if (!pAC->Rlmt.Net[NetIdx].Port[i]->LinkDown) {
1910 if (!pAC->Rlmt.Net[NetIdx].Port[Active]->LinkDown) {
1913 if (!pAC->Rlmt.Net[NetIdx].Port[PrefPort]->LinkDown) {
1916 PortFound = SK_TRUE;
1922 Para.Para32[0] = pAC->Rlmt.Net[NetIdx].Port[i]->PortNumber;
1923 Para.Para32[1] = NetIdx;
1924 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_ACTIVE_UP, Para);
1926 pAC->Rlmt.Net[NetIdx].ActivePort = i;
1927 Para.Para32[0] = pAC->Rlmt.Net[NetIdx].Port[i]->PortNumber;
1928 Para.Para32[1] = NetIdx;
1929 SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_UP, Para);
1931 if ((pAC->Rlmt.Net[NetIdx].RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
1932 (Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC,
1933 pAC->Rlmt.Net[NetIdx].Port[i]->PortNumber,
1934 SK_PACKET_ANNOUNCE, &pAC->Addr.Net[NetIdx].
1935 CurrentMacAddress, &SkRlmtMcAddr)) != NULL) {
1937 * Send announce packet to RLMT multicast address to force
1938 * switches to learn the new location of the logical MAC address.
1940 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
1944 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E007, SKERR_RLMT_E007_MSG);
1948 } /* LinksUp == 1 && RlmtState == SK_RLMT_RS_NET_DOWN */
1949 else { /* Cannot be reached in dual-net mode. */
1950 Para.Para32[0] = Active;
1954 * If RLMT Mode != CheckLinkState
1955 * select port that received a broadcast frame substantially later
1956 * than all other ports
1957 * else select first port that is not SuspectRx
1958 * else select first port that is PortUp
1959 * else select port that is PortGoingUp for the longest time
1960 * else select first port that is PortDown
1963 * For the preselected port:
1964 * If ActivePort is equal in quality, select ActivePort.
1966 * If PrefPort is equal in quality, select PrefPort.
1968 * If ActivePort != SelectedPort,
1969 * If old ActivePort is LinkDown,
1974 /* check of ChgBcPrio flag added */
1975 if ((pAC->Rlmt.Net[0].RlmtMode != SK_RLMT_MODE_CLS) &&
1976 (!pAC->Rlmt.Net[0].ChgBcPrio)) {
1979 PortFound = SkRlmtSelectBcRx(
1980 pAC, IoC, Active, PrefPort, &Para.Para32[1]);
1984 PortFound = SkRlmtSelectNotSuspect(
1985 pAC, IoC, Active, PrefPort, &Para.Para32[1]);
1987 } /* pAC->Rlmt.RlmtMode != SK_RLMT_MODE_CLS */
1989 /* with changed priority for last broadcast received */
1990 if ((pAC->Rlmt.Net[0].RlmtMode != SK_RLMT_MODE_CLS) &&
1991 (pAC->Rlmt.Net[0].ChgBcPrio)) {
1993 PortFound = SkRlmtSelectNotSuspect(
1994 pAC, IoC, Active, PrefPort, &Para.Para32[1]);
1998 PortFound = SkRlmtSelectBcRx(
1999 pAC, IoC, Active, PrefPort, &Para.Para32[1]);
2001 } /* pAC->Rlmt.RlmtMode != SK_RLMT_MODE_CLS */
2004 PortFound = SkRlmtSelectUp(
2005 pAC, IoC, Active, PrefPort, &Para.Para32[1], AUTONEG_SUCCESS);
2009 PortFound = SkRlmtSelectUp(
2010 pAC, IoC, Active, PrefPort, &Para.Para32[1], AUTONEG_FAILED);
2014 PortFound = SkRlmtSelectGoingUp(
2015 pAC, IoC, Active, PrefPort, &Para.Para32[1], AUTONEG_SUCCESS);
2019 PortFound = SkRlmtSelectGoingUp(
2020 pAC, IoC, Active, PrefPort, &Para.Para32[1], AUTONEG_FAILED);
2023 if (pAC->Rlmt.Net[0].RlmtMode != SK_RLMT_MODE_CLS) {
2025 PortFound = SkRlmtSelectDown(pAC, IoC,
2026 Active, PrefPort, &Para.Para32[1], AUTONEG_SUCCESS);
2030 PortFound = SkRlmtSelectDown(pAC, IoC,
2031 Active, PrefPort, &Para.Para32[1], AUTONEG_FAILED);
2033 } /* pAC->Rlmt.RlmtMode != SK_RLMT_MODE_CLS */
2037 if (Para.Para32[1] != Active) {
2038 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2039 ("Active: %d, Para1: %d.\n", Active, Para.Para32[1]))
2040 pAC->Rlmt.Net[NetIdx].ActivePort = Para.Para32[1];
2041 Para.Para32[0] = pAC->Rlmt.Net[NetIdx].
2042 Port[Para.Para32[0]]->PortNumber;
2043 Para.Para32[1] = pAC->Rlmt.Net[NetIdx].
2044 Port[Para.Para32[1]]->PortNumber;
2045 SK_HWAC_LINK_LED(pAC, IoC, Para.Para32[1], SK_LED_ACTIVE);
2046 if (pAC->Rlmt.Port[Active].LinkDown) {
2047 SkEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_HARD, Para);
2050 SK_HWAC_LINK_LED(pAC, IoC, Para.Para32[0], SK_LED_STANDBY);
2051 SkEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_SOFT, Para);
2053 Para.Para32[1] = NetIdx;
2055 pAC->Rlmt.Net[NetIdx].Port[Para.Para32[0]]->PortNumber;
2056 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_ACTIVE_DOWN, Para);
2057 Para.Para32[0] = pAC->Rlmt.Net[NetIdx].
2058 Port[pAC->Rlmt.Net[NetIdx].ActivePort]->PortNumber;
2059 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_ACTIVE_UP, Para);
2060 if ((pAC->Rlmt.Net[NetIdx].RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
2061 (Para.pParaPtr = SkRlmtBuildPacket(pAC, IoC, Para.Para32[0],
2062 SK_PACKET_ANNOUNCE, &pAC->Addr.Net[NetIdx].CurrentMacAddress,
2063 &SkRlmtMcAddr)) != NULL) {
2065 * Send announce packet to RLMT multicast address to force
2066 * switches to learn the new location of the logical
2069 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para);
2070 } /* (Para.pParaPtr = SkRlmtBuildPacket(...)) != NULL */
2071 } /* Para.Para32[1] != Active */
2074 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E004, SKERR_RLMT_E004_MSG);
2076 } /* LinksUp > 1 || LinksUp == 1 && RlmtState != SK_RLMT_RS_NET_DOWN */
2078 } /* SkRlmtCheckSwitch */
2081 /******************************************************************************
2083 * SkRlmtCheckSeg - Report if segmentation is detected
2086 * This routine checks if the ports see different root bridges and reports
2087 * segmentation in such a case.
2090 * runtime, pageable?
2095 RLMT_STATIC void SkRlmtCheckSeg(
2096 SK_AC *pAC, /* Adapter Context */
2097 SK_IOC IoC, /* I/O Context */
2098 SK_U32 NetIdx) /* Net number */
2105 pNet = &pAC->Rlmt.Net[NetIdx];
2106 pNet->RootIdSet = SK_FALSE;
2109 for (i = 0; i < pNet->NumPorts; i++) {
2110 if (pNet->Port[i]->LinkDown || !pNet->Port[i]->RootIdSet) {
2114 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_DUMP,
2115 ("Root ID %d: %02x %02x %02x %02x %02x %02x %02x %02x.\n", i,
2116 pNet->Port[i]->Root.Id[0], pNet->Port[i]->Root.Id[1],
2117 pNet->Port[i]->Root.Id[2], pNet->Port[i]->Root.Id[3],
2118 pNet->Port[i]->Root.Id[4], pNet->Port[i]->Root.Id[5],
2119 pNet->Port[i]->Root.Id[6], pNet->Port[i]->Root.Id[7]))
2121 if (!pNet->RootIdSet) {
2122 pNet->Root = pNet->Port[i]->Root;
2123 pNet->RootIdSet = SK_TRUE;
2127 for (j = 0; j < 8; j ++) {
2128 Equal &= pNet->Port[i]->Root.Id[j] == pNet->Root.Id[j];
2135 SK_ERR_LOG(pAC, SK_ERRCL_COMM, SKERR_RLMT_E005, SKERR_RLMT_E005_MSG);
2136 Para.Para32[0] = NetIdx;
2137 Para.Para32[1] = (SK_U32)-1;
2138 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_SEGMENTATION, Para);
2140 pNet->CheckingState &= ~SK_RLMT_RCS_REPORT_SEG;
2142 /* 2000-03-06 RA: New. */
2143 Para.Para32[0] = NetIdx;
2144 Para.Para32[1] = (SK_U32)-1;
2145 SkTimerStart(pAC, IoC, &pNet->SegTimer, SK_RLMT_SEG_TO_VAL,
2146 SKGE_RLMT, SK_RLMT_SEG_TIM, Para);
2149 } /* for (i = 0; i < pNet->NumPorts; i++) */
2151 /* 2000-03-06 RA: Moved here. */
2152 /* Segmentation check not running anymore. */
2153 pNet->CheckingState &= ~SK_RLMT_RCS_SEG;
2155 } /* SkRlmtCheckSeg */
2158 /******************************************************************************
2160 * SkRlmtPortStart - initialize port variables and start port
2163 * This routine initializes a port's variables and issues a PORT_START
2164 * to the HWAC module. This handles retries if the start fails or the
2165 * link eventually goes down.
2168 * runtime, pageable?
2173 RLMT_STATIC void SkRlmtPortStart(
2174 SK_AC *pAC, /* Adapter Context */
2175 SK_IOC IoC, /* I/O Context */
2176 SK_U32 PortNumber) /* Port number */
2180 pAC->Rlmt.Port[PortNumber].PortState = SK_RLMT_PS_LINK_DOWN;
2181 pAC->Rlmt.Port[PortNumber].PortStarted = SK_TRUE;
2182 pAC->Rlmt.Port[PortNumber].LinkDown = SK_TRUE;
2183 pAC->Rlmt.Port[PortNumber].PortDown = SK_TRUE;
2184 pAC->Rlmt.Port[PortNumber].CheckingState = 0;
2185 pAC->Rlmt.Port[PortNumber].RootIdSet = SK_FALSE;
2186 Para.Para32[0] = PortNumber;
2187 Para.Para32[1] = (SK_U32)-1;
2188 SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_START, Para);
2189 } /* SkRlmtPortStart */
2192 /******************************************************************************
2194 * SkRlmtEvtPortStartTim - PORT_START_TIM
2197 * This routine handles PORT_START_TIM events.
2200 * runtime, pageable?
2201 * may be called after SK_INIT_IO
2206 RLMT_STATIC void SkRlmtEvtPortStartTim(
2207 SK_AC *pAC, /* Adapter Context */
2208 SK_IOC IoC, /* I/O Context */
2209 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 -1 */
2213 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2214 ("SK_RLMT_PORTSTART_TIMEOUT Port %d Event BEGIN.\n", Para.Para32[0]))
2216 if (Para.Para32[1] != (SK_U32)-1) {
2217 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2218 ("Bad Parameter.\n"))
2219 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2220 ("SK_RLMT_PORTSTART_TIMEOUT Event EMPTY.\n"))
2225 * Used to start non-preferred ports if the preferred one
2227 * This timeout needs only be set when starting the first
2230 if (pAC->Rlmt.Port[Para.Para32[0]].LinkDown) {
2231 /* PORT_START failed. */
2232 for (i = 0; i < pAC->Rlmt.Port[Para.Para32[0]].Net->NumPorts; i++) {
2233 if (!pAC->Rlmt.Port[Para.Para32[0]].Net->Port[i]->PortStarted) {
2234 SkRlmtPortStart(pAC, IoC,
2235 pAC->Rlmt.Port[Para.Para32[0]].Net->Port[i]->PortNumber);
2240 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2241 ("SK_RLMT_PORTSTART_TIMEOUT Event END.\n"))
2242 } /* SkRlmtEvtPortStartTim */
2245 /******************************************************************************
2247 * SkRlmtEvtLinkUp - LINK_UP
2250 * This routine handles LLINK_UP events.
2253 * runtime, pageable?
2254 * may be called after SK_INIT_IO
2259 RLMT_STATIC void SkRlmtEvtLinkUp(
2260 SK_AC *pAC, /* Adapter Context */
2261 SK_IOC IoC, /* I/O Context */
2262 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 Undefined */
2265 SK_RLMT_PORT *pRPort;
2268 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2269 ("SK_RLMT_LINK_UP Port %d Event BEGIN.\n", Para.Para32[0]))
2271 pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
2272 if (!pRPort->PortStarted) {
2273 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E008, SKERR_RLMT_E008_MSG);
2275 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2276 ("SK_RLMT_LINK_UP Event EMPTY.\n"))
2280 if (!pRPort->LinkDown) {
2281 /* RA;:;: Any better solution? */
2282 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2283 ("SK_RLMT_LINK_UP Event EMPTY.\n"))
2287 SkTimerStop(pAC, IoC, &pRPort->UpTimer);
2288 SkTimerStop(pAC, IoC, &pRPort->DownRxTimer);
2289 SkTimerStop(pAC, IoC, &pRPort->DownTxTimer);
2291 /* Do something if timer already fired? */
2293 pRPort->LinkDown = SK_FALSE;
2294 pRPort->PortState = SK_RLMT_PS_GOING_UP;
2295 pRPort->GuTimeStamp = SkOsGetTime(pAC);
2296 pRPort->BcTimeStamp = 0;
2297 pRPort->Net->LinksUp++;
2298 if (pRPort->Net->LinksUp == 1) {
2299 SK_HWAC_LINK_LED(pAC, IoC, Para.Para32[0], SK_LED_ACTIVE);
2302 SK_HWAC_LINK_LED(pAC, IoC, Para.Para32[0], SK_LED_STANDBY);
2305 for (i = 0; i < pRPort->Net->NumPorts; i++) {
2306 if (!pRPort->Net->Port[i]->PortStarted) {
2307 SkRlmtPortStart(pAC, IoC, pRPort->Net->Port[i]->PortNumber);
2311 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
2313 if (pRPort->Net->LinksUp >= 2) {
2314 if (pRPort->Net->RlmtMode & SK_RLMT_CHECK_LOC_LINK) {
2315 /* Build the check chain. */
2316 SkRlmtBuildCheckChain(pAC, pRPort->Net->NetNumber);
2320 /* If the first link comes up, start the periodical RLMT timeout. */
2321 if (pRPort->Net->NumPorts > 1 && pRPort->Net->LinksUp == 1 &&
2322 (pRPort->Net->RlmtMode & SK_RLMT_CHECK_OTHERS) != 0) {
2323 Para2.Para32[0] = pRPort->Net->NetNumber;
2324 Para2.Para32[1] = (SK_U32)-1;
2325 SkTimerStart(pAC, IoC, &pRPort->Net->LocTimer,
2326 pRPort->Net->TimeoutValue, SKGE_RLMT, SK_RLMT_TIM, Para2);
2330 Para2.Para32[1] = (SK_U32)-1;
2331 SkTimerStart(pAC, IoC, &pRPort->UpTimer, SK_RLMT_PORTUP_TIM_VAL,
2332 SKGE_RLMT, SK_RLMT_PORTUP_TIM, Para2);
2334 /* Later: if (pAC->Rlmt.RlmtMode & SK_RLMT_CHECK_LOC_LINK) && */
2335 if ((pRPort->Net->RlmtMode & SK_RLMT_TRANSPARENT) == 0 &&
2336 (pRPort->Net->RlmtMode & SK_RLMT_CHECK_LINK) != 0 &&
2338 SkRlmtBuildPacket(pAC, IoC, Para.Para32[0], SK_PACKET_ANNOUNCE,
2339 &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress, &SkRlmtMcAddr)
2341 /* Send "new" packet to RLMT multicast address. */
2342 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2);
2345 if (pRPort->Net->RlmtMode & SK_RLMT_CHECK_SEG) {
2346 if ((Para2.pParaPtr =
2347 SkRlmtBuildSpanningTreePacket(pAC, IoC, Para.Para32[0])) != NULL) {
2348 pAC->Rlmt.Port[Para.Para32[0]].RootIdSet = SK_FALSE;
2349 pRPort->Net->CheckingState |=
2350 SK_RLMT_RCS_SEG | SK_RLMT_RCS_REPORT_SEG;
2352 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2);
2354 Para.Para32[1] = (SK_U32)-1;
2355 SkTimerStart(pAC, IoC, &pRPort->Net->SegTimer,
2356 SK_RLMT_SEG_TO_VAL, SKGE_RLMT, SK_RLMT_SEG_TIM, Para);
2360 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2361 ("SK_RLMT_LINK_UP Event END.\n"))
2362 } /* SkRlmtEvtLinkUp */
2365 /******************************************************************************
2367 * SkRlmtEvtPortUpTim - PORT_UP_TIM
2370 * This routine handles PORT_UP_TIM events.
2373 * runtime, pageable?
2374 * may be called after SK_INIT_IO
2379 RLMT_STATIC void SkRlmtEvtPortUpTim(
2380 SK_AC *pAC, /* Adapter Context */
2381 SK_IOC IoC, /* I/O Context */
2382 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 -1 */
2384 SK_RLMT_PORT *pRPort;
2386 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2387 ("SK_RLMT_PORTUP_TIM Port %d Event BEGIN.\n", Para.Para32[0]))
2389 if (Para.Para32[1] != (SK_U32)-1) {
2390 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2391 ("Bad Parameter.\n"))
2392 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2393 ("SK_RLMT_PORTUP_TIM Event EMPTY.\n"))
2397 pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
2398 if (pRPort->LinkDown || (pRPort->PortState == SK_RLMT_PS_UP)) {
2399 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2400 ("SK_RLMT_PORTUP_TIM Port %d Event EMPTY.\n", Para.Para32[0]))
2404 pRPort->PortDown = SK_FALSE;
2405 pRPort->PortState = SK_RLMT_PS_UP;
2406 pRPort->Net->PortsUp++;
2407 if (pRPort->Net->RlmtState != SK_RLMT_RS_INIT) {
2408 if (pAC->Rlmt.NumNets <= 1) {
2409 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
2411 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_PORT_UP, Para);
2414 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2415 ("SK_RLMT_PORTUP_TIM Event END.\n"))
2416 } /* SkRlmtEvtPortUpTim */
2419 /******************************************************************************
2421 * SkRlmtEvtPortDownTim - PORT_DOWN_*
2424 * This routine handles PORT_DOWN_* events.
2427 * runtime, pageable?
2428 * may be called after SK_INIT_IO
2433 RLMT_STATIC void SkRlmtEvtPortDownX(
2434 SK_AC *pAC, /* Adapter Context */
2435 SK_IOC IoC, /* I/O Context */
2436 SK_U32 Event, /* Event code */
2437 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 -1 */
2439 SK_RLMT_PORT *pRPort;
2441 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2442 ("SK_RLMT_PORTDOWN* Port %d Event (%d) BEGIN.\n",
2443 Para.Para32[0], Event))
2445 if (Para.Para32[1] != (SK_U32)-1) {
2446 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2447 ("Bad Parameter.\n"))
2448 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2449 ("SK_RLMT_PORTDOWN* Event EMPTY.\n"))
2453 pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
2454 if (!pRPort->PortStarted || (Event == SK_RLMT_PORTDOWN_TX_TIM &&
2455 !(pRPort->CheckingState & SK_RLMT_PCS_TX))) {
2456 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2457 ("SK_RLMT_PORTDOWN* Event (%d) EMPTY.\n", Event))
2461 /* Stop port's timers. */
2462 SkTimerStop(pAC, IoC, &pRPort->UpTimer);
2463 SkTimerStop(pAC, IoC, &pRPort->DownRxTimer);
2464 SkTimerStop(pAC, IoC, &pRPort->DownTxTimer);
2466 if (pRPort->PortState != SK_RLMT_PS_LINK_DOWN) {
2467 pRPort->PortState = SK_RLMT_PS_DOWN;
2470 if (!pRPort->PortDown) {
2471 pRPort->Net->PortsUp--;
2472 pRPort->PortDown = SK_TRUE;
2473 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_PORT_DOWN, Para);
2476 pRPort->PacketsPerTimeSlot = 0;
2477 /* pRPort->DataPacketsPerTimeSlot = 0; */
2478 pRPort->BpduPacketsPerTimeSlot = 0;
2479 pRPort->BcTimeStamp = 0;
2482 * RA;:;: To be checked:
2483 * - actions at RLMT_STOP: We should not switch anymore.
2485 if (pRPort->Net->RlmtState != SK_RLMT_RS_INIT) {
2486 if (Para.Para32[0] ==
2487 pRPort->Net->Port[pRPort->Net->ActivePort]->PortNumber) {
2488 /* Active Port went down. */
2489 SkRlmtCheckSwitch(pAC, IoC, pRPort->Net->NetNumber);
2493 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2494 ("SK_RLMT_PORTDOWN* Event (%d) END.\n", Event))
2495 } /* SkRlmtEvtPortDownX */
2498 /******************************************************************************
2500 * SkRlmtEvtLinkDown - LINK_DOWN
2503 * This routine handles LINK_DOWN events.
2506 * runtime, pageable?
2507 * may be called after SK_INIT_IO
2512 RLMT_STATIC void SkRlmtEvtLinkDown(
2513 SK_AC *pAC, /* Adapter Context */
2514 SK_IOC IoC, /* I/O Context */
2515 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 Undefined */
2517 SK_RLMT_PORT *pRPort;
2519 pRPort = &pAC->Rlmt.Port[Para.Para32[0]];
2520 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2521 ("SK_RLMT_LINK_DOWN Port %d Event BEGIN.\n", Para.Para32[0]))
2523 if (!pAC->Rlmt.Port[Para.Para32[0]].LinkDown) {
2524 pRPort->Net->LinksUp--;
2525 pRPort->LinkDown = SK_TRUE;
2526 pRPort->PortState = SK_RLMT_PS_LINK_DOWN;
2527 SK_HWAC_LINK_LED(pAC, IoC, Para.Para32[0], SK_LED_OFF);
2529 if ((pRPort->Net->RlmtMode & SK_RLMT_CHECK_LOC_LINK) != 0) {
2530 /* Build the check chain. */
2531 SkRlmtBuildCheckChain(pAC, pRPort->Net->NetNumber);
2534 /* Ensure that port is marked down. */
2535 Para.Para32[1] = -1;
2536 (void)SkRlmtEvent(pAC, IoC, SK_RLMT_PORTDOWN, Para);
2539 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2540 ("SK_RLMT_LINK_DOWN Event END.\n"))
2541 } /* SkRlmtEvtLinkDown */
2544 /******************************************************************************
2546 * SkRlmtEvtPortAddr - PORT_ADDR
2549 * This routine handles PORT_ADDR events.
2552 * runtime, pageable?
2553 * may be called after SK_INIT_IO
2558 RLMT_STATIC void SkRlmtEvtPortAddr(
2559 SK_AC *pAC, /* Adapter Context */
2560 SK_IOC IoC, /* I/O Context */
2561 SK_EVPARA Para) /* SK_U32 PortNumber; SK_U32 -1 */
2564 SK_RLMT_PORT *pRPort;
2565 SK_MAC_ADDR *pOldMacAddr;
2566 SK_MAC_ADDR *pNewMacAddr;
2568 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2569 ("SK_RLMT_PORT_ADDR Port %d Event BEGIN.\n", Para.Para32[0]))
2571 if (Para.Para32[1] != (SK_U32)-1) {
2572 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2573 ("Bad Parameter.\n"))
2574 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2575 ("SK_RLMT_PORT_ADDR Event EMPTY.\n"))
2579 /* Port's physical MAC address changed. */
2580 pOldMacAddr = &pAC->Addr.Port[Para.Para32[0]].PreviousMacAddress;
2581 pNewMacAddr = &pAC->Addr.Port[Para.Para32[0]].CurrentMacAddress;
2584 * NOTE: This is not scalable for solutions where ports are
2585 * checked remotely. There, we need to send an RLMT
2586 * address change packet - and how do we ensure delivery?
2588 for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
2589 pRPort = &pAC->Rlmt.Port[i];
2590 for (j = 0; j < pRPort->PortsChecked; j++) {
2592 pRPort->PortCheck[j].CheckAddr.a, pOldMacAddr->a)) {
2593 pRPort->PortCheck[j].CheckAddr = *pNewMacAddr;
2598 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2599 ("SK_RLMT_PORT_ADDR Event END.\n"))
2600 } /* SkRlmtEvtPortAddr */
2603 /******************************************************************************
2605 * SkRlmtEvtStart - START
2608 * This routine handles START events.
2611 * runtime, pageable?
2612 * may be called after SK_INIT_IO
2617 RLMT_STATIC void SkRlmtEvtStart(
2618 SK_AC *pAC, /* Adapter Context */
2619 SK_IOC IoC, /* I/O Context */
2620 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
2626 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2627 ("SK_RLMT_START Net %d Event BEGIN.\n", Para.Para32[0]))
2629 if (Para.Para32[1] != (SK_U32)-1) {
2630 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2631 ("Bad Parameter.\n"))
2632 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2633 ("SK_RLMT_START Event EMPTY.\n"))
2637 if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
2638 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2639 ("Bad NetNumber %d.\n", Para.Para32[0]))
2640 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2641 ("SK_RLMT_START Event EMPTY.\n"))
2645 if (pAC->Rlmt.Net[Para.Para32[0]].RlmtState != SK_RLMT_RS_INIT) {
2646 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2647 ("SK_RLMT_START Event EMPTY.\n"))
2651 if (pAC->Rlmt.NetsStarted >= pAC->Rlmt.NumNets) {
2652 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2653 ("All nets should have been started.\n"))
2654 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2655 ("SK_RLMT_START Event EMPTY.\n"))
2659 if (pAC->Rlmt.Net[Para.Para32[0]].PrefPort >=
2660 pAC->Rlmt.Net[Para.Para32[0]].NumPorts) {
2661 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E009, SKERR_RLMT_E009_MSG);
2663 /* Change PrefPort to internal default. */
2664 Para2.Para32[0] = 0xFFFFFFFF;
2665 Para2.Para32[1] = Para.Para32[0];
2666 (void)SkRlmtEvent(pAC, IoC, SK_RLMT_PREFPORT_CHANGE, Para2);
2669 PortIdx = pAC->Rlmt.Net[Para.Para32[0]].PrefPort;
2670 PortNumber = pAC->Rlmt.Net[Para.Para32[0]].Port[PortIdx]->PortNumber;
2672 pAC->Rlmt.Net[Para.Para32[0]].LinksUp = 0;
2673 pAC->Rlmt.Net[Para.Para32[0]].PortsUp = 0;
2674 pAC->Rlmt.Net[Para.Para32[0]].CheckingState = 0;
2675 pAC->Rlmt.Net[Para.Para32[0]].RlmtState = SK_RLMT_RS_NET_DOWN;
2677 /* Start preferred port. */
2678 SkRlmtPortStart(pAC, IoC, PortNumber);
2680 /* Start Timer (for first port only). */
2681 Para2.Para32[0] = PortNumber;
2682 Para2.Para32[1] = (SK_U32)-1;
2683 SkTimerStart(pAC, IoC, &pAC->Rlmt.Port[PortNumber].UpTimer,
2684 SK_RLMT_PORTSTART_TIM_VAL, SKGE_RLMT, SK_RLMT_PORTSTART_TIM, Para2);
2686 pAC->Rlmt.NetsStarted++;
2688 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2689 ("SK_RLMT_START Event END.\n"))
2690 } /* SkRlmtEvtStart */
2693 /******************************************************************************
2695 * SkRlmtEvtStop - STOP
2698 * This routine handles STOP events.
2701 * runtime, pageable?
2702 * may be called after SK_INIT_IO
2707 RLMT_STATIC void SkRlmtEvtStop(
2708 SK_AC *pAC, /* Adapter Context */
2709 SK_IOC IoC, /* I/O Context */
2710 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
2716 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2717 ("SK_RLMT_STOP Net %d Event BEGIN.\n", Para.Para32[0]))
2719 if (Para.Para32[1] != (SK_U32)-1) {
2720 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2721 ("Bad Parameter.\n"))
2722 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2723 ("SK_RLMT_STOP Event EMPTY.\n"))
2727 if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
2728 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2729 ("Bad NetNumber %d.\n", Para.Para32[0]))
2730 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2731 ("SK_RLMT_STOP Event EMPTY.\n"))
2735 if (pAC->Rlmt.Net[Para.Para32[0]].RlmtState == SK_RLMT_RS_INIT) {
2736 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2737 ("SK_RLMT_STOP Event EMPTY.\n"))
2741 if (pAC->Rlmt.NetsStarted == 0) {
2742 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2743 ("All nets are stopped.\n"))
2744 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2745 ("SK_RLMT_STOP Event EMPTY.\n"))
2749 /* Stop RLMT timers. */
2750 SkTimerStop(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[0]].LocTimer);
2751 SkTimerStop(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[0]].SegTimer);
2754 pAC->Rlmt.Net[Para.Para32[0]].RlmtState = SK_RLMT_RS_INIT;
2755 pAC->Rlmt.Net[Para.Para32[0]].RootIdSet = SK_FALSE;
2756 Para2.Para32[0] = SK_RLMT_NET_DOWN_FINAL;
2757 Para2.Para32[1] = Para.Para32[0]; /* Net# */
2758 SkEventQueue(pAC, SKGE_DRV, SK_DRV_NET_DOWN, Para2);
2761 for (i = 0; i < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; i++) {
2762 PortNumber = pAC->Rlmt.Net[Para.Para32[0]].Port[i]->PortNumber;
2763 if (pAC->Rlmt.Port[PortNumber].PortState != SK_RLMT_PS_INIT) {
2764 SkTimerStop(pAC, IoC, &pAC->Rlmt.Port[PortNumber].UpTimer);
2765 SkTimerStop(pAC, IoC, &pAC->Rlmt.Port[PortNumber].DownRxTimer);
2766 SkTimerStop(pAC, IoC, &pAC->Rlmt.Port[PortNumber].DownTxTimer);
2768 pAC->Rlmt.Port[PortNumber].PortState = SK_RLMT_PS_INIT;
2769 pAC->Rlmt.Port[PortNumber].RootIdSet = SK_FALSE;
2770 pAC->Rlmt.Port[PortNumber].PortStarted = SK_FALSE;
2771 Para2.Para32[0] = PortNumber;
2772 Para2.Para32[1] = (SK_U32)-1;
2773 SkEventQueue(pAC, SKGE_HWAC, SK_HWEV_PORT_STOP, Para2);
2777 pAC->Rlmt.NetsStarted--;
2779 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2780 ("SK_RLMT_STOP Event END.\n"))
2781 } /* SkRlmtEvtStop */
2784 /******************************************************************************
2786 * SkRlmtEvtTim - TIM
2789 * This routine handles TIM events.
2792 * runtime, pageable?
2793 * may be called after SK_INIT_IO
2798 RLMT_STATIC void SkRlmtEvtTim(
2799 SK_AC *pAC, /* Adapter Context */
2800 SK_IOC IoC, /* I/O Context */
2801 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
2803 SK_RLMT_PORT *pRPort;
2809 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2810 ("SK_RLMT_TIM Event BEGIN.\n"))
2812 if (Para.Para32[1] != (SK_U32)-1) {
2813 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2814 ("Bad Parameter.\n"))
2815 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2816 ("SK_RLMT_TIM Event EMPTY.\n"))
2820 if ((pAC->Rlmt.Net[Para.Para32[0]].RlmtMode & SK_RLMT_CHECK_OTHERS) == 0 ||
2821 pAC->Rlmt.Net[Para.Para32[0]].LinksUp == 0) {
2822 /* Mode changed or all links down: No more link checking. */
2827 pAC->Rlmt.SwitchCheckCounter--;
2828 if (pAC->Rlmt.SwitchCheckCounter == 0) {
2829 pAC->Rlmt.SwitchCheckCounter;
2833 NewTimeout = SK_RLMT_DEF_TO_VAL;
2834 for (i = 0; i < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; i++) {
2835 PortNumber = pAC->Rlmt.Net[Para.Para32[0]].Port[i]->PortNumber;
2836 pRPort = &pAC->Rlmt.Port[PortNumber];
2837 if (!pRPort->LinkDown) {
2838 Timeout = SkRlmtCheckPort(pAC, IoC, PortNumber);
2839 if (Timeout < NewTimeout) {
2840 NewTimeout = Timeout;
2844 * These counters should be set to 0 for all ports before the
2845 * first frame is sent in the next loop.
2847 pRPort->PacketsPerTimeSlot = 0;
2848 /* pRPort->DataPacketsPerTimeSlot = 0; */
2849 pRPort->BpduPacketsPerTimeSlot = 0;
2852 pAC->Rlmt.Net[Para.Para32[0]].TimeoutValue = NewTimeout;
2854 if (pAC->Rlmt.Net[Para.Para32[0]].LinksUp > 1) {
2856 * If checking remote ports, also send packets if
2858 * this port checks at least one (remote) port.
2862 * Must be new loop, as SkRlmtCheckPort can request to
2863 * check segmentation when e.g. checking the last port.
2865 for (i = 0; i < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; i++) {
2866 if (!pAC->Rlmt.Net[Para.Para32[0]].Port[i]->LinkDown) {
2867 SkRlmtSend(pAC, IoC,
2868 pAC->Rlmt.Net[Para.Para32[0]].Port[i]->PortNumber);
2873 SkTimerStart(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[0]].LocTimer,
2874 pAC->Rlmt.Net[Para.Para32[0]].TimeoutValue, SKGE_RLMT, SK_RLMT_TIM,
2877 if (pAC->Rlmt.Net[Para.Para32[0]].LinksUp > 1 &&
2878 (pAC->Rlmt.Net[Para.Para32[0]].RlmtMode & SK_RLMT_CHECK_SEG) &&
2879 (pAC->Rlmt.Net[Para.Para32[0]].CheckingState & SK_RLMT_RCS_START_SEG)) {
2880 SkTimerStart(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[0]].SegTimer,
2881 SK_RLMT_SEG_TO_VAL, SKGE_RLMT, SK_RLMT_SEG_TIM, Para);
2882 pAC->Rlmt.Net[Para.Para32[0]].CheckingState &= ~SK_RLMT_RCS_START_SEG;
2883 pAC->Rlmt.Net[Para.Para32[0]].CheckingState |=
2884 SK_RLMT_RCS_SEG | SK_RLMT_RCS_REPORT_SEG;
2887 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2888 ("SK_RLMT_TIM Event END.\n"))
2889 } /* SkRlmtEvtTim */
2892 /******************************************************************************
2894 * SkRlmtEvtSegTim - SEG_TIM
2897 * This routine handles SEG_TIM events.
2900 * runtime, pageable?
2901 * may be called after SK_INIT_IO
2906 RLMT_STATIC void SkRlmtEvtSegTim(
2907 SK_AC *pAC, /* Adapter Context */
2908 SK_IOC IoC, /* I/O Context */
2909 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
2915 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2916 ("SK_RLMT_SEG_TIM Event BEGIN.\n"))
2918 if (Para.Para32[1] != (SK_U32)-1) {
2919 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2920 ("Bad Parameter.\n"))
2921 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2922 ("SK_RLMT_SEG_TIM Event EMPTY.\n"))
2927 for (j = 0; j < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; j++) {
2928 SK_ADDR_PORT *pAPort;
2933 InAddr = (SK_U16 *)&InAddr8[0];
2934 pAPort = pAC->Rlmt.Net[Para.Para32[0]].Port[j]->AddrPort;
2935 for (k = 0; k < pAPort->NextExactMatchRlmt; k++) {
2936 /* Get exact match address k from port j. */
2937 XM_INADDR(IoC, pAC->Rlmt.Net[Para.Para32[0]].Port[j]->PortNumber,
2939 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2940 ("MC address %d on Port %u: %02x %02x %02x %02x %02x %02x -- %02x %02x %02x %02x %02x %02x.\n",
2941 k, pAC->Rlmt.Net[Para.Para32[0]].Port[j]->PortNumber,
2942 InAddr8[0], InAddr8[1], InAddr8[2],
2943 InAddr8[3], InAddr8[4], InAddr8[5],
2944 pAPort->Exact[k].a[0], pAPort->Exact[k].a[1],
2945 pAPort->Exact[k].a[2], pAPort->Exact[k].a[3],
2946 pAPort->Exact[k].a[4], pAPort->Exact[k].a[5]))
2951 SkRlmtCheckSeg(pAC, IoC, Para.Para32[0]);
2953 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2954 ("SK_RLMT_SEG_TIM Event END.\n"))
2955 } /* SkRlmtEvtSegTim */
2958 /******************************************************************************
2960 * SkRlmtEvtPacketRx - PACKET_RECEIVED
2963 * This routine handles PACKET_RECEIVED events.
2966 * runtime, pageable?
2967 * may be called after SK_INIT_IO
2972 RLMT_STATIC void SkRlmtEvtPacketRx(
2973 SK_AC *pAC, /* Adapter Context */
2974 SK_IOC IoC, /* I/O Context */
2975 SK_EVPARA Para) /* SK_MBUF *pMb */
2982 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2983 ("SK_RLMT_PACKET_RECEIVED Event BEGIN.\n"))
2985 /* Should we ignore frames during port switching? */
2988 pMb = Para.pParaPtr;
2990 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL, ("No mbuf.\n"))
2992 else if (pMb->pNext != NULL) {
2993 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
2994 ("More than one mbuf or pMb->pNext not set.\n"))
2998 for (pMb = Para.pParaPtr; pMb != NULL; pMb = pNextMb) {
2999 pNextMb = pMb->pNext;
3002 NetNumber = pAC->Rlmt.Port[pMb->PortIdx].Net->NetNumber;
3003 if (pAC->Rlmt.Net[NetNumber].RlmtState == SK_RLMT_RS_INIT) {
3004 SkDrvFreeRlmtMbuf(pAC, IoC, pMb);
3007 SkRlmtPacketReceive(pAC, IoC, pMb);
3011 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3012 ("SK_RLMT_PACKET_RECEIVED Event END.\n"))
3013 } /* SkRlmtEvtPacketRx */
3016 /******************************************************************************
3018 * SkRlmtEvtStatsClear - STATS_CLEAR
3021 * This routine handles STATS_CLEAR events.
3024 * runtime, pageable?
3025 * may be called after SK_INIT_IO
3030 RLMT_STATIC void SkRlmtEvtStatsClear(
3031 SK_AC *pAC, /* Adapter Context */
3032 SK_IOC IoC, /* I/O Context */
3033 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
3036 SK_RLMT_PORT *pRPort;
3038 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3039 ("SK_RLMT_STATS_CLEAR Event BEGIN.\n"))
3041 if (Para.Para32[1] != (SK_U32)-1) {
3042 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3043 ("Bad Parameter.\n"))
3044 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3045 ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"))
3049 if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
3050 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3051 ("Bad NetNumber %d.\n", Para.Para32[0]))
3052 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3053 ("SK_RLMT_STATS_CLEAR Event EMPTY.\n"))
3057 /* Clear statistics for logical and physical ports. */
3058 for (i = 0; i < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; i++) {
3060 &pAC->Rlmt.Port[pAC->Rlmt.Net[Para.Para32[0]].Port[i]->PortNumber];
3061 pRPort->TxHelloCts = 0;
3062 pRPort->RxHelloCts = 0;
3063 pRPort->TxSpHelloReqCts = 0;
3064 pRPort->RxSpHelloCts = 0;
3067 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3068 ("SK_RLMT_STATS_CLEAR Event END.\n"))
3069 } /* SkRlmtEvtStatsClear */
3072 /******************************************************************************
3074 * SkRlmtEvtStatsUpdate - STATS_UPDATE
3077 * This routine handles STATS_UPDATE events.
3080 * runtime, pageable?
3081 * may be called after SK_INIT_IO
3086 RLMT_STATIC void SkRlmtEvtStatsUpdate(
3087 SK_AC *pAC, /* Adapter Context */
3088 SK_IOC IoC, /* I/O Context */
3089 SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */
3091 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3092 ("SK_RLMT_STATS_UPDATE Event BEGIN.\n"))
3094 if (Para.Para32[1] != (SK_U32)-1) {
3095 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3096 ("Bad Parameter.\n"))
3097 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3098 ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"))
3102 if (Para.Para32[0] >= pAC->Rlmt.NumNets) {
3103 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3104 ("Bad NetNumber %d.\n", Para.Para32[0]))
3105 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3106 ("SK_RLMT_STATS_UPDATE Event EMPTY.\n"))
3110 /* Update statistics - currently always up-to-date. */
3112 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3113 ("SK_RLMT_STATS_UPDATE Event END.\n"))
3114 } /* SkRlmtEvtStatsUpdate */
3117 /******************************************************************************
3119 * SkRlmtEvtPrefportChange - PREFPORT_CHANGE
3122 * This routine handles PREFPORT_CHANGE events.
3125 * runtime, pageable?
3126 * may be called after SK_INIT_IO
3131 RLMT_STATIC void SkRlmtEvtPrefportChange(
3132 SK_AC *pAC, /* Adapter Context */
3133 SK_IOC IoC, /* I/O Context */
3134 SK_EVPARA Para) /* SK_U32 PortIndex; SK_U32 NetNumber */
3136 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3137 ("SK_RLMT_PREFPORT_CHANGE to Port %d Event BEGIN.\n", Para.Para32[0]))
3139 if (Para.Para32[1] >= pAC->Rlmt.NumNets) {
3140 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3141 ("Bad NetNumber %d.\n", Para.Para32[1]))
3142 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3143 ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"))
3147 /* 0xFFFFFFFF == auto-mode. */
3148 if (Para.Para32[0] == 0xFFFFFFFF) {
3149 pAC->Rlmt.Net[Para.Para32[1]].PrefPort = SK_RLMT_DEF_PREF_PORT;
3152 if (Para.Para32[0] >= pAC->Rlmt.Net[Para.Para32[1]].NumPorts) {
3153 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E010, SKERR_RLMT_E010_MSG);
3155 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3156 ("SK_RLMT_PREFPORT_CHANGE Event EMPTY.\n"))
3160 pAC->Rlmt.Net[Para.Para32[1]].PrefPort = Para.Para32[0];
3163 pAC->Rlmt.Net[Para.Para32[1]].Preference = Para.Para32[0];
3165 if (pAC->Rlmt.Net[Para.Para32[1]].RlmtState != SK_RLMT_RS_INIT) {
3166 SkRlmtCheckSwitch(pAC, IoC, Para.Para32[1]);
3169 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3170 ("SK_RLMT_PREFPORT_CHANGE Event END.\n"))
3171 } /* SkRlmtEvtPrefportChange */
3174 /******************************************************************************
3176 * SkRlmtEvtSetNets - SET_NETS
3179 * This routine handles SET_NETS events.
3182 * runtime, pageable?
3183 * may be called after SK_INIT_IO
3188 RLMT_STATIC void SkRlmtEvtSetNets(
3189 SK_AC *pAC, /* Adapter Context */
3190 SK_IOC IoC, /* I/O Context */
3191 SK_EVPARA Para) /* SK_U32 NumNets; SK_U32 -1 */
3195 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3196 ("SK_RLMT_SET_NETS Event BEGIN.\n"))
3198 if (Para.Para32[1] != (SK_U32)-1) {
3199 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3200 ("Bad Parameter.\n"))
3201 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3202 ("SK_RLMT_SET_NETS Event EMPTY.\n"))
3206 if (Para.Para32[0] == 0 || Para.Para32[0] > SK_MAX_NETS ||
3207 Para.Para32[0] > (SK_U32)pAC->GIni.GIMacsFound) {
3208 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3209 ("Bad number of nets: %d.\n", Para.Para32[0]))
3210 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3211 ("SK_RLMT_SET_NETS Event EMPTY.\n"))
3215 if (Para.Para32[0] == pAC->Rlmt.NumNets) { /* No change. */
3216 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3217 ("SK_RLMT_SET_NETS Event EMPTY.\n"))
3221 /* Entering and leaving dual mode only allowed while nets are stopped. */
3222 if (pAC->Rlmt.NetsStarted > 0) {
3223 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3224 ("Changing dual mode only allowed while all nets are stopped.\n"))
3225 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3226 ("SK_RLMT_SET_NETS Event EMPTY.\n"))
3230 if (Para.Para32[0] == 1) {
3231 if (pAC->Rlmt.NumNets > 1) {
3232 /* Clear logical MAC addr from second net's active port. */
3233 (void)SkAddrOverride(pAC, IoC, pAC->Rlmt.Net[1].Port[pAC->Addr.
3234 Net[1].ActivePort]->PortNumber, NULL, SK_ADDR_CLEAR_LOGICAL);
3235 pAC->Rlmt.Net[1].NumPorts = 0;
3238 pAC->Rlmt.NumNets = Para.Para32[0];
3239 for (i = 0; (SK_U32)i < pAC->Rlmt.NumNets; i++) {
3240 pAC->Rlmt.Net[i].RlmtState = SK_RLMT_RS_INIT;
3241 pAC->Rlmt.Net[i].RootIdSet = SK_FALSE;
3242 pAC->Rlmt.Net[i].Preference = 0xFFFFFFFF; /* "Automatic" */
3243 pAC->Rlmt.Net[i].PrefPort = SK_RLMT_DEF_PREF_PORT;
3244 /* Just assuming. */
3245 pAC->Rlmt.Net[i].ActivePort = pAC->Rlmt.Net[i].PrefPort;
3246 pAC->Rlmt.Net[i].RlmtMode = SK_RLMT_DEF_MODE;
3247 pAC->Rlmt.Net[i].TimeoutValue = SK_RLMT_DEF_TO_VAL;
3248 pAC->Rlmt.Net[i].NetNumber = i;
3251 pAC->Rlmt.Port[1].Net= &pAC->Rlmt.Net[0];
3252 pAC->Rlmt.Net[0].NumPorts = pAC->GIni.GIMacsFound;
3254 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_SET_NETS, Para);
3256 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3257 ("RLMT: Changed to one net with two ports.\n"))
3259 else if (Para.Para32[0] == 2) {
3260 pAC->Rlmt.Port[1].Net= &pAC->Rlmt.Net[1];
3261 pAC->Rlmt.Net[1].NumPorts = pAC->GIni.GIMacsFound - 1;
3262 pAC->Rlmt.Net[0].NumPorts =
3263 pAC->GIni.GIMacsFound - pAC->Rlmt.Net[1].NumPorts;
3265 pAC->Rlmt.NumNets = Para.Para32[0];
3266 for (i = 0; (SK_U32)i < pAC->Rlmt.NumNets; i++) {
3267 pAC->Rlmt.Net[i].RlmtState = SK_RLMT_RS_INIT;
3268 pAC->Rlmt.Net[i].RootIdSet = SK_FALSE;
3269 pAC->Rlmt.Net[i].Preference = 0xFFFFFFFF; /* "Automatic" */
3270 pAC->Rlmt.Net[i].PrefPort = SK_RLMT_DEF_PREF_PORT;
3271 /* Just assuming. */
3272 pAC->Rlmt.Net[i].ActivePort = pAC->Rlmt.Net[i].PrefPort;
3273 pAC->Rlmt.Net[i].RlmtMode = SK_RLMT_DEF_MODE;
3274 pAC->Rlmt.Net[i].TimeoutValue = SK_RLMT_DEF_TO_VAL;
3276 pAC->Rlmt.Net[i].NetNumber = i;
3279 /* Set logical MAC addr on second net's active port. */
3280 (void)SkAddrOverride(pAC, IoC, pAC->Rlmt.Net[1].Port[pAC->Addr.
3281 Net[1].ActivePort]->PortNumber, NULL, SK_ADDR_SET_LOGICAL);
3283 SkEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_RLMT_SET_NETS, Para);
3285 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3286 ("RLMT: Changed to two nets with one port each.\n"))
3289 /* Not implemented for more than two nets. */
3290 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3291 ("SetNets not implemented for more than two nets.\n"))
3292 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3293 ("SK_RLMT_SET_NETS Event EMPTY.\n"))
3297 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3298 ("SK_RLMT_SET_NETS Event END.\n"))
3299 } /* SkRlmtSetNets */
3302 /******************************************************************************
3304 * SkRlmtEvtModeChange - MODE_CHANGE
3307 * This routine handles MODE_CHANGE events.
3310 * runtime, pageable?
3311 * may be called after SK_INIT_IO
3316 RLMT_STATIC void SkRlmtEvtModeChange(
3317 SK_AC *pAC, /* Adapter Context */
3318 SK_IOC IoC, /* I/O Context */
3319 SK_EVPARA Para) /* SK_U32 NewMode; SK_U32 NetNumber */
3323 SK_U32 PrevRlmtMode;
3325 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3326 ("SK_RLMT_MODE_CHANGE Event BEGIN.\n"))
3328 if (Para.Para32[1] >= pAC->Rlmt.NumNets) {
3329 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3330 ("Bad NetNumber %d.\n", Para.Para32[1]))
3331 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3332 ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"))
3336 Para.Para32[0] |= SK_RLMT_CHECK_LINK;
3338 if ((pAC->Rlmt.Net[Para.Para32[1]].NumPorts == 1) &&
3339 Para.Para32[0] != SK_RLMT_MODE_CLS) {
3340 pAC->Rlmt.Net[Para.Para32[1]].RlmtMode = SK_RLMT_MODE_CLS;
3341 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3342 ("Forced RLMT mode to CLS on single port net.\n"))
3343 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3344 ("SK_RLMT_MODE_CHANGE Event EMPTY.\n"))
3348 /* Update RLMT mode. */
3349 PrevRlmtMode = pAC->Rlmt.Net[Para.Para32[1]].RlmtMode;
3350 pAC->Rlmt.Net[Para.Para32[1]].RlmtMode = Para.Para32[0];
3352 if ((PrevRlmtMode & SK_RLMT_CHECK_LOC_LINK) !=
3353 (pAC->Rlmt.Net[Para.Para32[1]].RlmtMode & SK_RLMT_CHECK_LOC_LINK)) {
3354 /* SK_RLMT_CHECK_LOC_LINK bit changed. */
3355 if ((PrevRlmtMode & SK_RLMT_CHECK_OTHERS) == 0 &&
3356 pAC->Rlmt.Net[Para.Para32[1]].NumPorts > 1 &&
3357 pAC->Rlmt.Net[Para.Para32[1]].PortsUp >= 1) {
3358 /* 20001207 RA: Was "PortsUp == 1". */
3359 Para2.Para32[0] = Para.Para32[1];
3360 Para2.Para32[1] = (SK_U32)-1;
3361 SkTimerStart(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[1]].LocTimer,
3362 pAC->Rlmt.Net[Para.Para32[1]].TimeoutValue,
3363 SKGE_RLMT, SK_RLMT_TIM, Para2);
3367 if ((PrevRlmtMode & SK_RLMT_CHECK_SEG) !=
3368 (pAC->Rlmt.Net[Para.Para32[1]].RlmtMode & SK_RLMT_CHECK_SEG)) {
3369 /* SK_RLMT_CHECK_SEG bit changed. */
3370 for (i = 0; i < pAC->Rlmt.Net[Para.Para32[1]].NumPorts; i++) {
3371 (void)SkAddrMcClear(pAC, IoC,
3372 pAC->Rlmt.Net[Para.Para32[1]].Port[i]->PortNumber,
3373 SK_ADDR_PERMANENT | SK_MC_SW_ONLY);
3375 /* Add RLMT MC address. */
3376 (void)SkAddrMcAdd(pAC, IoC,
3377 pAC->Rlmt.Net[Para.Para32[1]].Port[i]->PortNumber,
3378 &SkRlmtMcAddr, SK_ADDR_PERMANENT);
3380 if ((pAC->Rlmt.Net[Para.Para32[1]].RlmtMode &
3381 SK_RLMT_CHECK_SEG) != 0) {
3382 /* Add BPDU MC address. */
3383 (void)SkAddrMcAdd(pAC, IoC,
3384 pAC->Rlmt.Net[Para.Para32[1]].Port[i]->PortNumber,
3385 &BridgeMcAddr, SK_ADDR_PERMANENT);
3387 if (pAC->Rlmt.Net[Para.Para32[1]].RlmtState != SK_RLMT_RS_INIT) {
3388 if (!pAC->Rlmt.Net[Para.Para32[1]].Port[i]->LinkDown &&
3389 (Para2.pParaPtr = SkRlmtBuildSpanningTreePacket(
3390 pAC, IoC, i)) != NULL) {
3391 pAC->Rlmt.Net[Para.Para32[1]].Port[i]->RootIdSet =
3393 SkEventQueue(pAC, SKGE_DRV, SK_DRV_RLMT_SEND, Para2);
3397 (void)SkAddrMcUpdate(pAC, IoC,
3398 pAC->Rlmt.Net[Para.Para32[1]].Port[i]->PortNumber);
3401 if ((pAC->Rlmt.Net[Para.Para32[1]].RlmtMode & SK_RLMT_CHECK_SEG) != 0) {
3402 Para2.Para32[0] = Para.Para32[1];
3403 Para2.Para32[1] = (SK_U32)-1;
3404 SkTimerStart(pAC, IoC, &pAC->Rlmt.Net[Para.Para32[1]].SegTimer,
3405 SK_RLMT_SEG_TO_VAL, SKGE_RLMT, SK_RLMT_SEG_TIM, Para2);
3407 } /* SK_RLMT_CHECK_SEG bit changed. */
3409 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3410 ("SK_RLMT_MODE_CHANGE Event END.\n"))
3411 } /* SkRlmtEvtModeChange */
3414 /******************************************************************************
3416 * SkRlmtEvent - a PORT- or an RLMT-specific event happened
3419 * This routine calls subroutines to handle PORT- and RLMT-specific events.
3422 * runtime, pageable?
3423 * may be called after SK_INIT_IO
3429 SK_AC *pAC, /* Adapter Context */
3430 SK_IOC IoC, /* I/O Context */
3431 SK_U32 Event, /* Event code */
3432 SK_EVPARA Para) /* Event-specific parameter */
3436 /* ----- PORT events ----- */
3438 case SK_RLMT_PORTSTART_TIM: /* From RLMT via TIME. */
3439 SkRlmtEvtPortStartTim(pAC, IoC, Para);
3441 case SK_RLMT_LINK_UP: /* From SIRQ. */
3442 SkRlmtEvtLinkUp(pAC, IoC, Para);
3444 case SK_RLMT_PORTUP_TIM: /* From RLMT via TIME. */
3445 SkRlmtEvtPortUpTim(pAC, IoC, Para);
3447 case SK_RLMT_PORTDOWN: /* From RLMT. */
3448 case SK_RLMT_PORTDOWN_RX_TIM: /* From RLMT via TIME. */
3449 case SK_RLMT_PORTDOWN_TX_TIM: /* From RLMT via TIME. */
3450 SkRlmtEvtPortDownX(pAC, IoC, Event, Para);
3452 case SK_RLMT_LINK_DOWN: /* From SIRQ. */
3453 SkRlmtEvtLinkDown(pAC, IoC, Para);
3455 case SK_RLMT_PORT_ADDR: /* From ADDR. */
3456 SkRlmtEvtPortAddr(pAC, IoC, Para);
3459 /* ----- RLMT events ----- */
3461 case SK_RLMT_START: /* From DRV. */
3462 SkRlmtEvtStart(pAC, IoC, Para);
3464 case SK_RLMT_STOP: /* From DRV. */
3465 SkRlmtEvtStop(pAC, IoC, Para);
3467 case SK_RLMT_TIM: /* From RLMT via TIME. */
3468 SkRlmtEvtTim(pAC, IoC, Para);
3470 case SK_RLMT_SEG_TIM:
3471 SkRlmtEvtSegTim(pAC, IoC, Para);
3473 case SK_RLMT_PACKET_RECEIVED: /* From DRV. */
3474 SkRlmtEvtPacketRx(pAC, IoC, Para);
3476 case SK_RLMT_STATS_CLEAR: /* From PNMI. */
3477 SkRlmtEvtStatsClear(pAC, IoC, Para);
3479 case SK_RLMT_STATS_UPDATE: /* From PNMI. */
3480 SkRlmtEvtStatsUpdate(pAC, IoC, Para);
3482 case SK_RLMT_PREFPORT_CHANGE: /* From PNMI. */
3483 SkRlmtEvtPrefportChange(pAC, IoC, Para);
3485 case SK_RLMT_MODE_CHANGE: /* From PNMI. */
3486 SkRlmtEvtModeChange(pAC, IoC, Para);
3488 case SK_RLMT_SET_NETS: /* From DRV. */
3489 SkRlmtEvtSetNets(pAC, IoC, Para);
3492 /* ----- Unknown events ----- */
3494 default: /* Create error log entry. */
3495 SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_CTRL,
3496 ("Unknown RLMT Event %d.\n", Event))
3497 SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_RLMT_E003, SKERR_RLMT_E003_MSG);
3506 #endif /* __cplusplus */
3508 #endif /* CONFIG_SK98 */