/*
* Copyright (c) 2007-2015 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* 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
*
* 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.
*/
#include "efx.h"
#include "efx_impl.h"
#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
static void
static __checkReturn efx_rc_t
#endif /* EFSYS_OPT_RX_SCATTER */
static __checkReturn efx_rc_t
static __checkReturn efx_rc_t
static __checkReturn efx_rc_t
__in_ecount(n) unsigned int *table,
static __checkReturn uint32_t
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
static void
__in unsigned int n,
static void
static __checkReturn efx_rc_t
static void
static __checkReturn efx_rc_t
static void
#endif /* EFSYS_OPT_SIENA */
#if EFSYS_OPT_SIENA
siena_rx_init, /* erxo_init */
siena_rx_fini, /* erxo_fini */
siena_rx_scatter_enable, /* erxo_scatter_enable */
#endif
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
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 */
ef10_rx_init, /* erxo_init */
ef10_rx_fini, /* erxo_fini */
ef10_rx_scatter_enable, /* erxo_scatter_enable */
#endif
ef10_rx_scale_mode_set, /* erxo_scale_mode_set */
ef10_rx_scale_key_set, /* erxo_scale_key_set */
ef10_rx_scale_tbl_set, /* erxo_scale_tbl_set */
ef10_rx_prefix_hash, /* erxo_prefix_hash */
#endif
ef10_rx_prefix_pktlen, /* erxo_prefix_pktlen */
ef10_rx_qpost, /* erxo_qpost */
ef10_rx_qpush, /* erxo_qpush */
ef10_rx_qflush, /* erxo_qflush */
ef10_rx_qenable, /* erxo_qenable */
ef10_rx_qcreate, /* erxo_qcreate */
ef10_rx_qdestroy, /* erxo_qdestroy */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
{
goto fail1;
}
goto fail2;
}
#if EFSYS_OPT_SIENA
case EFX_FAMILY_SIENA:
break;
#endif /* EFSYS_OPT_SIENA */
case EFX_FAMILY_HUNTINGTON:
break;
#endif /* EFSYS_OPT_HUNTINGTON */
case EFX_FAMILY_MEDFORD:
break;
#endif /* EFSYS_OPT_MEDFORD */
default:
EFSYS_ASSERT(0);
goto fail3;
}
goto fail4;
return (0);
return (rc);
}
void
{
}
{
goto fail1;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCATTER */
{
goto fail1;
}
/* Report if resources are available to insert RX hash value */
return (0);
return (rc);
}
{
goto fail1;
}
/* Report if resources are available to support RSS */
return (0);
return (rc);
}
{
goto fail1;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
{
goto fail1;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
__in_ecount(n) unsigned int *table,
{
goto fail1;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
void
__in unsigned int n,
{
}
void
{
}
{
goto fail1;
return (0);
return (rc);
}
void
{
}
{
/* Allocate an RXQ object */
goto fail1;
}
goto fail2;
enp->en_rx_qcount++;
return (0);
return (rc);
}
void
{
}
{
}
{
}
#endif /* EFSYS_OPT_RX_SCALE */
#if EFSYS_OPT_SIENA
static __checkReturn efx_rc_t
{
unsigned int index;
/* Zero the RSS table */
index++) {
}
/* The RSS key and indirection table are writable. */
#endif /* EFSYS_OPT_RX_SCALE */
return (0);
}
static __checkReturn efx_rc_t
{
unsigned int nbuf32;
if ((nbuf32 == 0) ||
((buf_size % 32) != 0)) {
goto fail1;
}
if (enp->en_rx_qcount > 0) {
goto fail2;
}
/* Set scatter buffer size */
/* Enable scatter for packets not matching a filter */
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCATTER */
do { \
efx_oword_t oword; \
\
(_insert) ? 1 : 0); \
\
&oword); \
&oword); \
} \
\
} while (B_FALSE)
do { \
efx_oword_t oword; \
\
(_ip) ? 1 : 0); \
(_tcp) ? 0 : 1); \
(_insert) ? 1 : 0); \
\
} while (B_FALSE)
do { \
efx_oword_t oword; \
\
\
(_rc) = 0; \
\
} while (B_FALSE)
static __checkReturn efx_rc_t
{
switch (alg) {
case EFX_RX_HASHALG_LFSR:
break;
case EFX_RX_HASHALG_TOEPLITZ:
rc);
if (rc != 0)
goto fail1;
break;
default:
goto fail2;
}
return (0);
return (rc);
}
#endif
static __checkReturn efx_rc_t
{
unsigned int byte;
unsigned int offset;
byte = 0;
/* Write Toeplitz IPv4 hash key */
--offset)
byte = 0;
/* Verify Toeplitz IPv4 hash key */
--offset) {
goto fail1;
}
}
goto done;
byte = 0;
/* Write Toeplitz IPv6 hash key 3 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN +
--offset)
/* Write Toeplitz IPv6 hash key 2 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_MID_LBN +
--offset)
/* Write Toeplitz IPv6 hash key 1 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_LO_LBN +
--offset)
byte = 0;
/* Verify Toeplitz IPv6 hash key 3 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN +
--offset) {
goto fail2;
}
}
/* Verify Toeplitz IPv6 hash key 2 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_MID_LBN +
--offset) {
goto fail3;
}
}
/* Verify Toeplitz IPv6 hash key 1 */
for (offset = (FRF_CZ_RX_RSS_IPV6_TKEY_LO_LBN +
--offset) {
goto fail4;
}
}
done:
return (0);
return (rc);
}
#endif
static __checkReturn efx_rc_t
__in_ecount(n) unsigned int *table,
{
int index;
if (n > FR_BZ_RX_INDIRECTION_TBL_ROWS) {
goto fail1;
}
/* Calculate the entry to place in the table */
/* Write the table */
}
/* Determine if we're starting a new batch */
/* Read the table */
/* Verify the entry */
goto fail2;
}
}
return (0);
return (rc);
}
#endif
/*
* --------------------------
*
* Receive packets are prefixed by an optional 16 byte pseudo-header.
* The psuedo-header is a byte array of one of the forms:
*
* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
* xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.TT.TT.TT.TT
* xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.xx.LL.LL
*
* where:
* TT.TT.TT.TT Toeplitz hash (32-bit big-endian)
* LL.LL LFSR hash (16-bit big-endian)
*/
static __checkReturn uint32_t
{
switch (func) {
case EFX_RX_HASHALG_TOEPLITZ:
buffer[15]);
case EFX_RX_HASHALG_LFSR:
default:
EFSYS_ASSERT(0);
return (0);
}
}
#endif /* EFSYS_OPT_RX_SCALE */
static __checkReturn efx_rc_t
{
EFSYS_ASSERT(0);
return (ENOTSUP);
}
static void
__in unsigned int n,
{
unsigned int i;
unsigned int offset;
unsigned int id;
/* The client driver must not overfill the queue */
for (i = 0; i < n; i++) {
}
}
static void
{
/* All descriptors are pushed */
/* Push the populated descriptors out */
/* Only write the third DWORD */
/* Guarantee ordering of memory (descriptors) and PIO (doorbell) */
}
static __checkReturn efx_rc_t
{
/* Flush the queue */
return (0);
}
static void
{
}
static __checkReturn efx_rc_t
{
(1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH));
goto fail1;
}
goto fail2;
}
size++)
break;
goto fail3;
}
switch (type) {
case EFX_RXQ_TYPE_DEFAULT:
break;
case EFX_RXQ_TYPE_SCATTER:
goto fail4;
}
break;
#endif /* EFSYS_OPT_RX_SCATTER */
default:
goto fail4;
}
/* Set up the new descriptor queue */
return (0);
return (rc);
}
static void
{
--enp->en_rx_qcount;
/* Purge descriptor queue */
/* Free the RXQ object */
}
static void
{
}
#endif /* EFSYS_OPT_SIENA */