2 * eth1394.h -- Ethernet driver for Linux IEEE-1394 Subsystem
4 * Copyright (C) 2000 Bonin Franck <boninf@free.fr>
5 * (C) 2001 Ben Collins <bcollins@debian.org>
7 * Mainly based on work by Emanuel Pirker and Andreas E. Bombe
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /* Register for incoming packets. This is 4096 bytes, which supports up to
30 * S3200 (per Table 16-3 of IEEE 1394b-2002). */
31 #define ETHER1394_REGION_ADDR_LEN 4096
32 #define ETHER1394_REGION_ADDR 0xfffff0200000ULL
33 #define ETHER1394_REGION_ADDR_END (ETHER1394_REGION_ADDR + ETHER1394_REGION_ADDR_LEN)
35 /* GASP identifier numbers for IPv4 over IEEE 1394 */
36 #define ETHER1394_GASP_SPECIFIER_ID 0x00005E
37 #define ETHER1394_GASP_SPECIFIER_ID_HI ((ETHER1394_GASP_SPECIFIER_ID >> 8) & 0xffff)
38 #define ETHER1394_GASP_SPECIFIER_ID_LO (ETHER1394_GASP_SPECIFIER_ID & 0xff)
39 #define ETHER1394_GASP_VERSION 1
41 #define ETHER1394_GASP_OVERHEAD (2 * sizeof(quadlet_t)) /* GASP header overhead */
44 #define NODE_SET (ALL_NODES + 1)
46 enum eth1394_bc_states { ETHER1394_BC_CLOSED, ETHER1394_BC_OPENED,
50 struct list_head list; /* partial datagram list per node */
51 unsigned int sz; /* partial datagram list size per node */
52 spinlock_t lock; /* partial datagram lock */
55 /* Private structure for our ethernet driver */
57 struct net_device_stats stats; /* Device stats */
58 struct hpsb_host *host; /* The card for this dev */
59 u16 maxpayload[NODE_SET]; /* Max payload per node */
60 unsigned char sspd[NODE_SET]; /* Max speed per node */
61 u64 fifo[ALL_NODES]; /* FIFO offset per node */
62 u64 eui[ALL_NODES]; /* EUI-64 per node */
63 spinlock_t lock; /* Private lock */
64 int broadcast_channel; /* Async stream Broadcast Channel */
65 enum eth1394_bc_states bc_state; /* broadcast channel state */
66 struct hpsb_iso *iso; /* Async stream recv handle */
67 struct pdg_list pdg[ALL_NODES]; /* partial RX datagram lists */
68 int dgl[NODE_SET]; /* Outgoing datagram label per node */
72 struct hpsb_host *host;
73 struct net_device *dev;
77 /* Define a fake hardware header format for the networking core. Note that
78 * header size cannot exceed 16 bytes as that is the size of the header cache.
79 * Also, we do not need the source address in the header so we omit it and
80 * keep the header to under 16 bytes */
81 #define ETH1394_ALEN (8)
82 #define ETH1394_HLEN (10)
85 unsigned char h_dest[ETH1394_ALEN]; /* destination eth1394 addr */
86 unsigned short h_proto; /* packet type ID field */
87 } __attribute__((packed));
91 typedef enum {ETH1394_GASP, ETH1394_WRREQ} eth1394_tx_type;
94 #include <asm/byteorder.h>
97 #if defined __BIG_ENDIAN_BITFIELD
98 struct eth1394_uf_hdr {
101 u16 ether_type; /* Ethernet packet type */
102 } __attribute__((packed));
103 #elif defined __LITTLE_ENDIAN_BITFIELD
104 struct eth1394_uf_hdr {
108 } __attribute__((packed));
110 #error Unknown bit field type
114 #if defined __BIG_ENDIAN_BITFIELD
115 struct eth1394_ff_hdr {
118 u16 dg_size:12; /* Datagram size */
119 u16 ether_type; /* Ethernet packet type */
120 u16 dgl; /* Datagram label */
122 } __attribute__((packed));
123 #elif defined __LITTLE_ENDIAN_BITFIELD
124 struct eth1394_ff_hdr {
131 } __attribute__((packed));
133 #error Unknown bit field type
136 /* XXX: Subsequent fragments, including last */
137 #if defined __BIG_ENDIAN_BITFIELD
138 struct eth1394_sf_hdr {
141 u16 dg_size:12; /* Datagram size */
143 u16 fg_off:12; /* Fragment offset */
144 u16 dgl; /* Datagram label */
146 } __attribute__((packed));
147 #elif defined __LITTLE_ENDIAN_BITFIELD
148 struct eth1394_sf_hdr {
156 } __attribute__((packed));
158 #error Unknown bit field type
161 #if defined __BIG_ENDIAN_BITFIELD
162 struct eth1394_common_hdr {
165 } __attribute__((packed));
166 #elif defined __LITTLE_ENDIAN_BITFIELD
167 struct eth1394_common_hdr {
170 } __attribute__((packed));
172 #error Unknown bit field type
175 struct eth1394_hdr_words {
183 struct eth1394_common_hdr common;
184 struct eth1394_uf_hdr uf;
185 struct eth1394_ff_hdr ff;
186 struct eth1394_sf_hdr sf;
187 struct eth1394_hdr_words words;
190 /* End of IP1394 headers */
193 #define ETH1394_HDR_LF_UF 0 /* unfragmented */
194 #define ETH1394_HDR_LF_FF 1 /* first fragment */
195 #define ETH1394_HDR_LF_LF 2 /* last fragment */
196 #define ETH1394_HDR_LF_IF 3 /* interior fragment */
198 #define IP1394_HW_ADDR_LEN 16 /* As per RFC */
200 /* Our arp packet (ARPHRD_IEEE1394) */
202 u16 hw_type; /* 0x0018 */
203 u16 proto_type; /* 0x0806 */
204 u8 hw_addr_len; /* 16 */
205 u8 ip_addr_len; /* 4 */
206 u16 opcode; /* ARP Opcode */
207 /* Above is exactly the same format as struct arphdr */
209 u64 s_uniq_id; /* Sender's 64bit EUI */
210 u8 max_rec; /* Sender's max packet size */
211 u8 sspd; /* Sender's max speed */
212 u16 fifo_hi; /* hi 16bits of sender's FIFO addr */
213 u32 fifo_lo; /* lo 32bits of sender's FIFO addr */
214 u32 sip; /* Sender's IP Address */
215 u32 tip; /* IP Address of requested hw addr */
218 /* Network timeout */
219 #define ETHER1394_TIMEOUT 100000
221 /* This is our task struct. It's used for the packet complete callback. */
224 int outstanding_pkts;
225 eth1394_tx_type tx_type;
227 struct hpsb_packet *packet;
228 struct eth1394_priv *priv;
229 union eth1394_hdr hdr;
234 #endif /* __ETH1394_H */