Lines Matching refs:sa
52 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_fw_version_get() local
57 rc = efx_nic_get_fw_version(sa->nic, &enfi); in sfc_fw_version_get()
94 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_infos_get() local
96 struct sfc_mae *mae = &sa->mae; in sfc_dev_infos_get()
98 sfc_log_init(sa, "entry"); in sfc_dev_infos_get()
105 dev_info->max_vfs = sa->sriov.num_vfs; in sfc_dev_infos_get()
109 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_1000FDX)) in sfc_dev_infos_get()
111 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_10000FDX)) in sfc_dev_infos_get()
113 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_25000FDX)) in sfc_dev_infos_get()
115 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_40000FDX)) in sfc_dev_infos_get()
117 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_50000FDX)) in sfc_dev_infos_get()
119 if (sa->port.phy_adv_cap_mask & (1u << EFX_PHY_CAP_100000FDX)) in sfc_dev_infos_get()
122 dev_info->max_rx_queues = sa->rxq_max; in sfc_dev_infos_get()
123 dev_info->max_tx_queues = sa->txq_max; in sfc_dev_infos_get()
128 dev_info->rx_queue_offload_capa = sfc_rx_get_queue_offload_caps(sa); in sfc_dev_infos_get()
135 dev_info->rx_offload_capa = sfc_rx_get_dev_offload_caps(sa) | in sfc_dev_infos_get()
138 dev_info->tx_queue_offload_capa = sfc_tx_get_queue_offload_caps(sa); in sfc_dev_infos_get()
145 dev_info->tx_offload_capa = sfc_tx_get_dev_offload_caps(sa) | in sfc_dev_infos_get()
161 dev_info->rx_desc_lim.nb_max = sa->rxq_max_entries; in sfc_dev_infos_get()
162 dev_info->rx_desc_lim.nb_min = sa->rxq_min_entries; in sfc_dev_infos_get()
166 dev_info->rx_desc_lim.nb_align = sa->rxq_min_entries; in sfc_dev_infos_get()
169 dev_info->tx_desc_lim.nb_max = sa->txq_max_entries; in sfc_dev_infos_get()
170 dev_info->tx_desc_lim.nb_min = sa->txq_min_entries; in sfc_dev_infos_get()
175 dev_info->tx_desc_lim.nb_align = sa->txq_min_entries; in sfc_dev_infos_get()
208 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_configure() local
211 sfc_log_init(sa, "entry n_rxq=%u n_txq=%u", in sfc_dev_configure()
214 sfc_adapter_lock(sa); in sfc_dev_configure()
215 switch (sa->state) { in sfc_dev_configure()
219 rc = sfc_configure(sa); in sfc_dev_configure()
222 sfc_err(sa, "unexpected adapter state %u to configure", in sfc_dev_configure()
223 sa->state); in sfc_dev_configure()
227 sfc_adapter_unlock(sa); in sfc_dev_configure()
229 sfc_log_init(sa, "done %d", rc); in sfc_dev_configure()
237 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_start() local
240 sfc_log_init(sa, "entry"); in sfc_dev_start()
242 sfc_adapter_lock(sa); in sfc_dev_start()
243 rc = sfc_start(sa); in sfc_dev_start()
244 sfc_adapter_unlock(sa); in sfc_dev_start()
246 sfc_log_init(sa, "done %d", rc); in sfc_dev_start()
254 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_link_update() local
258 sfc_log_init(sa, "entry"); in sfc_dev_link_update()
260 if (sa->state != SFC_ETHDEV_STARTED) { in sfc_dev_link_update()
265 if (efx_port_poll(sa->nic, &link_mode) != 0) in sfc_dev_link_update()
270 sfc_ev_mgmt_qpoll(sa); in sfc_dev_link_update()
276 sfc_notice(sa, "Link status is %s", in sfc_dev_link_update()
285 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_stop() local
287 sfc_log_init(sa, "entry"); in sfc_dev_stop()
289 sfc_adapter_lock(sa); in sfc_dev_stop()
290 sfc_stop(sa); in sfc_dev_stop()
291 sfc_adapter_unlock(sa); in sfc_dev_stop()
293 sfc_log_init(sa, "done"); in sfc_dev_stop()
301 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_set_link_up() local
304 sfc_log_init(sa, "entry"); in sfc_dev_set_link_up()
306 sfc_adapter_lock(sa); in sfc_dev_set_link_up()
307 rc = sfc_start(sa); in sfc_dev_set_link_up()
308 sfc_adapter_unlock(sa); in sfc_dev_set_link_up()
317 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_set_link_down() local
319 sfc_log_init(sa, "entry"); in sfc_dev_set_link_down()
321 sfc_adapter_lock(sa); in sfc_dev_set_link_down()
322 sfc_stop(sa); in sfc_dev_set_link_down()
323 sfc_adapter_unlock(sa); in sfc_dev_set_link_down()
338 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_close() local
340 sfc_log_init(sa, "entry"); in sfc_dev_close()
347 sfc_pre_detach(sa); in sfc_dev_close()
349 sfc_adapter_lock(sa); in sfc_dev_close()
350 switch (sa->state) { in sfc_dev_close()
352 sfc_stop(sa); in sfc_dev_close()
353 SFC_ASSERT(sa->state == SFC_ETHDEV_CONFIGURED); in sfc_dev_close()
356 sfc_close(sa); in sfc_dev_close()
357 SFC_ASSERT(sa->state == SFC_ETHDEV_INITIALIZED); in sfc_dev_close()
362 sfc_err(sa, "unexpected adapter state %u on close", sa->state); in sfc_dev_close()
373 sfc_nic_dma_detach(sa); in sfc_dev_close()
374 sfc_detach(sa); in sfc_dev_close()
375 sfc_unprobe(sa); in sfc_dev_close()
377 sfc_kvargs_cleanup(sa); in sfc_dev_close()
379 sfc_adapter_unlock(sa); in sfc_dev_close()
380 sfc_adapter_lock_fini(sa); in sfc_dev_close()
382 sfc_log_init(sa, "done"); in sfc_dev_close()
385 sa->eth_dev = NULL; in sfc_dev_close()
387 free(sa); in sfc_dev_close()
398 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_filter_set() local
403 sfc_adapter_lock(sa); in sfc_dev_filter_set()
405 port = &sa->port; in sfc_dev_filter_set()
411 if (sfc_sa2shared(sa)->isolated) { in sfc_dev_filter_set()
412 sfc_warn(sa, "isolated mode is active on the port"); in sfc_dev_filter_set()
413 sfc_warn(sa, "the change is to be applied on the next " in sfc_dev_filter_set()
416 } else if ((sa->state == SFC_ETHDEV_STARTED) && in sfc_dev_filter_set()
417 ((rc = sfc_set_rx_mode(sa)) != 0)) { in sfc_dev_filter_set()
419 sfc_warn(sa, "Failed to %s %s mode, rc = %d", in sfc_dev_filter_set()
432 sfc_adapter_unlock(sa); in sfc_dev_filter_set()
479 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_rx_queue_setup() local
485 sfc_log_init(sa, "RxQ=%u nb_rx_desc=%u socket_id=%u", in sfc_rx_queue_setup()
488 sfc_adapter_lock(sa); in sfc_rx_queue_setup()
491 rc = sfc_rx_qinit(sa, sw_index, nb_rx_desc, socket_id, in sfc_rx_queue_setup()
499 sfc_adapter_unlock(sa); in sfc_rx_queue_setup()
504 sfc_adapter_unlock(sa); in sfc_rx_queue_setup()
514 struct sfc_adapter *sa; in sfc_rx_queue_release() local
521 sa = rxq->evq->sa; in sfc_rx_queue_release()
522 sfc_adapter_lock(sa); in sfc_rx_queue_release()
526 sfc_log_init(sa, "RxQ=%u", sw_index); in sfc_rx_queue_release()
528 sfc_rx_qfini(sa, sw_index); in sfc_rx_queue_release()
530 sfc_adapter_unlock(sa); in sfc_rx_queue_release()
539 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_tx_queue_setup() local
544 sfc_log_init(sa, "TxQ = %u, nb_tx_desc = %u, socket_id = %u", in sfc_tx_queue_setup()
547 sfc_adapter_lock(sa); in sfc_tx_queue_setup()
550 rc = sfc_tx_qinit(sa, sw_index, nb_tx_desc, socket_id, tx_conf); in sfc_tx_queue_setup()
557 sfc_adapter_unlock(sa); in sfc_tx_queue_setup()
561 sfc_adapter_unlock(sa); in sfc_tx_queue_setup()
572 struct sfc_adapter *sa; in sfc_tx_queue_release() local
581 sa = txq->evq->sa; in sfc_tx_queue_release()
583 sfc_log_init(sa, "TxQ = %u", sw_index); in sfc_tx_queue_release()
585 sfc_adapter_lock(sa); in sfc_tx_queue_release()
587 sfc_tx_qfini(sa, sw_index); in sfc_tx_queue_release()
589 sfc_adapter_unlock(sa); in sfc_tx_queue_release()
593 sfc_stats_get_dp_rx(struct sfc_adapter *sa, uint64_t *pkts, uint64_t *bytes) in sfc_stats_get_dp_rx() argument
595 struct sfc_adapter_shared *sas = sfc_sa2shared(sa); in sfc_stats_get_dp_rx()
609 sa->sw_stats.reset_rx_pkts[i]; in sfc_stats_get_dp_rx()
611 sa->sw_stats.reset_rx_bytes[i]; in sfc_stats_get_dp_rx()
620 sfc_stats_get_dp_tx(struct sfc_adapter *sa, uint64_t *pkts, uint64_t *bytes) in sfc_stats_get_dp_tx() argument
622 struct sfc_adapter_shared *sas = sfc_sa2shared(sa); in sfc_stats_get_dp_tx()
636 sa->sw_stats.reset_tx_pkts[i]; in sfc_stats_get_dp_tx()
638 sa->sw_stats.reset_tx_bytes[i]; in sfc_stats_get_dp_tx()
675 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_stats_get() local
676 struct sfc_port *port = &sa->port; in sfc_stats_get()
680 sfc_adapter_lock(sa); in sfc_stats_get()
683 sfc_stats_get_dp_rx(sa, &stats->ipackets, &stats->ibytes); in sfc_stats_get()
685 sfc_stats_get_dp_tx(sa, &stats->opackets, &stats->obytes); in sfc_stats_get()
687 ret = sfc_port_update_mac_stats(sa, B_FALSE); in sfc_stats_get()
766 sfc_adapter_unlock(sa); in sfc_stats_get()
774 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_stats_reset() local
775 struct sfc_port *port = &sa->port; in sfc_stats_reset()
778 sfc_adapter_lock(sa); in sfc_stats_reset()
780 if (sa->state != SFC_ETHDEV_STARTED) { in sfc_stats_reset()
786 sfc_adapter_unlock(sa); in sfc_stats_reset()
790 rc = sfc_port_reset_mac_stats(sa); in sfc_stats_reset()
792 sfc_err(sa, "failed to reset statistics (rc = %d)", rc); in sfc_stats_reset()
794 sfc_sw_xstats_reset(sa); in sfc_stats_reset()
796 sfc_adapter_unlock(sa); in sfc_stats_reset()
803 sfc_xstats_get_nb_supported(struct sfc_adapter *sa) in sfc_xstats_get_nb_supported() argument
805 struct sfc_port *port = &sa->port; in sfc_xstats_get_nb_supported()
808 sfc_adapter_lock(sa); in sfc_xstats_get_nb_supported()
810 sfc_sw_xstats_get_nb_supported(sa); in sfc_xstats_get_nb_supported()
811 sfc_adapter_unlock(sa); in sfc_xstats_get_nb_supported()
820 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_xstats_get() local
826 return sfc_xstats_get_nb_supported(sa); in sfc_xstats_get()
828 rc = sfc_port_get_mac_stats(sa, xstats, xstats_count, &nb_written); in sfc_xstats_get()
833 sfc_sw_xstats_get_vals(sa, xstats, xstats_count, &nb_written, in sfc_xstats_get()
844 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_xstats_get_names() local
845 struct sfc_port *port = &sa->port; in sfc_xstats_get_names()
852 return sfc_xstats_get_nb_supported(sa); in sfc_xstats_get_names()
858 efx_mac_stat_name(sa->nic, i), in sfc_xstats_get_names()
866 ret = sfc_sw_xstats_get_names(sa, xstats_names, xstats_count, in sfc_xstats_get_names()
880 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_xstats_get_by_id() local
881 struct sfc_port *port = &sa->port; in sfc_xstats_get_by_id()
896 rc = sfc_port_get_mac_stats_by_id(sa, ids, values, n); in sfc_xstats_get_by_id()
901 sfc_sw_xstats_get_vals_by_id(sa, ids, values, n, &nb_supported); in sfc_xstats_get_by_id()
918 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_xstats_get_names_by_id() local
919 struct sfc_port *port = &sa->port; in sfc_xstats_get_names_by_id()
929 return sfc_xstats_get_nb_supported(sa); in sfc_xstats_get_names_by_id()
938 sfc_adapter_lock(sa); in sfc_xstats_get_names_by_id()
946 efx_mac_stat_name(sa->nic, in sfc_xstats_get_names_by_id()
954 sfc_adapter_unlock(sa); in sfc_xstats_get_names_by_id()
956 ret = sfc_sw_xstats_get_names_by_id(sa, ids, xstats_names, size, in sfc_xstats_get_names_by_id()
975 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_flow_ctrl_get() local
980 sfc_adapter_lock(sa); in sfc_flow_ctrl_get()
982 if (sa->state == SFC_ETHDEV_STARTED) in sfc_flow_ctrl_get()
983 efx_mac_fcntl_get(sa->nic, &wanted_fc, &link_fc); in sfc_flow_ctrl_get()
985 link_fc = sa->port.flow_ctrl; in sfc_flow_ctrl_get()
1001 sfc_err(sa, "%s: unexpected flow control value %#x", in sfc_flow_ctrl_get()
1005 fc_conf->autoneg = sa->port.flow_ctrl_autoneg; in sfc_flow_ctrl_get()
1007 sfc_adapter_unlock(sa); in sfc_flow_ctrl_get()
1015 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_flow_ctrl_set() local
1016 struct sfc_port *port = &sa->port; in sfc_flow_ctrl_set()
1023 sfc_err(sa, "unsupported flow control settings specified"); in sfc_flow_ctrl_set()
1046 sfc_adapter_lock(sa); in sfc_flow_ctrl_set()
1048 if (sa->state == SFC_ETHDEV_STARTED) { in sfc_flow_ctrl_set()
1049 rc = efx_mac_fcntl_set(sa->nic, fcntl, fc_conf->autoneg); in sfc_flow_ctrl_set()
1057 sfc_adapter_unlock(sa); in sfc_flow_ctrl_set()
1062 sfc_adapter_unlock(sa); in sfc_flow_ctrl_set()
1069 sfc_check_scatter_on_all_rx_queues(struct sfc_adapter *sa, size_t pdu) in sfc_check_scatter_on_all_rx_queues() argument
1071 struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); in sfc_check_scatter_on_all_rx_queues()
1072 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); in sfc_check_scatter_on_all_rx_queues()
1084 if (!sfc_rx_check_scatter(pdu, sa->rxq_ctrl[i].buf_size, in sfc_check_scatter_on_all_rx_queues()
1088 sfc_err(sa, "MTU check for RxQ %u failed: %s", i, in sfc_check_scatter_on_all_rx_queues()
1100 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_set_mtu() local
1105 sfc_log_init(sa, "mtu=%u", mtu); in sfc_dev_set_mtu()
1109 sfc_err(sa, "too small MTU %u (PDU size %u less than min %u)", in sfc_dev_set_mtu()
1115 sfc_err(sa, "too big MTU %u (PDU size %u greater than max %u)", in sfc_dev_set_mtu()
1121 sfc_adapter_lock(sa); in sfc_dev_set_mtu()
1123 rc = sfc_check_scatter_on_all_rx_queues(sa, pdu); in sfc_dev_set_mtu()
1127 if (pdu != sa->port.pdu) { in sfc_dev_set_mtu()
1128 if (sa->state == SFC_ETHDEV_STARTED) { in sfc_dev_set_mtu()
1129 sfc_stop(sa); in sfc_dev_set_mtu()
1131 old_pdu = sa->port.pdu; in sfc_dev_set_mtu()
1132 sa->port.pdu = pdu; in sfc_dev_set_mtu()
1133 rc = sfc_start(sa); in sfc_dev_set_mtu()
1137 sa->port.pdu = pdu; in sfc_dev_set_mtu()
1141 sfc_adapter_unlock(sa); in sfc_dev_set_mtu()
1143 sfc_log_init(sa, "done"); in sfc_dev_set_mtu()
1147 sa->port.pdu = old_pdu; in sfc_dev_set_mtu()
1148 if (sfc_start(sa) != 0) in sfc_dev_set_mtu()
1149 sfc_err(sa, "cannot start with neither new (%u) nor old (%u) " in sfc_dev_set_mtu()
1154 sfc_adapter_unlock(sa); in sfc_dev_set_mtu()
1157 sfc_log_init(sa, "failed %d", rc); in sfc_dev_set_mtu()
1164 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_mac_addr_set() local
1165 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); in sfc_mac_addr_set()
1166 struct sfc_port *port = &sa->port; in sfc_mac_addr_set()
1170 sfc_adapter_lock(sa); in sfc_mac_addr_set()
1188 if (sfc_sa2shared(sa)->isolated) { in sfc_mac_addr_set()
1189 sfc_warn(sa, "isolated mode is active on the port"); in sfc_mac_addr_set()
1190 sfc_warn(sa, "will not set MAC address"); in sfc_mac_addr_set()
1194 if (sa->state != SFC_ETHDEV_STARTED) { in sfc_mac_addr_set()
1195 sfc_notice(sa, "the port is not started"); in sfc_mac_addr_set()
1196 sfc_notice(sa, "the new MAC address will be set on port start"); in sfc_mac_addr_set()
1202 rc = efx_mac_addr_set(sa->nic, mac_addr->addr_bytes); in sfc_mac_addr_set()
1204 sfc_err(sa, "cannot set MAC address (rc = %u)", rc); in sfc_mac_addr_set()
1213 rc = sfc_set_rx_mode_unchecked(sa); in sfc_mac_addr_set()
1215 sfc_err(sa, "cannot set filter (rc = %u)", rc); in sfc_mac_addr_set()
1217 (void)efx_mac_addr_set(sa->nic, old_addr->addr_bytes); in sfc_mac_addr_set()
1218 (void)sfc_set_rx_mode_unchecked(sa); in sfc_mac_addr_set()
1221 sfc_warn(sa, "cannot set MAC address with filters installed"); in sfc_mac_addr_set()
1222 sfc_warn(sa, "adapter will be restarted to pick the new MAC"); in sfc_mac_addr_set()
1223 sfc_warn(sa, "(some traffic may be dropped)"); in sfc_mac_addr_set()
1231 sfc_stop(sa); in sfc_mac_addr_set()
1232 rc = sfc_start(sa); in sfc_mac_addr_set()
1234 sfc_err(sa, "cannot restart adapter (rc = %u)", rc); in sfc_mac_addr_set()
1241 sfc_adapter_unlock(sa); in sfc_mac_addr_set()
1252 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_set_mc_addr_list() local
1253 struct sfc_port *port = &sa->port; in sfc_set_mc_addr_list()
1258 if (sfc_sa2shared(sa)->isolated) { in sfc_set_mc_addr_list()
1259 sfc_err(sa, "isolated mode is active on the port"); in sfc_set_mc_addr_list()
1260 sfc_err(sa, "will not set multicast address list"); in sfc_set_mc_addr_list()
1268 sfc_err(sa, "too many multicast addresses: %u > %u", in sfc_set_mc_addr_list()
1281 if (sa->state != SFC_ETHDEV_STARTED) in sfc_set_mc_addr_list()
1284 rc = efx_mac_multicast_list_set(sa->nic, port->mcast_addrs, in sfc_set_mc_addr_list()
1287 sfc_err(sa, "cannot set multicast address list (rc = %u)", rc); in sfc_set_mc_addr_list()
1396 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_rx_queue_start() local
1402 sfc_log_init(sa, "RxQ=%u", ethdev_qid); in sfc_rx_queue_start()
1404 sfc_adapter_lock(sa); in sfc_rx_queue_start()
1407 if (sa->state != SFC_ETHDEV_STARTED) in sfc_rx_queue_start()
1415 rc = sfc_rx_qstart(sa, sw_index); in sfc_rx_queue_start()
1421 sfc_adapter_unlock(sa); in sfc_rx_queue_start()
1428 sfc_adapter_unlock(sa); in sfc_rx_queue_start()
1437 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_rx_queue_stop() local
1442 sfc_log_init(sa, "RxQ=%u", ethdev_qid); in sfc_rx_queue_stop()
1444 sfc_adapter_lock(sa); in sfc_rx_queue_stop()
1447 sfc_rx_qstop(sa, sw_index); in sfc_rx_queue_stop()
1452 sfc_adapter_unlock(sa); in sfc_rx_queue_stop()
1461 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_tx_queue_start() local
1466 sfc_log_init(sa, "TxQ = %u", ethdev_qid); in sfc_tx_queue_start()
1468 sfc_adapter_lock(sa); in sfc_tx_queue_start()
1471 if (sa->state != SFC_ETHDEV_STARTED) in sfc_tx_queue_start()
1479 rc = sfc_tx_qstart(sa, sw_index); in sfc_tx_queue_start()
1485 sfc_adapter_unlock(sa); in sfc_tx_queue_start()
1492 sfc_adapter_unlock(sa); in sfc_tx_queue_start()
1501 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_tx_queue_stop() local
1505 sfc_log_init(sa, "TxQ = %u", ethdev_qid); in sfc_tx_queue_stop()
1507 sfc_adapter_lock(sa); in sfc_tx_queue_stop()
1510 sfc_tx_qstop(sa, sw_index); in sfc_tx_queue_stop()
1515 sfc_adapter_unlock(sa); in sfc_tx_queue_stop()
1542 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_udp_tunnel_op() local
1546 sfc_log_init(sa, "%s udp_port=%u prot_type=%u", in sfc_dev_udp_tunnel_op()
1558 sfc_adapter_lock(sa); in sfc_dev_udp_tunnel_op()
1562 rc = efx_tunnel_config_udp_add(sa->nic, in sfc_dev_udp_tunnel_op()
1567 rc = efx_tunnel_config_udp_remove(sa->nic, in sfc_dev_udp_tunnel_op()
1579 if (sa->state == SFC_ETHDEV_STARTED) { in sfc_dev_udp_tunnel_op()
1580 rc = efx_tunnel_reconfigure(sa->nic); in sfc_dev_udp_tunnel_op()
1595 sfc_adapter_unlock(sa); in sfc_dev_udp_tunnel_op()
1602 (void)efx_tunnel_config_udp_remove(sa->nic, in sfc_dev_udp_tunnel_op()
1607 (void)efx_tunnel_config_udp_add(sa->nic, in sfc_dev_udp_tunnel_op()
1615 sfc_adapter_unlock(sa); in sfc_dev_udp_tunnel_op()
1668 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_rss_hash_update() local
1669 struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; in sfc_dev_rss_hash_update()
1678 if (sfc_sa2shared(sa)->isolated) in sfc_dev_rss_hash_update()
1682 sfc_err(sa, "RSS is not available"); in sfc_dev_rss_hash_update()
1687 sfc_err(sa, "RSS is not configured"); in sfc_dev_rss_hash_update()
1693 sfc_err(sa, "RSS key size is wrong (should be %zu)", in sfc_dev_rss_hash_update()
1698 sfc_adapter_lock(sa); in sfc_dev_rss_hash_update()
1700 rc = sfc_rx_hf_rte_to_efx(sa, rss_conf->rss_hf, &efx_hash_types); in sfc_dev_rss_hash_update()
1709 rc = efx_rx_scale_mode_set(sa->nic, contexts[mode_i], in sfc_dev_rss_hash_update()
1717 if (sa->state == SFC_ETHDEV_STARTED) { in sfc_dev_rss_hash_update()
1719 rc = efx_rx_scale_key_set(sa->nic, in sfc_dev_rss_hash_update()
1733 sfc_adapter_unlock(sa); in sfc_dev_rss_hash_update()
1739 if (efx_rx_scale_key_set(sa->nic, contexts[i], rss->key, in sfc_dev_rss_hash_update()
1741 sfc_err(sa, "failed to restore RSS key"); in sfc_dev_rss_hash_update()
1746 if (efx_rx_scale_mode_set(sa->nic, contexts[i], in sfc_dev_rss_hash_update()
1749 sfc_err(sa, "failed to restore RSS mode"); in sfc_dev_rss_hash_update()
1753 sfc_adapter_unlock(sa); in sfc_dev_rss_hash_update()
1795 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_dev_rss_reta_update() local
1796 struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; in sfc_dev_rss_reta_update()
1802 if (sfc_sa2shared(sa)->isolated) in sfc_dev_rss_reta_update()
1806 sfc_err(sa, "RSS is not available"); in sfc_dev_rss_reta_update()
1811 sfc_err(sa, "RSS is not configured"); in sfc_dev_rss_reta_update()
1816 sfc_err(sa, "RETA size is wrong (should be %u)", in sfc_dev_rss_reta_update()
1825 sfc_adapter_lock(sa); in sfc_dev_rss_reta_update()
1844 if (sa->state == SFC_ETHDEV_STARTED) { in sfc_dev_rss_reta_update()
1845 rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT, in sfc_dev_rss_reta_update()
1855 sfc_adapter_unlock(sa); in sfc_dev_rss_reta_update()
1913 struct sfc_adapter *sa; member
1978 sfc_dbg(ctx->sa, in sfc_process_mport_journal_entry()
1997 sfc_err(ctx->sa, "failed to build entity mport selector for c%upf%uvf%u", in sfc_process_mport_journal_entry()
2030 sfc_err(ctx->sa, in sfc_process_mport_journal_entry()
2040 sfc_err(ctx->sa, "failed to find MAE switch port for c%upf%uvf%u: %s", in sfc_process_mport_journal_entry()
2057 if (ctx == NULL || ctx->sa == NULL) { in sfc_process_mport_journal_cb()
2058 sfc_err(ctx->sa, "received NULL context or SFC adapter"); in sfc_process_mport_journal_cb()
2063 sfc_err(ctx->sa, "actual and expected mport buffer sizes differ"); in sfc_process_mport_journal_cb()
2067 SFC_ASSERT(sfc_adapter_is_locked(ctx->sa)); in sfc_process_mport_journal_cb()
2075 sfc_dbg(ctx->sa, "mport is a zombie, skipping"); in sfc_process_mport_journal_cb()
2079 sfc_dbg(ctx->sa, "mport is not a VNIC, skipping"); in sfc_process_mport_journal_cb()
2083 sfc_dbg(ctx->sa, "mport is not a function, skipping"); in sfc_process_mport_journal_cb()
2087 sfc_dbg(ctx->sa, "mport is this driver instance, skipping"); in sfc_process_mport_journal_cb()
2095 sfc_process_mport_journal(struct sfc_adapter *sa) in sfc_process_mport_journal() argument
2104 ctx.sa = sa; in sfc_process_mport_journal()
2105 ctx.switch_domain_id = sa->mae.switch_domain_id; in sfc_process_mport_journal()
2107 efx_rc = efx_mcdi_get_own_client_handle(sa->nic, &ctx.mcdi_handle); in sfc_process_mport_journal()
2109 sfc_err(sa, "failed to get own MCDI handle"); in sfc_process_mport_journal()
2117 sfc_err(sa, "failed to get controller mapping"); in sfc_process_mport_journal()
2125 efx_rc = efx_mae_read_mport_journal(sa->nic, in sfc_process_mport_journal()
2128 sfc_err(sa, "failed to process MAE mport journal"); in sfc_process_mport_journal()
2164 struct sfc_adapter *sa; member
2186 SFC_ASSERT(ctx->sa != NULL); in sfc_get_representors_cb()
2189 sfc_dbg(ctx->sa, "not a representor, skipping"); in sfc_get_representors_cb()
2193 sfc_dbg(ctx->sa, "info structure is full already"); in sfc_get_representors_cb()
2203 sfc_err(ctx->sa, "invalid representor controller: %d", in sfc_get_representors_cb()
2223 sfc_err(ctx->sa, "representor name has been truncated: %s", in sfc_get_representors_cb()
2234 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_representor_info_get() local
2242 sfc_adapter_lock(sa); in sfc_representor_info_get()
2244 if (sa->mae.status != SFC_MAE_STATUS_ADMIN) { in sfc_representor_info_get()
2245 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2249 rc = sfc_process_mport_journal(sa); in sfc_representor_info_get()
2251 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2256 switch_domain_id = sa->mae.switch_domain_id; in sfc_representor_info_get()
2263 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2269 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2277 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2282 nic_cfg = efx_nic_cfg_get(sa->nic); in sfc_representor_info_get()
2288 sfc_err(sa, "invalid controller: %d", nic_cfg->enc_intf); in sfc_representor_info_get()
2296 get_repr_ctx.sa = sa; in sfc_representor_info_get()
2302 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2307 sfc_adapter_unlock(sa); in sfc_representor_info_get()
2314 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_rx_metadata_negotiate() local
2317 sfc_adapter_lock(sa); in sfc_rx_metadata_negotiate()
2319 if ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_FLAG) != 0) in sfc_rx_metadata_negotiate()
2322 if ((sa->priv.dp_rx->features & SFC_DP_RX_FEAT_FLOW_MARK) != 0) in sfc_rx_metadata_negotiate()
2325 if (sfc_flow_tunnel_is_supported(sa)) in sfc_rx_metadata_negotiate()
2328 sa->negotiated_rx_metadata = supported & *features; in sfc_rx_metadata_negotiate()
2329 *features = sa->negotiated_rx_metadata; in sfc_rx_metadata_negotiate()
2331 sfc_adapter_unlock(sa); in sfc_rx_metadata_negotiate()
2417 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_eth_dev_set_ops() local
2427 switch (sa->family) { in sfc_eth_dev_set_ops()
2442 encp = efx_nic_cfg_get(sa->nic); in sfc_eth_dev_set_ops()
2446 rc = sfc_kvargs_process(sa, SFC_KVARG_RX_DATAPATH, in sfc_eth_dev_set_ops()
2454 sfc_err(sa, "Rx datapath %s not found", rx_name); in sfc_eth_dev_set_ops()
2459 sfc_err(sa, in sfc_eth_dev_set_ops()
2468 sfc_err(sa, "Rx datapath by caps %#x not found", in sfc_eth_dev_set_ops()
2483 sa->negotiated_rx_metadata |= RTE_ETH_RX_METADATA_USER_FLAG; in sfc_eth_dev_set_ops()
2484 sa->negotiated_rx_metadata |= RTE_ETH_RX_METADATA_USER_MARK; in sfc_eth_dev_set_ops()
2487 sfc_notice(sa, "use %s Rx datapath", sas->dp_rx_name); in sfc_eth_dev_set_ops()
2489 rc = sfc_kvargs_process(sa, SFC_KVARG_TX_DATAPATH, in sfc_eth_dev_set_ops()
2497 sfc_err(sa, "Tx datapath %s not found", tx_name); in sfc_eth_dev_set_ops()
2502 sfc_err(sa, in sfc_eth_dev_set_ops()
2511 sfc_err(sa, "Tx datapath by caps %#x not found", in sfc_eth_dev_set_ops()
2524 sfc_notice(sa, "use %s Tx datapath", sas->dp_tx_name); in sfc_eth_dev_set_ops()
2526 sa->priv.dp_rx = dp_rx; in sfc_eth_dev_set_ops()
2527 sa->priv.dp_tx = dp_tx; in sfc_eth_dev_set_ops()
2557 struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); in sfc_eth_dev_clear_ops() local
2567 sa->priv.dp_tx = NULL; in sfc_eth_dev_clear_ops()
2571 sa->priv.dp_rx = NULL; in sfc_eth_dev_clear_ops()
2676 sfc_parse_switch_mode(struct sfc_adapter *sa, bool has_representors) in sfc_parse_switch_mode() argument
2678 const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); in sfc_parse_switch_mode()
2682 sfc_log_init(sa, "entry"); in sfc_parse_switch_mode()
2684 rc = sfc_kvargs_process(sa, SFC_KVARG_SWITCH_MODE, in sfc_parse_switch_mode()
2690 sa->switchdev = encp->enc_mae_admin && in sfc_parse_switch_mode()
2694 sa->switchdev = false; in sfc_parse_switch_mode()
2697 sa->switchdev = true; in sfc_parse_switch_mode()
2699 sfc_err(sa, "invalid switch mode device argument '%s'", in sfc_parse_switch_mode()
2705 sfc_log_init(sa, "done"); in sfc_parse_switch_mode()
2711 sfc_log_init(sa, "failed: %s", rte_strerror(rc)); in sfc_parse_switch_mode()
2723 struct sfc_adapter *sa; in sfc_eth_dev_init() local
2769 sa = calloc(1, sizeof(*sa)); in sfc_eth_dev_init()
2770 if (sa == NULL) { in sfc_eth_dev_init()
2775 dev->process_private = sa; in sfc_eth_dev_init()
2778 sa->priv.shared = sas; in sfc_eth_dev_init()
2779 sa->priv.logtype_main = logtype_main; in sfc_eth_dev_init()
2781 sa->eth_dev = dev; in sfc_eth_dev_init()
2787 rc = sfc_kvargs_parse(sa); in sfc_eth_dev_init()
2791 sfc_log_init(sa, "entry"); in sfc_eth_dev_init()
2799 sfc_adapter_lock_init(sa); in sfc_eth_dev_init()
2800 sfc_adapter_lock(sa); in sfc_eth_dev_init()
2802 sfc_log_init(sa, "probing"); in sfc_eth_dev_init()
2803 rc = sfc_probe(sa); in sfc_eth_dev_init()
2811 rc = sfc_parse_switch_mode(sa, init_data->nb_representors > 0); in sfc_eth_dev_init()
2815 sfc_log_init(sa, "set device ops"); in sfc_eth_dev_init()
2820 sfc_log_init(sa, "attaching"); in sfc_eth_dev_init()
2821 rc = sfc_attach(sa); in sfc_eth_dev_init()
2825 if (sa->switchdev && sa->mae.status != SFC_MAE_STATUS_ADMIN) { in sfc_eth_dev_init()
2826 sfc_err(sa, in sfc_eth_dev_init()
2832 encp = efx_nic_cfg_get(sa->nic); in sfc_eth_dev_init()
2847 rc = sfc_nic_dma_attach(sa); in sfc_eth_dev_init()
2851 sfc_adapter_unlock(sa); in sfc_eth_dev_init()
2853 sfc_log_init(sa, "done"); in sfc_eth_dev_init()
2858 sfc_detach(sa); in sfc_eth_dev_init()
2865 sfc_unprobe(sa); in sfc_eth_dev_init()
2868 sfc_adapter_unlock(sa); in sfc_eth_dev_init()
2869 sfc_adapter_lock_fini(sa); in sfc_eth_dev_init()
2874 sfc_kvargs_cleanup(sa); in sfc_eth_dev_init()
2877 sfc_log_init(sa, "failed %d", rc); in sfc_eth_dev_init()
2879 free(sa); in sfc_eth_dev_init()
2969 sfc_eth_dev_create_repr(struct sfc_adapter *sa, in sfc_eth_dev_create_repr() argument
2986 sfc_err(sa, "SF representors are not supported"); in sfc_eth_dev_create_repr()
2989 sfc_err(sa, "unknown representor type: %d", type); in sfc_eth_dev_create_repr()
2998 sfc_err(sa, in sfc_eth_dev_create_repr()
3010 rc = sfc_repr_create(sa->eth_dev, &entity, sa->mae.switch_domain_id, in sfc_eth_dev_create_repr()
3013 sfc_err(sa, in sfc_eth_dev_create_repr()
3023 sfc_eth_dev_create_repr_port(struct sfc_adapter *sa, in sfc_eth_dev_create_repr_port() argument
3033 return sfc_eth_dev_create_repr(sa, controller, port, in sfc_eth_dev_create_repr_port()
3039 rc = sfc_eth_dev_create_repr(sa, controller, port, in sfc_eth_dev_create_repr_port()
3050 sfc_eth_dev_create_repr_controller(struct sfc_adapter *sa, in sfc_eth_dev_create_repr_controller() argument
3061 encp = efx_nic_cfg_get(sa->nic); in sfc_eth_dev_create_repr_controller()
3063 return sfc_eth_dev_create_repr_port(sa, eth_da, controller, in sfc_eth_dev_create_repr_controller()
3068 rc = sfc_eth_dev_create_repr_port(sa, eth_da, controller, in sfc_eth_dev_create_repr_controller()
3083 struct sfc_adapter *sa; in sfc_eth_dev_create_representors() local
3088 sa = sfc_adapter_by_eth_dev(dev); in sfc_eth_dev_create_representors()
3089 switch_domain_id = sa->mae.switch_domain_id; in sfc_eth_dev_create_representors()
3098 sfc_err(sa, "SF representors are not supported"); in sfc_eth_dev_create_representors()
3101 sfc_err(sa, "unknown representor type: %d", in sfc_eth_dev_create_representors()
3106 if (!sa->switchdev) { in sfc_eth_dev_create_representors()
3107 sfc_err(sa, "cannot create representors in non-switchdev mode"); in sfc_eth_dev_create_representors()
3111 if (!sfc_repr_available(sfc_sa2shared(sa))) { in sfc_eth_dev_create_representors()
3112 sfc_err(sa, "cannot create representors: unsupported"); in sfc_eth_dev_create_representors()
3121 sfc_adapter_lock(sa); in sfc_eth_dev_create_representors()
3122 rc = sfc_process_mport_journal(sa); in sfc_eth_dev_create_representors()
3123 sfc_adapter_unlock(sa); in sfc_eth_dev_create_representors()
3135 sfc_err(sa, "failed to get representor"); in sfc_eth_dev_create_representors()
3138 sfc_eth_dev_create_repr_controller(sa, eth_da, intf); in sfc_eth_dev_create_representors()
3141 encp = efx_nic_cfg_get(sa->nic); in sfc_eth_dev_create_representors()
3142 sfc_eth_dev_create_repr_controller(sa, eth_da, encp->enc_intf); in sfc_eth_dev_create_representors()