2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2004 Doug Rabson
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _NET_FIREWIRE_H_
30 #define _NET_FIREWIRE_H_
32 #define FW_ENCAP_UNFRAG 0
33 #define FW_ENCAP_FIRST 1
34 #define FW_ENCAP_LAST 2
35 #define FW_ENCAP_NEXT 3
40 #if BYTE_ORDER == BIG_ENDIAN
42 uint32_t reserved :14;
43 uint32_t ether_type :16;
45 uint32_t ether_type :16;
46 uint32_t reserved :14;
51 #if BYTE_ORDER == BIG_ENDIAN
53 uint32_t reserved1 :2;
54 uint32_t datagram_size :12;
55 uint32_t ether_type :16;
57 uint32_t reserved2 :16;
59 uint32_t ether_type :16;
60 uint32_t datagram_size :12;
61 uint32_t reserved1 :2;
63 uint32_t reserved2 :16;
68 #if BYTE_ORDER == BIG_ENDIAN
70 uint32_t reserved1 :2;
71 uint32_t datagram_size :12;
72 uint32_t reserved2 :4;
73 uint32_t fragment_offset :12;
75 uint32_t reserved3 :16;
77 uint32_t fragment_offset :12;
78 uint32_t reserved2 :4;
79 uint32_t datagram_size :12;
80 uint32_t reserved1 :2;
82 uint32_t reserved3 :16;
88 #define MTAG_FIREWIRE 1394
89 #define MTAG_FIREWIRE_HWADDR 0
90 #define MTAG_FIREWIRE_SENDER_EUID 1
93 uint32_t sender_unique_ID_hi;
94 uint32_t sender_unique_ID_lo;
95 uint8_t sender_max_rec;
97 uint16_t sender_unicast_FIFO_hi;
98 uint32_t sender_unicast_FIFO_lo;
102 * BPF wants to see one of these.
105 uint8_t firewire_dhost[8];
106 uint8_t firewire_shost[8];
107 uint16_t firewire_type;
113 * A structure to track the reassembly of a link-level fragmented
117 STAILQ_ENTRY(fw_reass) fr_link;
118 uint32_t fr_id; /* host+dgl */
119 struct mbuf *fr_frags; /* chain of frags */
121 STAILQ_HEAD(fw_reass_list, fw_reass);
124 struct ifnet *fc_ifp;
125 struct fw_hwaddr fc_hwaddr;
126 struct firewire_comm *fc_fc;
127 uint8_t fc_broadcast_channel;
128 uint8_t fc_speed; /* our speed */
129 uint16_t fc_node; /* our nodeid */
130 struct fw_reass_list fc_frags; /* partial datagrams */
132 #define IFP2FWC(ifp) ((struct fw_com *)if_getl2com(ifp))
134 extern void firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src);
135 extern void firewire_ifattach(struct ifnet *, struct fw_hwaddr *);
136 extern void firewire_ifdetach(struct ifnet *);
137 extern void firewire_busreset(struct ifnet *);
138 extern int firewire_ioctl(struct ifnet *, u_long, caddr_t);
140 #endif /* !_KERNEL */
142 #endif /* !_NET_FIREWIRE_H_ */