eth_addrtbl.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef _ADDRESS_TABLE_H
  2. #define _ADDRESS_TABLE_H 1
  3. /*
  4. * ----------------------------------------------------------------------------
  5. * addressTable.h - this file has all the declarations of the address table
  6. */
  7. #define _8K_TABLE 0
  8. #define ADDRESS_TABLE_ALIGNMENT 8
  9. #define HASH_DEFAULT_MODE 14
  10. #define HASH_MODE 13
  11. #define HASH_SIZE 12
  12. #define HOP_NUMBER 12
  13. #define MAC_ADDRESS_STRING_SIZE 12
  14. #define MAC_ENTRY_SIZE sizeof(addrTblEntry)
  15. #define MAX_NUMBER_OF_ADDRESSES_TO_STORE 1000
  16. #define PROMISCUOUS_MODE 0
  17. #define SKIP 1<<1
  18. #define SKIP_BIT 1
  19. #define VALID 1
  20. /*
  21. * ----------------------------------------------------------------------------
  22. * XXX_MIKE - potential sign-extension bugs lurk here...
  23. */
  24. #define NIBBLE_SWAPPING_32_BIT(X) ( (((X) & 0xf0f0f0f0) >> 4) \
  25. | (((X) & 0x0f0f0f0f) << 4) )
  26. #define NIBBLE_SWAPPING_16_BIT(X) ( (((X) & 0x0000f0f0) >> 4) \
  27. | (((X) & 0x00000f0f) << 4) )
  28. #define FLIP_4_BITS(X) ( (((X) & 0x01) << 3) | (((X) & 0x002) << 1) \
  29. | (((X) & 0x04) >> 1) | (((X) & 0x008) >> 3) )
  30. #define FLIP_6_BITS(X) ( (((X) & 0x01) << 5) | (((X) & 0x020) >> 5) \
  31. | (((X) & 0x02) << 3) | (((X) & 0x010) >> 3) \
  32. | (((X) & 0x04) << 1) | (((X) & 0x008) >> 1) )
  33. #define FLIP_9_BITS(X) ( (((X) & 0x01) << 8) | (((X) & 0x100) >> 8) \
  34. | (((X) & 0x02) << 6) | (((X) & 0x080) >> 6) \
  35. | (((X) & 0x04) << 4) | (((X) & 0x040) >> 4) \
  36. | ((X) & 0x10) | (((X) & 0x08) << 2) | (((X) & 0x020) >> 2) )
  37. /*
  38. * V: value we're operating on
  39. * O: offset of rightmost bit in field
  40. * W: width of field to shift
  41. * S: distance to shift left
  42. */
  43. #define MASK( fieldWidth ) ((1 << (fieldWidth)) - 1)
  44. #define leftShiftedBitfield( V,O,W,S) (((V) & (MASK(W) << (O))) << (S))
  45. #define rightShiftedBitfield(V,O,W,S) (((u32)((V) & (MASK(W) << (O)))) >> (S))
  46. /*
  47. * Push to main memory all cache lines associated with
  48. * the specified range of virtual memory addresses
  49. *
  50. * A: Address of first byte in range to flush
  51. * N: Number of bytes to flush
  52. * Note - flush_dcache_range() does a "sync", does NOT invalidate
  53. */
  54. #define DCACHE_FLUSH_N_SYNC( A, N ) flush_dcache_range( (A), ((A)+(N)) )
  55. typedef struct addressTableEntryStruct {
  56. u32 hi;
  57. u32 lo;
  58. } addrTblEntry;
  59. u32
  60. uncachedPages( u32 pages );
  61. u32
  62. hashTableFunction( u32 macH, u32 macL, u32 HashSize, u32 hash_mode );
  63. unsigned int
  64. initAddressTable( u32 port, u32 hashMode, u32 hashSize );
  65. int
  66. addAddressTableEntry( u32 port, u32 macH, u32 macL, u32 rd, u32 skip );
  67. #endif /* #ifndef _ADDRESS_TABLE_H */