xref: /dpdk/drivers/net/intel/ice/ice_dcf_ethdev.h (revision c1d145834f287aa8cf53de914618a7312f2c360e)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4 
5 #ifndef _ICE_DCF_ETHDEV_H_
6 #define _ICE_DCF_ETHDEV_H_
7 
8 #include "base/ice_common.h"
9 #include "base/ice_adminq_cmd.h"
10 #include "base/ice_dcb.h"
11 #include "base/ice_sched.h"
12 
13 #include "ice_ethdev.h"
14 #include "ice_dcf.h"
15 
16 #define ICE_DCF_MAX_RINGS  1
17 #define DCF_NUM_MACADDR_MAX	64
18 #define ICE_DCF_FRAME_SIZE_MAX       9728
19 #define ICE_DCF_VLAN_TAG_SIZE               4
20 #define ICE_DCF_ETH_OVERHEAD \
21 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_DCF_VLAN_TAG_SIZE * 2)
22 #define ICE_DCF_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_DCF_ETH_OVERHEAD)
23 
24 struct ice_dcf_queue {
25 	uint64_t dummy;
26 };
27 
28 struct ice_dcf_repr_info {
29 	struct rte_eth_dev *vf_rep_eth_dev;
30 };
31 
32 struct ice_dcf_adapter {
33 	struct ice_adapter parent; /* Must be first */
34 	struct ice_dcf_hw real_hw;
35 
36 	bool promisc_unicast_enabled;
37 	bool promisc_multicast_enabled;
38 	uint32_t mc_addrs_num;
39 	struct rte_ether_addr mc_addrs[DCF_NUM_MACADDR_MAX];
40 	int num_reprs;
41 	struct ice_dcf_repr_info *repr_infos;
42 };
43 
44 struct ice_dcf_vf_repr_param {
45 	struct rte_eth_dev *dcf_eth_dev;
46 	uint16_t switch_domain_id;
47 	uint16_t vf_id;
48 };
49 
50 struct ice_dcf_vlan {
51 	bool port_vlan_ena;
52 	bool stripping_ena;
53 
54 	uint16_t tpid;
55 	uint16_t vid;
56 };
57 
58 struct ice_dcf_vf_repr {
59 	struct rte_eth_dev *dcf_eth_dev;
60 	struct rte_ether_addr mac_addr;
61 	uint16_t switch_domain_id;
62 	uint16_t vf_id;
63 	bool dcf_valid;
64 
65 	struct ice_dcf_vlan outer_vlan_info; /* DCF always handle outer VLAN */
66 };
67 
68 enum ice_dcf_devrarg {
69 	ICE_DCF_DEVARG_CAP,
70 	ICE_DCF_DEVARG_ACL,
71 };
72 
73 extern const struct rte_tm_ops ice_dcf_tm_ops;
74 void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
75 				 uint8_t *msg, uint16_t msglen);
76 int ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev);
77 void ice_dcf_uninit_parent_adapter(struct rte_eth_dev *eth_dev);
78 
79 int ice_devargs_check(struct rte_devargs *devargs, enum ice_dcf_devrarg devarg_type);
80 int ice_dcf_vf_repr_init(struct rte_eth_dev *vf_rep_eth_dev, void *init_param);
81 int ice_dcf_vf_repr_uninit(struct rte_eth_dev *vf_rep_eth_dev);
82 int ice_dcf_vf_repr_init_vlan(struct rte_eth_dev *vf_rep_eth_dev);
83 void ice_dcf_vf_repr_stop_all(struct ice_dcf_adapter *dcf_adapter);
84 void ice_dcf_vf_repr_notify_all(struct ice_dcf_adapter *dcf_adapter, bool valid);
85 int ice_dcf_handle_vf_repr_close(struct ice_dcf_adapter *dcf_adapter, uint16_t vf_id);
86 bool ice_dcf_adminq_need_retry(struct ice_adapter *ad);
87 
88 #endif /* _ICE_DCF_ETHDEV_H_ */
89