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_indep_data {
41 struct sfc_mae_switch_port_repr_data {
42 efx_pcie_interface_t intf;
47 union sfc_mae_switch_port_data {
48 struct sfc_mae_switch_port_indep_data indep;
49 struct sfc_mae_switch_port_repr_data repr;
52 struct sfc_mae_switch_port_request {
53 enum sfc_mae_switch_port_type type;
54 const efx_mport_sel_t *entity_mportp;
55 const efx_mport_sel_t *ethdev_mportp;
56 uint16_t ethdev_port_id;
57 union sfc_mae_switch_port_data port_data;
60 typedef void (sfc_mae_switch_port_iterator_cb)(
61 enum sfc_mae_switch_port_type type,
62 const efx_mport_sel_t *ethdev_mportp,
63 uint16_t ethdev_port_id,
64 const efx_mport_sel_t *entity_mportp,
65 uint16_t switch_port_id,
66 union sfc_mae_switch_port_data *port_datap,
69 int sfc_mae_switch_ports_iterate(uint16_t switch_domain_id,
70 sfc_mae_switch_port_iterator_cb *cb,
73 int sfc_mae_assign_switch_domain(struct sfc_adapter *sa,
74 uint16_t *switch_domain_id);
76 int sfc_mae_switch_domain_controllers(uint16_t switch_domain_id,
77 const efx_pcie_interface_t **controllers,
78 size_t *nb_controllers);
80 int sfc_mae_switch_domain_map_controllers(uint16_t switch_domain_id,
81 efx_pcie_interface_t *controllers,
82 size_t nb_controllers);
84 int sfc_mae_switch_controller_from_mapping(
85 const efx_pcie_interface_t *controllers,
86 size_t nb_controllers,
87 efx_pcie_interface_t intf,
90 int sfc_mae_switch_domain_get_controller(uint16_t switch_domain_id,
91 efx_pcie_interface_t intf,
94 int sfc_mae_switch_domain_get_intf(uint16_t switch_domain_id,
96 efx_pcie_interface_t *intf);
98 int sfc_mae_assign_switch_port(uint16_t switch_domain_id,
99 const struct sfc_mae_switch_port_request *req,
100 uint16_t *switch_port_id);
102 int sfc_mae_clear_switch_port(uint16_t switch_domain_id,
103 uint16_t switch_port_id);
105 int sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,
106 uint16_t ethdev_port_id,
107 efx_mport_sel_t *mport_sel);
109 int sfc_mae_switch_get_entity_mport(uint16_t switch_domain_id,
110 uint16_t ethdev_port_id,
111 efx_mport_sel_t *mport_sel);
113 int sfc_mae_switch_port_id_by_entity(uint16_t switch_domain_id,
114 const efx_mport_sel_t *entity_mportp,
115 enum sfc_mae_switch_port_type type,
116 uint16_t *switch_port_id);
118 int sfc_mae_get_switch_domain_admin(uint16_t switch_domain_id,
124 #endif /* _SFC_SWITCH_H */