From b0df8547c23c5ddc9bdb51b8320aaf7f8bd2f5c8 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 7 Dec 2010 19:02:27 +0000 Subject: [PATCH] --- yaml --- r: 224953 b: refs/heads/master c: 8891681af928f1da795cd4bd59043e5e0fadd6c8 h: refs/heads/master i: 224951: 74b995985f2af7afbdba071428e8894939211d26 v: v3 --- [refs] | 2 +- trunk/drivers/net/sfc/efx.h | 5 ++--- trunk/drivers/net/sfc/ethtool.c | 8 ++----- trunk/drivers/net/sfc/filter.c | 40 ++++++++++++++++++++++++--------- trunk/drivers/net/sfc/filter.h | 6 ----- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/[refs] b/[refs] index dd6ed61919e2..c99ce428046c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ac33ac610dc613b2b1c938f8b61eef651ab72563 +refs/heads/master: 8891681af928f1da795cd4bd59043e5e0fadd6c8 diff --git a/trunk/drivers/net/sfc/efx.h b/trunk/drivers/net/sfc/efx.h index 10a1bf40da96..003fdb35b4bb 100644 --- a/trunk/drivers/net/sfc/efx.h +++ b/trunk/drivers/net/sfc/efx.h @@ -74,9 +74,8 @@ extern int efx_filter_insert_filter(struct efx_nic *efx, bool replace); extern int efx_filter_remove_filter(struct efx_nic *efx, struct efx_filter_spec *spec); -extern void efx_filter_table_clear(struct efx_nic *efx, - enum efx_filter_table_id table_id, - enum efx_filter_priority priority); +extern void efx_filter_clear_rx(struct efx_nic *efx, + enum efx_filter_priority priority); /* Channels */ extern void efx_process_channel_now(struct efx_channel *channel); diff --git a/trunk/drivers/net/sfc/ethtool.c b/trunk/drivers/net/sfc/ethtool.c index d51a6b1f4766..0f46c1a3171e 100644 --- a/trunk/drivers/net/sfc/ethtool.c +++ b/trunk/drivers/net/sfc/ethtool.c @@ -558,12 +558,8 @@ static int efx_ethtool_set_flags(struct net_device *net_dev, u32 data) if (rc) return rc; - if (!(data & ETH_FLAG_NTUPLE)) { - efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_IP, - EFX_FILTER_PRI_MANUAL); - efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_MAC, - EFX_FILTER_PRI_MANUAL); - } + if (!(data & ETH_FLAG_NTUPLE)) + efx_filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL); return 0; } diff --git a/trunk/drivers/net/sfc/filter.c b/trunk/drivers/net/sfc/filter.c index 44500b54fd5f..e96e6e852f16 100644 --- a/trunk/drivers/net/sfc/filter.c +++ b/trunk/drivers/net/sfc/filter.c @@ -26,6 +26,12 @@ */ #define FILTER_CTL_SRCH_MAX 200 +enum efx_filter_table_id { + EFX_FILTER_TABLE_RX_IP = 0, + EFX_FILTER_TABLE_RX_MAC, + EFX_FILTER_TABLE_COUNT, +}; + struct efx_filter_table { u32 offset; /* address of table relative to BAR */ unsigned size; /* number of entries */ @@ -206,6 +212,14 @@ static int efx_filter_search(struct efx_filter_table *table, return filter_idx; } +/* Construct/deconstruct external filter IDs */ + +static inline int +efx_filter_make_id(enum efx_filter_table_id table_id, unsigned index) +{ + return table_id << 16 | index; +} + /** * efx_filter_insert_filter - add or replace a filter * @efx: NIC in which to insert the filter @@ -213,7 +227,7 @@ static int efx_filter_search(struct efx_filter_table *table, * @replace: Flag for whether the specified filter may replace a filter * with an identical match expression and equal or lower priority * - * On success, return the filter index within its table. + * On success, return the filter ID. * On failure, return a negative error code. */ int efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, @@ -273,6 +287,7 @@ int efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, netif_vdbg(efx, hw, efx->net_dev, "%s: filter type %d index %d rxq %u set", __func__, spec->type, filter_idx, spec->dmaq_id); + rc = efx_filter_make_id(table_id, filter_idx); out: spin_unlock_bh(&state->lock); @@ -340,15 +355,9 @@ int efx_filter_remove_filter(struct efx_nic *efx, struct efx_filter_spec *spec) return rc; } -/** - * efx_filter_table_clear - remove filters from a table by priority - * @efx: NIC from which to remove the filters - * @table_id: Table from which to remove the filters - * @priority: Maximum priority to remove - */ -void efx_filter_table_clear(struct efx_nic *efx, - enum efx_filter_table_id table_id, - enum efx_filter_priority priority) +static void efx_filter_table_clear(struct efx_nic *efx, + enum efx_filter_table_id table_id, + enum efx_filter_priority priority) { struct efx_filter_state *state = efx->filter_state; struct efx_filter_table *table = &state->table[table_id]; @@ -365,6 +374,17 @@ void efx_filter_table_clear(struct efx_nic *efx, spin_unlock_bh(&state->lock); } +/** + * efx_filter_clear_rx - remove RX filters by priority + * @efx: NIC from which to remove the filters + * @priority: Maximum priority to remove + */ +void efx_filter_clear_rx(struct efx_nic *efx, enum efx_filter_priority priority) +{ + efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_IP, priority); + efx_filter_table_clear(efx, EFX_FILTER_TABLE_RX_MAC, priority); +} + /* Restore filter stater after reset */ void efx_restore_filters(struct efx_nic *efx) { diff --git a/trunk/drivers/net/sfc/filter.h b/trunk/drivers/net/sfc/filter.h index a53319ded79c..d11e4aa78133 100644 --- a/trunk/drivers/net/sfc/filter.h +++ b/trunk/drivers/net/sfc/filter.h @@ -12,12 +12,6 @@ #include -enum efx_filter_table_id { - EFX_FILTER_TABLE_RX_IP = 0, - EFX_FILTER_TABLE_RX_MAC, - EFX_FILTER_TABLE_COUNT, -}; - /** * enum efx_filter_type - type of hardware filter * @EFX_FILTER_RX_TCP_FULL: RX, matching TCP/IPv4 4-tuple