#include "sfc_service.h"
static int
-sfc_mae_assign_entity_mport(struct sfc_adapter *sa,
+sfc_mae_assign_ethdev_mport(struct sfc_adapter *sa,
efx_mport_sel_t *mportp)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
mportp);
}
+static int
+sfc_mae_assign_entity_mport(struct sfc_adapter *sa,
+ efx_mport_sel_t *mportp)
+{
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+ int rc = 0;
+
+ if (encp->enc_mae_admin) {
+ /*
+ * This ethdev sits on MAE admin PF. The represented
+ * entity is the network port assigned to that PF.
+ */
+ rc = efx_mae_mport_by_phy_port(encp->enc_assigned_port, mportp);
+ } else {
+ /*
+ * This ethdev sits on unprivileged PF / VF. The entity
+ * represented by the ethdev can change dynamically
+ * as MAE admin changes default traffic rules.
+ *
+ * For the sake of simplicity, do not fill in the m-port
+ * and assume that flow rules should not be allowed to
+ * reference the entity represented by this ethdev.
+ */
+ efx_mae_mport_invalid(mportp);
+ }
+
+ return rc;
+}
+
static int
sfc_mae_counter_registry_init(struct sfc_mae_counter_registry *registry,
uint32_t nb_counters_max)
struct sfc_adapter_shared * const sas = sfc_sa2shared(sa);
struct sfc_mae_switch_port_request switch_port_request = {0};
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+ efx_mport_sel_t ethdev_mport;
efx_mport_sel_t entity_mport;
struct sfc_mae *mae = &sa->mae;
struct sfc_mae_bounce_eh *bounce_eh = &mae->bounce_eh;
}
}
+ sfc_log_init(sa, "assign ethdev MPORT");
+ rc = sfc_mae_assign_ethdev_mport(sa, ðdev_mport);
+ if (rc != 0)
+ goto fail_mae_assign_ethdev_mport;
+
sfc_log_init(sa, "assign entity MPORT");
rc = sfc_mae_assign_entity_mport(sa, &entity_mport);
if (rc != 0)
sfc_log_init(sa, "assign RTE switch port");
switch_port_request.type = SFC_MAE_SWITCH_PORT_INDEPENDENT;
+ switch_port_request.ethdev_mportp = ðdev_mport;
switch_port_request.entity_mportp = &entity_mport;
- /* RTE ethdev MPORT matches that of the entity for independent ports. */
- switch_port_request.ethdev_mportp = &entity_mport;
switch_port_request.ethdev_port_id = sas->port_id;
switch_port_request.port_data.indep.mae_admin =
encp->enc_mae_admin == B_TRUE;
fail_mae_assign_switch_port:
fail_mae_assign_switch_domain:
fail_mae_assign_entity_mport:
+fail_mae_assign_ethdev_mport:
if (encp->enc_mae_admin)
sfc_mae_counter_registry_fini(&mae->counter_registry);