/*
* Copyright (c) 2012-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"
static __checkReturn efx_rc_t
{
int i;
/* If this changes, then the payload size might need to change. */
EFSYS_ASSERT3U(MC_CMD_INIT_RXQ_OUT_LEN, ==, 0);
for (i = 0; i < npages; i++) {
dma_addr++;
addr += EFX_BUF_SIZE;
}
goto fail1;
}
return (0);
return (rc);
}
static __checkReturn efx_rc_t
{
goto fail1;
}
return (0);
return (rc);
}
static __checkReturn efx_rc_t
{
if (num_queues > EFX_MAXRSS) {
goto fail1;
}
switch (scale_support) {
case EFX_RX_SCALE_EXCLUSIVE:
break;
case EFX_RX_SCALE_SHARED:
break;
default:
goto fail2;
}
/* NUM_QUEUES is only used to validate indirection table offsets */
goto fail3;
}
goto fail4;
}
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
goto fail5;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
static efx_rc_t
{
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
goto fail1;
}
goto fail2;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
static efx_rc_t
{
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
goto fail1;
}
goto fail2;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
static efx_rc_t
{
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
goto fail1;
}
if (n != MC_CMD_RSS_CONTEXT_SET_KEY_IN_TOEPLITZ_KEY_LEN) {
goto fail2;
}
goto fail3;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
static efx_rc_t
__in_ecount(n) unsigned int *table,
{
int i, rc;
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
goto fail1;
}
for (i = 0;
i++) {
}
goto fail2;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
{
&enp->en_rss_context) == 0) {
/*
* Allocated an exclusive RSS context, which allows both the
* indirection table and key to be modified.
*/
} else {
/*
* Failed to allocate an exclusive RSS context. Continue
* operation without support for RSS. The pseudo-header in
* received packets will not contain a Toeplitz hash value.
*/
}
#endif /* EFSYS_OPT_RX_SCALE */
return (0);
}
{
return (0);
}
#endif /* EFSYS_OPT_RX_SCATTER */
{
goto fail1;
}
goto fail2;
}
goto fail3;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
{
goto fail1;
}
goto fail2;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
__in_ecount(n) unsigned int *table,
{
goto fail1;
}
goto fail2;
return (0);
return (rc);
}
#endif /* EFSYS_OPT_RX_SCALE */
/*
* EF10 RX pseudo-header
* ---------------------
*
* Receive packets are prefixed by an (optional) 14 byte pseudo-header:
*
* +00: Toeplitz hash value.
* (32bit little-endian)
* +04: Outer VLAN tag. Zero if the packet did not have an outer VLAN tag.
* (16bit big-endian)
* +06: Inner VLAN tag. Zero if the packet did not have an inner VLAN tag.
* (16bit big-endian)
* +08: Packet Length. Zero if the RX datapath was in cut-through mode.
* (16bit little-endian)
* +10: MAC timestamp. Zero if timestamping is not enabled.
* (32bit little-endian)
*
* See "The RX Pseudo-header" in SF-109306-TC.
*/
{
/*
* The RX pseudo-header contains the packet length, excluding the
* pseudo-header. If the hardware receive datapath was operating in
* cut-through mode then the length in the RX pseudo-header will be
* zero, and the packet length must be obtained from the DMA length
* reported in the RX event.
*/
return (0);
}
{
switch (func) {
case EFX_RX_HASHALG_TOEPLITZ:
return (buffer[0] |
default:
EFSYS_ASSERT(0);
return (0);
}
}
#endif /* EFSYS_OPT_RX_SCALE */
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++) {
}
}
void
{
/* Hardware has alignment restriction for WPTR */
return;
/* Push the populated descriptors out */
/* Guarantee ordering of memory (descriptors) and PIO (doorbell) */
}
{
goto fail1;
return (0);
return (rc);
}
void
{
/* FIXME */
/* FIXME */
}
{
goto fail1;
}
goto fail2;
}
/* Scatter can only be disabled if the firmware supports doing so */
if ((type != EFX_RXQ_TYPE_SCATTER) &&
} else {
}
esmp, disable_scatter)) != 0)
goto fail3;
return (0);
return (rc);
}
void
{
--enp->en_rx_qcount;
}
void
{
}
enp->en_rss_context = 0;
#else
#endif /* EFSYS_OPT_RX_SCALE */
}
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */