Lines Matching defs:hdev

776 static int hclge_dbg_get_dfx_bd_num(struct hclge_dev *hdev, int offset,
784 ret = hclge_query_bd_num_cmd_send(hdev, desc);
786 dev_err(&hdev->pdev->dev,
797 dev_err(&hdev->pdev->dev, "The value of dfx bd_num is 0!\n");
804 int hclge_dbg_cmd_send(struct hclge_dev *hdev, struct hclge_desc *desc_src,
819 ret = hclge_cmd_send(&hdev->hw, desc_src, bd_num);
821 dev_err(&hdev->pdev->dev,
827 hclge_dbg_dump_reg_tqp(struct hclge_dev *hdev,
838 ret = hclge_dbg_get_dfx_bd_num(hdev, reg_msg->offset, &bd_num);
857 for (index = 0; index < hdev->vport[0].alloc_tqps; index++) {
860 ret = hclge_dbg_cmd_send(hdev, desc, index, bd_num,
881 hclge_dbg_dump_reg_common(struct hclge_dev *hdev,
892 ret = hclge_dbg_get_dfx_bd_num(hdev, reg_msg->offset, &bd_num);
902 ret = hclge_dbg_cmd_send(hdev, desc, 0, bd_num, reg_msg->cmd);
943 static int hclge_dbg_dump_mac_enable_status(struct hclge_dev *hdev, char *buf,
953 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
955 dev_err(&hdev->pdev->dev,
973 static int hclge_dbg_dump_mac_frame_size(struct hclge_dev *hdev, char *buf,
982 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
984 dev_err(&hdev->pdev->dev,
999 static int hclge_dbg_dump_mac_speed_duplex(struct hclge_dev *hdev, char *buf,
1012 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1014 dev_err(&hdev->pdev->dev,
1030 static int hclge_dbg_dump_mac(struct hclge_dev *hdev, char *buf, int len)
1035 ret = hclge_dbg_dump_mac_enable_status(hdev, buf, len, &pos);
1039 ret = hclge_dbg_dump_mac_frame_size(hdev, buf, len, &pos);
1043 return hclge_dbg_dump_mac_speed_duplex(hdev, buf, len, &pos);
1046 static int hclge_dbg_dump_dcb_qset(struct hclge_dev *hdev, char *buf, int len,
1054 ret = hclge_tm_get_qset_num(hdev, &qset_num);
1061 ret = hclge_dbg_cmd_send(hdev, &desc, qset_id, 1,
1077 static int hclge_dbg_dump_dcb_pri(struct hclge_dev *hdev, char *buf, int len,
1085 ret = hclge_tm_get_pri_num(hdev, &pri_num);
1092 ret = hclge_dbg_cmd_send(hdev, &desc, pri_id, 1,
1107 static int hclge_dbg_dump_dcb_pg(struct hclge_dev *hdev, char *buf, int len,
1117 for (pg_id = 0; pg_id < hdev->tm_info.num_pg; pg_id++) {
1118 ret = hclge_dbg_cmd_send(hdev, &desc, pg_id, 1,
1133 static int hclge_dbg_dump_dcb_queue(struct hclge_dev *hdev, char *buf, int len,
1142 for (nq_id = 0; nq_id < hdev->num_tqps; nq_id++) {
1143 ret = hclge_dbg_cmd_send(hdev, &desc, nq_id, 1,
1151 ret = hclge_dbg_cmd_send(hdev, &desc, nq_id, 1,
1164 static int hclge_dbg_dump_dcb_port(struct hclge_dev *hdev, char *buf, int len,
1172 ret = hclge_dbg_cmd_send(hdev, &desc, port_id, 1,
1187 static int hclge_dbg_dump_dcb_tm(struct hclge_dev *hdev, char *buf, int len,
1194 ret = hclge_dbg_cmd_send(hdev, desc, port_id, 1,
1204 ret = hclge_dbg_cmd_send(hdev, desc, port_id, 2,
1226 if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER)
1229 ret = hclge_dbg_cmd_send(hdev, desc, port_id, 1,
1249 static int hclge_dbg_dump_dcb(struct hclge_dev *hdev, char *buf, int len)
1254 ret = hclge_dbg_dump_dcb_qset(hdev, buf, len, &pos);
1258 ret = hclge_dbg_dump_dcb_pri(hdev, buf, len, &pos);
1262 ret = hclge_dbg_dump_dcb_pg(hdev, buf, len, &pos);
1266 ret = hclge_dbg_dump_dcb_queue(hdev, buf, len, &pos);
1270 ret = hclge_dbg_dump_dcb_port(hdev, buf, len, &pos);
1274 return hclge_dbg_dump_dcb_tm(hdev, buf, len, &pos);
1277 static int hclge_dbg_dump_reg_cmd(struct hclge_dev *hdev,
1288 return hclge_dbg_dump_reg_tqp(hdev, reg_info,
1291 ret = hclge_dbg_dump_reg_common(hdev, reg_info, buf,
1301 static int hclge_dbg_dump_tc(struct hclge_dev *hdev, char *buf, int len)
1310 if (!hnae3_dev_dcb_supported(hdev)) {
1311 dev_err(&hdev->pdev->dev,
1317 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1319 dev_err(&hdev->pdev->dev, "failed to get tc weight, ret = %d\n",
1327 hdev->tm_info.num_tc);
1374 static int __hclge_dbg_dump_tm_pg(struct hclge_dev *hdev, char *data_str,
1393 for (pg_id = 0; pg_id < hdev->tm_info.num_pg; pg_id++) {
1394 ret = hclge_tm_get_pg_to_pri_map(hdev, pg_id, &pri_bit_map);
1398 ret = hclge_tm_get_pg_sch_mode(hdev, pg_id, &sch_mode);
1402 ret = hclge_tm_get_pg_weight(hdev, pg_id, &weight);
1406 ret = hclge_tm_get_pg_shaper(hdev, pg_id,
1412 ret = hclge_tm_get_pg_shaper(hdev, pg_id,
1438 static int hclge_dbg_dump_tm_pg(struct hclge_dev *hdev, char *buf, int len)
1448 ret = __hclge_dbg_dump_tm_pg(hdev, data_str, buf, len);
1455 static int hclge_dbg_dump_tm_port(struct hclge_dev *hdev, char *buf, int len)
1461 ret = hclge_tm_get_port_shaper(hdev, &shaper_para);
1476 static int hclge_dbg_dump_tm_bp_qset_map(struct hclge_dev *hdev, u8 tc_id,
1488 grp_num = hdev->num_tqps <= HCLGE_TQP_MAX_SIZE_DEV_V2 ?
1497 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1499 dev_err(&hdev->pdev->dev,
1523 static int hclge_dbg_dump_tm_map(struct hclge_dev *hdev, char *buf, int len)
1533 for (queue_id = 0; queue_id < hdev->num_tqps; queue_id++) {
1534 ret = hclge_tm_get_q_to_qs_map(hdev, queue_id, &qset_id);
1538 ret = hclge_tm_get_qset_map_pri(hdev, qset_id, &pri_id,
1543 ret = hclge_tm_get_q_to_tc(hdev, queue_id, &tc_id);
1553 if (!hnae3_dev_dcb_supported(hdev))
1556 ret = hclge_dbg_dump_tm_bp_qset_map(hdev, tc_id, buf + pos,
1568 static int hclge_dbg_dump_tm_nodes(struct hclge_dev *hdev, char *buf, int len)
1576 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1578 dev_err(&hdev->pdev->dev,
1620 static int hclge_dbg_dump_tm_pri(struct hclge_dev *hdev, char *buf, int len)
1629 ret = hclge_tm_get_pri_num(hdev, &pri_num);
1646 ret = hclge_tm_get_pri_sch_mode(hdev, i, &sch_mode);
1650 ret = hclge_tm_get_pri_weight(hdev, i, &weight);
1654 ret = hclge_tm_get_pri_shaper(hdev, i,
1660 ret = hclge_tm_get_pri_shaper(hdev, i,
1701 static int hclge_dbg_dump_tm_qset(struct hclge_dev *hdev, char *buf, int len)
1712 ret = hclge_tm_get_qset_num(hdev, &qset_num);
1724 ret = hclge_tm_get_qset_map_pri(hdev, i, &priority, &link_vld);
1728 ret = hclge_tm_get_qset_sch_mode(hdev, i, &sch_mode);
1732 ret = hclge_tm_get_qset_weight(hdev, i, &weight);
1736 ret = hclge_tm_get_qset_shaper(hdev, i, &shaper_para);
1760 static int hclge_dbg_dump_qos_pause_cfg(struct hclge_dev *hdev, char *buf,
1769 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1771 dev_err(&hdev->pdev->dev,
1787 static int hclge_dbg_dump_qos_pri_map(struct hclge_dev *hdev, char *buf,
1800 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1802 dev_err(&hdev->pdev->dev,
1823 static int hclge_dbg_dump_qos_dscp_map(struct hclge_dev *hdev, char *buf,
1826 struct hnae3_knic_private_info *kinfo = &hdev->vport[0].nic.kinfo;
1843 ret = hclge_cmd_send(&hdev->hw, desc, HCLGE_DSCP_MAP_TC_BD_NUM);
1845 dev_err(&hdev->pdev->dev,
1875 static int hclge_dbg_dump_tx_buf_cfg(struct hclge_dev *hdev, char *buf, int len)
1883 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1885 dev_err(&hdev->pdev->dev,
1899 static int hclge_dbg_dump_rx_priv_buf_cfg(struct hclge_dev *hdev, char *buf,
1908 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1910 dev_err(&hdev->pdev->dev,
1929 static int hclge_dbg_dump_rx_common_wl_cfg(struct hclge_dev *hdev, char *buf,
1938 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1940 dev_err(&hdev->pdev->dev,
1955 static int hclge_dbg_dump_rx_global_pkt_cnt(struct hclge_dev *hdev, char *buf,
1964 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1966 dev_err(&hdev->pdev->dev,
1980 static int hclge_dbg_dump_rx_priv_wl_buf_cfg(struct hclge_dev *hdev, char *buf,
1991 ret = hclge_cmd_send(&hdev->hw, desc, 2);
1993 dev_err(&hdev->pdev->dev,
2016 static int hclge_dbg_dump_rx_common_threshold_cfg(struct hclge_dev *hdev,
2027 ret = hclge_cmd_send(&hdev->hw, desc, 2);
2029 dev_err(&hdev->pdev->dev,
2053 static int hclge_dbg_dump_qos_buf_cfg(struct hclge_dev *hdev, char *buf,
2059 ret = hclge_dbg_dump_tx_buf_cfg(hdev, buf + pos, len - pos);
2064 ret = hclge_dbg_dump_rx_priv_buf_cfg(hdev, buf + pos, len - pos);
2069 ret = hclge_dbg_dump_rx_common_wl_cfg(hdev, buf + pos, len - pos);
2074 ret = hclge_dbg_dump_rx_global_pkt_cnt(hdev, buf + pos, len - pos);
2080 if (!hnae3_dev_dcb_supported(hdev))
2083 ret = hclge_dbg_dump_rx_priv_wl_buf_cfg(hdev, buf + pos, len - pos);
2088 ret = hclge_dbg_dump_rx_common_threshold_cfg(hdev, buf + pos,
2096 static int hclge_dbg_dump_mng_table(struct hclge_dev *hdev, char *buf, int len)
2116 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2118 dev_err(&hdev->pdev->dev,
2157 static int hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, bool sel_x,
2183 ret = hclge_cmd_send(&hdev->hw, desc, 3);
2212 static int hclge_dbg_get_rules_location(struct hclge_dev *hdev, u16 *rule_locs)
2218 spin_lock_bh(&hdev->fd_rule_lock);
2219 hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) {
2223 spin_unlock_bh(&hdev->fd_rule_lock);
2225 if (cnt != hdev->hclge_fd_rule_num || cnt == 0)
2231 static int hclge_dbg_dump_fd_tcam(struct hclge_dev *hdev, char *buf, int len)
2233 u32 rule_num = hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1];
2240 if (!hnae3_ae_dev_fd_supported(hdev->ae_dev)) {
2241 dev_err(&hdev->pdev->dev,
2246 if (!hdev->hclge_fd_rule_num || !rule_num)
2259 rule_cnt = hclge_dbg_get_rules_location(hdev, rule_locs);
2262 dev_err(&hdev->pdev->dev,
2272 ret = hclge_dbg_fd_tcam_read(hdev, true, tcam_buf, tcam_msg);
2274 dev_err(&hdev->pdev->dev,
2281 ret = hclge_dbg_fd_tcam_read(hdev, false, tcam_buf, tcam_msg);
2283 dev_err(&hdev->pdev->dev,
2297 static int hclge_dbg_dump_fd_counter(struct hclge_dev *hdev, char *buf, int len)
2299 u8 func_num = pci_num_vf(hdev->pdev) + 1; /* pf and enabled vf num */
2308 if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
2318 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2320 dev_err(&hdev->pdev->dev, "failed to get fd counter, ret = %d\n",
2343 int hclge_dbg_dump_rst_info(struct hclge_dev *hdev, char *buf, int len)
2349 hdev->rst_stats.pf_rst_cnt);
2351 hdev->rst_stats.flr_rst_cnt);
2353 hdev->rst_stats.global_rst_cnt);
2355 hdev->rst_stats.imp_rst_cnt);
2357 hdev->rst_stats.reset_done_cnt);
2359 hdev->rst_stats.hw_reset_done_cnt);
2361 hdev->rst_stats.reset_cnt);
2363 hdev->rst_stats.reset_fail_cnt);
2369 hclge_read_dev(&hdev->hw, offset));
2372 pos += scnprintf(buf + pos, len - pos, "hdev state: 0x%lx\n",
2373 hdev->state);
2378 static int hclge_dbg_dump_serv_info(struct hclge_dev *hdev, char *buf, int len)
2390 jiffies_to_msecs(jiffies - hdev->last_serv_processed));
2393 hdev->last_serv_processed);
2395 hdev->serv_processed_cnt);
2400 static int hclge_dbg_dump_interrupt(struct hclge_dev *hdev, char *buf, int len)
2405 hdev->num_nic_msi);
2407 hdev->num_roce_msi);
2409 hdev->num_msi_used);
2411 hdev->num_msi_left);
2444 hclge_dbg_get_imp_stats_info(struct hclge_dev *hdev, char *buf, int len)
2455 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2457 dev_err(&hdev->pdev->dev,
2465 dev_err(&hdev->pdev->dev, "imp statistics bd number is 0!\n");
2473 ret = hclge_dbg_cmd_send(hdev, desc_src, 0, bd_num,
2477 dev_err(&hdev->pdev->dev,
2519 hclge_dbg_dump_ncl_config(struct hclge_dev *hdev, char *buf, int len)
2538 ret = hclge_dbg_cmd_send(hdev, desc, data0, bd_num,
2549 static int hclge_dbg_dump_loopback(struct hclge_dev *hdev, char *buf, int len)
2551 struct phy_device *phydev = hdev->hw.mac.phydev;
2563 hdev->hw.mac.mac_id);
2566 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2568 dev_err(&hdev->pdev->dev,
2579 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2581 dev_err(&hdev->pdev->dev,
2600 } else if (hnae3_dev_phy_imp_supported(hdev)) {
2611 * @hdev: pointer to struct hclge_dev
2614 hclge_dbg_dump_mac_tnl_status(struct hclge_dev *hdev, char *buf, int len)
2623 while (kfifo_get(&hdev->mac_tnl_log, &stats)) {
2642 static void hclge_dbg_dump_mac_list(struct hclge_dev *hdev, char *buf, int len,
2664 for (func_id = 0; func_id < hdev->num_alloc_vport; func_id++) {
2665 vport = &hdev->vport[func_id];
2685 static int hclge_dbg_dump_umv_info(struct hclge_dev *hdev, char *buf, int len)
2687 u8 func_num = pci_num_vf(hdev->pdev) + 1;
2693 hdev->num_alloc_vport);
2695 hdev->max_umv_size);
2697 hdev->wanted_umv_size);
2699 hdev->priv_umv_size);
2701 mutex_lock(&hdev->vport_lock);
2703 hdev->share_umv_size);
2705 vport = &hdev->vport[i];
2710 mutex_unlock(&hdev->vport_lock);
2713 hdev->used_mc_mac_num);
2718 static int hclge_get_vlan_rx_offload_cfg(struct hclge_dev *hdev, u8 vf_id,
2734 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2736 dev_err(&hdev->pdev->dev,
2753 static int hclge_get_vlan_tx_offload_cfg(struct hclge_dev *hdev, u8 vf_id,
2768 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2770 dev_err(&hdev->pdev->dev,
2790 static int hclge_get_vlan_filter_config_cmd(struct hclge_dev *hdev,
2802 ret = hclge_cmd_send(&hdev->hw, desc, 1);
2804 dev_err(&hdev->pdev->dev,
2811 static int hclge_get_vlan_filter_state(struct hclge_dev *hdev, u8 vlan_type,
2818 ret = hclge_get_vlan_filter_config_cmd(hdev, vlan_type, vf_id, &desc);
2828 static int hclge_get_port_vlan_filter_bypass_state(struct hclge_dev *hdev,
2835 if (!test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, hdev->ae_dev->caps))
2842 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
2844 dev_err(&hdev->pdev->dev,
2880 static int hclge_dbg_dump_vlan_filter_config(struct hclge_dev *hdev, char *buf,
2886 u8 func_num = pci_num_vf(hdev->pdev) + 1; /* pf and enabled vf num */
2889 ret = hclge_get_vlan_filter_state(hdev, HCLGE_FILTER_TYPE_PORT, 0,
2906 ret = hclge_get_vlan_filter_state(hdev, HCLGE_FILTER_TYPE_VF, i,
2913 ret = hclge_get_port_vlan_filter_bypass_state(hdev, i, &bypass);
2922 hdev->ae_dev->caps) ? state_str[bypass] : "NA";
2933 static int hclge_dbg_dump_vlan_offload_config(struct hclge_dev *hdev, char *buf,
2939 u8 func_num = pci_num_vf(hdev->pdev) + 1; /* pf and enabled vf num */
2949 ret = hclge_get_vlan_tx_offload_cfg(hdev, i, &vlan_cfg);
2953 ret = hclge_get_vlan_rx_offload_cfg(hdev, i, &vlan_cfg);
2984 static int hclge_dbg_dump_vlan_config(struct hclge_dev *hdev, char *buf,
2990 ret = hclge_dbg_dump_vlan_filter_config(hdev, buf, len, &pos);
2994 return hclge_dbg_dump_vlan_offload_config(hdev, buf, len, &pos);
2997 static int hclge_dbg_dump_ptp_info(struct hclge_dev *hdev, char *buf, int len)
2999 struct hclge_ptp *ptp = hdev->ptp;
3035 ret = hclge_ptp_cfg_qry(hdev, &hw_cfg);
3048 static int hclge_dbg_dump_mac_uc(struct hclge_dev *hdev, char *buf, int len)
3050 hclge_dbg_dump_mac_list(hdev, buf, len, true);
3055 static int hclge_dbg_dump_mac_mc(struct hclge_dev *hdev, char *buf, int len)
3057 hclge_dbg_dump_mac_list(hdev, buf, len, false);
3218 struct hclge_dev *hdev = vport->back;
3225 return cmd_func->dbg_dump(hdev, buf, len);
3227 return cmd_func->dbg_dump_reg(hdev, cmd, buf,
3232 dev_err(&hdev->pdev->dev, "invalid command(%d)\n", cmd);