| 78 | }; |
| 79 | |
| 80 | static int |
| 81 | firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, |
| 82 | struct route *ro) |
| 83 | { |
| 84 | struct fw_com *fc = IFP2FWC(ifp); |
| 85 | int error, type; |
| 86 | struct m_tag *mtag; |
| 87 | union fw_encap *enc; |
| 88 | struct fw_hwaddr *destfw; |
| 89 | uint8_t speed; |
| 90 | uint16_t psize, fsize, dsize; |
| 91 | struct mbuf *mtail; |
| 92 | int unicast, dgl, foff; |
| 93 | static int next_dgl; |
| 94 | #if defined(INET) || defined(INET6) |
| 95 | int is_gw = 0; |
| 96 | #endif |
| 97 | |
| 98 | #ifdef MAC |
| 99 | error = mac_ifnet_check_transmit(ifp, m); |
| 100 | if (error) |
| 101 | goto bad; |
| 102 | #endif |
| 103 | |
| 104 | if (!((ifp->if_flags & IFF_UP) && |
| 105 | (ifp->if_drv_flags & IFF_DRV_RUNNING))) { |
| 106 | error = ENETDOWN; |
| 107 | goto bad; |
| 108 | } |
| 109 | |
| 110 | #if defined(INET) || defined(INET6) |
| 111 | if (ro != NULL) |
| 112 | is_gw = (ro->ro_flags & RT_HAS_GW) != 0; |
| 113 | #endif |
| 114 | /* |
| 115 | * For unicast, we make a tag to store the lladdr of the |
| 116 | * destination. This might not be the first time we have seen |
| 117 | * the packet (for instance, the arp code might be trying to |
| 118 | * re-send it after receiving an arp reply) so we only |
| 119 | * allocate a tag if there isn't one there already. For |
| 120 | * multicast, we will eventually use a different tag to store |
| 121 | * the channel number. |
| 122 | */ |
| 123 | unicast = !(m->m_flags & (M_BCAST | M_MCAST)); |
| 124 | if (unicast) { |
| 125 | mtag = m_tag_locate(m, MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, NULL); |
| 126 | if (!mtag) { |
| 127 | mtag = m_tag_alloc(MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, |
| 128 | sizeof (struct fw_hwaddr), M_NOWAIT); |
| 129 | if (!mtag) { |
| 130 | error = ENOMEM; |
| 131 | goto bad; |
| 132 | } |
| 133 | m_tag_prepend(m, mtag); |
| 134 | } |
| 135 | destfw = (struct fw_hwaddr *)(mtag + 1); |
| 136 | } else { |
| 137 | destfw = NULL; |
nothing calls this directly
no test coverage detected