summaryrefslogtreecommitdiffstats
path: root/sys/dev/sfxge/common/hunt_ev.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sfxge/common/hunt_ev.c')
-rw-r--r--sys/dev/sfxge/common/hunt_ev.c128
1 files changed, 71 insertions, 57 deletions
diff --git a/sys/dev/sfxge/common/hunt_ev.c b/sys/dev/sfxge/common/hunt_ev.c
index 8e5cf89..2cea2e0 100644
--- a/sys/dev/sfxge/common/hunt_ev.c
+++ b/sys/dev/sfxge/common/hunt_ev.c
@@ -31,10 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "efsys.h"
#include "efx.h"
-#include "efx_types.h"
-#include "efx_regs.h"
#include "efx_impl.h"
#if EFSYS_OPT_MON_STATS
#include "mcdi_mon.h"
@@ -54,42 +51,42 @@ __FBSDID("$FreeBSD$");
static __checkReturn boolean_t
-hunt_ev_rx(
+ef10_ev_rx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
static __checkReturn boolean_t
-hunt_ev_tx(
+ef10_ev_tx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
static __checkReturn boolean_t
-hunt_ev_driver(
+ef10_ev_driver(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
static __checkReturn boolean_t
-hunt_ev_drv_gen(
+ef10_ev_drv_gen(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
static __checkReturn boolean_t
-hunt_ev_mcdi(
+ef10_ev_mcdi(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
__in_opt void *arg);
-static __checkReturn int
+static __checkReturn efx_rc_t
efx_mcdi_init_evq(
__in efx_nic_t *enp,
__in unsigned int instance,
@@ -107,7 +104,7 @@ efx_mcdi_init_evq(
int npages;
int i;
int supports_rx_batching;
- int rc;
+ efx_rc_t rc;
npages = EFX_EVQ_NBUFS(nevs);
if (MC_CMD_INIT_EVQ_IN_LEN(npages) > MC_CMD_INIT_EVQ_IN_LENMAX) {
@@ -188,12 +185,12 @@ fail3:
fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
-static __checkReturn int
+static __checkReturn efx_rc_t
efx_mcdi_fini_evq(
__in efx_nic_t *enp,
__in uint32_t instance)
@@ -201,7 +198,7 @@ efx_mcdi_fini_evq(
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_FINI_EVQ_IN_LEN,
MC_CMD_FINI_EVQ_OUT_LEN)];
- int rc;
+ efx_rc_t rc;
(void) memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FINI_EVQ;
@@ -222,15 +219,15 @@ efx_mcdi_fini_evq(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
- __checkReturn int
-hunt_ev_init(
+ __checkReturn efx_rc_t
+ef10_ev_init(
__in efx_nic_t *enp)
{
_NOTE(ARGUNUSED(enp))
@@ -238,14 +235,14 @@ hunt_ev_init(
}
void
-hunt_ev_fini(
+ef10_ev_fini(
__in efx_nic_t *enp)
{
_NOTE(ARGUNUSED(enp))
}
- __checkReturn int
-hunt_ev_qcreate(
+ __checkReturn efx_rc_t
+ef10_ev_qcreate(
__in efx_nic_t *enp,
__in unsigned int index,
__in efsys_mem_t *esmp,
@@ -255,7 +252,7 @@ hunt_ev_qcreate(
{
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
uint32_t irq;
- int rc;
+ efx_rc_t rc;
_NOTE(ARGUNUSED(id)) /* buftbl id managed by MC */
EFX_STATIC_ASSERT(ISP2(EFX_EVQ_MAXNEVS));
@@ -272,11 +269,11 @@ hunt_ev_qcreate(
}
/* Set up the handler table */
- eep->ee_rx = hunt_ev_rx;
- eep->ee_tx = hunt_ev_tx;
- eep->ee_driver = hunt_ev_driver;
- eep->ee_drv_gen = hunt_ev_drv_gen;
- eep->ee_mcdi = hunt_ev_mcdi;
+ eep->ee_rx = ef10_ev_rx;
+ eep->ee_tx = ef10_ev_tx;
+ eep->ee_driver = ef10_ev_driver;
+ eep->ee_drv_gen = ef10_ev_drv_gen;
+ eep->ee_mcdi = ef10_ev_mcdi;
/*
* Set up the event queue
@@ -293,24 +290,25 @@ fail3:
fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
void
-hunt_ev_qdestroy(
+ef10_ev_qdestroy(
__in efx_evq_t *eep)
{
efx_nic_t *enp = eep->ee_enp;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
(void) efx_mcdi_fini_evq(eep->ee_enp, eep->ee_index);
}
- __checkReturn int
-hunt_ev_qprime(
+ __checkReturn efx_rc_t
+ef10_ev_qprime(
__in efx_evq_t *eep,
__in unsigned int count)
{
@@ -350,7 +348,7 @@ hunt_ev_qprime(
return (0);
}
-static __checkReturn int
+static __checkReturn efx_rc_t
efx_mcdi_driver_event(
__in efx_nic_t *enp,
__in uint32_t evq,
@@ -359,7 +357,7 @@ efx_mcdi_driver_event(
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_DRIVER_EVENT_IN_LEN,
MC_CMD_DRIVER_EVENT_OUT_LEN)];
- int rc;
+ efx_rc_t rc;
req.emr_cmd = MC_CMD_DRIVER_EVENT;
req.emr_in_buf = payload;
@@ -384,13 +382,13 @@ efx_mcdi_driver_event(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
void
-hunt_ev_qpost(
+ef10_ev_qpost(
__in efx_evq_t *eep,
__in uint16_t data)
{
@@ -405,8 +403,8 @@ hunt_ev_qpost(
(void) efx_mcdi_driver_event(enp, eep->ee_index, event);
}
- __checkReturn int
-hunt_ev_qmoderate(
+ __checkReturn efx_rc_t
+ef10_ev_qmoderate(
__in efx_evq_t *eep,
__in unsigned int us)
{
@@ -414,7 +412,7 @@ hunt_ev_qmoderate(
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_dword_t dword;
uint32_t timer_val, mode;
- int rc;
+ efx_rc_t rc;
if (us > encp->enc_evq_timer_max_us) {
rc = EINVAL;
@@ -455,7 +453,7 @@ hunt_ev_qmoderate(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
@@ -463,14 +461,10 @@ fail1:
#if EFSYS_OPT_QSTATS
void
-hunt_ev_qstats_update(
+ef10_ev_qstats_update(
__in efx_evq_t *eep,
__inout_ecount(EV_NQSTATS) efsys_stat_t *stat)
{
- /*
- * TBD: Consider a common Siena/Huntington function. The code is
- * essentially identical.
- */
unsigned int id;
for (id = 0; id < EV_NQSTATS; id++) {
@@ -484,7 +478,7 @@ hunt_ev_qstats_update(
static __checkReturn boolean_t
-hunt_ev_rx(
+ef10_ev_rx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -492,7 +486,9 @@ hunt_ev_rx(
{
efx_nic_t *enp = eep->ee_enp;
uint32_t size;
+#if 0
boolean_t parse_err;
+#endif
uint32_t label;
uint32_t mcast;
uint32_t eth_base_class;
@@ -500,7 +496,6 @@ hunt_ev_rx(
uint32_t l3_class;
uint32_t l4_class;
uint32_t next_read_lbits;
- boolean_t soft1, soft2;
uint16_t flags;
boolean_t should_abort;
efx_evq_rxq_state_t *eersp;
@@ -528,14 +523,21 @@ hunt_ev_rx(
if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_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.
*/
- EFSYS_ASSERT(0);
flags |= EFX_PKT_CONT;
}
+#if 0
+ /* TODO What to do if the packet is flagged with parsing error */
parse_err = (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_PARSE_INCOMPLETE) != 0);
+#endif
label = EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_QLABEL);
if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_ECRC_ERR) != 0) {
@@ -555,10 +557,6 @@ hunt_ev_rx(
flags |= EFX_DISCARD;
}
- /* FIXME: do we need soft bits from RXDP firmware ? */
- soft1 = (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_EV_SOFT1) != 0);
- soft2 = (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_EV_SOFT2) != 0);
-
mcast = EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_MAC_CLASS);
if (mcast == ESE_DZ_MAC_CLASS_UCAST)
flags |= EFX_PKT_UNICAST;
@@ -619,7 +617,9 @@ hunt_ev_rx(
switch (l3_class) {
case ESE_DZ_L3_CLASS_RSVD7: /* Used by firmware for packet overrun */
+#if 0
parse_err = B_TRUE;
+#endif
flags |= EFX_DISCARD;
break;
@@ -680,7 +680,7 @@ hunt_ev_rx(
}
static __checkReturn boolean_t
-hunt_ev_tx(
+ef10_ev_tx(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -715,7 +715,7 @@ hunt_ev_tx(
}
static __checkReturn boolean_t
-hunt_ev_driver(
+ef10_ev_driver(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -765,7 +765,7 @@ hunt_ev_driver(
}
static __checkReturn boolean_t
-hunt_ev_drv_gen(
+ef10_ev_drv_gen(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -793,7 +793,7 @@ hunt_ev_drv_gen(
}
static __checkReturn boolean_t
-hunt_ev_mcdi(
+ef10_ev_mcdi(
__in efx_evq_t *eep,
__in efx_qword_t *eqp,
__in const efx_ev_callbacks_t *eecp,
@@ -818,6 +818,20 @@ hunt_ev_mcdi(
MCDI_EV_FIELD(eqp, CMDDONE_ERRNO));
break;
+#if EFSYS_OPT_MCDI_PROXY_AUTH
+ case MCDI_EVENT_CODE_PROXY_RESPONSE:
+ /*
+ * 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".
+ */
+ efx_mcdi_ev_proxy_response(enp,
+ MCDI_EV_FIELD(eqp, PROXY_RESPONSE_HANDLE),
+ MCDI_EV_FIELD(eqp, PROXY_RESPONSE_RC));
+ break;
+#endif /* EFSYS_OPT_MCDI_PROXY_AUTH */
+
case MCDI_EVENT_CODE_LINKCHANGE: {
efx_link_mode_t link_mode;
@@ -830,7 +844,7 @@ hunt_ev_mcdi(
#if EFSYS_OPT_MON_STATS
efx_mon_stat_t id;
efx_mon_stat_value_t value;
- int rc;
+ efx_rc_t rc;
/* Decode monitor stat for MCDI sensor (if supported) */
if ((rc = mcdi_mon_ev(enp, eqp, &id, &value)) == 0) {
@@ -975,7 +989,7 @@ hunt_ev_mcdi(
}
void
-hunt_ev_rxlabel_init(
+ef10_ev_rxlabel_init(
__in efx_evq_t *eep,
__in efx_rxq_t *erp,
__in unsigned int label)
@@ -992,7 +1006,7 @@ hunt_ev_rxlabel_init(
}
void
-hunt_ev_rxlabel_fini(
+ef10_ev_rxlabel_fini(
__in efx_evq_t *eep,
__in unsigned int label)
{
OpenPOWER on IntegriCloud