nicext.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /****************************************************************************
  2. * Copyright(c) 2000-2001 Broadcom Corporation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation.
  7. *
  8. * Name: nicext.h
  9. *
  10. * Description: Broadcom Network Interface Card Extension (NICE) is an
  11. * extension to Linux NET device kernel mode drivers.
  12. * NICE is designed to provide additional functionalities,
  13. * such as receive packet intercept. To support Broadcom NICE,
  14. * the network device driver can be modified by adding an
  15. * device ioctl handler and by indicating receiving packets
  16. * to the NICE receive handler. Broadcom NICE will only be
  17. * enabled by a NICE-aware intermediate driver, such as
  18. * Broadcom Advanced Server Program Driver (BASP). When NICE
  19. * is not enabled, the modified network device drivers
  20. * functions exactly as other non-NICE aware drivers.
  21. *
  22. * Author: Frankie Fan
  23. *
  24. * Created: September 17, 2000
  25. *
  26. ****************************************************************************/
  27. #ifndef _nicext_h_
  28. #define _nicext_h_
  29. /*
  30. * ioctl for NICE
  31. */
  32. #define SIOCNICE SIOCDEVPRIVATE+7
  33. /*
  34. * SIOCNICE:
  35. *
  36. * The following structure needs to be less than IFNAMSIZ (16 bytes) because
  37. * we're overloading ifreq.ifr_ifru.
  38. *
  39. * If 16 bytes is not enough, we should consider relaxing this because
  40. * this is no field after ifr_ifru in the ifreq structure. But we may
  41. * run into future compatiability problem in case of changing struct ifreq.
  42. */
  43. struct nice_req
  44. {
  45. __u32 cmd;
  46. union
  47. {
  48. #ifdef __KERNEL__
  49. /* cmd = NICE_CMD_SET_RX or NICE_CMD_GET_RX */
  50. struct
  51. {
  52. void (*nrqus1_rx)( struct sk_buff*, void* );
  53. void* nrqus1_ctx;
  54. } nrqu_nrqus1;
  55. /* cmd = NICE_CMD_QUERY_SUPPORT */
  56. struct
  57. {
  58. __u32 nrqus2_magic;
  59. __u32 nrqus2_support_rx:1;
  60. __u32 nrqus2_support_vlan:1;
  61. __u32 nrqus2_support_get_speed:1;
  62. } nrqu_nrqus2;
  63. #endif
  64. /* cmd = NICE_CMD_GET_SPEED */
  65. struct
  66. {
  67. unsigned int nrqus3_speed; /* 0 if link is down, */
  68. /* otherwise speed in Mbps */
  69. } nrqu_nrqus3;
  70. /* cmd = NICE_CMD_BLINK_LED */
  71. struct
  72. {
  73. unsigned int nrqus4_blink_time; /* blink duration in seconds */
  74. } nrqu_nrqus4;
  75. } nrq_nrqu;
  76. };
  77. #define nrq_rx nrq_nrqu.nrqu_nrqus1.nrqus1_rx
  78. #define nrq_ctx nrq_nrqu.nrqu_nrqus1.nrqus1_ctx
  79. #define nrq_support_rx nrq_nrqu.nrqu_nrqus2.nrqus2_support_rx
  80. #define nrq_magic nrq_nrqu.nrqu_nrqus2.nrqus2_magic
  81. #define nrq_support_vlan nrq_nrqu.nrqu_nrqus2.nrqus2_support_vlan
  82. #define nrq_support_get_speed nrq_nrqu.nrqu_nrqus2.nrqus2_support_get_speed
  83. #define nrq_speed nrq_nrqu.nrqu_nrqus3.nrqus3_speed
  84. #define nrq_blink_time nrq_nrqu.nrqu_nrqus4.nrqus4_blink_time
  85. /*
  86. * magic constants
  87. */
  88. #define NICE_REQUESTOR_MAGIC 0x4543494E /* NICE in ascii */
  89. #define NICE_DEVICE_MAGIC 0x4E494345 /* ECIN in ascii */
  90. /*
  91. * command field
  92. */
  93. #define NICE_CMD_QUERY_SUPPORT 0x00000001
  94. #define NICE_CMD_SET_RX 0x00000002
  95. #define NICE_CMD_GET_RX 0x00000003
  96. #define NICE_CMD_GET_SPEED 0x00000004
  97. #define NICE_CMD_BLINK_LED 0x00000005
  98. #endif /* _nicext_h_ */