Leaked source code of windows server 2003
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.

1351 lines
26 KiB

  1. /*++
  2. Copyright (c) 1997 FORE Systems, Inc.
  3. Copyright (c) 1997 Microsoft Corporation
  4. Module Name:
  5. macros.h
  6. Abstract:
  7. Macros for the ATMLANE module
  8. Author:
  9. Revision History:
  10. --*/
  11. #ifndef __ATMLANE_MACROS_H
  12. #define __ATMLANE_MACROS_H
  13. #include "atmlane.h"
  14. #ifndef LOCKIN
  15. #define LOCKIN
  16. #endif
  17. #ifndef NOLOCKOUT
  18. #define NOLOCKOUT
  19. #endif
  20. #define NULL_NDIS_HANDLE ((NDIS_HANDLE)NULL)
  21. #ifndef MAX
  22. /*++
  23. OPAQUE
  24. MAX(
  25. IN OPAQUE Fred,
  26. IN OPAQUE Shred
  27. )
  28. --*/
  29. #define MAX(Fred, Shred) (((Fred) > (Shred)) ? (Fred) : (Shred))
  30. #endif // MAX
  31. #ifndef MIN
  32. /*++
  33. OPAQUE
  34. MIN(
  35. IN OPAQUE Fred,
  36. IN OPAQUE Shred
  37. )
  38. --*/
  39. #define MIN(Fred, Shred) (((Fred) < (Shred)) ? (Fred) : (Shred))
  40. #endif // MIN
  41. #define ROUND_OFF(_size) (((_size) + 7) & ~0x7)
  42. /*++
  43. ULONG
  44. ATMLANE_HASH(
  45. IN PMAC_ADDRESS pMacAddress
  46. )
  47. --*/
  48. #define ATMLANE_HASH(pMacAddress) \
  49. ((ULONG)(pMacAddress)->Byte[4])
  50. /*++
  51. BOOLEAN
  52. MAC_ADDR_EQUAL(
  53. IN PMAC_ADDRESS pMacAddr1,
  54. IN PMAC_ADDRESS pMacAddr2
  55. )
  56. --*/
  57. #define MAC_ADDR_EQUAL(_pMac1, _pMac2) \
  58. ((*(ULONG UNALIGNED *)&((PUCHAR)(_pMac1))[2] == \
  59. *(ULONG UNALIGNED *)&((PUCHAR)(_pMac2))[2]) && \
  60. (*(USHORT UNALIGNED *)(_pMac1) == \
  61. *(USHORT UNALIGNED *)(_pMac2)))
  62. /*++
  63. VOID
  64. SET_FLAG(
  65. IN ULONG Flags,
  66. IN ULONG Mask,
  67. IN ULONG Val
  68. )
  69. --*/
  70. #define SET_FLAG(Flags, Mask, Val) \
  71. (Flags) = ((Flags) & ~(Mask)) | (Val)
  72. /*++
  73. BOOLEAN
  74. IS_FLAG_SET(
  75. IN ULONG Flags,
  76. IN ULONG Mask,
  77. IN ULONG Val
  78. )
  79. --*/
  80. #define IS_FLAG_SET(Flags, Mask, Val) \
  81. (((Flags) & (Mask)) == (Val))
  82. // ----------------------------------------------------------------------------
  83. /*++
  84. VOID
  85. INIT_BLOCK_STRUCT(
  86. IN ATMLANE_BLOCK *pBlock
  87. )
  88. --*/
  89. #define INIT_BLOCK_STRUCT(pBlock) NdisInitializeEvent(&((pBlock)->Event))
  90. /*++
  91. NDIS_STATUS
  92. WAIT_ON_BLOCK_STRUCT(
  93. IN ATMLANE_BLOCK *pBlock
  94. )
  95. --*/
  96. #define WAIT_ON_BLOCK_STRUCT(pBlock) \
  97. (NdisWaitEvent(&((pBlock)->Event), 0), (pBlock)->Status)
  98. /*++
  99. VOID
  100. SIGNAL_BLOCK_STRUCT(
  101. IN ATMLANE_BLOCK *pBlock,
  102. IN UINT Status
  103. )
  104. --*/
  105. #define SIGNAL_BLOCK_STRUCT(pBlock, _Status) \
  106. { (pBlock)->Status = _Status; NdisSetEvent(&((pBlock)->Event)); }
  107. /*++
  108. VOID
  109. FREE_BLOCK_STRUCT(
  110. IN ATMLANE_BLOCK *pBlock
  111. )
  112. --*/
  113. #define FREE_BLOCK_STRUCT(pBlock) // Nothing to be done here
  114. // ----------------------------------------------------------------------------
  115. /*++
  116. VOID
  117. INIT_LOCK(
  118. IN PNDIS_SPIN_LOCK pLock
  119. )
  120. --*/
  121. #if DEBUG_SPIN_LOCK
  122. #define INIT_LOCK(pLock, Str) \
  123. AtmLaneAllocateSpinLock(pLock, Str, __FILE__, __LINE__)
  124. #else
  125. #define INIT_LOCK(pLock) \
  126. NdisAllocateSpinLock(pLock)
  127. #endif // DEBUG_SPIN_LOCK
  128. /*++
  129. VOID
  130. ACQUIRE_LOCK(
  131. IN PNDIS_SPIN_LOCK pLock,
  132. IN PUCHAR Str
  133. )
  134. --*/
  135. #if DEBUG_SPIN_LOCK
  136. #define ACQUIRE_LOCK(pLock, Str) \
  137. AtmLaneAcquireSpinLock(pLock, Str, __FILE__, __LINE__)
  138. #else
  139. #define ACQUIRE_LOCK(pLock) \
  140. NdisAcquireSpinLock(pLock)
  141. #endif // DEBUG_SPIN_LOCK
  142. /*++
  143. VOID
  144. ACQUIRE_LOCK_DPC(
  145. IN PNDIS_SPIN_LOCK pLock
  146. )
  147. --*/
  148. #if DEBUG_SPIN_LOCK
  149. #define ACQUIRE_LOCK_DPC(pLock, Str) \
  150. AtmLaneAcquireSpinLock(pLock, Str"-dpc", __FILE__, __LINE__)
  151. #else
  152. #define ACQUIRE_LOCK_DPC(pLock) \
  153. NdisDprAcquireSpinLock(pLock)
  154. #endif // DEBUG_SPIN_LOCK
  155. /*++
  156. VOID
  157. RELEASE_LOCK(
  158. IN PNDIS_SPIN_LOCK pLock,
  159. )
  160. --*/
  161. #if DEBUG_SPIN_LOCK
  162. #define RELEASE_LOCK(pLock, Str) \
  163. AtmLaneReleaseSpinLock(pLock, Str, __FILE__, __LINE__)
  164. #else
  165. #define RELEASE_LOCK(pLock) \
  166. NdisReleaseSpinLock(pLock)
  167. #endif // DEBUG_SPIN_LOCK
  168. /*++
  169. VOID
  170. RELEASE_LOCK_DPC(
  171. IN PNDIS_SPIN_LOCK pLock
  172. )
  173. --*/
  174. #if DEBUG_SPIN_LOCK
  175. #define RELEASE_LOCK_DPC(pLock, Str) \
  176. AtmLaneReleaseSpinLock(pLock, Str"-dpc", __FILE__, __LINE__)
  177. #else
  178. #define RELEASE_LOCK_DPC(pLock) \
  179. NdisDprReleaseSpinLock(pLock)
  180. #endif // DEBUG_SPIN_LOCK
  181. /*++
  182. VOID
  183. FREE_LOCK(
  184. IN PNDIS_SPIN_LOCK pLock
  185. )
  186. --*/
  187. #if DEBUG_SPIN_LOCK
  188. #define FREE_LOCK(pLock, Str) \
  189. AtmLaneFreeSpinLock(pLock, Str, __FILE__, __LINE__)
  190. #else
  191. #define FREE_LOCK(pLock) \
  192. NdisFreeSpinLock(pLock)
  193. #endif
  194. // ----------------------------------------------------------------------------
  195. /*++
  196. VOID
  197. INIT_ADAPTER_LOCK(
  198. IN PATMLANE_ADAPTER pAdapter
  199. )
  200. --*/
  201. #if DEBUG_SPIN_LOCK
  202. #define INIT_ADAPTER_LOCK(pAdapter) \
  203. INIT_LOCK(&((pAdapter)->AdapterLock), "adapter")
  204. #else
  205. #define INIT_ADAPTER_LOCK(pAdapter) \
  206. INIT_LOCK(&((pAdapter)->AdapterLock))
  207. #endif
  208. /*++
  209. VOID
  210. ACQUIRE_ADAPTER_LOCK(
  211. IN PATMLANE_ELAN pAdapter
  212. )
  213. --*/
  214. #if DEBUG_SPIN_LOCK
  215. #define ACQUIRE_ADAPTER_LOCK(pAdapter) \
  216. ACQUIRE_LOCK(&((pAdapter)->AdapterLock), "adapter")
  217. #else
  218. #define ACQUIRE_ADAPTER_LOCK(pAdapter) \
  219. ACQUIRE_LOCK(&((pAdapter)->AdapterLock))
  220. #endif
  221. /*++
  222. VOID
  223. ACQUIRE_ADAPTER_LOCK_DPC(
  224. IN PATMLANE_ELAN pAdapter
  225. )
  226. --*/
  227. #if DEBUG_SPIN_LOCK
  228. #define ACQUIRE_ADAPTER_LOCK_DPC(pAdapter) \
  229. ACQUIRE_LOCK_DPC(&((pAdapter)->AdapterLock), "adapter")
  230. #else
  231. #define ACQUIRE_ADAPTER_LOCK_DPC(pAdapter) \
  232. ACQUIRE_LOCK_DPC(&((pAdapter)->AdapterLock))
  233. #endif
  234. /*++
  235. VOID
  236. RELEASE_ADAPTER_LOCK(
  237. IN PATMLANE_ELAN pAdapter
  238. )
  239. --*/
  240. #if DEBUG_SPIN_LOCK
  241. #define RELEASE_ADAPTER_LOCK(pAdapter) \
  242. RELEASE_LOCK(&((pAdapter)->AdapterLock), "adapter")
  243. #else
  244. #define RELEASE_ADAPTER_LOCK(pAdapter) \
  245. RELEASE_LOCK(&((pAdapter)->AdapterLock))
  246. #endif
  247. /*++
  248. VOID
  249. RELEASE_ADAPTER_LOCK_DPC(
  250. IN PATMLANE_ELAN pAdapter
  251. )
  252. --*/
  253. #if DEBUG_SPIN_LOCK
  254. #define RELEASE_ADAPTER_LOCK_DPC(pAdapter) \
  255. RELEASE_LOCK_DPC(&((pAdapter)->AdapterLock), "adapter")
  256. #else
  257. #define RELEASE_ADAPTER_LOCK_DPC(pAdapter) \
  258. RELEASE_LOCK_DPC(&((pAdapter)->AdapterLock))
  259. #endif
  260. /*++
  261. VOID
  262. FREE_ADAPTER_LOCK(
  263. IN PATMLANE_ELAN pAdapter
  264. )
  265. --*/
  266. #if DEBUG_SPIN_LOCK
  267. #define FREE_ADAPTER_LOCK(pAdapter) \
  268. FREE_LOCK(&((pAdapter)->AdapterLock), "adapter")
  269. #else
  270. #define FREE_ADAPTER_LOCK(pAdapter) \
  271. FREE_LOCK(&((pAdapter)->AdapterLock))
  272. #endif
  273. // ----------------------------------------------------------------------------
  274. /*++
  275. VOID
  276. INIT_ELAN_LOCK(
  277. IN PATMLANE_ELAN pElan
  278. )
  279. --*/
  280. #if DEBUG_SPIN_LOCK
  281. #define INIT_ELAN_LOCK(pElan) \
  282. INIT_LOCK(&((pElan)->ElanLock), "elan")
  283. #else
  284. #define INIT_ELAN_LOCK(pElan) \
  285. INIT_LOCK(&((pElan)->ElanLock))
  286. #endif
  287. /*++
  288. VOID
  289. ACQUIRE_ELAN_LOCK(
  290. IN PATMLANE_ELAN pElan
  291. )
  292. --*/
  293. #if DEBUG_SPIN_LOCK
  294. #define ACQUIRE_ELAN_LOCK(pElan) \
  295. ACQUIRE_LOCK(&((pElan)->ElanLock), "elan")
  296. #else
  297. #define ACQUIRE_ELAN_LOCK(pElan) \
  298. ACQUIRE_LOCK(&((pElan)->ElanLock))
  299. #endif
  300. /*++
  301. VOID
  302. ACQUIRE_ELAN_LOCK_DPC(
  303. IN PATMLANE_ELAN pElan
  304. )
  305. --*/
  306. #if DEBUG_SPIN_LOCK
  307. #define ACQUIRE_ELAN_LOCK_DPC(pElan) \
  308. ACQUIRE_LOCK_DPC(&((pElan)->ElanLock), "elan")
  309. #else
  310. #define ACQUIRE_ELAN_LOCK_DPC(pElan) \
  311. ACQUIRE_LOCK_DPC(&((pElan)->ElanLock))
  312. #endif
  313. /*++
  314. VOID
  315. RELEASE_ELAN_LOCK(
  316. IN PATMLANE_ELAN pElan
  317. )
  318. --*/
  319. #if DEBUG_SPIN_LOCK
  320. #define RELEASE_ELAN_LOCK(pElan) \
  321. RELEASE_LOCK(&((pElan)->ElanLock), "elan")
  322. #else
  323. #define RELEASE_ELAN_LOCK(pElan) \
  324. RELEASE_LOCK(&((pElan)->ElanLock))
  325. #endif
  326. /*++
  327. VOID
  328. RELEASE_ELAN_LOCK_DPC(
  329. IN PATMLANE_ELAN pElan
  330. )
  331. --*/
  332. #if DEBUG_SPIN_LOCK
  333. #define RELEASE_ELAN_LOCK_DPC(pElan) \
  334. RELEASE_LOCK_DPC(&((pElan)->ElanLock), "elan")
  335. #else
  336. #define RELEASE_ELAN_LOCK_DPC(pElan) \
  337. RELEASE_LOCK_DPC(&((pElan)->ElanLock))
  338. #endif
  339. /*++
  340. VOID
  341. FREE_ELAN_LOCK(
  342. IN PATMLANE_ELAN pElan
  343. )
  344. --*/
  345. #if DEBUG_SPIN_LOCK
  346. #define FREE_ELAN_LOCK(pElan) \
  347. FREE_LOCK(&((pElan)->ElanLock), "elan")
  348. #else
  349. #define FREE_ELAN_LOCK(pElan) \
  350. FREE_LOCK(&((pElan)->ElanLock))
  351. #endif
  352. // ----------------------------------------------------------------------------
  353. /*++
  354. VOID
  355. INIT_HEADER_LOCK(
  356. IN PATMLANE_ELAN pElan
  357. )
  358. --*/
  359. #if DEBUG_SPIN_LOCK
  360. #define INIT_HEADER_LOCK(pElan) \
  361. INIT_LOCK(&((pElan)->HeaderBufferLock), "header")
  362. #else
  363. #define INIT_HEADER_LOCK(pElan) \
  364. INIT_LOCK(&((pElan)->HeaderBufferLock))
  365. #endif
  366. /*++
  367. VOID
  368. ACQUIRE_HEADER_LOCK(
  369. IN PATMLANE_ELAN pElan
  370. )
  371. --*/
  372. #if DEBUG_SPIN_LOCK
  373. #define ACQUIRE_HEADER_LOCK(pElan) \
  374. ACQUIRE_LOCK(&((pElan)->HeaderBufferLock), "header")
  375. #else
  376. #define ACQUIRE_HEADER_LOCK(pElan) \
  377. ACQUIRE_LOCK(&((pElan)->HeaderBufferLock))
  378. #endif
  379. /*++
  380. VOID
  381. ACQUIRE_HEADER_LOCK_DPC(
  382. IN PATMLANE_ELAN pElan
  383. )
  384. --*/
  385. #if DEBUG_SPIN_LOCK
  386. #define ACQUIRE_HEADER_LOCK_DPC(pElan) \
  387. ACQUIRE_LOCK_DPC(&((pElan)->HeaderBufferLock), "header")
  388. #else
  389. #define ACQUIRE_HEADER_LOCK_DPC(pElan) \
  390. ACQUIRE_LOCK_DPC(&((pElan)->HeaderBufferLock))
  391. #endif
  392. /*++
  393. VOID
  394. RELEASE_HEADER_LOCK(
  395. IN PATMLANE_ELAN pElan
  396. )
  397. --*/
  398. #if DEBUG_SPIN_LOCK
  399. #define RELEASE_HEADER_LOCK(pElan) \
  400. RELEASE_LOCK(&((pElan)->HeaderBufferLock), "header")
  401. #else
  402. #define RELEASE_HEADER_LOCK(pElan) \
  403. RELEASE_LOCK(&((pElan)->HeaderBufferLock))
  404. #endif
  405. /*++
  406. VOID
  407. RELEASE_HEADER_LOCK_DPC(
  408. IN PATMLANE_ELAN pElan
  409. )
  410. --*/
  411. #if DEBUG_SPIN_LOCK
  412. #define RELEASE_HEADER_LOCK_DPC(pElan) \
  413. RELEASE_LOCK_DPC(&((pElan)->HeaderBufferLock), "header")
  414. #else
  415. #define RELEASE_HEADER_LOCK_DPC(pElan) \
  416. RELEASE_LOCK_DPC(&((pElan)->HeaderBufferLock))
  417. #endif
  418. /*++
  419. VOID
  420. FREE_HEADER_LOCK(
  421. IN PATMLANE_ELAN pElan
  422. )
  423. --*/
  424. #if DEBUG_SPIN_LOCK
  425. #define FREE_HEADER_LOCK(pElan) \
  426. FREE_LOCK(&((pElan)->HeaderBufferLock), "header")
  427. #else
  428. #define FREE_HEADER_LOCK(pElan) \
  429. FREE_LOCK(&((pElan)->HeaderBufferLock))
  430. #endif
  431. // ----------------------------------------------------------------------------
  432. /*++
  433. VOID
  434. INIT_ELAN_TIMER_LOCK(
  435. IN PATMLANE_ELAN pElan
  436. )
  437. --*/
  438. #if DEBUG_SPIN_LOCK
  439. #define INIT_ELAN_TIMER_LOCK(pElan) \
  440. INIT_LOCK(&((pElan)->TimerLock), "timer")
  441. #else
  442. #define INIT_ELAN_TIMER_LOCK(pElan) \
  443. INIT_LOCK(&((pElan)->TimerLock))
  444. #endif
  445. /*++
  446. VOID
  447. ACQUIRE_ELAN_TIMER_LOCK(
  448. IN PATMLANE_ELAN pElan
  449. )
  450. --*/
  451. #if DEBUG_SPIN_LOCK
  452. #define ACQUIRE_ELAN_TIMER_LOCK(pElan) \
  453. ACQUIRE_LOCK(&((pElan)->TimerLock), "timer")
  454. #else
  455. #define ACQUIRE_ELAN_TIMER_LOCK(pElan) \
  456. ACQUIRE_LOCK(&((pElan)->TimerLock))
  457. #endif
  458. /*++
  459. VOID
  460. ACQUIRE_ELAN_TIMER_LOCK_DPC(
  461. IN PATMLANE_ELAN pElan
  462. )
  463. --*/
  464. #if DEBUG_SPIN_LOCK
  465. #define ACQUIRE_ELAN_TIMER_LOCK_DPC(pElan) \
  466. ACQUIRE_LOCK_DPC(&((pElan)->TimerLock), "timer")
  467. #else
  468. #define ACQUIRE_ELAN_TIMER_LOCK_DPC(pElan) \
  469. ACQUIRE_LOCK_DPC(&((pElan)->TimerLock))
  470. #endif
  471. /*++
  472. VOID
  473. RELEASE_ELAN_TIMER_LOCK(
  474. IN PATMLANE_ELAN pElan
  475. )
  476. --*/
  477. #if DEBUG_SPIN_LOCK
  478. #define RELEASE_ELAN_TIMER_LOCK(pElan) \
  479. RELEASE_LOCK(&((pElan)->TimerLock), "timer")
  480. #else
  481. #define RELEASE_ELAN_TIMER_LOCK(pElan) \
  482. RELEASE_LOCK(&((pElan)->TimerLock))
  483. #endif
  484. /*++
  485. VOID
  486. RELEASE_ELAN_TIMER_LOCK_DPC(
  487. IN PATMLANE_ELAN pElan
  488. )
  489. --*/
  490. #if DEBUG_SPIN_LOCK
  491. #define RELEASE_ELAN_TIMER_LOCK_DPC(pElan) \
  492. RELEASE_LOCK_DPC(&((pElan)->TimerLock), "timer")
  493. #else
  494. #define RELEASE_ELAN_TIMER_LOCK_DPC(pElan) \
  495. RELEASE_LOCK_DPC(&((pElan)->TimerLock))
  496. #endif
  497. /*++
  498. VOID
  499. FREE_ELAN_TIMER_LOCK(
  500. IN PATMLANE_ELAN pElan
  501. )
  502. --*/
  503. #if DEBUG_SPIN_LOCK
  504. #define FREE_ELAN_TIMER_LOCK(pElan) \
  505. FREE_LOCK(&((pElan)->TimerLock), "timer")
  506. #else
  507. #define FREE_ELAN_TIMER_LOCK(pElan) \
  508. FREE_LOCK(&((pElan)->TimerLock))
  509. #endif
  510. // ----------------------------------------------------------------------------
  511. /*++
  512. VOID
  513. INIT_ATM_ENTRY_LOCK(
  514. IN PATMLANE_ATM_ENTRY pAe
  515. )
  516. --*/
  517. #if DEBUG_SPIN_LOCK
  518. #define INIT_ATM_ENTRY_LOCK(pAe) \
  519. INIT_LOCK(&((pAe)->AeLock), "atmentry")
  520. #else
  521. #define INIT_ATM_ENTRY_LOCK(pAe) \
  522. INIT_LOCK(&((pAe)->AeLock))
  523. #endif
  524. /*++
  525. VOID
  526. ACQUIRE_ATM_ENTRY_LOCK(
  527. IN PATMLANE_ATM_ENTRY pAe
  528. )
  529. --*/
  530. #if DEBUG_SPIN_LOCK
  531. #define ACQUIRE_ATM_ENTRY_LOCK(pAe) \
  532. ACQUIRE_LOCK(&((pAe)->AeLock), "atmentry")
  533. #else
  534. #define ACQUIRE_ATM_ENTRY_LOCK(pAe) \
  535. ACQUIRE_LOCK(&((pAe)->AeLock))
  536. #endif
  537. /*++
  538. VOID
  539. ACQUIRE_ATM_ENTRY_LOCK_DPC(
  540. IN PATMLANE_ATM_ENTRY pAe
  541. )
  542. --*/
  543. #if DEBUG_SPIN_LOCK
  544. #define ACQUIRE_ATM_ENTRY_LOCK_DPC(pAe) \
  545. ACQUIRE_LOCK_DPC(&((pAe)->AeLock), "atmentry")
  546. #else
  547. #define ACQUIRE_ATM_ENTRY_LOCK_DPC(pAe) \
  548. ACQUIRE_LOCK_DPC(&((pAe)->AeLock))
  549. #endif
  550. /*++
  551. VOID
  552. RELEASE_ATM_ENTRY_LOCK(
  553. IN PATMLANE_ATM_ENTRY pAe
  554. )
  555. --*/
  556. #if DEBUG_SPIN_LOCK
  557. #define RELEASE_ATM_ENTRY_LOCK(pAe) \
  558. RELEASE_LOCK(&((pAe)->AeLock), "atmentry")
  559. #else
  560. #define RELEASE_ATM_ENTRY_LOCK(pAe) \
  561. RELEASE_LOCK(&((pAe)->AeLock))
  562. #endif
  563. /*++
  564. VOID
  565. RELEASE_ATM_ENTRY_LOCK_DPC(
  566. IN PATMLANE_ATM_ENTRY pAe
  567. )
  568. --*/
  569. #if DEBUG_SPIN_LOCK
  570. #define RELEASE_ATM_ENTRY_LOCK_DPC(pAe) \
  571. RELEASE_LOCK_DPC(&((pAe)->AeLock), "atmentry")
  572. #else
  573. #define RELEASE_ATM_ENTRY_LOCK_DPC(pAe) \
  574. RELEASE_LOCK_DPC(&((pAe)->AeLock))
  575. #endif
  576. /*++
  577. VOID
  578. FREE_ATM_ENTRY_LOCK(
  579. IN PATMLANE_ATM_ENTRY pAe
  580. )
  581. --*/
  582. #if DEBUG_SPIN_LOCK
  583. #define FREE_ATM_ENTRY_LOCK(pAe) \
  584. FREE_LOCK(&((pAe)->AeLock), "atmentry")
  585. #else
  586. #define FREE_ATM_ENTRY_LOCK(pAe) \
  587. FREE_LOCK(&((pAe)->AeLock))
  588. #endif
  589. // ----------------------------------------------------------------------------
  590. /*++
  591. VOID
  592. INIT_MAC_ENTRY_LOCK(
  593. IN PATMLANE_ATM_ENTRY pMe
  594. )
  595. --*/
  596. #if DEBUG_SPIN_LOCK
  597. #define INIT_MAC_ENTRY_LOCK(pMe) \
  598. INIT_LOCK(&((pMe)->MeLock), "macentry")
  599. #else
  600. #define INIT_MAC_ENTRY_LOCK(pMe) \
  601. INIT_LOCK(&((pMe)->MeLock))
  602. #endif
  603. /*++
  604. VOID
  605. ACQUIRE_MAC_ENTRY_LOCK(
  606. IN PATMLANE_ATM_ENTRY pMe
  607. )
  608. --*/
  609. #if DEBUG_SPIN_LOCK
  610. #define ACQUIRE_MAC_ENTRY_LOCK(pMe) \
  611. ACQUIRE_LOCK(&((pMe)->MeLock), "macentry")
  612. #else
  613. #define ACQUIRE_MAC_ENTRY_LOCK(pMe) \
  614. ACQUIRE_LOCK(&((pMe)->MeLock))
  615. #endif
  616. /*++
  617. VOID
  618. ACQUIRE_MAC_ENTRY_LOCK_DPC(
  619. IN PATMLANE_ATM_ENTRY pMe
  620. )
  621. --*/
  622. #if DEBUG_SPIN_LOCK
  623. #define ACQUIRE_MAC_ENTRY_LOCK_DPC(pMe) \
  624. ACQUIRE_LOCK_DPC(&((pMe)->MeLock), "macentry")
  625. #else
  626. #define ACQUIRE_MAC_ENTRY_LOCK_DPC(pMe) \
  627. ACQUIRE_LOCK_DPC(&((pMe)->MeLock))
  628. #endif
  629. /*++
  630. VOID
  631. RELEASE_MAC_ENTRY_LOCK(
  632. IN PATMLANE_ATM_ENTRY pMe
  633. )
  634. --*/
  635. #if DEBUG_SPIN_LOCK
  636. #define RELEASE_MAC_ENTRY_LOCK(pMe) \
  637. RELEASE_LOCK(&((pMe)->MeLock), "macentry")
  638. #else
  639. #define RELEASE_MAC_ENTRY_LOCK(pMe) \
  640. RELEASE_LOCK(&((pMe)->MeLock))
  641. #endif
  642. /*++
  643. VOID
  644. RELEASE_MAC_ENTRY_LOCK_DPC(
  645. IN PATMLANE_ATM_ENTRY pMe
  646. )
  647. --*/
  648. #if DEBUG_SPIN_LOCK
  649. #define RELEASE_MAC_ENTRY_LOCK_DPC(pMe) \
  650. RELEASE_LOCK_DPC(&((pMe)->MeLock), "macentry")
  651. #else
  652. #define RELEASE_MAC_ENTRY_LOCK_DPC(pMe) \
  653. RELEASE_LOCK_DPC(&((pMe)->MeLock))
  654. #endif
  655. /*++
  656. VOID
  657. FREE_MAC_ENTRY_LOCK(
  658. IN PATMLANE_ATM_ENTRY pMe
  659. )
  660. --*/
  661. #if DEBUG_SPIN_LOCK
  662. #define FREE_MAC_ENTRY_LOCK(pMe) \
  663. FREE_LOCK(&((pMe)->MeLock), "macentry")
  664. #else
  665. #define FREE_MAC_ENTRY_LOCK(pMe) \
  666. FREE_LOCK(&((pMe)->MeLock))
  667. #endif
  668. // ----------------------------------------------------------------------------
  669. /*++
  670. VOID
  671. INIT_ELAN_ATM_LIST_LOCK(
  672. IN PATMARP_INTERFACE pElan
  673. )
  674. --*/
  675. #if DEBUG_SPIN_LOCK
  676. #define INIT_ELAN_ATM_LIST_LOCK(pElan) \
  677. INIT_LOCK(&((pElan)->AtmEntryListLock), "atmlist")
  678. #else
  679. #define INIT_ELAN_ATM_LIST_LOCK(pElan) \
  680. INIT_LOCK(&((pElan)->AtmEntryListLock))
  681. #endif
  682. /*++
  683. VOID
  684. ACQUIRE_ELAN_ATM_LIST_LOCK(
  685. IN PATMARP_INTERFACE pElan
  686. )
  687. --*/
  688. #if DEBUG_SPIN_LOCK
  689. #define ACQUIRE_ELAN_ATM_LIST_LOCK(pElan) \
  690. ACQUIRE_LOCK(&((pElan)->AtmEntryListLock), "atmlist")
  691. #else
  692. #define ACQUIRE_ELAN_ATM_LIST_LOCK(pElan) \
  693. ACQUIRE_LOCK(&((pElan)->AtmEntryListLock))
  694. #endif
  695. /*++
  696. VOID
  697. ACQUIRE_ELAN_ATM_LIST_LOCK_DPC(
  698. IN PATMARP_INTERFACE pElan
  699. )
  700. --*/
  701. #if DEBUG_SPIN_LOCK
  702. #define ACQUIRE_ELAN_ATM_LIST_LOCK_DPC(pElan) \
  703. ACQUIRE_LOCK_DPC(&((pElan)->AtmEntryListLock), "atmlist")
  704. #else
  705. #define ACQUIRE_ELAN_ATM_LIST_LOCK_DPC(pElan) \
  706. ACQUIRE_LOCK_DPC(&((pElan)->AtmEntryListLock))
  707. #endif
  708. /*++
  709. VOID
  710. RELEASE_ELAN_ATM_LIST_LOCK(
  711. IN PATMARP_INTERFACE pElan
  712. )
  713. --*/
  714. #if DEBUG_SPIN_LOCK
  715. #define RELEASE_ELAN_ATM_LIST_LOCK(pElan) \
  716. RELEASE_LOCK(&((pElan)->AtmEntryListLock), "atmlist")
  717. #else
  718. #define RELEASE_ELAN_ATM_LIST_LOCK(pElan) \
  719. RELEASE_LOCK(&((pElan)->AtmEntryListLock))
  720. #endif
  721. /*++
  722. VOID
  723. RELEASE_ELAN_ATM_LIST_LOCK_DPC(
  724. IN PATMARP_INTERFACE pElan
  725. )
  726. --*/
  727. #if DEBUG_SPIN_LOCK
  728. #define RELEASE_ELAN_ATM_LIST_LOCK_DPC(pElan) \
  729. RELEASE_LOCK_DPC(&((pElan)->AtmEntryListLock), "atmlist")
  730. #else
  731. #define RELEASE_ELAN_ATM_LIST_LOCK_DPC(pElan) \
  732. RELEASE_LOCK_DPC(&((pElan)->AtmEntryListLock))
  733. #endif
  734. /*++
  735. VOID
  736. FREE_ELAN_ATM_LIST_LOCK(
  737. IN PATMARP_INTERFACE pElan
  738. )
  739. --*/
  740. #if DEBUG_SPIN_LOCK
  741. #define FREE_ELAN_ATM_LIST_LOCK(pElan) \
  742. FREE_LOCK(&((pElan)->AtmEntryListLock), "atmlist")
  743. #else
  744. #define FREE_ELAN_ATM_LIST_LOCK(pElan) \
  745. FREE_LOCK(&((pElan)->AtmEntryListLock))
  746. #endif
  747. // ----------------------------------------------------------------------------
  748. /*++
  749. VOID
  750. INIT_ELAN_MAC_TABLE_LOCK(
  751. IN PATMLANE_ELAN pElan
  752. )
  753. --*/
  754. #if DEBUG_SPIN_LOCK
  755. #define INIT_ELAN_MAC_TABLE_LOCK(pElan) \
  756. INIT_LOCK(&((pElan)->MacTableLock), "mactable")
  757. #else
  758. #define INIT_ELAN_MAC_TABLE_LOCK(pElan) \
  759. INIT_LOCK(&((pElan)->MacTableLock))
  760. #endif
  761. /*++
  762. VOID
  763. ACQUIRE_ELAN_MAC_TABLE_LOCK(
  764. IN PATMLANE_ELAN pElan
  765. )
  766. --*/
  767. #if DEBUG_SPIN_LOCK
  768. #define ACQUIRE_ELAN_MAC_TABLE_LOCK(pElan) \
  769. ACQUIRE_LOCK(&((pElan)->MacTableLock), "mactable")
  770. #else
  771. #define ACQUIRE_ELAN_MAC_TABLE_LOCK(pElan) \
  772. ACQUIRE_LOCK(&((pElan)->MacTableLock))
  773. #endif
  774. /*++
  775. VOID
  776. ACQUIRE_ELAN_MAC_TABLE_LOCK_DPC(
  777. IN PATMLANE_ELAN pElan
  778. )
  779. --*/
  780. #if DEBUG_SPIN_LOCK
  781. #define ACQUIRE_ELAN_MAC_TABLE_LOCK_DPC(pElan) \
  782. ACQUIRE_LOCK_DPC(&((pElan)->MacTableLock), "mactable")
  783. #else
  784. #define ACQUIRE_ELAN_MAC_TABLE_LOCK_DPC(pElan) \
  785. ACQUIRE_LOCK_DPC(&((pElan)->MacTableLock))
  786. #endif
  787. /*++
  788. VOID
  789. RELEASE_ELAN_MAC_TABLE_LOCK(
  790. IN PATMLANE_ELAN pElan
  791. )
  792. --*/
  793. #if DEBUG_SPIN_LOCK
  794. #define RELEASE_ELAN_MAC_TABLE_LOCK(pElan) \
  795. RELEASE_LOCK(&((pElan)->MacTableLock), "mactable")
  796. #else
  797. #define RELEASE_ELAN_MAC_TABLE_LOCK(pElan) \
  798. RELEASE_LOCK(&((pElan)->MacTableLock))
  799. #endif
  800. /*++
  801. VOID
  802. RELEASE_ELAN_MAC_TABLE_LOCK_DPC(
  803. IN PATMLANE_ELAN pElan
  804. )
  805. --*/
  806. #if DEBUG_SPIN_LOCK
  807. #define RELEASE_ELAN_MAC_TABLE_LOCK_DPC(pElan) \
  808. RELEASE_LOCK_DPC(&((pElan)->MacTableLock), "mactable")
  809. #else
  810. #define RELEASE_ELAN_MAC_TABLE_LOCK_DPC(pElan) \
  811. RELEASE_LOCK_DPC(&((pElan)->MacTableLock))
  812. #endif
  813. /*++
  814. VOID
  815. FREE_ELAN_MAC_TABLE_LOCK(
  816. IN PATMLANE_ELAN pElan
  817. )
  818. --*/
  819. #if DEBUG_SPIN_LOCK
  820. #define FREE_ELAN_MAC_TABLE_LOCK(pElan) \
  821. FREE_LOCK(&((pElan)->MacTableLock), "mactable")
  822. #else
  823. #define FREE_ELAN_MAC_TABLE_LOCK(pElan) \
  824. FREE_LOCK(&((pElan)->MacTableLock))
  825. #endif
  826. // ----------------------------------------------------------------------------
  827. /*++
  828. VOID
  829. INIT_VC_LOCK(
  830. IN PATMLANE_VC pVc
  831. )
  832. --*/
  833. #if DEBUG_SPIN_LOCK
  834. #define INIT_VC_LOCK(pVc) \
  835. INIT_LOCK(&((pVc)->VcLock), "vc")
  836. #else
  837. #define INIT_VC_LOCK(pVc) \
  838. INIT_LOCK(&((pVc)->VcLock))
  839. #endif
  840. /*++
  841. VOID
  842. ACQUIRE_VC_LOCK(
  843. IN PATMLANE_VC pVc
  844. )
  845. --*/
  846. #if DEBUG_SPIN_LOCK
  847. #define ACQUIRE_VC_LOCK(pVc) \
  848. ACQUIRE_LOCK(&((pVc)->VcLock), "vc")
  849. #else
  850. #define ACQUIRE_VC_LOCK(pVc) \
  851. ACQUIRE_LOCK(&((pVc)->VcLock))
  852. #endif
  853. /*++
  854. VOID
  855. ACQUIRE_VC_LOCK_DPC(
  856. IN PATMLANE_VC pVc
  857. )
  858. --*/
  859. #if DEBUG_SPIN_LOCK
  860. #define ACQUIRE_VC_LOCK_DPC(pVc) \
  861. ACQUIRE_LOCK_DPC(&((pVc)->VcLock), "vc")
  862. #else
  863. #define ACQUIRE_VC_LOCK_DPC(pVc) \
  864. ACQUIRE_LOCK_DPC(&((pVc)->VcLock))
  865. #endif
  866. /*++
  867. VOID
  868. RELEASE_VC_LOCK(
  869. IN PATMLANE_VC pVc
  870. )
  871. --*/
  872. #if DEBUG_SPIN_LOCK
  873. #define RELEASE_VC_LOCK(pVc) \
  874. RELEASE_LOCK(&((pVc)->VcLock), "vc")
  875. #else
  876. #define RELEASE_VC_LOCK(pVc) \
  877. RELEASE_LOCK(&((pVc)->VcLock))
  878. #endif
  879. /*++
  880. VOID
  881. RELEASE_VC_LOCK_DPC(
  882. IN PATMLANE_VC pVc
  883. )
  884. --*/
  885. #if DEBUG_SPIN_LOCK
  886. #define RELEASE_VC_LOCK_DPC(pVc) \
  887. RELEASE_LOCK_DPC(&((pVc)->VcLock), "vc")
  888. #else
  889. #define RELEASE_VC_LOCK_DPC(pVc) \
  890. RELEASE_LOCK_DPC(&((pVc)->VcLock))
  891. #endif
  892. /*++
  893. VOID
  894. FREE_VC_LOCK(
  895. IN PATMLANE_VC pVc
  896. )
  897. --*/
  898. #if DEBUG_SPIN_LOCK
  899. #define FREE_VC_LOCK(pVc) \
  900. FREE_LOCK(&((pVc)->VcLock), "vc")
  901. #else
  902. #define FREE_VC_LOCK(pVc) \
  903. FREE_LOCK(&((pVc)->VcLock))
  904. #endif
  905. // ----------------------------------------------------------------------------
  906. /*++
  907. VOID
  908. INIT_SENDPACKET_LOCK(
  909. IN PNDIS_PACKET pPkt
  910. )
  911. --*/
  912. #if DEBUG_SPIN_LOCK
  913. #define INIT_SENDPACKET_LOCK(pPkt) \
  914. INIT_LOCK(&(PSEND_RSVD(pPkt)->Lock), "packet")
  915. #else
  916. #define INIT_SENDPACKET_LOCK(pPkt) \
  917. INIT_LOCK(&(PSEND_RSVD(pPkt)->Lock))
  918. #endif
  919. /*++
  920. VOID
  921. ACQUIRE_SENDPACKET_LOCK(
  922. IN PNDIS_PACKET pPkt
  923. )
  924. --*/
  925. #if DEBUG_SPIN_LOCK
  926. #define ACQUIRE_SENDPACKET_LOCK(pPkt) \
  927. ACQUIRE_LOCK(&(PSEND_RSVD(pPkt)->Lock), "packet")
  928. #else
  929. #define ACQUIRE_SENDPACKET_LOCK(pPkt) \
  930. ACQUIRE_LOCK(&(PSEND_RSVD(pPkt)->Lock))
  931. #endif
  932. /*++
  933. VOID
  934. RELEASE_SENDPACKET_LOCK(
  935. IN PNDIS_PACKET pPkt
  936. )
  937. --*/
  938. #if DEBUG_SPIN_LOCK
  939. #define RELEASE_SENDPACKET_LOCK(pPkt) \
  940. RELEASE_LOCK(&(PSEND_RSVD(pPkt)->Lock), "packet")
  941. #else
  942. #define RELEASE_SENDPACKET_LOCK(pPkt) \
  943. RELEASE_LOCK(&(PSEND_RSVD(pPkt)->Lock))
  944. #endif
  945. /*++
  946. VOID
  947. FREE_SENDPACKET_LOCK(
  948. IN PNDIS_PACKET pPkt
  949. )
  950. --*/
  951. #if DEBUG_SPIN_LOCK
  952. #define FREE_SENDPACKET_LOCK(pPkt) \
  953. FREE_LOCK(&(PSEND_RSVD(pPkt)->Lock), "packet")
  954. #else
  955. #define FREE_SENDPACKET_LOCK(pPkt) \
  956. FREE_LOCK(&(PSEND_RSVD(pPkt)->Lock))
  957. #endif
  958. // ----------------------------------------------------------------------------
  959. /*++
  960. VOID
  961. INIT_GLOBAL_LOCK(
  962. IN PATMLANE_GLOBALS pGlob
  963. )
  964. --*/
  965. #if DEBUG_SPIN_LOCK
  966. #define INIT_GLOBAL_LOCK(pGlob) \
  967. INIT_LOCK(&((pGlob)->GlobalLock), "global")
  968. #else
  969. #define INIT_GLOBAL_LOCK(pGlob) \
  970. INIT_LOCK(&((pGlob)->GlobalLock))
  971. #endif
  972. /*++
  973. VOID
  974. ACQUIRE_GLOBAL_LOCK(
  975. IN PATMLANE_GLOBALS pGlob
  976. )
  977. --*/
  978. #if DEBUG_SPIN_LOCK
  979. #define ACQUIRE_GLOBAL_LOCK(pGlob) \
  980. ACQUIRE_LOCK(&((pGlob)->GlobalLock), "global")
  981. #else
  982. #define ACQUIRE_GLOBAL_LOCK(pGlob) \
  983. ACQUIRE_LOCK(&((pGlob)->GlobalLock))
  984. #endif
  985. /*++
  986. VOID
  987. RELEASE_GLOBAL_LOCK(
  988. IN PATMLANE_GLOBALS pGlob
  989. )
  990. --*/
  991. #if DEBUG_SPIN_LOCK
  992. #define RELEASE_GLOBAL_LOCK(pGlob) \
  993. RELEASE_LOCK(&((pGlob)->GlobalLock), "global")
  994. #else
  995. #define RELEASE_GLOBAL_LOCK(pGlob) \
  996. RELEASE_LOCK(&((pGlob)->GlobalLock))
  997. #endif
  998. /*++
  999. VOID
  1000. FREE_GLOBAL_LOCK(
  1001. IN PATMLANE_GLOBALS pGlob
  1002. )
  1003. --*/
  1004. #if DEBUG_SPIN_LOCK
  1005. #define FREE_GLOBAL_LOCK(pGlob) \
  1006. FREE_LOCK(&((pGlob)->GlobalLock), "global")
  1007. #else
  1008. #define FREE_GLOBAL_LOCK(pGlob) \
  1009. FREE_LOCK(&((pGlob)->GlobalLock))
  1010. #endif
  1011. // ----------------------------------------------------------------------------
  1012. /*++
  1013. VOID *
  1014. ALLOC_MEM(
  1015. OUT PVOID * pPtr,
  1016. IN ULONG SizeInBytes
  1017. )
  1018. --*/
  1019. #define ALLOC_MEM(pPtr, SizeInBytes) \
  1020. *(pPtr) = ExAllocatePoolWithTagPriority(NonPagedPool, SizeInBytes, (ULONG)'ENAL', NormalPoolPriority)
  1021. /*++
  1022. VOID *
  1023. ALLOC_MEM_PRIORITY(
  1024. OUT PVOID * pPtr,
  1025. IN ULONG SizeInBytes,
  1026. IN EX_POOL_PRIORITY _Priority
  1027. )
  1028. --*/
  1029. #define ALLOC_MEM_PRIORITY(pPtr, SizeInBytes, _Priority) \
  1030. *(pPtr) = ExAllocatePoolWithTagPriority(NonPagedPool, SizeInBytes, (ULONG)'ENAL', _Priority)
  1031. /*++
  1032. VOID
  1033. FREE_MEM(
  1034. IN POPAQUE pMem
  1035. )
  1036. --*/
  1037. #define FREE_MEM(pMem) ExFreePool((PVOID)(pMem));
  1038. // ----------------------------------------------------------------------------
  1039. /*++
  1040. VOID
  1041. INIT_SYSTEM_TIMER(
  1042. IN PNDIS_TIMER pTimer,
  1043. IN PNDIS_TIMER_FUNCTON pFunc,
  1044. IN PVOID Context
  1045. )
  1046. --*/
  1047. #define INIT_SYSTEM_TIMER(pTimer, pFunc, Context) \
  1048. NdisInitializeTimer(pTimer, (PNDIS_TIMER_FUNCTION)(pFunc), (PVOID)Context)
  1049. /*++
  1050. VOID
  1051. START_SYSTEM_TIMER(
  1052. IN PNDIS_TIMER pTimer,
  1053. IN UINT PeriodInSeconds
  1054. )
  1055. --*/
  1056. #define START_SYSTEM_TIMER(pTimer, PeriodInSeconds) \
  1057. NdisSetTimer(pTimer, (UINT)(PeriodInSeconds * 1000))
  1058. /*++
  1059. VOID
  1060. STOP_SYSTEM_TIMER(
  1061. IN PNDIS_TIMER pTimer
  1062. )
  1063. --*/
  1064. #define STOP_SYSTEM_TIMER(pTimer) \
  1065. { \
  1066. BOOLEAN WasCancelled; \
  1067. NdisCancelTimer(pTimer, &WasCancelled); \
  1068. }
  1069. /*++
  1070. BOOLEAN
  1071. IS_TIMER_ACTIVE(
  1072. IN PATMLANE_TIMER pArpTimer
  1073. )
  1074. --*/
  1075. #define IS_TIMER_ACTIVE(pTmr) ((pTmr)->pTimerList != (PATMLANE_TIMER_LIST)NULL)
  1076. // ----------------------------------------------------------------------------
  1077. /*++
  1078. ULONG
  1079. SECONDS_TO_LONG_TICKS(
  1080. IN ULONG Seconds
  1081. )
  1082. Convert from seconds to "long duration timer ticks"
  1083. --*/
  1084. #define SECONDS_TO_LONG_TICKS(Seconds) ((Seconds)/10)
  1085. /*++
  1086. ULONG
  1087. SECONDS_TO_SHORT_TICKS(
  1088. IN ULONG Seconds
  1089. )
  1090. Convert from seconds to "short duration timer ticks"
  1091. --*/
  1092. #define SECONDS_TO_SHORT_TICKS(Seconds) (Seconds)
  1093. // ----------------------------------------------------------------------------
  1094. /*++
  1095. VOID
  1096. SET_NEXT_PACKET(
  1097. IN PNDIS_PACKET pNdisPacket,
  1098. IN PNDIS_PACKET pNextPacket
  1099. )
  1100. --*/
  1101. #define SET_NEXT_PACKET(pPkt, pNext) \
  1102. ((PSEND_PACKET_RESERVED)((pPkt)->ProtocolReserved))->pNextNdisPacket = pNext;
  1103. /*++
  1104. PNDIS_PACKET
  1105. GET_NEXT_PACKET(
  1106. IN PNDIS_PACKET pNdisPacket
  1107. )
  1108. --*/
  1109. #define GET_NEXT_PACKET(pPkt) \
  1110. ((PSEND_PACKET_RESERVED)((pPkt)->ProtocolReserved))->pNextNdisPacket
  1111. // ----------------------------------------------------------------------------
  1112. /*++
  1113. ULONG
  1114. CELLS_TO_BYTES(
  1115. IN ULONG NumberOfCells
  1116. )
  1117. Convert from cell count to byte count
  1118. --*/
  1119. #define CELLS_TO_BYTES(NumberOfCells) ((NumberOfCells) * 48)
  1120. /*++
  1121. ULONG
  1122. BYTES_TO_CELLS(
  1123. IN ULONG ByteCount
  1124. )
  1125. Convert from byte count to cell count
  1126. --*/
  1127. #define BYTES_TO_CELLS(ByteCount) ((ByteCount) / 48)
  1128. /*++
  1129. ULONG
  1130. LINKSPEED_TO_CPS(
  1131. IN ULONG LinkSpeed
  1132. )
  1133. Convert from NDIS "Link Speed" to cells per second
  1134. --*/
  1135. #define LINKSPEED_TO_CPS(_LinkSpeed) (((_LinkSpeed)*100)/(48*8))
  1136. // ----------------------------------------------------------------------------
  1137. /*++
  1138. ULONG
  1139. SWAPULONG(
  1140. IN ULONG Val
  1141. )
  1142. --*/
  1143. #define SWAPULONG(Val) \
  1144. ((((Val)&0xff)<<24)|(((Val)&0xff00)<<8)| \
  1145. (((Val)&0xff0000)>>8)|(((Val)&0xff000000)>>24))
  1146. /*++
  1147. USHORT
  1148. SWAPUSHORT(
  1149. IN USHORT Val
  1150. )
  1151. --*/
  1152. #define SWAPUSHORT(Val) \
  1153. ((((Val) & 0xff) << 8) | (((Val) & 0xff00) >> 8))
  1154. // ----------------------------------------------------------------------------
  1155. /*++
  1156. BOOLEAN
  1157. ATM_ADDR_EQUAL(
  1158. IN PUCHAR Addr1,
  1159. IN PUCHAR Addr2
  1160. )
  1161. --*/
  1162. #define ATM_ADDR_EQUAL(_Addr1, _Addr2) \
  1163. NdisEqualMemory((_Addr1), (_Addr2), ATM_ADDRESS_LENGTH)
  1164. /*++
  1165. BOOLEAN
  1166. ETH_ADDR_MULTICAST(
  1167. IN PUCHAR Addr,
  1168. )
  1169. --*/
  1170. #define ETH_ADDR_MULTICAST(_Addr) ((_Addr)[0]&1)
  1171. /*++
  1172. BOOLEAN
  1173. TR_ADDR_MULTICAST(
  1174. IN PUCHAR Addr,
  1175. )
  1176. --*/
  1177. #define TR_ADDR_MULTICAST(_Addr) ((_Addr)[0]&0x80)
  1178. // ----------------------------------------------------------------------------
  1179. #endif // __ATMLANE_MACROS_H