diff options
author | Anirban Chakraborty <anirban.chakraborty@qlogic.com> | 2011-04-01 10:28:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 15:47:12 -0400 |
commit | 8816d0099b9c0f48452b69471c2f54037f7e0e3b (patch) | |
tree | 7c22e00a48baa5bebc5a0692288bbba75893dd54 | |
parent | b9796a14d9705c4be4a080a4fe39379a51681374 (diff) |
qlcnic: Remove unused code
Cleaned up unused codes for interrupt coalescence settings
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 56 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ethtool.c | 30 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_hw.c | 20 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 21 |
4 files changed, 46 insertions, 81 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index be9c32944de5..9d2e630c3895 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -392,6 +392,25 @@ struct qlcnic_rx_buffer { | |||
392 | #define QLCNIC_XGBE 0x02 | 392 | #define QLCNIC_XGBE 0x02 |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * Interrupt coalescing defaults. The defaults are for 1500 MTU. It is | ||
396 | * adjusted based on configured MTU. | ||
397 | */ | ||
398 | #define QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US 3 | ||
399 | #define QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS 256 | ||
400 | |||
401 | #define QLCNIC_INTR_DEFAULT 0x04 | ||
402 | #define QLCNIC_CONFIG_INTR_COALESCE 3 | ||
403 | |||
404 | struct qlcnic_nic_intr_coalesce { | ||
405 | u8 type; | ||
406 | u8 sts_ring_mask; | ||
407 | u16 rx_packets; | ||
408 | u16 rx_time_us; | ||
409 | u16 flag; | ||
410 | u32 timer_out; | ||
411 | }; | ||
412 | |||
413 | /* | ||
395 | * One hardware_context{} per adapter | 414 | * One hardware_context{} per adapter |
396 | * contains interrupt info as well shared hardware info. | 415 | * contains interrupt info as well shared hardware info. |
397 | */ | 416 | */ |
@@ -409,6 +428,8 @@ struct qlcnic_hardware_context { | |||
409 | u8 linkup; | 428 | u8 linkup; |
410 | u16 port_type; | 429 | u16 port_type; |
411 | u16 board_type; | 430 | u16 board_type; |
431 | |||
432 | struct qlcnic_nic_intr_coalesce coal; | ||
412 | }; | 433 | }; |
413 | 434 | ||
414 | struct qlcnic_adapter_stats { | 435 | struct qlcnic_adapter_stats { |
@@ -721,40 +742,6 @@ struct qlcnic_mac_list_s { | |||
721 | uint8_t mac_addr[ETH_ALEN+2]; | 742 | uint8_t mac_addr[ETH_ALEN+2]; |
722 | }; | 743 | }; |
723 | 744 | ||
724 | /* | ||
725 | * Interrupt coalescing defaults. The defaults are for 1500 MTU. It is | ||
726 | * adjusted based on configured MTU. | ||
727 | */ | ||
728 | #define QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US 3 | ||
729 | #define QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS 256 | ||
730 | #define QLCNIC_DEFAULT_INTR_COALESCE_TX_PACKETS 64 | ||
731 | #define QLCNIC_DEFAULT_INTR_COALESCE_TX_TIME_US 4 | ||
732 | |||
733 | #define QLCNIC_INTR_DEFAULT 0x04 | ||
734 | |||
735 | union qlcnic_nic_intr_coalesce_data { | ||
736 | struct { | ||
737 | u16 rx_packets; | ||
738 | u16 rx_time_us; | ||
739 | u16 tx_packets; | ||
740 | u16 tx_time_us; | ||
741 | } data; | ||
742 | u64 word; | ||
743 | }; | ||
744 | |||
745 | struct qlcnic_nic_intr_coalesce { | ||
746 | u16 stats_time_us; | ||
747 | u16 rate_sample_time; | ||
748 | u16 flags; | ||
749 | u16 rsvd_1; | ||
750 | u32 low_threshold; | ||
751 | u32 high_threshold; | ||
752 | union qlcnic_nic_intr_coalesce_data normal; | ||
753 | union qlcnic_nic_intr_coalesce_data low; | ||
754 | union qlcnic_nic_intr_coalesce_data high; | ||
755 | union qlcnic_nic_intr_coalesce_data irq; | ||
756 | }; | ||
757 | |||
758 | #define QLCNIC_HOST_REQUEST 0x13 | 745 | #define QLCNIC_HOST_REQUEST 0x13 |
759 | #define QLCNIC_REQUEST 0x14 | 746 | #define QLCNIC_REQUEST 0x14 |
760 | 747 | ||
@@ -1002,7 +989,6 @@ struct qlcnic_adapter { | |||
1002 | 989 | ||
1003 | struct delayed_work fw_work; | 990 | struct delayed_work fw_work; |
1004 | 991 | ||
1005 | struct qlcnic_nic_intr_coalesce coal; | ||
1006 | 992 | ||
1007 | struct qlcnic_filter_hash fhash; | 993 | struct qlcnic_filter_hash fhash; |
1008 | 994 | ||
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index 7e53cad6be16..24a79a6fc73d 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -936,8 +936,8 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, | |||
936 | */ | 936 | */ |
937 | if (ethcoal->rx_coalesce_usecs > 0xffff || | 937 | if (ethcoal->rx_coalesce_usecs > 0xffff || |
938 | ethcoal->rx_max_coalesced_frames > 0xffff || | 938 | ethcoal->rx_max_coalesced_frames > 0xffff || |
939 | ethcoal->tx_coalesce_usecs > 0xffff || | 939 | ethcoal->tx_coalesce_usecs || |
940 | ethcoal->tx_max_coalesced_frames > 0xffff || | 940 | ethcoal->tx_max_coalesced_frames || |
941 | ethcoal->rx_coalesce_usecs_irq || | 941 | ethcoal->rx_coalesce_usecs_irq || |
942 | ethcoal->rx_max_coalesced_frames_irq || | 942 | ethcoal->rx_max_coalesced_frames_irq || |
943 | ethcoal->tx_coalesce_usecs_irq || | 943 | ethcoal->tx_coalesce_usecs_irq || |
@@ -959,21 +959,17 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, | |||
959 | 959 | ||
960 | if (!ethcoal->rx_coalesce_usecs || | 960 | if (!ethcoal->rx_coalesce_usecs || |
961 | !ethcoal->rx_max_coalesced_frames) { | 961 | !ethcoal->rx_max_coalesced_frames) { |
962 | adapter->coal.flags = QLCNIC_INTR_DEFAULT; | 962 | adapter->ahw->coal.flag = QLCNIC_INTR_DEFAULT; |
963 | adapter->coal.normal.data.rx_time_us = | 963 | adapter->ahw->coal.rx_time_us = |
964 | QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; | 964 | QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; |
965 | adapter->coal.normal.data.rx_packets = | 965 | adapter->ahw->coal.rx_packets = |
966 | QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; | 966 | QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; |
967 | } else { | 967 | } else { |
968 | adapter->coal.flags = 0; | 968 | adapter->ahw->coal.flag = 0; |
969 | adapter->coal.normal.data.rx_time_us = | 969 | adapter->ahw->coal.rx_time_us = ethcoal->rx_coalesce_usecs; |
970 | ethcoal->rx_coalesce_usecs; | 970 | adapter->ahw->coal.rx_packets = |
971 | adapter->coal.normal.data.rx_packets = | 971 | ethcoal->rx_max_coalesced_frames; |
972 | ethcoal->rx_max_coalesced_frames; | ||
973 | } | 972 | } |
974 | adapter->coal.normal.data.tx_time_us = ethcoal->tx_coalesce_usecs; | ||
975 | adapter->coal.normal.data.tx_packets = | ||
976 | ethcoal->tx_max_coalesced_frames; | ||
977 | 973 | ||
978 | qlcnic_config_intr_coalesce(adapter); | 974 | qlcnic_config_intr_coalesce(adapter); |
979 | 975 | ||
@@ -988,12 +984,8 @@ static int qlcnic_get_intr_coalesce(struct net_device *netdev, | |||
988 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 984 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
989 | return -EINVAL; | 985 | return -EINVAL; |
990 | 986 | ||
991 | ethcoal->rx_coalesce_usecs = adapter->coal.normal.data.rx_time_us; | 987 | ethcoal->rx_coalesce_usecs = adapter->ahw->coal.rx_time_us; |
992 | ethcoal->tx_coalesce_usecs = adapter->coal.normal.data.tx_time_us; | 988 | ethcoal->rx_max_coalesced_frames = adapter->ahw->coal.rx_packets; |
993 | ethcoal->rx_max_coalesced_frames = | ||
994 | adapter->coal.normal.data.rx_packets; | ||
995 | ethcoal->tx_max_coalesced_frames = | ||
996 | adapter->coal.normal.data.tx_packets; | ||
997 | 989 | ||
998 | return 0; | 990 | return 0; |
999 | } | 991 | } |
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index 7e3f52690e3f..3901be85dcac 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c | |||
@@ -532,33 +532,31 @@ void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter) | |||
532 | } | 532 | } |
533 | } | 533 | } |
534 | 534 | ||
535 | #define QLCNIC_CONFIG_INTR_COALESCE 3 | ||
536 | |||
537 | /* | 535 | /* |
538 | * Send the interrupt coalescing parameter set by ethtool to the card. | 536 | * Send the interrupt coalescing parameter set by ethtool to the card. |
539 | */ | 537 | */ |
540 | int qlcnic_config_intr_coalesce(struct qlcnic_adapter *adapter) | 538 | int qlcnic_config_intr_coalesce(struct qlcnic_adapter *adapter) |
541 | { | 539 | { |
542 | struct qlcnic_nic_req req; | 540 | struct qlcnic_nic_req req; |
543 | u64 word[6]; | 541 | int rv; |
544 | int rv, i; | ||
545 | 542 | ||
546 | memset(&req, 0, sizeof(struct qlcnic_nic_req)); | 543 | memset(&req, 0, sizeof(struct qlcnic_nic_req)); |
547 | 544 | ||
548 | req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23); | 545 | req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23); |
549 | 546 | ||
550 | word[0] = QLCNIC_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16); | 547 | req.req_hdr = cpu_to_le64(QLCNIC_CONFIG_INTR_COALESCE | |
551 | req.req_hdr = cpu_to_le64(word[0]); | 548 | ((u64) adapter->portnum << 16)); |
552 | |||
553 | memcpy(&word[0], &adapter->coal, sizeof(adapter->coal)); | ||
554 | for (i = 0; i < 6; i++) | ||
555 | req.words[i] = cpu_to_le64(word[i]); | ||
556 | 549 | ||
550 | req.words[0] = cpu_to_le64(((u64) adapter->ahw->coal.flag) << 32); | ||
551 | req.words[2] = cpu_to_le64(adapter->ahw->coal.rx_packets | | ||
552 | ((u64) adapter->ahw->coal.rx_time_us) << 16); | ||
553 | req.words[5] = cpu_to_le64(adapter->ahw->coal.timer_out | | ||
554 | ((u64) adapter->ahw->coal.type) << 32 | | ||
555 | ((u64) adapter->ahw->coal.sts_ring_mask) << 40); | ||
557 | rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); | 556 | rv = qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); |
558 | if (rv != 0) | 557 | if (rv != 0) |
559 | dev_err(&adapter->netdev->dev, | 558 | dev_err(&adapter->netdev->dev, |
560 | "Could not send interrupt coalescing parameters\n"); | 559 | "Could not send interrupt coalescing parameters\n"); |
561 | |||
562 | return rv; | 560 | return rv; |
563 | } | 561 | } |
564 | 562 | ||
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index b75aef059adc..8bf9a968f7f2 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -1097,20 +1097,6 @@ qlcnic_free_irq(struct qlcnic_adapter *adapter) | |||
1097 | } | 1097 | } |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | static void | ||
1101 | qlcnic_init_coalesce_defaults(struct qlcnic_adapter *adapter) | ||
1102 | { | ||
1103 | adapter->coal.flags = QLCNIC_INTR_DEFAULT; | ||
1104 | adapter->coal.normal.data.rx_time_us = | ||
1105 | QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; | ||
1106 | adapter->coal.normal.data.rx_packets = | ||
1107 | QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; | ||
1108 | adapter->coal.normal.data.tx_time_us = | ||
1109 | QLCNIC_DEFAULT_INTR_COALESCE_TX_TIME_US; | ||
1110 | adapter->coal.normal.data.tx_packets = | ||
1111 | QLCNIC_DEFAULT_INTR_COALESCE_TX_PACKETS; | ||
1112 | } | ||
1113 | |||
1114 | static int | 1100 | static int |
1115 | __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | 1101 | __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) |
1116 | { | 1102 | { |
@@ -1244,8 +1230,6 @@ qlcnic_attach(struct qlcnic_adapter *adapter) | |||
1244 | goto err_out_free_hw; | 1230 | goto err_out_free_hw; |
1245 | } | 1231 | } |
1246 | 1232 | ||
1247 | qlcnic_init_coalesce_defaults(adapter); | ||
1248 | |||
1249 | qlcnic_create_sysfs_entries(adapter); | 1233 | qlcnic_create_sysfs_entries(adapter); |
1250 | 1234 | ||
1251 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; | 1235 | adapter->is_up = QLCNIC_ADAPTER_UP_MAGIC; |
@@ -1326,7 +1310,12 @@ static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) | |||
1326 | kfree(adapter->ahw); | 1310 | kfree(adapter->ahw); |
1327 | adapter->ahw = NULL; | 1311 | adapter->ahw = NULL; |
1328 | err = -ENOMEM; | 1312 | err = -ENOMEM; |
1313 | goto err_out; | ||
1329 | } | 1314 | } |
1315 | /* Initialize interrupt coalesce parameters */ | ||
1316 | adapter->ahw->coal.flag = QLCNIC_INTR_DEFAULT; | ||
1317 | adapter->ahw->coal.rx_time_us = QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; | ||
1318 | adapter->ahw->coal.rx_packets = QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; | ||
1330 | err_out: | 1319 | err_out: |
1331 | return err; | 1320 | return err; |
1332 | } | 1321 | } |