diff options
author | David S. Miller <davem@davemloft.net> | 2014-09-02 15:46:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-02 15:46:04 -0400 |
commit | 219c5361e625186c21f3e1bc7bc67cd7dac50ca9 (patch) | |
tree | d6607b00beef9aa8f24d90812b8aa9ea07d57d71 | |
parent | 364a9e93243d1785f310c0964af0e24bf1adac03 (diff) | |
parent | a28277dc65f4f7a58db899ab69acd8cf078b9039 (diff) |
Merge branch 'be2net-next'
Sathya Perla says:
====================
be2net: patch set
v2 changes: add a new line after variable declaration in patch 12.
***
Patch 1 adds a few new log messages to help debugging in failure cases.
Patch 2 uses new macros for parsing RX/TX completions and TX wrbs to
help shorten the lines.
Patch 3 adds a description for the RX counter rx_input_fifo_overflow_drop.
Patch 4 adds TX completion error statistics reporting via ethtool.
Patch 5 adds a dma_mapping_error counter and its reporting via ethtool.
Patch 6 fixes up log messages in the Lancer FW download path.
Patch 7 replaces gotos with direct return statements.
Patch 8 cleans up be_change_mtu() code by using a new macro BE_MAX_MTU
Patch 9 makes be_cmd_get_regs() routine to return an integer status
similar to other FW cmd routines in be_cmds.c
Patch 10 gets rid of TX budget as enforcing a budget on TX completion
processing in NAPI is neither suggested nor it provides a performance benefit.
Patch 11 defines and uses a new macro for_all_tx_queues_on_eq() similar
to the RX processing code.
Patch 12 queries max_tx_qs from the FW for BE3 super-nic profiles.
For those profiles, the driver cannot assume a constant BE3_MAX_TX_QS value,
as the value may change for each function.
Please consider applying this patch set to the net-next tree. Thanks!
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be.h | 28 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_cmds.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_ethtool.c | 35 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_hw.h | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 283 |
6 files changed, 233 insertions, 141 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 43e08d0bc3d3..a9f239adc3e3 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -86,6 +86,8 @@ static inline char *nic_name(struct pci_dev *pdev) | |||
86 | 86 | ||
87 | #define BE_MAX_JUMBO_FRAME_SIZE 9018 | 87 | #define BE_MAX_JUMBO_FRAME_SIZE 9018 |
88 | #define BE_MIN_MTU 256 | 88 | #define BE_MIN_MTU 256 |
89 | #define BE_MAX_MTU (BE_MAX_JUMBO_FRAME_SIZE - \ | ||
90 | (ETH_HLEN + ETH_FCS_LEN)) | ||
89 | 91 | ||
90 | #define BE_NUM_VLANS_SUPPORTED 64 | 92 | #define BE_NUM_VLANS_SUPPORTED 64 |
91 | #define BE_MAX_EQD 128u | 93 | #define BE_MAX_EQD 128u |
@@ -112,7 +114,6 @@ static inline char *nic_name(struct pci_dev *pdev) | |||
112 | #define MAX_ROCE_EQS 5 | 114 | #define MAX_ROCE_EQS 5 |
113 | #define MAX_MSIX_VECTORS 32 | 115 | #define MAX_MSIX_VECTORS 32 |
114 | #define MIN_MSIX_VECTORS 1 | 116 | #define MIN_MSIX_VECTORS 1 |
115 | #define BE_TX_BUDGET 256 | ||
116 | #define BE_NAPI_WEIGHT 64 | 117 | #define BE_NAPI_WEIGHT 64 |
117 | #define MAX_RX_POST BE_NAPI_WEIGHT /* Frags posted at a time */ | 118 | #define MAX_RX_POST BE_NAPI_WEIGHT /* Frags posted at a time */ |
118 | #define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST) | 119 | #define RX_FRAGS_REFILL_WM (RX_Q_LEN - MAX_RX_POST) |
@@ -198,7 +199,6 @@ struct be_eq_obj { | |||
198 | 199 | ||
199 | u8 idx; /* array index */ | 200 | u8 idx; /* array index */ |
200 | u8 msix_idx; | 201 | u8 msix_idx; |
201 | u16 tx_budget; | ||
202 | u16 spurious_intr; | 202 | u16 spurious_intr; |
203 | struct napi_struct napi; | 203 | struct napi_struct napi; |
204 | struct be_adapter *adapter; | 204 | struct be_adapter *adapter; |
@@ -248,6 +248,13 @@ struct be_tx_stats { | |||
248 | ulong tx_jiffies; | 248 | ulong tx_jiffies; |
249 | u32 tx_stops; | 249 | u32 tx_stops; |
250 | u32 tx_drv_drops; /* pkts dropped by driver */ | 250 | u32 tx_drv_drops; /* pkts dropped by driver */ |
251 | /* the error counters are described in be_ethtool.c */ | ||
252 | u32 tx_hdr_parse_err; | ||
253 | u32 tx_dma_err; | ||
254 | u32 tx_tso_err; | ||
255 | u32 tx_spoof_check_err; | ||
256 | u32 tx_qinq_err; | ||
257 | u32 tx_internal_parity_err; | ||
251 | struct u64_stats_sync sync; | 258 | struct u64_stats_sync sync; |
252 | struct u64_stats_sync sync_compl; | 259 | struct u64_stats_sync sync_compl; |
253 | }; | 260 | }; |
@@ -316,6 +323,7 @@ struct be_rx_obj { | |||
316 | struct be_drv_stats { | 323 | struct be_drv_stats { |
317 | u32 be_on_die_temperature; | 324 | u32 be_on_die_temperature; |
318 | u32 eth_red_drops; | 325 | u32 eth_red_drops; |
326 | u32 dma_map_errors; | ||
319 | u32 rx_drops_no_pbuf; | 327 | u32 rx_drops_no_pbuf; |
320 | u32 rx_drops_no_txpb; | 328 | u32 rx_drops_no_txpb; |
321 | u32 rx_drops_no_erx_descr; | 329 | u32 rx_drops_no_erx_descr; |
@@ -613,6 +621,10 @@ extern const struct ethtool_ops be_ethtool_ops; | |||
613 | for (i = eqo->idx, rxo = &adapter->rx_obj[i]; i < adapter->num_rx_qs;\ | 621 | for (i = eqo->idx, rxo = &adapter->rx_obj[i]; i < adapter->num_rx_qs;\ |
614 | i += adapter->num_evt_qs, rxo += adapter->num_evt_qs) | 622 | i += adapter->num_evt_qs, rxo += adapter->num_evt_qs) |
615 | 623 | ||
624 | #define for_all_tx_queues_on_eq(adapter, eqo, txo, i) \ | ||
625 | for (i = eqo->idx, txo = &adapter->tx_obj[i]; i < adapter->num_tx_qs;\ | ||
626 | i += adapter->num_evt_qs, txo += adapter->num_evt_qs) | ||
627 | |||
616 | #define is_mcc_eqo(eqo) (eqo->idx == 0) | 628 | #define is_mcc_eqo(eqo) (eqo->idx == 0) |
617 | #define mcc_eqo(adapter) (&adapter->eq_obj[0]) | 629 | #define mcc_eqo(adapter) (&adapter->eq_obj[0]) |
618 | 630 | ||
@@ -661,6 +673,18 @@ static inline u32 amap_get(void *ptr, u32 dw_offset, u32 mask, u32 offset) | |||
661 | amap_mask(sizeof(((_struct *)0)->field)), \ | 673 | amap_mask(sizeof(((_struct *)0)->field)), \ |
662 | AMAP_BIT_OFFSET(_struct, field)) | 674 | AMAP_BIT_OFFSET(_struct, field)) |
663 | 675 | ||
676 | #define GET_RX_COMPL_V0_BITS(field, ptr) \ | ||
677 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, field, ptr) | ||
678 | |||
679 | #define GET_RX_COMPL_V1_BITS(field, ptr) \ | ||
680 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, field, ptr) | ||
681 | |||
682 | #define GET_TX_COMPL_BITS(field, ptr) \ | ||
683 | AMAP_GET_BITS(struct amap_eth_tx_compl, field, ptr) | ||
684 | |||
685 | #define SET_TX_WRB_HDR_BITS(field, ptr, val) \ | ||
686 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, field, ptr, val) | ||
687 | |||
664 | #define be_dws_cpu_to_le(wrb, len) swap_dws(wrb, len) | 688 | #define be_dws_cpu_to_le(wrb, len) swap_dws(wrb, len) |
665 | #define be_dws_le_to_cpu(wrb, len) swap_dws(wrb, len) | 689 | #define be_dws_le_to_cpu(wrb, len) swap_dws(wrb, len) |
666 | static inline void swap_dws(void *wrb, int len) | 690 | static inline void swap_dws(void *wrb, int len) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 4370ec1952ac..5be100d1bc0a 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -1681,17 +1681,17 @@ err: | |||
1681 | return status; | 1681 | return status; |
1682 | } | 1682 | } |
1683 | 1683 | ||
1684 | void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | 1684 | int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) |
1685 | { | 1685 | { |
1686 | struct be_dma_mem get_fat_cmd; | 1686 | struct be_dma_mem get_fat_cmd; |
1687 | struct be_mcc_wrb *wrb; | 1687 | struct be_mcc_wrb *wrb; |
1688 | struct be_cmd_req_get_fat *req; | 1688 | struct be_cmd_req_get_fat *req; |
1689 | u32 offset = 0, total_size, buf_size, | 1689 | u32 offset = 0, total_size, buf_size, |
1690 | log_offset = sizeof(u32), payload_len; | 1690 | log_offset = sizeof(u32), payload_len; |
1691 | int status; | 1691 | int status = 0; |
1692 | 1692 | ||
1693 | if (buf_len == 0) | 1693 | if (buf_len == 0) |
1694 | return; | 1694 | return -EIO; |
1695 | 1695 | ||
1696 | total_size = buf_len; | 1696 | total_size = buf_len; |
1697 | 1697 | ||
@@ -1700,10 +1700,9 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | |||
1700 | get_fat_cmd.size, | 1700 | get_fat_cmd.size, |
1701 | &get_fat_cmd.dma); | 1701 | &get_fat_cmd.dma); |
1702 | if (!get_fat_cmd.va) { | 1702 | if (!get_fat_cmd.va) { |
1703 | status = -ENOMEM; | ||
1704 | dev_err(&adapter->pdev->dev, | 1703 | dev_err(&adapter->pdev->dev, |
1705 | "Memory allocation failure while retrieving FAT data\n"); | 1704 | "Memory allocation failure while retrieving FAT data\n"); |
1706 | return; | 1705 | return -ENOMEM; |
1707 | } | 1706 | } |
1708 | 1707 | ||
1709 | spin_lock_bh(&adapter->mcc_lock); | 1708 | spin_lock_bh(&adapter->mcc_lock); |
@@ -1746,6 +1745,7 @@ err: | |||
1746 | pci_free_consistent(adapter->pdev, get_fat_cmd.size, | 1745 | pci_free_consistent(adapter->pdev, get_fat_cmd.size, |
1747 | get_fat_cmd.va, get_fat_cmd.dma); | 1746 | get_fat_cmd.va, get_fat_cmd.dma); |
1748 | spin_unlock_bh(&adapter->mcc_lock); | 1747 | spin_unlock_bh(&adapter->mcc_lock); |
1748 | return status; | ||
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | /* Uses synchronous mcc */ | 1751 | /* Uses synchronous mcc */ |
@@ -1771,6 +1771,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter) | |||
1771 | status = be_mcc_notify_wait(adapter); | 1771 | status = be_mcc_notify_wait(adapter); |
1772 | if (!status) { | 1772 | if (!status) { |
1773 | struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb); | 1773 | struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb); |
1774 | |||
1774 | strcpy(adapter->fw_ver, resp->firmware_version_string); | 1775 | strcpy(adapter->fw_ver, resp->firmware_version_string); |
1775 | strcpy(adapter->fw_on_flash, resp->fw_on_flash_version_string); | 1776 | strcpy(adapter->fw_on_flash, resp->fw_on_flash_version_string); |
1776 | } | 1777 | } |
@@ -2018,6 +2019,9 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter) | |||
2018 | adapter->function_mode = le32_to_cpu(resp->function_mode); | 2019 | adapter->function_mode = le32_to_cpu(resp->function_mode); |
2019 | adapter->function_caps = le32_to_cpu(resp->function_caps); | 2020 | adapter->function_caps = le32_to_cpu(resp->function_caps); |
2020 | adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF; | 2021 | adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF; |
2022 | dev_info(&adapter->pdev->dev, | ||
2023 | "FW config: function_mode=0x%x, function_caps=0x%x\n", | ||
2024 | adapter->function_mode, adapter->function_caps); | ||
2021 | } | 2025 | } |
2022 | 2026 | ||
2023 | mutex_unlock(&adapter->mbox_lock); | 2027 | mutex_unlock(&adapter->mbox_lock); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 5284b825bba2..0e1186856aa6 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -2101,7 +2101,7 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter); | |||
2101 | int be_cmd_get_cntl_attributes(struct be_adapter *adapter); | 2101 | int be_cmd_get_cntl_attributes(struct be_adapter *adapter); |
2102 | int be_cmd_req_native_mode(struct be_adapter *adapter); | 2102 | int be_cmd_req_native_mode(struct be_adapter *adapter); |
2103 | int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size); | 2103 | int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size); |
2104 | void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf); | 2104 | int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf); |
2105 | int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, | 2105 | int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege, |
2106 | u32 domain); | 2106 | u32 domain); |
2107 | int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges, | 2107 | int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges, |
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c index 0cd3311409a8..2fd38261bedb 100644 --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | |||
@@ -78,6 +78,11 @@ static const struct be_ethtool_stat et_stats[] = { | |||
78 | * fifo must never overflow. | 78 | * fifo must never overflow. |
79 | */ | 79 | */ |
80 | {DRVSTAT_INFO(rxpp_fifo_overflow_drop)}, | 80 | {DRVSTAT_INFO(rxpp_fifo_overflow_drop)}, |
81 | /* Received packets dropped when the RX block runs out of space in | ||
82 | * one of its input FIFOs. This could happen due a long burst of | ||
83 | * minimum-sized (64b) frames in the receive path. | ||
84 | * This counter may also be erroneously incremented rarely. | ||
85 | */ | ||
81 | {DRVSTAT_INFO(rx_input_fifo_overflow_drop)}, | 86 | {DRVSTAT_INFO(rx_input_fifo_overflow_drop)}, |
82 | {DRVSTAT_INFO(rx_ip_checksum_errs)}, | 87 | {DRVSTAT_INFO(rx_ip_checksum_errs)}, |
83 | {DRVSTAT_INFO(rx_tcp_checksum_errs)}, | 88 | {DRVSTAT_INFO(rx_tcp_checksum_errs)}, |
@@ -114,6 +119,8 @@ static const struct be_ethtool_stat et_stats[] = { | |||
114 | * is more than 9018 bytes | 119 | * is more than 9018 bytes |
115 | */ | 120 | */ |
116 | {DRVSTAT_INFO(rx_drops_mtu)}, | 121 | {DRVSTAT_INFO(rx_drops_mtu)}, |
122 | /* Number of dma mapping errors */ | ||
123 | {DRVSTAT_INFO(dma_map_errors)}, | ||
117 | /* Number of packets dropped due to random early drop function */ | 124 | /* Number of packets dropped due to random early drop function */ |
118 | {DRVSTAT_INFO(eth_red_drops)}, | 125 | {DRVSTAT_INFO(eth_red_drops)}, |
119 | {DRVSTAT_INFO(be_on_die_temperature)}, | 126 | {DRVSTAT_INFO(be_on_die_temperature)}, |
@@ -152,6 +159,34 @@ static const struct be_ethtool_stat et_rx_stats[] = { | |||
152 | */ | 159 | */ |
153 | static const struct be_ethtool_stat et_tx_stats[] = { | 160 | static const struct be_ethtool_stat et_tx_stats[] = { |
154 | {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */ | 161 | {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */ |
162 | /* This counter is incremented when the HW encounters an error while | ||
163 | * parsing the packet header of an outgoing TX request. This counter is | ||
164 | * applicable only for BE2, BE3 and Skyhawk based adapters. | ||
165 | */ | ||
166 | {DRVSTAT_TX_INFO(tx_hdr_parse_err)}, | ||
167 | /* This counter is incremented when an error occurs in the DMA | ||
168 | * operation associated with the TX request from the host to the device. | ||
169 | */ | ||
170 | {DRVSTAT_TX_INFO(tx_dma_err)}, | ||
171 | /* This counter is incremented when MAC or VLAN spoof checking is | ||
172 | * enabled on the interface and the TX request fails the spoof check | ||
173 | * in HW. | ||
174 | */ | ||
175 | {DRVSTAT_TX_INFO(tx_spoof_check_err)}, | ||
176 | /* This counter is incremented when the HW encounters an error while | ||
177 | * performing TSO offload. This counter is applicable only for Lancer | ||
178 | * adapters. | ||
179 | */ | ||
180 | {DRVSTAT_TX_INFO(tx_tso_err)}, | ||
181 | /* This counter is incremented when the HW detects Q-in-Q style VLAN | ||
182 | * tagging in a packet and such tagging is not expected on the outgoing | ||
183 | * interface. This counter is applicable only for Lancer adapters. | ||
184 | */ | ||
185 | {DRVSTAT_TX_INFO(tx_qinq_err)}, | ||
186 | /* This counter is incremented when the HW detects parity errors in the | ||
187 | * packet data. This counter is applicable only for Lancer adapters. | ||
188 | */ | ||
189 | {DRVSTAT_TX_INFO(tx_internal_parity_err)}, | ||
155 | {DRVSTAT_TX_INFO(tx_bytes)}, | 190 | {DRVSTAT_TX_INFO(tx_bytes)}, |
156 | {DRVSTAT_TX_INFO(tx_pkts)}, | 191 | {DRVSTAT_TX_INFO(tx_pkts)}, |
157 | /* Number of skbs queued for trasmission by the driver */ | 192 | /* Number of skbs queued for trasmission by the driver */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 8840c64aaeca..295ee0835ba0 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -315,6 +315,18 @@ struct be_eth_hdr_wrb { | |||
315 | u32 dw[4]; | 315 | u32 dw[4]; |
316 | }; | 316 | }; |
317 | 317 | ||
318 | /********* Tx Compl Status Encoding *********/ | ||
319 | #define BE_TX_COMP_HDR_PARSE_ERR 0x2 | ||
320 | #define BE_TX_COMP_NDMA_ERR 0x3 | ||
321 | #define BE_TX_COMP_ACL_ERR 0x5 | ||
322 | |||
323 | #define LANCER_TX_COMP_LSO_ERR 0x1 | ||
324 | #define LANCER_TX_COMP_HSW_DROP_MAC_ERR 0x3 | ||
325 | #define LANCER_TX_COMP_HSW_DROP_VLAN_ERR 0x5 | ||
326 | #define LANCER_TX_COMP_QINQ_ERR 0x7 | ||
327 | #define LANCER_TX_COMP_PARITY_ERR 0xb | ||
328 | #define LANCER_TX_COMP_DMA_ERR 0xd | ||
329 | |||
318 | /* TX Compl Queue Descriptor */ | 330 | /* TX Compl Queue Descriptor */ |
319 | 331 | ||
320 | /* Pseudo amap definition for eth_tx_compl in which each bit of the | 332 | /* Pseudo amap definition for eth_tx_compl in which each bit of the |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 435d060f630b..5b26c4c9ab2b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -738,38 +738,37 @@ static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr, | |||
738 | 738 | ||
739 | memset(hdr, 0, sizeof(*hdr)); | 739 | memset(hdr, 0, sizeof(*hdr)); |
740 | 740 | ||
741 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, crc, hdr, 1); | 741 | SET_TX_WRB_HDR_BITS(crc, hdr, 1); |
742 | 742 | ||
743 | if (skb_is_gso(skb)) { | 743 | if (skb_is_gso(skb)) { |
744 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, lso, hdr, 1); | 744 | SET_TX_WRB_HDR_BITS(lso, hdr, 1); |
745 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, lso_mss, | 745 | SET_TX_WRB_HDR_BITS(lso_mss, hdr, skb_shinfo(skb)->gso_size); |
746 | hdr, skb_shinfo(skb)->gso_size); | ||
747 | if (skb_is_gso_v6(skb) && !lancer_chip(adapter)) | 746 | if (skb_is_gso_v6(skb) && !lancer_chip(adapter)) |
748 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, lso6, hdr, 1); | 747 | SET_TX_WRB_HDR_BITS(lso6, hdr, 1); |
749 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 748 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
750 | if (skb->encapsulation) { | 749 | if (skb->encapsulation) { |
751 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, ipcs, hdr, 1); | 750 | SET_TX_WRB_HDR_BITS(ipcs, hdr, 1); |
752 | proto = skb_inner_ip_proto(skb); | 751 | proto = skb_inner_ip_proto(skb); |
753 | } else { | 752 | } else { |
754 | proto = skb_ip_proto(skb); | 753 | proto = skb_ip_proto(skb); |
755 | } | 754 | } |
756 | if (proto == IPPROTO_TCP) | 755 | if (proto == IPPROTO_TCP) |
757 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, tcpcs, hdr, 1); | 756 | SET_TX_WRB_HDR_BITS(tcpcs, hdr, 1); |
758 | else if (proto == IPPROTO_UDP) | 757 | else if (proto == IPPROTO_UDP) |
759 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, udpcs, hdr, 1); | 758 | SET_TX_WRB_HDR_BITS(udpcs, hdr, 1); |
760 | } | 759 | } |
761 | 760 | ||
762 | if (vlan_tx_tag_present(skb)) { | 761 | if (vlan_tx_tag_present(skb)) { |
763 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan, hdr, 1); | 762 | SET_TX_WRB_HDR_BITS(vlan, hdr, 1); |
764 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); | 763 | vlan_tag = be_get_tx_vlan_tag(adapter, skb); |
765 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, vlan_tag, hdr, vlan_tag); | 764 | SET_TX_WRB_HDR_BITS(vlan_tag, hdr, vlan_tag); |
766 | } | 765 | } |
767 | 766 | ||
768 | /* To skip HW VLAN tagging: evt = 1, compl = 0 */ | 767 | /* To skip HW VLAN tagging: evt = 1, compl = 0 */ |
769 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, complete, hdr, !skip_hw_vlan); | 768 | SET_TX_WRB_HDR_BITS(complete, hdr, !skip_hw_vlan); |
770 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, event, hdr, 1); | 769 | SET_TX_WRB_HDR_BITS(event, hdr, 1); |
771 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, num_wrb, hdr, wrb_cnt); | 770 | SET_TX_WRB_HDR_BITS(num_wrb, hdr, wrb_cnt); |
772 | AMAP_SET_BITS(struct amap_eth_hdr_wrb, len, hdr, len); | 771 | SET_TX_WRB_HDR_BITS(len, hdr, len); |
773 | } | 772 | } |
774 | 773 | ||
775 | static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, | 774 | static void unmap_tx_frag(struct device *dev, struct be_eth_wrb *wrb, |
@@ -850,6 +849,7 @@ dma_err: | |||
850 | unmap_tx_frag(dev, wrb, map_single); | 849 | unmap_tx_frag(dev, wrb, map_single); |
851 | map_single = false; | 850 | map_single = false; |
852 | copied -= wrb->frag_len; | 851 | copied -= wrb->frag_len; |
852 | adapter->drv_stats.dma_map_errors++; | ||
853 | queue_head_inc(txq); | 853 | queue_head_inc(txq); |
854 | } | 854 | } |
855 | return 0; | 855 | return 0; |
@@ -1073,15 +1073,15 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
1073 | static int be_change_mtu(struct net_device *netdev, int new_mtu) | 1073 | static int be_change_mtu(struct net_device *netdev, int new_mtu) |
1074 | { | 1074 | { |
1075 | struct be_adapter *adapter = netdev_priv(netdev); | 1075 | struct be_adapter *adapter = netdev_priv(netdev); |
1076 | if (new_mtu < BE_MIN_MTU || | 1076 | struct device *dev = &adapter->pdev->dev; |
1077 | new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))) { | 1077 | |
1078 | dev_info(&adapter->pdev->dev, | 1078 | if (new_mtu < BE_MIN_MTU || new_mtu > BE_MAX_MTU) { |
1079 | "MTU must be between %d and %d bytes\n", | 1079 | dev_info(dev, "MTU must be between %d and %d bytes\n", |
1080 | BE_MIN_MTU, | 1080 | BE_MIN_MTU, BE_MAX_MTU); |
1081 | (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))); | ||
1082 | return -EINVAL; | 1081 | return -EINVAL; |
1083 | } | 1082 | } |
1084 | dev_info(&adapter->pdev->dev, "MTU changed from %d to %d bytes\n", | 1083 | |
1084 | dev_info(dev, "MTU changed from %d to %d bytes\n", | ||
1085 | netdev->mtu, new_mtu); | 1085 | netdev->mtu, new_mtu); |
1086 | netdev->mtu = new_mtu; | 1086 | netdev->mtu = new_mtu; |
1087 | return 0; | 1087 | return 0; |
@@ -1753,65 +1753,46 @@ static void be_rx_compl_process_gro(struct be_rx_obj *rxo, | |||
1753 | static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl, | 1753 | static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl, |
1754 | struct be_rx_compl_info *rxcp) | 1754 | struct be_rx_compl_info *rxcp) |
1755 | { | 1755 | { |
1756 | rxcp->pkt_size = | 1756 | rxcp->pkt_size = GET_RX_COMPL_V1_BITS(pktsize, compl); |
1757 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, pktsize, compl); | 1757 | rxcp->vlanf = GET_RX_COMPL_V1_BITS(vtp, compl); |
1758 | rxcp->vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtp, compl); | 1758 | rxcp->err = GET_RX_COMPL_V1_BITS(err, compl); |
1759 | rxcp->err = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, err, compl); | 1759 | rxcp->tcpf = GET_RX_COMPL_V1_BITS(tcpf, compl); |
1760 | rxcp->tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, tcpf, compl); | 1760 | rxcp->udpf = GET_RX_COMPL_V1_BITS(udpf, compl); |
1761 | rxcp->udpf = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, udpf, compl); | 1761 | rxcp->ip_csum = GET_RX_COMPL_V1_BITS(ipcksm, compl); |
1762 | rxcp->ip_csum = | 1762 | rxcp->l4_csum = GET_RX_COMPL_V1_BITS(l4_cksm, compl); |
1763 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, ipcksm, compl); | 1763 | rxcp->ipv6 = GET_RX_COMPL_V1_BITS(ip_version, compl); |
1764 | rxcp->l4_csum = | 1764 | rxcp->num_rcvd = GET_RX_COMPL_V1_BITS(numfrags, compl); |
1765 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, l4_cksm, compl); | 1765 | rxcp->pkt_type = GET_RX_COMPL_V1_BITS(cast_enc, compl); |
1766 | rxcp->ipv6 = | 1766 | rxcp->rss_hash = GET_RX_COMPL_V1_BITS(rsshash, compl); |
1767 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, ip_version, compl); | ||
1768 | rxcp->num_rcvd = | ||
1769 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, numfrags, compl); | ||
1770 | rxcp->pkt_type = | ||
1771 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl); | ||
1772 | rxcp->rss_hash = | ||
1773 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, rsshash, compl); | ||
1774 | if (rxcp->vlanf) { | 1767 | if (rxcp->vlanf) { |
1775 | rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq, | 1768 | rxcp->qnq = GET_RX_COMPL_V1_BITS(qnq, compl); |
1776 | compl); | 1769 | rxcp->vlan_tag = GET_RX_COMPL_V1_BITS(vlan_tag, compl); |
1777 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, | ||
1778 | vlan_tag, compl); | ||
1779 | } | 1770 | } |
1780 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl); | 1771 | rxcp->port = GET_RX_COMPL_V1_BITS(port, compl); |
1781 | rxcp->tunneled = | 1772 | rxcp->tunneled = |
1782 | AMAP_GET_BITS(struct amap_eth_rx_compl_v1, tunneled, compl); | 1773 | GET_RX_COMPL_V1_BITS(tunneled, compl); |
1783 | } | 1774 | } |
1784 | 1775 | ||
1785 | static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl, | 1776 | static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl, |
1786 | struct be_rx_compl_info *rxcp) | 1777 | struct be_rx_compl_info *rxcp) |
1787 | { | 1778 | { |
1788 | rxcp->pkt_size = | 1779 | rxcp->pkt_size = GET_RX_COMPL_V0_BITS(pktsize, compl); |
1789 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, pktsize, compl); | 1780 | rxcp->vlanf = GET_RX_COMPL_V0_BITS(vtp, compl); |
1790 | rxcp->vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtp, compl); | 1781 | rxcp->err = GET_RX_COMPL_V0_BITS(err, compl); |
1791 | rxcp->err = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, err, compl); | 1782 | rxcp->tcpf = GET_RX_COMPL_V0_BITS(tcpf, compl); |
1792 | rxcp->tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, tcpf, compl); | 1783 | rxcp->udpf = GET_RX_COMPL_V0_BITS(udpf, compl); |
1793 | rxcp->udpf = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, udpf, compl); | 1784 | rxcp->ip_csum = GET_RX_COMPL_V0_BITS(ipcksm, compl); |
1794 | rxcp->ip_csum = | 1785 | rxcp->l4_csum = GET_RX_COMPL_V0_BITS(l4_cksm, compl); |
1795 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, ipcksm, compl); | 1786 | rxcp->ipv6 = GET_RX_COMPL_V0_BITS(ip_version, compl); |
1796 | rxcp->l4_csum = | 1787 | rxcp->num_rcvd = GET_RX_COMPL_V0_BITS(numfrags, compl); |
1797 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, l4_cksm, compl); | 1788 | rxcp->pkt_type = GET_RX_COMPL_V0_BITS(cast_enc, compl); |
1798 | rxcp->ipv6 = | 1789 | rxcp->rss_hash = GET_RX_COMPL_V0_BITS(rsshash, compl); |
1799 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, ip_version, compl); | ||
1800 | rxcp->num_rcvd = | ||
1801 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, numfrags, compl); | ||
1802 | rxcp->pkt_type = | ||
1803 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl); | ||
1804 | rxcp->rss_hash = | ||
1805 | AMAP_GET_BITS(struct amap_eth_rx_compl_v0, rsshash, compl); | ||
1806 | if (rxcp->vlanf) { | 1790 | if (rxcp->vlanf) { |
1807 | rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq, | 1791 | rxcp->qnq = GET_RX_COMPL_V0_BITS(qnq, compl); |
1808 | compl); | 1792 | rxcp->vlan_tag = GET_RX_COMPL_V0_BITS(vlan_tag, compl); |
1809 | rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, | ||
1810 | vlan_tag, compl); | ||
1811 | } | 1793 | } |
1812 | rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); | 1794 | rxcp->port = GET_RX_COMPL_V0_BITS(port, compl); |
1813 | rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, | 1795 | rxcp->ip_frag = GET_RX_COMPL_V0_BITS(ip_frag, compl); |
1814 | ip_frag, compl); | ||
1815 | } | 1796 | } |
1816 | 1797 | ||
1817 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) | 1798 | static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) |
@@ -1897,7 +1878,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) | |||
1897 | if (dma_mapping_error(dev, page_dmaaddr)) { | 1878 | if (dma_mapping_error(dev, page_dmaaddr)) { |
1898 | put_page(pagep); | 1879 | put_page(pagep); |
1899 | pagep = NULL; | 1880 | pagep = NULL; |
1900 | rx_stats(rxo)->rx_post_fail++; | 1881 | adapter->drv_stats.dma_map_errors++; |
1901 | break; | 1882 | break; |
1902 | } | 1883 | } |
1903 | page_offset = 0; | 1884 | page_offset = 0; |
@@ -2091,9 +2072,7 @@ static void be_tx_compl_clean(struct be_adapter *adapter) | |||
2091 | num_wrbs = 0; | 2072 | num_wrbs = 0; |
2092 | txq = &txo->q; | 2073 | txq = &txo->q; |
2093 | while ((txcp = be_tx_compl_get(&txo->cq))) { | 2074 | while ((txcp = be_tx_compl_get(&txo->cq))) { |
2094 | end_idx = | 2075 | end_idx = GET_TX_COMPL_BITS(wrb_index, txcp); |
2095 | AMAP_GET_BITS(struct amap_eth_tx_compl, | ||
2096 | wrb_index, txcp); | ||
2097 | num_wrbs += be_tx_compl_process(adapter, txo, | 2076 | num_wrbs += be_tx_compl_process(adapter, txo, |
2098 | end_idx); | 2077 | end_idx); |
2099 | cmpl++; | 2078 | cmpl++; |
@@ -2164,7 +2143,6 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
2164 | napi_hash_add(&eqo->napi); | 2143 | napi_hash_add(&eqo->napi); |
2165 | aic = &adapter->aic_obj[i]; | 2144 | aic = &adapter->aic_obj[i]; |
2166 | eqo->adapter = adapter; | 2145 | eqo->adapter = adapter; |
2167 | eqo->tx_budget = BE_TX_BUDGET; | ||
2168 | eqo->idx = i; | 2146 | eqo->idx = i; |
2169 | aic->max_eqd = BE_MAX_EQD; | 2147 | aic->max_eqd = BE_MAX_EQD; |
2170 | aic->enable = true; | 2148 | aic->enable = true; |
@@ -2443,20 +2421,63 @@ loop_continue: | |||
2443 | return work_done; | 2421 | return work_done; |
2444 | } | 2422 | } |
2445 | 2423 | ||
2446 | static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo, | 2424 | static inline void be_update_tx_err(struct be_tx_obj *txo, u32 status) |
2447 | int budget, int idx) | 2425 | { |
2426 | switch (status) { | ||
2427 | case BE_TX_COMP_HDR_PARSE_ERR: | ||
2428 | tx_stats(txo)->tx_hdr_parse_err++; | ||
2429 | break; | ||
2430 | case BE_TX_COMP_NDMA_ERR: | ||
2431 | tx_stats(txo)->tx_dma_err++; | ||
2432 | break; | ||
2433 | case BE_TX_COMP_ACL_ERR: | ||
2434 | tx_stats(txo)->tx_spoof_check_err++; | ||
2435 | break; | ||
2436 | } | ||
2437 | } | ||
2438 | |||
2439 | static inline void lancer_update_tx_err(struct be_tx_obj *txo, u32 status) | ||
2440 | { | ||
2441 | switch (status) { | ||
2442 | case LANCER_TX_COMP_LSO_ERR: | ||
2443 | tx_stats(txo)->tx_tso_err++; | ||
2444 | break; | ||
2445 | case LANCER_TX_COMP_HSW_DROP_MAC_ERR: | ||
2446 | case LANCER_TX_COMP_HSW_DROP_VLAN_ERR: | ||
2447 | tx_stats(txo)->tx_spoof_check_err++; | ||
2448 | break; | ||
2449 | case LANCER_TX_COMP_QINQ_ERR: | ||
2450 | tx_stats(txo)->tx_qinq_err++; | ||
2451 | break; | ||
2452 | case LANCER_TX_COMP_PARITY_ERR: | ||
2453 | tx_stats(txo)->tx_internal_parity_err++; | ||
2454 | break; | ||
2455 | case LANCER_TX_COMP_DMA_ERR: | ||
2456 | tx_stats(txo)->tx_dma_err++; | ||
2457 | break; | ||
2458 | } | ||
2459 | } | ||
2460 | |||
2461 | static void be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo, | ||
2462 | int idx) | ||
2448 | { | 2463 | { |
2449 | struct be_eth_tx_compl *txcp; | 2464 | struct be_eth_tx_compl *txcp; |
2450 | int num_wrbs = 0, work_done; | 2465 | int num_wrbs = 0, work_done = 0; |
2466 | u32 compl_status; | ||
2467 | u16 last_idx; | ||
2451 | 2468 | ||
2452 | for (work_done = 0; work_done < budget; work_done++) { | 2469 | while ((txcp = be_tx_compl_get(&txo->cq))) { |
2453 | txcp = be_tx_compl_get(&txo->cq); | 2470 | last_idx = GET_TX_COMPL_BITS(wrb_index, txcp); |
2454 | if (!txcp) | 2471 | num_wrbs += be_tx_compl_process(adapter, txo, last_idx); |
2455 | break; | 2472 | work_done++; |
2456 | num_wrbs += be_tx_compl_process(adapter, txo, | 2473 | |
2457 | AMAP_GET_BITS(struct | 2474 | compl_status = GET_TX_COMPL_BITS(status, txcp); |
2458 | amap_eth_tx_compl, | 2475 | if (compl_status) { |
2459 | wrb_index, txcp)); | 2476 | if (lancer_chip(adapter)) |
2477 | lancer_update_tx_err(txo, compl_status); | ||
2478 | else | ||
2479 | be_update_tx_err(txo, compl_status); | ||
2480 | } | ||
2460 | } | 2481 | } |
2461 | 2482 | ||
2462 | if (work_done) { | 2483 | if (work_done) { |
@@ -2474,7 +2495,6 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo, | |||
2474 | tx_stats(txo)->tx_compl += work_done; | 2495 | tx_stats(txo)->tx_compl += work_done; |
2475 | u64_stats_update_end(&tx_stats(txo)->sync_compl); | 2496 | u64_stats_update_end(&tx_stats(txo)->sync_compl); |
2476 | } | 2497 | } |
2477 | return (work_done < budget); /* Done */ | ||
2478 | } | 2498 | } |
2479 | 2499 | ||
2480 | int be_poll(struct napi_struct *napi, int budget) | 2500 | int be_poll(struct napi_struct *napi, int budget) |
@@ -2483,17 +2503,12 @@ int be_poll(struct napi_struct *napi, int budget) | |||
2483 | struct be_adapter *adapter = eqo->adapter; | 2503 | struct be_adapter *adapter = eqo->adapter; |
2484 | int max_work = 0, work, i, num_evts; | 2504 | int max_work = 0, work, i, num_evts; |
2485 | struct be_rx_obj *rxo; | 2505 | struct be_rx_obj *rxo; |
2486 | bool tx_done; | 2506 | struct be_tx_obj *txo; |
2487 | 2507 | ||
2488 | num_evts = events_get(eqo); | 2508 | num_evts = events_get(eqo); |
2489 | 2509 | ||
2490 | /* Process all TXQs serviced by this EQ */ | 2510 | for_all_tx_queues_on_eq(adapter, eqo, txo, i) |
2491 | for (i = eqo->idx; i < adapter->num_tx_qs; i += adapter->num_evt_qs) { | 2511 | be_process_tx(adapter, txo, i); |
2492 | tx_done = be_process_tx(adapter, &adapter->tx_obj[i], | ||
2493 | eqo->tx_budget, i); | ||
2494 | if (!tx_done) | ||
2495 | max_work = budget; | ||
2496 | } | ||
2497 | 2512 | ||
2498 | if (be_lock_napi(eqo)) { | 2513 | if (be_lock_napi(eqo)) { |
2499 | /* This loop will iterate twice for EQ0 in which | 2514 | /* This loop will iterate twice for EQ0 in which |
@@ -3309,10 +3324,20 @@ static void BEx_get_resources(struct be_adapter *adapter, | |||
3309 | */ | 3324 | */ |
3310 | if (BE2_chip(adapter) || use_sriov || (adapter->port_num > 1) || | 3325 | if (BE2_chip(adapter) || use_sriov || (adapter->port_num > 1) || |
3311 | !be_physfn(adapter) || (be_is_mc(adapter) && | 3326 | !be_physfn(adapter) || (be_is_mc(adapter) && |
3312 | !(adapter->function_caps & BE_FUNCTION_CAPS_RSS))) | 3327 | !(adapter->function_caps & BE_FUNCTION_CAPS_RSS))) { |
3313 | res->max_tx_qs = 1; | 3328 | res->max_tx_qs = 1; |
3314 | else | 3329 | } else if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { |
3330 | struct be_resources super_nic_res = {0}; | ||
3331 | |||
3332 | /* On a SuperNIC profile, the driver needs to use the | ||
3333 | * GET_PROFILE_CONFIG cmd to query the per-function TXQ limits | ||
3334 | */ | ||
3335 | be_cmd_get_profile_config(adapter, &super_nic_res, 0); | ||
3336 | /* Some old versions of BE3 FW don't report max_tx_qs value */ | ||
3337 | res->max_tx_qs = super_nic_res.max_tx_qs ? : BE3_MAX_TX_QS; | ||
3338 | } else { | ||
3315 | res->max_tx_qs = BE3_MAX_TX_QS; | 3339 | res->max_tx_qs = BE3_MAX_TX_QS; |
3340 | } | ||
3316 | 3341 | ||
3317 | if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) && | 3342 | if ((adapter->function_caps & BE_FUNCTION_CAPS_RSS) && |
3318 | !use_sriov && be_physfn(adapter)) | 3343 | !use_sriov && be_physfn(adapter)) |
@@ -3413,16 +3438,16 @@ static int be_get_resources(struct be_adapter *adapter) | |||
3413 | if (be_roce_supported(adapter)) | 3438 | if (be_roce_supported(adapter)) |
3414 | res.max_evt_qs /= 2; | 3439 | res.max_evt_qs /= 2; |
3415 | adapter->res = res; | 3440 | adapter->res = res; |
3416 | |||
3417 | dev_info(dev, "Max: txqs %d, rxqs %d, rss %d, eqs %d, vfs %d\n", | ||
3418 | be_max_txqs(adapter), be_max_rxqs(adapter), | ||
3419 | be_max_rss(adapter), be_max_eqs(adapter), | ||
3420 | be_max_vfs(adapter)); | ||
3421 | dev_info(dev, "Max: uc-macs %d, mc-macs %d, vlans %d\n", | ||
3422 | be_max_uc(adapter), be_max_mc(adapter), | ||
3423 | be_max_vlans(adapter)); | ||
3424 | } | 3441 | } |
3425 | 3442 | ||
3443 | dev_info(dev, "Max: txqs %d, rxqs %d, rss %d, eqs %d, vfs %d\n", | ||
3444 | be_max_txqs(adapter), be_max_rxqs(adapter), | ||
3445 | be_max_rss(adapter), be_max_eqs(adapter), | ||
3446 | be_max_vfs(adapter)); | ||
3447 | dev_info(dev, "Max: uc-macs %d, mc-macs %d, vlans %d\n", | ||
3448 | be_max_uc(adapter), be_max_mc(adapter), | ||
3449 | be_max_vlans(adapter)); | ||
3450 | |||
3426 | return 0; | 3451 | return 0; |
3427 | } | 3452 | } |
3428 | 3453 | ||
@@ -3633,6 +3658,7 @@ static int be_setup(struct be_adapter *adapter) | |||
3633 | goto err; | 3658 | goto err; |
3634 | 3659 | ||
3635 | be_cmd_get_fw_ver(adapter); | 3660 | be_cmd_get_fw_ver(adapter); |
3661 | dev_info(dev, "FW version is %s\n", adapter->fw_ver); | ||
3636 | 3662 | ||
3637 | if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) { | 3663 | if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) { |
3638 | dev_err(dev, "Firmware on card is old(%s), IRQs may not work.", | 3664 | dev_err(dev, "Firmware on card is old(%s), IRQs may not work.", |
@@ -4052,6 +4078,7 @@ static int lancer_fw_download(struct be_adapter *adapter, | |||
4052 | { | 4078 | { |
4053 | #define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024) | 4079 | #define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024) |
4054 | #define LANCER_FW_DOWNLOAD_LOCATION "/prg" | 4080 | #define LANCER_FW_DOWNLOAD_LOCATION "/prg" |
4081 | struct device *dev = &adapter->pdev->dev; | ||
4055 | struct be_dma_mem flash_cmd; | 4082 | struct be_dma_mem flash_cmd; |
4056 | const u8 *data_ptr = NULL; | 4083 | const u8 *data_ptr = NULL; |
4057 | u8 *dest_image_ptr = NULL; | 4084 | u8 *dest_image_ptr = NULL; |
@@ -4064,21 +4091,16 @@ static int lancer_fw_download(struct be_adapter *adapter, | |||
4064 | u8 change_status; | 4091 | u8 change_status; |
4065 | 4092 | ||
4066 | if (!IS_ALIGNED(fw->size, sizeof(u32))) { | 4093 | if (!IS_ALIGNED(fw->size, sizeof(u32))) { |
4067 | dev_err(&adapter->pdev->dev, | 4094 | dev_err(dev, "FW image size should be multiple of 4\n"); |
4068 | "FW Image not properly aligned. " | 4095 | return -EINVAL; |
4069 | "Length must be 4 byte aligned.\n"); | ||
4070 | status = -EINVAL; | ||
4071 | goto lancer_fw_exit; | ||
4072 | } | 4096 | } |
4073 | 4097 | ||
4074 | flash_cmd.size = sizeof(struct lancer_cmd_req_write_object) | 4098 | flash_cmd.size = sizeof(struct lancer_cmd_req_write_object) |
4075 | + LANCER_FW_DOWNLOAD_CHUNK; | 4099 | + LANCER_FW_DOWNLOAD_CHUNK; |
4076 | flash_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, flash_cmd.size, | 4100 | flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, |
4077 | &flash_cmd.dma, GFP_KERNEL); | 4101 | &flash_cmd.dma, GFP_KERNEL); |
4078 | if (!flash_cmd.va) { | 4102 | if (!flash_cmd.va) |
4079 | status = -ENOMEM; | 4103 | return -ENOMEM; |
4080 | goto lancer_fw_exit; | ||
4081 | } | ||
4082 | 4104 | ||
4083 | dest_image_ptr = flash_cmd.va + | 4105 | dest_image_ptr = flash_cmd.va + |
4084 | sizeof(struct lancer_cmd_req_write_object); | 4106 | sizeof(struct lancer_cmd_req_write_object); |
@@ -4113,35 +4135,27 @@ static int lancer_fw_download(struct be_adapter *adapter, | |||
4113 | &add_status); | 4135 | &add_status); |
4114 | } | 4136 | } |
4115 | 4137 | ||
4116 | dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va, | 4138 | dma_free_coherent(dev, flash_cmd.size, flash_cmd.va, flash_cmd.dma); |
4117 | flash_cmd.dma); | ||
4118 | if (status) { | 4139 | if (status) { |
4119 | dev_err(&adapter->pdev->dev, | 4140 | dev_err(dev, "Firmware load error\n"); |
4120 | "Firmware load error. " | 4141 | return be_cmd_status(status); |
4121 | "Status code: 0x%x Additional Status: 0x%x\n", | ||
4122 | status, add_status); | ||
4123 | goto lancer_fw_exit; | ||
4124 | } | 4142 | } |
4125 | 4143 | ||
4144 | dev_info(dev, "Firmware flashed successfully\n"); | ||
4145 | |||
4126 | if (change_status == LANCER_FW_RESET_NEEDED) { | 4146 | if (change_status == LANCER_FW_RESET_NEEDED) { |
4127 | dev_info(&adapter->pdev->dev, | 4147 | dev_info(dev, "Resetting adapter to activate new FW\n"); |
4128 | "Resetting adapter to activate new FW\n"); | ||
4129 | status = lancer_physdev_ctrl(adapter, | 4148 | status = lancer_physdev_ctrl(adapter, |
4130 | PHYSDEV_CONTROL_FW_RESET_MASK); | 4149 | PHYSDEV_CONTROL_FW_RESET_MASK); |
4131 | if (status) { | 4150 | if (status) { |
4132 | dev_err(&adapter->pdev->dev, | 4151 | dev_err(dev, "Adapter busy, could not reset FW\n"); |
4133 | "Adapter busy for FW reset.\n" | 4152 | dev_err(dev, "Reboot server to activate new FW\n"); |
4134 | "New FW will not be active.\n"); | ||
4135 | goto lancer_fw_exit; | ||
4136 | } | 4153 | } |
4137 | } else if (change_status != LANCER_NO_RESET_NEEDED) { | 4154 | } else if (change_status != LANCER_NO_RESET_NEEDED) { |
4138 | dev_err(&adapter->pdev->dev, | 4155 | dev_info(dev, "Reboot server to activate new FW\n"); |
4139 | "System reboot required for new FW to be active\n"); | ||
4140 | } | 4156 | } |
4141 | 4157 | ||
4142 | dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n"); | 4158 | return 0; |
4143 | lancer_fw_exit: | ||
4144 | return status; | ||
4145 | } | 4159 | } |
4146 | 4160 | ||
4147 | #define UFI_TYPE2 2 | 4161 | #define UFI_TYPE2 2 |
@@ -4506,6 +4520,7 @@ static int be_map_pci_bars(struct be_adapter *adapter) | |||
4506 | return 0; | 4520 | return 0; |
4507 | 4521 | ||
4508 | pci_map_err: | 4522 | pci_map_err: |
4523 | dev_err(&adapter->pdev->dev, "Error in mapping PCI BARs\n"); | ||
4509 | be_unmap_pci_bars(adapter); | 4524 | be_unmap_pci_bars(adapter); |
4510 | return -ENOMEM; | 4525 | return -ENOMEM; |
4511 | } | 4526 | } |
@@ -4822,6 +4837,8 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) | |||
4822 | struct net_device *netdev; | 4837 | struct net_device *netdev; |
4823 | char port_name; | 4838 | char port_name; |
4824 | 4839 | ||
4840 | dev_info(&pdev->dev, "%s version is %s\n", DRV_NAME, DRV_VER); | ||
4841 | |||
4825 | status = pci_enable_device(pdev); | 4842 | status = pci_enable_device(pdev); |
4826 | if (status) | 4843 | if (status) |
4827 | goto do_none; | 4844 | goto do_none; |