diff options
Diffstat (limited to 'drivers/net/ethernet/qlogic')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 66 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 69 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 38 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | 20 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 116 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 327 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 4 |
12 files changed, 404 insertions, 311 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 2d818c1a469b..3109730556be 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -98,8 +98,22 @@ | |||
98 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ | 98 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ |
99 | + MGMT_CMD_DESC_RESV) | 99 | + MGMT_CMD_DESC_RESV) |
100 | #define QLCNIC_MAX_TX_TIMEOUTS 2 | 100 | #define QLCNIC_MAX_TX_TIMEOUTS 2 |
101 | #define QLCNIC_MAX_TX_RINGS 8 | 101 | |
102 | #define QLCNIC_MAX_SDS_RINGS 8 | 102 | /* Driver will use 1 Tx ring in INT-x/MSI/SRIOV mode. */ |
103 | #define QLCNIC_SINGLE_RING 1 | ||
104 | #define QLCNIC_DEF_SDS_RINGS 4 | ||
105 | #define QLCNIC_DEF_TX_RINGS 4 | ||
106 | #define QLCNIC_MAX_VNIC_TX_RINGS 4 | ||
107 | #define QLCNIC_MAX_VNIC_SDS_RINGS 4 | ||
108 | |||
109 | enum qlcnic_queue_type { | ||
110 | QLCNIC_TX_QUEUE = 1, | ||
111 | QLCNIC_RX_QUEUE, | ||
112 | }; | ||
113 | |||
114 | /* Operational mode for driver */ | ||
115 | #define QLCNIC_VNIC_MODE 0xFF | ||
116 | #define QLCNIC_DEFAULT_MODE 0x0 | ||
103 | 117 | ||
104 | /* | 118 | /* |
105 | * Following are the states of the Phantom. Phantom will set them and | 119 | * Following are the states of the Phantom. Phantom will set them and |
@@ -945,8 +959,6 @@ struct qlcnic_ipaddr { | |||
945 | #define QLCNIC_BEACON_EANBLE 0xC | 959 | #define QLCNIC_BEACON_EANBLE 0xC |
946 | #define QLCNIC_BEACON_DISABLE 0xD | 960 | #define QLCNIC_BEACON_DISABLE 0xD |
947 | 961 | ||
948 | #define QLCNIC_DEF_NUM_STS_DESC_RINGS 4 | ||
949 | #define QLCNIC_DEF_NUM_TX_RINGS 4 | ||
950 | #define QLCNIC_MSIX_TBL_SPACE 8192 | 962 | #define QLCNIC_MSIX_TBL_SPACE 8192 |
951 | #define QLCNIC_PCI_REG_MSIX_TBL 0x44 | 963 | #define QLCNIC_PCI_REG_MSIX_TBL 0x44 |
952 | #define QLCNIC_MSIX_TBL_PGSIZE 4096 | 964 | #define QLCNIC_MSIX_TBL_PGSIZE 4096 |
@@ -1017,7 +1029,6 @@ struct qlcnic_adapter { | |||
1017 | unsigned long state; | 1029 | unsigned long state; |
1018 | u32 flags; | 1030 | u32 flags; |
1019 | 1031 | ||
1020 | int max_drv_tx_rings; | ||
1021 | u16 num_txd; | 1032 | u16 num_txd; |
1022 | u16 num_rxd; | 1033 | u16 num_rxd; |
1023 | u16 num_jumbo_rxd; | 1034 | u16 num_jumbo_rxd; |
@@ -1025,7 +1036,13 @@ struct qlcnic_adapter { | |||
1025 | u16 max_jumbo_rxd; | 1036 | u16 max_jumbo_rxd; |
1026 | 1037 | ||
1027 | u8 max_rds_rings; | 1038 | u8 max_rds_rings; |
1028 | u8 max_sds_rings; | 1039 | |
1040 | u8 max_sds_rings; /* max sds rings supported by adapter */ | ||
1041 | u8 max_tx_rings; /* max tx rings supported by adapter */ | ||
1042 | |||
1043 | u8 drv_tx_rings; /* max tx rings supported by driver */ | ||
1044 | u8 drv_sds_rings; /* max sds rings supported by driver */ | ||
1045 | |||
1029 | u8 rx_csum; | 1046 | u8 rx_csum; |
1030 | u8 portnum; | 1047 | u8 portnum; |
1031 | 1048 | ||
@@ -1548,12 +1565,13 @@ int qlcnic_loopback_test(struct net_device *, u8); | |||
1548 | 1565 | ||
1549 | /* Functions from qlcnic_main.c */ | 1566 | /* Functions from qlcnic_main.c */ |
1550 | int qlcnic_reset_context(struct qlcnic_adapter *); | 1567 | int qlcnic_reset_context(struct qlcnic_adapter *); |
1551 | void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings); | 1568 | void qlcnic_diag_free_res(struct net_device *netdev, int); |
1552 | int qlcnic_diag_alloc_res(struct net_device *netdev, int test); | 1569 | int qlcnic_diag_alloc_res(struct net_device *netdev, int); |
1553 | netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 1570 | netdev_tx_t qlcnic_xmit_frame(struct sk_buff *, struct net_device *); |
1554 | int qlcnic_set_max_rss(struct qlcnic_adapter *, u8, int); | 1571 | void qlcnic_set_tx_ring_count(struct qlcnic_adapter *, u8); |
1555 | int qlcnic_validate_max_rss(struct qlcnic_adapter *, __u32); | 1572 | void qlcnic_set_sds_ring_count(struct qlcnic_adapter *, u8); |
1556 | int qlcnic_validate_max_tx_rings(struct qlcnic_adapter *, u32 txq); | 1573 | int qlcnic_setup_rings(struct qlcnic_adapter *, u8, u8); |
1574 | int qlcnic_validate_rings(struct qlcnic_adapter *, __u32, int); | ||
1557 | void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter); | 1575 | void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter); |
1558 | void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *); | 1576 | void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *); |
1559 | int qlcnic_enable_msix(struct qlcnic_adapter *, u32); | 1577 | int qlcnic_enable_msix(struct qlcnic_adapter *, u32); |
@@ -1646,19 +1664,18 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring) | |||
1646 | static inline int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter, | 1664 | static inline int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter, |
1647 | struct net_device *netdev) | 1665 | struct net_device *netdev) |
1648 | { | 1666 | { |
1649 | int err, tx_q; | 1667 | int err; |
1650 | |||
1651 | tx_q = adapter->max_drv_tx_rings; | ||
1652 | 1668 | ||
1653 | netdev->num_tx_queues = tx_q; | 1669 | netdev->num_tx_queues = adapter->drv_tx_rings; |
1654 | netdev->real_num_tx_queues = tx_q; | 1670 | netdev->real_num_tx_queues = adapter->drv_tx_rings; |
1655 | 1671 | ||
1656 | err = netif_set_real_num_tx_queues(netdev, tx_q); | 1672 | err = netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings); |
1657 | if (err) | 1673 | if (err) |
1658 | dev_err(&adapter->pdev->dev, "failed to set %d Tx queues\n", | 1674 | dev_err(&adapter->pdev->dev, "failed to set %d Tx queues\n", |
1659 | tx_q); | 1675 | adapter->drv_tx_rings); |
1660 | else | 1676 | else |
1661 | dev_info(&adapter->pdev->dev, "set %d Tx queues\n", tx_q); | 1677 | dev_info(&adapter->pdev->dev, "Set %d Tx queues\n", |
1678 | adapter->drv_tx_rings); | ||
1662 | 1679 | ||
1663 | return err; | 1680 | return err; |
1664 | } | 1681 | } |
@@ -1700,7 +1717,7 @@ struct qlcnic_hardware_ops { | |||
1700 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); | 1717 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); |
1701 | void (*get_ocm_win) (struct qlcnic_hardware_context *); | 1718 | void (*get_ocm_win) (struct qlcnic_hardware_context *); |
1702 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *, u8); | 1719 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *, u8); |
1703 | int (*setup_intr) (struct qlcnic_adapter *, u8, int); | 1720 | int (*setup_intr) (struct qlcnic_adapter *); |
1704 | int (*alloc_mbx_args)(struct qlcnic_cmd_args *, | 1721 | int (*alloc_mbx_args)(struct qlcnic_cmd_args *, |
1705 | struct qlcnic_adapter *, u32); | 1722 | struct qlcnic_adapter *, u32); |
1706 | int (*mbx_cmd) (struct qlcnic_adapter *, struct qlcnic_cmd_args *); | 1723 | int (*mbx_cmd) (struct qlcnic_adapter *, struct qlcnic_cmd_args *); |
@@ -1771,10 +1788,9 @@ static inline int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, | |||
1771 | return adapter->ahw->hw_ops->get_mac_address(adapter, mac, function); | 1788 | return adapter->ahw->hw_ops->get_mac_address(adapter, mac, function); |
1772 | } | 1789 | } |
1773 | 1790 | ||
1774 | static inline int qlcnic_setup_intr(struct qlcnic_adapter *adapter, | 1791 | static inline int qlcnic_setup_intr(struct qlcnic_adapter *adapter) |
1775 | u8 num_intr, int txq) | ||
1776 | { | 1792 | { |
1777 | return adapter->ahw->hw_ops->setup_intr(adapter, num_intr, txq); | 1793 | return adapter->ahw->hw_ops->setup_intr(adapter); |
1778 | } | 1794 | } |
1779 | 1795 | ||
1780 | static inline int qlcnic_alloc_mbx_args(struct qlcnic_cmd_args *mbx, | 1796 | static inline int qlcnic_alloc_mbx_args(struct qlcnic_cmd_args *mbx, |
@@ -2010,7 +2026,7 @@ static inline bool qlcnic_check_multi_tx(struct qlcnic_adapter *adapter) | |||
2010 | static inline void qlcnic_disable_multi_tx(struct qlcnic_adapter *adapter) | 2026 | static inline void qlcnic_disable_multi_tx(struct qlcnic_adapter *adapter) |
2011 | { | 2027 | { |
2012 | test_and_clear_bit(__QLCNIC_MULTI_TX_UNIQUE, &adapter->state); | 2028 | test_and_clear_bit(__QLCNIC_MULTI_TX_UNIQUE, &adapter->state); |
2013 | adapter->max_drv_tx_rings = 1; | 2029 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; |
2014 | } | 2030 | } |
2015 | 2031 | ||
2016 | /* When operating in a muti tx mode, driver needs to write 0x1 | 2032 | /* When operating in a muti tx mode, driver needs to write 0x1 |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 359e0f279b71..df6c6f51c609 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/aer.h> | 14 | #include <linux/aer.h> |
15 | 15 | ||
16 | #define QLCNIC_MAX_TX_QUEUES 1 | ||
17 | #define RSS_HASHTYPE_IP_TCP 0x3 | 16 | #define RSS_HASHTYPE_IP_TCP 0x3 |
18 | #define QLC_83XX_FW_MBX_CMD 0 | 17 | #define QLC_83XX_FW_MBX_CMD 0 |
19 | 18 | ||
@@ -268,20 +267,18 @@ int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, | |||
268 | } | 267 | } |
269 | } | 268 | } |
270 | 269 | ||
271 | int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter, u8 num_intr, int txq) | 270 | int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter) |
272 | { | 271 | { |
273 | int err, i, num_msix; | 272 | int err, i, num_msix; |
274 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 273 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
275 | 274 | ||
276 | if (!num_intr) | 275 | num_msix = adapter->drv_sds_rings; |
277 | num_intr = QLCNIC_DEF_NUM_STS_DESC_RINGS; | 276 | |
278 | num_msix = rounddown_pow_of_two(min_t(int, num_online_cpus(), | ||
279 | num_intr)); | ||
280 | /* account for AEN interrupt MSI-X based interrupts */ | 277 | /* account for AEN interrupt MSI-X based interrupts */ |
281 | num_msix += 1; | 278 | num_msix += 1; |
282 | 279 | ||
283 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) | 280 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) |
284 | num_msix += adapter->max_drv_tx_rings; | 281 | num_msix += adapter->drv_tx_rings; |
285 | 282 | ||
286 | err = qlcnic_enable_msix(adapter, num_msix); | 283 | err = qlcnic_enable_msix(adapter, num_msix); |
287 | if (err == -ENOMEM) | 284 | if (err == -ENOMEM) |
@@ -986,14 +983,14 @@ static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter) | |||
986 | 983 | ||
987 | sds_mbx_size = sizeof(struct qlcnic_sds_mbx); | 984 | sds_mbx_size = sizeof(struct qlcnic_sds_mbx); |
988 | context_id = recv_ctx->context_id; | 985 | context_id = recv_ctx->context_id; |
989 | num_sds = (adapter->max_sds_rings - QLCNIC_MAX_RING_SETS); | 986 | num_sds = adapter->drv_sds_rings - QLCNIC_MAX_SDS_RINGS; |
990 | ahw->hw_ops->alloc_mbx_args(&cmd, adapter, | 987 | ahw->hw_ops->alloc_mbx_args(&cmd, adapter, |
991 | QLCNIC_CMD_ADD_RCV_RINGS); | 988 | QLCNIC_CMD_ADD_RCV_RINGS); |
992 | cmd.req.arg[1] = 0 | (num_sds << 8) | (context_id << 16); | 989 | cmd.req.arg[1] = 0 | (num_sds << 8) | (context_id << 16); |
993 | 990 | ||
994 | /* set up status rings, mbx 2-81 */ | 991 | /* set up status rings, mbx 2-81 */ |
995 | index = 2; | 992 | index = 2; |
996 | for (i = 8; i < adapter->max_sds_rings; i++) { | 993 | for (i = 8; i < adapter->drv_sds_rings; i++) { |
997 | memset(&sds_mbx, 0, sds_mbx_size); | 994 | memset(&sds_mbx, 0, sds_mbx_size); |
998 | sds = &recv_ctx->sds_rings[i]; | 995 | sds = &recv_ctx->sds_rings[i]; |
999 | sds->consumer = 0; | 996 | sds->consumer = 0; |
@@ -1028,7 +1025,7 @@ static int qlcnic_83xx_add_rings(struct qlcnic_adapter *adapter) | |||
1028 | mbx_out = (struct qlcnic_add_rings_mbx_out *)&cmd.rsp.arg[1]; | 1025 | mbx_out = (struct qlcnic_add_rings_mbx_out *)&cmd.rsp.arg[1]; |
1029 | index = 0; | 1026 | index = 0; |
1030 | /* status descriptor ring */ | 1027 | /* status descriptor ring */ |
1031 | for (i = 8; i < adapter->max_sds_rings; i++) { | 1028 | for (i = 8; i < adapter->drv_sds_rings; i++) { |
1032 | sds = &recv_ctx->sds_rings[i]; | 1029 | sds = &recv_ctx->sds_rings[i]; |
1033 | sds->crb_sts_consumer = ahw->pci_base0 + | 1030 | sds->crb_sts_consumer = ahw->pci_base0 + |
1034 | mbx_out->host_csmr[index]; | 1031 | mbx_out->host_csmr[index]; |
@@ -1086,10 +1083,10 @@ int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
1086 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 1083 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
1087 | num_rds = adapter->max_rds_rings; | 1084 | num_rds = adapter->max_rds_rings; |
1088 | 1085 | ||
1089 | if (adapter->max_sds_rings <= QLCNIC_MAX_RING_SETS) | 1086 | if (adapter->drv_sds_rings <= QLCNIC_MAX_SDS_RINGS) |
1090 | num_sds = adapter->max_sds_rings; | 1087 | num_sds = adapter->drv_sds_rings; |
1091 | else | 1088 | else |
1092 | num_sds = QLCNIC_MAX_RING_SETS; | 1089 | num_sds = QLCNIC_MAX_SDS_RINGS; |
1093 | 1090 | ||
1094 | sds_mbx_size = sizeof(struct qlcnic_sds_mbx); | 1091 | sds_mbx_size = sizeof(struct qlcnic_sds_mbx); |
1095 | rds_mbx_size = sizeof(struct qlcnic_rds_mbx); | 1092 | rds_mbx_size = sizeof(struct qlcnic_rds_mbx); |
@@ -1190,7 +1187,7 @@ int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
1190 | sds->crb_intr_mask = ahw->pci_base0 + intr_mask; | 1187 | sds->crb_intr_mask = ahw->pci_base0 + intr_mask; |
1191 | } | 1188 | } |
1192 | 1189 | ||
1193 | if (adapter->max_sds_rings > QLCNIC_MAX_RING_SETS) | 1190 | if (adapter->drv_sds_rings > QLCNIC_MAX_SDS_RINGS) |
1194 | err = qlcnic_83xx_add_rings(adapter); | 1191 | err = qlcnic_83xx_add_rings(adapter); |
1195 | out: | 1192 | out: |
1196 | qlcnic_free_mbx_args(&cmd); | 1193 | qlcnic_free_mbx_args(&cmd); |
@@ -1246,9 +1243,9 @@ int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
1246 | mbx.size = tx->num_desc; | 1243 | mbx.size = tx->num_desc; |
1247 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { | 1244 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { |
1248 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) | 1245 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) |
1249 | msix_vector = adapter->max_sds_rings + ring; | 1246 | msix_vector = adapter->drv_sds_rings + ring; |
1250 | else | 1247 | else |
1251 | msix_vector = adapter->max_sds_rings - 1; | 1248 | msix_vector = adapter->drv_sds_rings - 1; |
1252 | msix_id = ahw->intr_tbl[msix_vector].id; | 1249 | msix_id = ahw->intr_tbl[msix_vector].id; |
1253 | } else { | 1250 | } else { |
1254 | msix_id = QLCRDX(ahw, QLCNIC_DEF_INT_ID); | 1251 | msix_id = QLCRDX(ahw, QLCNIC_DEF_INT_ID); |
@@ -1271,7 +1268,8 @@ int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
1271 | qlcnic_pf_set_interface_id_create_tx_ctx(adapter, &temp); | 1268 | qlcnic_pf_set_interface_id_create_tx_ctx(adapter, &temp); |
1272 | 1269 | ||
1273 | cmd.req.arg[1] = QLCNIC_CAP0_LEGACY_CONTEXT; | 1270 | cmd.req.arg[1] = QLCNIC_CAP0_LEGACY_CONTEXT; |
1274 | cmd.req.arg[5] = QLCNIC_MAX_TX_QUEUES | temp; | 1271 | cmd.req.arg[5] = QLCNIC_SINGLE_RING | temp; |
1272 | |||
1275 | buf = &cmd.req.arg[6]; | 1273 | buf = &cmd.req.arg[6]; |
1276 | memcpy(buf, &mbx, sizeof(struct qlcnic_tx_mbx)); | 1274 | memcpy(buf, &mbx, sizeof(struct qlcnic_tx_mbx)); |
1277 | /* send the mailbox command*/ | 1275 | /* send the mailbox command*/ |
@@ -1286,7 +1284,7 @@ int qlcnic_83xx_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
1286 | tx->ctx_id = mbx_out->ctx_id; | 1284 | tx->ctx_id = mbx_out->ctx_id; |
1287 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 1285 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
1288 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { | 1286 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { |
1289 | intr_mask = ahw->intr_tbl[adapter->max_sds_rings + ring].src; | 1287 | intr_mask = ahw->intr_tbl[adapter->drv_sds_rings + ring].src; |
1290 | tx->crb_intr_mask = ahw->pci_base0 + intr_mask; | 1288 | tx->crb_intr_mask = ahw->pci_base0 + intr_mask; |
1291 | } | 1289 | } |
1292 | dev_info(&adapter->pdev->dev, "Tx Context[0x%x] Created, state:0x%x\n", | 1290 | dev_info(&adapter->pdev->dev, "Tx Context[0x%x] Created, state:0x%x\n", |
@@ -1297,7 +1295,7 @@ out: | |||
1297 | } | 1295 | } |
1298 | 1296 | ||
1299 | static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, | 1297 | static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, |
1300 | int num_sds_ring) | 1298 | u8 num_sds_ring) |
1301 | { | 1299 | { |
1302 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1300 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1303 | struct qlcnic_host_sds_ring *sds_ring; | 1301 | struct qlcnic_host_sds_ring *sds_ring; |
@@ -1313,7 +1311,7 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, | |||
1313 | 1311 | ||
1314 | qlcnic_detach(adapter); | 1312 | qlcnic_detach(adapter); |
1315 | 1313 | ||
1316 | adapter->max_sds_rings = 1; | 1314 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; |
1317 | adapter->ahw->diag_test = test; | 1315 | adapter->ahw->diag_test = test; |
1318 | adapter->ahw->linkup = 0; | 1316 | adapter->ahw->linkup = 0; |
1319 | 1317 | ||
@@ -1327,7 +1325,7 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, | |||
1327 | if (ret) { | 1325 | if (ret) { |
1328 | qlcnic_detach(adapter); | 1326 | qlcnic_detach(adapter); |
1329 | if (adapter_state == QLCNIC_ADAPTER_UP_MAGIC) { | 1327 | if (adapter_state == QLCNIC_ADAPTER_UP_MAGIC) { |
1330 | adapter->max_sds_rings = num_sds_ring; | 1328 | adapter->drv_sds_rings = num_sds_ring; |
1331 | qlcnic_attach(adapter); | 1329 | qlcnic_attach(adapter); |
1332 | } | 1330 | } |
1333 | netif_device_attach(netdev); | 1331 | netif_device_attach(netdev); |
@@ -1340,7 +1338,7 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, | |||
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1340 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1343 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1341 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1344 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; | 1342 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1345 | qlcnic_83xx_enable_intr(adapter, sds_ring); | 1343 | qlcnic_83xx_enable_intr(adapter, sds_ring); |
1346 | } | 1344 | } |
@@ -1361,7 +1359,7 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, | |||
1361 | } | 1359 | } |
1362 | 1360 | ||
1363 | static void qlcnic_83xx_diag_free_res(struct net_device *netdev, | 1361 | static void qlcnic_83xx_diag_free_res(struct net_device *netdev, |
1364 | int max_sds_rings) | 1362 | u8 drv_sds_rings) |
1365 | { | 1363 | { |
1366 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1364 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1367 | struct qlcnic_host_sds_ring *sds_ring; | 1365 | struct qlcnic_host_sds_ring *sds_ring; |
@@ -1369,7 +1367,7 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, | |||
1369 | 1367 | ||
1370 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); | 1368 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); |
1371 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1369 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1372 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1370 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1373 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; | 1371 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1374 | qlcnic_83xx_disable_intr(adapter, sds_ring); | 1372 | qlcnic_83xx_disable_intr(adapter, sds_ring); |
1375 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) | 1373 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) |
@@ -1393,7 +1391,7 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, | |||
1393 | } | 1391 | } |
1394 | } | 1392 | } |
1395 | adapter->ahw->diag_test = 0; | 1393 | adapter->ahw->diag_test = 0; |
1396 | adapter->max_sds_rings = max_sds_rings; | 1394 | adapter->drv_sds_rings = drv_sds_rings; |
1397 | 1395 | ||
1398 | if (qlcnic_attach(adapter)) | 1396 | if (qlcnic_attach(adapter)) |
1399 | goto out; | 1397 | goto out; |
@@ -1655,7 +1653,8 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1655 | { | 1653 | { |
1656 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1654 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1657 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 1655 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
1658 | int ret = 0, loop = 0, max_sds_rings = adapter->max_sds_rings; | 1656 | u8 drv_sds_rings = adapter->drv_sds_rings; |
1657 | int ret = 0, loop = 0; | ||
1659 | 1658 | ||
1660 | if (ahw->op_mode == QLCNIC_NON_PRIV_FUNC) { | 1659 | if (ahw->op_mode == QLCNIC_NON_PRIV_FUNC) { |
1661 | netdev_warn(netdev, | 1660 | netdev_warn(netdev, |
@@ -1677,7 +1676,7 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1677 | mode == QLCNIC_ILB_MODE ? "internal" : "external"); | 1676 | mode == QLCNIC_ILB_MODE ? "internal" : "external"); |
1678 | 1677 | ||
1679 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST, | 1678 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST, |
1680 | max_sds_rings); | 1679 | drv_sds_rings); |
1681 | if (ret) | 1680 | if (ret) |
1682 | goto fail_diag_alloc; | 1681 | goto fail_diag_alloc; |
1683 | 1682 | ||
@@ -1715,10 +1714,10 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) | |||
1715 | qlcnic_83xx_clear_lb_mode(adapter, mode); | 1714 | qlcnic_83xx_clear_lb_mode(adapter, mode); |
1716 | 1715 | ||
1717 | free_diag_res: | 1716 | free_diag_res: |
1718 | qlcnic_83xx_diag_free_res(netdev, max_sds_rings); | 1717 | qlcnic_83xx_diag_free_res(netdev, drv_sds_rings); |
1719 | 1718 | ||
1720 | fail_diag_alloc: | 1719 | fail_diag_alloc: |
1721 | adapter->max_sds_rings = max_sds_rings; | 1720 | adapter->drv_sds_rings = drv_sds_rings; |
1722 | qlcnic_release_diag_lock(adapter); | 1721 | qlcnic_release_diag_lock(adapter); |
1723 | return ret; | 1722 | return ret; |
1724 | } | 1723 | } |
@@ -3303,10 +3302,10 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
3303 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 3302 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
3304 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 3303 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
3305 | struct qlcnic_cmd_args cmd; | 3304 | struct qlcnic_cmd_args cmd; |
3305 | u8 val, drv_sds_rings = adapter->drv_sds_rings; | ||
3306 | u32 data; | 3306 | u32 data; |
3307 | u16 intrpt_id, id; | 3307 | u16 intrpt_id, id; |
3308 | u8 val; | 3308 | int ret; |
3309 | int ret, max_sds_rings = adapter->max_sds_rings; | ||
3310 | 3309 | ||
3311 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { | 3310 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { |
3312 | netdev_info(netdev, "Device is resetting\n"); | 3311 | netdev_info(netdev, "Device is resetting\n"); |
@@ -3319,7 +3318,7 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
3319 | } | 3318 | } |
3320 | 3319 | ||
3321 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_INTERRUPT_TEST, | 3320 | ret = qlcnic_83xx_diag_alloc_res(netdev, QLCNIC_INTERRUPT_TEST, |
3322 | max_sds_rings); | 3321 | drv_sds_rings); |
3323 | if (ret) | 3322 | if (ret) |
3324 | goto fail_diag_irq; | 3323 | goto fail_diag_irq; |
3325 | 3324 | ||
@@ -3356,10 +3355,10 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
3356 | 3355 | ||
3357 | done: | 3356 | done: |
3358 | qlcnic_free_mbx_args(&cmd); | 3357 | qlcnic_free_mbx_args(&cmd); |
3359 | qlcnic_83xx_diag_free_res(netdev, max_sds_rings); | 3358 | qlcnic_83xx_diag_free_res(netdev, drv_sds_rings); |
3360 | 3359 | ||
3361 | fail_diag_irq: | 3360 | fail_diag_irq: |
3362 | adapter->max_sds_rings = max_sds_rings; | 3361 | adapter->drv_sds_rings = drv_sds_rings; |
3363 | qlcnic_release_diag_lock(adapter); | 3362 | qlcnic_release_diag_lock(adapter); |
3364 | return ret; | 3363 | return ret; |
3365 | } | 3364 | } |
@@ -3513,7 +3512,7 @@ int qlcnic_83xx_resume(struct qlcnic_adapter *adapter) | |||
3513 | if (err) | 3512 | if (err) |
3514 | return err; | 3513 | return err; |
3515 | 3514 | ||
3516 | if (ahw->nic_mode == QLC_83XX_VIRTUAL_NIC_MODE) { | 3515 | if (ahw->nic_mode == QLCNIC_VNIC_MODE) { |
3517 | if (ahw->op_mode == QLCNIC_MGMT_FUNC) { | 3516 | if (ahw->op_mode == QLCNIC_MGMT_FUNC) { |
3518 | qlcnic_83xx_set_vnic_opmode(adapter); | 3517 | qlcnic_83xx_set_vnic_opmode(adapter); |
3519 | } else { | 3518 | } else { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 9f4e4c4ab521..4cae6caa6bfa 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -61,7 +61,6 @@ | |||
61 | #define QLC_83XX_HOST_SDS_MBX_IDX 8 | 61 | #define QLC_83XX_HOST_SDS_MBX_IDX 8 |
62 | 62 | ||
63 | #define QLCNIC_HOST_RDS_MBX_IDX 88 | 63 | #define QLCNIC_HOST_RDS_MBX_IDX 88 |
64 | #define QLCNIC_MAX_RING_SETS 8 | ||
65 | 64 | ||
66 | /* Pause control registers */ | 65 | /* Pause control registers */ |
67 | #define QLC_83XX_SRE_SHIM_REG 0x0D200284 | 66 | #define QLC_83XX_SRE_SHIM_REG 0x0D200284 |
@@ -183,8 +182,8 @@ struct qlcnic_rcv_mbx_out { | |||
183 | u8 num_pci_func; | 182 | u8 num_pci_func; |
184 | u8 state; | 183 | u8 state; |
185 | #endif | 184 | #endif |
186 | u32 host_csmr[QLCNIC_MAX_RING_SETS]; | 185 | u32 host_csmr[QLCNIC_MAX_SDS_RINGS]; |
187 | struct __host_producer_mbx host_prod[QLCNIC_MAX_RING_SETS]; | 186 | struct __host_producer_mbx host_prod[QLCNIC_MAX_SDS_RINGS]; |
188 | } __packed; | 187 | } __packed; |
189 | 188 | ||
190 | struct qlcnic_add_rings_mbx_out { | 189 | struct qlcnic_add_rings_mbx_out { |
@@ -197,8 +196,8 @@ struct qlcnic_add_rings_mbx_out { | |||
197 | u8 sts_num; | 196 | u8 sts_num; |
198 | u8 rcv_num; | 197 | u8 rcv_num; |
199 | #endif | 198 | #endif |
200 | u32 host_csmr[QLCNIC_MAX_RING_SETS]; | 199 | u32 host_csmr[QLCNIC_MAX_SDS_RINGS]; |
201 | struct __host_producer_mbx host_prod[QLCNIC_MAX_RING_SETS]; | 200 | struct __host_producer_mbx host_prod[QLCNIC_MAX_SDS_RINGS]; |
202 | } __packed; | 201 | } __packed; |
203 | 202 | ||
204 | /* Transmit context mailbox inbox registers | 203 | /* Transmit context mailbox inbox registers |
@@ -415,8 +414,6 @@ enum qlcnic_83xx_states { | |||
415 | #define QLC_83XX_GET_VLAN_ALIGN_CAPABILITY(val) (val & 0x4000) | 414 | #define QLC_83XX_GET_VLAN_ALIGN_CAPABILITY(val) (val & 0x4000) |
416 | #define QLC_83XX_GET_FW_LRO_MSS_CAPABILITY(val) (val & 0x20000) | 415 | #define QLC_83XX_GET_FW_LRO_MSS_CAPABILITY(val) (val & 0x20000) |
417 | #define QLC_83XX_ESWITCH_CAPABILITY BIT_23 | 416 | #define QLC_83XX_ESWITCH_CAPABILITY BIT_23 |
418 | #define QLC_83XX_VIRTUAL_NIC_MODE 0xFF | ||
419 | #define QLC_83XX_DEFAULT_MODE 0x0 | ||
420 | #define QLC_83XX_SRIOV_MODE 0x1 | 417 | #define QLC_83XX_SRIOV_MODE 0x1 |
421 | #define QLCNIC_BRDTYPE_83XX_10G 0x0083 | 418 | #define QLCNIC_BRDTYPE_83XX_10G 0x0083 |
422 | 419 | ||
@@ -524,7 +521,7 @@ enum qlc_83xx_ext_regs { | |||
524 | /* 83xx funcitons */ | 521 | /* 83xx funcitons */ |
525 | int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *); | 522 | int qlcnic_83xx_get_fw_version(struct qlcnic_adapter *); |
526 | int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *, struct qlcnic_cmd_args *); | 523 | int qlcnic_83xx_issue_cmd(struct qlcnic_adapter *, struct qlcnic_cmd_args *); |
527 | int qlcnic_83xx_setup_intr(struct qlcnic_adapter *, u8, int); | 524 | int qlcnic_83xx_setup_intr(struct qlcnic_adapter *); |
528 | void qlcnic_83xx_get_func_no(struct qlcnic_adapter *); | 525 | void qlcnic_83xx_get_func_no(struct qlcnic_adapter *); |
529 | int qlcnic_83xx_cam_lock(struct qlcnic_adapter *); | 526 | int qlcnic_83xx_cam_lock(struct qlcnic_adapter *); |
530 | void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *); | 527 | void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 4a8a3f1b0345..5682a40eb8a7 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -902,7 +902,7 @@ static int qlcnic_83xx_idc_need_reset_state(struct qlcnic_adapter *adapter) | |||
902 | qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); | 902 | qlcnic_83xx_idc_update_audit_reg(adapter, 0, 1); |
903 | set_bit(__QLCNIC_RESETTING, &adapter->state); | 903 | set_bit(__QLCNIC_RESETTING, &adapter->state); |
904 | clear_bit(QLC_83XX_MBX_READY, &mbx->status); | 904 | clear_bit(QLC_83XX_MBX_READY, &mbx->status); |
905 | if (adapter->ahw->nic_mode == QLC_83XX_VIRTUAL_NIC_MODE) | 905 | if (adapter->ahw->nic_mode == QLCNIC_VNIC_MODE) |
906 | qlcnic_83xx_disable_vnic_mode(adapter, 1); | 906 | qlcnic_83xx_disable_vnic_mode(adapter, 1); |
907 | 907 | ||
908 | if (qlcnic_check_diag_status(adapter)) { | 908 | if (qlcnic_check_diag_status(adapter)) { |
@@ -2033,6 +2033,8 @@ int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter) | |||
2033 | ahw->max_mac_filters = nic_info.max_mac_filters; | 2033 | ahw->max_mac_filters = nic_info.max_mac_filters; |
2034 | ahw->max_mtu = nic_info.max_mtu; | 2034 | ahw->max_mtu = nic_info.max_mtu; |
2035 | 2035 | ||
2036 | adapter->max_tx_rings = ahw->max_tx_ques; | ||
2037 | adapter->max_sds_rings = ahw->max_rx_ques; | ||
2036 | /* eSwitch capability indicates vNIC mode. | 2038 | /* eSwitch capability indicates vNIC mode. |
2037 | * vNIC and SRIOV are mutually exclusive operational modes. | 2039 | * vNIC and SRIOV are mutually exclusive operational modes. |
2038 | * If SR-IOV capability is detected, SR-IOV physical function | 2040 | * If SR-IOV capability is detected, SR-IOV physical function |
@@ -2045,7 +2047,7 @@ int qlcnic_83xx_get_nic_configuration(struct qlcnic_adapter *adapter) | |||
2045 | return QLC_83XX_DEFAULT_OPMODE; | 2047 | return QLC_83XX_DEFAULT_OPMODE; |
2046 | 2048 | ||
2047 | if (ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY) | 2049 | if (ahw->capabilities & QLC_83XX_ESWITCH_CAPABILITY) |
2048 | return QLC_83XX_VIRTUAL_NIC_MODE; | 2050 | return QLCNIC_VNIC_MODE; |
2049 | 2051 | ||
2050 | return QLC_83XX_DEFAULT_OPMODE; | 2052 | return QLC_83XX_DEFAULT_OPMODE; |
2051 | } | 2053 | } |
@@ -2059,15 +2061,20 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) | |||
2059 | if (ret == -EIO) | 2061 | if (ret == -EIO) |
2060 | return -EIO; | 2062 | return -EIO; |
2061 | 2063 | ||
2062 | if (ret == QLC_83XX_VIRTUAL_NIC_MODE) { | 2064 | if (ret == QLCNIC_VNIC_MODE) { |
2063 | ahw->nic_mode = QLC_83XX_VIRTUAL_NIC_MODE; | 2065 | ahw->nic_mode = QLCNIC_VNIC_MODE; |
2066 | |||
2064 | if (qlcnic_83xx_config_vnic_opmode(adapter)) | 2067 | if (qlcnic_83xx_config_vnic_opmode(adapter)) |
2065 | return -EIO; | 2068 | return -EIO; |
2066 | 2069 | ||
2070 | adapter->max_sds_rings = QLCNIC_MAX_VNIC_SDS_RINGS; | ||
2071 | adapter->max_tx_rings = QLCNIC_SINGLE_RING; | ||
2067 | } else if (ret == QLC_83XX_DEFAULT_OPMODE) { | 2072 | } else if (ret == QLC_83XX_DEFAULT_OPMODE) { |
2068 | ahw->nic_mode = QLC_83XX_DEFAULT_MODE; | 2073 | ahw->nic_mode = QLCNIC_DEFAULT_MODE; |
2069 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; | 2074 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; |
2070 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; | 2075 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; |
2076 | adapter->max_sds_rings = ahw->max_rx_ques; | ||
2077 | adapter->max_tx_rings = QLCNIC_SINGLE_RING; | ||
2071 | } else { | 2078 | } else { |
2072 | return -EIO; | 2079 | return -EIO; |
2073 | } | 2080 | } |
@@ -2170,6 +2177,19 @@ static int qlcnic_83xx_get_fw_info(struct qlcnic_adapter *adapter) | |||
2170 | return err; | 2177 | return err; |
2171 | } | 2178 | } |
2172 | 2179 | ||
2180 | static void qlcnic_83xx_init_rings(struct qlcnic_adapter *adapter) | ||
2181 | { | ||
2182 | adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS; | ||
2183 | adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS; | ||
2184 | |||
2185 | qlcnic_set_tx_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
2186 | |||
2187 | /* compute and set drv sds rings */ | ||
2188 | if (adapter->ahw->msix_supported) | ||
2189 | qlcnic_set_sds_ring_count(adapter, QLCNIC_DEF_SDS_RINGS); | ||
2190 | else | ||
2191 | qlcnic_set_sds_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
2192 | } | ||
2173 | 2193 | ||
2174 | int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | 2194 | int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) |
2175 | { | 2195 | { |
@@ -2178,6 +2198,9 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2178 | int err = 0; | 2198 | int err = 0; |
2179 | 2199 | ||
2180 | ahw->msix_supported = !!qlcnic_use_msi_x; | 2200 | ahw->msix_supported = !!qlcnic_use_msi_x; |
2201 | |||
2202 | qlcnic_83xx_init_rings(adapter); | ||
2203 | |||
2181 | err = qlcnic_83xx_init_mailbox_work(adapter); | 2204 | err = qlcnic_83xx_init_mailbox_work(adapter); |
2182 | if (err) | 2205 | if (err) |
2183 | goto exit; | 2206 | goto exit; |
@@ -2209,7 +2232,7 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2209 | if (err) | 2232 | if (err) |
2210 | goto detach_mbx; | 2233 | goto detach_mbx; |
2211 | 2234 | ||
2212 | err = qlcnic_setup_intr(adapter, 0, 0); | 2235 | err = qlcnic_setup_intr(adapter); |
2213 | if (err) { | 2236 | if (err) { |
2214 | dev_err(&adapter->pdev->dev, "Failed to setup interrupt\n"); | 2237 | dev_err(&adapter->pdev->dev, "Failed to setup interrupt\n"); |
2215 | goto disable_intr; | 2238 | goto disable_intr; |
@@ -2231,6 +2254,7 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2231 | if (err) | 2254 | if (err) |
2232 | goto disable_mbx_intr; | 2255 | goto disable_mbx_intr; |
2233 | 2256 | ||
2257 | |||
2234 | /* Perform operating mode specific initialization */ | 2258 | /* Perform operating mode specific initialization */ |
2235 | err = adapter->nic_ops->init_driver(adapter); | 2259 | err = adapter->nic_ops->init_driver(adapter); |
2236 | if (err) | 2260 | if (err) |
@@ -2267,7 +2291,7 @@ void qlcnic_83xx_aer_stop_poll_work(struct qlcnic_adapter *adapter) | |||
2267 | clear_bit(QLC_83XX_MBX_READY, &idc->status); | 2291 | clear_bit(QLC_83XX_MBX_READY, &idc->status); |
2268 | cancel_delayed_work_sync(&adapter->fw_work); | 2292 | cancel_delayed_work_sync(&adapter->fw_work); |
2269 | 2293 | ||
2270 | if (ahw->nic_mode == QLC_83XX_VIRTUAL_NIC_MODE) | 2294 | if (ahw->nic_mode == QLCNIC_VNIC_MODE) |
2271 | qlcnic_83xx_disable_vnic_mode(adapter, 1); | 2295 | qlcnic_83xx_disable_vnic_mode(adapter, 1); |
2272 | 2296 | ||
2273 | qlcnic_83xx_idc_detach_driver(adapter); | 2297 | qlcnic_83xx_idc_detach_driver(adapter); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 86850dd633a1..859cb161fc63 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -270,7 +270,7 @@ int qlcnic_82xx_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
270 | int err; | 270 | int err; |
271 | 271 | ||
272 | nrds_rings = adapter->max_rds_rings; | 272 | nrds_rings = adapter->max_rds_rings; |
273 | nsds_rings = adapter->max_sds_rings; | 273 | nsds_rings = adapter->drv_sds_rings; |
274 | 274 | ||
275 | rq_size = SIZEOF_HOSTRQ_RX(struct qlcnic_hostrq_rx_ctx, nrds_rings, | 275 | rq_size = SIZEOF_HOSTRQ_RX(struct qlcnic_hostrq_rx_ctx, nrds_rings, |
276 | nsds_rings); | 276 | nsds_rings); |
@@ -475,7 +475,7 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
475 | 475 | ||
476 | if (qlcnic_check_multi_tx(adapter) && | 476 | if (qlcnic_check_multi_tx(adapter) && |
477 | !adapter->ahw->diag_test) { | 477 | !adapter->ahw->diag_test) { |
478 | temp_nsds_rings = adapter->max_sds_rings; | 478 | temp_nsds_rings = adapter->drv_sds_rings; |
479 | index = temp_nsds_rings + ring; | 479 | index = temp_nsds_rings + ring; |
480 | msix_id = ahw->intr_tbl[index].id; | 480 | msix_id = ahw->intr_tbl[index].id; |
481 | prq->msi_index = cpu_to_le16(msix_id); | 481 | prq->msi_index = cpu_to_le16(msix_id); |
@@ -512,7 +512,7 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter, | |||
512 | if (qlcnic_check_multi_tx(adapter) && | 512 | if (qlcnic_check_multi_tx(adapter) && |
513 | !adapter->ahw->diag_test && | 513 | !adapter->ahw->diag_test && |
514 | (adapter->flags & QLCNIC_MSIX_ENABLED)) { | 514 | (adapter->flags & QLCNIC_MSIX_ENABLED)) { |
515 | index = adapter->max_sds_rings + ring; | 515 | index = adapter->drv_sds_rings + ring; |
516 | intr_mask = ahw->intr_tbl[index].src; | 516 | intr_mask = ahw->intr_tbl[index].src; |
517 | tx_ring->crb_intr_mask = ahw->pci_base0 + intr_mask; | 517 | tx_ring->crb_intr_mask = ahw->pci_base0 + intr_mask; |
518 | } | 518 | } |
@@ -582,7 +582,7 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
582 | 582 | ||
583 | recv_ctx = adapter->recv_ctx; | 583 | recv_ctx = adapter->recv_ctx; |
584 | 584 | ||
585 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 585 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
586 | tx_ring = &adapter->tx_ring[ring]; | 586 | tx_ring = &adapter->tx_ring[ring]; |
587 | ptr = (__le32 *)dma_alloc_coherent(&pdev->dev, sizeof(u32), | 587 | ptr = (__le32 *)dma_alloc_coherent(&pdev->dev, sizeof(u32), |
588 | &tx_ring->hw_cons_phys_addr, | 588 | &tx_ring->hw_cons_phys_addr, |
@@ -616,7 +616,7 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
616 | 616 | ||
617 | } | 617 | } |
618 | 618 | ||
619 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 619 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
620 | sds_ring = &recv_ctx->sds_rings[ring]; | 620 | sds_ring = &recv_ctx->sds_rings[ring]; |
621 | 621 | ||
622 | addr = dma_alloc_coherent(&adapter->pdev->dev, | 622 | addr = dma_alloc_coherent(&adapter->pdev->dev, |
@@ -664,7 +664,7 @@ int qlcnic_fw_create_ctx(struct qlcnic_adapter *dev) | |||
664 | if (err) | 664 | if (err) |
665 | goto err_out; | 665 | goto err_out; |
666 | 666 | ||
667 | for (ring = 0; ring < dev->max_drv_tx_rings; ring++) { | 667 | for (ring = 0; ring < dev->drv_tx_rings; ring++) { |
668 | err = qlcnic_fw_cmd_create_tx_ctx(dev, | 668 | err = qlcnic_fw_cmd_create_tx_ctx(dev, |
669 | &dev->tx_ring[ring], | 669 | &dev->tx_ring[ring], |
670 | ring); | 670 | ring); |
@@ -703,7 +703,7 @@ void qlcnic_fw_destroy_ctx(struct qlcnic_adapter *adapter) | |||
703 | 703 | ||
704 | if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { | 704 | if (test_and_clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state)) { |
705 | qlcnic_fw_cmd_del_rx_ctx(adapter); | 705 | qlcnic_fw_cmd_del_rx_ctx(adapter); |
706 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) | 706 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) |
707 | qlcnic_fw_cmd_del_tx_ctx(adapter, | 707 | qlcnic_fw_cmd_del_tx_ctx(adapter, |
708 | &adapter->tx_ring[ring]); | 708 | &adapter->tx_ring[ring]); |
709 | 709 | ||
@@ -733,7 +733,7 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
733 | 733 | ||
734 | recv_ctx = adapter->recv_ctx; | 734 | recv_ctx = adapter->recv_ctx; |
735 | 735 | ||
736 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 736 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
737 | tx_ring = &adapter->tx_ring[ring]; | 737 | tx_ring = &adapter->tx_ring[ring]; |
738 | if (tx_ring->hw_consumer != NULL) { | 738 | if (tx_ring->hw_consumer != NULL) { |
739 | dma_free_coherent(&adapter->pdev->dev, sizeof(u32), | 739 | dma_free_coherent(&adapter->pdev->dev, sizeof(u32), |
@@ -764,7 +764,7 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
764 | } | 764 | } |
765 | } | 765 | } |
766 | 766 | ||
767 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 767 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
768 | sds_ring = &recv_ctx->sds_rings[ring]; | 768 | sds_ring = &recv_ctx->sds_rings[ring]; |
769 | 769 | ||
770 | if (sds_ring->desc_head != NULL) { | 770 | if (sds_ring->desc_head != NULL) { |
@@ -895,6 +895,8 @@ int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter, | |||
895 | npar_info->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques); | 895 | npar_info->max_rx_ques = le16_to_cpu(nic_info->max_rx_ques); |
896 | npar_info->capabilities = le32_to_cpu(nic_info->capabilities); | 896 | npar_info->capabilities = le32_to_cpu(nic_info->capabilities); |
897 | npar_info->max_mtu = le16_to_cpu(nic_info->max_mtu); | 897 | npar_info->max_mtu = le16_to_cpu(nic_info->max_mtu); |
898 | adapter->max_tx_rings = npar_info->max_tx_ques; | ||
899 | adapter->max_sds_rings = npar_info->max_rx_ques; | ||
898 | } | 900 | } |
899 | 901 | ||
900 | qlcnic_free_mbx_args(&cmd); | 902 | qlcnic_free_mbx_args(&cmd); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 9b6dd984fe00..225743cc82eb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -226,9 +226,9 @@ static const u32 ext_diag_registers[] = { | |||
226 | 226 | ||
227 | static inline int qlcnic_get_ring_regs_len(struct qlcnic_adapter *adapter) | 227 | static inline int qlcnic_get_ring_regs_len(struct qlcnic_adapter *adapter) |
228 | { | 228 | { |
229 | int ring_regs_cnt = (adapter->max_drv_tx_rings * 5) + | 229 | int ring_regs_cnt = (adapter->drv_tx_rings * 5) + |
230 | (adapter->max_rds_rings * 2) + | 230 | (adapter->max_rds_rings * 2) + |
231 | (adapter->max_sds_rings * 3) + 5; | 231 | (adapter->drv_sds_rings * 3) + 5; |
232 | return ring_regs_cnt * sizeof(u32); | 232 | return ring_regs_cnt * sizeof(u32); |
233 | } | 233 | } |
234 | 234 | ||
@@ -530,8 +530,8 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
530 | /* Marker btw regs and TX ring count */ | 530 | /* Marker btw regs and TX ring count */ |
531 | regs_buff[i++] = 0xFFEFCDAB; | 531 | regs_buff[i++] = 0xFFEFCDAB; |
532 | 532 | ||
533 | regs_buff[i++] = adapter->max_drv_tx_rings; /* No. of TX ring */ | 533 | regs_buff[i++] = adapter->drv_tx_rings; /* No. of TX ring */ |
534 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 534 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
535 | tx_ring = &adapter->tx_ring[ring]; | 535 | tx_ring = &adapter->tx_ring[ring]; |
536 | regs_buff[i++] = le32_to_cpu(*(tx_ring->hw_consumer)); | 536 | regs_buff[i++] = le32_to_cpu(*(tx_ring->hw_consumer)); |
537 | regs_buff[i++] = tx_ring->sw_consumer; | 537 | regs_buff[i++] = tx_ring->sw_consumer; |
@@ -550,8 +550,8 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
550 | regs_buff[i++] = rds_rings->producer; | 550 | regs_buff[i++] = rds_rings->producer; |
551 | } | 551 | } |
552 | 552 | ||
553 | regs_buff[i++] = adapter->max_sds_rings; /* No. of SDS ring */ | 553 | regs_buff[i++] = adapter->drv_sds_rings; /* No. of SDS ring */ |
554 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 554 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
555 | sds_ring = &(recv_ctx->sds_rings[ring]); | 555 | sds_ring = &(recv_ctx->sds_rings[ring]); |
556 | regs_buff[i++] = readl(sds_ring->crb_sts_consumer); | 556 | regs_buff[i++] = readl(sds_ring->crb_sts_consumer); |
557 | regs_buff[i++] = sds_ring->consumer; | 557 | regs_buff[i++] = sds_ring->consumer; |
@@ -664,46 +664,88 @@ qlcnic_set_ringparam(struct net_device *dev, | |||
664 | return qlcnic_reset_context(adapter); | 664 | return qlcnic_reset_context(adapter); |
665 | } | 665 | } |
666 | 666 | ||
667 | static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter, | ||
668 | u8 rx_ring, u8 tx_ring) | ||
669 | { | ||
670 | if (rx_ring != 0) { | ||
671 | if (rx_ring > adapter->max_sds_rings) { | ||
672 | netdev_err(adapter->netdev, "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n", | ||
673 | rx_ring, adapter->max_sds_rings); | ||
674 | return -EINVAL; | ||
675 | } | ||
676 | } | ||
677 | |||
678 | if (tx_ring != 0) { | ||
679 | if (qlcnic_82xx_check(adapter) && | ||
680 | (tx_ring > adapter->max_tx_rings)) { | ||
681 | netdev_err(adapter->netdev, | ||
682 | "Invalid ring count, Tx ring count %d should not be greater than max %d driver Tx rings.\n", | ||
683 | tx_ring, adapter->max_tx_rings); | ||
684 | return -EINVAL; | ||
685 | } | ||
686 | |||
687 | if (qlcnic_83xx_check(adapter) && | ||
688 | (tx_ring > QLCNIC_SINGLE_RING)) { | ||
689 | netdev_err(adapter->netdev, | ||
690 | "Invalid ring count, Tx ring count %d should not be greater than %d driver Tx rings.\n", | ||
691 | tx_ring, QLCNIC_SINGLE_RING); | ||
692 | return -EINVAL; | ||
693 | } | ||
694 | } | ||
695 | |||
696 | return 0; | ||
697 | } | ||
698 | |||
667 | static void qlcnic_get_channels(struct net_device *dev, | 699 | static void qlcnic_get_channels(struct net_device *dev, |
668 | struct ethtool_channels *channel) | 700 | struct ethtool_channels *channel) |
669 | { | 701 | { |
670 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 702 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
671 | int min; | ||
672 | |||
673 | min = min_t(int, adapter->ahw->max_rx_ques, num_online_cpus()); | ||
674 | channel->max_rx = rounddown_pow_of_two(min); | ||
675 | channel->max_tx = min_t(int, QLCNIC_MAX_TX_RINGS, num_online_cpus()); | ||
676 | 703 | ||
677 | channel->rx_count = adapter->max_sds_rings; | 704 | channel->max_rx = adapter->max_sds_rings; |
678 | channel->tx_count = adapter->max_drv_tx_rings; | 705 | channel->max_tx = adapter->max_tx_rings; |
706 | channel->rx_count = adapter->drv_sds_rings; | ||
707 | channel->tx_count = adapter->drv_tx_rings; | ||
679 | } | 708 | } |
680 | 709 | ||
681 | static int qlcnic_set_channels(struct net_device *dev, | 710 | static int qlcnic_set_channels(struct net_device *dev, |
682 | struct ethtool_channels *channel) | 711 | struct ethtool_channels *channel) |
683 | { | 712 | { |
684 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 713 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
685 | int err; | 714 | int err; |
686 | int txq = 0; | ||
687 | 715 | ||
688 | if (channel->other_count || channel->combined_count) | 716 | if (channel->other_count || channel->combined_count) |
689 | return -EINVAL; | 717 | return -EINVAL; |
690 | 718 | ||
719 | err = qlcnic_validate_ring_count(adapter, channel->rx_count, | ||
720 | channel->tx_count); | ||
721 | if (err) | ||
722 | return err; | ||
723 | |||
691 | if (channel->rx_count) { | 724 | if (channel->rx_count) { |
692 | err = qlcnic_validate_max_rss(adapter, channel->rx_count); | 725 | err = qlcnic_validate_rings(adapter, channel->rx_count, |
693 | if (err) | 726 | QLCNIC_RX_QUEUE); |
727 | if (err) { | ||
728 | netdev_err(dev, "Unable to configure %u SDS rings\n", | ||
729 | channel->rx_count); | ||
694 | return err; | 730 | return err; |
731 | } | ||
695 | } | 732 | } |
696 | 733 | ||
697 | if (qlcnic_82xx_check(adapter) && channel->tx_count) { | 734 | if (qlcnic_82xx_check(adapter) && channel->tx_count) { |
698 | err = qlcnic_validate_max_tx_rings(adapter, channel->tx_count); | 735 | err = qlcnic_validate_rings(adapter, channel->tx_count, |
699 | if (err) | 736 | QLCNIC_TX_QUEUE); |
737 | if (err) { | ||
738 | netdev_err(dev, "Unable to configure %u Tx rings\n", | ||
739 | channel->tx_count); | ||
700 | return err; | 740 | return err; |
701 | txq = channel->tx_count; | 741 | } |
702 | } | 742 | } |
703 | 743 | ||
704 | err = qlcnic_set_max_rss(adapter, channel->rx_count, txq); | 744 | err = qlcnic_setup_rings(adapter, channel->rx_count, |
705 | netdev_info(dev, "allocated 0x%x sds rings and 0x%x tx rings\n", | 745 | channel->tx_count); |
706 | adapter->max_sds_rings, adapter->max_drv_tx_rings); | 746 | netdev_info(dev, "Allocated %d SDS rings and %d Tx rings\n", |
747 | adapter->drv_sds_rings, adapter->drv_tx_rings); | ||
748 | |||
707 | return err; | 749 | return err; |
708 | } | 750 | } |
709 | 751 | ||
@@ -905,7 +947,7 @@ static int qlcnic_irq_test(struct net_device *netdev) | |||
905 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 947 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
906 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 948 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
907 | struct qlcnic_cmd_args cmd; | 949 | struct qlcnic_cmd_args cmd; |
908 | int ret, max_sds_rings = adapter->max_sds_rings; | 950 | int ret, drv_sds_rings = adapter->drv_sds_rings; |
909 | 951 | ||
910 | if (qlcnic_83xx_check(adapter)) | 952 | if (qlcnic_83xx_check(adapter)) |
911 | return qlcnic_83xx_interrupt_test(netdev); | 953 | return qlcnic_83xx_interrupt_test(netdev); |
@@ -934,10 +976,10 @@ done: | |||
934 | qlcnic_free_mbx_args(&cmd); | 976 | qlcnic_free_mbx_args(&cmd); |
935 | 977 | ||
936 | free_diag_res: | 978 | free_diag_res: |
937 | qlcnic_diag_free_res(netdev, max_sds_rings); | 979 | qlcnic_diag_free_res(netdev, drv_sds_rings); |
938 | 980 | ||
939 | clear_diag_irq: | 981 | clear_diag_irq: |
940 | adapter->max_sds_rings = max_sds_rings; | 982 | adapter->drv_sds_rings = drv_sds_rings; |
941 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 983 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
942 | 984 | ||
943 | return ret; | 985 | return ret; |
@@ -1013,8 +1055,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) | |||
1013 | int qlcnic_loopback_test(struct net_device *netdev, u8 mode) | 1055 | int qlcnic_loopback_test(struct net_device *netdev, u8 mode) |
1014 | { | 1056 | { |
1015 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1057 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1016 | int max_drv_tx_rings = adapter->max_drv_tx_rings; | 1058 | int drv_tx_rings = adapter->drv_tx_rings; |
1017 | int max_sds_rings = adapter->max_sds_rings; | 1059 | int drv_sds_rings = adapter->drv_sds_rings; |
1018 | struct qlcnic_host_sds_ring *sds_ring; | 1060 | struct qlcnic_host_sds_ring *sds_ring; |
1019 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 1061 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
1020 | int loop = 0; | 1062 | int loop = 0; |
@@ -1069,11 +1111,11 @@ int qlcnic_loopback_test(struct net_device *netdev, u8 mode) | |||
1069 | qlcnic_clear_lb_mode(adapter, mode); | 1111 | qlcnic_clear_lb_mode(adapter, mode); |
1070 | 1112 | ||
1071 | free_res: | 1113 | free_res: |
1072 | qlcnic_diag_free_res(netdev, max_sds_rings); | 1114 | qlcnic_diag_free_res(netdev, drv_sds_rings); |
1073 | 1115 | ||
1074 | clear_it: | 1116 | clear_it: |
1075 | adapter->max_sds_rings = max_sds_rings; | 1117 | adapter->drv_sds_rings = drv_sds_rings; |
1076 | adapter->max_drv_tx_rings = max_drv_tx_rings; | 1118 | adapter->drv_tx_rings = drv_tx_rings; |
1077 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 1119 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
1078 | return ret; | 1120 | return ret; |
1079 | } | 1121 | } |
@@ -1127,7 +1169,7 @@ qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 *data) | |||
1127 | break; | 1169 | break; |
1128 | case ETH_SS_STATS: | 1170 | case ETH_SS_STATS: |
1129 | num_stats = ARRAY_SIZE(qlcnic_tx_queue_stats_strings); | 1171 | num_stats = ARRAY_SIZE(qlcnic_tx_queue_stats_strings); |
1130 | for (i = 0; i < adapter->max_drv_tx_rings; i++) { | 1172 | for (i = 0; i < adapter->drv_tx_rings; i++) { |
1131 | for (index = 0; index < num_stats; index++) { | 1173 | for (index = 0; index < num_stats; index++) { |
1132 | sprintf(data, "tx_queue_%d %s", i, | 1174 | sprintf(data, "tx_queue_%d %s", i, |
1133 | qlcnic_tx_queue_stats_strings[index]); | 1175 | qlcnic_tx_queue_stats_strings[index]); |
@@ -1233,7 +1275,7 @@ static void qlcnic_update_stats(struct qlcnic_adapter *adapter) | |||
1233 | struct qlcnic_host_tx_ring *tx_ring; | 1275 | struct qlcnic_host_tx_ring *tx_ring; |
1234 | int ring; | 1276 | int ring; |
1235 | 1277 | ||
1236 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1278 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1237 | tx_ring = &adapter->tx_ring[ring]; | 1279 | tx_ring = &adapter->tx_ring[ring]; |
1238 | adapter->stats.xmit_on += tx_ring->tx_stats.xmit_on; | 1280 | adapter->stats.xmit_on += tx_ring->tx_stats.xmit_on; |
1239 | adapter->stats.xmit_off += tx_ring->tx_stats.xmit_off; | 1281 | adapter->stats.xmit_off += tx_ring->tx_stats.xmit_off; |
@@ -1268,10 +1310,10 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev, | |||
1268 | int index, ret, length, size, tx_size, ring; | 1310 | int index, ret, length, size, tx_size, ring; |
1269 | char *p; | 1311 | char *p; |
1270 | 1312 | ||
1271 | tx_size = adapter->max_drv_tx_rings * QLCNIC_TX_STATS_LEN; | 1313 | tx_size = adapter->drv_tx_rings * QLCNIC_TX_STATS_LEN; |
1272 | 1314 | ||
1273 | memset(data, 0, tx_size * sizeof(u64)); | 1315 | memset(data, 0, tx_size * sizeof(u64)); |
1274 | for (ring = 0, index = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1316 | for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { |
1275 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { | 1317 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { |
1276 | tx_ring = &adapter->tx_ring[ring]; | 1318 | tx_ring = &adapter->tx_ring[ring]; |
1277 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); | 1319 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); |
@@ -1320,7 +1362,7 @@ static int qlcnic_set_led(struct net_device *dev, | |||
1320 | enum ethtool_phys_id_state state) | 1362 | enum ethtool_phys_id_state state) |
1321 | { | 1363 | { |
1322 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 1364 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
1323 | int max_sds_rings = adapter->max_sds_rings; | 1365 | int drv_sds_rings = adapter->drv_sds_rings; |
1324 | int err = -EIO, active = 1; | 1366 | int err = -EIO, active = 1; |
1325 | 1367 | ||
1326 | if (qlcnic_83xx_check(adapter)) | 1368 | if (qlcnic_83xx_check(adapter)) |
@@ -1378,7 +1420,7 @@ static int qlcnic_set_led(struct net_device *dev, | |||
1378 | } | 1420 | } |
1379 | 1421 | ||
1380 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) | 1422 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) |
1381 | qlcnic_diag_free_res(dev, max_sds_rings); | 1423 | qlcnic_diag_free_res(dev, drv_sds_rings); |
1382 | 1424 | ||
1383 | if (!active || err) | 1425 | if (!active || err) |
1384 | clear_bit(__QLCNIC_LED_ENABLE, &adapter->state); | 1426 | clear_bit(__QLCNIC_LED_ENABLE, &adapter->state); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 272c356cf9b2..13303e7d1ed7 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | |||
@@ -146,6 +146,12 @@ struct qlcnic_mailbox_metadata { | |||
146 | #define QLCNIC_MBX_PORT_RSP_OK 0x1a | 146 | #define QLCNIC_MBX_PORT_RSP_OK 0x1a |
147 | #define QLCNIC_MBX_ASYNC_EVENT BIT_15 | 147 | #define QLCNIC_MBX_ASYNC_EVENT BIT_15 |
148 | 148 | ||
149 | /* Set HW Tx ring limit for 82xx adapter. */ | ||
150 | #define QLCNIC_MAX_HW_TX_RINGS 8 | ||
151 | #define QLCNIC_MAX_HW_VNIC_TX_RINGS 4 | ||
152 | #define QLCNIC_MAX_TX_RINGS 8 | ||
153 | #define QLCNIC_MAX_SDS_RINGS 8 | ||
154 | |||
149 | struct qlcnic_pci_info; | 155 | struct qlcnic_pci_info; |
150 | struct qlcnic_info; | 156 | struct qlcnic_info; |
151 | struct qlcnic_cmd_args; | 157 | struct qlcnic_cmd_args; |
@@ -176,7 +182,7 @@ int qlcnic_82xx_set_lb_mode(struct qlcnic_adapter *, u8); | |||
176 | void qlcnic_82xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 182 | void qlcnic_82xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
177 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 183 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
178 | void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *, u32); | 184 | void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *, u32); |
179 | int qlcnic_82xx_setup_intr(struct qlcnic_adapter *, u8, int); | 185 | int qlcnic_82xx_setup_intr(struct qlcnic_adapter *); |
180 | irqreturn_t qlcnic_82xx_clear_legacy_intr(struct qlcnic_adapter *); | 186 | irqreturn_t qlcnic_82xx_clear_legacy_intr(struct qlcnic_adapter *); |
181 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | 187 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, |
182 | struct qlcnic_cmd_args *); | 188 | struct qlcnic_cmd_args *); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index 66c26cf7a2b8..e9c21e5d0ca9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | |||
@@ -236,7 +236,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) | |||
236 | spin_lock_init(&rds_ring->lock); | 236 | spin_lock_init(&rds_ring->lock); |
237 | } | 237 | } |
238 | 238 | ||
239 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 239 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
240 | sds_ring = &recv_ctx->sds_rings[ring]; | 240 | sds_ring = &recv_ctx->sds_rings[ring]; |
241 | sds_ring->irq = adapter->msix_entries[ring].vector; | 241 | sds_ring->irq = adapter->msix_entries[ring].vector; |
242 | sds_ring->adapter = adapter; | 242 | sds_ring->adapter = adapter; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index df31be7a7aba..1c07ec250f23 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -787,6 +787,9 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter, | |||
787 | struct net_device *netdev = adapter->netdev; | 787 | struct net_device *netdev = adapter->netdev; |
788 | struct qlcnic_skb_frag *frag; | 788 | struct qlcnic_skb_frag *frag; |
789 | 789 | ||
790 | if (!spin_trylock(&adapter->tx_clean_lock)) | ||
791 | return 1; | ||
792 | |||
790 | sw_consumer = tx_ring->sw_consumer; | 793 | sw_consumer = tx_ring->sw_consumer; |
791 | hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); | 794 | hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); |
792 | 795 | ||
@@ -840,6 +843,7 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter, | |||
840 | */ | 843 | */ |
841 | hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); | 844 | hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer)); |
842 | done = (sw_consumer == hw_consumer); | 845 | done = (sw_consumer == hw_consumer); |
846 | spin_unlock(&adapter->tx_clean_lock); | ||
843 | 847 | ||
844 | return done; | 848 | return done; |
845 | } | 849 | } |
@@ -1459,18 +1463,18 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, | |||
1459 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 1463 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1460 | struct qlcnic_host_tx_ring *tx_ring; | 1464 | struct qlcnic_host_tx_ring *tx_ring; |
1461 | 1465 | ||
1462 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings)) | 1466 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->drv_sds_rings)) |
1463 | return -ENOMEM; | 1467 | return -ENOMEM; |
1464 | 1468 | ||
1465 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1469 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1466 | sds_ring = &recv_ctx->sds_rings[ring]; | 1470 | sds_ring = &recv_ctx->sds_rings[ring]; |
1467 | if (qlcnic_check_multi_tx(adapter) && | 1471 | if (qlcnic_check_multi_tx(adapter) && |
1468 | !adapter->ahw->diag_test && | 1472 | !adapter->ahw->diag_test && |
1469 | (adapter->max_drv_tx_rings > 1)) { | 1473 | (adapter->drv_tx_rings > QLCNIC_SINGLE_RING)) { |
1470 | netif_napi_add(netdev, &sds_ring->napi, qlcnic_rx_poll, | 1474 | netif_napi_add(netdev, &sds_ring->napi, qlcnic_rx_poll, |
1471 | NAPI_POLL_WEIGHT); | 1475 | NAPI_POLL_WEIGHT); |
1472 | } else { | 1476 | } else { |
1473 | if (ring == (adapter->max_sds_rings - 1)) | 1477 | if (ring == (adapter->drv_sds_rings - 1)) |
1474 | netif_napi_add(netdev, &sds_ring->napi, | 1478 | netif_napi_add(netdev, &sds_ring->napi, |
1475 | qlcnic_poll, | 1479 | qlcnic_poll, |
1476 | NAPI_POLL_WEIGHT); | 1480 | NAPI_POLL_WEIGHT); |
@@ -1487,7 +1491,7 @@ int qlcnic_82xx_napi_add(struct qlcnic_adapter *adapter, | |||
1487 | } | 1491 | } |
1488 | 1492 | ||
1489 | if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) { | 1493 | if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) { |
1490 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1494 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1491 | tx_ring = &adapter->tx_ring[ring]; | 1495 | tx_ring = &adapter->tx_ring[ring]; |
1492 | netif_napi_add(netdev, &tx_ring->napi, qlcnic_tx_poll, | 1496 | netif_napi_add(netdev, &tx_ring->napi, qlcnic_tx_poll, |
1493 | NAPI_POLL_WEIGHT); | 1497 | NAPI_POLL_WEIGHT); |
@@ -1504,7 +1508,7 @@ void qlcnic_82xx_napi_del(struct qlcnic_adapter *adapter) | |||
1504 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 1508 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1505 | struct qlcnic_host_tx_ring *tx_ring; | 1509 | struct qlcnic_host_tx_ring *tx_ring; |
1506 | 1510 | ||
1507 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1511 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1508 | sds_ring = &recv_ctx->sds_rings[ring]; | 1512 | sds_ring = &recv_ctx->sds_rings[ring]; |
1509 | netif_napi_del(&sds_ring->napi); | 1513 | netif_napi_del(&sds_ring->napi); |
1510 | } | 1514 | } |
@@ -1512,7 +1516,7 @@ void qlcnic_82xx_napi_del(struct qlcnic_adapter *adapter) | |||
1512 | qlcnic_free_sds_rings(adapter->recv_ctx); | 1516 | qlcnic_free_sds_rings(adapter->recv_ctx); |
1513 | 1517 | ||
1514 | if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) { | 1518 | if (qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) { |
1515 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1519 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1516 | tx_ring = &adapter->tx_ring[ring]; | 1520 | tx_ring = &adapter->tx_ring[ring]; |
1517 | netif_napi_del(&tx_ring->napi); | 1521 | netif_napi_del(&tx_ring->napi); |
1518 | } | 1522 | } |
@@ -1531,7 +1535,7 @@ void qlcnic_82xx_napi_enable(struct qlcnic_adapter *adapter) | |||
1531 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 1535 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
1532 | return; | 1536 | return; |
1533 | 1537 | ||
1534 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1538 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1535 | sds_ring = &recv_ctx->sds_rings[ring]; | 1539 | sds_ring = &recv_ctx->sds_rings[ring]; |
1536 | napi_enable(&sds_ring->napi); | 1540 | napi_enable(&sds_ring->napi); |
1537 | qlcnic_enable_int(sds_ring); | 1541 | qlcnic_enable_int(sds_ring); |
@@ -1540,8 +1544,8 @@ void qlcnic_82xx_napi_enable(struct qlcnic_adapter *adapter) | |||
1540 | if (qlcnic_check_multi_tx(adapter) && | 1544 | if (qlcnic_check_multi_tx(adapter) && |
1541 | (adapter->flags & QLCNIC_MSIX_ENABLED) && | 1545 | (adapter->flags & QLCNIC_MSIX_ENABLED) && |
1542 | !adapter->ahw->diag_test && | 1546 | !adapter->ahw->diag_test && |
1543 | (adapter->max_drv_tx_rings > 1)) { | 1547 | (adapter->drv_tx_rings > QLCNIC_SINGLE_RING)) { |
1544 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1548 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1545 | tx_ring = &adapter->tx_ring[ring]; | 1549 | tx_ring = &adapter->tx_ring[ring]; |
1546 | napi_enable(&tx_ring->napi); | 1550 | napi_enable(&tx_ring->napi); |
1547 | qlcnic_enable_tx_intr(adapter, tx_ring); | 1551 | qlcnic_enable_tx_intr(adapter, tx_ring); |
@@ -1559,7 +1563,7 @@ void qlcnic_82xx_napi_disable(struct qlcnic_adapter *adapter) | |||
1559 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 1563 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
1560 | return; | 1564 | return; |
1561 | 1565 | ||
1562 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1566 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1563 | sds_ring = &recv_ctx->sds_rings[ring]; | 1567 | sds_ring = &recv_ctx->sds_rings[ring]; |
1564 | qlcnic_disable_int(sds_ring); | 1568 | qlcnic_disable_int(sds_ring); |
1565 | napi_synchronize(&sds_ring->napi); | 1569 | napi_synchronize(&sds_ring->napi); |
@@ -1569,7 +1573,7 @@ void qlcnic_82xx_napi_disable(struct qlcnic_adapter *adapter) | |||
1569 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 1573 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
1570 | !adapter->ahw->diag_test && | 1574 | !adapter->ahw->diag_test && |
1571 | qlcnic_check_multi_tx(adapter)) { | 1575 | qlcnic_check_multi_tx(adapter)) { |
1572 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1576 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1573 | tx_ring = &adapter->tx_ring[ring]; | 1577 | tx_ring = &adapter->tx_ring[ring]; |
1574 | qlcnic_disable_tx_int(adapter, tx_ring); | 1578 | qlcnic_disable_tx_int(adapter, tx_ring); |
1575 | napi_synchronize(&tx_ring->napi); | 1579 | napi_synchronize(&tx_ring->napi); |
@@ -1907,7 +1911,7 @@ void qlcnic_83xx_napi_enable(struct qlcnic_adapter *adapter) | |||
1907 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 1911 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
1908 | return; | 1912 | return; |
1909 | 1913 | ||
1910 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1914 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1911 | sds_ring = &recv_ctx->sds_rings[ring]; | 1915 | sds_ring = &recv_ctx->sds_rings[ring]; |
1912 | napi_enable(&sds_ring->napi); | 1916 | napi_enable(&sds_ring->napi); |
1913 | if (adapter->flags & QLCNIC_MSIX_ENABLED) | 1917 | if (adapter->flags & QLCNIC_MSIX_ENABLED) |
@@ -1916,7 +1920,7 @@ void qlcnic_83xx_napi_enable(struct qlcnic_adapter *adapter) | |||
1916 | 1920 | ||
1917 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 1921 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
1918 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { | 1922 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { |
1919 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1923 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1920 | tx_ring = &adapter->tx_ring[ring]; | 1924 | tx_ring = &adapter->tx_ring[ring]; |
1921 | napi_enable(&tx_ring->napi); | 1925 | napi_enable(&tx_ring->napi); |
1922 | qlcnic_83xx_enable_tx_intr(adapter, tx_ring); | 1926 | qlcnic_83xx_enable_tx_intr(adapter, tx_ring); |
@@ -1934,7 +1938,7 @@ void qlcnic_83xx_napi_disable(struct qlcnic_adapter *adapter) | |||
1934 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 1938 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
1935 | return; | 1939 | return; |
1936 | 1940 | ||
1937 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1941 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1938 | sds_ring = &recv_ctx->sds_rings[ring]; | 1942 | sds_ring = &recv_ctx->sds_rings[ring]; |
1939 | if (adapter->flags & QLCNIC_MSIX_ENABLED) | 1943 | if (adapter->flags & QLCNIC_MSIX_ENABLED) |
1940 | qlcnic_83xx_disable_intr(adapter, sds_ring); | 1944 | qlcnic_83xx_disable_intr(adapter, sds_ring); |
@@ -1944,7 +1948,7 @@ void qlcnic_83xx_napi_disable(struct qlcnic_adapter *adapter) | |||
1944 | 1948 | ||
1945 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 1949 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
1946 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { | 1950 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { |
1947 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1951 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1948 | tx_ring = &adapter->tx_ring[ring]; | 1952 | tx_ring = &adapter->tx_ring[ring]; |
1949 | qlcnic_83xx_disable_tx_intr(adapter, tx_ring); | 1953 | qlcnic_83xx_disable_tx_intr(adapter, tx_ring); |
1950 | napi_synchronize(&tx_ring->napi); | 1954 | napi_synchronize(&tx_ring->napi); |
@@ -1961,10 +1965,10 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter, | |||
1961 | struct qlcnic_host_tx_ring *tx_ring; | 1965 | struct qlcnic_host_tx_ring *tx_ring; |
1962 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 1966 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1963 | 1967 | ||
1964 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings)) | 1968 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->drv_sds_rings)) |
1965 | return -ENOMEM; | 1969 | return -ENOMEM; |
1966 | 1970 | ||
1967 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1971 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1968 | sds_ring = &recv_ctx->sds_rings[ring]; | 1972 | sds_ring = &recv_ctx->sds_rings[ring]; |
1969 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { | 1973 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { |
1970 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) | 1974 | if (!(adapter->flags & QLCNIC_TX_INTR_SHARED)) |
@@ -1990,7 +1994,7 @@ int qlcnic_83xx_napi_add(struct qlcnic_adapter *adapter, | |||
1990 | 1994 | ||
1991 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 1995 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
1992 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { | 1996 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { |
1993 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 1997 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
1994 | tx_ring = &adapter->tx_ring[ring]; | 1998 | tx_ring = &adapter->tx_ring[ring]; |
1995 | netif_napi_add(netdev, &tx_ring->napi, | 1999 | netif_napi_add(netdev, &tx_ring->napi, |
1996 | qlcnic_83xx_msix_tx_poll, | 2000 | qlcnic_83xx_msix_tx_poll, |
@@ -2008,7 +2012,7 @@ void qlcnic_83xx_napi_del(struct qlcnic_adapter *adapter) | |||
2008 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 2012 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
2009 | struct qlcnic_host_tx_ring *tx_ring; | 2013 | struct qlcnic_host_tx_ring *tx_ring; |
2010 | 2014 | ||
2011 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 2015 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
2012 | sds_ring = &recv_ctx->sds_rings[ring]; | 2016 | sds_ring = &recv_ctx->sds_rings[ring]; |
2013 | netif_napi_del(&sds_ring->napi); | 2017 | netif_napi_del(&sds_ring->napi); |
2014 | } | 2018 | } |
@@ -2017,7 +2021,7 @@ void qlcnic_83xx_napi_del(struct qlcnic_adapter *adapter) | |||
2017 | 2021 | ||
2018 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && | 2022 | if ((adapter->flags & QLCNIC_MSIX_ENABLED) && |
2019 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { | 2023 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) { |
2020 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 2024 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
2021 | tx_ring = &adapter->tx_ring[ring]; | 2025 | tx_ring = &adapter->tx_ring[ring]; |
2022 | netif_napi_del(&tx_ring->napi); | 2026 | netif_napi_del(&tx_ring->napi); |
2023 | } | 2027 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index fab5f3b6be4b..007b7df73510 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -548,36 +548,75 @@ static struct qlcnic_hardware_ops qlcnic_hw_ops = { | |||
548 | .io_resume = qlcnic_82xx_io_resume, | 548 | .io_resume = qlcnic_82xx_io_resume, |
549 | }; | 549 | }; |
550 | 550 | ||
551 | static void qlcnic_get_multiq_capability(struct qlcnic_adapter *adapter) | 551 | static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter) |
552 | { | 552 | { |
553 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 553 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
554 | int num_tx_q; | ||
555 | 554 | ||
556 | if (ahw->msix_supported && | 555 | if (qlcnic_82xx_check(adapter) && |
557 | (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_MULTI_TX)) { | 556 | (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_MULTI_TX)) { |
558 | num_tx_q = min_t(int, QLCNIC_DEF_NUM_TX_RINGS, | 557 | test_and_set_bit(__QLCNIC_MULTI_TX_UNIQUE, &adapter->state); |
559 | num_online_cpus()); | 558 | return 0; |
560 | if (num_tx_q > 1) { | ||
561 | test_and_set_bit(__QLCNIC_MULTI_TX_UNIQUE, | ||
562 | &adapter->state); | ||
563 | adapter->max_drv_tx_rings = num_tx_q; | ||
564 | } | ||
565 | } else { | 559 | } else { |
566 | adapter->max_drv_tx_rings = 1; | 560 | return 1; |
567 | } | 561 | } |
568 | } | 562 | } |
569 | 563 | ||
564 | static int qlcnic_max_rings(struct qlcnic_adapter *adapter, u8 ring_cnt, | ||
565 | int queue_type) | ||
566 | { | ||
567 | int num_rings, max_rings = QLCNIC_MAX_SDS_RINGS; | ||
568 | |||
569 | if (queue_type == QLCNIC_RX_QUEUE) | ||
570 | max_rings = adapter->max_sds_rings; | ||
571 | else if (queue_type == QLCNIC_TX_QUEUE) | ||
572 | max_rings = adapter->max_tx_rings; | ||
573 | |||
574 | num_rings = rounddown_pow_of_two(min_t(int, num_online_cpus(), | ||
575 | max_rings)); | ||
576 | |||
577 | if (ring_cnt > num_rings) | ||
578 | return num_rings; | ||
579 | else | ||
580 | return ring_cnt; | ||
581 | } | ||
582 | |||
583 | void qlcnic_set_tx_ring_count(struct qlcnic_adapter *adapter, u8 tx_cnt) | ||
584 | { | ||
585 | /* 83xx adapter does not have max_tx_rings intialized in probe */ | ||
586 | if (adapter->max_tx_rings) | ||
587 | adapter->drv_tx_rings = qlcnic_max_rings(adapter, tx_cnt, | ||
588 | QLCNIC_TX_QUEUE); | ||
589 | else | ||
590 | adapter->drv_tx_rings = tx_cnt; | ||
591 | |||
592 | dev_info(&adapter->pdev->dev, "Set %d Tx rings\n", | ||
593 | adapter->drv_tx_rings); | ||
594 | } | ||
595 | |||
596 | void qlcnic_set_sds_ring_count(struct qlcnic_adapter *adapter, u8 rx_cnt) | ||
597 | { | ||
598 | /* 83xx adapter does not have max_sds_rings intialized in probe */ | ||
599 | if (adapter->max_sds_rings) | ||
600 | adapter->drv_sds_rings = qlcnic_max_rings(adapter, rx_cnt, | ||
601 | QLCNIC_RX_QUEUE); | ||
602 | else | ||
603 | adapter->drv_sds_rings = rx_cnt; | ||
604 | |||
605 | dev_info(&adapter->pdev->dev, "Set %d SDS rings\n", | ||
606 | adapter->drv_sds_rings); | ||
607 | } | ||
608 | |||
570 | int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) | 609 | int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) |
571 | { | 610 | { |
572 | struct pci_dev *pdev = adapter->pdev; | 611 | struct pci_dev *pdev = adapter->pdev; |
573 | int max_tx_rings, max_sds_rings, tx_vector; | 612 | int drv_tx_rings, drv_sds_rings, tx_vector; |
574 | int err = -1, i; | 613 | int err = -1, i; |
575 | 614 | ||
576 | if (adapter->flags & QLCNIC_TX_INTR_SHARED) { | 615 | if (adapter->flags & QLCNIC_TX_INTR_SHARED) { |
577 | max_tx_rings = 0; | 616 | drv_tx_rings = 0; |
578 | tx_vector = 0; | 617 | tx_vector = 0; |
579 | } else { | 618 | } else { |
580 | max_tx_rings = adapter->max_drv_tx_rings; | 619 | drv_tx_rings = adapter->drv_tx_rings; |
581 | tx_vector = 1; | 620 | tx_vector = 1; |
582 | } | 621 | } |
583 | 622 | ||
@@ -589,7 +628,7 @@ int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) | |||
589 | return -ENOMEM; | 628 | return -ENOMEM; |
590 | } | 629 | } |
591 | 630 | ||
592 | adapter->max_sds_rings = 1; | 631 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; |
593 | adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); | 632 | adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); |
594 | 633 | ||
595 | if (adapter->ahw->msix_supported) { | 634 | if (adapter->ahw->msix_supported) { |
@@ -602,18 +641,18 @@ int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) | |||
602 | if (qlcnic_83xx_check(adapter)) { | 641 | if (qlcnic_83xx_check(adapter)) { |
603 | adapter->ahw->num_msix = num_msix; | 642 | adapter->ahw->num_msix = num_msix; |
604 | /* subtract mail box and tx ring vectors */ | 643 | /* subtract mail box and tx ring vectors */ |
605 | adapter->max_sds_rings = num_msix - | 644 | adapter->drv_sds_rings = num_msix - |
606 | max_tx_rings - 1; | 645 | drv_tx_rings - 1; |
607 | } else { | 646 | } else { |
608 | adapter->ahw->num_msix = num_msix; | 647 | adapter->ahw->num_msix = num_msix; |
609 | if (qlcnic_check_multi_tx(adapter) && | 648 | if (qlcnic_check_multi_tx(adapter) && |
610 | !adapter->ahw->diag_test && | 649 | !adapter->ahw->diag_test && |
611 | (adapter->max_drv_tx_rings > 1)) | 650 | (adapter->drv_tx_rings > 1)) |
612 | max_sds_rings = num_msix - max_tx_rings; | 651 | drv_sds_rings = num_msix - drv_tx_rings; |
613 | else | 652 | else |
614 | max_sds_rings = num_msix; | 653 | drv_sds_rings = num_msix; |
615 | 654 | ||
616 | adapter->max_sds_rings = max_sds_rings; | 655 | adapter->drv_sds_rings = drv_sds_rings; |
617 | } | 656 | } |
618 | dev_info(&pdev->dev, "using msi-x interrupts\n"); | 657 | dev_info(&pdev->dev, "using msi-x interrupts\n"); |
619 | return err; | 658 | return err; |
@@ -624,13 +663,13 @@ int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix) | |||
624 | if (qlcnic_83xx_check(adapter)) { | 663 | if (qlcnic_83xx_check(adapter)) { |
625 | if (err < (QLC_83XX_MINIMUM_VECTOR - tx_vector)) | 664 | if (err < (QLC_83XX_MINIMUM_VECTOR - tx_vector)) |
626 | return err; | 665 | return err; |
627 | err -= (max_tx_rings + 1); | 666 | err -= drv_tx_rings + 1; |
628 | num_msix = rounddown_pow_of_two(err); | 667 | num_msix = rounddown_pow_of_two(err); |
629 | num_msix += (max_tx_rings + 1); | 668 | num_msix += drv_tx_rings + 1; |
630 | } else { | 669 | } else { |
631 | num_msix = rounddown_pow_of_two(err); | 670 | num_msix = rounddown_pow_of_two(err); |
632 | if (qlcnic_check_multi_tx(adapter)) | 671 | if (qlcnic_check_multi_tx(adapter)) |
633 | num_msix += max_tx_rings; | 672 | num_msix += drv_tx_rings; |
634 | } | 673 | } |
635 | 674 | ||
636 | if (num_msix) { | 675 | if (num_msix) { |
@@ -683,25 +722,14 @@ static int qlcnic_enable_msi_legacy(struct qlcnic_adapter *adapter) | |||
683 | return err; | 722 | return err; |
684 | } | 723 | } |
685 | 724 | ||
686 | int qlcnic_82xx_setup_intr(struct qlcnic_adapter *adapter, u8 num_intr, int txq) | 725 | int qlcnic_82xx_setup_intr(struct qlcnic_adapter *adapter) |
687 | { | 726 | { |
688 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
689 | int num_msix, err = 0; | 727 | int num_msix, err = 0; |
690 | 728 | ||
691 | if (!num_intr) | 729 | num_msix = adapter->drv_sds_rings; |
692 | num_intr = QLCNIC_DEF_NUM_STS_DESC_RINGS; | ||
693 | 730 | ||
694 | if (ahw->msix_supported) { | 731 | if (qlcnic_check_multi_tx(adapter)) |
695 | num_msix = rounddown_pow_of_two(min_t(int, num_online_cpus(), | 732 | num_msix += adapter->drv_tx_rings; |
696 | num_intr)); | ||
697 | if (qlcnic_check_multi_tx(adapter)) { | ||
698 | if (txq) | ||
699 | adapter->max_drv_tx_rings = txq; | ||
700 | num_msix += adapter->max_drv_tx_rings; | ||
701 | } | ||
702 | } else { | ||
703 | num_msix = 1; | ||
704 | } | ||
705 | 733 | ||
706 | err = qlcnic_enable_msix(adapter, num_msix); | 734 | err = qlcnic_enable_msix(adapter, num_msix); |
707 | if (err == -ENOMEM) | 735 | if (err == -ENOMEM) |
@@ -1140,14 +1168,18 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | |||
1140 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; | 1168 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; |
1141 | adapter->ahw->max_mtu = nic_info.max_mtu; | 1169 | adapter->ahw->max_mtu = nic_info.max_mtu; |
1142 | 1170 | ||
1143 | /* Disable NPAR for 83XX */ | 1171 | if (adapter->ahw->capabilities & BIT_6) { |
1144 | if (qlcnic_83xx_check(adapter)) | ||
1145 | return err; | ||
1146 | |||
1147 | if (adapter->ahw->capabilities & BIT_6) | ||
1148 | adapter->flags |= QLCNIC_ESWITCH_ENABLED; | 1172 | adapter->flags |= QLCNIC_ESWITCH_ENABLED; |
1149 | else | 1173 | adapter->ahw->nic_mode = QLCNIC_VNIC_MODE; |
1174 | adapter->max_tx_rings = QLCNIC_MAX_HW_VNIC_TX_RINGS; | ||
1175 | adapter->max_sds_rings = QLCNIC_MAX_VNIC_SDS_RINGS; | ||
1176 | |||
1177 | dev_info(&adapter->pdev->dev, "vNIC mode enabled.\n"); | ||
1178 | } else { | ||
1179 | adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE; | ||
1180 | adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS; | ||
1150 | adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; | 1181 | adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; |
1182 | } | ||
1151 | 1183 | ||
1152 | return err; | 1184 | return err; |
1153 | } | 1185 | } |
@@ -1295,6 +1327,8 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter) | |||
1295 | "HAL Version: %d, Privileged function\n", | 1327 | "HAL Version: %d, Privileged function\n", |
1296 | adapter->ahw->fw_hal_version); | 1328 | adapter->ahw->fw_hal_version); |
1297 | } | 1329 | } |
1330 | } else { | ||
1331 | adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE; | ||
1298 | } | 1332 | } |
1299 | 1333 | ||
1300 | adapter->flags |= QLCNIC_ADAPTER_INITIALIZED; | 1334 | adapter->flags |= QLCNIC_ADAPTER_INITIALIZED; |
@@ -1554,7 +1588,7 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) | |||
1554 | if (qlcnic_82xx_check(adapter) || | 1588 | if (qlcnic_82xx_check(adapter) || |
1555 | (qlcnic_83xx_check(adapter) && | 1589 | (qlcnic_83xx_check(adapter) && |
1556 | (adapter->flags & QLCNIC_MSIX_ENABLED))) { | 1590 | (adapter->flags & QLCNIC_MSIX_ENABLED))) { |
1557 | num_sds_rings = adapter->max_sds_rings; | 1591 | num_sds_rings = adapter->drv_sds_rings; |
1558 | for (ring = 0; ring < num_sds_rings; ring++) { | 1592 | for (ring = 0; ring < num_sds_rings; ring++) { |
1559 | sds_ring = &recv_ctx->sds_rings[ring]; | 1593 | sds_ring = &recv_ctx->sds_rings[ring]; |
1560 | if (qlcnic_82xx_check(adapter) && | 1594 | if (qlcnic_82xx_check(adapter) && |
@@ -1588,7 +1622,7 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) | |||
1588 | (adapter->flags & QLCNIC_MSIX_ENABLED) && | 1622 | (adapter->flags & QLCNIC_MSIX_ENABLED) && |
1589 | !(adapter->flags & QLCNIC_TX_INTR_SHARED))) { | 1623 | !(adapter->flags & QLCNIC_TX_INTR_SHARED))) { |
1590 | handler = qlcnic_msix_tx_intr; | 1624 | handler = qlcnic_msix_tx_intr; |
1591 | for (ring = 0; ring < adapter->max_drv_tx_rings; | 1625 | for (ring = 0; ring < adapter->drv_tx_rings; |
1592 | ring++) { | 1626 | ring++) { |
1593 | tx_ring = &adapter->tx_ring[ring]; | 1627 | tx_ring = &adapter->tx_ring[ring]; |
1594 | snprintf(tx_ring->name, sizeof(tx_ring->name), | 1628 | snprintf(tx_ring->name, sizeof(tx_ring->name), |
@@ -1616,7 +1650,7 @@ qlcnic_free_irq(struct qlcnic_adapter *adapter) | |||
1616 | if (qlcnic_82xx_check(adapter) || | 1650 | if (qlcnic_82xx_check(adapter) || |
1617 | (qlcnic_83xx_check(adapter) && | 1651 | (qlcnic_83xx_check(adapter) && |
1618 | (adapter->flags & QLCNIC_MSIX_ENABLED))) { | 1652 | (adapter->flags & QLCNIC_MSIX_ENABLED))) { |
1619 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1653 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1620 | sds_ring = &recv_ctx->sds_rings[ring]; | 1654 | sds_ring = &recv_ctx->sds_rings[ring]; |
1621 | free_irq(sds_ring->irq, sds_ring); | 1655 | free_irq(sds_ring->irq, sds_ring); |
1622 | } | 1656 | } |
@@ -1625,7 +1659,7 @@ qlcnic_free_irq(struct qlcnic_adapter *adapter) | |||
1625 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) || | 1659 | !(adapter->flags & QLCNIC_TX_INTR_SHARED)) || |
1626 | (qlcnic_82xx_check(adapter) && | 1660 | (qlcnic_82xx_check(adapter) && |
1627 | qlcnic_check_multi_tx(adapter))) { | 1661 | qlcnic_check_multi_tx(adapter))) { |
1628 | for (ring = 0; ring < adapter->max_drv_tx_rings; | 1662 | for (ring = 0; ring < adapter->drv_tx_rings; |
1629 | ring++) { | 1663 | ring++) { |
1630 | tx_ring = &adapter->tx_ring[ring]; | 1664 | tx_ring = &adapter->tx_ring[ring]; |
1631 | if (tx_ring->irq) | 1665 | if (tx_ring->irq) |
@@ -1679,7 +1713,7 @@ int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1679 | 1713 | ||
1680 | adapter->ahw->linkup = 0; | 1714 | adapter->ahw->linkup = 0; |
1681 | 1715 | ||
1682 | if (adapter->max_sds_rings > 1) | 1716 | if (adapter->drv_sds_rings > 1) |
1683 | qlcnic_config_rss(adapter, 1); | 1717 | qlcnic_config_rss(adapter, 1); |
1684 | 1718 | ||
1685 | qlcnic_config_intr_coalesce(adapter); | 1719 | qlcnic_config_intr_coalesce(adapter); |
@@ -1721,6 +1755,7 @@ void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1721 | if (qlcnic_sriov_vf_check(adapter)) | 1755 | if (qlcnic_sriov_vf_check(adapter)) |
1722 | qlcnic_sriov_cleanup_async_list(&adapter->ahw->sriov->bc); | 1756 | qlcnic_sriov_cleanup_async_list(&adapter->ahw->sriov->bc); |
1723 | smp_mb(); | 1757 | smp_mb(); |
1758 | spin_lock(&adapter->tx_clean_lock); | ||
1724 | netif_carrier_off(netdev); | 1759 | netif_carrier_off(netdev); |
1725 | adapter->ahw->linkup = 0; | 1760 | adapter->ahw->linkup = 0; |
1726 | netif_tx_disable(netdev); | 1761 | netif_tx_disable(netdev); |
@@ -1739,8 +1774,9 @@ void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1739 | 1774 | ||
1740 | qlcnic_reset_rx_buffers_list(adapter); | 1775 | qlcnic_reset_rx_buffers_list(adapter); |
1741 | 1776 | ||
1742 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) | 1777 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) |
1743 | qlcnic_release_tx_buffers(adapter, &adapter->tx_ring[ring]); | 1778 | qlcnic_release_tx_buffers(adapter, &adapter->tx_ring[ring]); |
1779 | spin_unlock(&adapter->tx_clean_lock); | ||
1744 | } | 1780 | } |
1745 | 1781 | ||
1746 | /* Usage: During suspend and firmware recovery module */ | 1782 | /* Usage: During suspend and firmware recovery module */ |
@@ -1816,16 +1852,16 @@ void qlcnic_detach(struct qlcnic_adapter *adapter) | |||
1816 | adapter->is_up = 0; | 1852 | adapter->is_up = 0; |
1817 | } | 1853 | } |
1818 | 1854 | ||
1819 | void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings) | 1855 | void qlcnic_diag_free_res(struct net_device *netdev, int drv_sds_rings) |
1820 | { | 1856 | { |
1821 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1857 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1822 | struct qlcnic_host_sds_ring *sds_ring; | 1858 | struct qlcnic_host_sds_ring *sds_ring; |
1823 | int max_tx_rings = adapter->max_drv_tx_rings; | 1859 | int drv_tx_rings = adapter->drv_tx_rings; |
1824 | int ring; | 1860 | int ring; |
1825 | 1861 | ||
1826 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); | 1862 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); |
1827 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1863 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1828 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1864 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1829 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; | 1865 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1830 | qlcnic_disable_int(sds_ring); | 1866 | qlcnic_disable_int(sds_ring); |
1831 | } | 1867 | } |
@@ -1836,8 +1872,8 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings) | |||
1836 | qlcnic_detach(adapter); | 1872 | qlcnic_detach(adapter); |
1837 | 1873 | ||
1838 | adapter->ahw->diag_test = 0; | 1874 | adapter->ahw->diag_test = 0; |
1839 | adapter->max_sds_rings = max_sds_rings; | 1875 | adapter->drv_sds_rings = drv_sds_rings; |
1840 | adapter->max_drv_tx_rings = max_tx_rings; | 1876 | adapter->drv_tx_rings = drv_tx_rings; |
1841 | 1877 | ||
1842 | if (qlcnic_attach(adapter)) | 1878 | if (qlcnic_attach(adapter)) |
1843 | goto out; | 1879 | goto out; |
@@ -1903,10 +1939,10 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | |||
1903 | 1939 | ||
1904 | qlcnic_detach(adapter); | 1940 | qlcnic_detach(adapter); |
1905 | 1941 | ||
1906 | adapter->max_sds_rings = 1; | 1942 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; |
1943 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; | ||
1907 | adapter->ahw->diag_test = test; | 1944 | adapter->ahw->diag_test = test; |
1908 | adapter->ahw->linkup = 0; | 1945 | adapter->ahw->linkup = 0; |
1909 | adapter->max_drv_tx_rings = 1; | ||
1910 | 1946 | ||
1911 | ret = qlcnic_attach(adapter); | 1947 | ret = qlcnic_attach(adapter); |
1912 | if (ret) { | 1948 | if (ret) { |
@@ -1927,7 +1963,7 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | |||
1927 | } | 1963 | } |
1928 | 1964 | ||
1929 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1965 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1930 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1966 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
1931 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; | 1967 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1932 | qlcnic_enable_int(sds_ring); | 1968 | qlcnic_enable_int(sds_ring); |
1933 | } | 1969 | } |
@@ -2100,7 +2136,7 @@ void qlcnic_free_tx_rings(struct qlcnic_adapter *adapter) | |||
2100 | int ring; | 2136 | int ring; |
2101 | struct qlcnic_host_tx_ring *tx_ring; | 2137 | struct qlcnic_host_tx_ring *tx_ring; |
2102 | 2138 | ||
2103 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 2139 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
2104 | tx_ring = &adapter->tx_ring[ring]; | 2140 | tx_ring = &adapter->tx_ring[ring]; |
2105 | if (tx_ring && tx_ring->cmd_buf_arr != NULL) { | 2141 | if (tx_ring && tx_ring->cmd_buf_arr != NULL) { |
2106 | vfree(tx_ring->cmd_buf_arr); | 2142 | vfree(tx_ring->cmd_buf_arr); |
@@ -2118,14 +2154,14 @@ int qlcnic_alloc_tx_rings(struct qlcnic_adapter *adapter, | |||
2118 | struct qlcnic_host_tx_ring *tx_ring; | 2154 | struct qlcnic_host_tx_ring *tx_ring; |
2119 | struct qlcnic_cmd_buffer *cmd_buf_arr; | 2155 | struct qlcnic_cmd_buffer *cmd_buf_arr; |
2120 | 2156 | ||
2121 | tx_ring = kcalloc(adapter->max_drv_tx_rings, | 2157 | tx_ring = kcalloc(adapter->drv_tx_rings, |
2122 | sizeof(struct qlcnic_host_tx_ring), GFP_KERNEL); | 2158 | sizeof(struct qlcnic_host_tx_ring), GFP_KERNEL); |
2123 | if (tx_ring == NULL) | 2159 | if (tx_ring == NULL) |
2124 | return -ENOMEM; | 2160 | return -ENOMEM; |
2125 | 2161 | ||
2126 | adapter->tx_ring = tx_ring; | 2162 | adapter->tx_ring = tx_ring; |
2127 | 2163 | ||
2128 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 2164 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
2129 | tx_ring = &adapter->tx_ring[ring]; | 2165 | tx_ring = &adapter->tx_ring[ring]; |
2130 | tx_ring->num_desc = adapter->num_txd; | 2166 | tx_ring->num_desc = adapter->num_txd; |
2131 | tx_ring->txq = netdev_get_tx_queue(netdev, ring); | 2167 | tx_ring->txq = netdev_get_tx_queue(netdev, ring); |
@@ -2140,11 +2176,11 @@ int qlcnic_alloc_tx_rings(struct qlcnic_adapter *adapter, | |||
2140 | 2176 | ||
2141 | if (qlcnic_83xx_check(adapter) || | 2177 | if (qlcnic_83xx_check(adapter) || |
2142 | (qlcnic_82xx_check(adapter) && qlcnic_check_multi_tx(adapter))) { | 2178 | (qlcnic_82xx_check(adapter) && qlcnic_check_multi_tx(adapter))) { |
2143 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 2179 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
2144 | tx_ring = &adapter->tx_ring[ring]; | 2180 | tx_ring = &adapter->tx_ring[ring]; |
2145 | tx_ring->adapter = adapter; | 2181 | tx_ring->adapter = adapter; |
2146 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { | 2182 | if (adapter->flags & QLCNIC_MSIX_ENABLED) { |
2147 | index = adapter->max_sds_rings + ring; | 2183 | index = adapter->drv_sds_rings + ring; |
2148 | vector = adapter->msix_entries[index].vector; | 2184 | vector = adapter->msix_entries[index].vector; |
2149 | tx_ring->irq = vector; | 2185 | tx_ring->irq = vector; |
2150 | } | 2186 | } |
@@ -2263,6 +2299,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2263 | rwlock_init(&adapter->ahw->crb_lock); | 2299 | rwlock_init(&adapter->ahw->crb_lock); |
2264 | mutex_init(&adapter->ahw->mem_lock); | 2300 | mutex_init(&adapter->ahw->mem_lock); |
2265 | 2301 | ||
2302 | spin_lock_init(&adapter->tx_clean_lock); | ||
2266 | INIT_LIST_HEAD(&adapter->mac_list); | 2303 | INIT_LIST_HEAD(&adapter->mac_list); |
2267 | 2304 | ||
2268 | qlcnic_register_dcb(adapter); | 2305 | qlcnic_register_dcb(adapter); |
@@ -2277,20 +2314,21 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2277 | goto err_out_maintenance_mode; | 2314 | goto err_out_maintenance_mode; |
2278 | } | 2315 | } |
2279 | 2316 | ||
2280 | qlcnic_get_multiq_capability(adapter); | 2317 | /* compute and set default and max tx/sds rings */ |
2281 | 2318 | if (adapter->ahw->msix_supported) { | |
2282 | if ((adapter->ahw->act_pci_func > 2) && | 2319 | if (qlcnic_check_multi_tx_capability(adapter) == 1) |
2283 | qlcnic_check_multi_tx(adapter)) { | 2320 | qlcnic_set_tx_ring_count(adapter, |
2284 | adapter->max_drv_tx_rings = QLCNIC_DEF_NUM_TX_RINGS; | 2321 | QLCNIC_SINGLE_RING); |
2285 | dev_info(&adapter->pdev->dev, | 2322 | else |
2286 | "vNIC mode enabled, Set max TX rings = %d\n", | 2323 | qlcnic_set_tx_ring_count(adapter, |
2287 | adapter->max_drv_tx_rings); | 2324 | QLCNIC_DEF_TX_RINGS); |
2325 | qlcnic_set_sds_ring_count(adapter, | ||
2326 | QLCNIC_DEF_SDS_RINGS); | ||
2327 | } else { | ||
2328 | qlcnic_set_tx_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
2329 | qlcnic_set_sds_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
2288 | } | 2330 | } |
2289 | 2331 | ||
2290 | if (!qlcnic_check_multi_tx(adapter)) { | ||
2291 | clear_bit(__QLCNIC_MULTI_TX_UNIQUE, &adapter->state); | ||
2292 | adapter->max_drv_tx_rings = 1; | ||
2293 | } | ||
2294 | err = qlcnic_setup_idc_param(adapter); | 2332 | err = qlcnic_setup_idc_param(adapter); |
2295 | if (err) | 2333 | if (err) |
2296 | goto err_out_free_hw; | 2334 | goto err_out_free_hw; |
@@ -2301,13 +2339,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2301 | 2339 | ||
2302 | if (dcb && qlcnic_dcb_attach(dcb)) | 2340 | if (dcb && qlcnic_dcb_attach(dcb)) |
2303 | qlcnic_clear_dcb_ops(dcb); | 2341 | qlcnic_clear_dcb_ops(dcb); |
2304 | |||
2305 | } else if (qlcnic_83xx_check(adapter)) { | 2342 | } else if (qlcnic_83xx_check(adapter)) { |
2306 | adapter->max_drv_tx_rings = 1; | ||
2307 | qlcnic_83xx_check_vf(adapter, ent); | 2343 | qlcnic_83xx_check_vf(adapter, ent); |
2308 | adapter->portnum = adapter->ahw->pci_func; | 2344 | adapter->portnum = adapter->ahw->pci_func; |
2309 | err = qlcnic_83xx_init(adapter, pci_using_dac); | 2345 | err = qlcnic_83xx_init(adapter, pci_using_dac); |
2310 | |||
2311 | if (err) { | 2346 | if (err) { |
2312 | switch (err) { | 2347 | switch (err) { |
2313 | case -ENOTRECOVERABLE: | 2348 | case -ENOTRECOVERABLE: |
@@ -2351,7 +2386,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2351 | "Device does not support MSI interrupts\n"); | 2386 | "Device does not support MSI interrupts\n"); |
2352 | 2387 | ||
2353 | if (qlcnic_82xx_check(adapter)) { | 2388 | if (qlcnic_82xx_check(adapter)) { |
2354 | err = qlcnic_setup_intr(adapter, 0, 0); | 2389 | err = qlcnic_setup_intr(adapter); |
2355 | if (err) { | 2390 | if (err) { |
2356 | dev_err(&pdev->dev, "Failed to setup interrupt\n"); | 2391 | dev_err(&pdev->dev, "Failed to setup interrupt\n"); |
2357 | goto err_out_disable_msi; | 2392 | goto err_out_disable_msi; |
@@ -2722,7 +2757,7 @@ static void qlcnic_tx_timeout(struct net_device *netdev) | |||
2722 | QLCNIC_FORCE_FW_DUMP_KEY); | 2757 | QLCNIC_FORCE_FW_DUMP_KEY); |
2723 | } else { | 2758 | } else { |
2724 | netdev_info(netdev, "Tx timeout, reset adapter context.\n"); | 2759 | netdev_info(netdev, "Tx timeout, reset adapter context.\n"); |
2725 | for (ring = 0; ring < adapter->max_drv_tx_rings; ring++) { | 2760 | for (ring = 0; ring < adapter->drv_tx_rings; ring++) { |
2726 | tx_ring = &adapter->tx_ring[ring]; | 2761 | tx_ring = &adapter->tx_ring[ring]; |
2727 | netdev_info(netdev, "Tx ring=%d\n", ring); | 2762 | netdev_info(netdev, "Tx ring=%d\n", ring); |
2728 | netdev_info(netdev, | 2763 | netdev_info(netdev, |
@@ -2850,7 +2885,7 @@ static void qlcnic_poll_controller(struct net_device *netdev) | |||
2850 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; | 2885 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
2851 | 2886 | ||
2852 | disable_irq(adapter->irq); | 2887 | disable_irq(adapter->irq); |
2853 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 2888 | for (ring = 0; ring < adapter->drv_sds_rings; ring++) { |
2854 | sds_ring = &recv_ctx->sds_rings[ring]; | 2889 | sds_ring = &recv_ctx->sds_rings[ring]; |
2855 | qlcnic_intr(adapter->irq, sds_ring); | 2890 | qlcnic_intr(adapter->irq, sds_ring); |
2856 | } | 2891 | } |
@@ -3517,7 +3552,7 @@ static int qlcnic_attach_func(struct pci_dev *pdev) | |||
3517 | qlcnic_clr_drv_state(adapter); | 3552 | qlcnic_clr_drv_state(adapter); |
3518 | kfree(adapter->msix_entries); | 3553 | kfree(adapter->msix_entries); |
3519 | adapter->msix_entries = NULL; | 3554 | adapter->msix_entries = NULL; |
3520 | err = qlcnic_setup_intr(adapter, 0, 0); | 3555 | err = qlcnic_setup_intr(adapter); |
3521 | 3556 | ||
3522 | if (err) { | 3557 | if (err) { |
3523 | kfree(adapter->msix_entries); | 3558 | kfree(adapter->msix_entries); |
@@ -3662,130 +3697,94 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) | |||
3662 | return err; | 3697 | return err; |
3663 | } | 3698 | } |
3664 | 3699 | ||
3665 | int qlcnic_validate_max_tx_rings(struct qlcnic_adapter *adapter, u32 txq) | 3700 | int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt, |
3701 | int queue_type) | ||
3666 | { | 3702 | { |
3667 | struct net_device *netdev = adapter->netdev; | 3703 | struct net_device *netdev = adapter->netdev; |
3668 | u8 max_hw = QLCNIC_MAX_TX_RINGS; | 3704 | u8 max_hw_rings = 0; |
3669 | u32 max_allowed; | 3705 | char buf[8]; |
3706 | int cur_rings; | ||
3707 | |||
3708 | if (queue_type == QLCNIC_RX_QUEUE) { | ||
3709 | max_hw_rings = adapter->max_sds_rings; | ||
3710 | cur_rings = adapter->drv_sds_rings; | ||
3711 | strcpy(buf, "SDS"); | ||
3712 | } else if (queue_type == QLCNIC_TX_QUEUE) { | ||
3713 | if (qlcnic_83xx_check(adapter)) | ||
3714 | max_hw_rings = QLCNIC_SINGLE_RING; | ||
3715 | else | ||
3716 | max_hw_rings = adapter->max_tx_rings; | ||
3670 | 3717 | ||
3671 | if (!qlcnic_use_msi_x && !qlcnic_use_msi) { | 3718 | cur_rings = adapter->drv_tx_rings; |
3672 | netdev_err(netdev, "No Multi TX-Q support in INT-x mode\n"); | 3719 | strcpy(buf, "Tx"); |
3673 | return -EINVAL; | ||
3674 | } | 3720 | } |
3675 | 3721 | ||
3676 | if (!qlcnic_check_multi_tx(adapter)) { | 3722 | if (!qlcnic_use_msi_x && !qlcnic_use_msi) { |
3677 | netdev_err(netdev, "No Multi TX-Q support\n"); | 3723 | netdev_err(netdev, "No RSS/TSS support in INT-x mode\n"); |
3678 | return -EINVAL; | 3724 | return -EINVAL; |
3679 | } | 3725 | } |
3680 | 3726 | ||
3681 | if (txq > QLCNIC_MAX_TX_RINGS) { | 3727 | if (adapter->flags & QLCNIC_MSI_ENABLED) { |
3682 | netdev_err(netdev, "Invalid ring count\n"); | 3728 | netdev_err(netdev, "No RSS/TSS support in MSI mode\n"); |
3683 | return -EINVAL; | 3729 | return -EINVAL; |
3684 | } | 3730 | } |
3685 | 3731 | ||
3686 | max_allowed = rounddown_pow_of_two(min_t(int, max_hw, | 3732 | if (ring_cnt < 2) { |
3687 | num_online_cpus())); | 3733 | netdev_err(netdev, |
3688 | if ((txq > max_allowed) || !is_power_of_2(txq)) { | 3734 | "%s rings value should not be lower than 2\n", buf); |
3689 | if (!is_power_of_2(txq)) | ||
3690 | netdev_err(netdev, | ||
3691 | "TX queue should be a power of 2\n"); | ||
3692 | if (txq > num_online_cpus()) | ||
3693 | netdev_err(netdev, | ||
3694 | "Tx queue should not be higher than [%u], number of online CPUs in the system\n", | ||
3695 | num_online_cpus()); | ||
3696 | netdev_err(netdev, "Unable to configure %u Tx rings\n", txq); | ||
3697 | return -EINVAL; | 3735 | return -EINVAL; |
3698 | } | 3736 | } |
3699 | 3737 | ||
3700 | return 0; | 3738 | if (!is_power_of_2(ring_cnt)) { |
3701 | } | 3739 | netdev_err(netdev, "%s rings value should be a power of 2\n", |
3702 | 3740 | buf); | |
3703 | int qlcnic_validate_max_rss(struct qlcnic_adapter *adapter, | ||
3704 | __u32 val) | ||
3705 | { | ||
3706 | struct net_device *netdev = adapter->netdev; | ||
3707 | u8 max_hw = adapter->ahw->max_rx_ques; | ||
3708 | u32 max_allowed; | ||
3709 | |||
3710 | if (!qlcnic_use_msi_x && !qlcnic_use_msi) { | ||
3711 | netdev_err(netdev, "No RSS support in INT-x mode\n"); | ||
3712 | return -EINVAL; | 3741 | return -EINVAL; |
3713 | } | 3742 | } |
3714 | 3743 | ||
3715 | if (val > QLCNIC_MAX_SDS_RINGS) { | 3744 | if (qlcnic_82xx_check(adapter) && (queue_type == QLCNIC_TX_QUEUE) && |
3716 | netdev_err(netdev, "RSS value should not be higher than %u\n", | 3745 | !qlcnic_check_multi_tx(adapter)) { |
3717 | QLCNIC_MAX_SDS_RINGS); | 3746 | netdev_err(netdev, "No Multi Tx queue support\n"); |
3718 | return -EINVAL; | 3747 | return -EINVAL; |
3719 | } | 3748 | } |
3720 | 3749 | ||
3721 | max_allowed = rounddown_pow_of_two(min_t(int, max_hw, | 3750 | if (ring_cnt > num_online_cpus()) { |
3722 | num_online_cpus())); | 3751 | netdev_err(netdev, |
3723 | if ((val > max_allowed) || (val < 2) || !is_power_of_2(val)) { | 3752 | "%s value[%u] should not be higher than, number of online CPUs\n", |
3724 | if (!is_power_of_2(val)) | 3753 | buf, num_online_cpus()); |
3725 | netdev_err(netdev, "RSS value should be a power of 2\n"); | ||
3726 | |||
3727 | if (val < 2) | ||
3728 | netdev_err(netdev, "RSS value should not be lower than 2\n"); | ||
3729 | |||
3730 | if (val > max_hw) | ||
3731 | netdev_err(netdev, | ||
3732 | "RSS value should not be higher than[%u], the max RSS rings supported by the adapter\n", | ||
3733 | max_hw); | ||
3734 | |||
3735 | if (val > num_online_cpus()) | ||
3736 | netdev_err(netdev, | ||
3737 | "RSS value should not be higher than[%u], number of online CPUs in the system\n", | ||
3738 | num_online_cpus()); | ||
3739 | |||
3740 | netdev_err(netdev, "Unable to configure %u RSS rings\n", val); | ||
3741 | |||
3742 | return -EINVAL; | 3754 | return -EINVAL; |
3743 | } | 3755 | } |
3756 | |||
3744 | return 0; | 3757 | return 0; |
3745 | } | 3758 | } |
3746 | 3759 | ||
3747 | int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data, int txq) | 3760 | int qlcnic_setup_rings(struct qlcnic_adapter *adapter, u8 rx_cnt, u8 tx_cnt) |
3748 | { | 3761 | { |
3749 | int err; | ||
3750 | struct net_device *netdev = adapter->netdev; | 3762 | struct net_device *netdev = adapter->netdev; |
3751 | int num_msix; | 3763 | int err; |
3752 | 3764 | ||
3753 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) | 3765 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) |
3754 | return -EBUSY; | 3766 | return -EBUSY; |
3755 | 3767 | ||
3756 | if (qlcnic_82xx_check(adapter) && !qlcnic_use_msi_x && | ||
3757 | !qlcnic_use_msi) { | ||
3758 | netdev_err(netdev, "No RSS support in INT-x mode\n"); | ||
3759 | return -EINVAL; | ||
3760 | } | ||
3761 | |||
3762 | netif_device_detach(netdev); | 3768 | netif_device_detach(netdev); |
3763 | if (netif_running(netdev)) | 3769 | if (netif_running(netdev)) |
3764 | __qlcnic_down(adapter, netdev); | 3770 | __qlcnic_down(adapter, netdev); |
3765 | 3771 | ||
3766 | qlcnic_detach(adapter); | 3772 | qlcnic_detach(adapter); |
3767 | 3773 | ||
3768 | if (qlcnic_82xx_check(adapter)) { | ||
3769 | if (txq != 0) | ||
3770 | adapter->max_drv_tx_rings = txq; | ||
3771 | |||
3772 | if (qlcnic_check_multi_tx(adapter) && | ||
3773 | (txq > adapter->max_drv_tx_rings)) | ||
3774 | num_msix = adapter->max_drv_tx_rings; | ||
3775 | else | ||
3776 | num_msix = data; | ||
3777 | } | ||
3778 | |||
3779 | if (qlcnic_83xx_check(adapter)) { | 3774 | if (qlcnic_83xx_check(adapter)) { |
3780 | qlcnic_83xx_free_mbx_intr(adapter); | 3775 | qlcnic_83xx_free_mbx_intr(adapter); |
3781 | qlcnic_83xx_enable_mbx_poll(adapter); | 3776 | qlcnic_83xx_enable_mbx_poll(adapter); |
3782 | } | 3777 | } |
3783 | 3778 | ||
3784 | netif_set_real_num_tx_queues(netdev, adapter->max_drv_tx_rings); | ||
3785 | |||
3786 | qlcnic_teardown_intr(adapter); | 3779 | qlcnic_teardown_intr(adapter); |
3787 | 3780 | ||
3788 | err = qlcnic_setup_intr(adapter, data, txq); | 3781 | /* compute and set default and max tx/sds rings */ |
3782 | qlcnic_set_tx_ring_count(adapter, tx_cnt); | ||
3783 | qlcnic_set_sds_ring_count(adapter, rx_cnt); | ||
3784 | |||
3785 | netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings); | ||
3786 | |||
3787 | err = qlcnic_setup_intr(adapter); | ||
3789 | if (err) { | 3788 | if (err) { |
3790 | kfree(adapter->msix_entries); | 3789 | kfree(adapter->msix_entries); |
3791 | netdev_err(netdev, "failed to setup interrupt\n"); | 3790 | netdev_err(netdev, "failed to setup interrupt\n"); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 8b96e29df30f..21a4b274d2e4 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -508,7 +508,11 @@ static int qlcnic_sriov_setup_vf(struct qlcnic_adapter *adapter, | |||
508 | dev_warn(&adapter->pdev->dev, | 508 | dev_warn(&adapter->pdev->dev, |
509 | "Device does not support MSI interrupts\n"); | 509 | "Device does not support MSI interrupts\n"); |
510 | 510 | ||
511 | err = qlcnic_setup_intr(adapter, 1, 0); | 511 | /* compute and set default and max tx/sds rings */ |
512 | qlcnic_set_tx_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
513 | qlcnic_set_sds_ring_count(adapter, QLCNIC_SINGLE_RING); | ||
514 | |||
515 | err = qlcnic_setup_intr(adapter); | ||
512 | if (err) { | 516 | if (err) { |
513 | dev_err(&adapter->pdev->dev, "Failed to setup interrupt\n"); | 517 | dev_err(&adapter->pdev->dev, "Failed to setup interrupt\n"); |
514 | goto err_out_disable_msi; | 518 | goto err_out_disable_msi; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index e8b1ce64c33a..1a9f8a400e50 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -156,7 +156,7 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter, | |||
156 | const char *buf, size_t len) | 156 | const char *buf, size_t len) |
157 | { | 157 | { |
158 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 158 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
159 | int err, max_sds_rings = adapter->max_sds_rings; | 159 | int err, drv_sds_rings = adapter->drv_sds_rings; |
160 | u16 beacon; | 160 | u16 beacon; |
161 | u8 h_beacon_state, b_state, b_rate; | 161 | u8 h_beacon_state, b_state, b_rate; |
162 | 162 | ||
@@ -211,7 +211,7 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter, | |||
211 | } | 211 | } |
212 | 212 | ||
213 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) | 213 | if (test_and_clear_bit(__QLCNIC_DIAG_RES_ALLOC, &adapter->state)) |
214 | qlcnic_diag_free_res(adapter->netdev, max_sds_rings); | 214 | qlcnic_diag_free_res(adapter->netdev, drv_sds_rings); |
215 | 215 | ||
216 | out: | 216 | out: |
217 | if (!ahw->beacon_state) | 217 | if (!ahw->beacon_state) |