Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright 2008-2017 Cisco Systems, Inc. All rights reserved. 3 : : * Copyright 2007 Nuova Systems, Inc. All rights reserved. 4 : : */ 5 : : 6 : : #ifndef _RQ_ENET_DESC_H_ 7 : : #define _RQ_ENET_DESC_H_ 8 : : 9 : : #include <rte_byteorder.h> 10 : : 11 : : /* Ethernet receive queue descriptor: 16B */ 12 : : struct rq_enet_desc { 13 : : uint64_t address; 14 : : uint16_t length_type; 15 : : uint8_t reserved[6]; 16 : : }; 17 : : 18 : : enum rq_enet_type_types { 19 : : RQ_ENET_TYPE_ONLY_SOP = 0, 20 : : RQ_ENET_TYPE_NOT_SOP = 1, 21 : : RQ_ENET_TYPE_RESV2 = 2, 22 : : RQ_ENET_TYPE_RESV3 = 3, 23 : : }; 24 : : 25 : : #define RQ_ENET_ADDR_BITS 64 26 : : #define RQ_ENET_LEN_BITS 14 27 : : #define RQ_ENET_LEN_MASK ((1 << RQ_ENET_LEN_BITS) - 1) 28 : : #define RQ_ENET_TYPE_BITS 2 29 : : #define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1) 30 : : 31 : : static inline void rq_enet_desc_enc(volatile struct rq_enet_desc *desc, 32 : : uint64_t address, uint8_t type, uint16_t length) 33 : : { 34 : 0 : desc->address = rte_cpu_to_le_64(address); 35 : 0 : desc->length_type = rte_cpu_to_le_16((length & RQ_ENET_LEN_MASK) | 36 : : ((type & RQ_ENET_TYPE_MASK) << RQ_ENET_LEN_BITS)); 37 : : } 38 : : 39 : : static inline void rq_enet_desc_dec(struct rq_enet_desc *desc, 40 : : uint64_t *address, uint8_t *type, uint16_t *length) 41 : : { 42 : : *address = rte_le_to_cpu_64(desc->address); 43 : : *length = rte_le_to_cpu_16(desc->length_type) & RQ_ENET_LEN_MASK; 44 : : *type = (uint8_t)((rte_le_to_cpu_16(desc->length_type) >> 45 : : RQ_ENET_LEN_BITS) & RQ_ENET_TYPE_MASK); 46 : : } 47 : : 48 : : #endif /* _RQ_ENET_DESC_H_ */