/*
* 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"
#include "mcdi_mon.h"
#endif
#if EFSYS_OPT_QSTATS
do { \
} while (B_FALSE)
#else
#endif
static __checkReturn boolean_t
static __checkReturn boolean_t
static __checkReturn boolean_t
static __checkReturn boolean_t
static __checkReturn boolean_t
static __checkReturn efx_rc_t
{
int npages;
int i;
int supports_rx_batching;
goto fail1;
}
/*
* On Huntington RX and TX event batching can only be requested
* together (even if the datapath firmware doesn't actually support RX
* batching).
* Cut through is incompatible with RX batching and so enabling cut
* through disables RX batching (but it does not affect TX batching).
*
* So always enable RX and TX event batching, and enable cut through
* if RX event batching isn't supported (i.e. on low latency firmware).
*/
for (i = 0; i < npages; i++) {
dma_addr++;
addr += EFX_BUF_SIZE;
}
goto fail2;
}
goto fail3;
}
return (0);
return (rc);
}
static __checkReturn efx_rc_t
{
goto fail1;
}
return (0);
return (rc);
}
{
return (0);
}
void
{
}
{
goto fail1;
}
goto fail2;
}
/* Set up the handler table */
/*
* Set up the event queue
* NOTE: ignore the returned IRQ param as firmware does not set it.
*/
goto fail3;
return (0);
return (rc);
}
void
{
}
{
(1 << ERF_DD_EVQ_IND_RPTR_WIDTH));
(rptr >> ERF_DD_EVQ_IND_RPTR_WIDTH));
} else {
}
return (0);
}
static __checkReturn efx_rc_t
{
goto fail1;
}
return (0);
return (rc);
}
void
{
}
{
goto fail1;
}
/* If the value is zero then disable the timer */
if (us == 0) {
timer_val = 0;
} else {
/* Calculate the timer value in quanta */
/* Moderation value is base 0 so we need to deduct 1 */
if (timer_val > 0)
timer_val--;
}
if (encp->enc_bug35388_workaround) {
} else {
}
return (0);
return (rc);
}
#if EFSYS_OPT_QSTATS
void
{
unsigned int id;
}
}
#endif /* EFSYS_OPT_QSTATS */
static __checkReturn boolean_t
{
unsigned int desc_count;
unsigned int last_used_id;
return (B_FALSE);
/* Basic packet information */
/* Drop this event */
return (B_FALSE);
}
flags = 0;
if (cont != 0) {
/*
* This may be part of a scattered frame, or it may be a
* truncated frame if scatter is disabled on this RXQ.
* Overlength frames can be received if e.g. a VF is configured
* for 1500 MTU but connected to a port set to 9000 MTU
* (see bug56567).
* FIXME: There is not yet any driver that supports scatter on
* Huntington. Scatter support is required for OSX.
*/
flags |= EFX_PKT_CONT;
}
if (mac_class == ESE_DZ_MAC_CLASS_UCAST)
flags |= EFX_PKT_UNICAST;
/* Increment the count of descriptors read */
/*
* FIXME: add error checking to make sure this a batched event.
* This could also be an aborted scatter, see Bug36629.
*/
if (desc_count > 1) {
}
/* Calculate the index of the the last descriptor consumed */
/* RX frame truncated (error flag is misnamed) */
flags |= EFX_DISCARD;
goto deliver;
}
/* Bad Ethernet frame CRC */
flags |= EFX_DISCARD;
goto deliver;
}
/*
* Hardware parse failed, due to malformed headers
* or headers that are too long for the parser.
* Headers and checksums must be validated by the host.
*/
// TODO: EFX_EV_QSTAT_INCR(eep, EV_RX_PARSE_INCOMPLETE);
goto deliver;
}
if ((eth_tag_class == ESE_DZ_ETH_TAG_CLASS_VLAN1) ||
}
switch (l3_class) {
case ESE_DZ_L3_CLASS_IP4:
case ESE_DZ_L3_CLASS_IP4_FRAG:
flags |= EFX_PKT_IPV4;
} else {
flags |= EFX_CKSUM_IPV4;
}
if (l4_class == ESE_DZ_L4_CLASS_TCP) {
flags |= EFX_PKT_TCP;
} else if (l4_class == ESE_DZ_L4_CLASS_UDP) {
flags |= EFX_PKT_UDP;
} else {
}
break;
case ESE_DZ_L3_CLASS_IP6:
case ESE_DZ_L3_CLASS_IP6_FRAG:
flags |= EFX_PKT_IPV6;
if (l4_class == ESE_DZ_L4_CLASS_TCP) {
flags |= EFX_PKT_TCP;
} else if (l4_class == ESE_DZ_L4_CLASS_UDP) {
flags |= EFX_PKT_UDP;
} else {
}
break;
default:
break;
}
} else {
}
}
/* If we're not discarding the packet then it is ok */
if (~flags & EFX_DISCARD)
return (should_abort);
}
static __checkReturn boolean_t
{
return (B_FALSE);
/* Drop this event */
return (B_FALSE);
}
return (should_abort);
}
static __checkReturn boolean_t
{
unsigned int code;
switch (code) {
case ESE_DZ_DRV_TIMER_EV: {
break;
}
case ESE_DZ_DRV_WAKE_UP_EV: {
break;
}
case ESE_DZ_DRV_START_UP_EV:
break;
default:
break;
}
return (should_abort);
}
static __checkReturn boolean_t
{
return (B_TRUE);
}
return (should_abort);
}
static __checkReturn boolean_t
{
unsigned code;
switch (code) {
case MCDI_EVENT_CODE_BADSSERT:
break;
case MCDI_EVENT_CODE_CMDDONE:
break;
/*
* This event notifies a function that an authorization request
* has been processed. If the request was authorized then the
* function can now re-send the original MCDI request.
* See SF-113652-SW "SR-IOV Proxied Network Access Control".
*/
break;
#endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
case MCDI_EVENT_CODE_LINKCHANGE: {
break;
}
case MCDI_EVENT_CODE_SENSOREVT: {
/* Decode monitor stat for MCDI sensor (if supported) */
/* Report monitor stat change */
} else {
}
#endif
break;
}
case MCDI_EVENT_CODE_SCHEDERR:
/* Informational only */
break;
case MCDI_EVENT_CODE_REBOOT:
break;
/* MC_REBOOT event is used for Huntington (EF10) and later. */
break;
}
#endif
break;
case MCDI_EVENT_CODE_FWALERT: {
else
break;
}
case MCDI_EVENT_CODE_TX_ERR: {
/*
* After a TXQ error is detected, firmware sends a TX_ERR event.
* This may be followed by TX completions (which we discard),
* and then finally by a TX_FLUSH event. Firmware destroys the
* TXQ automatically after sending the TX_FLUSH event.
*/
/* Inform the driver that a reset is required. */
break;
}
case MCDI_EVENT_CODE_TX_FLUSH: {
/*
* EF10 firmware sends two TX_FLUSH events: one to the txq's
* event queue, and one to evq 0 (with TX_FLUSH_TO_DRIVER set).
* We want to wait for all completions, so ignore the events
* with TX_FLUSH_TO_DRIVER.
*/
break;
}
break;
}
case MCDI_EVENT_CODE_RX_ERR: {
/*
* After an RXQ error is detected, firmware sends an RX_ERR
* event. This may be followed by RX events (which we discard),
* and then finally by an RX_FLUSH event. Firmware destroys the
* RXQ automatically after sending the RX_FLUSH event.
*/
/* Inform the driver that a reset is required. */
break;
}
case MCDI_EVENT_CODE_RX_FLUSH: {
/*
* EF10 firmware sends two RX_FLUSH events: one to the rxq's
* event queue, and one to evq 0 (with RX_FLUSH_TO_DRIVER set).
* We want to wait for all completions, so ignore the events
* with RX_FLUSH_TO_DRIVER.
*/
break;
}
break;
}
default:
break;
}
return (should_abort);
}
void
{
eersp->eers_rx_read_ptr = 0;
}
void
{
eersp->eers_rx_read_ptr = 0;
eersp->eers_rx_mask = 0;
}
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */