| 1980 | } |
| 1981 | |
| 1982 | static efx_rc_t |
| 1983 | sfc_process_mport_journal_entry(struct sfc_mport_journal_ctx *ctx, |
| 1984 | efx_mport_desc_t *mport) |
| 1985 | { |
| 1986 | struct sfc_mae_switch_port_request req; |
| 1987 | efx_mport_sel_t entity_selector; |
| 1988 | efx_mport_sel_t ethdev_mport; |
| 1989 | uint16_t switch_port_id; |
| 1990 | efx_rc_t efx_rc; |
| 1991 | int rc; |
| 1992 | |
| 1993 | sfc_dbg(ctx->sa, |
| 1994 | "processing mport id %u (controller %u pf %u vf %u)", |
| 1995 | mport->emd_id.id, mport->emd_vnic.ev_intf, |
| 1996 | mport->emd_vnic.ev_pf, mport->emd_vnic.ev_vf); |
| 1997 | efx_mae_mport_invalid(ðdev_mport); |
| 1998 | |
| 1999 | if (!ctx->controllers_assigned) { |
| 2000 | rc = sfc_journal_ctx_add_controller(ctx, |
| 2001 | mport->emd_vnic.ev_intf); |
| 2002 | if (rc != 0) |
| 2003 | return rc; |
| 2004 | } |
| 2005 | |
| 2006 | /* Build Mport selector */ |
| 2007 | efx_rc = efx_mae_mport_by_pcie_mh_function(mport->emd_vnic.ev_intf, |
| 2008 | mport->emd_vnic.ev_pf, |
| 2009 | mport->emd_vnic.ev_vf, |
| 2010 | &entity_selector); |
| 2011 | if (efx_rc != 0) { |
| 2012 | sfc_err(ctx->sa, "failed to build entity mport selector for c%upf%uvf%u", |
| 2013 | mport->emd_vnic.ev_intf, |
| 2014 | mport->emd_vnic.ev_pf, |
| 2015 | mport->emd_vnic.ev_vf); |
| 2016 | return efx_rc; |
| 2017 | } |
| 2018 | |
| 2019 | rc = sfc_mae_switch_port_id_by_entity(ctx->switch_domain_id, |
| 2020 | &entity_selector, |
| 2021 | SFC_MAE_SWITCH_PORT_REPRESENTOR, |
| 2022 | &switch_port_id); |
| 2023 | switch (rc) { |
| 2024 | case 0: |
| 2025 | /* Already registered */ |
| 2026 | break; |
| 2027 | case ENOENT: |
| 2028 | /* |
| 2029 | * No representor has been created for this entity. |
| 2030 | * Create a dummy switch registry entry with an invalid ethdev |
| 2031 | * mport selector. When a corresponding representor is created, |
| 2032 | * this entry will be updated. |
| 2033 | */ |
| 2034 | req.type = SFC_MAE_SWITCH_PORT_REPRESENTOR; |
| 2035 | req.entity_mportp = &entity_selector; |
| 2036 | req.ethdev_mportp = ðdev_mport; |
| 2037 | req.ethdev_port_id = RTE_MAX_ETHPORTS; |
| 2038 | req.port_data.repr.intf = mport->emd_vnic.ev_intf; |
| 2039 | req.port_data.repr.pf = mport->emd_vnic.ev_pf; |
no test coverage detected