aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bna
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bna')
-rw-r--r--drivers/net/bna/bna_ctrl.c241
-rw-r--r--drivers/net/bna/bna_txrx.c11
-rw-r--r--drivers/net/bna/bna_types.h4
3 files changed, 3 insertions, 253 deletions
diff --git a/drivers/net/bna/bna_ctrl.c b/drivers/net/bna/bna_ctrl.c
index 68e4c5eced53..e1527472b961 100644
--- a/drivers/net/bna/bna_ctrl.c
+++ b/drivers/net/bna/bna_ctrl.c
@@ -2132,37 +2132,6 @@ rxf_fltr_mbox_cmd(struct bna_rxf *rxf, u8 cmd, enum bna_status status)
2132 bna_mbox_send(rxf->rx->bna, &rxf->mbox_qe); 2132 bna_mbox_send(rxf->rx->bna, &rxf->mbox_qe);
2133} 2133}
2134 2134
2135static void
2136__rxf_default_function_config(struct bna_rxf *rxf, enum bna_status status)
2137{
2138 struct bna_rx_fndb_ram *rx_fndb_ram;
2139 u32 ctrl_flags;
2140 int i;
2141
2142 rx_fndb_ram = (struct bna_rx_fndb_ram *)
2143 BNA_GET_MEM_BASE_ADDR(rxf->rx->bna->pcidev.pci_bar_kva,
2144 RX_FNDB_RAM_BASE_OFFSET);
2145
2146 for (i = 0; i < BFI_MAX_RXF; i++) {
2147 if (status == BNA_STATUS_T_ENABLED) {
2148 if (i == rxf->rxf_id)
2149 continue;
2150
2151 ctrl_flags =
2152 readl(&rx_fndb_ram[i].control_flags);
2153 ctrl_flags |= BNA_RXF_CF_DEFAULT_FUNCTION_ENABLE;
2154 writel(ctrl_flags,
2155 &rx_fndb_ram[i].control_flags);
2156 } else {
2157 ctrl_flags =
2158 readl(&rx_fndb_ram[i].control_flags);
2159 ctrl_flags &= ~BNA_RXF_CF_DEFAULT_FUNCTION_ENABLE;
2160 writel(ctrl_flags,
2161 &rx_fndb_ram[i].control_flags);
2162 }
2163 }
2164}
2165
2166int 2135int
2167rxf_process_packet_filter_ucast(struct bna_rxf *rxf) 2136rxf_process_packet_filter_ucast(struct bna_rxf *rxf)
2168{ 2137{
@@ -2229,46 +2198,6 @@ rxf_process_packet_filter_promisc(struct bna_rxf *rxf)
2229} 2198}
2230 2199
2231int 2200int
2232rxf_process_packet_filter_default(struct bna_rxf *rxf)
2233{
2234 struct bna *bna = rxf->rx->bna;
2235
2236 /* Enable/disable default mode */
2237 if (is_default_enable(rxf->rxmode_pending,
2238 rxf->rxmode_pending_bitmask)) {
2239 /* move default configuration from pending -> active */
2240 default_inactive(rxf->rxmode_pending,
2241 rxf->rxmode_pending_bitmask);
2242 rxf->rxmode_active |= BNA_RXMODE_DEFAULT;
2243
2244 /* Disable VLAN filter to allow all VLANs */
2245 __rxf_vlan_filter_set(rxf, BNA_STATUS_T_DISABLED);
2246 /* Redirect all other RxF vlan filtering to this one */
2247 __rxf_default_function_config(rxf, BNA_STATUS_T_ENABLED);
2248 rxf_fltr_mbox_cmd(rxf, BFI_LL_H2I_RXF_DEFAULT_SET_REQ,
2249 BNA_STATUS_T_ENABLED);
2250 return 1;
2251 } else if (is_default_disable(rxf->rxmode_pending,
2252 rxf->rxmode_pending_bitmask)) {
2253 /* move default configuration from pending -> active */
2254 default_inactive(rxf->rxmode_pending,
2255 rxf->rxmode_pending_bitmask);
2256 rxf->rxmode_active &= ~BNA_RXMODE_DEFAULT;
2257 bna->rxf_default_id = BFI_MAX_RXF;
2258
2259 /* Revert VLAN filter */
2260 __rxf_vlan_filter_set(rxf, rxf->vlan_filter_status);
2261 /* Stop RxF vlan filter table redirection */
2262 __rxf_default_function_config(rxf, BNA_STATUS_T_DISABLED);
2263 rxf_fltr_mbox_cmd(rxf, BFI_LL_H2I_RXF_DEFAULT_SET_REQ,
2264 BNA_STATUS_T_DISABLED);
2265 return 1;
2266 }
2267
2268 return 0;
2269}
2270
2271int
2272rxf_process_packet_filter_allmulti(struct bna_rxf *rxf) 2201rxf_process_packet_filter_allmulti(struct bna_rxf *rxf)
2273{ 2202{
2274 /* Enable/disable allmulti mode */ 2203 /* Enable/disable allmulti mode */
@@ -2365,48 +2294,6 @@ rxf_clear_packet_filter_promisc(struct bna_rxf *rxf)
2365} 2294}
2366 2295
2367int 2296int
2368rxf_clear_packet_filter_default(struct bna_rxf *rxf)
2369{
2370 struct bna *bna = rxf->rx->bna;
2371
2372 /* 8. Execute pending default mode disable command */
2373 if (is_default_disable(rxf->rxmode_pending,
2374 rxf->rxmode_pending_bitmask)) {
2375 /* move default configuration from pending -> active */
2376 default_inactive(rxf->rxmode_pending,
2377 rxf->rxmode_pending_bitmask);
2378 rxf->rxmode_active &= ~BNA_RXMODE_DEFAULT;
2379 bna->rxf_default_id = BFI_MAX_RXF;
2380
2381 /* Revert VLAN filter */
2382 __rxf_vlan_filter_set(rxf, rxf->vlan_filter_status);
2383 /* Stop RxF vlan filter table redirection */
2384 __rxf_default_function_config(rxf, BNA_STATUS_T_DISABLED);
2385 rxf_fltr_mbox_cmd(rxf, BFI_LL_H2I_RXF_DEFAULT_SET_REQ,
2386 BNA_STATUS_T_DISABLED);
2387 return 1;
2388 }
2389
2390 /* 9. Clear active default mode; move it to pending enable */
2391 if (rxf->rxmode_active & BNA_RXMODE_DEFAULT) {
2392 /* move default configuration from active -> pending */
2393 default_enable(rxf->rxmode_pending,
2394 rxf->rxmode_pending_bitmask);
2395 rxf->rxmode_active &= ~BNA_RXMODE_DEFAULT;
2396
2397 /* Revert VLAN filter */
2398 __rxf_vlan_filter_set(rxf, rxf->vlan_filter_status);
2399 /* Stop RxF vlan filter table redirection */
2400 __rxf_default_function_config(rxf, BNA_STATUS_T_DISABLED);
2401 rxf_fltr_mbox_cmd(rxf, BFI_LL_H2I_RXF_DEFAULT_SET_REQ,
2402 BNA_STATUS_T_DISABLED);
2403 return 1;
2404 }
2405
2406 return 0;
2407}
2408
2409int
2410rxf_clear_packet_filter_allmulti(struct bna_rxf *rxf) 2297rxf_clear_packet_filter_allmulti(struct bna_rxf *rxf)
2411{ 2298{
2412 /* 10. Execute pending allmulti mode disable command */ 2299 /* 10. Execute pending allmulti mode disable command */
@@ -2481,28 +2368,6 @@ rxf_reset_packet_filter_promisc(struct bna_rxf *rxf)
2481} 2368}
2482 2369
2483void 2370void
2484rxf_reset_packet_filter_default(struct bna_rxf *rxf)
2485{
2486 struct bna *bna = rxf->rx->bna;
2487
2488 /* 8. Clear pending default mode disable */
2489 if (is_default_disable(rxf->rxmode_pending,
2490 rxf->rxmode_pending_bitmask)) {
2491 default_inactive(rxf->rxmode_pending,
2492 rxf->rxmode_pending_bitmask);
2493 rxf->rxmode_active &= ~BNA_RXMODE_DEFAULT;
2494 bna->rxf_default_id = BFI_MAX_RXF;
2495 }
2496
2497 /* 9. Move default mode config from active -> pending */
2498 if (rxf->rxmode_active & BNA_RXMODE_DEFAULT) {
2499 default_enable(rxf->rxmode_pending,
2500 rxf->rxmode_pending_bitmask);
2501 rxf->rxmode_active &= ~BNA_RXMODE_DEFAULT;
2502 }
2503}
2504
2505void
2506rxf_reset_packet_filter_allmulti(struct bna_rxf *rxf) 2371rxf_reset_packet_filter_allmulti(struct bna_rxf *rxf)
2507{ 2372{
2508 /* 10. Clear pending allmulti mode disable */ 2373 /* 10. Clear pending allmulti mode disable */
@@ -2599,76 +2464,6 @@ rxf_promisc_disable(struct bna_rxf *rxf)
2599 * 1 = need h/w change 2464 * 1 = need h/w change
2600 */ 2465 */
2601static int 2466static int
2602rxf_default_enable(struct bna_rxf *rxf)
2603{
2604 struct bna *bna = rxf->rx->bna;
2605 int ret = 0;
2606
2607 /* There can not be any pending disable command */
2608
2609 /* Do nothing if pending enable or already enabled */
2610 if (is_default_enable(rxf->rxmode_pending,
2611 rxf->rxmode_pending_bitmask) ||
2612 (rxf->rxmode_active & BNA_RXMODE_DEFAULT)) {
2613 /* Schedule enable */
2614 } else {
2615 /* Default mode should not be active in the system */
2616 default_enable(rxf->rxmode_pending,
2617 rxf->rxmode_pending_bitmask);
2618 bna->rxf_default_id = rxf->rxf_id;
2619 ret = 1;
2620 }
2621
2622 return ret;
2623}
2624
2625/**
2626 * Should only be called by bna_rxf_mode_set.
2627 * Helps deciding if h/w configuration is needed or not.
2628 * Returns:
2629 * 0 = no h/w change
2630 * 1 = need h/w change
2631 */
2632static int
2633rxf_default_disable(struct bna_rxf *rxf)
2634{
2635 struct bna *bna = rxf->rx->bna;
2636 int ret = 0;
2637
2638 /* There can not be any pending disable */
2639
2640 /* Turn off pending enable command , if any */
2641 if (is_default_enable(rxf->rxmode_pending,
2642 rxf->rxmode_pending_bitmask)) {
2643 /* Promisc mode should not be active */
2644 /* system default state should be pending */
2645 default_inactive(rxf->rxmode_pending,
2646 rxf->rxmode_pending_bitmask);
2647 /* Remove the default state from the system */
2648 bna->rxf_default_id = BFI_MAX_RXF;
2649
2650 /* Schedule disable */
2651 } else if (rxf->rxmode_active & BNA_RXMODE_DEFAULT) {
2652 /* Default mode should be active in the system */
2653 default_disable(rxf->rxmode_pending,
2654 rxf->rxmode_pending_bitmask);
2655 ret = 1;
2656
2657 /* Do nothing if already disabled */
2658 } else {
2659 }
2660
2661 return ret;
2662}
2663
2664/**
2665 * Should only be called by bna_rxf_mode_set.
2666 * Helps deciding if h/w configuration is needed or not.
2667 * Returns:
2668 * 0 = no h/w change
2669 * 1 = need h/w change
2670 */
2671static int
2672rxf_allmulti_enable(struct bna_rxf *rxf) 2467rxf_allmulti_enable(struct bna_rxf *rxf)
2673{ 2468{
2674 int ret = 0; 2469 int ret = 0;
@@ -2730,38 +2525,13 @@ bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode new_mode,
2730 struct bna_rxf *rxf = &rx->rxf; 2525 struct bna_rxf *rxf = &rx->rxf;
2731 int need_hw_config = 0; 2526 int need_hw_config = 0;
2732 2527
2733 /* Error checks */ 2528 /* Process the commands */
2734 2529
2735 if (is_promisc_enable(new_mode, bitmask)) { 2530 if (is_promisc_enable(new_mode, bitmask)) {
2736 /* If promisc mode is already enabled elsewhere in the system */ 2531 /* If promisc mode is already enabled elsewhere in the system */
2737 if ((rx->bna->rxf_promisc_id != BFI_MAX_RXF) && 2532 if ((rx->bna->rxf_promisc_id != BFI_MAX_RXF) &&
2738 (rx->bna->rxf_promisc_id != rxf->rxf_id)) 2533 (rx->bna->rxf_promisc_id != rxf->rxf_id))
2739 goto err_return; 2534 goto err_return;
2740
2741 /* If default mode is already enabled in the system */
2742 if (rx->bna->rxf_default_id != BFI_MAX_RXF)
2743 goto err_return;
2744
2745 /* Trying to enable promiscuous and default mode together */
2746 if (is_default_enable(new_mode, bitmask))
2747 goto err_return;
2748 }
2749
2750 if (is_default_enable(new_mode, bitmask)) {
2751 /* If default mode is already enabled elsewhere in the system */
2752 if ((rx->bna->rxf_default_id != BFI_MAX_RXF) &&
2753 (rx->bna->rxf_default_id != rxf->rxf_id)) {
2754 goto err_return;
2755 }
2756
2757 /* If promiscuous mode is already enabled in the system */
2758 if (rx->bna->rxf_promisc_id != BFI_MAX_RXF)
2759 goto err_return;
2760 }
2761
2762 /* Process the commands */
2763
2764 if (is_promisc_enable(new_mode, bitmask)) {
2765 if (rxf_promisc_enable(rxf)) 2535 if (rxf_promisc_enable(rxf))
2766 need_hw_config = 1; 2536 need_hw_config = 1;
2767 } else if (is_promisc_disable(new_mode, bitmask)) { 2537 } else if (is_promisc_disable(new_mode, bitmask)) {
@@ -2769,14 +2539,6 @@ bna_rx_mode_set(struct bna_rx *rx, enum bna_rxmode new_mode,
2769 need_hw_config = 1; 2539 need_hw_config = 1;
2770 } 2540 }
2771 2541
2772 if (is_default_enable(new_mode, bitmask)) {
2773 if (rxf_default_enable(rxf))
2774 need_hw_config = 1;
2775 } else if (is_default_disable(new_mode, bitmask)) {
2776 if (rxf_default_disable(rxf))
2777 need_hw_config = 1;
2778 }
2779
2780 if (is_allmulti_enable(new_mode, bitmask)) { 2542 if (is_allmulti_enable(new_mode, bitmask)) {
2781 if (rxf_allmulti_enable(rxf)) 2543 if (rxf_allmulti_enable(rxf))
2782 need_hw_config = 1; 2544 need_hw_config = 1;
@@ -3202,7 +2964,6 @@ bna_init(struct bna *bna, struct bnad *bnad, struct bfa_pcidev *pcidev,
3202 2964
3203 bna_mcam_mod_init(&bna->mcam_mod, bna, res_info); 2965 bna_mcam_mod_init(&bna->mcam_mod, bna, res_info);
3204 2966
3205 bna->rxf_default_id = BFI_MAX_RXF;
3206 bna->rxf_promisc_id = BFI_MAX_RXF; 2967 bna->rxf_promisc_id = BFI_MAX_RXF;
3207 2968
3208 /* Mbox q element for posting stat request to f/w */ 2969 /* Mbox q element for posting stat request to f/w */
diff --git a/drivers/net/bna/bna_txrx.c b/drivers/net/bna/bna_txrx.c
index 50766181d585..58c7664040dc 100644
--- a/drivers/net/bna/bna_txrx.c
+++ b/drivers/net/bna/bna_txrx.c
@@ -1226,8 +1226,7 @@ rxf_process_packet_filter_vlan(struct bna_rxf *rxf)
1226 /* Apply the VLAN filter */ 1226 /* Apply the VLAN filter */
1227 if (rxf->rxf_flags & BNA_RXF_FL_VLAN_CONFIG_PENDING) { 1227 if (rxf->rxf_flags & BNA_RXF_FL_VLAN_CONFIG_PENDING) {
1228 rxf->rxf_flags &= ~BNA_RXF_FL_VLAN_CONFIG_PENDING; 1228 rxf->rxf_flags &= ~BNA_RXF_FL_VLAN_CONFIG_PENDING;
1229 if (!(rxf->rxmode_active & BNA_RXMODE_PROMISC) && 1229 if (!(rxf->rxmode_active & BNA_RXMODE_PROMISC))
1230 !(rxf->rxmode_active & BNA_RXMODE_DEFAULT))
1231 __rxf_vlan_filter_set(rxf, rxf->vlan_filter_status); 1230 __rxf_vlan_filter_set(rxf, rxf->vlan_filter_status);
1232 } 1231 }
1233 1232
@@ -1276,9 +1275,6 @@ rxf_process_packet_filter(struct bna_rxf *rxf)
1276 if (rxf_process_packet_filter_promisc(rxf)) 1275 if (rxf_process_packet_filter_promisc(rxf))
1277 return 1; 1276 return 1;
1278 1277
1279 if (rxf_process_packet_filter_default(rxf))
1280 return 1;
1281
1282 if (rxf_process_packet_filter_allmulti(rxf)) 1278 if (rxf_process_packet_filter_allmulti(rxf))
1283 return 1; 1279 return 1;
1284 1280
@@ -1340,9 +1336,6 @@ rxf_clear_packet_filter(struct bna_rxf *rxf)
1340 if (rxf_clear_packet_filter_promisc(rxf)) 1336 if (rxf_clear_packet_filter_promisc(rxf))
1341 return 1; 1337 return 1;
1342 1338
1343 if (rxf_clear_packet_filter_default(rxf))
1344 return 1;
1345
1346 if (rxf_clear_packet_filter_allmulti(rxf)) 1339 if (rxf_clear_packet_filter_allmulti(rxf))
1347 return 1; 1340 return 1;
1348 1341
@@ -1389,8 +1382,6 @@ rxf_reset_packet_filter(struct bna_rxf *rxf)
1389 1382
1390 rxf_reset_packet_filter_promisc(rxf); 1383 rxf_reset_packet_filter_promisc(rxf);
1391 1384
1392 rxf_reset_packet_filter_default(rxf);
1393
1394 rxf_reset_packet_filter_allmulti(rxf); 1385 rxf_reset_packet_filter_allmulti(rxf);
1395} 1386}
1396 1387
diff --git a/drivers/net/bna/bna_types.h b/drivers/net/bna/bna_types.h
index d79fd98921b8..b9c134f7ad31 100644
--- a/drivers/net/bna/bna_types.h
+++ b/drivers/net/bna/bna_types.h
@@ -165,8 +165,7 @@ enum bna_rxp_type {
165 165
166enum bna_rxmode { 166enum bna_rxmode {
167 BNA_RXMODE_PROMISC = 1, 167 BNA_RXMODE_PROMISC = 1,
168 BNA_RXMODE_DEFAULT = 2, 168 BNA_RXMODE_ALLMULTI = 2
169 BNA_RXMODE_ALLMULTI = 4
170}; 169};
171 170
172enum bna_rx_event { 171enum bna_rx_event {
@@ -1118,7 +1117,6 @@ struct bna {
1118 1117
1119 struct bna_rit_mod rit_mod; 1118 struct bna_rit_mod rit_mod;
1120 1119
1121 int rxf_default_id;
1122 int rxf_promisc_id; 1120 int rxf_promisc_id;
1123 1121
1124 struct bna_mbox_qe mbox_qe; 1122 struct bna_mbox_qe mbox_qe;