diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-09-04 13:57:25 -0400 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-10-01 20:58:41 -0400 |
commit | 9e0f9a10576a7769869ce1f76f5b336da20667a6 (patch) | |
tree | 76be46bf82a681f2a1a838a55025e4567e620224 | |
parent | 1ac0226eb04e56cacee080fb71938eb50b5245eb (diff) |
sfc: Remove EFX_FILTER_FLAG_RX_OVERRIDE_IP
This filter flag cannot yet be set through the ethtool command and
will not be supported on future hardware.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r-- | drivers/net/ethernet/sfc/ethtool.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/filter.c | 53 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/filter.h | 7 |
3 files changed, 10 insertions, 58 deletions
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index cf772074145a..90f078eff8e6 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c | |||
@@ -961,9 +961,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, | |||
961 | int rc; | 961 | int rc; |
962 | 962 | ||
963 | /* Check that user wants us to choose the location */ | 963 | /* Check that user wants us to choose the location */ |
964 | if (rule->location != RX_CLS_LOC_ANY && | 964 | if (rule->location != RX_CLS_LOC_ANY) |
965 | rule->location != RX_CLS_LOC_FIRST && | ||
966 | rule->location != RX_CLS_LOC_LAST) | ||
967 | return -EINVAL; | 965 | return -EINVAL; |
968 | 966 | ||
969 | /* Range-check ring_cookie */ | 967 | /* Range-check ring_cookie */ |
@@ -977,9 +975,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx, | |||
977 | rule->m_ext.data[1])) | 975 | rule->m_ext.data[1])) |
978 | return -EINVAL; | 976 | return -EINVAL; |
979 | 977 | ||
980 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, | 978 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_MANUAL, 0, |
981 | (rule->location == RX_CLS_LOC_FIRST) ? | ||
982 | EFX_FILTER_FLAG_RX_OVERRIDE_IP : 0, | ||
983 | (rule->ring_cookie == RX_CLS_FLOW_DISC) ? | 979 | (rule->ring_cookie == RX_CLS_FLOW_DISC) ? |
984 | 0xfff : rule->ring_cookie); | 980 | 0xfff : rule->ring_cookie); |
985 | 981 | ||
diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c index c3fd61f0a95c..e89bad78312e 100644 --- a/drivers/net/ethernet/sfc/filter.c +++ b/drivers/net/ethernet/sfc/filter.c | |||
@@ -162,20 +162,12 @@ static void efx_filter_push_rx_config(struct efx_nic *efx) | |||
162 | !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags & | 162 | !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags & |
163 | EFX_FILTER_FLAG_RX_RSS)); | 163 | EFX_FILTER_FLAG_RX_RSS)); |
164 | EFX_SET_OWORD_FIELD( | 164 | EFX_SET_OWORD_FIELD( |
165 | filter_ctl, FRF_CZ_UNICAST_NOMATCH_IP_OVERRIDE, | ||
166 | !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags & | ||
167 | EFX_FILTER_FLAG_RX_OVERRIDE_IP)); | ||
168 | EFX_SET_OWORD_FIELD( | ||
169 | filter_ctl, FRF_CZ_MULTICAST_NOMATCH_Q_ID, | 165 | filter_ctl, FRF_CZ_MULTICAST_NOMATCH_Q_ID, |
170 | table->spec[EFX_FILTER_INDEX_MC_DEF].dmaq_id); | 166 | table->spec[EFX_FILTER_INDEX_MC_DEF].dmaq_id); |
171 | EFX_SET_OWORD_FIELD( | 167 | EFX_SET_OWORD_FIELD( |
172 | filter_ctl, FRF_CZ_MULTICAST_NOMATCH_RSS_ENABLED, | 168 | filter_ctl, FRF_CZ_MULTICAST_NOMATCH_RSS_ENABLED, |
173 | !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags & | 169 | !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags & |
174 | EFX_FILTER_FLAG_RX_RSS)); | 170 | EFX_FILTER_FLAG_RX_RSS)); |
175 | EFX_SET_OWORD_FIELD( | ||
176 | filter_ctl, FRF_CZ_MULTICAST_NOMATCH_IP_OVERRIDE, | ||
177 | !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags & | ||
178 | EFX_FILTER_FLAG_RX_OVERRIDE_IP)); | ||
179 | } | 171 | } |
180 | 172 | ||
181 | efx_writeo(efx, &filter_ctl, FR_BZ_RX_FILTER_CTL); | 173 | efx_writeo(efx, &filter_ctl, FR_BZ_RX_FILTER_CTL); |
@@ -480,14 +472,12 @@ static u32 efx_filter_build(efx_oword_t *filter, struct efx_filter_spec *spec) | |||
480 | 472 | ||
481 | case EFX_FILTER_TABLE_RX_MAC: { | 473 | case EFX_FILTER_TABLE_RX_MAC: { |
482 | bool is_wild = spec->type == EFX_FILTER_MAC_WILD; | 474 | bool is_wild = spec->type == EFX_FILTER_MAC_WILD; |
483 | EFX_POPULATE_OWORD_8( | 475 | EFX_POPULATE_OWORD_7( |
484 | *filter, | 476 | *filter, |
485 | FRF_CZ_RMFT_RSS_EN, | 477 | FRF_CZ_RMFT_RSS_EN, |
486 | !!(spec->flags & EFX_FILTER_FLAG_RX_RSS), | 478 | !!(spec->flags & EFX_FILTER_FLAG_RX_RSS), |
487 | FRF_CZ_RMFT_SCATTER_EN, | 479 | FRF_CZ_RMFT_SCATTER_EN, |
488 | !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER), | 480 | !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER), |
489 | FRF_CZ_RMFT_IP_OVERRIDE, | ||
490 | !!(spec->flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP), | ||
491 | FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id, | 481 | FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id, |
492 | FRF_CZ_RMFT_WILDCARD_MATCH, is_wild, | 482 | FRF_CZ_RMFT_WILDCARD_MATCH, is_wild, |
493 | FRF_CZ_RMFT_DEST_MAC_HI, spec->data[2], | 483 | FRF_CZ_RMFT_DEST_MAC_HI, spec->data[2], |
@@ -569,31 +559,15 @@ static int efx_filter_search(struct efx_filter_table *table, | |||
569 | /* | 559 | /* |
570 | * Construct/deconstruct external filter IDs. These must be ordered | 560 | * Construct/deconstruct external filter IDs. These must be ordered |
571 | * by matching priority, for RX NFC semantics. | 561 | * by matching priority, for RX NFC semantics. |
572 | * | ||
573 | * Each RX MAC filter entry has a flag for whether it can override an | ||
574 | * RX IP filter that also matches. So we assign locations for MAC | ||
575 | * filters with overriding behaviour, then for IP filters, then for | ||
576 | * MAC filters without overriding behaviour. | ||
577 | */ | 562 | */ |
578 | 563 | ||
579 | #define EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP 0 | ||
580 | #define EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP 1 | ||
581 | #define EFX_FILTER_MATCH_PRI_NORMAL_BASE 2 | ||
582 | |||
583 | #define EFX_FILTER_INDEX_WIDTH 13 | 564 | #define EFX_FILTER_INDEX_WIDTH 13 |
584 | #define EFX_FILTER_INDEX_MASK ((1 << EFX_FILTER_INDEX_WIDTH) - 1) | 565 | #define EFX_FILTER_INDEX_MASK ((1 << EFX_FILTER_INDEX_WIDTH) - 1) |
585 | 566 | ||
586 | static inline u32 efx_filter_make_id(enum efx_filter_table_id table_id, | 567 | static inline u32 efx_filter_make_id(enum efx_filter_table_id table_id, |
587 | unsigned int index, u8 flags) | 568 | unsigned int index, u8 flags) |
588 | { | 569 | { |
589 | unsigned int match_pri = EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id; | 570 | unsigned int match_pri = table_id; |
590 | |||
591 | if (flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP) { | ||
592 | if (table_id == EFX_FILTER_TABLE_RX_MAC) | ||
593 | match_pri = EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP; | ||
594 | else if (table_id == EFX_FILTER_TABLE_RX_DEF) | ||
595 | match_pri = EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP; | ||
596 | } | ||
597 | 571 | ||
598 | return match_pri << EFX_FILTER_INDEX_WIDTH | index; | 572 | return match_pri << EFX_FILTER_INDEX_WIDTH | index; |
599 | } | 573 | } |
@@ -602,14 +576,7 @@ static inline enum efx_filter_table_id efx_filter_id_table_id(u32 id) | |||
602 | { | 576 | { |
603 | unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH; | 577 | unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH; |
604 | 578 | ||
605 | switch (match_pri) { | 579 | return match_pri; |
606 | case EFX_FILTER_MATCH_PRI_RX_MAC_OVERRIDE_IP: | ||
607 | return EFX_FILTER_TABLE_RX_MAC; | ||
608 | case EFX_FILTER_MATCH_PRI_RX_DEF_OVERRIDE_IP: | ||
609 | return EFX_FILTER_TABLE_RX_DEF; | ||
610 | default: | ||
611 | return match_pri - EFX_FILTER_MATCH_PRI_NORMAL_BASE; | ||
612 | } | ||
613 | } | 580 | } |
614 | 581 | ||
615 | static inline unsigned int efx_filter_id_index(u32 id) | 582 | static inline unsigned int efx_filter_id_index(u32 id) |
@@ -621,10 +588,7 @@ static inline u8 efx_filter_id_flags(u32 id) | |||
621 | { | 588 | { |
622 | unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH; | 589 | unsigned int match_pri = id >> EFX_FILTER_INDEX_WIDTH; |
623 | 590 | ||
624 | if (match_pri < EFX_FILTER_MATCH_PRI_NORMAL_BASE) | 591 | if (match_pri <= EFX_FILTER_TABLE_RX_DEF) |
625 | return EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_RX_OVERRIDE_IP; | ||
626 | else if (match_pri <= | ||
627 | EFX_FILTER_MATCH_PRI_NORMAL_BASE + EFX_FILTER_TABLE_RX_DEF) | ||
628 | return EFX_FILTER_FLAG_RX; | 592 | return EFX_FILTER_FLAG_RX; |
629 | else | 593 | else |
630 | return EFX_FILTER_FLAG_TX; | 594 | return EFX_FILTER_FLAG_TX; |
@@ -637,8 +601,7 @@ u32 efx_filter_get_rx_id_limit(struct efx_nic *efx) | |||
637 | 601 | ||
638 | do { | 602 | do { |
639 | if (state->table[table_id].size != 0) | 603 | if (state->table[table_id].size != 0) |
640 | return ((EFX_FILTER_MATCH_PRI_NORMAL_BASE + table_id) | 604 | return (table_id << EFX_FILTER_INDEX_WIDTH) + |
641 | << EFX_FILTER_INDEX_WIDTH) + | ||
642 | state->table[table_id].size; | 605 | state->table[table_id].size; |
643 | } while (table_id--); | 606 | } while (table_id--); |
644 | 607 | ||
@@ -781,8 +744,7 @@ int efx_filter_remove_id_safe(struct efx_nic *efx, | |||
781 | spin_lock_bh(&state->lock); | 744 | spin_lock_bh(&state->lock); |
782 | 745 | ||
783 | if (test_bit(filter_idx, table->used_bitmap) && | 746 | if (test_bit(filter_idx, table->used_bitmap) && |
784 | spec->priority == priority && | 747 | spec->priority == priority) { |
785 | !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) { | ||
786 | efx_filter_table_clear_entry(efx, table, filter_idx); | 748 | efx_filter_table_clear_entry(efx, table, filter_idx); |
787 | if (table->used == 0) | 749 | if (table->used == 0) |
788 | efx_filter_table_reset_search_depth(table); | 750 | efx_filter_table_reset_search_depth(table); |
@@ -833,8 +795,7 @@ int efx_filter_get_filter_safe(struct efx_nic *efx, | |||
833 | spin_lock_bh(&state->lock); | 795 | spin_lock_bh(&state->lock); |
834 | 796 | ||
835 | if (test_bit(filter_idx, table->used_bitmap) && | 797 | if (test_bit(filter_idx, table->used_bitmap) && |
836 | spec->priority == priority && | 798 | spec->priority == priority) { |
837 | !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) { | ||
838 | *spec_buf = *spec; | 799 | *spec_buf = *spec; |
839 | rc = 0; | 800 | rc = 0; |
840 | } else { | 801 | } else { |
diff --git a/drivers/net/ethernet/sfc/filter.h b/drivers/net/ethernet/sfc/filter.h index 3c77802aed6c..5cb54723b824 100644 --- a/drivers/net/ethernet/sfc/filter.h +++ b/drivers/net/ethernet/sfc/filter.h | |||
@@ -61,16 +61,12 @@ enum efx_filter_priority { | |||
61 | * according to the indirection table. | 61 | * according to the indirection table. |
62 | * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving | 62 | * @EFX_FILTER_FLAG_RX_SCATTER: Enable DMA scatter on the receiving |
63 | * queue. | 63 | * queue. |
64 | * @EFX_FILTER_FLAG_RX_OVERRIDE_IP: Enables a MAC filter to override | ||
65 | * any IP filter that matches the same packet. By default, IP | ||
66 | * filters take precedence. | ||
67 | * @EFX_FILTER_FLAG_RX: Filter is for RX | 64 | * @EFX_FILTER_FLAG_RX: Filter is for RX |
68 | * @EFX_FILTER_FLAG_TX: Filter is for TX | 65 | * @EFX_FILTER_FLAG_TX: Filter is for TX |
69 | */ | 66 | */ |
70 | enum efx_filter_flags { | 67 | enum efx_filter_flags { |
71 | EFX_FILTER_FLAG_RX_RSS = 0x01, | 68 | EFX_FILTER_FLAG_RX_RSS = 0x01, |
72 | EFX_FILTER_FLAG_RX_SCATTER = 0x02, | 69 | EFX_FILTER_FLAG_RX_SCATTER = 0x02, |
73 | EFX_FILTER_FLAG_RX_OVERRIDE_IP = 0x04, | ||
74 | EFX_FILTER_FLAG_RX = 0x08, | 70 | EFX_FILTER_FLAG_RX = 0x08, |
75 | EFX_FILTER_FLAG_TX = 0x10, | 71 | EFX_FILTER_FLAG_TX = 0x10, |
76 | }; | 72 | }; |
@@ -88,8 +84,7 @@ enum efx_filter_flags { | |||
88 | * | 84 | * |
89 | * The @priority field is used by software to determine whether a new | 85 | * The @priority field is used by software to determine whether a new |
90 | * filter may replace an old one. The hardware priority of a filter | 86 | * filter may replace an old one. The hardware priority of a filter |
91 | * depends on the filter type and %EFX_FILTER_FLAG_RX_OVERRIDE_IP | 87 | * depends on the filter type. |
92 | * flag. | ||
93 | */ | 88 | */ |
94 | struct efx_filter_spec { | 89 | struct efx_filter_spec { |
95 | u8 type:4; | 90 | u8 type:4; |