PageRenderTime 19ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 1ms

/drivers/staging/et131x/et1310_tx.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 150 lines | 32 code | 15 blank | 103 comment | 0 complexity | 8dc15729380fb994ffc0508b34c9e3a0 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. * Agere Systems Inc.
  3. * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
  4. *
  5. * Copyright © 2005 Agere Systems Inc.
  6. * All rights reserved.
  7. * http://www.agere.com
  8. *
  9. *------------------------------------------------------------------------------
  10. *
  11. * et1310_tx.h - Defines, structs, enums, prototypes, etc. pertaining to data
  12. * transmission.
  13. *
  14. *------------------------------------------------------------------------------
  15. *
  16. * SOFTWARE LICENSE
  17. *
  18. * This software is provided subject to the following terms and conditions,
  19. * which you should read carefully before using the software. Using this
  20. * software indicates your acceptance of these terms and conditions. If you do
  21. * not agree with these terms and conditions, do not use the software.
  22. *
  23. * Copyright © 2005 Agere Systems Inc.
  24. * All rights reserved.
  25. *
  26. * Redistribution and use in source or binary forms, with or without
  27. * modifications, are permitted provided that the following conditions are met:
  28. *
  29. * . Redistributions of source code must retain the above copyright notice, this
  30. * list of conditions and the following Disclaimer as comments in the code as
  31. * well as in the documentation and/or other materials provided with the
  32. * distribution.
  33. *
  34. * . Redistributions in binary form must reproduce the above copyright notice,
  35. * this list of conditions and the following Disclaimer in the documentation
  36. * and/or other materials provided with the distribution.
  37. *
  38. * . Neither the name of Agere Systems Inc. nor the names of the contributors
  39. * may be used to endorse or promote products derived from this software
  40. * without specific prior written permission.
  41. *
  42. * Disclaimer
  43. *
  44. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  45. * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  46. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
  47. * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
  48. * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
  49. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  50. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  51. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  52. * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
  53. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  54. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  55. * DAMAGE.
  56. *
  57. */
  58. #ifndef __ET1310_TX_H__
  59. #define __ET1310_TX_H__
  60. /* Typedefs for Tx Descriptor Ring */
  61. /*
  62. * word 2 of the control bits in the Tx Descriptor ring for the ET-1310
  63. *
  64. * 0-15: length of packet
  65. * 16-27: VLAN tag
  66. * 28: VLAN CFI
  67. * 29-31: VLAN priority
  68. *
  69. * word 3 of the control bits in the Tx Descriptor ring for the ET-1310
  70. *
  71. * 0: last packet in the sequence
  72. * 1: first packet in the sequence
  73. * 2: interrupt the processor when this pkt sent
  74. * 3: Control word - no packet data
  75. * 4: Issue half-duplex backpressure : XON/XOFF
  76. * 5: send pause frame
  77. * 6: Tx frame has error
  78. * 7: append CRC
  79. * 8: MAC override
  80. * 9: pad packet
  81. * 10: Packet is a Huge packet
  82. * 11: append VLAN tag
  83. * 12: IP checksum assist
  84. * 13: TCP checksum assist
  85. * 14: UDP checksum assist
  86. */
  87. /* struct tx_desc represents each descriptor on the ring */
  88. struct tx_desc {
  89. u32 addr_hi;
  90. u32 addr_lo;
  91. u32 len_vlan; /* control words how to xmit the */
  92. u32 flags; /* data (detailed above) */
  93. };
  94. /*
  95. * The status of the Tx DMA engine it sits in free memory, and is pointed to
  96. * by 0x101c / 0x1020. This is a DMA10 type
  97. */
  98. /* TCB (Transmit Control Block: Host Side) */
  99. struct tcb {
  100. struct tcb *next; /* Next entry in ring */
  101. u32 flags; /* Our flags for the packet */
  102. u32 count; /* Used to spot stuck/lost packets */
  103. u32 stale; /* Used to spot stuck/lost packets */
  104. struct sk_buff *skb; /* Network skb we are tied to */
  105. u32 index; /* Ring indexes */
  106. u32 index_start;
  107. };
  108. /* Structure representing our local reference(s) to the ring */
  109. struct tx_ring {
  110. /* TCB (Transmit Control Block) memory and lists */
  111. struct tcb *tcb_ring;
  112. /* List of TCBs that are ready to be used */
  113. struct tcb *tcb_qhead;
  114. struct tcb *tcb_qtail;
  115. /* list of TCBs that are currently being sent. NOTE that access to all
  116. * three of these (including used) are controlled via the
  117. * TCBSendQLock. This lock should be secured prior to incementing /
  118. * decrementing used, or any queue manipulation on send_head /
  119. * tail
  120. */
  121. struct tcb *send_head;
  122. struct tcb *send_tail;
  123. int used;
  124. /* The actual descriptor ring */
  125. struct tx_desc *tx_desc_ring;
  126. dma_addr_t tx_desc_ring_pa;
  127. /* send_idx indicates where we last wrote to in the descriptor ring. */
  128. u32 send_idx;
  129. /* The location of the write-back status block */
  130. u32 *tx_status;
  131. dma_addr_t tx_status_pa;
  132. /* Packets since the last IRQ: used for interrupt coalescing */
  133. int since_irq;
  134. };
  135. #endif /* __ET1310_TX_H__ */