| 1133 | } |
| 1134 | |
| 1135 | static int |
| 1136 | tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) |
| 1137 | { |
| 1138 | struct lro_entry *le; |
| 1139 | struct ether_header *eh; |
| 1140 | #ifdef INET6 |
| 1141 | struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ |
| 1142 | #endif |
| 1143 | #ifdef INET |
| 1144 | struct ip *ip4 = NULL; /* Keep compiler happy. */ |
| 1145 | #endif |
| 1146 | struct tcphdr *th; |
| 1147 | void *l3hdr = NULL; /* Keep compiler happy. */ |
| 1148 | uint32_t *ts_ptr; |
| 1149 | tcp_seq seq; |
| 1150 | int error, ip_len, l; |
| 1151 | uint16_t eh_type, tcp_data_len, need_flush; |
| 1152 | struct lro_head *bucket; |
| 1153 | struct timespec arrv; |
| 1154 | |
| 1155 | /* We expect a contiguous header [eh, ip, tcp]. */ |
| 1156 | if ((m->m_flags & (M_TSTMP_LRO|M_TSTMP)) == 0) { |
| 1157 | /* If no hardware or arrival stamp on the packet add arrival */ |
| 1158 | nanouptime(&arrv); |
| 1159 | m->m_pkthdr.rcv_tstmp = (arrv.tv_sec * 1000000000) + arrv.tv_nsec; |
| 1160 | m->m_flags |= M_TSTMP_LRO; |
| 1161 | } |
| 1162 | eh = mtod(m, struct ether_header *); |
| 1163 | eh_type = ntohs(eh->ether_type); |
| 1164 | switch (eh_type) { |
| 1165 | #ifdef INET6 |
| 1166 | case ETHERTYPE_IPV6: |
| 1167 | { |
| 1168 | CURVNET_SET(lc->ifp->if_vnet); |
| 1169 | if (V_ip6_forwarding != 0) { |
| 1170 | /* XXX-BZ stats but changing lro_ctrl is a problem. */ |
| 1171 | CURVNET_RESTORE(); |
| 1172 | return (TCP_LRO_CANNOT); |
| 1173 | } |
| 1174 | CURVNET_RESTORE(); |
| 1175 | l3hdr = ip6 = (struct ip6_hdr *)(eh + 1); |
| 1176 | error = tcp_lro_rx_ipv6(lc, m, ip6, &th); |
| 1177 | if (error != 0) |
| 1178 | return (error); |
| 1179 | tcp_data_len = ntohs(ip6->ip6_plen); |
| 1180 | ip_len = sizeof(*ip6) + tcp_data_len; |
| 1181 | break; |
| 1182 | } |
| 1183 | #endif |
| 1184 | #ifdef INET |
| 1185 | case ETHERTYPE_IP: |
| 1186 | { |
| 1187 | CURVNET_SET(lc->ifp->if_vnet); |
| 1188 | if (V_ipforwarding != 0) { |
| 1189 | /* XXX-BZ stats but changing lro_ctrl is a problem. */ |
| 1190 | CURVNET_RESTORE(); |
| 1191 | return (TCP_LRO_CANNOT); |
| 1192 | } |
no test coverage detected