diff options
Diffstat (limited to 'sys/dev/sfxge/common/efx_rx.c')
-rw-r--r-- | sys/dev/sfxge/common/efx_rx.c | 174 |
1 files changed, 72 insertions, 102 deletions
diff --git a/sys/dev/sfxge/common/efx_rx.c b/sys/dev/sfxge/common/efx_rx.c index 8ebe205..4a3b76e 100644 --- a/sys/dev/sfxge/common/efx_rx.c +++ b/sys/dev/sfxge/common/efx_rx.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2015 Solarflare Communications Inc. + * Copyright (c) 2007-2016 Solarflare Communications Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,45 +35,45 @@ __FBSDID("$FreeBSD$"); #include "efx_impl.h" -#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA +#if EFSYS_OPT_SIENA static __checkReturn efx_rc_t -falconsiena_rx_init( +siena_rx_init( __in efx_nic_t *enp); static void -falconsiena_rx_fini( +siena_rx_fini( __in efx_nic_t *enp); #if EFSYS_OPT_RX_SCATTER static __checkReturn efx_rc_t -falconsiena_rx_scatter_enable( +siena_rx_scatter_enable( __in efx_nic_t *enp, __in unsigned int buf_size); #endif /* EFSYS_OPT_RX_SCATTER */ #if EFSYS_OPT_RX_SCALE static __checkReturn efx_rc_t -falconsiena_rx_scale_mode_set( +siena_rx_scale_mode_set( __in efx_nic_t *enp, __in efx_rx_hash_alg_t alg, __in efx_rx_hash_type_t type, __in boolean_t insert); static __checkReturn efx_rc_t -falconsiena_rx_scale_key_set( +siena_rx_scale_key_set( __in efx_nic_t *enp, __in_ecount(n) uint8_t *key, __in size_t n); static __checkReturn efx_rc_t -falconsiena_rx_scale_tbl_set( +siena_rx_scale_tbl_set( __in efx_nic_t *enp, __in_ecount(n) unsigned int *table, __in size_t n); static __checkReturn uint32_t -falconsiena_rx_prefix_hash( +siena_rx_prefix_hash( __in efx_nic_t *enp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer); @@ -81,13 +81,13 @@ falconsiena_rx_prefix_hash( #endif /* EFSYS_OPT_RX_SCALE */ static __checkReturn efx_rc_t -falconsiena_rx_prefix_pktlen( +siena_rx_prefix_pktlen( __in efx_nic_t *enp, __in uint8_t *buffer, __out uint16_t *lengthp); static void -falconsiena_rx_qpost( +siena_rx_qpost( __in efx_rxq_t *erp, __in_ecount(n) efsys_dma_addr_t *addrp, __in size_t size, @@ -96,21 +96,21 @@ falconsiena_rx_qpost( __in unsigned int added); static void -falconsiena_rx_qpush( +siena_rx_qpush( __in efx_rxq_t *erp, __in unsigned int added, __inout unsigned int *pushedp); static __checkReturn efx_rc_t -falconsiena_rx_qflush( +siena_rx_qflush( __in efx_rxq_t *erp); static void -falconsiena_rx_qenable( +siena_rx_qenable( __in efx_rxq_t *erp); static __checkReturn efx_rc_t -falconsiena_rx_qcreate( +siena_rx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -122,60 +122,37 @@ falconsiena_rx_qcreate( __in efx_rxq_t *erp); static void -falconsiena_rx_qdestroy( +siena_rx_qdestroy( __in efx_rxq_t *erp); -#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */ - +#endif /* EFSYS_OPT_SIENA */ -#if EFSYS_OPT_FALCON -static efx_rx_ops_t __efx_rx_falcon_ops = { - falconsiena_rx_init, /* erxo_init */ - falconsiena_rx_fini, /* erxo_fini */ -#if EFSYS_OPT_RX_SCATTER - falconsiena_rx_scatter_enable, /* erxo_scatter_enable */ -#endif -#if EFSYS_OPT_RX_SCALE - falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */ - falconsiena_rx_scale_key_set, /* erxo_scale_key_set */ - falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */ - falconsiena_rx_prefix_hash, /* erxo_prefix_hash */ -#endif - falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */ - falconsiena_rx_qpost, /* erxo_qpost */ - falconsiena_rx_qpush, /* erxo_qpush */ - falconsiena_rx_qflush, /* erxo_qflush */ - falconsiena_rx_qenable, /* erxo_qenable */ - falconsiena_rx_qcreate, /* erxo_qcreate */ - falconsiena_rx_qdestroy, /* erxo_qdestroy */ -}; -#endif /* EFSYS_OPT_FALCON */ #if EFSYS_OPT_SIENA -static efx_rx_ops_t __efx_rx_siena_ops = { - falconsiena_rx_init, /* erxo_init */ - falconsiena_rx_fini, /* erxo_fini */ +static const efx_rx_ops_t __efx_rx_siena_ops = { + siena_rx_init, /* erxo_init */ + siena_rx_fini, /* erxo_fini */ #if EFSYS_OPT_RX_SCATTER - falconsiena_rx_scatter_enable, /* erxo_scatter_enable */ + siena_rx_scatter_enable, /* erxo_scatter_enable */ #endif #if EFSYS_OPT_RX_SCALE - falconsiena_rx_scale_mode_set, /* erxo_scale_mode_set */ - falconsiena_rx_scale_key_set, /* erxo_scale_key_set */ - falconsiena_rx_scale_tbl_set, /* erxo_scale_tbl_set */ - falconsiena_rx_prefix_hash, /* erxo_prefix_hash */ + siena_rx_scale_mode_set, /* erxo_scale_mode_set */ + siena_rx_scale_key_set, /* erxo_scale_key_set */ + siena_rx_scale_tbl_set, /* erxo_scale_tbl_set */ + siena_rx_prefix_hash, /* erxo_prefix_hash */ #endif - falconsiena_rx_prefix_pktlen, /* erxo_prefix_pktlen */ - falconsiena_rx_qpost, /* erxo_qpost */ - falconsiena_rx_qpush, /* erxo_qpush */ - falconsiena_rx_qflush, /* erxo_qflush */ - falconsiena_rx_qenable, /* erxo_qenable */ - falconsiena_rx_qcreate, /* erxo_qcreate */ - falconsiena_rx_qdestroy, /* erxo_qdestroy */ + siena_rx_prefix_pktlen, /* erxo_prefix_pktlen */ + siena_rx_qpost, /* erxo_qpost */ + siena_rx_qpush, /* erxo_qpush */ + siena_rx_qflush, /* erxo_qflush */ + siena_rx_qenable, /* erxo_qenable */ + siena_rx_qcreate, /* erxo_qcreate */ + siena_rx_qdestroy, /* erxo_qdestroy */ }; #endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD -static efx_rx_ops_t __efx_rx_ef10_ops = { +static const efx_rx_ops_t __efx_rx_ef10_ops = { ef10_rx_init, /* erxo_init */ ef10_rx_fini, /* erxo_fini */ #if EFSYS_OPT_RX_SCATTER @@ -202,7 +179,7 @@ static efx_rx_ops_t __efx_rx_ef10_ops = { efx_rx_init( __inout efx_nic_t *enp) { - efx_rx_ops_t *erxop; + const efx_rx_ops_t *erxop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -219,27 +196,21 @@ efx_rx_init( } switch (enp->en_family) { -#if EFSYS_OPT_FALCON - case EFX_FAMILY_FALCON: - erxop = (efx_rx_ops_t *)&__efx_rx_falcon_ops; - break; -#endif /* EFSYS_OPT_FALCON */ - #if EFSYS_OPT_SIENA case EFX_FAMILY_SIENA: - erxop = (efx_rx_ops_t *)&__efx_rx_siena_ops; + erxop = &__efx_rx_siena_ops; break; #endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON case EFX_FAMILY_HUNTINGTON: - erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops; + erxop = &__efx_rx_ef10_ops; break; #endif /* EFSYS_OPT_HUNTINGTON */ #if EFSYS_OPT_MEDFORD case EFX_FAMILY_MEDFORD: - erxop = (efx_rx_ops_t *)&__efx_rx_ef10_ops; + erxop = &__efx_rx_ef10_ops; break; #endif /* EFSYS_OPT_MEDFORD */ @@ -274,7 +245,7 @@ fail1: efx_rx_fini( __in efx_nic_t *enp) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NIC); @@ -293,7 +264,7 @@ efx_rx_scatter_enable( __in efx_nic_t *enp, __in unsigned int buf_size) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -370,7 +341,7 @@ efx_rx_scale_mode_set( __in efx_rx_hash_type_t type, __in boolean_t insert) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -397,7 +368,7 @@ efx_rx_scale_key_set( __in_ecount(n) uint8_t *key, __in size_t n) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -422,7 +393,7 @@ efx_rx_scale_tbl_set( __in_ecount(n) unsigned int *table, __in size_t n) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -450,7 +421,7 @@ efx_rx_qpost( __in unsigned int added) { efx_nic_t *enp = erp->er_enp; - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); @@ -464,7 +435,7 @@ efx_rx_qpush( __inout unsigned int *pushedp) { efx_nic_t *enp = erp->er_enp; - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); @@ -476,7 +447,7 @@ efx_rx_qflush( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rc_t rc; EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); @@ -497,7 +468,7 @@ efx_rx_qenable( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); @@ -516,7 +487,7 @@ efx_rx_qcreate( __in efx_evq_t *eep, __deref_out efx_rxq_t **erpp) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; efx_rxq_t *erp; efx_rc_t rc; @@ -561,7 +532,7 @@ efx_rx_qdestroy( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(erp->er_magic, ==, EFX_RXQ_MAGIC); @@ -574,7 +545,7 @@ efx_psuedo_hdr_pkt_length_get( __in uint8_t *buffer, __out uint16_t *lengthp) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; return (erxop->erxo_prefix_pktlen(enp, buffer, lengthp)); } @@ -586,17 +557,17 @@ efx_psuedo_hdr_hash_get( __in efx_rx_hash_alg_t func, __in uint8_t *buffer) { - efx_rx_ops_t *erxop = enp->en_erxop; + const efx_rx_ops_t *erxop = enp->en_erxop; EFSYS_ASSERT3U(enp->en_hash_support, ==, EFX_RX_HASH_AVAILABLE); return (erxop->erxo_prefix_hash(enp, func, buffer)); } #endif /* EFSYS_OPT_RX_SCALE */ -#if EFSYS_OPT_FALCON || EFSYS_OPT_SIENA +#if EFSYS_OPT_SIENA static __checkReturn efx_rc_t -falconsiena_rx_init( +siena_rx_init( __in efx_nic_t *enp) { efx_oword_t oword; @@ -633,7 +604,7 @@ falconsiena_rx_init( #if EFSYS_OPT_RX_SCATTER static __checkReturn efx_rc_t -falconsiena_rx_scatter_enable( +siena_rx_scatter_enable( __in efx_nic_t *enp, __in unsigned int buf_size) { @@ -721,11 +692,6 @@ fail1: do { \ efx_oword_t oword; \ \ - if ((_enp)->en_family == EFX_FAMILY_FALCON) { \ - (_rc) = ((_ip) || (_tcp)) ? ENOTSUP : 0; \ - break; \ - } \ - \ EFX_BAR_READO((_enp), FR_CZ_RX_RSS_IPV6_REG3, &oword); \ EFX_SET_OWORD_FIELD(oword, \ FRF_CZ_RX_RSS_IPV6_THASH_ENABLE, 1); \ @@ -744,7 +710,7 @@ fail1: #if EFSYS_OPT_RX_SCALE static __checkReturn efx_rc_t -falconsiena_rx_scale_mode_set( +siena_rx_scale_mode_set( __in efx_nic_t *enp, __in efx_rx_hash_alg_t alg, __in efx_rx_hash_type_t type, @@ -791,7 +757,7 @@ fail1: #if EFSYS_OPT_RX_SCALE static __checkReturn efx_rc_t -falconsiena_rx_scale_key_set( +siena_rx_scale_key_set( __in efx_nic_t *enp, __in_ecount(n) uint8_t *key, __in size_t n) @@ -828,8 +794,6 @@ falconsiena_rx_scale_key_set( if ((enp->en_features & EFX_FEATURE_IPV6) == 0) goto done; - EFSYS_ASSERT3U(enp->en_family, !=, EFX_FAMILY_FALCON); - byte = 0; /* Write Toeplitz IPv6 hash key 3 */ @@ -918,7 +882,7 @@ fail1: #if EFSYS_OPT_RX_SCALE static __checkReturn efx_rc_t -falconsiena_rx_scale_tbl_set( +siena_rx_scale_tbl_set( __in efx_nic_t *enp, __in_ecount(n) unsigned int *table, __in size_t n) @@ -996,11 +960,13 @@ fail1: #if EFSYS_OPT_RX_SCALE static __checkReturn uint32_t -falconsiena_rx_prefix_hash( +siena_rx_prefix_hash( __in efx_nic_t *enp, __in efx_rx_hash_alg_t func, __in uint8_t *buffer) { + _NOTE(ARGUNUSED(enp)) + switch (func) { case EFX_RX_HASHALG_TOEPLITZ: return ((buffer[12] << 24) | @@ -1019,11 +985,13 @@ falconsiena_rx_prefix_hash( #endif /* EFSYS_OPT_RX_SCALE */ static __checkReturn efx_rc_t -falconsiena_rx_prefix_pktlen( +siena_rx_prefix_pktlen( __in efx_nic_t *enp, __in uint8_t *buffer, __out uint16_t *lengthp) { + _NOTE(ARGUNUSED(enp, buffer, lengthp)) + /* Not supported by Falcon/Siena hardware */ EFSYS_ASSERT(0); return (ENOTSUP); @@ -1031,7 +999,7 @@ falconsiena_rx_prefix_pktlen( static void -falconsiena_rx_qpost( +siena_rx_qpost( __in efx_rxq_t *erp, __in_ecount(n) efsys_dma_addr_t *addrp, __in size_t size, @@ -1069,7 +1037,7 @@ falconsiena_rx_qpost( } static void -falconsiena_rx_qpush( +siena_rx_qpush( __in efx_rxq_t *erp, __in unsigned int added, __inout unsigned int *pushedp) @@ -1101,7 +1069,7 @@ falconsiena_rx_qpush( } static __checkReturn efx_rc_t -falconsiena_rx_qflush( +siena_rx_qflush( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; @@ -1119,7 +1087,7 @@ falconsiena_rx_qflush( } static void -falconsiena_rx_qenable( +siena_rx_qenable( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; @@ -1139,7 +1107,7 @@ falconsiena_rx_qenable( } static __checkReturn efx_rc_t -falconsiena_rx_qcreate( +siena_rx_qcreate( __in efx_nic_t *enp, __in unsigned int index, __in unsigned int label, @@ -1156,6 +1124,8 @@ falconsiena_rx_qcreate( boolean_t jumbo; efx_rc_t rc; + _NOTE(ARGUNUSED(esmp)) + EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS == (1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH)); EFSYS_ASSERT3U(label, <, EFX_EV_RX_NLABELS); @@ -1229,7 +1199,7 @@ fail1: } static void -falconsiena_rx_qdestroy( +siena_rx_qdestroy( __in efx_rxq_t *erp) { efx_nic_t *enp = erp->er_enp; @@ -1249,10 +1219,10 @@ falconsiena_rx_qdestroy( } static void -falconsiena_rx_fini( +siena_rx_fini( __in efx_nic_t *enp) { _NOTE(ARGUNUSED(enp)) } -#endif /* EFSYS_OPT_FALCON || EFSYS_OPT_SIENA */ +#endif /* EFSYS_OPT_SIENA */ |