2c2 < * SPDX-License-Identifier: BSD-2-Clause --- > * Copyright 2007-2009 Solarflare Communications Inc. All rights reserved. 4,6d3 < * Copyright (c) 2007-2016 Solarflare Communications Inc. < * All rights reserved. < * 8c5,11 < * modification, are permitted provided that the following conditions are met: --- > * modification, are permitted provided that the following conditions > * are met: > * 1. Redistributions of source code must retain the above copyright > * notice, this list of conditions and the following disclaimer. > * 2. Redistributions in binary form must reproduce the above copyright > * notice, this list of conditions and the following disclaimer in the > * documentation and/or other materials provided with the distribution. 10,30c13,23 < * 1. Redistributions of source code must retain the above copyright notice, < * this list of conditions and the following disclaimer. < * 2. Redistributions in binary form must reproduce the above copyright notice, < * this list of conditions and the following disclaimer in the documentation < * and/or other materials provided with the distribution. < * < * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" < * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, < * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR < * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR < * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, < * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, < * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; < * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, < * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR < * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, < * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. < * < * The views and conclusions contained in the software and documentation are < * those of the authors and should not be interpreted as representing official < * policies, either expressed or implied, of the FreeBSD Project. --- > * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND > * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. 33,35c26 < #include < __FBSDID("$FreeBSD$"); < --- > #include "efsys.h" 36a28 > #include "efx_types.h" 39c31,33 < #if EFSYS_OPT_SIENA --- > #if EFSYS_OPT_MAC_FALCON_GMAC > #include "falcon_gmac.h" > #endif 41,43c35,37 < static __checkReturn efx_rc_t < siena_mac_multicast_list_set( < __in efx_nic_t *enp); --- > #if EFSYS_OPT_MAC_FALCON_XMAC > #include "falcon_xmac.h" > #endif 45c39,54 < #endif /* EFSYS_OPT_SIENA */ --- > #if EFSYS_OPT_MAC_FALCON_GMAC > static efx_mac_ops_t __cs __efx_falcon_gmac_ops = { > falcon_gmac_reset, /* emo_reset */ > falcon_mac_poll, /* emo_poll */ > falcon_mac_up, /* emo_up */ > falcon_gmac_reconfigure, /* emo_reconfigure */ > #if EFSYS_OPT_LOOPBACK > falcon_mac_loopback_set, /* emo_loopback_set */ > #endif /* EFSYS_OPT_LOOPBACK */ > #if EFSYS_OPT_MAC_STATS > falcon_mac_stats_upload, /* emo_stats_upload */ > NULL, /* emo_stats_periodic */ > falcon_gmac_stats_update /* emo_stats_update */ > #endif /* EFSYS_OPT_MAC_STATS */ > }; > #endif /* EFSYS_OPT_MAC_FALCON_GMAC */ 47,57c56,61 < #if EFSYS_OPT_SIENA < static const efx_mac_ops_t __efx_mac_siena_ops = { < siena_mac_poll, /* emo_poll */ < siena_mac_up, /* emo_up */ < siena_mac_reconfigure, /* emo_addr_set */ < siena_mac_reconfigure, /* emo_pdu_set */ < siena_mac_pdu_get, /* emo_pdu_get */ < siena_mac_reconfigure, /* emo_reconfigure */ < siena_mac_multicast_list_set, /* emo_multicast_list_set */ < NULL, /* emo_filter_set_default_rxq */ < NULL, /* emo_filter_default_rxq_clear */ --- > #if EFSYS_OPT_MAC_FALCON_XMAC > static efx_mac_ops_t __cs __efx_falcon_xmac_ops = { > falcon_xmac_reset, /* emo_reset */ > falcon_mac_poll, /* emo_poll */ > falcon_mac_up, /* emo_up */ > falcon_xmac_reconfigure, /* emo_reconfigure */ 59c63 < siena_mac_loopback_set, /* emo_loopback_set */ --- > falcon_mac_loopback_set, /* emo_loopback_set */ 62,66c66,68 < siena_mac_stats_get_mask, /* emo_stats_get_mask */ < efx_mcdi_mac_stats_clear, /* emo_stats_clear */ < efx_mcdi_mac_stats_upload, /* emo_stats_upload */ < efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ < siena_mac_stats_update /* emo_stats_update */ --- > falcon_mac_stats_upload, /* emo_stats_upload */ > NULL, /* emo_stats_periodic */ > falcon_xmac_stats_update /* emo_stats_update */ 69c71 < #endif /* EFSYS_OPT_SIENA */ --- > #endif /* EFSYS_OPT_MAC_FALCON_XMAC */ 71,82c73,78 < #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 < static const efx_mac_ops_t __efx_mac_ef10_ops = { < ef10_mac_poll, /* emo_poll */ < ef10_mac_up, /* emo_up */ < ef10_mac_addr_set, /* emo_addr_set */ < ef10_mac_pdu_set, /* emo_pdu_set */ < ef10_mac_pdu_get, /* emo_pdu_get */ < ef10_mac_reconfigure, /* emo_reconfigure */ < ef10_mac_multicast_list_set, /* emo_multicast_list_set */ < ef10_mac_filter_default_rxq_set, /* emo_filter_default_rxq_set */ < ef10_mac_filter_default_rxq_clear, < /* emo_filter_default_rxq_clear */ --- > #if EFSYS_OPT_SIENA > static efx_mac_ops_t __cs __efx_siena_mac_ops = { > NULL, /* emo_reset */ > siena_mac_poll, /* emo_poll */ > siena_mac_up, /* emo_up */ > siena_mac_reconfigure, /* emo_reconfigure */ 84c80 < ef10_mac_loopback_set, /* emo_loopback_set */ --- > siena_mac_loopback_set, /* emo_loopback_set */ 87,91c83,85 < ef10_mac_stats_get_mask, /* emo_stats_get_mask */ < efx_mcdi_mac_stats_clear, /* emo_stats_clear */ < efx_mcdi_mac_stats_upload, /* emo_stats_upload */ < efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ < ef10_mac_stats_update /* emo_stats_update */ --- > siena_mac_stats_upload, /* emo_stats_upload */ > siena_mac_stats_periodic, /* emo_stats_periodic */ > siena_mac_stats_update /* emo_stats_update */ 94c88 < #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ --- > #endif /* EFSYS_OPT_SIENA */ 96c90,109 < __checkReturn efx_rc_t --- > static efx_mac_ops_t __cs * __cs __efx_mac_ops[] = { > NULL, > #if EFSYS_OPT_MAC_FALCON_GMAC > &__efx_falcon_gmac_ops, > #else > NULL, > #endif /* EFSYS_OPT_MAC_FALCON_GMAC */ > #if EFSYS_OPT_MAC_FALCON_XMAC > &__efx_falcon_xmac_ops, > #else > NULL, > #endif /* EFSYS_OPT_MAC_FALCON_XMAC */ > #if EFSYS_OPT_SIENA > &__efx_siena_mac_ops, > #else > NULL, > #endif /* EFSYS_OPT_SIENA */ > }; > > __checkReturn int 102c115 < const efx_mac_ops_t *emop = epp->ep_emop; --- > efx_mac_ops_t *emop = epp->ep_emop; 104c117 < efx_rc_t rc; --- > int rc; 122c135 < if ((rc = emop->emo_pdu_set(enp)) != 0) --- > if ((rc = emop->emo_reconfigure(enp)) != 0) 135c148 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 140,160c153 < __checkReturn efx_rc_t < efx_mac_pdu_get( < __in efx_nic_t *enp, < __out size_t *pdu) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; < < if ((rc = emop->emo_pdu_get(enp, pdu)) != 0) < goto fail1; < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < __checkReturn efx_rc_t --- > __checkReturn int 166c159 < const efx_mac_ops_t *emop = epp->ep_emop; --- > efx_mac_ops_t *emop = epp->ep_emop; 169c162 < efx_rc_t rc; --- > int rc; 174c167 < if (EFX_MAC_ADDR_IS_MULTICAST(addr)) { --- > if (addr[0] & 0x01) { 187c180 < if ((rc = emop->emo_addr_set(enp)) != 0) --- > if ((rc = emop->emo_reconfigure(enp)) != 0) 200c193 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 205c198 < __checkReturn efx_rc_t --- > __checkReturn int 208,210c201 < __in boolean_t all_unicst, < __in boolean_t mulcst, < __in boolean_t all_mulcst, --- > __in boolean_t unicst, 214,217c205,206 < const efx_mac_ops_t *emop = epp->ep_emop; < boolean_t old_all_unicst; < boolean_t old_mulcst; < boolean_t old_all_mulcst; --- > efx_mac_ops_t *emop = epp->ep_emop; > boolean_t old_unicst; 219c208 < efx_rc_t rc; --- > int rc; 224,227c213,214 < old_all_unicst = epp->ep_all_unicst; < old_mulcst = epp->ep_mulcst; < old_all_mulcst = epp->ep_all_mulcst; < old_brdcst = epp->ep_brdcst; --- > old_unicst = unicst; > old_brdcst = brdcst; 229,231c216 < epp->ep_all_unicst = all_unicst; < epp->ep_mulcst = mulcst; < epp->ep_all_mulcst = all_mulcst; --- > epp->ep_unicst = unicst; 240c225 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 242,244c227 < epp->ep_all_unicst = old_all_unicst; < epp->ep_mulcst = old_mulcst; < epp->ep_all_mulcst = old_all_mulcst; --- > epp->ep_unicst = old_unicst; 250c233 < __checkReturn efx_rc_t --- > __checkReturn int 256,257c239,240 < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > int rc; 267a251,258 > if (enabled && emop->emo_reset != NULL) { > if ((rc = emop->emo_reset(enp)) != 0) > goto fail1; > > EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_MAC); > enp->en_reset_flags &= ~EFX_RESET_PHY; > } > 269c260 < goto fail1; --- > goto fail2; 272a264,265 > fail2: > EFSYS_PROBE(fail2); 274c267 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 279c272 < __checkReturn efx_rc_t --- > __checkReturn int 285,286c278,279 < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > int rc; 297c290 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 302c295 < __checkReturn efx_rc_t --- > __checkReturn int 309,310c302,303 < const efx_mac_ops_t *emop = epp->ep_emop; < const efx_phy_ops_t *epop = epp->ep_epop; --- > efx_mac_ops_t *emop = epp->ep_emop; > efx_phy_ops_t *epop = epp->ep_epop; 314c307 < efx_rc_t rc; --- > int rc; 325c318 < * Ignore a request to set flow control auto-negotiation --- > * Ignore a request to set flow control autonegotiation 332c325 < old_autoneg = epp->ep_fcntl_autoneg; --- > old_autoneg = autoneg; 339,341c332,334 < * Always encode the flow control settings in the advertised < * capabilities even if we are not trying to auto-negotiate < * them and reconfigure both the PHY and the MAC. --- > * If the PHY supports autonegotiation, then encode the flow control > * settings in the advertised capabilities, and restart AN. Otherwise, > * just push the new settings directly to the MAC. 343,348c336,342 < if (fcntl & EFX_FCNTL_RESPOND) < epp->ep_adv_cap_mask |= (1 << EFX_PHY_CAP_PAUSE | < 1 << EFX_PHY_CAP_ASYM); < else < epp->ep_adv_cap_mask &= ~(1 << EFX_PHY_CAP_PAUSE | < 1 << EFX_PHY_CAP_ASYM); --- > if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_AN)) { > if (fcntl & EFX_FCNTL_RESPOND) > epp->ep_adv_cap_mask |= (1 << EFX_PHY_CAP_PAUSE | > 1 << EFX_PHY_CAP_ASYM); > else > epp->ep_adv_cap_mask &= ~(1 << EFX_PHY_CAP_PAUSE | > 1 << EFX_PHY_CAP_ASYM); 350,351c344,345 < if (fcntl & EFX_FCNTL_GENERATE) < epp->ep_adv_cap_mask ^= (1 << EFX_PHY_CAP_ASYM); --- > if (fcntl & EFX_FCNTL_GENERATE) > epp->ep_adv_cap_mask ^= (1 << EFX_PHY_CAP_ASYM); 353,354c347,348 < if ((rc = epop->epo_reconfigure(enp)) != 0) < goto fail2; --- > if ((rc = epop->epo_reconfigure(enp)) != 0) > goto fail2; 356,357c350,353 < if ((rc = emop->emo_reconfigure(enp)) != 0) < goto fail3; --- > } else { > if ((rc = emop->emo_reconfigure(enp)) != 0) > goto fail2; > } 361,363d356 < fail3: < EFSYS_PROBE(fail3); < 372c365 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 384c377 < unsigned int wanted = 0; --- > unsigned int wanted; 390,391c383,384 < * Decode the requested flow control settings from the PHY < * advertised capabilities. --- > * If the PHY supports auto negotiation, then the requested flow > * control settings are encoded in the advertised capabilities. 393,396c386,387 < if (epp->ep_adv_cap_mask & (1 << EFX_PHY_CAP_PAUSE)) < wanted = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; < if (epp->ep_adv_cap_mask & (1 << EFX_PHY_CAP_ASYM)) < wanted ^= EFX_FCNTL_GENERATE; --- > if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_AN)) { > wanted = 0; 397a389,395 > if (epp->ep_adv_cap_mask & (1 << EFX_PHY_CAP_PAUSE)) > wanted = EFX_FCNTL_RESPOND | EFX_FCNTL_GENERATE; > if (epp->ep_adv_cap_mask & (1 << EFX_PHY_CAP_ASYM)) > wanted ^= EFX_FCNTL_GENERATE; > } else > wanted = epp->ep_fcntl; > 402,403c400,401 < __checkReturn efx_rc_t < efx_mac_multicast_list_set( --- > __checkReturn int > efx_mac_hash_set( 405,406c403 < __in_ecount(6*count) uint8_t const *addrs, < __in int count) --- > __in_ecount(EFX_MAC_HASH_BITS) unsigned int const *bucket) 409,412c406,409 < const efx_mac_ops_t *emop = epp->ep_emop; < uint8_t *old_mulcst_addr_list = NULL; < uint32_t old_mulcst_addr_count; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > efx_oword_t old_hash[2]; > unsigned int index; > int rc; 417,420c414 < if (count > EFX_MAC_MULTICAST_LIST_MAX) { < rc = EINVAL; < goto fail1; < } --- > memcpy(old_hash, epp->ep_multicst_hash, sizeof (old_hash)); 422,435c416,420 < old_mulcst_addr_count = epp->ep_mulcst_addr_count; < if (old_mulcst_addr_count > 0) { < /* Allocate memory to store old list (instead of using stack) */ < EFSYS_KMEM_ALLOC(enp->en_esip, < old_mulcst_addr_count * EFX_MAC_ADDR_LEN, < old_mulcst_addr_list); < if (old_mulcst_addr_list == NULL) { < rc = ENOMEM; < goto fail2; < } < < /* Save the old list in case we need to rollback */ < memcpy(old_mulcst_addr_list, epp->ep_mulcst_addr_list, < old_mulcst_addr_count * EFX_MAC_ADDR_LEN); --- > /* Set the lower 128 bits of the hash */ > EFX_ZERO_OWORD(epp->ep_multicst_hash[0]); > for (index = 0; index < 128; index++) { > if (bucket[index] != 0) > EFX_SET_OWORD_BIT(epp->ep_multicst_hash[0], index); 438,449c423,427 < /* Store the new list */ < memcpy(epp->ep_mulcst_addr_list, addrs, < count * EFX_MAC_ADDR_LEN); < epp->ep_mulcst_addr_count = count; < < if ((rc = emop->emo_multicast_list_set(enp)) != 0) < goto fail3; < < if (old_mulcst_addr_count > 0) { < EFSYS_KMEM_FREE(enp->en_esip, < old_mulcst_addr_count * EFX_MAC_ADDR_LEN, < old_mulcst_addr_list); --- > /* Set the upper 128 bits of the hash */ > EFX_ZERO_OWORD(epp->ep_multicst_hash[1]); > for (index = 0; index < 128; index++) { > if (bucket[index + 128] != 0) > EFX_SET_OWORD_BIT(epp->ep_multicst_hash[1], index); 452c430,431 < return (0); --- > if ((rc = emop->emo_reconfigure(enp)) != 0) > goto fail1; 454,496d432 < fail3: < EFSYS_PROBE(fail3); < < /* Restore original list on failure */ < epp->ep_mulcst_addr_count = old_mulcst_addr_count; < if (old_mulcst_addr_count > 0) { < memcpy(epp->ep_mulcst_addr_list, old_mulcst_addr_list, < old_mulcst_addr_count * EFX_MAC_ADDR_LEN); < < EFSYS_KMEM_FREE(enp->en_esip, < old_mulcst_addr_count * EFX_MAC_ADDR_LEN, < old_mulcst_addr_list); < } < < fail2: < EFSYS_PROBE(fail2); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < < } < < __checkReturn efx_rc_t < efx_mac_filter_default_rxq_set( < __in efx_nic_t *enp, < __in efx_rxq_t *erp, < __in boolean_t using_rss) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; < < EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); < EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); < < if (emop->emo_filter_default_rxq_set != NULL) { < rc = emop->emo_filter_default_rxq_set(enp, erp, using_rss); < if (rc != 0) < goto fail1; < } < 500c436 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 501a438,439 > memcpy(epp->ep_multicst_hash, old_hash, sizeof (old_hash)); > 505,518d442 < void < efx_mac_filter_default_rxq_clear( < __in efx_nic_t *enp) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < < EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); < EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); < < if (emop->emo_filter_default_rxq_clear != NULL) < emop->emo_filter_default_rxq_clear(enp); < } < 523,524c447,448 < /* START MKCONFIG GENERATED EfxMacStatNamesBlock 1a45a82fcfb30c1b */ < static const char * const __efx_mac_stat_name[] = { --- > /* START MKCONFIG GENERATED EfxMacStatNamesBlock adf707adba80813e */ > static const char __cs * __cs __efx_mac_stat_name[] = { 576,630d499 < "pm_trunc_bb_overflow", < "pm_discard_bb_overflow", < "pm_trunc_vfifo_full", < "pm_discard_vfifo_full", < "pm_trunc_qbb", < "pm_discard_qbb", < "pm_discard_mapping", < "rxdp_q_disabled_pkts", < "rxdp_di_dropped_pkts", < "rxdp_streaming_pkts", < "rxdp_hlb_fetch", < "rxdp_hlb_wait", < "vadapter_rx_unicast_packets", < "vadapter_rx_unicast_bytes", < "vadapter_rx_multicast_packets", < "vadapter_rx_multicast_bytes", < "vadapter_rx_broadcast_packets", < "vadapter_rx_broadcast_bytes", < "vadapter_rx_bad_packets", < "vadapter_rx_bad_bytes", < "vadapter_rx_overflow", < "vadapter_tx_unicast_packets", < "vadapter_tx_unicast_bytes", < "vadapter_tx_multicast_packets", < "vadapter_tx_multicast_bytes", < "vadapter_tx_broadcast_packets", < "vadapter_tx_broadcast_bytes", < "vadapter_tx_bad_packets", < "vadapter_tx_bad_bytes", < "vadapter_tx_overflow", < "fec_uncorrected_errors", < "fec_corrected_errors", < "fec_corrected_symbols_lane0", < "fec_corrected_symbols_lane1", < "fec_corrected_symbols_lane2", < "fec_corrected_symbols_lane3", < "ctpio_vi_busy_fallback", < "ctpio_long_write_success", < "ctpio_missing_dbell_fail", < "ctpio_overflow_fail", < "ctpio_underflow_fail", < "ctpio_timeout_fail", < "ctpio_noncontig_wr_fail", < "ctpio_frm_clobber_fail", < "ctpio_invalid_wr_fail", < "ctpio_vi_clobber_fallback", < "ctpio_unqualified_fallback", < "ctpio_runt_fallback", < "ctpio_success", < "ctpio_fallback", < "ctpio_poison", < "ctpio_erase", < "rxdp_scatter_disabled_trunc", < "rxdp_hlb_idle", < "rxdp_hlb_timeout", 634c503 < __checkReturn const char * --- > __checkReturn const char __cs * 646c515 < #endif /* EFSYS_OPT_NAMES */ --- > #endif /* EFSYS_OPT_STAT_NAME */ 648,770c517 < static efx_rc_t < efx_mac_stats_mask_add_range( < __inout_bcount(mask_size) uint32_t *maskp, < __in size_t mask_size, < __in const struct efx_mac_stats_range *rngp) < { < unsigned int mask_npages = mask_size / sizeof (*maskp); < unsigned int el; < unsigned int el_min; < unsigned int el_max; < unsigned int low; < unsigned int high; < unsigned int width; < efx_rc_t rc; < < if ((mask_npages * EFX_MAC_STATS_MASK_BITS_PER_PAGE) <= < (unsigned int)rngp->last) { < rc = EINVAL; < goto fail1; < } < < EFSYS_ASSERT3U(rngp->first, <=, rngp->last); < EFSYS_ASSERT3U(rngp->last, <, EFX_MAC_NSTATS); < < for (el = 0; el < mask_npages; ++el) { < el_min = el * EFX_MAC_STATS_MASK_BITS_PER_PAGE; < el_max = < el_min + (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1); < if ((unsigned int)rngp->first > el_max || < (unsigned int)rngp->last < el_min) < continue; < low = MAX((unsigned int)rngp->first, el_min); < high = MIN((unsigned int)rngp->last, el_max); < width = high - low + 1; < maskp[el] |= < (width == EFX_MAC_STATS_MASK_BITS_PER_PAGE) ? < (~0ULL) : (((1ULL << width) - 1) << (low - el_min)); < } < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < efx_rc_t < efx_mac_stats_mask_add_ranges( < __inout_bcount(mask_size) uint32_t *maskp, < __in size_t mask_size, < __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, < __in unsigned int rng_count) < { < unsigned int i; < efx_rc_t rc; < < for (i = 0; i < rng_count; ++i) { < if ((rc = efx_mac_stats_mask_add_range(maskp, mask_size, < &rngp[i])) != 0) < goto fail1; < } < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < __checkReturn efx_rc_t < efx_mac_stats_get_mask( < __in efx_nic_t *enp, < __out_bcount(mask_size) uint32_t *maskp, < __in size_t mask_size) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; < < EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); < EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE); < EFSYS_ASSERT(maskp != NULL); < EFSYS_ASSERT(mask_size % sizeof (maskp[0]) == 0); < < (void) memset(maskp, 0, mask_size); < < if ((rc = emop->emo_stats_get_mask(enp, maskp, mask_size)) != 0) < goto fail1; < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < __checkReturn efx_rc_t < efx_mac_stats_clear( < __in efx_nic_t *enp) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; < < EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); < EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); < EFSYS_ASSERT(emop != NULL); < < if ((rc = emop->emo_stats_clear(enp)) != 0) < goto fail1; < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < __checkReturn efx_rc_t --- > __checkReturn int 776,777c523,524 < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > int rc; 782a530,534 > /* > * Don't assert !ep_mac_stats_pending, because the client might > * have failed to finalise statistics when previously stopping > * the port. > */ 785a538,539 > epp->ep_mac_stats_pending = B_TRUE; > 789c543 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 794c548 < __checkReturn efx_rc_t --- > __checkReturn int 802,803c556,557 < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > int rc; 823c577 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 828c582,583 < __checkReturn efx_rc_t --- > > __checkReturn int 833c588 < __inout_opt uint32_t *generationp) --- > __in uint32_t *generationp) 836,837c591,592 < const efx_mac_ops_t *emop = epp->ep_emop; < efx_rc_t rc; --- > efx_mac_ops_t *emop = epp->ep_emop; > int rc; 843a599,600 > if (rc == 0) > epp->ep_mac_stats_pending = B_FALSE; 850c607 < __checkReturn efx_rc_t --- > __checkReturn int 856c613 < const efx_mac_ops_t *emop; --- > efx_mac_ops_t *emop; 859d615 < switch (enp->en_family) { 861,862c617 < case EFX_FAMILY_SIENA: < emop = &__efx_mac_siena_ops; --- > if (enp->en_family == EFX_FAMILY_SIENA) { 864,865c619,621 < break; < #endif /* EFSYS_OPT_SIENA */ --- > goto chosen; > } > #endif 867,872c623,632 < #if EFSYS_OPT_HUNTINGTON < case EFX_FAMILY_HUNTINGTON: < emop = &__efx_mac_ef10_ops; < type = EFX_MAC_HUNTINGTON; < break; < #endif /* EFSYS_OPT_HUNTINGTON */ --- > #if EFSYS_OPT_FALCON > switch (epp->ep_link_mode) { > #if EFSYS_OPT_MAC_FALCON_GMAC > case EFX_LINK_100HDX: > case EFX_LINK_100FDX: > case EFX_LINK_1000HDX: > case EFX_LINK_1000FDX: > type = EFX_MAC_FALCON_GMAC; > goto chosen; > #endif /* EFSYS_OPT_FALCON_GMAC */ 874,879c634,638 < #if EFSYS_OPT_MEDFORD < case EFX_FAMILY_MEDFORD: < emop = &__efx_mac_ef10_ops; < type = EFX_MAC_MEDFORD; < break; < #endif /* EFSYS_OPT_MEDFORD */ --- > #if EFSYS_OPT_MAC_FALCON_XMAC > case EFX_LINK_10000FDX: > type = EFX_MAC_FALCON_XMAC; > goto chosen; > #endif /* EFSYS_OPT_FALCON_XMAC */ 881,887d639 < #if EFSYS_OPT_MEDFORD2 < case EFX_FAMILY_MEDFORD2: < emop = &__efx_mac_ef10_ops; < type = EFX_MAC_MEDFORD2; < break; < #endif /* EFSYS_OPT_MEDFORD2 */ < 889,890c641,658 < rc = EINVAL; < goto fail1; --- > #if EFSYS_OPT_MAC_FALCON_GMAC && EFSYS_OPT_MAC_FALCON_XMAC > /* Only initialise a MAC supported by the PHY */ > if (epp->ep_phy_cap_mask & > ((1 << EFX_PHY_CAP_1000FDX) | > (1 << EFX_PHY_CAP_1000HDX) | > (1 << EFX_PHY_CAP_100FDX) | > (1 << EFX_PHY_CAP_100HDX) | > (1 << EFX_PHY_CAP_10FDX) | > (1 << EFX_PHY_CAP_10FDX))) > type = EFX_MAC_FALCON_GMAC; > else > type = EFX_MAC_FALCON_XMAC; > #elif EFSYS_OPT_MAC_FALCON_GMAC > type = EFX_MAC_FALCON_GMAC; > #else > type = EFX_MAC_FALCON_XMAC; > #endif > goto chosen; 891a660 > #endif /* EFSYS_OPT_FALCON */ 892a662 > chosen: 894a665 > emop = epp->ep_emop = (efx_mac_ops_t *)__efx_mac_ops[type]; 897d667 < epp->ep_emop = emop; 899,939c669,675 < < return (0); < < fail1: < EFSYS_PROBE1(fail1, efx_rc_t, rc); < < return (rc); < } < < #if EFSYS_OPT_SIENA < < #define EFX_MAC_HASH_BITS (1 << 8) < < /* Compute the multicast hash as used on Falcon and Siena. */ < static void < siena_mac_multicast_hash_compute( < __in_ecount(6*count) uint8_t const *addrs, < __in int count, < __out efx_oword_t *hash_low, < __out efx_oword_t *hash_high) < { < uint32_t crc, index; < int i; < < EFSYS_ASSERT(hash_low != NULL); < EFSYS_ASSERT(hash_high != NULL); < < EFX_ZERO_OWORD(*hash_low); < EFX_ZERO_OWORD(*hash_high); < < for (i = 0; i < count; i++) { < /* Calculate hash bucket (IEEE 802.3 CRC32 of the MAC addr) */ < crc = efx_crc32_calculate(0xffffffff, addrs, EFX_MAC_ADDR_LEN); < index = crc % EFX_MAC_HASH_BITS; < if (index < 128) { < EFX_SET_OWORD_BIT(*hash_low, index); < } else { < EFX_SET_OWORD_BIT(*hash_high, index - 128); < } < < addrs += EFX_MAC_ADDR_LEN; --- > > if (emop->emo_reset != NULL) { > if ((rc = emop->emo_reset(enp)) != 0) > goto fail1; > > EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_MAC); > enp->en_reset_flags &= ~EFX_RESET_MAC; 941d676 < } 943,965d677 < static __checkReturn efx_rc_t < siena_mac_multicast_list_set( < __in efx_nic_t *enp) < { < efx_port_t *epp = &(enp->en_port); < const efx_mac_ops_t *emop = epp->ep_emop; < efx_oword_t old_hash[2]; < efx_rc_t rc; < < EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); < EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); < < memcpy(old_hash, epp->ep_multicst_hash, sizeof (old_hash)); < < siena_mac_multicast_hash_compute( < epp->ep_mulcst_addr_list, < epp->ep_mulcst_addr_count, < &epp->ep_multicst_hash[0], < &epp->ep_multicst_hash[1]); < < if ((rc = emop->emo_reconfigure(enp)) != 0) < goto fail1; < 969c681 < EFSYS_PROBE1(fail1, efx_rc_t, rc); --- > EFSYS_PROBE1(fail1, int, rc); 971,972d682 < memcpy(epp->ep_multicst_hash, old_hash, sizeof (old_hash)); < 975,976d684 < < #endif /* EFSYS_OPT_SIENA */