4 * Copyright (C) Cavium networks Ltd. 2016.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Cavium networks nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef __THUNDERX_NICVF_RXTX_H__
34 #define __THUNDERX_NICVF_RXTX_H__
36 #include <rte_ethdev.h>
38 #define NICVF_TX_OFFLOAD_MASK (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK)
41 #define __hot __attribute__((hot))
44 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
45 static inline uint16_t __attribute__((const))
46 nicvf_frag_num(uint16_t i)
48 return (i & ~3) + 3 - (i & 3);
51 static inline void __hot
52 fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt)
54 /* Local variable sqe to avoid read from sq desc memory*/
57 /* Fill the SQ gather entry */
58 sqe.buff[0] = 0; sqe.buff[1] = 0;
59 sqe.gather.subdesc_type = SQ_DESC_TYPE_GATHER;
60 sqe.gather.ld_type = NIC_SEND_LD_TYPE_E_LDT;
61 sqe.gather.size = pkt->data_len;
62 sqe.gather.addr = rte_mbuf_data_dma_addr(pkt);
64 entry->buff[0] = sqe.buff[0];
65 entry->buff[1] = sqe.buff[1];
70 static inline uint16_t __attribute__((const))
71 nicvf_frag_num(uint16_t i)
76 static inline void __hot
77 fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt)
79 entry->buff[0] = (uint64_t)SQ_DESC_TYPE_GATHER << 60 |
80 (uint64_t)NIC_SEND_LD_TYPE_E_LDT << 58 |
82 entry->buff[1] = rte_mbuf_data_dma_addr(pkt);
86 uint16_t nicvf_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, uint16_t pkts);
87 uint16_t nicvf_xmit_pkts_multiseg(void *txq, struct rte_mbuf **tx_pkts,
90 void nicvf_single_pool_free_xmited_buffers(struct nicvf_txq *sq);
91 void nicvf_multi_pool_free_xmited_buffers(struct nicvf_txq *sq);
93 #endif /* __THUNDERX_NICVF_RXTX_H__ */