diff options
author | Sathya Perla <sathya.perla@emulex.com> | 2011-10-23 22:45:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-24 18:40:14 -0400 |
commit | a54769f51b9495f8313224fea670ab6fe720f4b1 (patch) | |
tree | 5fe4b7932d8d8266858da615ecede00b2ab6d132 | |
parent | 859c20123a6f4bac3fad6506f224908834fe3f68 (diff) |
be2net: add vlan/rx-mode/flow-control config to be_setup()
When a card is reset due to EEH error recovery or due to a suspend,
rx-mode config (promisc/mc) is not being sent to the FW. be_setup() is
called in these flows and is the best place for such config/re-config
cmds. Hence include rx-mode, vlan and flow-control config in
be_setup().
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 121 |
1 files changed, 56 insertions, 65 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 706fc5989939..d05b6bb5ae81 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -796,7 +796,7 @@ static void be_vlan_rem_vid(struct net_device *netdev, u16 vid) | |||
796 | be_vid_config(adapter, false, 0); | 796 | be_vid_config(adapter, false, 0); |
797 | } | 797 | } |
798 | 798 | ||
799 | static void be_set_multicast_list(struct net_device *netdev) | 799 | static void be_set_rx_mode(struct net_device *netdev) |
800 | { | 800 | { |
801 | struct be_adapter *adapter = netdev_priv(netdev); | 801 | struct be_adapter *adapter = netdev_priv(netdev); |
802 | 802 | ||
@@ -2352,17 +2352,6 @@ static int be_open(struct net_device *netdev) | |||
2352 | /* Now that interrupts are on we can process async mcc */ | 2352 | /* Now that interrupts are on we can process async mcc */ |
2353 | be_async_mcc_enable(adapter); | 2353 | be_async_mcc_enable(adapter); |
2354 | 2354 | ||
2355 | if (be_physfn(adapter)) { | ||
2356 | status = be_vid_config(adapter, false, 0); | ||
2357 | if (status) | ||
2358 | goto err; | ||
2359 | |||
2360 | status = be_cmd_set_flow_control(adapter, | ||
2361 | adapter->tx_fc, adapter->rx_fc); | ||
2362 | if (status) | ||
2363 | goto err; | ||
2364 | } | ||
2365 | |||
2366 | return 0; | 2355 | return 0; |
2367 | err: | 2356 | err: |
2368 | be_close(adapter->netdev); | 2357 | be_close(adapter->netdev); |
@@ -2450,10 +2439,40 @@ static inline void be_vf_eth_addr_rem(struct be_adapter *adapter) | |||
2450 | } | 2439 | } |
2451 | } | 2440 | } |
2452 | 2441 | ||
2442 | static int be_clear(struct be_adapter *adapter) | ||
2443 | { | ||
2444 | int vf; | ||
2445 | |||
2446 | if (be_physfn(adapter) && adapter->sriov_enabled) | ||
2447 | be_vf_eth_addr_rem(adapter); | ||
2448 | |||
2449 | be_mcc_queues_destroy(adapter); | ||
2450 | be_rx_queues_destroy(adapter); | ||
2451 | be_tx_queues_destroy(adapter); | ||
2452 | adapter->eq_next_idx = 0; | ||
2453 | |||
2454 | if (be_physfn(adapter) && adapter->sriov_enabled) | ||
2455 | for (vf = 0; vf < num_vfs; vf++) | ||
2456 | if (adapter->vf_cfg[vf].vf_if_handle) | ||
2457 | be_cmd_if_destroy(adapter, | ||
2458 | adapter->vf_cfg[vf].vf_if_handle, | ||
2459 | vf + 1); | ||
2460 | |||
2461 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); | ||
2462 | |||
2463 | adapter->be3_native = false; | ||
2464 | adapter->promiscuous = false; | ||
2465 | |||
2466 | /* tell fw we're done with firing cmds */ | ||
2467 | be_cmd_fw_clean(adapter); | ||
2468 | return 0; | ||
2469 | } | ||
2470 | |||
2453 | static int be_setup(struct be_adapter *adapter) | 2471 | static int be_setup(struct be_adapter *adapter) |
2454 | { | 2472 | { |
2455 | struct net_device *netdev = adapter->netdev; | 2473 | struct net_device *netdev = adapter->netdev; |
2456 | u32 cap_flags, en_flags, vf = 0; | 2474 | u32 cap_flags, en_flags, vf = 0; |
2475 | u32 tx_fc, rx_fc; | ||
2457 | int status; | 2476 | int status; |
2458 | u8 mac[ETH_ALEN]; | 2477 | u8 mac[ETH_ALEN]; |
2459 | 2478 | ||
@@ -2479,7 +2498,7 @@ static int be_setup(struct be_adapter *adapter) | |||
2479 | netdev->dev_addr, false/* pmac_invalid */, | 2498 | netdev->dev_addr, false/* pmac_invalid */, |
2480 | &adapter->if_handle, &adapter->pmac_id, 0); | 2499 | &adapter->if_handle, &adapter->pmac_id, 0); |
2481 | if (status != 0) | 2500 | if (status != 0) |
2482 | goto do_none; | 2501 | goto err; |
2483 | 2502 | ||
2484 | if (be_physfn(adapter)) { | 2503 | if (be_physfn(adapter)) { |
2485 | if (adapter->sriov_enabled) { | 2504 | if (adapter->sriov_enabled) { |
@@ -2494,7 +2513,7 @@ static int be_setup(struct be_adapter *adapter) | |||
2494 | dev_err(&adapter->pdev->dev, | 2513 | dev_err(&adapter->pdev->dev, |
2495 | "Interface Create failed for VF %d\n", | 2514 | "Interface Create failed for VF %d\n", |
2496 | vf); | 2515 | vf); |
2497 | goto if_destroy; | 2516 | goto err; |
2498 | } | 2517 | } |
2499 | adapter->vf_cfg[vf].vf_pmac_id = | 2518 | adapter->vf_cfg[vf].vf_pmac_id = |
2500 | BE_INVALID_PMAC_ID; | 2519 | BE_INVALID_PMAC_ID; |
@@ -2512,70 +2531,46 @@ static int be_setup(struct be_adapter *adapter) | |||
2512 | 2531 | ||
2513 | status = be_tx_queues_create(adapter); | 2532 | status = be_tx_queues_create(adapter); |
2514 | if (status != 0) | 2533 | if (status != 0) |
2515 | goto if_destroy; | 2534 | goto err; |
2516 | 2535 | ||
2517 | status = be_rx_queues_create(adapter); | 2536 | status = be_rx_queues_create(adapter); |
2518 | if (status != 0) | 2537 | if (status != 0) |
2519 | goto tx_qs_destroy; | 2538 | goto err; |
2520 | 2539 | ||
2521 | /* Allow all priorities by default. A GRP5 evt may modify this */ | 2540 | /* Allow all priorities by default. A GRP5 evt may modify this */ |
2522 | adapter->vlan_prio_bmap = 0xff; | 2541 | adapter->vlan_prio_bmap = 0xff; |
2523 | 2542 | ||
2524 | status = be_mcc_queues_create(adapter); | 2543 | status = be_mcc_queues_create(adapter); |
2525 | if (status != 0) | 2544 | if (status != 0) |
2526 | goto rx_qs_destroy; | 2545 | goto err; |
2527 | 2546 | ||
2528 | adapter->link_speed = -1; | 2547 | adapter->link_speed = -1; |
2529 | 2548 | ||
2530 | be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL); | 2549 | be_cmd_get_fw_ver(adapter, adapter->fw_ver, NULL); |
2531 | 2550 | ||
2532 | pcie_set_readrq(adapter->pdev, 4096); | 2551 | status = be_vid_config(adapter, false, 0); |
2533 | return 0; | 2552 | if (status) |
2534 | 2553 | goto err; | |
2535 | rx_qs_destroy: | ||
2536 | be_rx_queues_destroy(adapter); | ||
2537 | tx_qs_destroy: | ||
2538 | be_tx_queues_destroy(adapter); | ||
2539 | if_destroy: | ||
2540 | if (be_physfn(adapter) && adapter->sriov_enabled) | ||
2541 | for (vf = 0; vf < num_vfs; vf++) | ||
2542 | if (adapter->vf_cfg[vf].vf_if_handle) | ||
2543 | be_cmd_if_destroy(adapter, | ||
2544 | adapter->vf_cfg[vf].vf_if_handle, | ||
2545 | vf + 1); | ||
2546 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); | ||
2547 | do_none: | ||
2548 | return status; | ||
2549 | } | ||
2550 | |||
2551 | static int be_clear(struct be_adapter *adapter) | ||
2552 | { | ||
2553 | int vf; | ||
2554 | |||
2555 | if (be_physfn(adapter) && adapter->sriov_enabled) | ||
2556 | be_vf_eth_addr_rem(adapter); | ||
2557 | |||
2558 | be_mcc_queues_destroy(adapter); | ||
2559 | be_rx_queues_destroy(adapter); | ||
2560 | be_tx_queues_destroy(adapter); | ||
2561 | adapter->eq_next_idx = 0; | ||
2562 | |||
2563 | if (be_physfn(adapter) && adapter->sriov_enabled) | ||
2564 | for (vf = 0; vf < num_vfs; vf++) | ||
2565 | if (adapter->vf_cfg[vf].vf_if_handle) | ||
2566 | be_cmd_if_destroy(adapter, | ||
2567 | adapter->vf_cfg[vf].vf_if_handle, | ||
2568 | vf + 1); | ||
2569 | 2554 | ||
2570 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); | 2555 | be_set_rx_mode(adapter->netdev); |
2571 | 2556 | ||
2572 | adapter->be3_native = 0; | 2557 | status = be_cmd_get_flow_control(adapter, &tx_fc, &rx_fc); |
2558 | if (status) | ||
2559 | goto err; | ||
2560 | if (rx_fc != adapter->rx_fc || tx_fc != adapter->tx_fc) { | ||
2561 | status = be_cmd_set_flow_control(adapter, adapter->tx_fc, | ||
2562 | adapter->rx_fc); | ||
2563 | if (status) | ||
2564 | goto err; | ||
2565 | } | ||
2573 | 2566 | ||
2574 | /* tell fw we're done with firing cmds */ | 2567 | pcie_set_readrq(adapter->pdev, 4096); |
2575 | be_cmd_fw_clean(adapter); | ||
2576 | return 0; | 2568 | return 0; |
2577 | } | ||
2578 | 2569 | ||
2570 | err: | ||
2571 | be_clear(adapter); | ||
2572 | return status; | ||
2573 | } | ||
2579 | 2574 | ||
2580 | #define FW_FILE_HDR_SIGN "ServerEngines Corp. " | 2575 | #define FW_FILE_HDR_SIGN "ServerEngines Corp. " |
2581 | static bool be_flash_redboot(struct be_adapter *adapter, | 2576 | static bool be_flash_redboot(struct be_adapter *adapter, |
@@ -2915,7 +2910,7 @@ static struct net_device_ops be_netdev_ops = { | |||
2915 | .ndo_open = be_open, | 2910 | .ndo_open = be_open, |
2916 | .ndo_stop = be_close, | 2911 | .ndo_stop = be_close, |
2917 | .ndo_start_xmit = be_xmit, | 2912 | .ndo_start_xmit = be_xmit, |
2918 | .ndo_set_rx_mode = be_set_multicast_list, | 2913 | .ndo_set_rx_mode = be_set_rx_mode, |
2919 | .ndo_set_mac_address = be_mac_addr_set, | 2914 | .ndo_set_mac_address = be_mac_addr_set, |
2920 | .ndo_change_mtu = be_change_mtu, | 2915 | .ndo_change_mtu = be_change_mtu, |
2921 | .ndo_get_stats64 = be_get_stats64, | 2916 | .ndo_get_stats64 = be_get_stats64, |
@@ -2948,10 +2943,6 @@ static void be_netdev_init(struct net_device *netdev) | |||
2948 | 2943 | ||
2949 | netdev->flags |= IFF_MULTICAST; | 2944 | netdev->flags |= IFF_MULTICAST; |
2950 | 2945 | ||
2951 | /* Default settings for Rx and Tx flow control */ | ||
2952 | adapter->rx_fc = true; | ||
2953 | adapter->tx_fc = true; | ||
2954 | |||
2955 | netif_set_gso_max_size(netdev, 65535); | 2946 | netif_set_gso_max_size(netdev, 65535); |
2956 | 2947 | ||
2957 | BE_SET_NETDEV_OPS(netdev, &be_netdev_ops); | 2948 | BE_SET_NETDEV_OPS(netdev, &be_netdev_ops); |
@@ -3373,6 +3364,7 @@ static int __devinit be_probe(struct pci_dev *pdev, | |||
3373 | be_msix_enable(adapter); | 3364 | be_msix_enable(adapter); |
3374 | 3365 | ||
3375 | INIT_DELAYED_WORK(&adapter->work, be_worker); | 3366 | INIT_DELAYED_WORK(&adapter->work, be_worker); |
3367 | adapter->rx_fc = adapter->tx_fc = true; | ||
3376 | 3368 | ||
3377 | status = be_setup(adapter); | 3369 | status = be_setup(adapter); |
3378 | if (status) | 3370 | if (status) |
@@ -3448,7 +3440,6 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3448 | be_close(netdev); | 3440 | be_close(netdev); |
3449 | rtnl_unlock(); | 3441 | rtnl_unlock(); |
3450 | } | 3442 | } |
3451 | be_cmd_get_flow_control(adapter, &adapter->tx_fc, &adapter->rx_fc); | ||
3452 | be_clear(adapter); | 3443 | be_clear(adapter); |
3453 | 3444 | ||
3454 | be_msix_disable(adapter); | 3445 | be_msix_disable(adapter); |