LCOV - code coverage report
Current view: top level - app/test-pmd - macswap_common.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 16 0.0 %
Date: 2025-01-02 22:41:34 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2018 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _MACSWAP_COMMON_H_
       6                 :            : #define _MACSWAP_COMMON_H_
       7                 :            : 
       8                 :            : static inline uint64_t
       9                 :            : ol_flags_init(uint64_t tx_offload)
      10                 :            : {
      11                 :            :         uint64_t ol_flags = 0;
      12                 :            : 
      13                 :            :         ol_flags |= (tx_offload & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) ?
      14                 :          0 :                         RTE_MBUF_F_TX_VLAN : 0;
      15                 :          0 :         ol_flags |= (tx_offload & RTE_ETH_TX_OFFLOAD_QINQ_INSERT) ?
      16                 :          0 :                         RTE_MBUF_F_TX_QINQ : 0;
      17                 :          0 :         ol_flags |= (tx_offload & RTE_ETH_TX_OFFLOAD_MACSEC_INSERT) ?
      18                 :          0 :                         RTE_MBUF_F_TX_MACSEC : 0;
      19                 :            : 
      20                 :            :         return ol_flags;
      21                 :            : }
      22                 :            : 
      23                 :            : static inline void
      24                 :            : vlan_qinq_set(struct rte_mbuf *pkts[], uint16_t nb,
      25                 :            :                 uint64_t ol_flags, uint16_t vlan, uint16_t outer_vlan)
      26                 :            : {
      27                 :            :         int i;
      28                 :            : 
      29                 :          0 :         if (ol_flags & RTE_MBUF_F_TX_VLAN)
      30                 :          0 :                 for (i = 0; i < nb; i++)
      31                 :          0 :                         pkts[i]->vlan_tci = vlan;
      32                 :          0 :         if (ol_flags & RTE_MBUF_F_TX_QINQ)
      33                 :          0 :                 for (i = 0; i < nb; i++)
      34                 :          0 :                         pkts[i]->vlan_tci_outer = outer_vlan;
      35                 :            : }
      36                 :            : 
      37                 :            : static inline void
      38                 :            : mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags)
      39                 :            : {
      40                 :          0 :         mb->ol_flags &= RTE_MBUF_F_INDIRECT | RTE_MBUF_F_EXTERNAL;
      41                 :          0 :         mb->ol_flags |= ol_flags;
      42                 :          0 :         mb->l2_len = sizeof(struct rte_ether_hdr);
      43                 :          0 :         mb->l3_len = sizeof(struct rte_ipv4_hdr);
      44                 :          0 : }
      45                 :            : 
      46                 :            : #endif /* _MACSWAP_COMMON_H_ */

Generated by: LCOV version 1.14