Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3355 lines
91 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. priv.h
  5. Abstract:
  6. Private structure definitions and function templates for the 1394 ARP module.
  7. Author:
  8. Revision History:
  9. Who When What
  10. -------- -------- ----
  11. josephj 11-17-98 created
  12. --*/
  13. #define ARP1394_SYMBOLIC_NAME L"\\DosDevices\\ARP1394"
  14. #define ARP1394_DEVICE_NAME L"\\Device\\ARP1394"
  15. #define ARP1394_UL_NAME L"ARP1394"
  16. #define ARP1394_LL_NAME L"TCPIP_ARP1394"
  17. #define ARP1394_NDIS_MAJOR_VERSION 5
  18. #define ARP1394_NDIS_MINOR_VERSION 0
  19. // The physical address length, as reported to IP in the following places:
  20. //
  21. // IFEntry.if_physaddr (on WIN98, IFEntry.if_physaddr is truncated to 6 bytes)
  22. // LLIPBindInfo.lip_addr
  23. // IPNetToMediaEntry.inme_physaddr
  24. //
  25. // Note that may be (and in fact currently is) less then the actual length of
  26. // the actual IEEE1394 FIFO physical-address length.
  27. //
  28. #define ARP1394_IP_PHYSADDR_LEN 6 // TODO: make 8
  29. // The levels of the various types of locks
  30. //
  31. enum
  32. {
  33. LOCKLEVEL_GLOBAL=1, // Must start > 0.
  34. LOCKLEVEL_ADAPTER,
  35. LOCKLEVEL_IF_SEND
  36. };
  37. #define ARP1394_GLOBALS_SIG 'G31A'
  38. // TODO: read this from configuration. Set default based on the ip/1394 standard.
  39. //
  40. #define ARP1394_ADAPTER_MTU 1520
  41. #define ARP1394_MAX_PROTOCOL_PKTS 1000
  42. #define ARP1394_MAX_PROTOCOL_PACKET_SIZE 1600 // We need to forward between ICS.
  43. #define ARP1394_ADDRESS_RESOLUTION_TIMEOUT 1000 // Ms
  44. #define ARP1394_MAX_ETHERNET_PKTS 4
  45. // Delay between polling for connect status.
  46. //
  47. #define ARP1394_WAIT_FOR_CONNECT_STATUS_TIMEOUT 5000
  48. //
  49. // Packet flags for packets allocated by us.
  50. // Go into protocol-context (pc_common.pc_flags) of the packet.
  51. //
  52. #define ARP1394_PACKET_FLAGS_ARP 0
  53. #define ARP1394_PACKET_FLAGS_ICS 1
  54. #define ARP1394_PACKET_FLAGS_MCAP 2
  55. #define ARP1394_PACKET_FLAGS_DBGCOPY 3
  56. #define ARP1394_PACKET_FLAGS_IOCTL 4
  57. //
  58. // Pre allocation constants to avoid low memory condition
  59. //
  60. #define ARP1394_BACKUP_TASKS 4
  61. // Forward references
  62. //
  63. typedef struct _ARP1394_INTERFACE ARP1394_INTERFACE;
  64. typedef struct _ARPCB_LOCAL_IP ARPCB_LOCAL_IP;
  65. typedef struct _ARPCB_REMOTE_IP ARPCB_REMOTE_IP;
  66. typedef struct _ARPCB_REMOTE_ETH ARPCB_REMOTE_ETH;
  67. typedef struct _ARPCB_DEST ARPCB_DEST, *PARPCB_DEST;
  68. typedef IPAddr IP_ADDRESS, *PIP_ADDRESS;
  69. typedef IPMask IP_MASK, *PIP_MASK;
  70. typedef int MYBOOL; // Like BOOL
  71. typedef struct _ARP1394_GLOBALS
  72. {
  73. RM_OBJECT_HEADER Hdr;
  74. RM_LOCK Lock;
  75. // Driver global state
  76. //
  77. struct
  78. {
  79. // Handle to Driver Object for ARP1394
  80. //
  81. PVOID pDriverObject;
  82. // Handle to the single device object representing this driver.
  83. //
  84. PVOID pDeviceObject;
  85. } driver;
  86. // Global NDIS State
  87. //
  88. struct
  89. {
  90. // NDIS' protocol handle, returned in NdisRegisterProtocol
  91. //
  92. NDIS_HANDLE ProtocolHandle;
  93. // NDIS Protocol characteristics
  94. //
  95. NDIS_PROTOCOL_CHARACTERISTICS PC;
  96. // NDIS Client characteristics
  97. NDIS_CLIENT_CHARACTERISTICS CC;
  98. } ndis;
  99. // Global IP State
  100. //
  101. struct
  102. {
  103. // Handle returned by IPRegisterARP
  104. //
  105. HANDLE ARPRegisterHandle;
  106. // Following are callback's into IP, set in IPRegisterARP
  107. //
  108. IP_ADD_INTERFACE pAddInterfaceRtn; // add an interface
  109. IP_DEL_INTERFACE pDelInterfaceRtn; // delete an interface
  110. IP_BIND_COMPLETE pBindCompleteRtn; // inform of bind cmpl
  111. IP_ADD_LINK pAddLinkRtn;
  112. IP_DELETE_LINK pDeleteLinkRtn;
  113. } ip;
  114. // Global adapter list
  115. //
  116. struct {
  117. RM_GROUP Group;
  118. } adapters;
  119. // Global List of backup tasks
  120. SLIST_HEADER BackupTasks;
  121. NDIS_SPIN_LOCK BackupTaskLock;
  122. UINT NumTasks;
  123. }
  124. ARP1394_GLOBALS;
  125. extern ARP1394_GLOBALS ArpGlobals;
  126. typedef struct // ARP1394_ADAPTER
  127. {
  128. RM_OBJECT_HEADER Hdr;
  129. RM_LOCK Lock;
  130. //
  131. // PRIMARY_STATE flags (in Hdr.State)
  132. //
  133. // PRIMARY_STATE is the primary state of the adapter.
  134. //
  135. #define ARPAD_PS_MASK 0x00f
  136. #define ARPAD_PS_DEINITED 0x000
  137. #define ARPAD_PS_INITED 0x001
  138. #define ARPAD_PS_FAILEDINIT 0x002
  139. #define ARPAD_PS_INITING 0x003
  140. #define ARPAD_PS_REINITING 0x004
  141. #define ARPAD_PS_DEINITING 0x005
  142. #define SET_AD_PRIMARY_STATE(_pAD, _IfState) \
  143. RM_SET_STATE(_pAD, ARPAD_PS_MASK, _IfState)
  144. #define CHECK_AD_PRIMARY_STATE(_pAD, _IfState) \
  145. RM_CHECK_STATE(_pAD, ARPAD_PS_MASK, _IfState)
  146. #define GET_AD_PRIMARY_STATE(_pAD) \
  147. RM_GET_STATE(_pAD, ARPAD_PS_MASK)
  148. //
  149. // ACTIVE_STATE flags (in Hdr.State)
  150. //
  151. // ACTIVE_STATE is a secondary state of the adapter.
  152. // Primary state takes precedence over secondary sate. For example,
  153. // the interface is REINITING and ACTIVE, one should not actively use the
  154. // interface.
  155. //
  156. // NOTE: When the primary state is INITED, the secondary state WILL be
  157. // ACTIVATED. It is thus usually only necessary to look at the primary state.
  158. //
  159. #define ARPAD_AS_MASK 0x0f0
  160. #define ARPAD_AS_DEACTIVATED 0x000
  161. #define ARPAD_AS_ACTIVATED 0x010
  162. #define ARPAD_AS_FAILEDACTIVATE 0x020
  163. #define ARPAD_AS_DEACTIVATING 0x030
  164. #define ARPAD_AS_ACTIVATING 0x040
  165. #define SET_AD_ACTIVE_STATE(_pAD, _IfState) \
  166. RM_SET_STATE(_pAD, ARPAD_AS_MASK, _IfState)
  167. #define CHECK_AD_ACTIVE_STATE(_pAD, _IfState) \
  168. RM_CHECK_STATE(_pAD, ARPAD_AS_MASK, _IfState)
  169. #define GET_AD_ACTIVE_STATE(_pAD) \
  170. RM_GET_STATE(_pAD, ARPAD_AS_MASK)
  171. // BRIDGE (Ethernet Emulation) state (in Hdr.State)
  172. //
  173. #define ARPAD_BS_MASK 0x100
  174. #define ARPAD_BS_ENABLED 0x100
  175. #define ARP_ENABLE_BRIDGE(_pAD) \
  176. RM_SET_STATE(_pAD, ARPAD_BS_MASK, ARPAD_BS_ENABLED)
  177. #define ARP_BRIDGE_ENABLED(_pAD) \
  178. RM_CHECK_STATE(_pAD, ARPAD_BS_MASK, ARPAD_BS_ENABLED)
  179. #define SET_BS_FLAG(_pAD, _IfState) \
  180. RM_SET_STATE(_pAD, ARPAD_BS_MASK, _IfState)
  181. #define CHECK_BS_FLAG(_pAD, _IfState) \
  182. RM_CHECK_STATE(_pAD, ARPAD_BS_MASK, _IfState)
  183. #define GET_BS_ACTIVE_STATE(_pAD) \
  184. RM_GET_STATE(_pAD, ARPAD_BS_MASK)
  185. #define ARPAD_POWER_MASK 0xf000
  186. #define ARPAD_POWER_LOW_POWER 0x1000
  187. #define ARPAD_POWER_NORMAL 0x0000
  188. #define SET_POWER_STATE(_pAD, _PoState) \
  189. RM_SET_STATE(_pAD, ARPAD_POWER_MASK , _PoState)
  190. #define CHECK_POWER_STATE(_pAD, _PoState) \
  191. RM_CHECK_STATE(_pAD, ARPAD_POWER_MASK, _PoState)
  192. #define GET_POWER_ACTIVE_STATE(_pAD) \
  193. RM_GET_STATE(_pAD, ARPAD_POWER_MASK)
  194. // NDIS bind info.
  195. //
  196. struct
  197. {
  198. NDIS_STRING ConfigName;
  199. NDIS_STRING DeviceName;
  200. PVOID IpConfigHandle;
  201. NDIS_HANDLE BindContext;
  202. // Init/Deinit/Reinit task
  203. //
  204. PRM_TASK pPrimaryTask;
  205. // Activate/Deactivate task
  206. //
  207. PRM_TASK pSecondaryTask;
  208. NDIS_HANDLE AdapterHandle;
  209. // This is read from the configuration information in the registry.
  210. // It is a multisz string, in theory it could contain the config-strings
  211. // of multiple interfaces, although IP/1394 only provides one.
  212. //
  213. NDIS_STRING IpConfigString;
  214. } bind;
  215. // Information about the adapter, obtained by querying it.
  216. // Note: MTU is the MTU reported by the adapter, and is not the same
  217. // as the MTU reported up to ip (the latter MTU is in the ARP1394_INTERFACE
  218. // structure).
  219. //
  220. struct
  221. {
  222. ULONG MTU;
  223. // Maximum speed, in bytes per second, that the local host controller
  224. // is capable of.
  225. //
  226. ULONG Speed;
  227. #if OBSOLETE
  228. // Minimum size (in bytes) of:
  229. // -- Max individual async write to any remote node
  230. // -- Max individual async write to any channel
  231. // -- Max block we can receive on our recv FIFO
  232. // -- Max block we can receive on any channel
  233. //
  234. ULONG MaxBlockSize;
  235. #endif // 0
  236. // max_rec (Maximum bus data record size)
  237. // size == 2^(max_rec+1).
  238. // (Macro IP1394_MAXREC_TO_SIZE in rfc.h)
  239. //
  240. //
  241. ULONG MaxRec;
  242. ULONG MaxSpeedCode;
  243. //NIC1394_FIFO_ADDRESS LocalHwAddress;
  244. UINT64 LocalUniqueID;
  245. UCHAR * szDescription;
  246. UINT DescriptionLength; // including null termination.
  247. // This address is synthesized using the adapter's EU64 unique ID.
  248. //
  249. ENetAddr EthernetMacAddress;
  250. } info;
  251. struct
  252. {
  253. //
  254. // Current Power State
  255. //
  256. NET_DEVICE_POWER_STATE State;
  257. NDIS_EVENT Complete;
  258. //
  259. // Boolean variable to track the state on resume
  260. //
  261. BOOLEAN bReceivedSetPowerD0;
  262. BOOLEAN bReceivedAf;
  263. BOOLEAN bReceivedUnbind;
  264. BOOLEAN bResuming;
  265. BOOLEAN bFailedResume;
  266. }PoMgmt;
  267. // The IP interface control block (only one per adapter).
  268. //
  269. ARP1394_INTERFACE *pIF;
  270. // Bus Topology of the 1394 card below this adapter
  271. //
  272. EUID_TOPOLOGY EuidMap;
  273. //
  274. // Set when a Workitem is queued to query Node Addresses
  275. //
  276. MYBOOL fQueryAddress;
  277. //
  278. // Power State of the Adapter
  279. //
  280. NET_DEVICE_POWER_STATE PowerState;
  281. }
  282. ARP1394_ADAPTER, *PARP1394_ADAPTER;
  283. // This structure maintains a pool of buffers, all pointing to
  284. // the same area of memory (whose contents are expected to be CONSTANT).
  285. // The primary use of this structure is to maintain a pool of encapsulation headers
  286. // buffers.
  287. //
  288. typedef struct _ARP_CONST_BUFFER_POOL
  289. {
  290. NDIS_HANDLE NdisHandle; // Buffer pool handle
  291. PRM_OBJECT_HEADER pOwningObject; // ptr to object that owns this list
  292. // Following stuff just for statistics gathering.
  293. // TODO: consider conditionally-compiling this.
  294. //
  295. struct
  296. {
  297. UINT TotBufAllocs; // # allocs from buffer pool
  298. UINT TotCacheAllocs; // # allocs from cache list
  299. UINT TotAllocFails; // # failed allocs
  300. } stats;
  301. UINT NumBuffersToCache; // Number to keep inited and cached
  302. UINT MaxBuffers; // Max number to allocate
  303. UINT cbMem; // Size in bytes of mem below...
  304. const VOID* pvMem; // Ptr to memory containg encap data
  305. UINT NumAllocd; // # outstanding allocs from pool
  306. UINT NumInCache; // # items sitting in cache.
  307. NDIS_SPIN_LOCK NdisLock; // Spinlock protecting the list below
  308. SLIST_HEADER BufferList; // List of available, inited bufs
  309. } ARP_CONST_BUFFER_POOL;
  310. // This structure is used when calling NdisRequest.
  311. //
  312. typedef struct _ARP_NDIS_REQUEST
  313. {
  314. NDIS_REQUEST Request; // The NDIS request structure.
  315. NDIS_EVENT Event; // Event to signal when done.
  316. PRM_TASK pTask; // Task to resume when done.
  317. NDIS_STATUS Status; // Status of completed request.
  318. } ARP_NDIS_REQUEST, *PARP_NDIS_REQUEST;
  319. // Static set of information associated with a VC, mainly co-ndis call handlers.
  320. //
  321. typedef struct
  322. {
  323. PCHAR Description;
  324. CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
  325. // CO_STATUS_HANDLER CoStatusHandler;
  326. CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
  327. // CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
  328. // CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
  329. // CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
  330. CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
  331. // Vc type is currently used just for stats. We may get rid of some of the
  332. // handlers above and use the vctype instead.
  333. //
  334. enum
  335. {
  336. ARPVCTYPE_SEND_FIFO,
  337. ARPVCTYPE_RECV_FIFO,
  338. ARPVCTYPE_BROADCAST_CHANNEL,
  339. ARPVCTYPE_MULTI_CHANNEL,
  340. ARPVCTYPE_ETHERNET,
  341. ARPVCTYPE_SEND_CHANNEL,
  342. ARPVCTYPE_RECV_CHANNEL,
  343. } VcType;
  344. BOOLEAN IsDestVc;
  345. } ARP_STATIC_VC_INFO, *PARP_STATIC_VC_INFO;
  346. // ARP's protocol vc context has this common header.
  347. //
  348. typedef struct
  349. {
  350. PARP_STATIC_VC_INFO pStaticInfo;
  351. // Ndis VC handle associated with the VC.
  352. //
  353. NDIS_HANDLE NdisVcHandle;
  354. // These two tasks are for making and tearingdown the VC,
  355. // respectively.
  356. //
  357. PRM_TASK pMakeCallTask;
  358. PRM_TASK pCleanupCallTask;
  359. } ARP_VC_HEADER, *PARP_VC_HEADER;
  360. typedef struct
  361. {
  362. // Channel number.
  363. //
  364. UINT Channel;
  365. // IP multicast group address bound to this channel.
  366. //
  367. IP_ADDRESS GroupAddress;
  368. // Absolute time at which this information was updated,
  369. // in seconds.
  370. //
  371. UINT UpdateTime;
  372. // Absolute time at which this mapping will expire.
  373. // In seconds.
  374. //
  375. UINT ExpieryTime;
  376. UINT SpeedCode;
  377. // TBD
  378. //
  379. UINT Flags; // One of the MCAP_CHANNEL_FLAGS_*
  380. #define MCAP_CHANNEL_FLAGS_LOCALLY_ALLOCATED 0x1
  381. // NodeID of owner of this channel.
  382. //
  383. UINT NodeId;
  384. } MCAP_CHANNEL_INFO, *PMCAP_CHANNEL_INFO;
  385. // The IP interface control block.
  386. //
  387. typedef struct _ARP1394_INTERFACE
  388. {
  389. RM_OBJECT_HEADER Hdr;
  390. //
  391. // PRIMARY_STATE flags (in Hdr.State)
  392. //
  393. // PRIMARY_STATE is the primary state of the interface.
  394. //
  395. #define ARPIF_PS_MASK 0x00f
  396. #define ARPIF_PS_DEINITED 0x000
  397. #define ARPIF_PS_INITED 0x001
  398. #define ARPIF_PS_FAILEDINIT 0x002
  399. #define ARPIF_PS_INITING 0x003
  400. #define ARPIF_PS_REINITING 0x004
  401. #define ARPIF_PS_DEINITING 0x005
  402. #define ARPIF_PS_LOW_POWER 0x006
  403. #define SET_IF_PRIMARY_STATE(_pIF, _IfState) \
  404. RM_SET_STATE(_pIF, ARPIF_PS_MASK, _IfState)
  405. #define CHECK_IF_PRIMARY_STATE(_pIF, _IfState) \
  406. RM_CHECK_STATE(_pIF, ARPIF_PS_MASK, _IfState)
  407. #define GET_IF_PRIMARY_STATE(_pIF) \
  408. RM_GET_STATE(_pIF, ARPIF_PS_MASK)
  409. //
  410. // ACTIVE_STATE flags (in Hdr.State)
  411. //
  412. // ACTIVE_STATE is a secondary state of the interface.
  413. // Primary state takes precedence over secondary sate. For example,
  414. // the interface is REINITING and ACTIVE, one should not actively use the
  415. // interface.
  416. //
  417. // NOTE: When the primary state is INITED, the secondary state WILL be
  418. // ACTIVATED. It is thus usually only necessary to look at the primary state.
  419. //
  420. #define ARPIF_AS_MASK 0x0f0
  421. #define ARPIF_AS_DEACTIVATED 0x000
  422. #define ARPIF_AS_ACTIVATED 0x010
  423. #define ARPIF_AS_FAILEDACTIVATE 0x020
  424. #define ARPIF_AS_DEACTIVATING 0x030
  425. #define ARPIF_AS_ACTIVATING 0x040
  426. #define SET_IF_ACTIVE_STATE(_pIF, _IfState) \
  427. RM_SET_STATE(_pIF, ARPIF_AS_MASK, _IfState)
  428. #define CHECK_IF_ACTIVE_STATE(_pIF, _IfState) \
  429. RM_CHECK_STATE(_pIF, ARPIF_AS_MASK, _IfState)
  430. #define GET_IF_ACTIVE_STATE(_pIF) \
  431. RM_GET_STATE(_pIF, ARPIF_AS_MASK)
  432. //
  433. // IP_STATE flags (in Hdr.State)
  434. //
  435. // This state is set to OPEN when our open handler (ArpIpOpen) is called, and
  436. // to CLOSED when our close handler (ArpIpClose) is called
  437. //
  438. #define ARPIF_IPS_MASK 0xf00
  439. #define ARPIF_IPS_CLOSED 0x000
  440. #define ARPIF_IPS_OPEN 0x100
  441. #define SET_IF_IP_STATE(_pIF, _IfState) \
  442. RM_SET_STATE(_pIF, ARPIF_IPS_MASK, _IfState)
  443. #define CHECK_IF_IP_STATE(_pIF, _IfState) \
  444. RM_CHECK_STATE(_pIF, ARPIF_IPS_MASK, _IfState)
  445. #define GET_IF_IP_STATE(_pIF) \
  446. RM_GET_STATE(_pIF, ARPIF_IPS_MASK)
  447. // Init/Deinit/Reinit task
  448. //
  449. PRM_TASK pPrimaryTask;
  450. // Activate/Deactivate task
  451. //
  452. PRM_TASK pActDeactTask;
  453. // Maintenance task
  454. //
  455. PRM_TASK pMaintenanceTask;
  456. // Ndis-provided handlers and handles.
  457. //
  458. struct
  459. {
  460. // Cashed value of the adapter handle.
  461. //
  462. NDIS_HANDLE AdapterHandle;
  463. // The address family handle.
  464. //
  465. NDIS_HANDLE AfHandle;
  466. } ndis;
  467. // Stuff directly relating to interaction with IP.
  468. //
  469. struct
  470. {
  471. //
  472. // Following passed in from IP.
  473. //
  474. PVOID Context; // Use in calls to IP
  475. ULONG IFIndex; // Interface number
  476. IPRcvRtn RcvHandler; // Indicate Receive
  477. IPTxCmpltRtn TxCmpltHandler; // Transmit Complete
  478. IPStatusRtn StatusHandler;
  479. IPTDCmpltRtn TDCmpltHandler; // Transfer Data Complete
  480. IPRcvCmpltRtn RcvCmpltHandler; // Receive Complete
  481. IPRcvPktRtn RcvPktHandler; // Indicate Receive Packet
  482. IP_PNP PnPEventHandler;
  483. //
  484. // Following passed up to IP.
  485. //
  486. ULONG MTU; // Max Transmision Unit (bytes)
  487. NDIS_STRING ConfigString;
  488. // Following are for IP's query/set info functionality.
  489. //
  490. UINT ATInstance; // Instance # for this AT Entity
  491. UINT IFInstance; // Instance # for this IF Entity
  492. //
  493. // Other stuff ...
  494. //
  495. // Defaults to all-1's, but may be set by ip to be something different
  496. // (actually the only other possibility is all-0's, when the stack is
  497. // running in "BSD compatibility mode".
  498. // This field is used to decide where a given destination address is
  499. // unicast or not.
  500. //
  501. //
  502. IP_ADDRESS BroadcastAddress;
  503. // This address is used in filling out ARP requests.
  504. //
  505. IP_ADDRESS DefaultLocalAddress;
  506. #if TODO
  507. #ifdef PROMIS
  508. NDIS_OID EnabledIpFilters; // Set of enabled oids --
  509. // set/cleared using
  510. // arpIfSetNdisRequest.
  511. #endif // PROMIS
  512. #endif // TODO
  513. } ip;
  514. // Statistics
  515. //
  516. // WARNING: arpResetIfStats() zeros this entire structure, then
  517. // selectively re-inits some fields, such as StatsResetTime.
  518. //
  519. struct
  520. {
  521. // Following for MIB stats
  522. //
  523. ULONG LastChangeTime; // Time of last state change
  524. ULONG InOctets; // Input octets
  525. ULONG InUnicastPkts; // Input Unicast packets
  526. ULONG InNonUnicastPkts; // Input Non-unicast packets
  527. ULONG OutOctets; // Output octets
  528. ULONG OutUnicastPkts; // Output Unicast packets
  529. ULONG OutNonUnicastPkts; // Output Non-unicast packets
  530. ULONG InDiscards;
  531. ULONG InErrors;
  532. ULONG UnknownProtos;
  533. ULONG OutDiscards;
  534. ULONG OutErrors;
  535. ULONG OutQlen;
  536. //
  537. // Following for our private statistics gathering.
  538. //
  539. // Timestamp since the last reset of statistics collection.
  540. // Set by a call to NdisGetCurrentSystemTime.
  541. //
  542. LARGE_INTEGER StatsResetTime; // In 100-nanoseconds.
  543. LARGE_INTEGER PerformanceFrequency; // In Hz.
  544. //
  545. // Some send pkt stats
  546. //
  547. struct
  548. {
  549. UINT TotSends;
  550. UINT FastSends;
  551. UINT MediumSends;
  552. UINT SlowSends;
  553. UINT BackFills;
  554. // UINT HeaderBufUses;
  555. // UINT HeaderBufCacheHits;
  556. ARP1394_PACKET_COUNTS SendFifoCounts;
  557. ARP1394_PACKET_COUNTS SendChannelCounts;
  558. } sendpkts;
  559. //
  560. // Some recv pkt stats
  561. //
  562. struct
  563. {
  564. UINT TotRecvs;
  565. UINT NoCopyRecvs;
  566. UINT CopyRecvs;
  567. UINT ResourceRecvs;
  568. ARP1394_PACKET_COUNTS RecvFifoCounts;
  569. ARP1394_PACKET_COUNTS RecvChannelCounts;
  570. } recvpkts;
  571. //
  572. // Task statistics
  573. //
  574. struct
  575. {
  576. UINT TotalTasks;
  577. UINT CurrentTasks;
  578. UINT TimeCounts[ARP1394_NUM_TASKTIME_SLOTS];
  579. } tasks;
  580. //
  581. // Arp cache stats
  582. //
  583. struct {
  584. UINT TotalQueries;
  585. UINT SuccessfulQueries;
  586. UINT FailedQueries;
  587. UINT TotalResponses;
  588. UINT TotalLookups;
  589. // UINT TraverseRatio; << this is picked up by looking into the
  590. // << hash table data structure.
  591. } arpcache;
  592. //
  593. // Call stats
  594. //
  595. struct
  596. {
  597. //
  598. // FIFO-related call stats.
  599. //
  600. UINT TotalSendFifoMakeCalls;
  601. UINT SuccessfulSendFifoMakeCalls;
  602. UINT FailedSendFifoMakeCalls;
  603. UINT IncomingClosesOnSendFifos;
  604. //
  605. // Channel-related call stats.
  606. //
  607. UINT TotalChannelMakeCalls;
  608. UINT SuccessfulChannelMakeCalls;
  609. UINT FailedChannelMakeCalls;
  610. UINT IncomingClosesOnChannels;
  611. } calls;
  612. } stats;
  613. // Group containing local ip addresses, of type ARPCB_LOCAL_IP
  614. //
  615. RM_GROUP LocalIpGroup;
  616. // Group containing remote ip addresses, of type ARPCB_REMOTE_IP
  617. // (this is the arp cache)
  618. //
  619. RM_GROUP RemoteIpGroup;
  620. // Group containing remote ethernet destinations. This group is only used
  621. // if the adapter is operating in bridge mode.
  622. // This is the Ethernet address cache.
  623. //
  624. RM_GROUP RemoteEthGroup;
  625. // Group containing remote h/w distinations, of type ARPCB_DEST
  626. // (each ARPCB_DEST has a group of VCs)
  627. //
  628. RM_GROUP DestinationGroup;
  629. // Group containing the table (bridge only) of dhcp session, and their
  630. // associated physical addresses
  631. //
  632. RM_GROUP EthDhcpGroup;
  633. // Stuff relating to the receive FIFO, which is owned by the interface.
  634. //
  635. //
  636. struct {
  637. ARP_VC_HEADER VcHdr;
  638. // Address offset of the receive VC
  639. //
  640. struct
  641. {
  642. ULONG Off_Low;
  643. USHORT Off_High;
  644. } offset;
  645. } recvinfo;
  646. // This maintains interface-wide information relevant to the send path.
  647. //
  648. struct
  649. {
  650. // Lock used exclusively for sending.
  651. // Protects the following:
  652. // ??? this->sendinfo.listPktsWaitingForHeaders
  653. // ??? this->sendinfo.NumSendPacketsWaiting
  654. // pLocalIp->sendinfo
  655. // pDest->sendinfo
  656. //
  657. //
  658. RM_LOCK Lock;
  659. // List of send packets waiting for header buffers to become available.
  660. //
  661. LIST_ENTRY listPktsWaitingForHeaders;
  662. // Length of the above list
  663. //
  664. UINT NumSendPacketsWaiting;
  665. // Pool of header buffer pool. This is seralized by its OWN lock,
  666. // not by sendinfo.Lock.
  667. //
  668. ARP_CONST_BUFFER_POOL HeaderPool;
  669. // Pool of Channel header buffers. This is serialized by its OWN lock,
  670. // not by sendinfo.Lock
  671. //
  672. ARP_CONST_BUFFER_POOL ChannelHeaderPool;
  673. } sendinfo;
  674. //
  675. // Following 3 are "special" destinations ....
  676. //
  677. // Pointer to the broadcast-channel destination object.
  678. //
  679. PARPCB_DEST pBroadcastDest;
  680. // Pointer to the multi-channel destination object.
  681. //
  682. PARPCB_DEST pMultiChannelDest;
  683. // Pointer to the ethernet destination object.
  684. //
  685. PARPCB_DEST pEthernetDest;
  686. // Stuff relating to running the ARP protocol
  687. // (All serialized by the IF lock (not the IF SEND lock).
  688. //
  689. struct
  690. {
  691. // The NDIS packet pool for ARP pkts.
  692. //
  693. NDIS_HANDLE PacketPool;
  694. // The NDIS buffer pool for ARP pkts.
  695. //
  696. NDIS_HANDLE BufferPool;
  697. // Number of currently allocated packets.
  698. //
  699. LONG NumOutstandingPackets;
  700. // Maximum size of the packet that can be allocated from this pool.
  701. //
  702. UINT MaxBufferSize;
  703. } arp;
  704. // Stuff relating to the Ethernet VC, which is owned by the interface.
  705. //
  706. struct {
  707. // The NDIS packet pool for Ethernet pkts.
  708. //
  709. NDIS_HANDLE PacketPool;
  710. // The NDIS buffer pool for Ethernet packet headers.
  711. //
  712. NDIS_HANDLE BufferPool;
  713. #if TEST_ICS_HACK
  714. PRM_TASK pTestIcsTask;
  715. #endif // TEST_ICS_HACK;
  716. } ethernet;
  717. #define ARP_NUM_CHANNELS 64
  718. struct
  719. {
  720. // Information about each channel. Information includes:
  721. // IP multicast group address and expiry time.
  722. //
  723. MCAP_CHANNEL_INFO rgChannelInfo[ARP_NUM_CHANNELS];
  724. } mcapinfo;
  725. struct
  726. {
  727. PRM_TASK pAfPendingTask;
  728. } PoMgmt;
  729. }
  730. ARP1394_INTERFACE, *PARP1394_INTERFACE;
  731. #define ARP_OBJECT_IS_INTERFACE(_pHdr) ((_pHdr)->Sig == MTAG_INTERFACE)
  732. #define ASSERT_VALID_INTERFACE(_pIF) ASSERT((_pIF)->Hdr.Sig == MTAG_INTERFACE)
  733. #define ARP_WRITELOCK_IF_SEND_LOCK(_pIF, _psr) \
  734. RmDoWriteLock(&(_pIF)->sendinfo.Lock, (_psr))
  735. #define ARP_READLOCK_IF_SEND_LOCK(_pIF, _psr) \
  736. RmDoReadLock(&(_pIF)->sendinfo.Lock, (_psr))
  737. #define ARP_UNLOCK_IF_SEND_LOCK(_pIF, _psr) \
  738. RmDoUnlock(&(_pIF)->sendinfo.Lock, (_psr))
  739. #define ARP_FASTREADLOCK_IF_SEND_LOCK(_pIF) \
  740. NdisAcquireSpinLock(&(_pIF)->sendinfo.Lock.OsLock)
  741. #define ARP_FASTUNLOCK_IF_SEND_LOCK(_pIF) \
  742. NdisReleaseSpinLock(&(_pIF)->sendinfo.Lock.OsLock)
  743. /*++
  744. VOID
  745. ARP_IF_STAT_INCR(
  746. IN ARP1394_INTERFACE * _pIF
  747. IN OPAQUE StatsCounter
  748. )
  749. Increment the specified StatsCounter on an Interface by 1.
  750. --*/
  751. #define ARP_IF_STAT_INCR(_pIF, StatsCounter) \
  752. NdisInterlockedIncrement(&(_pIF)->stats.StatsCounter)
  753. /*++
  754. VOID
  755. ARP_IF_STAT_ADD(
  756. IN ARP1394_INTERFACE * _pIF
  757. IN OPAQUE StatsCounter,
  758. IN ULONG IncrValue
  759. )
  760. Increment the specified StatsCounter on an Interface by the specified IncrValue.
  761. Take a lock on the interface to do so.
  762. --*/
  763. #if BINARY_COMPATIBLE
  764. #define ARP_IF_STAT_ADD(_pIF, StatsCounter, IncrValue) \
  765. ((_pIF)->stats.StatsCounter += (IncrValue))
  766. #else // !BINARY_COMPATIBLE
  767. #define ARP_IF_STAT_ADD(_pIF, StatsCounter, IncrValue) \
  768. InterlockedExchangeAdd(&(_pIF)->stats.StatsCounter, IncrValue)
  769. #endif // !BINARY_COMPATIBLE
  770. //
  771. // This is the table used to store the DHCP entries used in the bridge mode
  772. //
  773. typedef struct _ARP1394_ETH_DHCP_ENTRY
  774. {
  775. RM_OBJECT_HEADER Hdr;
  776. //
  777. // xid - per dhcp session (e.g discover, offer)
  778. //
  779. ULONG xid;
  780. //
  781. // HW address in the dhcp packet.
  782. //
  783. ENetAddr requestorMAC;
  784. //
  785. // New HW address that arp1394 inserts in the dhcp packet
  786. //
  787. ENetAddr newMAC;
  788. //
  789. // Time last checked to be used for aging purposes
  790. //
  791. UINT TimeLastChecked;
  792. //
  793. // Task used in unloading DhcpEntry
  794. //
  795. PRM_TASK pUnloadTask;
  796. }ARP1394_ETH_DHCP_ENTRY, *PARP1394_ETH_DHCP_ENTRY;
  797. typedef enum _ARP_RESUME_CAUSE {
  798. Cause_SetPowerD0,
  799. Cause_AfNotify,
  800. Cause_Unbind
  801. } ARP_RESUME_CAUSE;
  802. //=========================================================================
  803. // N D I S H A N D L E R S
  804. //=========================================================================
  805. INT
  806. ArpNdBindAdapter(
  807. OUT PNDIS_STATUS pStatus,
  808. IN NDIS_HANDLE BindContext,
  809. IN PNDIS_STRING pDeviceName,
  810. IN PVOID SystemSpecific1,
  811. IN PVOID SystemSpecific2
  812. );
  813. VOID
  814. ArpNdUnbindAdapter(
  815. OUT PNDIS_STATUS pStatus,
  816. IN NDIS_HANDLE ProtocolBindingContext,
  817. IN NDIS_HANDLE UnbindContext
  818. );
  819. VOID
  820. ArpNdOpenAdapterComplete(
  821. IN NDIS_HANDLE ProtocolBindingContext,
  822. IN NDIS_STATUS Status,
  823. IN NDIS_STATUS OpenErrorStatus
  824. );
  825. VOID
  826. ArpNdCloseAdapterComplete(
  827. IN NDIS_HANDLE ProtocolBindingContext,
  828. IN NDIS_STATUS Status
  829. );
  830. VOID
  831. ArpNdResetComplete(
  832. IN NDIS_HANDLE ProtocolBindingContext,
  833. IN NDIS_STATUS Status
  834. );
  835. VOID
  836. ArpNdReceiveComplete(
  837. IN NDIS_HANDLE ProtocolBindingContext
  838. );
  839. VOID
  840. ArpNdRequestComplete(
  841. IN NDIS_HANDLE ProtocolBindingContext,
  842. IN PNDIS_REQUEST pNdisRequest,
  843. IN NDIS_STATUS Status
  844. );
  845. VOID
  846. ArpNdStatus(
  847. IN NDIS_HANDLE ProtocolBindingContext,
  848. IN NDIS_STATUS GeneralStatus,
  849. IN PVOID pStatusBuffer,
  850. IN UINT StatusBufferSize
  851. );
  852. VOID
  853. ArpNdStatusComplete(
  854. IN NDIS_HANDLE ProtocolBindingContext
  855. );
  856. VOID
  857. ArpNdSendComplete(
  858. IN NDIS_HANDLE ProtocolBindingContext,
  859. IN PNDIS_PACKET pNdisPacket,
  860. IN NDIS_STATUS Status
  861. );
  862. //
  863. // Following are some connectionless handlers we provide because we're calling
  864. // connectionless entrypoints.
  865. //
  866. NDIS_STATUS
  867. ArpNdReceive (
  868. NDIS_HANDLE ProtocolBindingContext,
  869. NDIS_HANDLE Context,
  870. VOID *Header,
  871. UINT HeaderSize,
  872. VOID *Data,
  873. UINT Size,
  874. UINT TotalSize
  875. );
  876. INT
  877. ArpNdReceivePacket (
  878. NDIS_HANDLE ProtocolBindingContext,
  879. PNDIS_PACKET Packet
  880. );
  881. NDIS_STATUS
  882. ArpNdPnPEvent(
  883. IN NDIS_HANDLE ProtocolBindingContext,
  884. IN PNET_PNP_EVENT pNetPnPEvent
  885. );
  886. VOID
  887. ArpNdUnloadProtocol(
  888. VOID
  889. );
  890. VOID
  891. ArpCoSendComplete(
  892. IN NDIS_STATUS Status,
  893. IN NDIS_HANDLE ProtocolVcContext,
  894. IN PNDIS_PACKET pNdisPacket
  895. );
  896. VOID
  897. ArpCoStatus(
  898. IN NDIS_HANDLE ProtocolBindingContext,
  899. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  900. IN NDIS_STATUS GeneralStatus,
  901. IN PVOID pStatusBuffer,
  902. IN UINT StatusBufferSize
  903. );
  904. UINT
  905. ArpCoReceivePacket(
  906. IN NDIS_HANDLE ProtocolBindingContext,
  907. IN NDIS_HANDLE ProtocolVcContext,
  908. IN PNDIS_PACKET pNdisPacket
  909. );
  910. VOID
  911. ArpCoAfRegisterNotify(
  912. IN NDIS_HANDLE ProtocolBindingContext,
  913. IN PCO_ADDRESS_FAMILY pAddressFamily
  914. );
  915. NDIS_STATUS
  916. ArpCoCreateVc(
  917. IN NDIS_HANDLE ProtocolAfContext,
  918. IN NDIS_HANDLE NdisVcHandle,
  919. OUT PNDIS_HANDLE pProtocolVcContext
  920. );
  921. NDIS_STATUS
  922. ArpCoDeleteVc(
  923. IN NDIS_HANDLE ProtocolVcContext
  924. );
  925. NDIS_STATUS
  926. ArpCoIncomingCall(
  927. IN NDIS_HANDLE ProtocolSapContext,
  928. IN NDIS_HANDLE ProtocolVcContext,
  929. IN OUT PCO_CALL_PARAMETERS pCallParameters
  930. );
  931. VOID
  932. ArpCoCallConnected(
  933. IN NDIS_HANDLE ProtocolVcContext
  934. );
  935. VOID
  936. ArpCoIncomingClose(
  937. IN NDIS_STATUS CloseStatus,
  938. IN NDIS_HANDLE ProtocolVcContext,
  939. IN PVOID pCloseData OPTIONAL,
  940. IN UINT Size OPTIONAL
  941. );
  942. VOID
  943. ArpCoQosChange(
  944. IN NDIS_HANDLE ProtocolVcContext,
  945. IN PCO_CALL_PARAMETERS pCallParameters
  946. );
  947. VOID
  948. ArpCoOpenAfComplete(
  949. IN NDIS_STATUS Status,
  950. IN NDIS_HANDLE ProtocolAfContext,
  951. IN NDIS_HANDLE NdisAfHandle
  952. );
  953. VOID
  954. ArpCoCloseAfComplete(
  955. IN NDIS_STATUS Status,
  956. IN NDIS_HANDLE ProtocolAfContext
  957. );
  958. VOID
  959. ArpCoMakeCallComplete(
  960. IN NDIS_STATUS Status,
  961. IN NDIS_HANDLE ProtocolVcContext,
  962. IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
  963. IN PCO_CALL_PARAMETERS pCallParameters
  964. );
  965. VOID
  966. ArpCoCloseCallComplete(
  967. IN NDIS_STATUS Status,
  968. IN NDIS_HANDLE ProtocolVcContext,
  969. IN NDIS_HANDLE ProtocolPartyContext OPTIONAL
  970. );
  971. VOID
  972. ArpCoModifyQosComplete(
  973. IN NDIS_STATUS Status,
  974. IN NDIS_HANDLE ProtocolVcContext,
  975. IN PCO_CALL_PARAMETERS pCallParameters
  976. );
  977. NDIS_STATUS
  978. ArpCoRequest(
  979. IN NDIS_HANDLE ProtocolAfContext,
  980. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  981. IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
  982. IN OUT PNDIS_REQUEST pNdisRequest
  983. );
  984. VOID
  985. ArpCoRequestComplete(
  986. IN NDIS_STATUS Status,
  987. IN NDIS_HANDLE ProtocolAfContext,
  988. IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
  989. IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
  990. IN PNDIS_REQUEST pNdisRequest
  991. );
  992. //=========================================================================
  993. // I P H A N D L E R S
  994. //=========================================================================
  995. INT
  996. ArpIpDynRegister(
  997. IN PNDIS_STRING pAdapterString,
  998. IN PVOID IpContext,
  999. IN struct _IP_HANDLERS * pIpHandlers,
  1000. IN struct LLIPBindInfo * pBindInfo,
  1001. IN UINT InterfaceNumber
  1002. );
  1003. VOID
  1004. ArpIpOpen(
  1005. IN PVOID Context
  1006. );
  1007. VOID
  1008. ArpIpClose(
  1009. IN PVOID Context
  1010. );
  1011. UINT
  1012. ArpIpAddAddress(
  1013. IN PVOID Context,
  1014. IN UINT AddressType,
  1015. IN IP_ADDRESS IpAddress,
  1016. IN IP_MASK Mask,
  1017. IN PVOID Context2
  1018. );
  1019. UINT
  1020. ArpIpDelAddress(
  1021. IN PVOID Context,
  1022. IN UINT AddressType,
  1023. IN IP_ADDRESS IpAddress,
  1024. IN IP_MASK Mask
  1025. );
  1026. NDIS_STATUS
  1027. ArpIpMultiTransmit(
  1028. IN PVOID Context,
  1029. IN PNDIS_PACKET * pNdisPacketArray,
  1030. IN UINT NumberOfPackets,
  1031. IN IP_ADDRESS Destination,
  1032. IN RouteCacheEntry * pRCE OPTIONAL,
  1033. IN VOID * ArpCtxt
  1034. );
  1035. NDIS_STATUS
  1036. ArpIpTransmit(
  1037. IN PVOID Context,
  1038. IN PNDIS_PACKET pNdisPacket,
  1039. IN IP_ADDRESS Destination,
  1040. IN RouteCacheEntry * pRCE OPTIONAL,
  1041. IN VOID * ArpCtxt
  1042. );
  1043. NDIS_STATUS
  1044. ArpIpTransfer(
  1045. IN PVOID Context,
  1046. IN NDIS_HANDLE Context1,
  1047. IN UINT ArpHdrOffset,
  1048. IN UINT ProtoOffset,
  1049. IN UINT BytesWanted,
  1050. IN PNDIS_PACKET pNdisPacket,
  1051. OUT PUINT pTransferCount
  1052. );
  1053. VOID
  1054. ArpIpInvalidate(
  1055. IN PVOID Context,
  1056. IN RouteCacheEntry * pRCE
  1057. );
  1058. INT
  1059. ArpIpQueryInfo(
  1060. IN PVOID Context,
  1061. IN TDIObjectID * pID,
  1062. IN PNDIS_BUFFER pNdisBuffer,
  1063. IN OUT PUINT pBufferSize,
  1064. IN PVOID QueryContext
  1065. );
  1066. INT
  1067. ArpIpSetInfo(
  1068. IN PVOID Context,
  1069. IN TDIObjectID * pID,
  1070. IN PVOID pBuffer,
  1071. IN UINT BufferSize
  1072. );
  1073. INT
  1074. ArpIpGetEList(
  1075. IN PVOID Context,
  1076. IN TDIEntityID * pEntityList,
  1077. IN OUT PUINT pEntityListSize
  1078. );
  1079. VOID
  1080. ArpIpPnPComplete(
  1081. IN PVOID Context,
  1082. IN NDIS_STATUS Status,
  1083. IN PNET_PNP_EVENT pNetPnPEvent
  1084. );
  1085. #ifdef PROMIS
  1086. EXTERN
  1087. NDIS_STATUS
  1088. ArpIpSetNdisRequest(
  1089. IN PVOID Context,
  1090. IN NDIS_OID Oid,
  1091. IN UINT On
  1092. );
  1093. #endif // PROMIS
  1094. // The following structure has the general form of NDIS_CO_MEDIA_PARAMETERS.
  1095. // To properly track changes in NDIS_CO_MEDIA_PARAMETERS (however unlikeley!),
  1096. // code which uses any field in this structure should assert that the field is at
  1097. // the same offset as the corresponding NDIS structure.
  1098. // For example:
  1099. // ASSERT(FIELD_OFFSET(ARP1394_CO_MEDIA_PARAMETERS, Parameters)
  1100. // == FIELD_OFFSET(CO_MEDIA_PARAMETERS, MediaSpecific.Parameters))
  1101. //
  1102. //
  1103. typedef struct
  1104. {
  1105. // First 3 fields of CO_MEDIA_PARAMETERS
  1106. //
  1107. ULONG Flags; // TRANSMIT_VC and/or RECEIVE_VC
  1108. ULONG ReceivePriority; // 0 (unused)
  1109. ULONG ReceiveSizeHint; // 0 (unused)
  1110. // Followed by 1st 2 fields of CO_SPECIFIC_PARAMETERS
  1111. //
  1112. ULONG POINTER_ALIGNMENT ParamType; // Set to NIC1394_MEDIA_SPECIFIC
  1113. ULONG Length; // Set to sizeof(NIC1394_MEDIA_PARAMETERS)
  1114. // Followed by the NIC1394-specific media parameters.
  1115. // Note: we can't directly put the NIC1394_MEDIA_PARAMETERS structure here because
  1116. // it (currently) requires 8-byte alignment.
  1117. //
  1118. UCHAR Parameters[sizeof(NIC1394_MEDIA_PARAMETERS)];
  1119. } ARP1394_CO_MEDIA_PARAMETERS;
  1120. typedef enum _TASK_CAUSE {
  1121. SetLowPower = 1,
  1122. SetPowerOn
  1123. }TASK_CAUSE ;
  1124. typedef struct
  1125. {
  1126. RM_TASK TskHdr;
  1127. // Used to save the true return status (typically a failure status,
  1128. // which we don't want to forget during async cleanup).
  1129. //
  1130. NDIS_STATUS ReturnStatus;
  1131. } TASK_ADAPTERINIT, *PTASK_ADAPTERINIT;
  1132. typedef struct
  1133. {
  1134. RM_TASK TskHdr;
  1135. ARP_NDIS_REQUEST ArpNdisRequest;
  1136. NIC1394_LOCAL_NODE_INFO LocalNodeInfo;
  1137. // Following is used to switch to PASSIVE before calling IP's add interface
  1138. // Rtn.
  1139. //
  1140. NDIS_WORK_ITEM WorkItem;
  1141. } TASK_ADAPTERACTIVATE, *PTASK_ADAPTERACTIVATE;
  1142. typedef struct
  1143. {
  1144. RM_TASK TskHdr;
  1145. NDIS_HANDLE pUnbindContext;
  1146. } TASK_ADAPTERSHUTDOWN, *PTASK_ADAPTERSHUTDOWN;
  1147. // This is the task structure to be used with arpTaskActivateInterface
  1148. //
  1149. typedef struct
  1150. {
  1151. RM_TASK TskHdr;
  1152. #if ARP_DEFERIFINIT
  1153. // Following is used when waiting for the adapter to go to connected status
  1154. //
  1155. //
  1156. NDIS_TIMER Timer;
  1157. #endif // ARP_DEFERIFINIT
  1158. // Following is used to switch to PASSIVE before calling IP's add interface
  1159. // Rtn.
  1160. //
  1161. NDIS_WORK_ITEM WorkItem;
  1162. } TASK_ACTIVATE_IF, *PTASK_ACTIVATE_IF;
  1163. // This is the task structure to be used with arpTaskDeactivateInterface
  1164. //
  1165. typedef struct
  1166. {
  1167. RM_TASK TskHdr;
  1168. BOOLEAN fPendingOnIpClose;
  1169. TASK_CAUSE Cause;
  1170. // Following is used to switch to PASSIVE before calling IP's del interface
  1171. // Rtn.
  1172. //
  1173. NDIS_WORK_ITEM WorkItem;
  1174. } TASK_DEACTIVATE_IF, *PTASK_DEACTIVATE_IF;
  1175. // This is the task structure to be used with arpTaskReinitInterface
  1176. //
  1177. typedef struct
  1178. {
  1179. RM_TASK TskHdr;
  1180. NDIS_HANDLE pUnbindContext;
  1181. // Net PnP event to complete when reinit task is done.
  1182. //
  1183. PNET_PNP_EVENT pNetPnPEvent;
  1184. } TASK_REINIT_IF, *PTASK_REINIT_IF;
  1185. typedef struct
  1186. {
  1187. RM_TASK TskHdr;
  1188. // Ndis call params and media params for this call.
  1189. //
  1190. CO_CALL_PARAMETERS CallParams;
  1191. ARP1394_CO_MEDIA_PARAMETERS MediaParams;
  1192. } TASK_MAKECALL;
  1193. // This is the task structure to be used with arpTaskResolveIpAddress
  1194. //
  1195. typedef struct
  1196. {
  1197. RM_TASK TskHdr;
  1198. // Number of retry attempts left before we declare an address resolution failure.
  1199. //
  1200. UINT RetriesLeft;
  1201. // Used for the response timeout
  1202. //
  1203. NDIS_TIMER Timer;
  1204. } TASK_RESOLVE_IP_ADDRESS, *PTASK_RESOLVE_IP_ADDRESS;
  1205. typedef struct
  1206. {
  1207. RM_TASK TskHdr;
  1208. MYBOOL Quit; // If set, task will quit.
  1209. NDIS_TIMER Timer; // Used for the periodically sending out packets.
  1210. PNDIS_PACKET p1394Pkt; // Used for testing forward to ethernet
  1211. PNDIS_PACKET pEthPkt; // Used for sending connectionless ethernet pkts.
  1212. UINT Delay; // Delay (ms) in between sending packets.
  1213. UINT PktType; // Type of operation: do nothing, send over ethernet
  1214. // etc.
  1215. } TASK_ICS_TEST, *PTASK_ICS_TEST;
  1216. typedef struct
  1217. {
  1218. RM_TASK TskHdr;
  1219. MYBOOL Quit; // If set, task will quit.
  1220. NDIS_TIMER Timer; // Used for periodically waking up to do stuff.
  1221. UINT Delay; // Current value of delay (seconds). Can change.
  1222. UINT RemoteIpMaintenanceTime; // Absolute time in seconds
  1223. UINT RemoteEthMaintenanceTime; // Absolute time in seconds
  1224. UINT LocalIpMaintenanceTime; // Absolute time in seconds.
  1225. UINT McapDbMaintenanceTime; // Absolute time in seconds.
  1226. UINT DhcpTableMaintainanceTime; // Absolute time in seconds
  1227. } TASK_IF_MAINTENANCE, *PTASK_IF_MAINTENANCE;
  1228. typedef struct _TASK_BACKUP
  1229. {
  1230. RM_TASK Hdr;
  1231. //
  1232. // We are using Backup Task flag at position 31 because we do
  1233. // not want to conflict with the ResumeDelayed flags
  1234. //
  1235. #define ARP_BACKUP_TASK_MASK 0x80000000
  1236. #define ARP_BACKUP_TASK_FLAG 0x80000000
  1237. #define MARK_TASK_AS_BACKUP(_pT) \
  1238. RM_SET_STATE(_pT, ARP_BACKUP_TASK_MASK , ARP_BACKUP_TASK_FLAG )
  1239. #define CHECK_TASK_IS_BACKUP(_pT) \
  1240. RM_CHECK_STATE(_pT, ARP_BACKUP_TASK_MASK , ARP_BACKUP_TASK_FLAG )
  1241. #define GET_TASK_BACKUP_STATE(_pT) \
  1242. RM_GET_STATE(_pT, ARP_BACKUP_TASK_MASK )
  1243. DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) SINGLE_LIST_ENTRY List; // Linked list pointing to next task
  1244. } TASK_BACKUP, *PTASK_BACKUP;
  1245. // This is the task structure to be used with arpTaskResolveIpAddress
  1246. //
  1247. typedef struct
  1248. {
  1249. RM_TASK TskHdr;
  1250. NDIS_WORK_ITEM WorkItem;
  1251. } TASK_UNLOAD_REMOTE, *PTASK_UNLOAD_REMOTE;
  1252. //
  1253. // This task is used during a SetPower.
  1254. // It contains structures that will be track of the
  1255. // the numbero of calls that are closed /opened
  1256. // and the events that need to be waited for.
  1257. //
  1258. typedef struct _CALL_COUNT
  1259. {
  1260. // Count of Destination that will closeVc
  1261. //
  1262. ULONG DestCount;
  1263. // Event which the Close VC will wait on.
  1264. //
  1265. NDIS_EVENT VcEvent;
  1266. } CALL_COUNT, *PCALL_COUNT;
  1267. typedef struct _TASK_POWER {
  1268. RM_TASK Hdr;
  1269. // Event which the Set Power will wait on.
  1270. //
  1271. NDIS_EVENT CompleteEvent;
  1272. // Status of the Task
  1273. //
  1274. PNDIS_STATUS pStatus;
  1275. // Power state we are transitioning to
  1276. //
  1277. NET_DEVICE_POWER_STATE PowerState;
  1278. //
  1279. //WorkItem to switch to passive
  1280. NDIS_WORK_ITEM WorkItem;
  1281. //
  1282. // Last working Stage of task - dbg purpose only
  1283. //
  1284. UINT LastStage;
  1285. //
  1286. // Previous state of parent object. This is used so
  1287. // that the object can be placed back into its previous
  1288. // state.
  1289. //
  1290. UINT PrevState;
  1291. } TASK_POWER, *PTASK_POWER;
  1292. //
  1293. // This structure is used to keep track of a close call
  1294. // that originated becuase of a SetPower
  1295. //
  1296. typedef struct _TASK_SET_POWER_CALL
  1297. {
  1298. RM_TASK Hdr;
  1299. TASK_CAUSE Cause;
  1300. // The Call Call Count is used as place to count the number of outstanding close calls
  1301. // It uses DestCount as a place to store this information
  1302. //
  1303. PCALL_COUNT pCount;
  1304. }TASK_SET_POWER_CALL, *PTASK_SET_POWER_CALL;
  1305. //
  1306. // ARP1394_TASK is the union of all tasks structures used in arp1394.
  1307. // arpAllocateTask allocates memory of sizeof(ARP1394_TASK), which is guaranteed
  1308. // to be large enough to hold any task.
  1309. //
  1310. typedef union
  1311. {
  1312. RM_TASK TskHdr;
  1313. TASK_ADAPTERINIT AdapterInit;
  1314. TASK_ADAPTERSHUTDOWN AdapterShutdown;
  1315. TASK_ADAPTERACTIVATE AdapterActivate;
  1316. TASK_ACTIVATE_IF ActivateIf;
  1317. TASK_DEACTIVATE_IF DeactivateIf;
  1318. TASK_REINIT_IF ReinitIf;
  1319. TASK_MAKECALL MakeFifoCall;
  1320. TASK_RESOLVE_IP_ADDRESS ResolveIpAddress;
  1321. #if TEST_ICS_HACK
  1322. TASK_ICS_TEST IcsTest;
  1323. #endif // TEST_ICS_HACK
  1324. TASK_IF_MAINTENANCE IfMaintenance;
  1325. TASK_BACKUP Backup;
  1326. TASK_UNLOAD_REMOTE Unload;
  1327. TASK_SET_POWER_CALL CloseCall;
  1328. TASK_POWER TaskPower;
  1329. } ARP1394_TASK;
  1330. //
  1331. // ---------------------------- DESTINATION (REMOTE) KEY --------------
  1332. //
  1333. #pragma pack (push, 1)
  1334. typedef union _REMOTE_DEST_KEY
  1335. {
  1336. ENetAddr ENetAddress;
  1337. IPAddr IpAddress;
  1338. UCHAR Addr[ARP_802_ADDR_LENGTH];
  1339. struct
  1340. {
  1341. ULONG u32;
  1342. USHORT u16;
  1343. } u;
  1344. } REMOTE_DEST_KEY, *PREMOTE_DEST_KEY;
  1345. #pragma pack (pop)
  1346. #define REMOTE_DEST_IP_ADDRESS_FLAG 0xffff
  1347. #define IS_REMOTE_DEST_IP_ADDRESS(_R) ((_R)->u.u16 == REMOTE_DEST_IP_ADDRESS_FLAG )
  1348. #define REMOTE_DEST_IP_ADDRESS(_R) ((&(_R)->IpAddress))
  1349. #define REMOTE_DEST_ETH_ADDRESS(_R) ((&(_R)->ENetAddress))
  1350. #define REMOTE_DEST_KEY_INIT(_R) { (_R)->u.u32 = 0; (_R)->u.u16=REMOTE_DEST_IP_ADDRESS_FLAG ; };
  1351. //const REMOTE_DEST_KEY DefaultRemoteDestKey = {0,0,0,0,0xff,0xff};
  1352. //
  1353. // ---------------------------- DESTINATION (REMOTE) IP CONTROL BLOCK --------------
  1354. //
  1355. // Contains information about one destination (remote) IP address.
  1356. //
  1357. // Parent Object: pInterface
  1358. // Lock: It's own lock.
  1359. //
  1360. // There is atmost one ARP Table entry for a given IP address.
  1361. //
  1362. // The IP Entry participates in two lists:
  1363. // (1) A list of all entries that hash to the same bucket in the ARP Table
  1364. // (2) A list of all entries that resolve to the same destination H/W Address --
  1365. // this is only if the IP address is unicast.
  1366. //
  1367. // A pointer to this structure is also used as our context value in the
  1368. // Route Cache Entry prepared by the higher layer protocol(s).
  1369. //
  1370. // Reference Count: We add one to its ref count for each of the following:
  1371. // TBD:
  1372. //
  1373. typedef struct _ARPCB_REMOTE_IP
  1374. {
  1375. RM_OBJECT_HEADER Hdr; // Common header
  1376. //
  1377. // State flags for RemoteIp (in Hdr.State)
  1378. //
  1379. #define ARPREMOTEIP_RESOLVED_MASK 0x0f
  1380. #define ARPREMOTEIP_UNRESOLVED 0x00
  1381. #define ARPREMOTEIP_RESOLVED 0x01
  1382. #define ARPREMOTEIP_SDTYPE_MASK 0x10 // "SD" == Static/Dynamic
  1383. #define ARPREMOTEIP_STATIC 0x00
  1384. #define ARPREMOTEIP_DYNAMIC 0x10
  1385. #define ARPREMOTEIP_FCTYPE_MASK 0x20 // "FC" == FIFO/Channel
  1386. #define ARPREMOTEIP_FIFO 0x00
  1387. #define ARPREMOTEIP_CHANNEL 0x20
  1388. #define ARPREMOTEIP_MCAP_MASK 0x40 // "FC" == FIFO/Channel
  1389. #define ARPREMOTEIP_MCAP_CAPABLE 0x40
  1390. #define SET_REMOTEIP_RESOLVE_STATE(_pRIp, _IfState) \
  1391. RM_SET_STATE(_pRIp, ARPREMOTEIP_RESOLVED_MASK, _IfState)
  1392. #define CHECK_REMOTEIP_RESOLVE_STATE(_pRIp, _IfState) \
  1393. RM_CHECK_STATE(_pRIp, ARPREMOTEIP_RESOLVED_MASK, _IfState)
  1394. #define SET_REMOTEIP_SDTYPE(_pRIp, _IfState) \
  1395. RM_SET_STATE(_pRIp, ARPREMOTEIP_SDTYPE_MASK, _IfState)
  1396. #define CHECK_REMOTEIP_SDTYPE(_pRIp, _IfState) \
  1397. RM_CHECK_STATE(_pRIp, ARPREMOTEIP_SDTYPE_MASK, _IfState)
  1398. #define SET_REMOTEIP_FCTYPE(_pRIp, _IfState) \
  1399. RM_SET_STATE(_pRIp, ARPREMOTEIP_FCTYPE_MASK, _IfState)
  1400. #define CHECK_REMOTEIP_FCTYPE(_pRIp, _IfState) \
  1401. RM_CHECK_STATE(_pRIp, ARPREMOTEIP_FCTYPE_MASK, _IfState)
  1402. #define SET_REMOTEIP_MCAP(_pRIp, _IfState) \
  1403. RM_SET_STATE(_pRIp, ARPREMOTEIP_MCAP_MASK, _IfState)
  1404. #define CHECK_REMOTEIP_MCAP(_pRIp, _IfState) \
  1405. RM_CHECK_STATE(_pRIp, ARPREMOTEIP_MCAP_MASK, _IfState)
  1406. IP_ADDRESS IpAddress; // IP Address
  1407. LIST_ENTRY linkSameDest; // List of entries pointing to
  1408. // the same destination.
  1409. ARPCB_DEST *pDest; // Pointer to destination CB.
  1410. REMOTE_DEST_KEY Key; // Ip address or Mac Address
  1411. #if TODO
  1412. // Timers are: (all exclusive)
  1413. // - Aging timer
  1414. // - Waiting for ARP reply
  1415. // - Waiting for InARP reply
  1416. // - Delay after NAK
  1417. // - Waiting for MARS MULTI
  1418. // - Delay before marking for reval
  1419. #endif // TODO
  1420. ULONG RetriesLeft;
  1421. // The information in this struct is protected by the IF send lock,
  1422. // EXCEPT as noted.
  1423. //
  1424. struct
  1425. {
  1426. // Singly-linked list of Route Cache Entries (no space in RCE to hold
  1427. // a doubly-linked list, unfortunately.)
  1428. //
  1429. RouteCacheEntry *pRceList;
  1430. // listSendPkts is NOT protected by the IF send lock. Instead it is protected
  1431. // by this object(pRemoteIp)'s lock.
  1432. //
  1433. LIST_ENTRY listSendPkts;
  1434. // This entry is NOT protected by any lock. It is set to ZERO
  1435. // each time a packet is sent to this address and is set to the
  1436. // current system time periodically by the garbage collecting task.
  1437. //
  1438. UINT TimeLastChecked;
  1439. } sendinfo;
  1440. PRM_TASK pSendPktsTask;// Points to the task (if any)
  1441. // Attempting to send queued packets.
  1442. PRM_TASK pResolutionTask;// Points to the task (if any)
  1443. // attempting to resolve
  1444. // this destination IP address.
  1445. PRM_TASK pUnloadTask; // Unload (shutdown) this object.
  1446. } ARPCB_REMOTE_IP, *PARPCB_REMOTE_IP;
  1447. #define ASSERT_VALID_REMOTE_IP(_pRemoteIp) \
  1448. ASSERT((_pRemoteIp)->Hdr.Sig == MTAG_REMOTE_IP)
  1449. #define VALID_REMOTE_IP(_pRemoteIp) ((_pRemoteIp)->Hdr.Sig == MTAG_REMOTE_IP)
  1450. //
  1451. // --------------------- DESTINATION (REMOTE) ETHERNET CONTROL BLOCK --------------
  1452. // Creation Params -- passed into the function that creates an
  1453. // instance of a remote ethernet control block.
  1454. //
  1455. typedef struct
  1456. {
  1457. ENetAddr EthAddress;
  1458. IP_ADDRESS IpAddress;
  1459. } ARP_REMOTE_ETH_PARAMS, *PARP_REMOTE_ETH_PARAMS;
  1460. //
  1461. // Contains information about one destination (remote) Ethernet address.
  1462. //
  1463. // Parent Object: pInterface
  1464. // Lock: pInterface
  1465. //
  1466. // There is atmost one Ethernet Table entry for a given Remote ethernet address.
  1467. //
  1468. // The Ethernet entry participates in one group:
  1469. // A list of all entries that hash to the same bucket in the Ethernet Table
  1470. //
  1471. typedef struct _ARPCB_REMOTE_ETH
  1472. {
  1473. RM_OBJECT_HEADER Hdr; // Common header
  1474. IP_ADDRESS IpAddress; // Remote IP address
  1475. ENetAddr EthAddress; // Remote Ethernet MAC addres
  1476. PRM_TASK pUnloadTask; // Unload (shutdown) this object.
  1477. // This entry is NOT protected by any lock. It is set to ZERO
  1478. // each time a packet is sent to this address and is set to the
  1479. // current system time periodically by the garbage collecting task.
  1480. //
  1481. UINT TimeLastChecked;
  1482. } ARPCB_REMOTE_ETH, *PARPCB_REMOTE_ETH;
  1483. #define ASSERT_VALID_REMOTE_ETH(_pRemoteEth) \
  1484. ASSERT((_pRemoteEth)->Hdr.Sig == MTAG_REMOTE_ETH)
  1485. //
  1486. // ---------------------------- LOCAL IP CONTROL BLOCK --------------
  1487. //
  1488. // Contains information about one local IP address.
  1489. //
  1490. // Parent Object: pInterface
  1491. // Lock: uses parent's (pInterface's) lock.
  1492. //
  1493. typedef struct _ARPCB_LOCAL_IP
  1494. {
  1495. RM_OBJECT_HEADER Hdr; // Common header
  1496. //
  1497. // State flags for LocalIp (in Hdr.State)
  1498. //
  1499. #define ARPLOCALIP_MCAP_MASK 0x40
  1500. #define ARPLOCALIP_MCAP_CAPABLE 0x40
  1501. #define SET_LOCALIP_MCAP(_pLIp, _IfState) \
  1502. RM_SET_STATE(_pLIp, ARPLOCALIP_MCAP_MASK, _IfState)
  1503. #define CHECK_LOCALIP_MCAP(_pLIp, _IfState) \
  1504. RM_CHECK_STATE(_pLIp, ARPLOCALIP_MCAP_MASK, _IfState)
  1505. UINT IpAddressType; // One of the LLIP_ADDR_* consts
  1506. IP_ADDRESS IpAddress; // The Address
  1507. IP_MASK IpMask; // Mask for the above.
  1508. UINT AddAddressCount; // No of times address was added
  1509. PRM_TASK pRegistrationTask; // Points to the task (if any)
  1510. // that is doing the unsolicited
  1511. // ARP request to report and
  1512. // validate this IP address is
  1513. // owned by the local interface.
  1514. PRM_TASK pUnloadTask; // Unload (shutdown) this object.
  1515. LIST_ENTRY linkSameDest; // List of entries pointing to
  1516. ARPCB_DEST *pDest; // Pointer to destination CB.
  1517. } ARPCB_LOCAL_IP, *PARPCB_LOCAL_IP;
  1518. // Returns true IFF pLocalIp is in the process of going away (assumes
  1519. // pLocalIp's lock is held) ...
  1520. //
  1521. #define ARP_LOCAL_IP_IS_UNLOADING(pLocalIp) (pLocalIp->pUnloadTask != NULL)
  1522. typedef struct
  1523. {
  1524. NIC1394_DESTINATION HwAddr; // Must be 1st for hash function.
  1525. UINT ChannelSeqNo;
  1526. BOOLEAN ReceiveOnly;
  1527. BOOLEAN AcquireChannel;
  1528. } ARP_DEST_PARAMS, *PARP_DEST_PARAMS;
  1529. //
  1530. // ---------------------------- DESTINATION CONTROL BLOCK --------------
  1531. //
  1532. // All information about an remote destination, including list of VCs to it.
  1533. // This is used for both unicast destinations and multicast/broadcast
  1534. // destinations.
  1535. //
  1536. // Parent Object: PARCB_INTERFACE (Interface control block).
  1537. // Lock: uses parent's (Interface).
  1538. //
  1539. typedef struct _ARPCB_DEST
  1540. {
  1541. RM_OBJECT_HEADER Hdr; // Common header
  1542. LIST_ENTRY listIpToThisDest; // List of IP entries that
  1543. // point to this entry
  1544. LIST_ENTRY listLocalIp; // List of local IP entries
  1545. // related to this dest. that
  1546. // (Currently only related to
  1547. // MCAP recv channels, but
  1548. // could be extended to
  1549. // using async stream for
  1550. // FIFO as well!).
  1551. ARP_DEST_PARAMS Params; // Dest HW Address, etc.
  1552. ARP_VC_HEADER VcHdr; // Single VC associated
  1553. // with this object.
  1554. PRM_TASK pUnloadTask; // Unload (shutdown) this object.
  1555. // The following structure is protected by the IF send lock.
  1556. // It contains all the information required for the fast send path.
  1557. //
  1558. struct
  1559. {
  1560. PRM_TASK pSuspendedCleanupCallTask;
  1561. UINT NumOutstandingSends;
  1562. BOOLEAN OkToSend;
  1563. BOOLEAN IsFifo;
  1564. } sendinfo;
  1565. #define ARP_DEST_IS_FIFO(_pDest) ((_pDest)->sendinfo.IsFifo != 0)
  1566. #define ARP_CAN_SEND_ON_DEST(_pDest) ((_pDest)->sendinfo.OkToSend != 0)
  1567. } ARPCB_DEST, *PARPCB_DEST;
  1568. #define ARP_OBJECT_IS_DEST(_pHdr) ((_pHdr)->Sig == MTAG_DEST)
  1569. #define ASSERT_VALID_DEST(_pDest) \
  1570. ASSERTEX((_pDest)->Hdr.Sig == MTAG_DEST, (_pDest))
  1571. #if OBSOLETE
  1572. //
  1573. // ---------------------------- RECV CHANNEL CONTROL BLOCK --------------
  1574. //
  1575. // All information about a receive channel destination.
  1576. //
  1577. // Parent Object: PARCB_INTERFACE (Interface control block).
  1578. // Lock: uses parent's (Interface).
  1579. //
  1580. typedef struct _ARPCB_RCVCH
  1581. {
  1582. RM_OBJECT_HEADER Hdr; // Common header
  1583. LIST_ENTRY listLIpToThisDest; // List of Local IP entries
  1584. // that point to this entry
  1585. NIC1394_DESTINATION HwAddr; // Destination HW Address.
  1586. ARP_VC_HEADER VcHdr; // Single VC associated
  1587. // with this object.
  1588. PRM_TASK pUnloadTask; // Unload (shutdown) this object.
  1589. } ARPCB_DEST, *PARPCB_RCVCH;
  1590. #endif // OBSOLETE
  1591. // Following sits in the miniport-reserved portion of send-pkts, before they
  1592. // are sent out. We have 4 UINT_PTRs of space available to us.
  1593. //
  1594. typedef struct
  1595. {
  1596. LIST_ENTRY linkQueue;
  1597. union
  1598. {
  1599. struct
  1600. {
  1601. IP_ADDRESS IpAddress;
  1602. ULONG Flags;
  1603. #define ARPSPI_BACKFILLED 0x1
  1604. #define ARPSPI_HEADBUF 0x2
  1605. #define ARPSPI_FIFOPKT 0x4
  1606. #define ARPSPI_CHANNELPKT 0x8
  1607. } IpXmit;
  1608. };
  1609. } ARP_SEND_PKT_MPR_INFO;
  1610. //
  1611. // Various macros for getting and setting information saved in the
  1612. // MiniportReserved portion of packets waiting to be sent...
  1613. //
  1614. #define ARP_OUR_CTXT_FROM_SEND_PACKET(_pPkt) \
  1615. ((ARP_SEND_PKT_MPR_INFO *) &(_pPkt)->MiniportReserved)
  1616. #define ARP_SEND_PKT_FROM_OUR_CTXT(_pCtxt) \
  1617. CONTAINING_RECORD((_pCtxt), NDIS_PACKET, MiniportReserved)
  1618. // Our context in the IP RouteCacheEntry.
  1619. // (Max 2 UINT_PTRs available)
  1620. // Since we also want to keep the destination type (FIFO or CHANNEL) in the RCE,
  1621. // we resort to the questionable technique of saving the FIFO/CHANNEL info in
  1622. // LSB bit of the UINT_PTR used for storing the pointer to the RemoteIp object.
  1623. // We want to keep the FIFO/CHANNEL info in the RCE so that we can prepend
  1624. // the correct header block WITHOUT holding the send lock. We want to keep
  1625. // the send lock held for as little time as possible.
  1626. //
  1627. typedef struct
  1628. {
  1629. ARPCB_REMOTE_IP *pRemoteIp; // Ptr to pRemoteIp
  1630. RouteCacheEntry *pNextRce; // Ptr to next RCE associated with the above
  1631. // RemoteIP
  1632. } ARP_RCE_CONTEXT;
  1633. #define ARP_OUR_CTXT_FROM_RCE(_pRCE) \
  1634. ((ARP_RCE_CONTEXT*) &(_pRCE)->rce_context)
  1635. // Parsed version of the IP/1394 ARP packet.
  1636. //
  1637. typedef struct
  1638. {
  1639. NIC1394_FIFO_ADDRESS SenderHwAddr; // requires 8-byte alignment.
  1640. UINT OpCode;
  1641. UINT SenderMaxRec;
  1642. UINT SenderMaxSpeedCode;
  1643. IP_ADDRESS SenderIpAddress;
  1644. IP_ADDRESS TargetIpAddress;
  1645. UCHAR SourceNodeAdddress;
  1646. UCHAR fPktHasNodeAddress;
  1647. ENetAddr SourceMacAddress;
  1648. } IP1394_ARP_PKT_INFO, *PIP1394_ARP_PKT_INFO;
  1649. // Parsed version of the IP/1394 MCAP Group Descriptor
  1650. //
  1651. typedef struct
  1652. {
  1653. UINT Expiration;
  1654. UINT Channel;
  1655. UINT SpeedCode;
  1656. IP_ADDRESS GroupAddress;
  1657. } IP1394_MCAP_GD_INFO, * PIP1394_MCAP_GD_INFO;
  1658. // Parsed version of an IP/1394 MCAP packet.
  1659. //
  1660. typedef struct
  1661. {
  1662. UINT SenderNodeID;
  1663. UINT OpCode;
  1664. UINT NumGroups;
  1665. PIP1394_MCAP_GD_INFO pGdis;
  1666. // Space for storing up-to 4 GD_INFOs
  1667. //
  1668. IP1394_MCAP_GD_INFO GdiSpace[4];
  1669. } IP1394_MCAP_PKT_INFO, *PIP1394_MCAP_PKT_INFO;
  1670. typedef struct _EUID_NODE_MAC_TABLE_WORKITEM
  1671. {
  1672. // WorkItem used in the request
  1673. NDIS_WORK_ITEM WorkItem;
  1674. } EUID_NODE_MAC_TABLE_WORKITEM, *PEUID_NODE_MAC_TABLE_WORKITEM;
  1675. typedef struct _ARP1394_WORK_ITEM ARP1394_WORK_ITEM, *PARP1394_WORK_ITEM;
  1676. typedef
  1677. NDIS_STATUS
  1678. (*ARP_WORK_ITEM_PROC)(
  1679. struct _ARP1394_WORK_ITEM*,
  1680. PRM_OBJECT_HEADER,
  1681. PRM_STACK_RECORD
  1682. );
  1683. typedef struct _ARP1394_WORK_ITEM
  1684. {
  1685. union
  1686. {
  1687. EUID_TOPOLOGY Euid;
  1688. NDIS_WORK_ITEM NdisWorkItem;
  1689. } u;
  1690. ARP_WORK_ITEM_PROC pFunc;
  1691. } ARP1394_WORK_ITEM, *PARP1394_WORK_ITEM;
  1692. // Structure to express the information carried in an IP header
  1693. typedef struct _ARP_IP_HEADER_INFO
  1694. {
  1695. UCHAR protocol;
  1696. IP_ADDRESS ipSource, ipTarget;
  1697. USHORT headerSize;
  1698. ULONG IpHeaderOffset;
  1699. ULONG IpPktLength;
  1700. } ARP_IP_HEADER_INFO, *PARP_IP_HEADER_INFO;
  1701. //=========================================================================
  1702. // I N T E R N A L P R O T O T Y P E S
  1703. //=========================================================================
  1704. NTSTATUS
  1705. ArpDeviceIoControl(
  1706. IN PDEVICE_OBJECT pDeviceObject,
  1707. IN PIRP pIrp
  1708. );
  1709. NTSTATUS
  1710. ArpWmiDispatch(
  1711. IN PDEVICE_OBJECT pDeviceObject,
  1712. IN PIRP pIrp
  1713. );
  1714. NTSTATUS
  1715. ArpHandleIoctlRequest(
  1716. IN PIRP pIrp,
  1717. IN PIO_STACK_LOCATION pIrpSp
  1718. );
  1719. NDIS_STATUS
  1720. arpCfgGetInterfaceConfiguration(
  1721. IN ARP1394_INTERFACE * pIF,
  1722. IN PRM_STACK_RECORD pSR
  1723. );
  1724. NDIS_STATUS
  1725. arpCfgReadAdapterConfiguration(
  1726. IN ARP1394_ADAPTER * pAdapter,
  1727. IN PRM_STACK_RECORD pSR
  1728. );
  1729. NDIS_STATUS
  1730. arpCfgReadInterfaceConfiguration(
  1731. IN NDIS_HANDLE InterfaceConfigHandle,
  1732. IN ARP1394_INTERFACE * pF,
  1733. IN PRM_STACK_RECORD pSR
  1734. );
  1735. NDIS_STATUS
  1736. arpAllocateTask(
  1737. IN PRM_OBJECT_HEADER pParentObject,
  1738. IN PFN_RM_TASK_HANDLER pfnHandler,
  1739. IN UINT Timeout,
  1740. IN const char * szDescription, OPTIONAL
  1741. OUT PRM_TASK *ppTask,
  1742. IN PRM_STACK_RECORD pSR
  1743. );
  1744. VOID
  1745. arpFreeTask(
  1746. IN PRM_TASK pTask,
  1747. IN PRM_STACK_RECORD pSR
  1748. );
  1749. NDIS_STATUS
  1750. arpTaskInitInterface(
  1751. IN PRM_TASK pTask,
  1752. IN RM_TASK_OPERATION Code,
  1753. IN UINT_PTR UserParam, // Unused
  1754. IN PRM_STACK_RECORD pSR
  1755. );
  1756. NDIS_STATUS
  1757. arpTaskDeinitInterface(
  1758. IN PRM_TASK pTask,
  1759. IN RM_TASK_OPERATION Code,
  1760. IN UINT_PTR UserParam, // Unused
  1761. IN PRM_STACK_RECORD pSR
  1762. );
  1763. NDIS_STATUS
  1764. arpTaskReinitInterface(
  1765. IN PRM_TASK pTask,
  1766. IN RM_TASK_OPERATION Code,
  1767. IN UINT_PTR UserParam, // Unused
  1768. IN PRM_STACK_RECORD pSR
  1769. );
  1770. NDIS_STATUS
  1771. arpTaskActivateInterface(
  1772. IN PRM_TASK pTask,
  1773. IN RM_TASK_OPERATION Code,
  1774. IN UINT_PTR UserParam, // Unused
  1775. IN PRM_STACK_RECORD pSR
  1776. );
  1777. NDIS_STATUS
  1778. arpTaskDeactivateInterface(
  1779. IN PRM_TASK pTask,
  1780. IN RM_TASK_OPERATION Code,
  1781. IN UINT_PTR UserParam, // Unused
  1782. IN PRM_STACK_RECORD pSR
  1783. );
  1784. NDIS_STATUS
  1785. arpTaskMakeRecvFifoCall(
  1786. IN PRM_TASK pTask,
  1787. IN RM_TASK_OPERATION Code,
  1788. IN UINT_PTR UserParam, // Unused
  1789. IN PRM_STACK_RECORD pSR
  1790. );
  1791. NDIS_STATUS
  1792. arpTaskCleanupRecvFifoCall(
  1793. IN PRM_TASK pTask,
  1794. IN RM_TASK_OPERATION Code,
  1795. IN UINT_PTR UserParam, // Unused
  1796. IN PRM_STACK_RECORD pSR
  1797. );
  1798. NDIS_STATUS
  1799. arpTaskMakeCallToDest(
  1800. IN PRM_TASK pTask,
  1801. IN RM_TASK_OPERATION Code,
  1802. IN UINT_PTR UserParam, // Unused
  1803. IN PRM_STACK_RECORD pSR
  1804. );
  1805. NDIS_STATUS
  1806. arpTaskCleanupCallToDest(
  1807. IN PRM_TASK pTask,
  1808. IN RM_TASK_OPERATION Code,
  1809. IN UINT_PTR UserParam, // Unused
  1810. IN PRM_STACK_RECORD pSR
  1811. );
  1812. NDIS_STATUS
  1813. arpTaskResolveIpAddress(
  1814. IN struct _RM_TASK * pTask,
  1815. IN RM_TASK_OPERATION Code,
  1816. IN UINT_PTR UserParam,
  1817. IN PRM_STACK_RECORD pSR
  1818. );
  1819. PRM_OBJECT_HEADER
  1820. arpAdapterCreate(
  1821. PRM_OBJECT_HEADER pParentObject,
  1822. PVOID pCreateParams,
  1823. PRM_STACK_RECORD psr
  1824. );
  1825. VOID
  1826. arpDeinitIf(
  1827. PARP1394_INTERFACE pIF,
  1828. PRM_TASK pCallingTask, // OPTIONAL
  1829. UINT SuspendCode, // OPTIONAL
  1830. PRM_STACK_RECORD pSR
  1831. );
  1832. NDIS_STATUS
  1833. arpTaskUnloadLocalIp(
  1834. IN PRM_TASK pTask,
  1835. IN RM_TASK_OPERATION Code,
  1836. IN UINT_PTR UserParam, // Unused
  1837. IN PRM_STACK_RECORD pSR
  1838. );
  1839. NDIS_STATUS
  1840. arpTaskUnloadRemoteIp(
  1841. IN PRM_TASK pTask,
  1842. IN RM_TASK_OPERATION Code,
  1843. IN UINT_PTR UserParam, // Unused
  1844. IN PRM_STACK_RECORD pSR
  1845. );
  1846. NDIS_STATUS
  1847. arpTaskUnloadRemoteEth(
  1848. IN PRM_TASK pTask,
  1849. IN RM_TASK_OPERATION Code,
  1850. IN UINT_PTR UserParam, // Unused
  1851. IN PRM_STACK_RECORD pSR
  1852. );
  1853. NDIS_STATUS
  1854. arpTaskUnloadDestination(
  1855. IN PRM_TASK pTask,
  1856. IN RM_TASK_OPERATION Code,
  1857. IN UINT_PTR UserParam, // Unused
  1858. IN PRM_STACK_RECORD pSR
  1859. );
  1860. VOID
  1861. arpObjectDelete (
  1862. PRM_OBJECT_HEADER pObj,
  1863. PRM_STACK_RECORD psr
  1864. );
  1865. VOID
  1866. arpAdapterDelete (
  1867. PRM_OBJECT_HEADER pObj,
  1868. PRM_STACK_RECORD psr
  1869. );
  1870. NDIS_STATUS
  1871. arpCopyUnicodeString(
  1872. OUT PNDIS_STRING pDest,
  1873. IN PNDIS_STRING pSrc,
  1874. BOOLEAN fUpCase
  1875. );
  1876. NDIS_STATUS
  1877. arpTaskInitializeAdapter(
  1878. IN PRM_TASK pTask,
  1879. IN RM_TASK_OPERATION Code,
  1880. IN UINT_PTR UserParam,
  1881. IN PRM_STACK_RECORD pSR
  1882. );
  1883. NDIS_STATUS
  1884. arpTaskShutdownAdapter(
  1885. IN PRM_TASK pTask,
  1886. IN RM_TASK_OPERATION Code,
  1887. IN UINT_PTR UserParam,
  1888. IN PRM_STACK_RECORD pSR
  1889. );
  1890. NDIS_STATUS
  1891. arpTaskActivateAdapter(
  1892. IN PRM_TASK pTask,
  1893. IN RM_TASK_OPERATION Code,
  1894. IN UINT_PTR UserParam,
  1895. IN PRM_STACK_RECORD pSR
  1896. );
  1897. NDIS_STATUS
  1898. arpTaskDeactivateAdapter(
  1899. IN PRM_TASK pTask,
  1900. IN RM_TASK_OPERATION Code,
  1901. IN UINT_PTR UserParam,
  1902. IN PRM_STACK_RECORD pSR
  1903. );
  1904. NDIS_STATUS
  1905. arpTaskInterfaceTimer(
  1906. IN PRM_TASK pTask,
  1907. IN RM_TASK_OPERATION Code,
  1908. IN UINT_PTR UserParam,
  1909. IN PRM_STACK_RECORD pSR
  1910. );
  1911. NDIS_STATUS
  1912. arpTaskInterfaceTimer(
  1913. IN PRM_TASK pTask,
  1914. IN RM_TASK_OPERATION Code,
  1915. IN UINT_PTR UserParam,
  1916. IN PRM_STACK_RECORD pSR
  1917. );
  1918. #if TEST_ICS_HACK
  1919. NDIS_STATUS
  1920. arpTaskDoIcsTest(
  1921. IN struct _RM_TASK * pTask,
  1922. IN RM_TASK_OPERATION Code,
  1923. IN UINT_PTR UserParam,
  1924. IN PRM_STACK_RECORD pSR
  1925. );
  1926. #endif // TEST_ICS_HACK
  1927. NDIS_STATUS
  1928. arpTaskIfMaintenance(
  1929. IN struct _RM_TASK * pTask,
  1930. IN RM_TASK_OPERATION Code,
  1931. IN UINT_PTR UserParam,
  1932. IN PRM_STACK_RECORD pSR
  1933. );
  1934. NDIS_STATUS
  1935. arpInitializeConstBufferPool(
  1936. IN UINT NumBuffersToCache,
  1937. IN UINT MaxBuffers,
  1938. IN const VOID* pvMem,
  1939. IN UINT cbMem,
  1940. IN PRM_OBJECT_HEADER pOwningObject,
  1941. IN OUT ARP_CONST_BUFFER_POOL * pHdrPool,
  1942. IN PRM_STACK_RECORD pSR
  1943. );
  1944. VOID
  1945. arpDeinitializeConstBufferPool(
  1946. IN ARP_CONST_BUFFER_POOL * pHdrPool,
  1947. IN PRM_STACK_RECORD pSR
  1948. );
  1949. PNDIS_BUFFER
  1950. arpAllocateConstBuffer(
  1951. ARP_CONST_BUFFER_POOL * pHdrPool
  1952. );
  1953. VOID
  1954. arpDeallocateConstBuffer(
  1955. ARP_CONST_BUFFER_POOL * pHdrPool,
  1956. PNDIS_BUFFER pNdisBuffer
  1957. );
  1958. VOID
  1959. arpCompleteSentPkt(
  1960. IN NDIS_STATUS Status,
  1961. IN ARP1394_INTERFACE * pIF,
  1962. IN ARPCB_DEST * pDest,
  1963. IN PNDIS_PACKET pNdisPacket
  1964. );
  1965. NDIS_STATUS
  1966. arpParseArpPkt(
  1967. IN PIP1394_ARP_PKT pArpPkt,
  1968. IN UINT cbBufferSize,
  1969. OUT PIP1394_ARP_PKT_INFO pPktInfo
  1970. );
  1971. VOID
  1972. arpPrepareArpPkt(
  1973. IN PIP1394_ARP_PKT_INFO pArpPktInfo,
  1974. // IN UINT SenderMaxRec,
  1975. OUT PIP1394_ARP_PKT pArpPkt
  1976. );
  1977. NDIS_STATUS
  1978. arpPrepareArpResponse(
  1979. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  1980. IN PIP1394_ARP_PKT_INFO pArpRequest,
  1981. OUT PIP1394_ARP_PKT_INFO pArpResponse,
  1982. IN PRM_STACK_RECORD pSR
  1983. );
  1984. NDIS_STATUS
  1985. arpAddOneStaticArpEntry(
  1986. IN PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  1987. IN IP_ADDRESS IpAddress,
  1988. IN PNIC1394_FIFO_ADDRESS pFifoAddr,
  1989. IN PRM_STACK_RECORD pSR
  1990. );
  1991. VOID
  1992. arpSetPrimaryIfTask(
  1993. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  1994. PRM_TASK pTask,
  1995. ULONG PrimaryState,
  1996. PRM_STACK_RECORD pSR
  1997. );
  1998. VOID
  1999. arpClearPrimaryIfTask(
  2000. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2001. PRM_TASK pTask,
  2002. ULONG PrimaryState,
  2003. PRM_STACK_RECORD pSR
  2004. );
  2005. VOID
  2006. arpSetSecondaryIfTask(
  2007. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2008. PRM_TASK pTask,
  2009. ULONG SecondaryState,
  2010. PRM_STACK_RECORD pSR
  2011. );
  2012. VOID
  2013. arpClearSecondaryIfTask(
  2014. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2015. PRM_TASK pTask,
  2016. ULONG SecondaryState,
  2017. PRM_STACK_RECORD pSR
  2018. );
  2019. VOID
  2020. arpSetPrimaryAdapterTask(
  2021. PARP1394_ADAPTER pAdapter, // LOCKIN LOCKOUT
  2022. PRM_TASK pTask,
  2023. ULONG PrimaryState,
  2024. PRM_STACK_RECORD pSR
  2025. );
  2026. VOID
  2027. arpClearPrimaryAdapterTask(
  2028. PARP1394_ADAPTER pAdapter, // LOCKIN LOCKOUT
  2029. PRM_TASK pTask,
  2030. ULONG PrimaryState,
  2031. PRM_STACK_RECORD pSR
  2032. );
  2033. VOID
  2034. arpSetSecondaryAdapterTask(
  2035. PARP1394_ADAPTER pAdapter, // LOCKIN LOCKOUT
  2036. PRM_TASK pTask,
  2037. ULONG SecondaryState,
  2038. PRM_STACK_RECORD pSR
  2039. );
  2040. VOID
  2041. arpClearSecondaryAdapterTask(
  2042. PARP1394_ADAPTER pAdapter, // LOCKIN LOCKOUT
  2043. PRM_TASK pTask,
  2044. ULONG SecondaryState,
  2045. PRM_STACK_RECORD pSR
  2046. );
  2047. NDIS_STATUS
  2048. arpTryReconfigureIf(
  2049. PARP1394_INTERFACE pIF,
  2050. PNET_PNP_EVENT pNetPnPEvent,
  2051. PRM_STACK_RECORD pSR
  2052. );
  2053. VOID
  2054. arpResetIfStats(
  2055. IN PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2056. IN PRM_STACK_RECORD pSR
  2057. );
  2058. VOID
  2059. arpGetPktCountBins(
  2060. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2061. IN PNDIS_PACKET pNdisPacket,
  2062. OUT PULONG pSizeBin,
  2063. OUT PULONG pTimeBin
  2064. );
  2065. VOID
  2066. arpLogSendFifoCounts(
  2067. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2068. IN PNDIS_PACKET pNdisPacket,
  2069. IN NDIS_STATUS Status
  2070. );
  2071. VOID
  2072. arpLogRecvFifoCounts(
  2073. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2074. IN PNDIS_PACKET pNdisPacket
  2075. );
  2076. VOID
  2077. arpLogSendChannelCounts(
  2078. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2079. IN PNDIS_PACKET pNdisPacket,
  2080. IN NDIS_STATUS Status
  2081. );
  2082. VOID
  2083. arpLogRecvChannelCounts(
  2084. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2085. IN PNDIS_PACKET pNdisPacket
  2086. );
  2087. NDIS_STATUS
  2088. arpInitializeVc(
  2089. PARP1394_INTERFACE pIF,
  2090. PARP_STATIC_VC_INFO pVcInfo,
  2091. PRM_OBJECT_HEADER pOwner,
  2092. PARP_VC_HEADER pVcHdr,
  2093. PRM_STACK_RECORD pSR
  2094. );
  2095. VOID
  2096. arpDeinitializeVc(
  2097. PARP1394_INTERFACE pIF,
  2098. PARP_VC_HEADER pVcHdr,
  2099. PRM_OBJECT_HEADER pOwner, // NOLOCKIN NOLOCKOUT
  2100. PRM_STACK_RECORD pSR
  2101. );
  2102. NDIS_STATUS
  2103. arpAllocateControlPacketPool(
  2104. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2105. UINT MaxBufferSize,
  2106. PRM_STACK_RECORD pSR
  2107. );
  2108. VOID
  2109. arpFreeControlPacketPool(
  2110. PARP1394_INTERFACE pIF, // LOCKIN LOCKOUT
  2111. PRM_STACK_RECORD pSR
  2112. );
  2113. NDIS_STATUS
  2114. arpAllocateControlPacket(
  2115. IN PARP1394_INTERFACE pIF,
  2116. IN UINT cbBufferSize,
  2117. IN UINT PktFlags,
  2118. OUT PNDIS_PACKET *ppNdisPacket,
  2119. OUT PVOID *ppvData,
  2120. PRM_STACK_RECORD pSR
  2121. );
  2122. VOID
  2123. arpFreeControlPacket(
  2124. PARP1394_INTERFACE pIF,
  2125. PNDIS_PACKET pNdisPacket,
  2126. PRM_STACK_RECORD pSR
  2127. );
  2128. VOID
  2129. arpRefSendPkt(
  2130. PNDIS_PACKET pNdisPacket,
  2131. PARPCB_DEST pDest
  2132. );
  2133. VOID
  2134. arpProcessArpPkt(
  2135. PARP1394_INTERFACE pIF,
  2136. PIP1394_ARP_PKT pArpPkt,
  2137. UINT cbBufferSize
  2138. );
  2139. VOID
  2140. arpProcessMcapPkt(
  2141. PARP1394_INTERFACE pIF,
  2142. PIP1394_MCAP_PKT pMcapPkt,
  2143. UINT cbBufferSize
  2144. );
  2145. VOID
  2146. arpLinkRemoteIpToDest(
  2147. ARPCB_REMOTE_IP *pRemoteIp,
  2148. ARPCB_DEST *pDest,
  2149. PRM_STACK_RECORD pSR
  2150. );
  2151. VOID
  2152. arpUnlinkRemoteIpFromDest(
  2153. ARPCB_REMOTE_IP *pRemoteIp, // LOCKIN LOCKOUT
  2154. PRM_STACK_RECORD pSR
  2155. );
  2156. VOID
  2157. arpUnlinkAllRemoteIpsFromDest(
  2158. ARPCB_DEST *pDest, // LOCKIN LOCKOUT
  2159. PRM_STACK_RECORD pSR
  2160. );
  2161. VOID
  2162. arpLinkLocalIpToDest(
  2163. ARPCB_LOCAL_IP * pLocalIp,
  2164. ARPCB_DEST *pDest,
  2165. PRM_STACK_RECORD pSR
  2166. );
  2167. VOID
  2168. arpUnlinkLocalIpFromDest(
  2169. ARPCB_LOCAL_IP *pLocalIp, // LOCKIN LOCKOUT
  2170. PRM_STACK_RECORD pSR
  2171. );
  2172. VOID
  2173. arpUnlinkAllLocalIpsFromDest(
  2174. ARPCB_DEST *pDest, // LOCKIN LOCKOUT
  2175. PRM_STACK_RECORD pSR
  2176. );
  2177. #if 0
  2178. NDIS_STATUS
  2179. arpCopyAnsiStringToUnicodeString(
  2180. OUT PNDIS_STRING pDest,
  2181. IN PANSI_STRING pSrc
  2182. );
  2183. NDIS_STATUS
  2184. arpCopyUnicodeStringToAnsiString(
  2185. OUT PANSI_STRING pDest,
  2186. IN PNDIS_STRING pSrc
  2187. );
  2188. #endif // 0
  2189. VOID
  2190. arpUpdateReceiveMultichannels(
  2191. PARP1394_INTERFACE pIF,
  2192. UINT SecondsSinceLastCall,
  2193. PRM_STACK_RECORD pSR
  2194. );
  2195. NDIS_STATUS
  2196. arpPrepareAndSendNdisRequest(
  2197. IN PARP1394_ADAPTER pAdapter,
  2198. IN PARP_NDIS_REQUEST pArpNdisRequest,
  2199. IN PRM_TASK pTask, // OPTIONAL
  2200. IN UINT PendCode,
  2201. IN NDIS_OID Oid,
  2202. IN PVOID pBuffer,
  2203. IN ULONG BufferLength,
  2204. IN NDIS_REQUEST_TYPE RequestType,
  2205. IN PRM_STACK_RECORD pSR
  2206. );
  2207. typedef enum
  2208. {
  2209. ARP_ICS_FORWARD_TO_1394,
  2210. ARP_ICS_FORWARD_TO_ETHERNET,
  2211. } ARP_ICS_FORWARD_DIRECTION;
  2212. #if TEST_ICS_HACK
  2213. VOID
  2214. arpEthSendComplete(
  2215. IN ARP1394_ADAPTER * pAdapter,
  2216. IN PNDIS_PACKET pNdisPacket,
  2217. IN NDIS_STATUS Status
  2218. );
  2219. NDIS_STATUS
  2220. arpEthReceive(
  2221. ARP1394_ADAPTER * pAdapter,
  2222. NDIS_HANDLE Context,
  2223. VOID *Header,
  2224. UINT HeaderSize,
  2225. VOID *Data,
  2226. UINT Size,
  2227. UINT TotalSize
  2228. );
  2229. #endif // TEST_ICS_HACK
  2230. VOID
  2231. arpEthReceivePacket(
  2232. ARP1394_INTERFACE * pIF,
  2233. PNDIS_PACKET Packet
  2234. );
  2235. NDIS_STATUS
  2236. arpAllocateEthernetPools(
  2237. IN PARP1394_INTERFACE pIF,
  2238. IN PRM_STACK_RECORD pSR
  2239. );
  2240. VOID
  2241. arpFreeEthernetPools(
  2242. IN PARP1394_INTERFACE pIF,
  2243. IN PRM_STACK_RECORD pSR
  2244. );
  2245. #if TEST_ICS_HACK
  2246. VOID
  2247. arpDbgStartIcsTest(
  2248. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2249. PRM_STACK_RECORD pSR
  2250. );
  2251. VOID
  2252. arpDbgTryStopIcsTest(
  2253. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2254. PRM_STACK_RECORD pSR
  2255. );
  2256. #endif // TEST_ICS_HACK
  2257. VOID
  2258. arpDbgIncrementReentrancy(
  2259. PLONG pReentrancyCount
  2260. );
  2261. VOID
  2262. arpDbgDecrementReentrancy(
  2263. PLONG pReentrancyCount
  2264. );
  2265. VOID
  2266. arpHandleControlPktSendCompletion(
  2267. IN ARP1394_INTERFACE * pIF,
  2268. IN PNDIS_PACKET pNdisPacket
  2269. );
  2270. VOID
  2271. arpStartIfMaintenanceTask(
  2272. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2273. PRM_STACK_RECORD pSR
  2274. );
  2275. NDIS_STATUS
  2276. arpTryStopIfMaintenanceTask(
  2277. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2278. IN PRM_TASK pTask, // task to pend until M task completes
  2279. IN UINT PendCode, // Pend code to suspend task.
  2280. PRM_STACK_RECORD pSR
  2281. );
  2282. UINT
  2283. arpGetSystemTime(VOID);
  2284. BOOLEAN
  2285. arpCanTryMcap(
  2286. IP_ADDRESS IpAddress
  2287. );
  2288. UINT
  2289. arpFindAssignedChannel(
  2290. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2291. IN IP_ADDRESS IpAddress,
  2292. IN UINT CurrentTime,
  2293. PRM_STACK_RECORD pSR
  2294. );
  2295. VOID
  2296. arpUpdateRemoteIpDest(
  2297. IN PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2298. IN PARPCB_REMOTE_IP pRemoteIp,
  2299. IN PARP_DEST_PARAMS pDestParams,
  2300. PRM_STACK_RECORD pSR
  2301. );
  2302. MYBOOL
  2303. arpIsActiveMcapChannel(
  2304. PMCAP_CHANNEL_INFO pMci,
  2305. UINT CurrentTime
  2306. );
  2307. VOID
  2308. arpSendControlPkt(
  2309. IN ARP1394_INTERFACE * pIF, // LOCKIN NOLOCKOUT (IF send lk)
  2310. IN PNDIS_PACKET pNdisPacket,
  2311. IN PARPCB_DEST pDest,
  2312. IN PRM_STACK_RECORD pSR
  2313. );
  2314. NDIS_STATUS
  2315. arpCreateMcapPkt(
  2316. IN PARP1394_INTERFACE pIF,
  2317. IN PIP1394_MCAP_PKT_INFO pPktInfo,
  2318. OUT PNDIS_PACKET *ppNdisPacket,
  2319. PRM_STACK_RECORD pSR
  2320. );
  2321. UINT
  2322. arpProcessReceivedPacket(
  2323. IN PARP1394_INTERFACE pIF,
  2324. IN PNDIS_PACKET pNdisPacket,
  2325. IN MYBOOL IsChannel
  2326. );
  2327. VOID
  2328. arpUpdateArpCache(
  2329. PARP1394_INTERFACE pIF, // NOLOCKIN NOLOCKOUT
  2330. IP_ADDRESS RemoteIpAddress,
  2331. ENetAddr *pRemoteEthAddress,
  2332. PARP_DEST_PARAMS pDestParams,
  2333. MYBOOL fCreateIfRequired,
  2334. PRM_STACK_RECORD pSR
  2335. );
  2336. UINT
  2337. arpEthernetReceivePacket(
  2338. IN NDIS_HANDLE ProtocolBindingContext,
  2339. IN NDIS_HANDLE ProtocolVcContext,
  2340. IN PNDIS_PACKET pNdisPacket
  2341. );
  2342. VOID
  2343. arpEthReceive1394Packet(
  2344. IN PARP1394_INTERFACE pIF,
  2345. IN PNDIS_PACKET pNdisPacket,
  2346. IN PVOID pvHeader,
  2347. IN UINT HeaderSize,
  2348. IN MYBOOL IsChannel
  2349. );
  2350. NDIS_STATUS
  2351. arpSlowIpTransmit(
  2352. IN ARP1394_INTERFACE * pIF,
  2353. IN PNDIS_PACKET pNdisPacket,
  2354. IN REMOTE_DEST_KEY Destination,
  2355. IN RouteCacheEntry * pRCE OPTIONAL
  2356. );
  2357. VOID
  2358. arpDelRceList(
  2359. IN PARPCB_REMOTE_IP pRemoteIp, // IF send lock WRITELOCKIN WRITELOCKOUTD
  2360. IN PRM_STACK_RECORD pSR
  2361. );
  2362. VOID
  2363. arpGenericWorkItem(
  2364. struct _NDIS_WORK_ITEM * pWorkItem,
  2365. PVOID pContext
  2366. );
  2367. VOID
  2368. arpQueueWorkItem (
  2369. PARP1394_WORK_ITEM pWorkItem,
  2370. ARP_WORK_ITEM_PROC pFunc,
  2371. PRM_OBJECT_HEADER pHdr,
  2372. PRM_STACK_RECORD pSR
  2373. );
  2374. NDIS_STATUS
  2375. arpGetEuidTopology (
  2376. IN PARP1394_ADAPTER pAdapter,
  2377. PRM_STACK_RECORD pSR
  2378. );
  2379. VOID
  2380. arpNdProcessBusReset(
  2381. IN PARP1394_ADAPTER pAdapter
  2382. );
  2383. NDIS_STATUS
  2384. arpAddIpAddressToRemoteIp (
  2385. PARPCB_REMOTE_IP pRemoteIp,
  2386. PNDIS_PACKET pNdisPacket
  2387. );
  2388. VOID
  2389. arpReturnBackupTask (
  2390. IN ARP1394_TASK* pTask
  2391. );
  2392. VOID
  2393. arpAllocateBackupTasks (
  2394. ARP1394_GLOBALS* pGlobals
  2395. );
  2396. VOID
  2397. arpFreeBackupTasks (
  2398. ARP1394_GLOBALS* pGlobals
  2399. );
  2400. ARP1394_TASK *
  2401. arpGetBackupTask (
  2402. IN ARP1394_GLOBALS* pGlobals
  2403. );
  2404. NTSTATUS
  2405. arpDelArpEntry(
  2406. PARP1394_INTERFACE pIF,
  2407. IPAddr IpAddress,
  2408. PRM_STACK_RECORD pSR
  2409. );
  2410. VOID
  2411. arpAddBackupTasks (
  2412. IN ARP1394_GLOBALS* pGlobals,
  2413. UINT Num
  2414. );
  2415. VOID
  2416. arpRemoveBackupTasks (
  2417. IN ARP1394_GLOBALS* pGlobals,
  2418. UINT Num
  2419. );
  2420. MYBOOL
  2421. arpNeedToCleanupDestVc(
  2422. ARPCB_DEST *pDest // LOCKING LOCKOUT
  2423. );
  2424. VOID
  2425. arpLowPowerCloseAllCalls (
  2426. ARP1394_INTERFACE *pIF,
  2427. PRM_STACK_RECORD pSR
  2428. );
  2429. VOID
  2430. arpDeactivateIf(
  2431. PARP1394_INTERFACE pIF,
  2432. PRM_TASK pCallingTask, // OPTIONAL
  2433. UINT SuspendCode, // OPTIONAL
  2434. PRM_STACK_RECORD pSR
  2435. );
  2436. NDIS_STATUS
  2437. arpTaskLowPower(
  2438. IN struct _RM_TASK * pTask,
  2439. IN RM_TASK_OPERATION Code,
  2440. IN UINT_PTR UserParam,
  2441. IN PRM_STACK_RECORD pSR
  2442. );
  2443. NDIS_STATUS
  2444. arpSetupSpecialDest(
  2445. IN PARP1394_INTERFACE pIF,
  2446. IN NIC1394_ADDRESS_TYPE AddressType,
  2447. IN PRM_TASK pParentTask,
  2448. IN UINT PendCode,
  2449. OUT PARPCB_DEST * ppSpecialDest,
  2450. IN PRM_STACK_RECORD pSR
  2451. );
  2452. NDIS_STATUS
  2453. arpResume (
  2454. IN ARP1394_ADAPTER* pAdapter,
  2455. IN ARP_RESUME_CAUSE Cause,
  2456. IN PRM_STACK_RECORD pSR
  2457. );
  2458. NDIS_STATUS
  2459. arpTaskOnPower (
  2460. IN PRM_TASK pTask,
  2461. IN RM_TASK_OPERATION Code,
  2462. IN UINT_PTR UserParam, // Unused
  2463. IN PRM_STACK_RECORD pSR
  2464. );
  2465. NDIS_STATUS
  2466. arpMakeCallOnDest(
  2467. IN PARPCB_REMOTE_IP pRemoteIp,
  2468. IN PARPCB_DEST pDest,
  2469. IN PRM_TASK pTaskToPend,
  2470. IN ULONG PEND_StageMakeCallComplete,
  2471. IN PRM_STACK_RECORD pSR
  2472. );
  2473. //=========================================================================
  2474. // G L O B A L D A T A
  2475. //=========================================================================
  2476. extern
  2477. RM_STATIC_OBJECT_INFO
  2478. ArpGlobals_AdapterStaticInfo;
  2479. extern const
  2480. NIC1394_ENCAPSULATION_HEADER
  2481. Arp1394_IpEncapHeader;
  2482. // Warning -- FAIL(NDIS_STATUS_PENDING) == TRUE
  2483. //
  2484. #define FAIL(_Status) ((_Status) != NDIS_STATUS_SUCCESS)
  2485. #define PEND(_Status) ((_Status) == NDIS_STATUS_PENDING)
  2486. #if RM_EXTRA_CHECKING
  2487. #define LOCKHDR(_pHdr, _psr) \
  2488. RmWriteLockObject((_pHdr), dbg_func_locid, (_psr))
  2489. #else // !RM_EXTRA_CHECKING
  2490. #define LOCKHDR(_pHdr, _psr) \
  2491. RmWriteLockObject((_pHdr), (_psr))
  2492. #endif // !RM_EXTRA_CHECKING
  2493. #define LOCKOBJ(_pObj, _psr) \
  2494. LOCKHDR(&(_pObj)->Hdr, (_psr))
  2495. #define UNLOCKHDR(_pHdr, _psr) \
  2496. RmUnlockObject((_pHdr), (_psr))
  2497. #define UNLOCKOBJ(_pObj, _psr) \
  2498. UNLOCKHDR(&(_pObj)->Hdr, (_psr))
  2499. #define ARP_ALLOCSTRUCT(_p, _tag) \
  2500. NdisAllocateMemoryWithTag(&(_p), sizeof(*(_p)), (_tag))
  2501. #define ARP_FREE(_p) NdisFreeMemory((_p), 0, 0)
  2502. #define ARP_ZEROSTRUCT(_p) \
  2503. NdisZeroMemory((_p), sizeof(*(_p)))
  2504. #define ARRAY_LENGTH(_array) (sizeof(_array)/sizeof((_array)[0]))
  2505. #if RM_EXTRA_CHECKING
  2506. #define DBG_ADDASSOC(_phdr, _e1, _e2, _assoc, _fmt, _psr)\
  2507. RmDbgAddAssociation( \
  2508. dbg_func_locid, \
  2509. (_phdr), \
  2510. (UINT_PTR) (_e1), \
  2511. (UINT_PTR) (_e2), \
  2512. (_assoc), \
  2513. (_fmt), \
  2514. (_psr) \
  2515. )
  2516. #define DBG_DELASSOC(_phdr, _e1, _e2, _assoc, _psr) \
  2517. RmDbgDeleteAssociation( \
  2518. dbg_func_locid, \
  2519. (_phdr), \
  2520. (UINT_PTR) (_e1), \
  2521. (UINT_PTR) (_e2), \
  2522. (_assoc), \
  2523. (_psr) \
  2524. )
  2525. // (debug only) Enumeration of types of associations.
  2526. //
  2527. enum
  2528. {
  2529. ARPASSOC_IP_OPEN, // IP has called ArpIpOpen
  2530. ARPASSOC_LINK_IPADDR_OF_DEST,
  2531. ARPASSOC_LINK_DEST_OF_IPADDR,
  2532. ARPASSOC_LOCALIP_UNLOAD_TASK,
  2533. ARPASSOC_REMOTEIP_UNLOAD_TASK,
  2534. ARPASSOC_REMOTEETH_UNLOAD_TASK,
  2535. ARPASSOC_DEST_UNLOAD_TASK,
  2536. ARPASSOC_CBUFPOOL_ALLOC,
  2537. ARPASSOC_EXTLINK_DEST_TO_PKT,
  2538. ARPASSOC_EXTLINK_RIP_TO_RCE,
  2539. ARPASSOC_EXTLINK_TO_NDISVCHANDLE,
  2540. ARPASSOC_REMOTEIP_SENDPKTS_TASK,
  2541. ARPASSOC_IF_MAKECALL_TASK,
  2542. ARPASSOC_IF_CLEANUPCALL_TASK,
  2543. ARPASSOC_DEST_MAKECALL_TASK,
  2544. ARPASSOC_DEST_CLEANUPCALL_TASK,
  2545. ARPASSOC_DEST_CLEANUPCALLTASK_WAITING_ON_SENDS,
  2546. ARPASSOC_PKTS_QUEUED_ON_REMOTEIP,
  2547. ARPASSOC_PRIMARY_IF_TASK,
  2548. ARPASSOC_ACTDEACT_IF_TASK,
  2549. ARPASSOC_IF_OPENAF,
  2550. ARPASSOC_PRIMARY_AD_TASK,
  2551. ARPASSOC_ACTDEACT_AD_TASK,
  2552. ARPASSOC_LINK_IF_OF_BCDEST,
  2553. ARPASSOC_LINK_BCDEST_OF_IF,
  2554. ARPASSOC_IF_PROTOPKTPOOL,
  2555. ARPASSOC_IF_PROTOBUFPOOL,
  2556. ARPASSOC_RESOLUTION_IF_TASK,
  2557. ARPASSOC_LINK_IF_OF_MCDEST,
  2558. ARPASSOC_LINK_MCDEST_OF_IF,
  2559. ARPASSOC_LINK_IF_OF_ETHDEST,
  2560. ARPASSOC_LINK_ETHDEST_OF_IF,
  2561. ARPASSOC_IF_ETHPKTPOOL,
  2562. ARPASSOC_IF_ETHBUFPOOL,
  2563. ARPASSOC_ETH_SEND_PACKET,
  2564. ARPASSOC_IF_MAINTENANCE_TASK,
  2565. ARPASSOC_WORK_ITEM,
  2566. ARPASSOC_ETHDHCP_UNLOAD_TASK,
  2567. ARPASSOC_REMOTEIP_RESOLVE_TASK,
  2568. ARPASSOC_TASK_TO_RESOLVE_REMOTEIP
  2569. };
  2570. #else // !RM_EXTRA_CHECKING
  2571. #define DBG_ADDASSOC(_phdr, _e1, _e2, _assoc, _fmt, _psr) (0)
  2572. #define DBG_DELASSOC(_phdr, _e1, _e2, _assoc, _psr) (0)
  2573. #endif // !RM_EXTRA_CHECKING
  2574. #define ARPDBG_REF_EVERY_PACKET 1
  2575. #define ARPDBG_REF_EVERY_RCE 1
  2576. // USHORT
  2577. // SWAPBYTES_USHORT(USHORT Val )
  2578. //
  2579. #define SWAPBYTES_USHORT(Val) \
  2580. ((((Val) & 0xff) << 8) | (((Val) & 0xff00) >> 8))
  2581. // ULONG
  2582. // SWAPBYTES_ULONG(ULONG Val )
  2583. //
  2584. #define SWAPBYTES_ULONG(Val) \
  2585. ((((Val) & 0x000000ff) << 24) | \
  2586. (((Val) & 0x0000ff00) << 8) | \
  2587. (((Val) & 0x00ff0000) >> 8) | \
  2588. (((Val) & 0xff000000) >> 24) )
  2589. #define N2H_USHORT(Val) SWAPBYTES_USHORT(Val)
  2590. #define H2N_USHORT(Val) SWAPBYTES_USHORT(Val)
  2591. #define N2H_ULONG(Val) SWAPBYTES_ULONG(Val)
  2592. #define H2N_ULONG(Val) SWAPBYTES_ULONG(Val)
  2593. #define ARP_ATPASSIVE() (KeGetCurrentIrql()==PASSIVE_LEVEL)
  2594. #define LOGSTATS_NoCopyRecvs(_pIF, _pNdisPacket) \
  2595. NdisInterlockedIncrement(&((_pIF)->stats.recvpkts.NoCopyRecvs))
  2596. #define LOGSTATS_CopyRecvs(_pIF, _pNdisPacket) \
  2597. NdisInterlockedIncrement(&((_pIF)->stats.recvpkts.CopyRecvs))
  2598. #define LOGSTATS_ResourceRecvs(_pIF, _pNdisPacket) \
  2599. NdisInterlockedIncrement(&((_pIF)->stats.recvpkts.ResourceRecvs))
  2600. #define LOGSTATS_TotRecvs(_pIF, _pNdisPacket) \
  2601. NdisInterlockedIncrement(&((_pIF)->stats.recvpkts.TotRecvs))
  2602. #define LOGSTATS_RecvFifoCounts(_pIF, _pNdisPacket) \
  2603. arpLogRecvFifoCounts(_pIF, _pNdisPacket)
  2604. #define LOGSTATS_RecvChannelCounts(_pIF, _pNdisPacket) \
  2605. arpLogRecvChannelCounts(_pIF, _pNdisPacket)
  2606. #define LOGSTATS_TotalSendFifoMakeCalls(_pIF) \
  2607. NdisInterlockedIncrement(&((_pIF)->stats.calls.TotalSendFifoMakeCalls))
  2608. #define LOGSTATS_SuccessfulSendFifoMakeCalls(_pIF) \
  2609. NdisInterlockedIncrement(&((_pIF)->stats.calls.SuccessfulSendFifoMakeCalls))
  2610. #define LOGSTATS_FailedSendFifoMakeCalls(_pIF) \
  2611. NdisInterlockedIncrement(&((_pIF)->stats.calls.FailedSendFifoMakeCalls))
  2612. #define LOGSTATS_IncomingClosesOnSendFifos(_pIF) \
  2613. NdisInterlockedIncrement(&((_pIF)->stats.calls.IncomingClosesOnSendFifos))
  2614. #define LOGSTATS_TotalChannelMakeCalls(_pIF) \
  2615. NdisInterlockedIncrement(&((_pIF)->stats.calls.TotalChannelMakeCalls))
  2616. #define LOGSTATS_SuccessfulChannelMakeCalls(_pIF) \
  2617. NdisInterlockedIncrement(&((_pIF)->stats.calls.SuccessfulChannelMakeCalls))
  2618. #define LOGSTATS_FailedChannelMakeCalls(_pIF) \
  2619. NdisInterlockedIncrement(&((_pIF)->stats.calls.FailedChannelMakeCalls))
  2620. #define LOGSTATS_IncomingClosesOnChannels(_pIF) \
  2621. NdisInterlockedIncrement(&((_pIF)->stats.calls.IncomingClosesOnChannels))
  2622. #define IF_FROM_LOCALIP(_pLIp) \
  2623. (PARP1394_INTERFACE) RM_PARENT_OBJECT(_pLIp)
  2624. #define IF_FROM_REMOTEIP(_pRIp) \
  2625. (PARP1394_INTERFACE) RM_PARENT_OBJECT(_pRIp)
  2626. #define IF_FROM_DEST(_pDest) \
  2627. (PARP1394_INTERFACE) RM_PARENT_OBJECT(_pDest)
  2628. #if RM_EXTRA_CHECKING
  2629. #define OBJLOG0(_pObj, _szFmt) \
  2630. RmDbgLogToObject( \
  2631. &(_pObj)->Hdr, \
  2632. NULL, (_szFmt), \
  2633. 0, 0, 0, 0, NULL, NULL \
  2634. )
  2635. #define OBJLOG1(_pObj, _szFmt, _P1) \
  2636. RmDbgLogToObject( \
  2637. &(_pObj)->Hdr, \
  2638. NULL, (_szFmt), \
  2639. (UINT_PTR) (_P1), \
  2640. 0, 0, 0, NULL, NULL \
  2641. )
  2642. #define OBJLOG2(_pObj, _szFmt, _P1, _P2) \
  2643. RmDbgLogToObject( \
  2644. &(_pObj)->Hdr, \
  2645. NULL, (_szFmt), \
  2646. (UINT_PTR) (_P1), \
  2647. (UINT_PTR) (_P2), \
  2648. 0, 0, NULL, NULL \
  2649. )
  2650. #else // !RM_EXTRA_CHECKING
  2651. #define OBJLOG0(_pObj, _szFmt) (0)
  2652. #define OBJLOG1(_pObj, _szFmt, _P1) (0)
  2653. #define OBJLOG2(_pObj, _szFmt, _P1, _P2) (0)
  2654. #endif // !RM_EXTRA_CHECKING
  2655. #if ARP_DO_TIMESTAMPS
  2656. void
  2657. arpTimeStamp(
  2658. char *szFormatString,
  2659. UINT Val
  2660. );
  2661. #define TIMESTAMPX(_FormatString) \
  2662. arpTimeStamp("TIMESTAMP %lu:%lu.%lu ARP1394 " _FormatString "\n", 0)
  2663. #if ARP_DO_ALL_TIMESTAMPS
  2664. #define TIMESTAMP(_FormatString) \
  2665. arpTimeStamp("TIMESTAMP %lu:%lu.%lu ARP1394 " _FormatString "\n", 0)
  2666. #define TIMESTAMP1(_FormatString, _Val) \
  2667. arpTimeStamp("TIMESTAMP %lu:%lu.%lu ARP1394 " _FormatString "\n", (_Val))
  2668. #else
  2669. #define TIMESTAMP(_FormatString)
  2670. #define TIMESTAMP1(_FormatString, _Val)
  2671. #endif
  2672. #else // !ARP_DO_TIMESTAMPS
  2673. #define TIMESTAMP(_FormatString)
  2674. #define TIMESTAMPX(_FormatString)
  2675. #define TIMESTAMP1(_FormatString, _Val)
  2676. #endif // !ARP_DO_TIMESTAMPS