mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
Merge branch 'hns3-next'
Huazhong Tan says: ==================== code optimizations & bugfixes for HNS3 driver This patch-set includes code optimizations and bugfixes for the HNS3 ethernet controller driver. [patch 1/10] removes the redundant core reset type [patch 2/10 - 3/10] fixes two VLAN related issues [patch 4/10] fixes a TM issue [patch 5/10 - 10/10] includes some patches related to RAS & MSI-X error Change log: V1->V2: removes two patches which needs to change HNS's infiniband driver as well, they will be upstreamed later with the infiniband's one. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6e36d77c83
11 changed files with 117 additions and 124 deletions
|
@ -251,6 +251,7 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo)
|
|||
|
||||
ae_algo->ops->uninit_ae_dev(ae_dev);
|
||||
hnae3_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0);
|
||||
ae_dev->ops = NULL;
|
||||
}
|
||||
|
||||
list_del(&ae_algo->node);
|
||||
|
@ -351,6 +352,7 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
|
||||
ae_algo->ops->uninit_ae_dev(ae_dev);
|
||||
hnae3_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0);
|
||||
ae_dev->ops = NULL;
|
||||
}
|
||||
|
||||
list_del(&ae_dev->node);
|
||||
|
|
|
@ -154,7 +154,6 @@ enum hnae3_reset_type {
|
|||
HNAE3_VF_FULL_RESET,
|
||||
HNAE3_FLR_RESET,
|
||||
HNAE3_FUNC_RESET,
|
||||
HNAE3_CORE_RESET,
|
||||
HNAE3_GLOBAL_RESET,
|
||||
HNAE3_IMP_RESET,
|
||||
HNAE3_UNKNOWN_RESET,
|
||||
|
@ -339,6 +338,8 @@ struct hnae3_ae_dev {
|
|||
* Set vlan filter config of Ports
|
||||
* set_vf_vlan_filter()
|
||||
* Set vlan filter config of vf
|
||||
* restore_vlan_table()
|
||||
* Restore vlan filter entries after reset
|
||||
* enable_hw_strip_rxvtag()
|
||||
* Enable/disable hardware strip vlan tag of packets received
|
||||
* set_gro_en
|
||||
|
@ -506,6 +507,7 @@ struct hnae3_ae_ops {
|
|||
void (*set_timer_task)(struct hnae3_handle *handle, bool enable);
|
||||
int (*mac_connect_phy)(struct hnae3_handle *handle);
|
||||
void (*mac_disconnect_phy)(struct hnae3_handle *handle);
|
||||
void (*restore_vlan_table)(struct hnae3_handle *handle);
|
||||
};
|
||||
|
||||
struct hnae3_dcb_ops {
|
||||
|
|
|
@ -1548,15 +1548,11 @@ static int hns3_vlan_rx_add_vid(struct net_device *netdev,
|
|||
__be16 proto, u16 vid)
|
||||
{
|
||||
struct hnae3_handle *h = hns3_get_handle(netdev);
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
int ret = -EIO;
|
||||
|
||||
if (h->ae_algo->ops->set_vlan_filter)
|
||||
ret = h->ae_algo->ops->set_vlan_filter(h, proto, vid, false);
|
||||
|
||||
if (!ret)
|
||||
set_bit(vid, priv->active_vlans);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1564,33 +1560,11 @@ static int hns3_vlan_rx_kill_vid(struct net_device *netdev,
|
|||
__be16 proto, u16 vid)
|
||||
{
|
||||
struct hnae3_handle *h = hns3_get_handle(netdev);
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
int ret = -EIO;
|
||||
|
||||
if (h->ae_algo->ops->set_vlan_filter)
|
||||
ret = h->ae_algo->ops->set_vlan_filter(h, proto, vid, true);
|
||||
|
||||
if (!ret)
|
||||
clear_bit(vid, priv->active_vlans);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hns3_restore_vlan(struct net_device *netdev)
|
||||
{
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
int ret = 0;
|
||||
u16 vid;
|
||||
|
||||
for_each_set_bit(vid, priv->active_vlans, VLAN_N_VID) {
|
||||
ret = hns3_vlan_rx_add_vid(netdev, htons(ETH_P_8021Q), vid);
|
||||
if (ret) {
|
||||
netdev_err(netdev, "Restore vlan: %d filter, ret:%d\n",
|
||||
vid, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1946,9 +1920,9 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
|
|||
if (state == pci_channel_io_perm_failure)
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
|
||||
if (!ae_dev) {
|
||||
if (!ae_dev || !ae_dev->ops) {
|
||||
dev_err(&pdev->dev,
|
||||
"Can't recover - error happened during device init\n");
|
||||
"Can't recover - error happened before device initialized\n");
|
||||
return PCI_ERS_RESULT_NONE;
|
||||
}
|
||||
|
||||
|
@ -1967,6 +1941,9 @@ static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
|
|||
|
||||
dev_info(dev, "requesting reset due to PCI error\n");
|
||||
|
||||
if (!ae_dev || !ae_dev->ops)
|
||||
return PCI_ERS_RESULT_NONE;
|
||||
|
||||
/* request the reset */
|
||||
if (ae_dev->ops->reset_event) {
|
||||
if (!ae_dev->override_pci_need_reset)
|
||||
|
@ -4301,12 +4278,8 @@ static int hns3_reset_notify_restore_enet(struct hnae3_handle *handle)
|
|||
vlan_filter_enable = netdev->flags & IFF_PROMISC ? false : true;
|
||||
hns3_enable_vlan_filter(netdev, vlan_filter_enable);
|
||||
|
||||
/* Hardware table is only clear when pf resets */
|
||||
if (!(handle->flags & HNAE3_SUPPORT_VF)) {
|
||||
ret = hns3_restore_vlan(netdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (handle->ae_algo->ops->restore_vlan_table)
|
||||
handle->ae_algo->ops->restore_vlan_table(handle);
|
||||
|
||||
return hns3_restore_fd_rules(netdev);
|
||||
}
|
||||
|
|
|
@ -550,7 +550,6 @@ struct hns3_nic_priv {
|
|||
struct notifier_block notifier_block;
|
||||
/* Vxlan/Geneve information */
|
||||
struct hns3_udp_tunnel udp_tnl[HNS3_UDP_TNL_MAX];
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
struct hns3_enet_coalesce tx_coal;
|
||||
struct hns3_enet_coalesce rx_coal;
|
||||
};
|
||||
|
|
|
@ -173,7 +173,11 @@ static bool hclge_is_special_opcode(u16 opcode)
|
|||
HCLGE_OPC_STATS_MAC,
|
||||
HCLGE_OPC_STATS_MAC_ALL,
|
||||
HCLGE_OPC_QUERY_32_BIT_REG,
|
||||
HCLGE_OPC_QUERY_64_BIT_REG};
|
||||
HCLGE_OPC_QUERY_64_BIT_REG,
|
||||
HCLGE_QUERY_CLEAR_MPF_RAS_INT,
|
||||
HCLGE_QUERY_CLEAR_PF_RAS_INT,
|
||||
HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT,
|
||||
HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {
|
||||
|
|
|
@ -1053,7 +1053,7 @@ static void hclge_dbg_dump_mac_tnl_status(struct hclge_dev *hdev)
|
|||
|
||||
while (kfifo_get(&hdev->mac_tnl_log, &stats)) {
|
||||
rem_nsec = do_div(stats.time, HCLGE_BILLION_NANO_SECONDS);
|
||||
dev_info(&hdev->pdev->dev, "[%07lu.%03lu]status = 0x%x\n",
|
||||
dev_info(&hdev->pdev->dev, "[%07lu.%03lu] status = 0x%x\n",
|
||||
(unsigned long)stats.time, rem_nsec / 1000,
|
||||
stats.status);
|
||||
}
|
||||
|
|
|
@ -87,25 +87,25 @@ static const struct hclge_hw_error hclge_msix_sram_ecc_int[] = {
|
|||
|
||||
static const struct hclge_hw_error hclge_igu_int[] = {
|
||||
{ .int_msk = BIT(0), .msg = "igu_rx_buf0_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(2), .msg = "igu_rx_buf1_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct hclge_hw_error hclge_igu_egu_tnl_int[] = {
|
||||
{ .int_msk = BIT(0), .msg = "rx_buf_overflow",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(1), .msg = "rx_stp_fifo_overflow",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(2), .msg = "rx_stp_fifo_undeflow",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(3), .msg = "tx_buf_overflow",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(4), .msg = "tx_buf_underrun",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(5), .msg = "rx_stp_buf_overflow",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
|
@ -413,13 +413,13 @@ static const struct hclge_hw_error hclge_ppu_mpf_abnormal_int_st2[] = {
|
|||
|
||||
static const struct hclge_hw_error hclge_ppu_mpf_abnormal_int_st3[] = {
|
||||
{ .int_msk = BIT(4), .msg = "gro_bd_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(5), .msg = "gro_context_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(6), .msg = "rx_stash_cfg_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ .int_msk = BIT(7), .msg = "axi_rd_fbd_ecc_mbit_err",
|
||||
.reset_level = HNAE3_CORE_RESET },
|
||||
.reset_level = HNAE3_GLOBAL_RESET },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
|
@ -1098,8 +1098,6 @@ static int hclge_handle_mpf_ras_error(struct hclge_dev *hdev,
|
|||
/* query all main PF RAS errors */
|
||||
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_MPF_RAS_INT,
|
||||
true);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
|
||||
if (ret) {
|
||||
dev_err(dev, "query all mpf ras int cmd failed (%d)\n", ret);
|
||||
|
@ -1262,8 +1260,6 @@ static int hclge_handle_mpf_ras_error(struct hclge_dev *hdev,
|
|||
|
||||
/* clear all main PF RAS errors */
|
||||
hclge_cmd_reuse_desc(&desc[0], false);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
|
||||
if (ret)
|
||||
dev_err(dev, "clear all mpf ras int cmd failed (%d)\n", ret);
|
||||
|
@ -1293,8 +1289,6 @@ static int hclge_handle_pf_ras_error(struct hclge_dev *hdev,
|
|||
/* query all PF RAS errors */
|
||||
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_PF_RAS_INT,
|
||||
true);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
|
||||
if (ret) {
|
||||
dev_err(dev, "query all pf ras int cmd failed (%d)\n", ret);
|
||||
|
@ -1348,8 +1342,6 @@ static int hclge_handle_pf_ras_error(struct hclge_dev *hdev,
|
|||
|
||||
/* clear all PF RAS errors */
|
||||
hclge_cmd_reuse_desc(&desc[0], false);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], num);
|
||||
if (ret)
|
||||
dev_err(dev, "clear all pf ras int cmd failed (%d)\n", ret);
|
||||
|
@ -1501,7 +1493,7 @@ hclge_log_and_clear_rocee_ras_error(struct hclge_dev *hdev)
|
|||
return reset_type;
|
||||
}
|
||||
|
||||
static int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en)
|
||||
int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en)
|
||||
{
|
||||
struct device *dev = &hdev->pdev->dev;
|
||||
struct hclge_desc desc;
|
||||
|
@ -1574,10 +1566,9 @@ static const struct hclge_hw_blk hw_blk[] = {
|
|||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state)
|
||||
int hclge_config_nic_hw_error(struct hclge_dev *hdev, bool state)
|
||||
{
|
||||
const struct hclge_hw_blk *module = hw_blk;
|
||||
struct device *dev = &hdev->pdev->dev;
|
||||
int ret = 0;
|
||||
|
||||
while (module->name) {
|
||||
|
@ -1589,10 +1580,6 @@ int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state)
|
|||
module++;
|
||||
}
|
||||
|
||||
ret = hclge_config_rocee_ras_interrupt(hdev, state);
|
||||
if (ret)
|
||||
dev_err(dev, "fail(%d) to configure ROCEE err int\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1667,8 +1654,6 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
|||
/* query all main PF MSIx errors */
|
||||
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT,
|
||||
true);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], mpf_bd_num);
|
||||
if (ret) {
|
||||
dev_err(dev, "query all mpf msix int cmd failed (%d)\n",
|
||||
|
@ -1700,8 +1685,6 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
|||
|
||||
/* clear all main PF MSIx errors */
|
||||
hclge_cmd_reuse_desc(&desc[0], false);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], mpf_bd_num);
|
||||
if (ret) {
|
||||
dev_err(dev, "clear all mpf msix int cmd failed (%d)\n",
|
||||
|
@ -1713,8 +1696,6 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
|||
memset(desc, 0, bd_num * sizeof(struct hclge_desc));
|
||||
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT,
|
||||
true);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], pf_bd_num);
|
||||
if (ret) {
|
||||
dev_err(dev, "query all pf msix int cmd failed (%d)\n",
|
||||
|
@ -1753,8 +1734,6 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
|||
|
||||
/* clear all PF MSIx errors */
|
||||
hclge_cmd_reuse_desc(&desc[0], false);
|
||||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
|
||||
|
||||
ret = hclge_cmd_send(&hdev->hw, &desc[0], pf_bd_num);
|
||||
if (ret) {
|
||||
dev_err(dev, "clear all pf msix int cmd failed (%d)\n",
|
||||
|
@ -1783,7 +1762,6 @@ int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
|||
ret = hclge_clear_mac_tnl_int(hdev);
|
||||
if (ret)
|
||||
dev_err(dev, "clear mac tnl int failed (%d)\n", ret);
|
||||
set_bit(HNAE3_NONE_RESET, reset_requests);
|
||||
}
|
||||
|
||||
msi_error:
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
#define HCLGE_NCSI_ERR_INT_TYPE 0x9
|
||||
#define HCLGE_MAC_COMMON_ERR_INT_EN 0x107FF
|
||||
#define HCLGE_MAC_COMMON_ERR_INT_EN_MASK 0x107FF
|
||||
#define HCLGE_MAC_TNL_INT_EN GENMASK(7, 0)
|
||||
#define HCLGE_MAC_TNL_INT_EN_MASK GENMASK(7, 0)
|
||||
#define HCLGE_MAC_TNL_INT_CLR GENMASK(7, 0)
|
||||
#define HCLGE_MAC_TNL_INT_EN GENMASK(9, 0)
|
||||
#define HCLGE_MAC_TNL_INT_EN_MASK GENMASK(9, 0)
|
||||
#define HCLGE_MAC_TNL_INT_CLR GENMASK(9, 0)
|
||||
#define HCLGE_PPU_MPF_ABNORMAL_INT0_EN GENMASK(31, 0)
|
||||
#define HCLGE_PPU_MPF_ABNORMAL_INT0_EN_MASK GENMASK(31, 0)
|
||||
#define HCLGE_PPU_MPF_ABNORMAL_INT1_EN GENMASK(31, 0)
|
||||
|
@ -119,7 +119,8 @@ struct hclge_hw_error {
|
|||
};
|
||||
|
||||
int hclge_config_mac_tnl_int(struct hclge_dev *hdev, bool en);
|
||||
int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state);
|
||||
int hclge_config_nic_hw_error(struct hclge_dev *hdev, bool state);
|
||||
int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en);
|
||||
pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev);
|
||||
int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
|
||||
unsigned long *reset_requests);
|
||||
|
|
|
@ -2706,15 +2706,6 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
|
|||
return HCLGE_VECTOR0_EVENT_RST;
|
||||
}
|
||||
|
||||
if (BIT(HCLGE_VECTOR0_CORERESET_INT_B) & rst_src_reg) {
|
||||
dev_info(&hdev->pdev->dev, "core reset interrupt\n");
|
||||
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
|
||||
set_bit(HNAE3_CORE_RESET, &hdev->reset_pending);
|
||||
*clearval = BIT(HCLGE_VECTOR0_CORERESET_INT_B);
|
||||
hdev->rst_stats.core_rst_cnt++;
|
||||
return HCLGE_VECTOR0_EVENT_RST;
|
||||
}
|
||||
|
||||
/* check for vector0 msix event source */
|
||||
if (msix_src_reg & HCLGE_VECTOR0_REG_MSIX_MASK) {
|
||||
dev_dbg(&hdev->pdev->dev, "received event 0x%x\n",
|
||||
|
@ -2941,10 +2932,6 @@ static int hclge_reset_wait(struct hclge_dev *hdev)
|
|||
reg = HCLGE_GLOBAL_RESET_REG;
|
||||
reg_bit = HCLGE_GLOBAL_RESET_BIT;
|
||||
break;
|
||||
case HNAE3_CORE_RESET:
|
||||
reg = HCLGE_GLOBAL_RESET_REG;
|
||||
reg_bit = HCLGE_CORE_RESET_BIT;
|
||||
break;
|
||||
case HNAE3_FUNC_RESET:
|
||||
reg = HCLGE_FUN_RST_ING;
|
||||
reg_bit = HCLGE_FUN_RST_ING_B;
|
||||
|
@ -3076,12 +3063,6 @@ static void hclge_do_reset(struct hclge_dev *hdev)
|
|||
hclge_write_dev(&hdev->hw, HCLGE_GLOBAL_RESET_REG, val);
|
||||
dev_info(&pdev->dev, "Global Reset requested\n");
|
||||
break;
|
||||
case HNAE3_CORE_RESET:
|
||||
val = hclge_read_dev(&hdev->hw, HCLGE_GLOBAL_RESET_REG);
|
||||
hnae3_set_bit(val, HCLGE_CORE_RESET_BIT, 1);
|
||||
hclge_write_dev(&hdev->hw, HCLGE_GLOBAL_RESET_REG, val);
|
||||
dev_info(&pdev->dev, "Core Reset requested\n");
|
||||
break;
|
||||
case HNAE3_FUNC_RESET:
|
||||
dev_info(&pdev->dev, "PF Reset requested\n");
|
||||
/* schedule again to check later */
|
||||
|
@ -3128,16 +3109,10 @@ static enum hnae3_reset_type hclge_get_reset_level(struct hclge_dev *hdev,
|
|||
rst_level = HNAE3_IMP_RESET;
|
||||
clear_bit(HNAE3_IMP_RESET, addr);
|
||||
clear_bit(HNAE3_GLOBAL_RESET, addr);
|
||||
clear_bit(HNAE3_CORE_RESET, addr);
|
||||
clear_bit(HNAE3_FUNC_RESET, addr);
|
||||
} else if (test_bit(HNAE3_GLOBAL_RESET, addr)) {
|
||||
rst_level = HNAE3_GLOBAL_RESET;
|
||||
clear_bit(HNAE3_GLOBAL_RESET, addr);
|
||||
clear_bit(HNAE3_CORE_RESET, addr);
|
||||
clear_bit(HNAE3_FUNC_RESET, addr);
|
||||
} else if (test_bit(HNAE3_CORE_RESET, addr)) {
|
||||
rst_level = HNAE3_CORE_RESET;
|
||||
clear_bit(HNAE3_CORE_RESET, addr);
|
||||
clear_bit(HNAE3_FUNC_RESET, addr);
|
||||
} else if (test_bit(HNAE3_FUNC_RESET, addr)) {
|
||||
rst_level = HNAE3_FUNC_RESET;
|
||||
|
@ -3165,9 +3140,6 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev)
|
|||
case HNAE3_GLOBAL_RESET:
|
||||
clearval = BIT(HCLGE_VECTOR0_GLOBALRESET_INT_B);
|
||||
break;
|
||||
case HNAE3_CORE_RESET:
|
||||
clearval = BIT(HCLGE_VECTOR0_CORERESET_INT_B);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -7053,6 +7025,12 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
|
|||
u8 vf_byte_off;
|
||||
int ret;
|
||||
|
||||
/* if vf vlan table is full, firmware will close vf vlan filter, it
|
||||
* is unable and unnecessary to add new vlan id to vf vlan filter
|
||||
*/
|
||||
if (test_bit(vfid, hdev->vf_vlan_full) && !is_kill)
|
||||
return 0;
|
||||
|
||||
hclge_cmd_setup_basic_desc(&desc[0],
|
||||
HCLGE_OPC_VLAN_FILTER_VF_CFG, false);
|
||||
hclge_cmd_setup_basic_desc(&desc[1],
|
||||
|
@ -7088,6 +7066,7 @@ static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid,
|
|||
return 0;
|
||||
|
||||
if (req0->resp_code == HCLGE_VF_VLAN_NO_ENTRY) {
|
||||
set_bit(vfid, hdev->vf_vlan_full);
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"vf vlan table is full, vf vlan filter is disabled\n");
|
||||
return 0;
|
||||
|
@ -7422,10 +7401,6 @@ static void hclge_add_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id,
|
|||
{
|
||||
struct hclge_vport_vlan_cfg *vlan;
|
||||
|
||||
/* vlan 0 is reserved */
|
||||
if (!vlan_id)
|
||||
return;
|
||||
|
||||
vlan = kzalloc(sizeof(*vlan), GFP_KERNEL);
|
||||
if (!vlan)
|
||||
return;
|
||||
|
@ -7520,6 +7495,43 @@ void hclge_uninit_vport_vlan_table(struct hclge_dev *hdev)
|
|||
mutex_unlock(&hdev->vport_cfg_mutex);
|
||||
}
|
||||
|
||||
static void hclge_restore_vlan_table(struct hnae3_handle *handle)
|
||||
{
|
||||
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||
struct hclge_vport_vlan_cfg *vlan, *tmp;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
u16 vlan_proto, qos;
|
||||
u16 state, vlan_id;
|
||||
int i;
|
||||
|
||||
mutex_lock(&hdev->vport_cfg_mutex);
|
||||
for (i = 0; i < hdev->num_alloc_vport; i++) {
|
||||
vport = &hdev->vport[i];
|
||||
vlan_proto = vport->port_base_vlan_cfg.vlan_info.vlan_proto;
|
||||
vlan_id = vport->port_base_vlan_cfg.vlan_info.vlan_tag;
|
||||
qos = vport->port_base_vlan_cfg.vlan_info.qos;
|
||||
state = vport->port_base_vlan_cfg.state;
|
||||
|
||||
if (state != HNAE3_PORT_BASE_VLAN_DISABLE) {
|
||||
hclge_set_vlan_filter_hw(hdev, htons(vlan_proto),
|
||||
vport->vport_id, vlan_id, qos,
|
||||
false);
|
||||
continue;
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(vlan, tmp, &vport->vlan_list, node) {
|
||||
if (vlan->hd_tbl_status)
|
||||
hclge_set_vlan_filter_hw(hdev,
|
||||
htons(ETH_P_8021Q),
|
||||
vport->vport_id,
|
||||
vlan->vlan_id, 0,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&hdev->vport_cfg_mutex);
|
||||
}
|
||||
|
||||
int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
|
||||
{
|
||||
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||
|
@ -8190,10 +8202,16 @@ static int hclge_init_nic_client_instance(struct hnae3_ae_dev *ae_dev,
|
|||
set_bit(HCLGE_STATE_NIC_REGISTERED, &hdev->state);
|
||||
hnae3_set_client_init_flag(client, ae_dev, 1);
|
||||
|
||||
/* Enable nic hw error interrupts */
|
||||
ret = hclge_config_nic_hw_error(hdev, true);
|
||||
if (ret)
|
||||
dev_err(&ae_dev->pdev->dev,
|
||||
"fail(%d) to enable hw error interrupts\n", ret);
|
||||
|
||||
if (netif_msg_drv(&hdev->vport->nic))
|
||||
hclge_info_show(hdev);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hclge_init_roce_client_instance(struct hnae3_ae_dev *ae_dev,
|
||||
|
@ -8273,7 +8291,13 @@ static int hclge_init_client_instance(struct hnae3_client *client,
|
|||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Enable roce ras interrupts */
|
||||
ret = hclge_config_rocee_ras_interrupt(hdev, true);
|
||||
if (ret)
|
||||
dev_err(&ae_dev->pdev->dev,
|
||||
"fail(%d) to enable roce ras interrupts\n", ret);
|
||||
|
||||
return ret;
|
||||
|
||||
clear_nic:
|
||||
hdev->nic_client = NULL;
|
||||
|
@ -8577,13 +8601,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
goto err_mdiobus_unreg;
|
||||
}
|
||||
|
||||
ret = hclge_hw_error_set_state(hdev, true);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"fail(%d) to enable hw error interrupts\n", ret);
|
||||
goto err_mdiobus_unreg;
|
||||
}
|
||||
|
||||
INIT_KFIFO(hdev->mac_tnl_log);
|
||||
|
||||
hclge_dcb_ops_set(hdev);
|
||||
|
@ -8649,6 +8666,7 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
|
||||
hclge_stats_clear(hdev);
|
||||
memset(hdev->vlan_table, 0, sizeof(hdev->vlan_table));
|
||||
memset(hdev->vf_vlan_full, 0, sizeof(hdev->vf_vlan_full));
|
||||
|
||||
ret = hclge_cmd_init(hdev);
|
||||
if (ret) {
|
||||
|
@ -8706,15 +8724,26 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
}
|
||||
|
||||
/* Re-enable the hw error interrupts because
|
||||
* the interrupts get disabled on core/global reset.
|
||||
* the interrupts get disabled on global reset.
|
||||
*/
|
||||
ret = hclge_hw_error_set_state(hdev, true);
|
||||
ret = hclge_config_nic_hw_error(hdev, true);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"fail(%d) to re-enable HNS hw error interrupts\n", ret);
|
||||
"fail(%d) to re-enable NIC hw error interrupts\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (hdev->roce_client) {
|
||||
ret = hclge_config_rocee_ras_interrupt(hdev, true);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"fail(%d) to re-enable roce ras interrupts\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
hclge_reset_vport_state(hdev);
|
||||
|
||||
dev_info(&pdev->dev, "Reset done, %s driver initialization finished.\n",
|
||||
|
@ -8739,8 +8768,11 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
|
|||
hclge_enable_vector(&hdev->misc_vector, false);
|
||||
synchronize_irq(hdev->misc_vector.vector_irq);
|
||||
|
||||
/* Disable all hw interrupts */
|
||||
hclge_config_mac_tnl_int(hdev, false);
|
||||
hclge_hw_error_set_state(hdev, false);
|
||||
hclge_config_nic_hw_error(hdev, false);
|
||||
hclge_config_rocee_ras_interrupt(hdev, false);
|
||||
|
||||
hclge_cmd_uninit(hdev);
|
||||
hclge_misc_irq_uninit(hdev);
|
||||
hclge_pci_uninit(hdev);
|
||||
|
@ -9226,6 +9258,7 @@ static const struct hnae3_ae_ops hclge_ops = {
|
|||
.set_timer_task = hclge_set_timer_task,
|
||||
.mac_connect_phy = hclge_mac_connect_phy,
|
||||
.mac_disconnect_phy = hclge_mac_disconnect_phy,
|
||||
.restore_vlan_table = hclge_restore_vlan_table,
|
||||
};
|
||||
|
||||
static struct hnae3_ae_algo ae_algo = {
|
||||
|
|
|
@ -820,6 +820,7 @@ struct hclge_dev {
|
|||
struct hclge_vlan_type_cfg vlan_type_cfg;
|
||||
|
||||
unsigned long vlan_table[VLAN_N_VID][BITS_TO_LONGS(HCLGE_VPORT_NUM)];
|
||||
unsigned long vf_vlan_full[BITS_TO_LONGS(HCLGE_VPORT_NUM)];
|
||||
|
||||
struct hclge_fd_cfg fd_cfg;
|
||||
struct hlist_head fd_rule_list;
|
||||
|
|
|
@ -397,7 +397,7 @@ static int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev)
|
|||
u8 ir_u, ir_b, ir_s;
|
||||
int ret;
|
||||
|
||||
ret = hclge_shaper_para_calc(HCLGE_ETHER_MAX_RATE,
|
||||
ret = hclge_shaper_para_calc(hdev->hw.mac.speed,
|
||||
HCLGE_SHAPER_LVL_PORT,
|
||||
&ir_b, &ir_u, &ir_s);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in a new issue