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 /* Register for incoming packets. This is 8192 bytes, which supports up to
28 * 1600mbs. We'll need to change this if that ever becomes "small" :) */
29 #define ETHER1394_REGION_ADDR_LEN 8192
30 #define ETHER1394_REGION_ADDR 0xfffff0200000ULL
31 #define ETHER1394_REGION_ADDR_END (ETHER1394_REGION_ADDR + ETHER1394_REGION_ADDR_LEN)
34 #define NODE_SET (ALL_NODES + 1)
36 /* Private structure for our ethernet driver */
38 struct net_device_stats stats; /* Device stats */
39 struct hpsb_host *host; /* The card for this dev */
40 unsigned char max_rec[NODE_SET];/* Max payload per node */
41 unsigned char sspd[NODE_SET]; /* Max speed per node */
42 u16 fifo_hi[ALL_NODES]; /* 16bit hi fifo offset per node */
43 u32 fifo_lo[ALL_NODES]; /* 32bit lo fifo offset per node */
44 u64 eui[ALL_NODES]; /* EUI-64 per node */
45 spinlock_t lock; /* Private lock */
49 struct list_head list;
50 struct hpsb_host *host;
51 struct net_device *dev;
54 /* This is our task struct. It's used for the packet complete callback. */
56 struct sk_buff *skb; /* Socket buffer we are sending */
57 nodeid_t dest_node; /* Destination of the packet */
58 u64 addr; /* Address */
59 struct hpsb_queue_struct tq; /* The task */
63 #include <asm/byteorder.h>
66 #if defined __BIG_ENDIAN_BITFIELD
67 struct eth1394_uf_hdr {
70 u16 ether_type; /* Ethernet packet type */
71 } __attribute__((packed));
72 #elif defined __LITTLE_ENDIAN_BITFIELD
73 struct eth1394_uf_hdr {
77 } __attribute__((packed));
79 #error Unknown bit field type
83 #if defined __BIG_ENDIAN_BITFIELD
84 struct eth1394_ff_hdr {
87 u16 dg_size:12; /* Datagram size */
88 u16 ether_type; /* Ethernet packet type */
89 u16 dgl; /* Datagram label */
91 } __attribute__((packed));
92 #elif defined __LITTLE_ENDIAN_BITFIELD
93 struct eth1394_ff_hdr {
100 } __attribute__((packed));
102 #error Unknown bit field type
105 /* XXX: Subsequent fragments, including last */
106 #if defined __BIG_ENDIAN_BITFIELD
107 struct eth1394_sf_hdr {
110 u16 dg_size:12; /* Datagram size */
112 u16 fg_off:10; /* Fragment offset */
113 u16 dgl; /* Datagram label */
115 } __attribute__((packed));
116 #elif defined __LITTLE_ENDIAN_BITFIELD
117 struct eth1394_sf_hdr {
125 } __attribute__((packed));
127 #error Unknown bit field type
130 #if defined __BIG_ENDIAN_BITFIELD
131 struct eth1394_common_hdr {
134 } __attribute__((packed));
135 #elif defined __LITTLE_ENDIAN_BITFIELD
136 struct eth1394_common_hdr {
139 } __attribute__((packed));
141 #error Unknown bit field type
144 struct eth1394_hdr_words {
152 struct eth1394_common_hdr common;
153 struct eth1394_uf_hdr uf;
154 struct eth1394_ff_hdr ff;
155 struct eth1394_sf_hdr sf;
156 struct eth1394_hdr_words words;
159 /* End of IP1394 headers */
162 #define ETH1394_HDR_LF_UF 0 /* unfragmented */
163 #define ETH1394_HDR_LF_FF 1 /* first fragment */
164 #define ETH1394_HDR_LF_LF 2 /* last fragment */
165 #define ETH1394_HDR_LF_IF 3 /* interior fragment */
167 #define IP1394_HW_ADDR_LEN 16 /* As per RFC */
169 /* Our arp packet (ARPHRD_IEEE1394) */
171 u16 hw_type; /* 0x0018 */
172 u16 proto_type; /* 0x0806 */
173 u8 hw_addr_len; /* 16 */
174 u8 ip_addr_len; /* 4 */
175 u16 opcode; /* ARP Opcode */
176 /* Above is exactly the same format as struct arphdr */
178 u64 s_uniq_id; /* Sender's 64bit EUI */
179 u8 max_rec; /* Sender's max packet size */
180 u8 sspd; /* Sender's max speed */
181 u16 fifo_hi; /* hi 16bits of sender's FIFO addr */
182 u32 fifo_lo; /* lo 32bits of sender's FIFO addr */
183 u32 sip; /* Sender's IP Address */
184 u32 tip; /* IP Address of requested hw addr */
187 /* Network timeout */
188 #define ETHER1394_TIMEOUT 100000
190 #endif /* __ETH1394_H */