1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2019-2021 Xilinx, Inc.
4 * Copyright(c) 2019 Solarflare Communications Inc.
6 * This software was jointly developed between OKTET Labs (under contract
7 * for Solarflare) and Solarflare Communications, Inc.
23 /** Options for MAE switch port type */
24 enum sfc_mae_switch_port_type {
26 * The switch port is operated by a self-sufficient RTE ethdev
27 * and thus refers to its underlying PCIe function
29 SFC_MAE_SWITCH_PORT_INDEPENDENT = 0,
31 * The switch port is operated by a representor RTE ethdev
32 * and thus refers to the represented PCIe function
34 SFC_MAE_SWITCH_PORT_REPRESENTOR,
37 struct sfc_mae_switch_port_repr_data {
38 efx_pcie_interface_t intf;
43 union sfc_mae_switch_port_data {
44 struct sfc_mae_switch_port_repr_data repr;
47 struct sfc_mae_switch_port_request {
48 enum sfc_mae_switch_port_type type;
49 const efx_mport_sel_t *entity_mportp;
50 const efx_mport_sel_t *ethdev_mportp;
51 uint16_t ethdev_port_id;
52 union sfc_mae_switch_port_data port_data;
55 typedef void (sfc_mae_switch_port_iterator_cb)(
56 enum sfc_mae_switch_port_type type,
57 const efx_mport_sel_t *ethdev_mportp,
58 uint16_t ethdev_port_id,
59 const efx_mport_sel_t *entity_mportp,
60 uint16_t switch_port_id,
61 union sfc_mae_switch_port_data *port_datap,
64 int sfc_mae_switch_ports_iterate(uint16_t switch_domain_id,
65 sfc_mae_switch_port_iterator_cb *cb,
68 int sfc_mae_assign_switch_domain(struct sfc_adapter *sa,
69 uint16_t *switch_domain_id);
71 int sfc_mae_switch_domain_controllers(uint16_t switch_domain_id,
72 const efx_pcie_interface_t **controllers,
73 size_t *nb_controllers);
75 int sfc_mae_switch_domain_map_controllers(uint16_t switch_domain_id,
76 efx_pcie_interface_t *controllers,
77 size_t nb_controllers);
79 int sfc_mae_switch_controller_from_mapping(
80 const efx_pcie_interface_t *controllers,
81 size_t nb_controllers,
82 efx_pcie_interface_t intf,
85 int sfc_mae_switch_domain_get_controller(uint16_t switch_domain_id,
86 efx_pcie_interface_t intf,
89 int sfc_mae_switch_domain_get_intf(uint16_t switch_domain_id,
91 efx_pcie_interface_t *intf);
93 int sfc_mae_assign_switch_port(uint16_t switch_domain_id,
94 const struct sfc_mae_switch_port_request *req,
95 uint16_t *switch_port_id);
97 int sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,
98 uint16_t ethdev_port_id,
99 efx_mport_sel_t *mport_sel);
101 int sfc_mae_switch_port_id_by_entity(uint16_t switch_domain_id,
102 const efx_mport_sel_t *entity_mportp,
103 enum sfc_mae_switch_port_type type,
104 uint16_t *switch_port_id);
109 #endif /* _SFC_SWITCH_H */