* Return the CSUM_INNER_* equivalent of CSUM_* caps. */
| 2423 | * Return the CSUM_INNER_* equivalent of CSUM_* caps. |
| 2424 | */ |
| 2425 | static uint32_t |
| 2426 | csum_flags_to_inner_flags(uint32_t csum_flags_in, const uint32_t encap) |
| 2427 | { |
| 2428 | uint32_t csum_flags = encap; |
| 2429 | const uint32_t v4 = CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP; |
| 2430 | |
| 2431 | /* |
| 2432 | * csum_flags can request either v4 or v6 offload but not both. |
| 2433 | * tcp_output always sets CSUM_TSO (both CSUM_IP_TSO and CSUM_IP6_TSO) |
| 2434 | * so those bits are no good to detect the IP version. Other bits are |
| 2435 | * always set with CSUM_TSO and we use those to figure out the IP |
| 2436 | * version. |
| 2437 | */ |
| 2438 | if (csum_flags_in & v4) { |
| 2439 | if (csum_flags_in & CSUM_IP) |
| 2440 | csum_flags |= CSUM_INNER_IP; |
| 2441 | if (csum_flags_in & CSUM_IP_UDP) |
| 2442 | csum_flags |= CSUM_INNER_IP_UDP; |
| 2443 | if (csum_flags_in & CSUM_IP_TCP) |
| 2444 | csum_flags |= CSUM_INNER_IP_TCP; |
| 2445 | if (csum_flags_in & CSUM_IP_TSO) |
| 2446 | csum_flags |= CSUM_INNER_IP_TSO; |
| 2447 | } else { |
| 2448 | #ifdef INVARIANTS |
| 2449 | const uint32_t v6 = CSUM_IP6_UDP | CSUM_IP6_TCP; |
| 2450 | |
| 2451 | MPASS((csum_flags_in & v6) != 0); |
| 2452 | #endif |
| 2453 | if (csum_flags_in & CSUM_IP6_UDP) |
| 2454 | csum_flags |= CSUM_INNER_IP6_UDP; |
| 2455 | if (csum_flags_in & CSUM_IP6_TCP) |
| 2456 | csum_flags |= CSUM_INNER_IP6_TCP; |
| 2457 | if (csum_flags_in & CSUM_IP6_TSO) |
| 2458 | csum_flags |= CSUM_INNER_IP6_TSO; |
| 2459 | } |
| 2460 | |
| 2461 | return (csum_flags); |
| 2462 | } |
| 2463 | |
| 2464 | static int |
| 2465 | vxlan_encap4(struct vxlan_softc *sc, const union vxlan_sockaddr *fvxlsa, |
no outgoing calls
no test coverage detected