1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 #ifndef _HINIC_PMD_ETHDEV_H_
6 #define _HINIC_PMD_ETHDEV_H_
8 #include <rte_ethdev.h>
9 #include <rte_ethdev_core.h>
11 #include "base/hinic_compat.h"
12 #include "base/hinic_pmd_cfg.h"
14 #define HINIC_DEV_NAME_LEN 32
15 #define HINIC_MAX_RX_QUEUES 64
17 /* mbuf pool for copy invalid mbuf segs */
18 #define HINIC_COPY_MEMPOOL_DEPTH 128
19 #define HINIC_COPY_MBUF_SIZE 4096
21 #define SIZE_8BYTES(size) (ALIGN((u32)(size), 8) >> 3)
23 #define HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev) \
24 ((struct hinic_nic_dev *)(dev)->data->dev_private)
26 #define HINIC_MAX_QUEUE_DEPTH 4096
27 #define HINIC_MIN_QUEUE_DEPTH 128
28 #define HINIC_TXD_ALIGN 1
29 #define HINIC_RXD_ALIGN 1
31 #define HINIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))
32 #define HINIC_VFTA_SIZE (4096 / HINIC_UINT32_BIT_SIZE)
34 enum hinic_dev_status {
41 /* Information about the fdir mode. */
42 struct hinic_hw_fdir_mask {
43 uint32_t src_ipv4_mask;
44 uint32_t dst_ipv4_mask;
45 uint16_t src_port_mask;
46 uint16_t dst_port_mask;
49 /* Flow Director attribute */
50 struct hinic_atr_input {
57 struct hinic_fdir_rule {
58 struct hinic_hw_fdir_mask mask;
59 struct hinic_atr_input hinic_fdir; /* key of fdir filter */
60 uint8_t queue; /* queue assigned when matched */
63 extern const struct rte_flow_ops hinic_flow_ops;
65 /* hinic nic_device */
66 struct hinic_nic_dev {
68 struct hinic_hwdev *hwdev;
69 struct hinic_txq **txqs;
70 struct hinic_rxq **rxqs;
71 struct rte_mempool *cpy_mpool;
79 u8 rx_queue_list[HINIC_MAX_RX_QUEUES];
81 u32 vfta[HINIC_VFTA_SIZE]; /* VLAN bitmap */
83 struct rte_ether_addr default_addr;
84 struct rte_ether_addr *mc_list;
87 struct nic_service_cap nic_cap;
88 u32 rx_mode_status; /* promisc or allmulticast */
89 unsigned long dev_status;
92 char proc_dev_name[HINIC_DEV_NAME_LEN];
93 /* PF0->COS4, PF1->COS5, PF2->COS6, PF3->COS7,
94 * vf: the same with associate pf
99 #endif /* _HINIC_PMD_ETHDEV_H_ */