Home | History | Annotate | Download | only in phantom
      1 #ifndef _PHANTOM_HW_H
      2 #define _PHANTOM_HW_H
      3 
      4 /*
      5  * Copyright (C) 2008 Michael Brown <mbrown (at) fensystems.co.uk>.
      6  * Copyright (C) 2008 NetXen, Inc.
      7  *
      8  * This program is free software; you can redistribute it and/or
      9  * modify it under the terms of the GNU General Public License as
     10  * published by the Free Software Foundation; either version 2 of the
     11  * License, or any later version.
     12  *
     13  * This program is distributed in the hope that it will be useful, but
     14  * WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16  * General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU General Public License
     19  * along with this program; if not, write to the Free Software
     20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21  */
     22 
     23 FILE_LICENCE ( GPL2_OR_LATER );
     24 
     25 /**
     26  * @file
     27  *
     28  * Phantom hardware definitions
     29  *
     30  */
     31 
     32 /** A Phantom RX descriptor */
     33 struct phantom_rds_pb {
     34 	pseudo_bit_t handle[16];		/**< Reference handle */
     35 	pseudo_bit_t flags[16];			/**< Flags */
     36 	pseudo_bit_t length[32];		/**< Buffer length */
     37 
     38 	/* --------------------------------------------------------------- */
     39 
     40 	pseudo_bit_t dma_addr[64];		/**< Buffer DMA address */
     41 
     42 };
     43 
     44 /** A Phantom RX status descriptor */
     45 struct phantom_sds_pb {
     46 	pseudo_bit_t port[4];			/**< Port number */
     47 	pseudo_bit_t status[4];			/**< Checksum status */
     48 	pseudo_bit_t type[4];			/**< Type */
     49 	pseudo_bit_t total_length[16];		/**< Total packet length */
     50 	pseudo_bit_t handle[16];		/**< Reference handle */
     51 	pseudo_bit_t protocol[4];		/**< Protocol */
     52 	pseudo_bit_t pkt_offset[5];		/**< Offset to packet start */
     53 	pseudo_bit_t desc_cnt[3];		/**< Descriptor count */
     54 	pseudo_bit_t owner[2];			/**< Owner */
     55 	pseudo_bit_t opcode[6];			/**< Opcode */
     56 
     57 	/* --------------------------------------------------------------- */
     58 
     59 	pseudo_bit_t hash_value[32];		/**< RSS hash value */
     60 	pseudo_bit_t hash_type[8];		/**< RSS hash type */
     61 	pseudo_bit_t lro[8];			/**< LRO data */
     62 };
     63 
     64 /** Phantom RX status opcodes */
     65 enum phantom_sds_opcode {
     66 	UNM_SYN_OFFLOAD = 0x03,
     67 	UNM_RXPKT_DESC = 0x04,
     68 };
     69 
     70 /** A Phantom TX descriptor */
     71 struct phantom_tx_cds_pb {
     72 	pseudo_bit_t tcp_hdr_offset[8];		/**< TCP header offset (LSO) */
     73         pseudo_bit_t ip_hdr_offset[8];		/**< IP header offset (LSO) */
     74 	pseudo_bit_t flags[7];			/**< Flags */
     75 	pseudo_bit_t opcode[6];			/**< Opcode */
     76 	pseudo_bit_t hw_rsvd_0[3];		/**< (Reserved) */
     77 	pseudo_bit_t num_buffers[8];		/**< Total number of buffers */
     78 	pseudo_bit_t length[24];		/**< Total length */
     79 
     80 	/* --------------------------------------------------------------- */
     81 
     82 	pseudo_bit_t buffer2_dma_addr[64];	/**< Buffer 2 DMA address */
     83 
     84 	/* --------------------------------------------------------------- */
     85 
     86 	pseudo_bit_t handle[16];		/**< Reference handle (n/a) */
     87 	pseudo_bit_t port_mss[16];		/**< TCP MSS (LSO) */
     88 	pseudo_bit_t port[4];			/**< Port */
     89 	pseudo_bit_t context_id[4];		/**< Context ID */
     90 	pseudo_bit_t total_hdr_length[8];	/**< MAC+IP+TCP header (LSO) */
     91 	pseudo_bit_t conn_id[16];		/**< IPSec connection ID */
     92 
     93 	/* --------------------------------------------------------------- */
     94 
     95 	pseudo_bit_t buffer3_dma_addr[64];	/**< Buffer 3 DMA address */
     96 
     97 	/* --------------------------------------------------------------- */
     98 
     99 	pseudo_bit_t buffer1_dma_addr[64];	/**< Buffer 1 DMA address */
    100 
    101 	/* --------------------------------------------------------------- */
    102 
    103 	pseudo_bit_t buffer1_length[16];	/**< Buffer 1 length */
    104 	pseudo_bit_t buffer2_length[16];	/**< Buffer 2 length */
    105 	pseudo_bit_t buffer3_length[16];	/**< Buffer 3 length */
    106 	pseudo_bit_t buffer4_length[16];	/**< Buffer 4 length */
    107 
    108 	/* --------------------------------------------------------------- */
    109 
    110 	pseudo_bit_t buffer4_dma_addr[64];	/**< Buffer 4 DMA address */
    111 
    112 	/* --------------------------------------------------------------- */
    113 
    114 	pseudo_bit_t hw_rsvd_1[64];		/**< (Reserved) */
    115 };
    116 
    117 /** A Phantom MAC address request body */
    118 struct phantom_nic_request_body_mac_request_pb {
    119 	pseudo_bit_t opcode[8];			/**< Opcode */
    120 	pseudo_bit_t tag[8];			/**< Tag */
    121 	pseudo_bit_t mac_addr_0[8];		/**< MAC address byte 0 */
    122 	pseudo_bit_t mac_addr_1[8];		/**< MAC address byte 1 */
    123 	pseudo_bit_t mac_addr_2[8];		/**< MAC address byte 2 */
    124 	pseudo_bit_t mac_addr_3[8];		/**< MAC address byte 3 */
    125 	pseudo_bit_t mac_addr_4[8];		/**< MAC address byte 4 */
    126 	pseudo_bit_t mac_addr_5[8];		/**< MAC address byte 5 */
    127 };
    128 
    129 /** Phantom MAC request opcodes */
    130 enum phantom_mac_request_opcode {
    131 	UNM_MAC_ADD = 0x01,			/**< Add MAC address */
    132 	UNM_MAC_DEL = 0x02,			/**< Delete MAC address */
    133 };
    134 
    135 /** A Phantom NIC request command descriptor */
    136 struct phantom_nic_request_cds_pb {
    137 	struct {
    138 		pseudo_bit_t dst_minor[18];
    139 		pseudo_bit_t dst_subq[1];
    140 		pseudo_bit_t dst_major[4];
    141 		pseudo_bit_t opcode[6];
    142 		pseudo_bit_t hw_rsvd_0[3];
    143 		pseudo_bit_t msginfo[24];
    144 		pseudo_bit_t hw_rsvd_1[2];
    145 		pseudo_bit_t qmsg_type[6];
    146 	} common;
    147 
    148 	/* --------------------------------------------------------------- */
    149 
    150 	struct {
    151 		pseudo_bit_t opcode[8];
    152 		pseudo_bit_t comp_id [8];
    153 		pseudo_bit_t context_id[16];
    154 		pseudo_bit_t need_completion[1];
    155 		pseudo_bit_t hw_rsvd_0[23];
    156 		pseudo_bit_t sub_opcode[8];
    157 	} header;
    158 
    159 	/* --------------------------------------------------------------- */
    160 
    161 	union {
    162 		struct phantom_nic_request_body_mac_request_pb mac_request;
    163 		pseudo_bit_t padding[384];
    164 	} body;
    165 };
    166 
    167 /** Phantom NIC request opcodes */
    168 enum phantom_nic_request_opcode {
    169 	UNM_MAC_EVENT = 0x01,			/**< Add/delete MAC address */
    170 };
    171 
    172 /** A Phantom command descriptor */
    173 union phantom_cds_pb {
    174 	struct phantom_tx_cds_pb tx;
    175 	struct phantom_nic_request_cds_pb nic_request;
    176 };
    177 
    178 /** Phantom command descriptor opcodes */
    179 enum phantom_cds_opcode {
    180 	UNM_TX_ETHER_PKT = 0x01,		/**< Transmit raw Ethernet */
    181 	UNM_NIC_REQUEST = 0x14,			/**< NIC request */
    182 };
    183 
    184 #endif /* _PHANTOM_HW_H */
    185