Commit 73a1dd8c authored by David S. Miller's avatar David S. Miller

Merge branch 'net-hns3-add-some-cleanups-and-optimizations'

Huazhong Tan says:

====================
net: hns3: add some cleanups and optimizations

This patch-set includes cleanups, optimizations and bugfix for
the HNS3 ethernet controller driver.

[patch 01/12] adds code optimization for debugfs command "dump reg".

[patch 02/12] fixes magic number issues.

[patch 03/12] modifies some parameters about hclge_dbg_dump_tm_map().

[patch 04/12] removes some unused parameters.

[patch 05/12] refactors some logs to make them more readable.

[patch 06/12] makes some resusable codes into functions.

[patch 07/12] fixes some type errors.

[patch 08/12] reduces the waiting time for per TQP reset.

[patch 09/12] implements .process_hw_error for hns3 client.

[patch 10/12] adds phy selftest for HNS3 driver.

[patch 11/12] adds checking for reset interrupt status when reset fails.

[patch 12/12] prevents SSU loopback when running ethtool -t.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8eb3cef8 dd2956ea
...@@ -146,6 +146,12 @@ enum hnae3_reset_notify_type { ...@@ -146,6 +146,12 @@ enum hnae3_reset_notify_type {
HNAE3_RESTORE_CLIENT, HNAE3_RESTORE_CLIENT,
}; };
enum hnae3_hw_error_type {
HNAE3_PPU_POISON_ERROR,
HNAE3_CMDQ_ECC_ERROR,
HNAE3_IMP_RD_POISON_ERROR,
};
enum hnae3_reset_type { enum hnae3_reset_type {
HNAE3_VF_RESET, HNAE3_VF_RESET,
HNAE3_VF_FUNC_RESET, HNAE3_VF_FUNC_RESET,
...@@ -210,7 +216,8 @@ struct hnae3_client_ops { ...@@ -210,7 +216,8 @@ struct hnae3_client_ops {
int (*setup_tc)(struct hnae3_handle *handle, u8 tc); int (*setup_tc)(struct hnae3_handle *handle, u8 tc);
int (*reset_notify)(struct hnae3_handle *handle, int (*reset_notify)(struct hnae3_handle *handle,
enum hnae3_reset_notify_type type); enum hnae3_reset_notify_type type);
enum hnae3_reset_type (*process_hw_error)(struct hnae3_handle *handle); void (*process_hw_error)(struct hnae3_handle *handle,
enum hnae3_hw_error_type);
}; };
#define HNAE3_CLIENT_NAME_LENGTH 16 #define HNAE3_CLIENT_NAME_LENGTH 16
......
...@@ -39,7 +39,7 @@ static int hns3_dbg_queue_info(struct hnae3_handle *h, ...@@ -39,7 +39,7 @@ static int hns3_dbg_queue_info(struct hnae3_handle *h,
if (queue_num >= h->kinfo.num_tqps) { if (queue_num >= h->kinfo.num_tqps) {
dev_err(&h->pdev->dev, dev_err(&h->pdev->dev,
"Queue number(%u) is out of range(%u)\n", queue_num, "Queue number(%u) is out of range(0-%u)\n", queue_num,
h->kinfo.num_tqps - 1); h->kinfo.num_tqps - 1);
return -EINVAL; return -EINVAL;
} }
...@@ -177,7 +177,7 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf) ...@@ -177,7 +177,7 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf)
} }
if (q_num >= h->kinfo.num_tqps) { if (q_num >= h->kinfo.num_tqps) {
dev_err(dev, "Queue number(%u) is out of range(%u)\n", q_num, dev_err(dev, "Queue number(%u) is out of range(0-%u)\n", q_num,
h->kinfo.num_tqps - 1); h->kinfo.num_tqps - 1);
return -EINVAL; return -EINVAL;
} }
...@@ -188,14 +188,14 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf) ...@@ -188,14 +188,14 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf)
tx_index = (cnt == 1) ? value : tx_index; tx_index = (cnt == 1) ? value : tx_index;
if (tx_index >= ring->desc_num) { if (tx_index >= ring->desc_num) {
dev_err(dev, "bd index (%u) is out of range(%u)\n", tx_index, dev_err(dev, "bd index(%u) is out of range(0-%u)\n", tx_index,
ring->desc_num - 1); ring->desc_num - 1);
return -EINVAL; return -EINVAL;
} }
tx_desc = &ring->desc[tx_index]; tx_desc = &ring->desc[tx_index];
dev_info(dev, "TX Queue Num: %u, BD Index: %u\n", q_num, tx_index); dev_info(dev, "TX Queue Num: %u, BD Index: %u\n", q_num, tx_index);
dev_info(dev, "(TX) addr: 0x%llx\n", tx_desc->addr); dev_info(dev, "(TX)addr: 0x%llx\n", tx_desc->addr);
dev_info(dev, "(TX)vlan_tag: %u\n", tx_desc->tx.vlan_tag); dev_info(dev, "(TX)vlan_tag: %u\n", tx_desc->tx.vlan_tag);
dev_info(dev, "(TX)send_size: %u\n", tx_desc->tx.send_size); dev_info(dev, "(TX)send_size: %u\n", tx_desc->tx.send_size);
dev_info(dev, "(TX)vlan_tso: %u\n", tx_desc->tx.type_cs_vlan_tso); dev_info(dev, "(TX)vlan_tso: %u\n", tx_desc->tx.type_cs_vlan_tso);
...@@ -219,6 +219,7 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf) ...@@ -219,6 +219,7 @@ static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf)
dev_info(dev, "RX Queue Num: %u, BD Index: %u\n", q_num, rx_index); dev_info(dev, "RX Queue Num: %u, BD Index: %u\n", q_num, rx_index);
dev_info(dev, "(RX)addr: 0x%llx\n", rx_desc->addr); dev_info(dev, "(RX)addr: 0x%llx\n", rx_desc->addr);
dev_info(dev, "(RX)l234_info: %u\n", rx_desc->rx.l234_info);
dev_info(dev, "(RX)pkt_len: %u\n", rx_desc->rx.pkt_len); dev_info(dev, "(RX)pkt_len: %u\n", rx_desc->rx.pkt_len);
dev_info(dev, "(RX)size: %u\n", rx_desc->rx.size); dev_info(dev, "(RX)size: %u\n", rx_desc->rx.size);
dev_info(dev, "(RX)rss_hash: %u\n", rx_desc->rx.rss_hash); dev_info(dev, "(RX)rss_hash: %u\n", rx_desc->rx.rss_hash);
...@@ -238,16 +239,16 @@ static void hns3_dbg_help(struct hnae3_handle *h) ...@@ -238,16 +239,16 @@ static void hns3_dbg_help(struct hnae3_handle *h)
char printf_buf[HNS3_DBG_BUF_LEN]; char printf_buf[HNS3_DBG_BUF_LEN];
dev_info(&h->pdev->dev, "available commands\n"); dev_info(&h->pdev->dev, "available commands\n");
dev_info(&h->pdev->dev, "queue info [number]\n"); dev_info(&h->pdev->dev, "queue info <number>\n");
dev_info(&h->pdev->dev, "queue map\n"); dev_info(&h->pdev->dev, "queue map\n");
dev_info(&h->pdev->dev, "bd info [q_num] <bd index>\n"); dev_info(&h->pdev->dev, "bd info <q_num> <bd index>\n");
if (!hns3_is_phys_func(h->pdev)) if (!hns3_is_phys_func(h->pdev))
return; return;
dev_info(&h->pdev->dev, "dump fd tcam\n"); dev_info(&h->pdev->dev, "dump fd tcam\n");
dev_info(&h->pdev->dev, "dump tc\n"); dev_info(&h->pdev->dev, "dump tc\n");
dev_info(&h->pdev->dev, "dump tm map [q_num]\n"); dev_info(&h->pdev->dev, "dump tm map <q_num>\n");
dev_info(&h->pdev->dev, "dump tm\n"); dev_info(&h->pdev->dev, "dump tm\n");
dev_info(&h->pdev->dev, "dump qos pause cfg\n"); dev_info(&h->pdev->dev, "dump qos pause cfg\n");
dev_info(&h->pdev->dev, "dump qos pri map\n"); dev_info(&h->pdev->dev, "dump qos pri map\n");
...@@ -259,20 +260,20 @@ static void hns3_dbg_help(struct hnae3_handle *h) ...@@ -259,20 +260,20 @@ static void hns3_dbg_help(struct hnae3_handle *h)
dev_info(&h->pdev->dev, "dump mac tnl status\n"); dev_info(&h->pdev->dev, "dump mac tnl status\n");
memset(printf_buf, 0, HNS3_DBG_BUF_LEN); memset(printf_buf, 0, HNS3_DBG_BUF_LEN);
strncat(printf_buf, "dump reg [[bios common] [ssu <prt_id>]", strncat(printf_buf, "dump reg [[bios common] [ssu <port_id>]",
HNS3_DBG_BUF_LEN - 1); HNS3_DBG_BUF_LEN - 1);
strncat(printf_buf + strlen(printf_buf), strncat(printf_buf + strlen(printf_buf),
" [igu egu <prt_id>] [rpu <tc_queue_num>]", " [igu egu <port_id>] [rpu <tc_queue_num>]",
HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1); HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1);
strncat(printf_buf + strlen(printf_buf), strncat(printf_buf + strlen(printf_buf),
" [rtc] [ppp] [rcb] [tqp <q_num>]]\n", " [rtc] [ppp] [rcb] [tqp <queue_num>]]\n",
HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1); HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1);
dev_info(&h->pdev->dev, "%s", printf_buf); dev_info(&h->pdev->dev, "%s", printf_buf);
memset(printf_buf, 0, HNS3_DBG_BUF_LEN); memset(printf_buf, 0, HNS3_DBG_BUF_LEN);
strncat(printf_buf, "dump reg dcb [port_id] [pri_id] [pg_id]", strncat(printf_buf, "dump reg dcb <port_id> <pri_id> <pg_id>",
HNS3_DBG_BUF_LEN - 1); HNS3_DBG_BUF_LEN - 1);
strncat(printf_buf + strlen(printf_buf), " [rq_id] [nq_id] [qset_id]\n", strncat(printf_buf + strlen(printf_buf), " <rq_id> <nq_id> <qset_id>\n",
HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1); HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1);
dev_info(&h->pdev->dev, "%s", printf_buf); dev_info(&h->pdev->dev, "%s", printf_buf);
} }
......
...@@ -4470,12 +4470,36 @@ int hns3_set_channels(struct net_device *netdev, ...@@ -4470,12 +4470,36 @@ int hns3_set_channels(struct net_device *netdev,
return hns3_reset_notify(h, HNAE3_UP_CLIENT); return hns3_reset_notify(h, HNAE3_UP_CLIENT);
} }
static const struct hns3_hw_error_info hns3_hw_err[] = {
{ .type = HNAE3_PPU_POISON_ERROR,
.msg = "PPU poison" },
{ .type = HNAE3_CMDQ_ECC_ERROR,
.msg = "IMP CMDQ error" },
{ .type = HNAE3_IMP_RD_POISON_ERROR,
.msg = "IMP RD poison" },
};
static void hns3_process_hw_error(struct hnae3_handle *handle,
enum hnae3_hw_error_type type)
{
int i;
for (i = 0; i < ARRAY_SIZE(hns3_hw_err); i++) {
if (hns3_hw_err[i].type == type) {
dev_err(&handle->pdev->dev, "Detected %s!\n",
hns3_hw_err[i].msg);
break;
}
}
}
static const struct hnae3_client_ops client_ops = { static const struct hnae3_client_ops client_ops = {
.init_instance = hns3_client_init, .init_instance = hns3_client_init,
.uninit_instance = hns3_client_uninit, .uninit_instance = hns3_client_uninit,
.link_status_change = hns3_link_status_change, .link_status_change = hns3_link_status_change,
.setup_tc = hns3_client_setup_tc, .setup_tc = hns3_client_setup_tc,
.reset_notify = hns3_reset_notify, .reset_notify = hns3_reset_notify,
.process_hw_error = hns3_process_hw_error,
}; };
/* hns3_init_module - Driver registration routine /* hns3_init_module - Driver registration routine
......
...@@ -552,6 +552,11 @@ union l4_hdr_info { ...@@ -552,6 +552,11 @@ union l4_hdr_info {
unsigned char *hdr; unsigned char *hdr;
}; };
struct hns3_hw_error_info {
enum hnae3_hw_error_type type;
const char *msg;
};
static inline int ring_space(struct hns3_enet_ring *ring) static inline int ring_space(struct hns3_enet_ring *ring)
{ {
/* This smp_load_acquire() pairs with smp_store_release() in /* This smp_load_acquire() pairs with smp_store_release() in
......
...@@ -59,7 +59,7 @@ static const struct hns3_stats hns3_rxq_stats[] = { ...@@ -59,7 +59,7 @@ static const struct hns3_stats hns3_rxq_stats[] = {
#define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT) #define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT)
#define HNS3_SELF_TEST_TYPE_NUM 3 #define HNS3_SELF_TEST_TYPE_NUM 4
#define HNS3_NIC_LB_TEST_PKT_NUM 1 #define HNS3_NIC_LB_TEST_PKT_NUM 1
#define HNS3_NIC_LB_TEST_RING_ID 0 #define HNS3_NIC_LB_TEST_RING_ID 0
#define HNS3_NIC_LB_TEST_PACKET_SIZE 128 #define HNS3_NIC_LB_TEST_PACKET_SIZE 128
...@@ -89,6 +89,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) ...@@ -89,6 +89,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en)
case HNAE3_LOOP_SERIAL_SERDES: case HNAE3_LOOP_SERIAL_SERDES:
case HNAE3_LOOP_PARALLEL_SERDES: case HNAE3_LOOP_PARALLEL_SERDES:
case HNAE3_LOOP_APP: case HNAE3_LOOP_APP:
case HNAE3_LOOP_PHY:
ret = h->ae_algo->ops->set_loopback(h, loop, en); ret = h->ae_algo->ops->set_loopback(h, loop, en);
break; break;
default: default:
...@@ -96,7 +97,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en) ...@@ -96,7 +97,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en)
break; break;
} }
if (ret) if (ret || h->pdev->revision >= 0x21)
return ret; return ret;
if (en) { if (en) {
...@@ -143,7 +144,10 @@ static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode) ...@@ -143,7 +144,10 @@ static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode)
static void hns3_lp_setup_skb(struct sk_buff *skb) static void hns3_lp_setup_skb(struct sk_buff *skb)
{ {
#define HNS3_NIC_LB_DST_MAC_ADDR 0x1f
struct net_device *ndev = skb->dev; struct net_device *ndev = skb->dev;
struct hnae3_handle *handle;
unsigned char *packet; unsigned char *packet;
struct ethhdr *ethh; struct ethhdr *ethh;
unsigned int i; unsigned int i;
...@@ -159,7 +163,9 @@ static void hns3_lp_setup_skb(struct sk_buff *skb) ...@@ -159,7 +163,9 @@ static void hns3_lp_setup_skb(struct sk_buff *skb)
* before the packet reaches mac or serdes, which will defect * before the packet reaches mac or serdes, which will defect
* the purpose of mac or serdes selftest. * the purpose of mac or serdes selftest.
*/ */
ethh->h_dest[5] += 0x1f; handle = hns3_get_handle(ndev);
if (handle->pdev->revision == 0x20)
ethh->h_dest[5] += HNS3_NIC_LB_DST_MAC_ADDR;
eth_zero_addr(ethh->h_source); eth_zero_addr(ethh->h_source);
ethh->h_proto = htons(ETH_P_ARP); ethh->h_proto = htons(ETH_P_ARP);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
...@@ -330,6 +336,10 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -330,6 +336,10 @@ static void hns3_self_test(struct net_device *ndev,
st_param[HNAE3_LOOP_PARALLEL_SERDES][1] = st_param[HNAE3_LOOP_PARALLEL_SERDES][1] =
h->flags & HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK; h->flags & HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK;
st_param[HNAE3_LOOP_PHY][0] = HNAE3_LOOP_PHY;
st_param[HNAE3_LOOP_PHY][1] =
h->flags & HNAE3_SUPPORT_PHY_LOOPBACK;
if (if_running) if (if_running)
ndev->netdev_ops->ndo_stop(ndev); ndev->netdev_ops->ndo_stop(ndev);
......
...@@ -223,6 +223,9 @@ enum hclge_opcode_type { ...@@ -223,6 +223,9 @@ enum hclge_opcode_type {
HCLGE_OPC_MAC_ETHTYPE_ADD = 0x1010, HCLGE_OPC_MAC_ETHTYPE_ADD = 0x1010,
HCLGE_OPC_MAC_ETHTYPE_REMOVE = 0x1011, HCLGE_OPC_MAC_ETHTYPE_REMOVE = 0x1011,
/* MAC VLAN commands */
HCLGE_OPC_MAC_VLAN_SWITCH_PARAM = 0x1033,
/* VLAN commands */ /* VLAN commands */
HCLGE_OPC_VLAN_FILTER_CTRL = 0x1100, HCLGE_OPC_VLAN_FILTER_CTRL = 0x1100,
HCLGE_OPC_VLAN_FILTER_PF_CFG = 0x1101, HCLGE_OPC_VLAN_FILTER_PF_CFG = 0x1101,
...@@ -771,6 +774,31 @@ struct hclge_vlan_filter_vf_cfg_cmd { ...@@ -771,6 +774,31 @@ struct hclge_vlan_filter_vf_cfg_cmd {
u8 vf_bitmap[16]; u8 vf_bitmap[16];
}; };
#define HCLGE_SWITCH_ANTI_SPOOF_B 0U
#define HCLGE_SWITCH_ALW_LPBK_B 1U
#define HCLGE_SWITCH_ALW_LCL_LPBK_B 2U
#define HCLGE_SWITCH_ALW_DST_OVRD_B 3U
#define HCLGE_SWITCH_NO_MASK 0x0
#define HCLGE_SWITCH_ANTI_SPOOF_MASK 0xFE
#define HCLGE_SWITCH_ALW_LPBK_MASK 0xFD
#define HCLGE_SWITCH_ALW_LCL_LPBK_MASK 0xFB
#define HCLGE_SWITCH_LW_DST_OVRD_MASK 0xF7
struct hclge_mac_vlan_switch_cmd {
u8 roce_sel;
u8 rsv1[3];
__le32 func_id;
u8 switch_param;
u8 rsv2[3];
u8 param_mask;
u8 rsv3[11];
};
enum hclge_mac_vlan_cfg_sel {
HCLGE_MAC_VLAN_NIC_SEL = 0,
HCLGE_MAC_VLAN_ROCE_SEL,
};
#define HCLGE_ACCEPT_TAG1_B 0 #define HCLGE_ACCEPT_TAG1_B 0
#define HCLGE_ACCEPT_UNTAG1_B 1 #define HCLGE_ACCEPT_UNTAG1_B 1
#define HCLGE_PORT_INS_TAG1_EN_B 2 #define HCLGE_PORT_INS_TAG1_EN_B 2
......
...@@ -198,6 +198,28 @@ static int hclge_client_setup_tc(struct hclge_dev *hdev) ...@@ -198,6 +198,28 @@ static int hclge_client_setup_tc(struct hclge_dev *hdev)
return 0; return 0;
} }
static int hclge_notify_down_uinit(struct hclge_dev *hdev)
{
int ret;
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
if (ret)
return ret;
return hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
}
static int hclge_notify_init_up(struct hclge_dev *hdev)
{
int ret;
ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
if (ret)
return ret;
return hclge_notify_client(hdev, HNAE3_UP_CLIENT);
}
static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
{ {
struct hclge_vport *vport = hclge_get_vport(h); struct hclge_vport *vport = hclge_get_vport(h);
...@@ -218,11 +240,7 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) ...@@ -218,11 +240,7 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
if (map_changed) { if (map_changed) {
netif_dbg(h, drv, netdev, "set ets\n"); netif_dbg(h, drv, netdev, "set ets\n");
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); ret = hclge_notify_down_uinit(hdev);
if (ret)
return ret;
ret = hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -242,11 +260,7 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) ...@@ -242,11 +260,7 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
if (ret) if (ret)
goto err_out; goto err_out;
ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT); ret = hclge_notify_init_up(hdev);
if (ret)
return ret;
ret = hclge_notify_client(hdev, HNAE3_UP_CLIENT);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -257,10 +271,8 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) ...@@ -257,10 +271,8 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
if (!map_changed) if (!map_changed)
return ret; return ret;
if (hclge_notify_client(hdev, HNAE3_INIT_CLIENT)) hclge_notify_init_up(hdev);
return ret;
hclge_notify_client(hdev, HNAE3_UP_CLIENT);
return ret; return ret;
} }
...@@ -383,11 +395,7 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc) ...@@ -383,11 +395,7 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc)
if (ret) if (ret)
return -EINVAL; return -EINVAL;
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); ret = hclge_notify_down_uinit(hdev);
if (ret)
return ret;
ret = hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
if (ret) if (ret)
return ret; return ret;
...@@ -409,17 +417,11 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc) ...@@ -409,17 +417,11 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc)
else else
hdev->flag &= ~HCLGE_FLAG_MQPRIO_ENABLE; hdev->flag &= ~HCLGE_FLAG_MQPRIO_ENABLE;
ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT); return hclge_notify_init_up(hdev);
if (ret)
return ret;
return hclge_notify_client(hdev, HNAE3_UP_CLIENT);
err_out: err_out:
if (hclge_notify_client(hdev, HNAE3_INIT_CLIENT)) hclge_notify_init_up(hdev);
return ret;
hclge_notify_client(hdev, HNAE3_UP_CLIENT);
return ret; return ret;
} }
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#ifndef __HCLGE_DEBUGFS_H #ifndef __HCLGE_DEBUGFS_H
#define __HCLGE_DEBUGFS_H #define __HCLGE_DEBUGFS_H
#include <linux/etherdevice.h>
#include "hclge_cmd.h"
#define HCLGE_DBG_BUF_LEN 256 #define HCLGE_DBG_BUF_LEN 256
#define HCLGE_DBG_MNG_TBL_MAX 64 #define HCLGE_DBG_MNG_TBL_MAX 64
...@@ -63,9 +66,23 @@ struct hclge_dbg_bitmap_cmd { ...@@ -63,9 +66,23 @@ struct hclge_dbg_bitmap_cmd {
}; };
}; };
struct hclge_dbg_reg_common_msg {
int msg_num;
int offset;
enum hclge_opcode_type cmd;
};
#define HCLGE_DBG_MAX_DFX_MSG_LEN 60
struct hclge_dbg_dfx_message { struct hclge_dbg_dfx_message {
int flag; int flag;
char message[60]; char message[HCLGE_DBG_MAX_DFX_MSG_LEN];
};
#define HCLGE_DBG_MAC_REG_TYPE_LEN 32
struct hclge_dbg_reg_type_info {
const char *reg_type;
struct hclge_dbg_dfx_message *dfx_msg;
struct hclge_dbg_reg_common_msg reg_msg;
}; };
#pragma pack() #pragma pack()
......
...@@ -930,32 +930,44 @@ static int hclge_config_ppu_error_interrupts(struct hclge_dev *hdev, u32 cmd, ...@@ -930,32 +930,44 @@ static int hclge_config_ppu_error_interrupts(struct hclge_dev *hdev, u32 cmd,
/* configure PPU error interrupts */ /* configure PPU error interrupts */
if (cmd == HCLGE_PPU_MPF_ECC_INT_CMD) { if (cmd == HCLGE_PPU_MPF_ECC_INT_CMD) {
hclge_cmd_setup_basic_desc(&desc[0], cmd, false); hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
desc[0].flag |= HCLGE_CMD_FLAG_NEXT; desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
hclge_cmd_setup_basic_desc(&desc[1], cmd, false); hclge_cmd_setup_basic_desc(&desc[1], cmd, false);
if (en) { if (en) {
desc[0].data[0] = HCLGE_PPU_MPF_ABNORMAL_INT0_EN; desc[0].data[0] =
desc[0].data[1] = HCLGE_PPU_MPF_ABNORMAL_INT1_EN; cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT0_EN);
desc[1].data[3] = HCLGE_PPU_MPF_ABNORMAL_INT3_EN; desc[0].data[1] =
desc[1].data[4] = HCLGE_PPU_MPF_ABNORMAL_INT2_EN; cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT1_EN);
desc[1].data[3] =
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT3_EN);
desc[1].data[4] =
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN);
} }
desc[1].data[0] = HCLGE_PPU_MPF_ABNORMAL_INT0_EN_MASK; desc[1].data[0] =
desc[1].data[1] = HCLGE_PPU_MPF_ABNORMAL_INT1_EN_MASK; cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT0_EN_MASK);
desc[1].data[2] = HCLGE_PPU_MPF_ABNORMAL_INT2_EN_MASK; desc[1].data[1] =
desc[1].data[3] |= HCLGE_PPU_MPF_ABNORMAL_INT3_EN_MASK; cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT1_EN_MASK);
desc[1].data[2] =
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN_MASK);
desc[1].data[3] |=
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT3_EN_MASK);
desc_num = 2; desc_num = 2;
} else if (cmd == HCLGE_PPU_MPF_OTHER_INT_CMD) { } else if (cmd == HCLGE_PPU_MPF_OTHER_INT_CMD) {
hclge_cmd_setup_basic_desc(&desc[0], cmd, false); hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
if (en) if (en)
desc[0].data[0] = HCLGE_PPU_MPF_ABNORMAL_INT2_EN2; desc[0].data[0] =
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN2);
desc[0].data[2] = HCLGE_PPU_MPF_ABNORMAL_INT2_EN2_MASK; desc[0].data[2] =
cpu_to_le32(HCLGE_PPU_MPF_ABNORMAL_INT2_EN2_MASK);
} else if (cmd == HCLGE_PPU_PF_OTHER_INT_CMD) { } else if (cmd == HCLGE_PPU_PF_OTHER_INT_CMD) {
hclge_cmd_setup_basic_desc(&desc[0], cmd, false); hclge_cmd_setup_basic_desc(&desc[0], cmd, false);
if (en) if (en)
desc[0].data[0] = HCLGE_PPU_PF_ABNORMAL_INT_EN; desc[0].data[0] =
cpu_to_le32(HCLGE_PPU_PF_ABNORMAL_INT_EN);
desc[0].data[2] = HCLGE_PPU_PF_ABNORMAL_INT_EN_MASK; desc[0].data[2] =
cpu_to_le32(HCLGE_PPU_PF_ABNORMAL_INT_EN_MASK);
} else { } else {
dev_err(dev, "Invalid cmd to configure PPU error interrupts\n"); dev_err(dev, "Invalid cmd to configure PPU error interrupts\n");
return -EINVAL; return -EINVAL;
...@@ -1313,10 +1325,12 @@ static int hclge_handle_pf_ras_error(struct hclge_dev *hdev, ...@@ -1313,10 +1325,12 @@ static int hclge_handle_pf_ras_error(struct hclge_dev *hdev,
/* log PPU(RCB) errors */ /* log PPU(RCB) errors */
desc_data = (__le32 *)&desc[3]; desc_data = (__le32 *)&desc[3];
status = le32_to_cpu(*desc_data) & HCLGE_PPU_PF_INT_RAS_MASK; status = le32_to_cpu(*desc_data) & HCLGE_PPU_PF_INT_RAS_MASK;
if (status) if (status) {
hclge_log_error(dev, "PPU_PF_ABNORMAL_INT_ST0", hclge_log_error(dev, "PPU_PF_ABNORMAL_INT_ST0",
&hclge_ppu_pf_abnormal_int[0], status, &hclge_ppu_pf_abnormal_int[0], status,
&ae_dev->hw_err_reset_req); &ae_dev->hw_err_reset_req);
hclge_report_hw_error(hdev, HNAE3_PPU_POISON_ERROR);
}
/* clear all PF RAS errors */ /* clear all PF RAS errors */
hclge_cmd_reuse_desc(&desc[0], false); hclge_cmd_reuse_desc(&desc[0], false);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#define __HCLGE_ERR_H #define __HCLGE_ERR_H
#include "hclge_main.h" #include "hclge_main.h"
#include "hnae3.h"
#define HCLGE_MPF_RAS_INT_MIN_BD_NUM 10 #define HCLGE_MPF_RAS_INT_MIN_BD_NUM 10
#define HCLGE_PF_RAS_INT_MIN_BD_NUM 4 #define HCLGE_PF_RAS_INT_MIN_BD_NUM 4
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
#define HCLGE_DEFAULT_UMV_SPACE_PER_PF \ #define HCLGE_DEFAULT_UMV_SPACE_PER_PF \
(HCLGE_UMV_TBL_SIZE / HCLGE_MAX_PF_NUM) (HCLGE_UMV_TBL_SIZE / HCLGE_MAX_PF_NUM)
#define HCLGE_TQP_RESET_TRY_TIMES 10 #define HCLGE_TQP_RESET_TRY_TIMES 200
#define HCLGE_PHY_PAGE_MDIX 0 #define HCLGE_PHY_PAGE_MDIX 0
#define HCLGE_PHY_PAGE_COPPER 0 #define HCLGE_PHY_PAGE_COPPER 0
...@@ -148,6 +148,8 @@ enum HLCGE_PORT_TYPE { ...@@ -148,6 +148,8 @@ enum HLCGE_PORT_TYPE {
NETWORK_PORT NETWORK_PORT
}; };
#define PF_VPORT_ID 0
#define HCLGE_PF_ID_S 0 #define HCLGE_PF_ID_S 0
#define HCLGE_PF_ID_M GENMASK(2, 0) #define HCLGE_PF_ID_M GENMASK(2, 0)
#define HCLGE_VF_ID_S 3 #define HCLGE_VF_ID_S 3
...@@ -164,6 +166,7 @@ enum HLCGE_PORT_TYPE { ...@@ -164,6 +166,7 @@ enum HLCGE_PORT_TYPE {
#define HCLGE_GLOBAL_RESET_BIT 0 #define HCLGE_GLOBAL_RESET_BIT 0
#define HCLGE_CORE_RESET_BIT 1 #define HCLGE_CORE_RESET_BIT 1
#define HCLGE_IMP_RESET_BIT 2 #define HCLGE_IMP_RESET_BIT 2
#define HCLGE_RESET_INT_M GENMASK(2, 0)
#define HCLGE_FUN_RST_ING 0x20C00 #define HCLGE_FUN_RST_ING 0x20C00
#define HCLGE_FUN_RST_ING_B 0 #define HCLGE_FUN_RST_ING_B 0
...@@ -178,6 +181,8 @@ enum HLCGE_PORT_TYPE { ...@@ -178,6 +181,8 @@ enum HLCGE_PORT_TYPE {
#define HCLGE_VECTOR0_RX_CMDQ_INT_B 1 #define HCLGE_VECTOR0_RX_CMDQ_INT_B 1
#define HCLGE_VECTOR0_IMP_RESET_INT_B 1 #define HCLGE_VECTOR0_IMP_RESET_INT_B 1
#define HCLGE_VECTOR0_IMP_CMDQ_ERR_B 4U
#define HCLGE_VECTOR0_IMP_RD_POISON_B 5U
#define HCLGE_MAC_DEFAULT_FRAME \ #define HCLGE_MAC_DEFAULT_FRAME \
(ETH_HLEN + ETH_FCS_LEN + 2 * VLAN_HLEN + ETH_DATA_LEN) (ETH_HLEN + ETH_FCS_LEN + 2 * VLAN_HLEN + ETH_DATA_LEN)
...@@ -986,4 +991,6 @@ int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid, ...@@ -986,4 +991,6 @@ int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid,
void hclge_task_schedule(struct hclge_dev *hdev, unsigned long delay_time); void hclge_task_schedule(struct hclge_dev *hdev, unsigned long delay_time);
int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev, int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev,
struct hclge_desc *desc); struct hclge_desc *desc);
void hclge_report_hw_error(struct hclge_dev *hdev,
enum hnae3_hw_error_type type);
#endif #endif
...@@ -277,9 +277,9 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) ...@@ -277,9 +277,9 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
switch (msg_q[0]) { switch (msg_q[0]) {
case HCLGE_MBX_LINK_STAT_CHANGE: case HCLGE_MBX_LINK_STAT_CHANGE:
link_status = le16_to_cpu(msg_q[1]); link_status = msg_q[1];
memcpy(&speed, &msg_q[2], sizeof(speed)); memcpy(&speed, &msg_q[2], sizeof(speed));
duplex = (u8)le16_to_cpu(msg_q[4]); duplex = (u8)msg_q[4];
/* update upper layer with new link link status */ /* update upper layer with new link link status */
hclgevf_update_link_status(hdev, link_status); hclgevf_update_link_status(hdev, link_status);
...@@ -287,7 +287,7 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) ...@@ -287,7 +287,7 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
break; break;
case HCLGE_MBX_LINK_STAT_MODE: case HCLGE_MBX_LINK_STAT_MODE:
idx = (u8)le16_to_cpu(msg_q[1]); idx = (u8)msg_q[1];
if (idx) if (idx)
memcpy(&hdev->hw.mac.supported, &msg_q[2], memcpy(&hdev->hw.mac.supported, &msg_q[2],
sizeof(unsigned long)); sizeof(unsigned long));
...@@ -301,14 +301,14 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) ...@@ -301,14 +301,14 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev)
* has been completely reset. After this stack should * has been completely reset. After this stack should
* eventually be re-initialized. * eventually be re-initialized.
*/ */
reset_type = le16_to_cpu(msg_q[1]); reset_type = (enum hnae3_reset_type)msg_q[1];
set_bit(reset_type, &hdev->reset_pending); set_bit(reset_type, &hdev->reset_pending);
set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state); set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state);
hclgevf_reset_task_schedule(hdev); hclgevf_reset_task_schedule(hdev);
break; break;
case HCLGE_MBX_PUSH_VLAN_INFO: case HCLGE_MBX_PUSH_VLAN_INFO:
state = le16_to_cpu(msg_q[1]); state = msg_q[1];
vlan_info = &msg_q[1]; vlan_info = &msg_q[1];
hclgevf_update_port_base_vlan_info(hdev, state, hclgevf_update_port_base_vlan_info(hdev, state,
(u8 *)vlan_info, 8); (u8 *)vlan_info, 8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment