dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
- if (mae->status == SFC_MAE_STATUS_SUPPORTED) {
+ if (mae->status == SFC_MAE_STATUS_SUPPORTED ||
+ mae->status == SFC_MAE_STATUS_ADMIN) {
dev_info->switch_info.name = dev->device->driver->name;
dev_info->switch_info.domain_id = mae->switch_domain_id;
dev_info->switch_info.port_id = mae->switch_port_id;
sfc_adapter_lock(sa);
- if (sa->mae.status != SFC_MAE_STATUS_SUPPORTED) {
+ if (sa->mae.status != SFC_MAE_STATUS_ADMIN) {
sfc_adapter_unlock(sa);
return -ENOTSUP;
}
goto fail_kvargs;
if (switch_mode == NULL) {
- sa->switchdev = encp->enc_mae_supported &&
+ sa->switchdev = encp->enc_mae_admin &&
(!encp->enc_datapath_cap_evb ||
has_representors);
} else if (strcasecmp(switch_mode, SFC_KVARG_SWITCH_MODE_LEGACY) == 0) {
if (rc != 0)
goto fail_attach;
- if (sa->switchdev && sa->mae.status != SFC_MAE_STATUS_SUPPORTED) {
+ if (sa->switchdev && sa->mae.status != SFC_MAE_STATUS_ADMIN) {
sfc_err(sa,
- "failed to enable switchdev mode without MAE support");
+ "failed to enable switchdev mode without admin MAE privilege");
rc = ENOTSUP;
goto fail_switchdev_no_mae;
}
return 0;
}
- sfc_log_init(sa, "init MAE");
- rc = efx_mae_init(sa->nic);
- if (rc != 0)
- goto fail_mae_init;
+ if (encp->enc_mae_admin) {
+ sfc_log_init(sa, "init MAE");
+ rc = efx_mae_init(sa->nic);
+ if (rc != 0)
+ goto fail_mae_init;
- sfc_log_init(sa, "get MAE limits");
- rc = efx_mae_get_limits(sa->nic, &limits);
- if (rc != 0)
- goto fail_mae_get_limits;
+ sfc_log_init(sa, "get MAE limits");
+ rc = efx_mae_get_limits(sa->nic, &limits);
+ if (rc != 0)
+ goto fail_mae_get_limits;
- sfc_log_init(sa, "init MAE counter registry");
- rc = sfc_mae_counter_registry_init(&mae->counter_registry,
- limits.eml_max_n_counters);
- if (rc != 0) {
- sfc_err(sa, "failed to init MAE counters registry for %u entries: %s",
- limits.eml_max_n_counters, rte_strerror(rc));
- goto fail_counter_registry_init;
+ sfc_log_init(sa, "init MAE counter registry");
+ rc = sfc_mae_counter_registry_init(&mae->counter_registry,
+ limits.eml_max_n_counters);
+ if (rc != 0) {
+ sfc_err(sa, "failed to init MAE counters registry for %u entries: %s",
+ limits.eml_max_n_counters, rte_strerror(rc));
+ goto fail_counter_registry_init;
+ }
}
sfc_log_init(sa, "assign entity MPORT");
if (rc != 0)
goto fail_mae_assign_switch_port;
- sfc_log_init(sa, "allocate encap. header bounce buffer");
- bounce_eh->buf_size = limits.eml_encap_header_size_limit;
- bounce_eh->buf = rte_malloc("sfc_mae_bounce_eh",
- bounce_eh->buf_size, 0);
- if (bounce_eh->buf == NULL)
- goto fail_mae_alloc_bounce_eh;
-
- mae->status = SFC_MAE_STATUS_SUPPORTED;
- mae->nb_outer_rule_prios_max = limits.eml_max_n_outer_prios;
- mae->nb_action_rule_prios_max = limits.eml_max_n_action_prios;
- mae->encap_types_supported = limits.eml_encap_types_supported;
+ if (encp->enc_mae_admin) {
+ sfc_log_init(sa, "allocate encap. header bounce buffer");
+ bounce_eh->buf_size = limits.eml_encap_header_size_limit;
+ bounce_eh->buf = rte_malloc("sfc_mae_bounce_eh",
+ bounce_eh->buf_size, 0);
+ if (bounce_eh->buf == NULL)
+ goto fail_mae_alloc_bounce_eh;
+
+ mae->nb_outer_rule_prios_max = limits.eml_max_n_outer_prios;
+ mae->nb_action_rule_prios_max = limits.eml_max_n_action_prios;
+ mae->encap_types_supported = limits.eml_encap_types_supported;
+ }
+
TAILQ_INIT(&mae->outer_rules);
TAILQ_INIT(&mae->encap_headers);
TAILQ_INIT(&mae->action_sets);
+ if (encp->enc_mae_admin)
+ mae->status = SFC_MAE_STATUS_ADMIN;
+ else
+ mae->status = SFC_MAE_STATUS_SUPPORTED;
+
sfc_log_init(sa, "done");
return 0;
fail_mae_assign_switch_port:
fail_mae_assign_switch_domain:
fail_mae_assign_entity_mport:
- sfc_mae_counter_registry_fini(&mae->counter_registry);
+ if (encp->enc_mae_admin)
+ sfc_mae_counter_registry_fini(&mae->counter_registry);
fail_counter_registry_init:
fail_mae_get_limits:
- efx_mae_fini(sa->nic);
+ if (encp->enc_mae_admin)
+ efx_mae_fini(sa->nic);
fail_mae_init:
sfc_log_init(sa, "failed %d", rc);
mae->nb_action_rule_prios_max = 0;
mae->status = SFC_MAE_STATUS_UNKNOWN;
- if (status_prev != SFC_MAE_STATUS_SUPPORTED)
+ if (status_prev != SFC_MAE_STATUS_ADMIN)
return;
rte_free(mae->bounce_eh.buf);
return 0;
}
- if (mae->status != SFC_MAE_STATUS_SUPPORTED) {
+ if (mae->status != SFC_MAE_STATUS_ADMIN) {
rc = ENOTSUP;
- sfc_err(sa, "failed to init switchdev - no MAE support");
+ sfc_err(sa, "failed to init switchdev - no admin MAE privilege");
goto fail_no_mae;
}