summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ef10.c
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2016-06-15 17:49:05 +0100
committerDavid S. Miller <davem@davemloft.net>2016-06-15 22:26:26 -0700
commit8c91562075e8621f6d9a11cfcf31a71a7203cbbe (patch)
treebb1611ed9680040a67a954f03f81149744e71bbb /drivers/net/ethernet/sfc/ef10.c
parentd248953a3ccd218893b5119a0e63058f0dabca67 (diff)
downloadlinux-8c91562075e8621f6d9a11cfcf31a71a7203cbbe.tar.gz
linux-8c91562075e8621f6d9a11cfcf31a71a7203cbbe.tar.xz
sfc: Refactor checks for invalid filter ID
Nearly every time we call efx_ef10_filter_remove_unsafe, we first check for EFX_EF10_FILTER_ID_INVALID, in which case we do nothing. So move that check into the function, simplifying all the call sites. Also, change the return type to void, since none of the callers check it. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef10.c')
-rw-r--r--drivers/net/ethernet/sfc/ef10.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index add9f46542fc..d4f9e9420d4e 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -3568,12 +3568,13 @@ static u32 efx_ef10_filter_get_unsafe_id(struct efx_nic *efx, u32 filter_id)
return filter_id % HUNT_FILTER_TBL_ROWS;
}
-static int efx_ef10_filter_remove_unsafe(struct efx_nic *efx,
- enum efx_filter_priority priority,
- u32 filter_id)
+static void efx_ef10_filter_remove_unsafe(struct efx_nic *efx,
+ enum efx_filter_priority priority,
+ u32 filter_id)
{
- return efx_ef10_filter_remove_internal(efx, 1U << priority,
- filter_id, true);
+ if (filter_id == EFX_EF10_FILTER_ID_INVALID)
+ return;
+ efx_ef10_filter_remove_internal(efx, 1U << priority, filter_id, true);
}
static int efx_ef10_filter_get_safe(struct efx_nic *efx,
@@ -4229,8 +4230,6 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
rc);
/* Fall back to promiscuous */
for (j = 0; j < i; j++) {
- if (ids[j] == EFX_EF10_FILTER_ID_INVALID)
- continue;
efx_ef10_filter_remove_unsafe(
efx, EFX_FILTER_PRI_AUTO,
ids[j]);
@@ -4256,8 +4255,6 @@ static int efx_ef10_filter_insert_addr_list(struct efx_nic *efx,
"Broadcast filter insert failed rc=%d\n", rc);
/* Fall back to promiscuous */
for (j = 0; j < i; j++) {
- if (ids[j] == EFX_EF10_FILTER_ID_INVALID)
- continue;
efx_ef10_filter_remove_unsafe(
efx, EFX_FILTER_PRI_AUTO,
ids[j]);
@@ -4616,25 +4613,15 @@ static void efx_ef10_filter_del_vlan_internal(struct efx_nic *efx,
list_del(&vlan->list);
- for (i = 0; i < ARRAY_SIZE(vlan->uc); i++) {
- if (vlan->uc[i] != EFX_EF10_FILTER_ID_INVALID)
- efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO,
- vlan->uc[i]);
- }
- for (i = 0; i < ARRAY_SIZE(vlan->mc); i++) {
- if (vlan->mc[i] != EFX_EF10_FILTER_ID_INVALID)
- efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO,
- vlan->mc[i]);
- }
- if (vlan->ucdef != EFX_EF10_FILTER_ID_INVALID)
- efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO,
- vlan->ucdef);
- if (vlan->bcast != EFX_EF10_FILTER_ID_INVALID)
+ for (i = 0; i < ARRAY_SIZE(vlan->uc); i++)
efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO,
- vlan->bcast);
- if (vlan->mcdef != EFX_EF10_FILTER_ID_INVALID)
+ vlan->uc[i]);
+ for (i = 0; i < ARRAY_SIZE(vlan->mc); i++)
efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO,
- vlan->mcdef);
+ vlan->mc[i]);
+ efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, vlan->ucdef);
+ efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, vlan->bcast);
+ efx_ef10_filter_remove_unsafe(efx, EFX_FILTER_PRI_AUTO, vlan->mcdef);
kfree(vlan);
}