2018-01-10 09:17:10 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright 2008-2017 Cisco Systems, Inc. All rights reserved.
|
2014-11-25 17:26:42 +00:00
|
|
|
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RQ_ENET_DESC_H_
|
|
|
|
#define _RQ_ENET_DESC_H_
|
|
|
|
|
2020-01-14 00:24:49 +00:00
|
|
|
#include <rte_byteorder.h>
|
|
|
|
|
2014-11-25 17:26:42 +00:00
|
|
|
/* Ethernet receive queue descriptor: 16B */
|
|
|
|
struct rq_enet_desc {
|
2020-01-14 00:24:50 +00:00
|
|
|
uint64_t address;
|
|
|
|
uint16_t length_type;
|
|
|
|
uint8_t reserved[6];
|
2014-11-25 17:26:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum rq_enet_type_types {
|
|
|
|
RQ_ENET_TYPE_ONLY_SOP = 0,
|
|
|
|
RQ_ENET_TYPE_NOT_SOP = 1,
|
|
|
|
RQ_ENET_TYPE_RESV2 = 2,
|
|
|
|
RQ_ENET_TYPE_RESV3 = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define RQ_ENET_ADDR_BITS 64
|
|
|
|
#define RQ_ENET_LEN_BITS 14
|
|
|
|
#define RQ_ENET_LEN_MASK ((1 << RQ_ENET_LEN_BITS) - 1)
|
|
|
|
#define RQ_ENET_TYPE_BITS 2
|
|
|
|
#define RQ_ENET_TYPE_MASK ((1 << RQ_ENET_TYPE_BITS) - 1)
|
|
|
|
|
2016-06-16 19:19:05 +00:00
|
|
|
static inline void rq_enet_desc_enc(volatile struct rq_enet_desc *desc,
|
2020-01-14 00:24:50 +00:00
|
|
|
uint64_t address, uint8_t type, uint16_t length)
|
2014-11-25 17:26:42 +00:00
|
|
|
{
|
2020-01-14 00:24:49 +00:00
|
|
|
desc->address = rte_cpu_to_le_64(address);
|
|
|
|
desc->length_type = rte_cpu_to_le_16((length & RQ_ENET_LEN_MASK) |
|
2014-11-25 17:26:42 +00:00
|
|
|
((type & RQ_ENET_TYPE_MASK) << RQ_ENET_LEN_BITS));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rq_enet_desc_dec(struct rq_enet_desc *desc,
|
2020-01-14 00:24:50 +00:00
|
|
|
uint64_t *address, uint8_t *type, uint16_t *length)
|
2014-11-25 17:26:42 +00:00
|
|
|
{
|
2020-01-14 00:24:49 +00:00
|
|
|
*address = rte_le_to_cpu_64(desc->address);
|
|
|
|
*length = rte_le_to_cpu_16(desc->length_type) & RQ_ENET_LEN_MASK;
|
2020-01-14 00:24:50 +00:00
|
|
|
*type = (uint8_t)((rte_le_to_cpu_16(desc->length_type) >>
|
|
|
|
RQ_ENET_LEN_BITS) & RQ_ENET_TYPE_MASK);
|
2014-11-25 17:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _RQ_ENET_DESC_H_ */
|