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.
27 #include <linux/netdevice.h>
28 #include <linux/skbuff.h>
29 #include <asm/byteorder.h>
32 #include "ieee1394_types.h"
34 /* Register for incoming packets. This is 4096 bytes, which supports up to
35 * S3200 (per Table 16-3 of IEEE 1394b-2002). */
36 #define ETHER1394_REGION_ADDR_LEN 4096
38 /* GASP identifier numbers for IPv4 over IEEE 1394 */
39 #define ETHER1394_GASP_SPECIFIER_ID 0x00005E
40 #define ETHER1394_GASP_SPECIFIER_ID_HI ((0x00005E >> 8) & 0xffff)
41 #define ETHER1394_GASP_SPECIFIER_ID_LO (0x00005E & 0xff)
42 #define ETHER1394_GASP_VERSION 1
44 #define ETHER1394_GASP_OVERHEAD (2 * sizeof(quadlet_t)) /* for GASP header */
46 #define ETHER1394_GASP_BUFFERS 16
48 #define NODE_SET (ALL_NODES + 1) /* Node set == 64 */
50 enum eth1394_bc_states
{ ETHER1394_BC_ERROR
,
52 ETHER1394_BC_STOPPED
};
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 bc_maxpayload
; /* Max broadcast payload */
60 u8 bc_sspd
; /* Max broadcast speed */
61 u64 local_fifo
; /* Local FIFO Address */
62 spinlock_t lock
; /* Private lock */
63 int broadcast_channel
; /* Async stream Broadcast Channel */
64 enum eth1394_bc_states bc_state
; /* broadcast channel state */
65 struct hpsb_iso
*iso
; /* Async stream recv handle */
66 int bc_dgl
; /* Outgoing broadcast datagram label */
67 struct list_head ip_node_list
; /* List of IP capable nodes */
68 struct unit_directory
*ud_list
[ALL_NODES
]; /* Cached unit dir list */
72 /* Define a fake hardware header format for the networking core. Note that
73 * header size cannot exceed 16 bytes as that is the size of the header cache.
74 * Also, we do not need the source address in the header so we omit it and
75 * keep the header to under 16 bytes */
76 #define ETH1394_ALEN (8)
77 #define ETH1394_HLEN (10)
80 unsigned char h_dest
[ETH1394_ALEN
]; /* destination eth1394 addr */
81 unsigned short h_proto
; /* packet type ID field */
82 } __attribute__((packed
));
84 static inline struct eth1394hdr
*eth1394_hdr(const struct sk_buff
*skb
)
86 return (struct eth1394hdr
*)skb_mac_header(skb
);
89 typedef enum {ETH1394_GASP
, ETH1394_WRREQ
} eth1394_tx_type
;
94 #if defined __BIG_ENDIAN_BITFIELD
95 struct eth1394_uf_hdr
{
98 u16 ether_type
; /* Ethernet packet type */
99 } __attribute__((packed
));
100 #elif defined __LITTLE_ENDIAN_BITFIELD
101 struct eth1394_uf_hdr
{
105 } __attribute__((packed
));
107 #error Unknown bit field type
111 #if defined __BIG_ENDIAN_BITFIELD
112 struct eth1394_ff_hdr
{
115 u16 dg_size
:12; /* Datagram size */
116 u16 ether_type
; /* Ethernet packet type */
117 u16 dgl
; /* Datagram label */
119 } __attribute__((packed
));
120 #elif defined __LITTLE_ENDIAN_BITFIELD
121 struct eth1394_ff_hdr
{
128 } __attribute__((packed
));
130 #error Unknown bit field type
133 /* XXX: Subsequent fragments, including last */
134 #if defined __BIG_ENDIAN_BITFIELD
135 struct eth1394_sf_hdr
{
138 u16 dg_size
:12; /* Datagram size */
140 u16 fg_off
:12; /* Fragment offset */
141 u16 dgl
; /* Datagram label */
143 } __attribute__((packed
));
144 #elif defined __LITTLE_ENDIAN_BITFIELD
145 struct eth1394_sf_hdr
{
153 } __attribute__((packed
));
155 #error Unknown bit field type
158 #if defined __BIG_ENDIAN_BITFIELD
159 struct eth1394_common_hdr
{
162 } __attribute__((packed
));
163 #elif defined __LITTLE_ENDIAN_BITFIELD
164 struct eth1394_common_hdr
{
167 } __attribute__((packed
));
169 #error Unknown bit field type
172 struct eth1394_hdr_words
{
180 struct eth1394_common_hdr common
;
181 struct eth1394_uf_hdr uf
;
182 struct eth1394_ff_hdr ff
;
183 struct eth1394_sf_hdr sf
;
184 struct eth1394_hdr_words words
;
187 /* End of IP1394 headers */
190 #define ETH1394_HDR_LF_UF 0 /* unfragmented */
191 #define ETH1394_HDR_LF_FF 1 /* first fragment */
192 #define ETH1394_HDR_LF_LF 2 /* last fragment */
193 #define ETH1394_HDR_LF_IF 3 /* interior fragment */
195 #define IP1394_HW_ADDR_LEN 16 /* As per RFC */
197 /* Our arp packet (ARPHRD_IEEE1394) */
199 u16 hw_type
; /* 0x0018 */
200 u16 proto_type
; /* 0x0806 */
201 u8 hw_addr_len
; /* 16 */
202 u8 ip_addr_len
; /* 4 */
203 u16 opcode
; /* ARP Opcode */
204 /* Above is exactly the same format as struct arphdr */
206 u64 s_uniq_id
; /* Sender's 64bit EUI */
207 u8 max_rec
; /* Sender's max packet size */
208 u8 sspd
; /* Sender's max speed */
209 u16 fifo_hi
; /* hi 16bits of sender's FIFO addr */
210 u32 fifo_lo
; /* lo 32bits of sender's FIFO addr */
211 u32 sip
; /* Sender's IP Address */
212 u32 tip
; /* IP Address of requested hw addr */
215 /* Network timeout */
216 #define ETHER1394_TIMEOUT 100000
218 /* This is our task struct. It's used for the packet complete callback. */
221 int outstanding_pkts
;
222 eth1394_tx_type tx_type
;
224 struct hpsb_packet
*packet
;
225 struct eth1394_priv
*priv
;
226 union eth1394_hdr hdr
;
231 #endif /* __ETH1394_H */