* Update LRO packet headers. * The HW LRO feature doesn't update the L3/TCP headers after coalescing the * TCP segments but supply information in CQE to fill it by SW. * * @param padd * The packet address. * @param cqe * Pointer to the completion entry. * @param len * The packet length. */
| 1387 | * The packet length. |
| 1388 | */ |
| 1389 | static inline void |
| 1390 | mlx5_lro_update_hdr(uint8_t *__rte_restrict padd, |
| 1391 | volatile struct mlx5_cqe *__rte_restrict cqe, |
| 1392 | volatile struct mlx5_mini_cqe8 *mcqe, |
| 1393 | struct mlx5_rxq_data *rxq, uint32_t len) |
| 1394 | { |
| 1395 | union { |
| 1396 | struct rte_ether_hdr *eth; |
| 1397 | struct rte_vlan_hdr *vlan; |
| 1398 | struct rte_ipv4_hdr *ipv4; |
| 1399 | struct rte_ipv6_hdr *ipv6; |
| 1400 | struct rte_tcp_hdr *tcp; |
| 1401 | uint8_t *hdr; |
| 1402 | } h = { |
| 1403 | .hdr = padd, |
| 1404 | }; |
| 1405 | uint16_t proto = h.eth->ether_type; |
| 1406 | uint32_t phcsum; |
| 1407 | uint8_t l4_type; |
| 1408 | |
| 1409 | h.eth++; |
| 1410 | while (proto == RTE_BE16(RTE_ETHER_TYPE_VLAN) || |
| 1411 | proto == RTE_BE16(RTE_ETHER_TYPE_QINQ)) { |
| 1412 | proto = h.vlan->eth_proto; |
| 1413 | h.vlan++; |
| 1414 | } |
| 1415 | if (proto == RTE_BE16(RTE_ETHER_TYPE_IPV4)) { |
| 1416 | h.ipv4->time_to_live = cqe->lro_min_ttl; |
| 1417 | h.ipv4->total_length = rte_cpu_to_be_16(len - (h.hdr - padd)); |
| 1418 | h.ipv4->hdr_checksum = 0; |
| 1419 | h.ipv4->hdr_checksum = rte_ipv4_cksum(h.ipv4); |
| 1420 | phcsum = rte_ipv4_phdr_cksum(h.ipv4, 0); |
| 1421 | h.ipv4++; |
| 1422 | } else { |
| 1423 | h.ipv6->hop_limits = cqe->lro_min_ttl; |
| 1424 | h.ipv6->payload_len = rte_cpu_to_be_16(len - (h.hdr - padd) - |
| 1425 | sizeof(*h.ipv6)); |
| 1426 | phcsum = rte_ipv6_phdr_cksum(h.ipv6, 0); |
| 1427 | h.ipv6++; |
| 1428 | } |
| 1429 | if (mcqe == NULL || |
| 1430 | rxq->mcqe_format != MLX5_CQE_RESP_FORMAT_L34H_STRIDX) |
| 1431 | l4_type = (rte_be_to_cpu_16(cqe->hdr_type_etc) & |
| 1432 | MLX5_CQE_L4_TYPE_MASK) >> MLX5_CQE_L4_TYPE_SHIFT; |
| 1433 | else |
| 1434 | l4_type = (rte_be_to_cpu_16(mcqe->hdr_type) & |
| 1435 | MLX5_CQE_L4_TYPE_MASK) >> MLX5_CQE_L4_TYPE_SHIFT; |
| 1436 | mlx5_lro_update_tcp_hdr(h.tcp, cqe, phcsum, l4_type); |
| 1437 | } |
| 1438 | |
| 1439 | void |
| 1440 | mlx5_mprq_buf_free(struct mlx5_mprq_buf *buf) |
nothing calls this directly
no test coverage detected