2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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
31 #ifndef _NET_FIREWIRE_H_
32 #define _NET_FIREWIRE_H_
34 #define FW_ENCAP_UNFRAG 0
35 #define FW_ENCAP_FIRST 1
36 #define FW_ENCAP_LAST 2
37 #define FW_ENCAP_NEXT 3
42 #if BYTE_ORDER == BIG_ENDIAN
44 uint32_t reserved :14;
45 uint32_t ether_type :16;
47 uint32_t ether_type :16;
48 uint32_t reserved :14;
53 #if BYTE_ORDER == BIG_ENDIAN
55 uint32_t reserved1 :2;
56 uint32_t datagram_size :12;
57 uint32_t ether_type :16;
59 uint32_t reserved2 :16;
61 uint32_t ether_type :16;
62 uint32_t datagram_size :12;
63 uint32_t reserved1 :2;
65 uint32_t reserved2 :16;
70 #if BYTE_ORDER == BIG_ENDIAN
72 uint32_t reserved1 :2;
73 uint32_t datagram_size :12;
74 uint32_t reserved2 :4;
75 uint32_t fragment_offset :12;
77 uint32_t reserved3 :16;
79 uint32_t fragment_offset :12;
80 uint32_t reserved2 :4;
81 uint32_t datagram_size :12;
82 uint32_t reserved1 :2;
84 uint32_t reserved3 :16;
90 #define MTAG_FIREWIRE 1394
91 #define MTAG_FIREWIRE_HWADDR 0
92 #define MTAG_FIREWIRE_SENDER_EUID 1
95 uint32_t sender_unique_ID_hi;
96 uint32_t sender_unique_ID_lo;
97 uint8_t sender_max_rec;
99 uint16_t sender_unicast_FIFO_hi;
100 uint32_t sender_unicast_FIFO_lo;
104 * BPF wants to see one of these.
107 uint8_t firewire_dhost[8];
108 uint8_t firewire_shost[8];
109 uint16_t firewire_type;
115 * A structure to track the reassembly of a link-level fragmented
119 STAILQ_ENTRY(fw_reass) fr_link;
120 uint32_t fr_id; /* host+dgl */
121 struct mbuf *fr_frags; /* chain of frags */
123 STAILQ_HEAD(fw_reass_list, fw_reass);
126 struct ifnet *fc_ifp;
127 struct fw_hwaddr fc_hwaddr;
128 struct firewire_comm *fc_fc;
129 uint8_t fc_broadcast_channel;
130 uint8_t fc_speed; /* our speed */
131 uint16_t fc_node; /* our nodeid */
132 struct fw_reass_list fc_frags; /* partial datagrams */
134 #define IFP2FWC(ifp) ((struct fw_com *)(ifp)->if_l2com)
136 extern void firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src);
137 extern void firewire_ifattach(struct ifnet *, struct fw_hwaddr *);
138 extern void firewire_ifdetach(struct ifnet *);
139 extern void firewire_busreset(struct ifnet *);
140 extern int firewire_ioctl(struct ifnet *, u_long, caddr_t);
142 #endif /* !_KERNEL */
144 #endif /* !_NET_FIREWIRE_H_ */