/*
* 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"
#if EFSYS_OPT_QSTATS
do { \
} while (B_FALSE)
#else
#endif
static __checkReturn efx_rc_t
{
int npages;
int i;
if (npages > MC_CMD_INIT_TXQ_IN_DMA_ADDR_MAXNUM) {
goto fail1;
}
for (i = 0; i < npages; i++) {
dma_addr++;
addr += EFX_BUF_SIZE;
}
goto fail2;
}
return (0);
return (rc);
}
static __checkReturn efx_rc_t
{
goto fail1;
}
return (0);
return (rc);
}
{
return (0);
}
void
{
}
{
esmp)) != 0)
goto fail1;
/*
* A previous user of this TX queue may have written a descriptor to the
* TX push collector, but not pushed the doorbell (e.g. after a crash).
* The next doorbell write would then push the stale descriptor.
*
* Ensure the (per network port) TX push collector is cleared by writing
* a no-op TX option descriptor. See bug29981 for details.
*/
*addedp = 1;
return (0);
return (rc);
}
void
{
/* FIXME */
/* FIXME */
}
{
if (etp->et_pio_size != 0) {
goto fail1;
}
/* Sub-allocate a PIO block from a piobuf */
&etp->et_pio_bufnum,
&handle,
&etp->et_pio_blknum,
&etp->et_pio_offset,
&etp->et_pio_size)) != 0) {
goto fail2;
}
/* Link the piobuf to this TXQ */
goto fail3;
}
/*
* et_pio_offset is the offset of the sub-allocated block within the
* hardware PIO buffer. It is used as the buffer address in the PIO
* option descriptor.
*
* et_pio_write_offset is the offset of the sub-allocated block from the
* start of the write-combined memory mapping, and is used for writing
* data into the PIO buffer.
*/
return (0);
etp->et_pio_size = 0;
return (rc);
}
void
{
if (etp->et_pio_size != 0) {
/* Unlink the piobuf from this TXQ */
/* Free the sub-allocated PIO block */
etp->et_pio_blknum);
etp->et_pio_size = 0;
etp->et_pio_write_offset = 0;
}
}
{
if (etp->et_pio_size == 0) {
goto fail1;
}
goto fail2;
}
/*
* Writes to PIO buffers must be 64 bit aligned, and multiples of
* 64 bits.
*/
while (write_offset < write_offset_limit) {
eqp++;
write_offset += sizeof (efx_qword_t);
}
return (0);
return (rc);
}
{
unsigned int id;
goto fail1;
}
if (etp->et_pio_size == 0) {
goto fail2;
}
size_t, pkt_length);
return (0);
return (rc);
}
__in unsigned int n,
{
unsigned int i;
goto fail1;
}
for (i = 0; i < n; i++) {
unsigned int id;
/* Fragments must not span 4k boundaries. */
}
return (0);
return (rc);
}
/*
* This improves performance by pushing a TX descriptor at the same time as the
* doorbell. The descriptor must be added to the TXQ, so that can be used if the
* hardware decides not to use the pushed descriptor.
*/
void
{
unsigned int wptr;
unsigned int id;
/* Guarantee ordering of memory (descriptors) and PIO (doorbell) */
&oword);
}
__in unsigned int n,
{
unsigned int i;
goto fail1;
}
for (i = 0; i < n; i++) {
unsigned int id;
}
unsigned int, added, unsigned int, n);
return (0);
return (rc);
}
void
{
/* Fragments must not span 4k boundaries. */
}
void
{
}
void
{
}
void
{
}
{
/* FIXME */
if (B_FALSE) {
goto fail1;
}
/* FIXME */
return (0);
return (rc);
}
{
goto fail1;
return (0);
return (rc);
}
void
{
/* FIXME */
/* FIXME */
}
#if EFSYS_OPT_QSTATS
void
{
unsigned int id;
}
}
#endif /* EFSYS_OPT_QSTATS */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */