summaryrefslogtreecommitdiffstats
path: root/sys/dev/sfxge/common/hunt_filter.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-15 08:36:46 -0200
committerRenato Botelho <renato@netgate.com>2016-01-15 08:36:46 -0200
commit5118afa75776a41209a94f4a4ddf7c3164fac0df (patch)
treea899f605d0f0d9be1fb44d7a8d643a1233065dda /sys/dev/sfxge/common/hunt_filter.c
parent58b7eab7d39d983cc70f6f1d611f00470a76fca1 (diff)
parentce58d6dbf38815b68dedcf0559779e5ceb149a0d (diff)
downloadFreeBSD-src-5118afa75776a41209a94f4a4ddf7c3164fac0df.zip
FreeBSD-src-5118afa75776a41209a94f4a4ddf7c3164fac0df.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/dev/sfxge/common/hunt_filter.c')
-rw-r--r--sys/dev/sfxge/common/hunt_filter.c462
1 files changed, 233 insertions, 229 deletions
diff --git a/sys/dev/sfxge/common/hunt_filter.c b/sys/dev/sfxge/common/hunt_filter.c
index 27af7c3..eaa0720 100644
--- a/sys/dev/sfxge/common/hunt_filter.c
+++ b/sys/dev/sfxge/common/hunt_filter.c
@@ -31,100 +31,98 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "efsys.h"
#include "efx.h"
-#include "efx_types.h"
-#include "efx_regs_mcdi.h"
#include "efx_impl.h"
#if EFSYS_OPT_HUNTINGTON
#if EFSYS_OPT_FILTER
-#define HFE_SPEC(hftp, index) ((hftp)->hft_entry[(index)].hfe_spec)
+#define EFE_SPEC(eftp, index) ((eftp)->eft_entry[(index)].efe_spec)
static efx_filter_spec_t *
-hunt_filter_entry_spec(
- __in const hunt_filter_table_t *hftp,
+ef10_filter_entry_spec(
+ __in const ef10_filter_table_t *eftp,
__in unsigned int index)
{
- return ((efx_filter_spec_t *)(HFE_SPEC(hftp, index) &
- ~(uintptr_t)EFX_HUNT_FILTER_FLAGS));
+ return ((efx_filter_spec_t *)(EFE_SPEC(eftp, index) &
+ ~(uintptr_t)EFX_EF10_FILTER_FLAGS));
}
static boolean_t
-hunt_filter_entry_is_busy(
- __in const hunt_filter_table_t *hftp,
+ef10_filter_entry_is_busy(
+ __in const ef10_filter_table_t *eftp,
__in unsigned int index)
{
- if (HFE_SPEC(hftp, index) & EFX_HUNT_FILTER_FLAG_BUSY)
+ if (EFE_SPEC(eftp, index) & EFX_EF10_FILTER_FLAG_BUSY)
return (B_TRUE);
else
return (B_FALSE);
}
static boolean_t
-hunt_filter_entry_is_auto_old(
- __in const hunt_filter_table_t *hftp,
+ef10_filter_entry_is_auto_old(
+ __in const ef10_filter_table_t *eftp,
__in unsigned int index)
{
- if (HFE_SPEC(hftp, index) & EFX_HUNT_FILTER_FLAG_AUTO_OLD)
+ if (EFE_SPEC(eftp, index) & EFX_EF10_FILTER_FLAG_AUTO_OLD)
return (B_TRUE);
else
return (B_FALSE);
}
static void
-hunt_filter_set_entry(
- __inout hunt_filter_table_t *hftp,
+ef10_filter_set_entry(
+ __inout ef10_filter_table_t *eftp,
__in unsigned int index,
__in_opt const efx_filter_spec_t *efsp)
{
- HFE_SPEC(hftp, index) = (uintptr_t)efsp;
+ EFE_SPEC(eftp, index) = (uintptr_t)efsp;
}
static void
-hunt_filter_set_entry_busy(
- __inout hunt_filter_table_t *hftp,
+ef10_filter_set_entry_busy(
+ __inout ef10_filter_table_t *eftp,
__in unsigned int index)
{
- HFE_SPEC(hftp, index) |= (uintptr_t)EFX_HUNT_FILTER_FLAG_BUSY;
+ EFE_SPEC(eftp, index) |= (uintptr_t)EFX_EF10_FILTER_FLAG_BUSY;
}
static void
-hunt_filter_set_entry_not_busy(
- __inout hunt_filter_table_t *hftp,
+ef10_filter_set_entry_not_busy(
+ __inout ef10_filter_table_t *eftp,
__in unsigned int index)
{
- HFE_SPEC(hftp, index) &= ~(uintptr_t)EFX_HUNT_FILTER_FLAG_BUSY;
+ EFE_SPEC(eftp, index) &= ~(uintptr_t)EFX_EF10_FILTER_FLAG_BUSY;
}
static void
-hunt_filter_set_entry_auto_old(
- __inout hunt_filter_table_t *hftp,
+ef10_filter_set_entry_auto_old(
+ __inout ef10_filter_table_t *eftp,
__in unsigned int index)
{
- EFSYS_ASSERT(hunt_filter_entry_spec(hftp, index) != NULL);
- HFE_SPEC(hftp, index) |= (uintptr_t)EFX_HUNT_FILTER_FLAG_AUTO_OLD;
+ EFSYS_ASSERT(ef10_filter_entry_spec(eftp, index) != NULL);
+ EFE_SPEC(eftp, index) |= (uintptr_t)EFX_EF10_FILTER_FLAG_AUTO_OLD;
}
static void
-hunt_filter_set_entry_not_auto_old(
- __inout hunt_filter_table_t *hftp,
+ef10_filter_set_entry_not_auto_old(
+ __inout ef10_filter_table_t *eftp,
__in unsigned int index)
{
- HFE_SPEC(hftp, index) &= ~(uintptr_t)EFX_HUNT_FILTER_FLAG_AUTO_OLD;
- EFSYS_ASSERT(hunt_filter_entry_spec(hftp, index) != NULL);
+ EFE_SPEC(eftp, index) &= ~(uintptr_t)EFX_EF10_FILTER_FLAG_AUTO_OLD;
+ EFSYS_ASSERT(ef10_filter_entry_spec(eftp, index) != NULL);
}
- __checkReturn int
-hunt_filter_init(
+ __checkReturn efx_rc_t
+ef10_filter_init(
__in efx_nic_t *enp)
{
- int rc;
- hunt_filter_table_t *hftp;
+ efx_rc_t rc;
+ ef10_filter_table_t *eftp;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
#define MATCH_MASK(match) (EFX_MASK32(match) << EFX_LOW_BIT(match))
EFX_STATIC_ASSERT(EFX_FILTER_MATCH_REM_HOST ==
@@ -149,47 +147,48 @@ hunt_filter_init(
MATCH_MASK(MC_CMD_FILTER_OP_IN_MATCH_IP_PROTO));
#undef MATCH_MASK
- EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (hunt_filter_table_t), hftp);
+ EFSYS_KMEM_ALLOC(enp->en_esip, sizeof (ef10_filter_table_t), eftp);
- if (!hftp) {
+ if (!eftp) {
rc = ENOMEM;
goto fail1;
}
- enp->en_filter.ef_hunt_filter_table = hftp;
+ enp->en_filter.ef_ef10_filter_table = eftp;
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
void
-hunt_filter_fini(
+ef10_filter_fini(
__in efx_nic_t *enp)
{
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
- if (enp->en_filter.ef_hunt_filter_table != NULL) {
- EFSYS_KMEM_FREE(enp->en_esip, sizeof (hunt_filter_table_t),
- enp->en_filter.ef_hunt_filter_table);
+ if (enp->en_filter.ef_ef10_filter_table != NULL) {
+ EFSYS_KMEM_FREE(enp->en_esip, sizeof (ef10_filter_table_t),
+ enp->en_filter.ef_ef10_filter_table);
}
}
-static __checkReturn int
+static __checkReturn efx_rc_t
efx_mcdi_filter_op_add(
__in efx_nic_t *enp,
__in efx_filter_spec_t *spec,
__in unsigned int filter_op,
- __inout hunt_filter_handle_t *handle)
+ __inout ef10_filter_handle_t *handle)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN,
MC_CMD_FILTER_OP_OUT_LEN)];
uint32_t match_fields = 0;
- int rc;
+ efx_rc_t rc;
memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FILTER_OP;
@@ -201,9 +200,9 @@ efx_mcdi_filter_op_add(
switch (filter_op) {
case MC_CMD_FILTER_OP_IN_OP_REPLACE:
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO,
- handle->hfh_lo);
+ handle->efh_lo);
MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI,
- handle->hfh_hi);
+ handle->efh_hi);
/* Fall through */
case MC_CMD_FILTER_OP_IN_OP_INSERT:
case MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE:
@@ -302,8 +301,8 @@ efx_mcdi_filter_op_add(
goto fail3;
}
- handle->hfh_lo = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_LO);
- handle->hfh_hi = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_HI);
+ handle->efh_lo = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_LO);
+ handle->efh_hi = MCDI_OUT_DWORD(req, FILTER_OP_OUT_HANDLE_HI);
return (0);
@@ -312,22 +311,22 @@ 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_filter_op_delete(
__in efx_nic_t *enp,
__in unsigned int filter_op,
- __inout hunt_filter_handle_t *handle)
+ __inout ef10_filter_handle_t *handle)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_FILTER_OP_IN_LEN,
MC_CMD_FILTER_OP_OUT_LEN)];
- int rc;
+ efx_rc_t rc;
memset(payload, 0, sizeof (payload));
req.emr_cmd = MC_CMD_FILTER_OP;
@@ -351,8 +350,8 @@ efx_mcdi_filter_op_delete(
goto fail1;
}
- MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->hfh_lo);
- MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->hfh_hi);
+ MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_LO, handle->efh_lo);
+ MCDI_IN_SET_DWORD(req, FILTER_OP_IN_HANDLE_HI, handle->efh_hi);
efx_mcdi_execute(enp, &req);
@@ -374,13 +373,13 @@ fail3:
fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
static __checkReturn boolean_t
-hunt_filter_equal(
+ef10_filter_equal(
__in const efx_filter_spec_t *left,
__in const efx_filter_spec_t *right)
{
@@ -413,7 +412,7 @@ hunt_filter_equal(
}
static __checkReturn boolean_t
-hunt_filter_same_dest(
+ef10_filter_same_dest(
__in const efx_filter_spec_t *left,
__in const efx_filter_spec_t *right)
{
@@ -430,7 +429,7 @@ hunt_filter_same_dest(
}
static __checkReturn uint32_t
-hunt_filter_hash(
+ef10_filter_hash(
__in efx_filter_spec_t *spec)
{
EFX_STATIC_ASSERT((sizeof (efx_filter_spec_t) % sizeof (uint32_t))
@@ -456,7 +455,7 @@ hunt_filter_hash(
* exclusive.
*/
static __checkReturn boolean_t
-hunt_filter_is_exclusive(
+ef10_filter_is_exclusive(
__in efx_filter_spec_t *spec)
{
if ((spec->efs_match_flags & EFX_FILTER_MATCH_LOC_MAC) &&
@@ -477,31 +476,32 @@ hunt_filter_is_exclusive(
return (B_FALSE);
}
- __checkReturn int
-hunt_filter_restore(
+ __checkReturn efx_rc_t
+ef10_filter_restore(
__in efx_nic_t *enp)
{
int tbl_id;
efx_filter_spec_t *spec;
- hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
boolean_t restoring;
int state;
- int rc;
+ efx_rc_t rc;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
- for (tbl_id = 0; tbl_id < EFX_HUNT_FILTER_TBL_ROWS; tbl_id++) {
+ for (tbl_id = 0; tbl_id < EFX_EF10_FILTER_TBL_ROWS; tbl_id++) {
EFSYS_LOCK(enp->en_eslp, state);
- spec = hunt_filter_entry_spec(hftp, tbl_id);
+ spec = ef10_filter_entry_spec(eftp, tbl_id);
if (spec == NULL) {
restoring = B_FALSE;
- } else if (hunt_filter_entry_is_busy(hftp, tbl_id)) {
+ } else if (ef10_filter_entry_is_busy(eftp, tbl_id)) {
/* Ignore busy entries. */
restoring = B_FALSE;
} else {
- hunt_filter_set_entry_busy(hftp, tbl_id);
+ ef10_filter_set_entry_busy(eftp, tbl_id);
restoring = B_TRUE;
}
@@ -510,14 +510,14 @@ hunt_filter_restore(
if (restoring == B_FALSE)
continue;
- if (hunt_filter_is_exclusive(spec)) {
+ if (ef10_filter_is_exclusive(spec)) {
rc = efx_mcdi_filter_op_add(enp, spec,
MC_CMD_FILTER_OP_IN_OP_INSERT,
- &hftp->hft_entry[tbl_id].hfe_handle);
+ &eftp->eft_entry[tbl_id].efe_handle);
} else {
rc = efx_mcdi_filter_op_add(enp, spec,
MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE,
- &hftp->hft_entry[tbl_id].hfe_handle);
+ &eftp->eft_entry[tbl_id].efe_handle);
}
if (rc != 0)
@@ -525,7 +525,7 @@ hunt_filter_restore(
EFSYS_LOCK(enp->en_eslp, state);
- hunt_filter_set_entry_not_busy(hftp, tbl_id);
+ ef10_filter_set_entry_not_busy(eftp, tbl_id);
EFSYS_UNLOCK(enp->en_eslp, state);
}
@@ -533,7 +533,7 @@ hunt_filter_restore(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
@@ -542,17 +542,17 @@ fail1:
* An arbitrary search limit for the software hash table. As per the linux net
* driver.
*/
-#define EFX_HUNT_FILTER_SEARCH_LIMIT 200
+#define EF10_FILTER_SEARCH_LIMIT 200
-static __checkReturn int
-hunt_filter_add_internal(
+static __checkReturn efx_rc_t
+ef10_filter_add_internal(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec,
__in boolean_t may_replace,
__out_opt uint32_t *filter_id)
{
- int rc;
- hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table;
+ efx_rc_t rc;
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t *saved_spec;
uint32_t hash;
unsigned int depth;
@@ -562,13 +562,14 @@ hunt_filter_add_internal(
int state;
boolean_t locked = B_FALSE;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
#if EFSYS_OPT_RX_SCALE
spec->efs_rss_context = enp->en_rss_context;
#endif
- hash = hunt_filter_hash(spec);
+ hash = ef10_filter_hash(spec);
/*
* FIXME: Add support for inserting filters of different priorities
@@ -587,21 +588,21 @@ hunt_filter_add_internal(
locked = B_TRUE;
for (;;) {
- i = (hash + depth) & (EFX_HUNT_FILTER_TBL_ROWS - 1);
- saved_spec = hunt_filter_entry_spec(hftp, i);
+ i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1);
+ saved_spec = ef10_filter_entry_spec(eftp, i);
if (!saved_spec) {
if (ins_index < 0) {
ins_index = i;
}
- } else if (hunt_filter_equal(spec, saved_spec)) {
- if (hunt_filter_entry_is_busy(hftp, i))
+ } else if (ef10_filter_equal(spec, saved_spec)) {
+ if (ef10_filter_entry_is_busy(eftp, i))
break;
if (saved_spec->efs_priority
== EFX_FILTER_PRI_AUTO) {
ins_index = i;
goto found;
- } else if (hunt_filter_is_exclusive(spec)) {
+ } else if (ef10_filter_is_exclusive(spec)) {
if (may_replace) {
ins_index = i;
goto found;
@@ -619,7 +620,7 @@ hunt_filter_add_internal(
* the first suitable slot or return EBUSY if
* there was none.
*/
- if (depth == EFX_HUNT_FILTER_SEARCH_LIMIT) {
+ if (depth == EF10_FILTER_SEARCH_LIMIT) {
if (ins_index < 0) {
rc = EBUSY;
goto fail2;
@@ -639,11 +640,11 @@ found:
* insert a conflicting filter while we're waiting for the
* firmware must find the busy entry.
*/
- saved_spec = hunt_filter_entry_spec(hftp, ins_index);
+ saved_spec = ef10_filter_entry_spec(eftp, ins_index);
if (saved_spec) {
if (saved_spec->efs_priority == EFX_FILTER_PRI_AUTO) {
/* This is a filter we are refreshing */
- hunt_filter_set_entry_not_auto_old(hftp, ins_index);
+ ef10_filter_set_entry_not_auto_old(eftp, ins_index);
goto out_unlock;
}
@@ -655,9 +656,9 @@ found:
goto fail3;
}
*saved_spec = *spec;
- hunt_filter_set_entry(hftp, ins_index, saved_spec);
+ ef10_filter_set_entry(eftp, ins_index, saved_spec);
}
- hunt_filter_set_entry_busy(hftp, ins_index);
+ ef10_filter_set_entry_busy(eftp, ins_index);
EFSYS_UNLOCK(enp->en_eslp, state);
locked = B_FALSE;
@@ -669,15 +670,15 @@ found:
if (replacing) {
rc = efx_mcdi_filter_op_add(enp, spec,
MC_CMD_FILTER_OP_IN_OP_REPLACE,
- &hftp->hft_entry[ins_index].hfe_handle);
- } else if (hunt_filter_is_exclusive(spec)) {
+ &eftp->eft_entry[ins_index].efe_handle);
+ } else if (ef10_filter_is_exclusive(spec)) {
rc = efx_mcdi_filter_op_add(enp, spec,
MC_CMD_FILTER_OP_IN_OP_INSERT,
- &hftp->hft_entry[ins_index].hfe_handle);
+ &eftp->eft_entry[ins_index].efe_handle);
} else {
rc = efx_mcdi_filter_op_add(enp, spec,
MC_CMD_FILTER_OP_IN_OP_SUBSCRIBE,
- &hftp->hft_entry[ins_index].hfe_handle);
+ &eftp->eft_entry[ins_index].efe_handle);
}
if (rc != 0)
@@ -694,7 +695,7 @@ found:
saved_spec->efs_dmaq_id = spec->efs_dmaq_id;
}
- hunt_filter_set_entry_not_busy(hftp, ins_index);
+ ef10_filter_set_entry_not_busy(eftp, ins_index);
out_unlock:
@@ -713,8 +714,8 @@ fail4:
EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), saved_spec);
saved_spec = NULL;
}
- hunt_filter_set_entry_not_busy(hftp, ins_index);
- hunt_filter_set_entry(hftp, ins_index, NULL);
+ ef10_filter_set_entry_not_busy(eftp, ins_index);
+ ef10_filter_set_entry(eftp, ins_index, NULL);
fail3:
EFSYS_PROBE(fail3);
@@ -723,7 +724,7 @@ fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
if (locked)
EFSYS_UNLOCK(enp->en_eslp, state);
@@ -731,37 +732,37 @@ fail1:
return (rc);
}
- __checkReturn int
-hunt_filter_add(
+ __checkReturn efx_rc_t
+ef10_filter_add(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec,
__in boolean_t may_replace)
{
- int rc;
+ efx_rc_t rc;
- rc = hunt_filter_add_internal(enp, spec, may_replace, NULL);
+ rc = ef10_filter_add_internal(enp, spec, may_replace, NULL);
if (rc != 0)
goto fail1;
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
-static __checkReturn int
-hunt_filter_delete_internal(
+static __checkReturn efx_rc_t
+ef10_filter_delete_internal(
__in efx_nic_t *enp,
__in uint32_t filter_id)
{
- int rc;
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ efx_rc_t rc;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t *spec;
int state;
- uint32_t filter_idx = filter_id % EFX_HUNT_FILTER_TBL_ROWS;
+ uint32_t filter_idx = filter_id % EFX_EF10_FILTER_TBL_ROWS;
/*
* Find the software table entry and mark it busy. Don't
@@ -771,13 +772,13 @@ hunt_filter_delete_internal(
* FIXME: What if the busy flag is never cleared?
*/
EFSYS_LOCK(enp->en_eslp, state);
- while (hunt_filter_entry_is_busy(table, filter_idx)) {
+ while (ef10_filter_entry_is_busy(table, filter_idx)) {
EFSYS_UNLOCK(enp->en_eslp, state);
EFSYS_SPIN(1);
EFSYS_LOCK(enp->en_eslp, state);
}
- if ((spec = hunt_filter_entry_spec(table, filter_idx)) != NULL) {
- hunt_filter_set_entry_busy(table, filter_idx);
+ if ((spec = ef10_filter_entry_spec(table, filter_idx)) != NULL) {
+ ef10_filter_set_entry_busy(table, filter_idx);
}
EFSYS_UNLOCK(enp->en_eslp, state);
@@ -790,20 +791,20 @@ hunt_filter_delete_internal(
* Try to remove the hardware filter. This may fail if the MC has
* rebooted (which frees all hardware filter resources).
*/
- if (hunt_filter_is_exclusive(spec)) {
+ if (ef10_filter_is_exclusive(spec)) {
rc = efx_mcdi_filter_op_delete(enp,
MC_CMD_FILTER_OP_IN_OP_REMOVE,
- &table->hft_entry[filter_idx].hfe_handle);
+ &table->eft_entry[filter_idx].efe_handle);
} else {
rc = efx_mcdi_filter_op_delete(enp,
MC_CMD_FILTER_OP_IN_OP_UNSUBSCRIBE,
- &table->hft_entry[filter_idx].hfe_handle);
+ &table->eft_entry[filter_idx].efe_handle);
}
/* Free the software table entry */
EFSYS_LOCK(enp->en_eslp, state);
- hunt_filter_set_entry_not_busy(table, filter_idx);
- hunt_filter_set_entry(table, filter_idx, NULL);
+ ef10_filter_set_entry_not_busy(table, filter_idx);
+ ef10_filter_set_entry(table, filter_idx, NULL);
EFSYS_UNLOCK(enp->en_eslp, state);
EFSYS_KMEM_FREE(enp->en_esip, sizeof (*spec), spec);
@@ -818,18 +819,18 @@ fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
- __checkReturn int
-hunt_filter_delete(
+ __checkReturn efx_rc_t
+ef10_filter_delete(
__in efx_nic_t *enp,
__inout efx_filter_spec_t *spec)
{
- int rc;
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ efx_rc_t rc;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t *saved_spec;
unsigned int hash;
unsigned int depth;
@@ -837,22 +838,23 @@ hunt_filter_delete(
int state;
boolean_t locked = B_FALSE;
- EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
+ EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
+ enp->en_family == EFX_FAMILY_MEDFORD);
- hash = hunt_filter_hash(spec);
+ hash = ef10_filter_hash(spec);
EFSYS_LOCK(enp->en_eslp, state);
locked = B_TRUE;
depth = 1;
for (;;) {
- i = (hash + depth) & (EFX_HUNT_FILTER_TBL_ROWS - 1);
- saved_spec = hunt_filter_entry_spec(table, i);
- if (saved_spec && hunt_filter_equal(spec, saved_spec) &&
- hunt_filter_same_dest(spec, saved_spec)) {
+ i = (hash + depth) & (EFX_EF10_FILTER_TBL_ROWS - 1);
+ saved_spec = ef10_filter_entry_spec(table, i);
+ if (saved_spec && ef10_filter_equal(spec, saved_spec) &&
+ ef10_filter_same_dest(spec, saved_spec)) {
break;
}
- if (depth == EFX_HUNT_FILTER_SEARCH_LIMIT) {
+ if (depth == EF10_FILTER_SEARCH_LIMIT) {
rc = ENOENT;
goto fail1;
}
@@ -862,7 +864,7 @@ hunt_filter_delete(
EFSYS_UNLOCK(enp->en_eslp, state);
locked = B_FALSE;
- rc = hunt_filter_delete_internal(enp, i);
+ rc = ef10_filter_delete_internal(enp, i);
if (rc != 0)
goto fail2;
@@ -872,7 +874,7 @@ fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
if (locked)
EFSYS_UNLOCK(enp->en_eslp, state);
@@ -880,7 +882,7 @@ fail1:
return (rc);
}
-static __checkReturn int
+static __checkReturn efx_rc_t
efx_mcdi_get_parser_disp_info(
__in efx_nic_t *enp,
__out uint32_t *list,
@@ -889,7 +891,7 @@ efx_mcdi_get_parser_disp_info(
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)];
- int rc;
+ efx_rc_t rc;
uint32_t i;
boolean_t support_unknown_ucast = B_FALSE;
boolean_t support_unknown_mcast = B_FALSE;
@@ -955,18 +957,18 @@ efx_mcdi_get_parser_disp_info(
fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
- __checkReturn int
-hunt_filter_supported_filters(
+ __checkReturn efx_rc_t
+ef10_filter_supported_filters(
__in efx_nic_t *enp,
__out uint32_t *list,
__out size_t *length)
{
- int rc;
+ efx_rc_t rc;
if ((rc = efx_mcdi_get_parser_disp_info(enp, list, length) != 0))
goto fail1;
@@ -974,21 +976,21 @@ hunt_filter_supported_filters(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
-static __checkReturn int
-hunt_filter_unicast_refresh(
+static __checkReturn efx_rc_t
+ef10_filter_unicast_refresh(
__in efx_nic_t *enp,
__in_ecount(6) uint8_t const *addr,
__in boolean_t all_unicst,
__in efx_filter_flag_t filter_flags)
{
- hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t spec;
- int rc;
+ efx_rc_t rc;
if (all_unicst == B_TRUE)
goto use_uc_def;
@@ -996,11 +998,11 @@ hunt_filter_unicast_refresh(
/* Insert the filter for the local station address */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
- hftp->hft_default_rxq);
+ eftp->eft_default_rxq);
efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC, addr);
- rc = hunt_filter_add_internal(enp, &spec, B_TRUE,
- &hftp->hft_unicst_filter_index);
+ rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
+ &eftp->eft_unicst_filter_index);
if (rc != 0) {
/*
* Fall back to an unknown filter. We may be able to subscribe
@@ -1008,7 +1010,7 @@ hunt_filter_unicast_refresh(
*/
goto use_uc_def;
}
- hftp->hft_unicst_filter_set = B_TRUE;
+ eftp->eft_unicst_filter_set = B_TRUE;
return (0);
@@ -1016,32 +1018,32 @@ use_uc_def:
/* Insert the unknown unicast filter */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
- hftp->hft_default_rxq);
+ eftp->eft_default_rxq);
efx_filter_spec_set_uc_def(&spec);
- rc = hunt_filter_add_internal(enp, &spec, B_TRUE,
- &hftp->hft_unicst_filter_index);
+ rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
+ &eftp->eft_unicst_filter_index);
if (rc != 0)
goto fail1;
- hftp->hft_unicst_filter_set = B_TRUE;
+ eftp->eft_unicst_filter_set = B_TRUE;
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
- if (hftp->hft_unicst_filter_set != B_FALSE) {
- (void) hunt_filter_delete_internal(enp,
- hftp->hft_unicst_filter_index);
+ if (eftp->eft_unicst_filter_set != B_FALSE) {
+ (void) ef10_filter_delete_internal(enp,
+ eftp->eft_unicst_filter_index);
- hftp->hft_unicst_filter_set = B_FALSE;
+ eftp->eft_unicst_filter_set = B_FALSE;
}
return (rc);
}
-static __checkReturn int
-hunt_filter_multicast_refresh(
+static __checkReturn efx_rc_t
+ef10_filter_multicast_refresh(
__in efx_nic_t *enp,
__in boolean_t mulcst,
__in boolean_t all_mulcst,
@@ -1050,11 +1052,11 @@ hunt_filter_multicast_refresh(
__in int count,
__in efx_filter_flag_t filter_flags)
{
- hunt_filter_table_t *hftp = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *eftp = enp->en_filter.ef_ef10_filter_table;
efx_filter_spec_t spec;
uint8_t addr[6];
unsigned i;
- int rc;
+ efx_rc_t rc;
if (all_mulcst == B_TRUE)
goto use_mc_def;
@@ -1063,25 +1065,25 @@ hunt_filter_multicast_refresh(
count = 0;
if (count + (brdcst ? 1 : 0) >
- EFX_ARRAY_SIZE(hftp->hft_mulcst_filter_indexes)) {
+ EFX_ARRAY_SIZE(eftp->eft_mulcst_filter_indexes)) {
/* Too many MAC addresses; use unknown multicast filter */
goto use_mc_def;
}
/* Insert/renew multicast address list filters */
- hftp->hft_mulcst_filter_count = count;
- for (i = 0; i < hftp->hft_mulcst_filter_count; i++) {
+ eftp->eft_mulcst_filter_count = count;
+ for (i = 0; i < eftp->eft_mulcst_filter_count; i++) {
efx_filter_spec_init_rx(&spec,
EFX_FILTER_PRI_AUTO,
filter_flags,
- hftp->hft_default_rxq);
+ eftp->eft_default_rxq);
efx_filter_spec_set_eth_local(&spec,
EFX_FILTER_SPEC_VID_UNSPEC,
&addrs[i * EFX_MAC_ADDR_LEN]);
- rc = hunt_filter_add_internal(enp, &spec, B_TRUE,
- &hftp->hft_mulcst_filter_indexes[i]);
+ rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
+ &eftp->eft_mulcst_filter_indexes[i]);
if (rc != 0) {
/* Rollback, then use unknown multicast filter */
goto rollback;
@@ -1090,18 +1092,18 @@ hunt_filter_multicast_refresh(
if (brdcst == B_TRUE) {
/* Insert/renew broadcast address filter */
- hftp->hft_mulcst_filter_count++;
+ eftp->eft_mulcst_filter_count++;
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
- hftp->hft_default_rxq);
+ eftp->eft_default_rxq);
EFX_MAC_BROADCAST_ADDR_SET(addr);
efx_filter_spec_set_eth_local(&spec, EFX_FILTER_SPEC_VID_UNSPEC,
addr);
- rc = hunt_filter_add_internal(enp, &spec, B_TRUE,
- &hftp->hft_mulcst_filter_indexes[
- hftp->hft_mulcst_filter_count - 1]);
+ rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
+ &eftp->eft_mulcst_filter_indexes[
+ eftp->eft_mulcst_filter_count - 1]);
if (rc != 0) {
/* Rollback, then use unknown multicast filter */
goto rollback;
@@ -1116,24 +1118,24 @@ rollback:
* before inserting the unknown multicast filter.
*/
while (i--) {
- (void) hunt_filter_delete_internal(enp,
- hftp->hft_mulcst_filter_indexes[i]);
+ (void) ef10_filter_delete_internal(enp,
+ eftp->eft_mulcst_filter_indexes[i]);
}
- hftp->hft_mulcst_filter_count = 0;
+ eftp->eft_mulcst_filter_count = 0;
use_mc_def:
/* Insert the unknown multicast filter */
efx_filter_spec_init_rx(&spec, EFX_FILTER_PRI_AUTO,
filter_flags,
- hftp->hft_default_rxq);
+ eftp->eft_default_rxq);
efx_filter_spec_set_mc_def(&spec);
- rc = hunt_filter_add_internal(enp, &spec, B_TRUE,
- &hftp->hft_mulcst_filter_indexes[0]);
+ rc = ef10_filter_add_internal(enp, &spec, B_TRUE,
+ &eftp->eft_mulcst_filter_indexes[0]);
if (rc != 0)
goto fail1;
- hftp->hft_mulcst_filter_count = 1;
+ eftp->eft_mulcst_filter_count = 1;
/*
* FIXME: If brdcst == B_FALSE, add a filter to drop broadcast traffic.
@@ -1142,21 +1144,21 @@ use_mc_def:
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
-static __checkReturn int
+static __checkReturn efx_rc_t
hunt_filter_get_workarounds(
__in efx_nic_t *enp)
{
efx_nic_cfg_t *encp = &enp->en_nic_cfg;
uint32_t implemented = 0;
uint32_t enabled = 0;
- int rc;
+ efx_rc_t rc;
rc = efx_mcdi_get_workarounds(enp, &implemented, &enabled);
if (rc == 0) {
@@ -1178,7 +1180,7 @@ hunt_filter_get_workarounds(
return (0);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
@@ -1191,8 +1193,8 @@ fail1:
* return ENOTSUP (Note the filters for the specified addresses are
* still applied in this case).
*/
- __checkReturn int
-hunt_filter_reconfigure(
+ __checkReturn efx_rc_t
+ef10_filter_reconfigure(
__in efx_nic_t *enp,
__in_ecount(6) uint8_t const *mac_addr,
__in boolean_t all_unicst,
@@ -1202,58 +1204,58 @@ hunt_filter_reconfigure(
__in_ecount(6*count) uint8_t const *addrs,
__in int count)
{
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
efx_filter_flag_t filter_flags;
unsigned i;
int all_unicst_rc;
int all_mulcst_rc;
- int rc;
+ efx_rc_t rc;
- if (table->hft_default_rxq == NULL) {
+ if (table->eft_default_rxq == NULL) {
/*
* Filters direct traffic to the default RXQ, and so cannot be
* inserted until it is available. Any currently configured
* filters must be removed (ignore errors in case the MC
* has rebooted, which removes hardware filters).
*/
- if (table->hft_unicst_filter_set != B_FALSE) {
- (void) hunt_filter_delete_internal(enp,
- table->hft_unicst_filter_index);
- table->hft_unicst_filter_set = B_FALSE;
+ if (table->eft_unicst_filter_set != B_FALSE) {
+ (void) ef10_filter_delete_internal(enp,
+ table->eft_unicst_filter_index);
+ table->eft_unicst_filter_set = B_FALSE;
}
- for (i = 0; i < table->hft_mulcst_filter_count; i++) {
- (void) hunt_filter_delete_internal(enp,
- table->hft_mulcst_filter_indexes[i]);
+ for (i = 0; i < table->eft_mulcst_filter_count; i++) {
+ (void) ef10_filter_delete_internal(enp,
+ table->eft_mulcst_filter_indexes[i]);
}
- table->hft_mulcst_filter_count = 0;
+ table->eft_mulcst_filter_count = 0;
return (0);
}
- if (table->hft_using_rss)
+ if (table->eft_using_rss)
filter_flags = EFX_FILTER_FLAG_RX_RSS;
else
filter_flags = 0;
/* Mark old filters which may need to be removed */
- if (table->hft_unicst_filter_set != B_FALSE) {
- hunt_filter_set_entry_auto_old(table,
- table->hft_unicst_filter_index);
+ if (table->eft_unicst_filter_set != B_FALSE) {
+ ef10_filter_set_entry_auto_old(table,
+ table->eft_unicst_filter_index);
}
- for (i = 0; i < table->hft_mulcst_filter_count; i++) {
- hunt_filter_set_entry_auto_old(table,
- table->hft_mulcst_filter_indexes[i]);
+ for (i = 0; i < table->eft_mulcst_filter_count; i++) {
+ ef10_filter_set_entry_auto_old(table,
+ table->eft_mulcst_filter_indexes[i]);
}
/* Insert or renew unicast filters */
- if ((all_unicst_rc = hunt_filter_unicast_refresh(enp, mac_addr,
+ if ((all_unicst_rc = ef10_filter_unicast_refresh(enp, mac_addr,
all_unicst, filter_flags)) != 0) {
if (all_unicst == B_FALSE) {
rc = all_unicst_rc;
goto fail1;
}
/* Retry without all_unicast flag */
- rc = hunt_filter_unicast_refresh(enp, mac_addr,
+ rc = ef10_filter_unicast_refresh(enp, mac_addr,
B_FALSE, filter_flags);
if (rc != 0)
goto fail2;
@@ -1272,12 +1274,14 @@ hunt_filter_reconfigure(
* filters. This ensures that encp->enc_workaround_bug26807 matches the
* firmware state, and that later changes to enable/disable the
* workaround will result in this function seeing a reset (FLR).
+ *
+ * FIXME: On Medford mulicast chaining should always be on.
*/
if ((rc = hunt_filter_get_workarounds(enp)) != 0)
goto fail3;
/* Insert or renew multicast filters */
- if ((all_mulcst_rc = hunt_filter_multicast_refresh(enp, mulcst,
+ if ((all_mulcst_rc = ef10_filter_multicast_refresh(enp, mulcst,
all_mulcst, brdcst,
addrs, count, filter_flags)) != 0) {
if (all_mulcst == B_FALSE) {
@@ -1285,7 +1289,7 @@ hunt_filter_reconfigure(
goto fail4;
}
/* Retry without all_mulcast flag */
- rc = hunt_filter_multicast_refresh(enp, mulcst,
+ rc = ef10_filter_multicast_refresh(enp, mulcst,
B_FALSE, brdcst,
addrs, count, filter_flags);
if (rc != 0)
@@ -1293,9 +1297,9 @@ hunt_filter_reconfigure(
}
/* Remove old filters which were not renewed */
- for (i = 0; i < EFX_ARRAY_SIZE(table->hft_entry); i++) {
- if (hunt_filter_entry_is_auto_old(table, i)) {
- (void) hunt_filter_delete_internal(enp, i);
+ for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) {
+ if (ef10_filter_entry_is_auto_old(table, i)) {
+ (void) ef10_filter_delete_internal(enp, i);
}
}
@@ -1316,12 +1320,12 @@ fail3:
fail2:
EFSYS_PROBE(fail2);
fail1:
- EFSYS_PROBE1(fail1, int, rc);
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
/* Clear auto old flags */
- for (i = 0; i < EFX_ARRAY_SIZE(table->hft_entry); i++) {
- if (hunt_filter_entry_is_auto_old(table, i)) {
- hunt_filter_set_entry_not_auto_old(table, i);
+ for (i = 0; i < EFX_ARRAY_SIZE(table->eft_entry); i++) {
+ if (ef10_filter_entry_is_auto_old(table, i)) {
+ ef10_filter_set_entry_not_auto_old(table, i);
}
}
@@ -1329,45 +1333,45 @@ fail1:
}
void
-hunt_filter_get_default_rxq(
+ef10_filter_get_default_rxq(
__in efx_nic_t *enp,
__out efx_rxq_t **erpp,
__out boolean_t *using_rss)
{
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
- *erpp = table->hft_default_rxq;
- *using_rss = table->hft_using_rss;
+ *erpp = table->eft_default_rxq;
+ *using_rss = table->eft_using_rss;
}
void
-hunt_filter_default_rxq_set(
+ef10_filter_default_rxq_set(
__in efx_nic_t *enp,
__in efx_rxq_t *erp,
__in boolean_t using_rss)
{
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
#if EFSYS_OPT_RX_SCALE
EFSYS_ASSERT((using_rss == B_FALSE) ||
- (enp->en_rss_context != HUNTINGTON_RSS_CONTEXT_INVALID));
- table->hft_using_rss = using_rss;
+ (enp->en_rss_context != EF10_RSS_CONTEXT_INVALID));
+ table->eft_using_rss = using_rss;
#else
EFSYS_ASSERT(using_rss == B_FALSE);
- table->hft_using_rss = B_FALSE;
+ table->eft_using_rss = B_FALSE;
#endif
- table->hft_default_rxq = erp;
+ table->eft_default_rxq = erp;
}
void
-hunt_filter_default_rxq_clear(
+ef10_filter_default_rxq_clear(
__in efx_nic_t *enp)
{
- hunt_filter_table_t *table = enp->en_filter.ef_hunt_filter_table;
+ ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
- table->hft_default_rxq = NULL;
- table->hft_using_rss = B_FALSE;
+ table->eft_default_rxq = NULL;
+ table->eft_using_rss = B_FALSE;
}
OpenPOWER on IntegriCloud