* Figure out what HW csum a packet wants and return the appropriate control * bits. */
| 678 | * bits. |
| 679 | */ |
| 680 | static u64 hwcsum(enum chip_type chip, const struct rte_mbuf *m) |
| 681 | { |
| 682 | int csum_type; |
| 683 | |
| 684 | if (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { |
| 685 | switch (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) { |
| 686 | case RTE_MBUF_F_TX_TCP_CKSUM: |
| 687 | csum_type = TX_CSUM_TCPIP; |
| 688 | break; |
| 689 | case RTE_MBUF_F_TX_UDP_CKSUM: |
| 690 | csum_type = TX_CSUM_UDPIP; |
| 691 | break; |
| 692 | default: |
| 693 | goto nocsum; |
| 694 | } |
| 695 | } else { |
| 696 | goto nocsum; |
| 697 | } |
| 698 | |
| 699 | if (likely(csum_type >= TX_CSUM_TCPIP)) { |
| 700 | u64 hdr_len = V_TXPKT_IPHDR_LEN(m->l3_len); |
| 701 | int eth_hdr_len = m->l2_len; |
| 702 | |
| 703 | if (CHELSIO_CHIP_VERSION(chip) <= CHELSIO_T5) |
| 704 | hdr_len |= V_TXPKT_ETHHDR_LEN(eth_hdr_len); |
| 705 | else |
| 706 | hdr_len |= V_T6_TXPKT_ETHHDR_LEN(eth_hdr_len); |
| 707 | return V_TXPKT_CSUM_TYPE(csum_type) | hdr_len; |
| 708 | } |
| 709 | nocsum: |
| 710 | /* |
| 711 | * unknown protocol, disable HW csum |
| 712 | * and hope a bad packet is detected |
| 713 | */ |
| 714 | return F_TXPKT_L4CSUM_DIS; |
| 715 | } |
| 716 | |
| 717 | static inline void txq_advance(struct sge_txq *q, unsigned int n) |
| 718 | { |
no outgoing calls
no test coverage detected