Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11619743ybi; Thu, 25 Jul 2019 20:28:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDOQRGtb7KlX5BEj/38hmEh1DAL66kvXwZbKmOkeMMBUStpoMi3XF0CchECFlSHbD+7sp5 X-Received: by 2002:aa7:8b55:: with SMTP id i21mr19955081pfd.155.1564111705931; Thu, 25 Jul 2019 20:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564111705; cv=none; d=google.com; s=arc-20160816; b=H9PWQHcC+luNdSCMy6mZkp5/DiY+ctRl0rm28T9Cta3ogttH/7R3Eba6G3If8GXZyW B9cmKIp2Yt0W2KGhHnuXxKTA9JZelmX7r9S2sv03aferU/q1TzkilwsbdW29o9dVBvhH HxxPFhCbvhBGD7Dz/cH/RLjhdYrqPb33pyzRrqRsbEi6Cpj8ccsxuakcPnctkwMoXK4t 5xZSDySWJHvtsiR5LlFZ2iNpZPkQNVcbr10BBNuFIgdyX8aaKlgdGTm9sMtgjbeK0Dt8 q/d5v71XeHUZIk4GDZ3OcqPJZp3ZT2M9AmoxsfCq4QPxZrYO3Vj4r/SZpYZb1tKQycTq MwTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=8zxlO7CHE9RWSEA7paWGtuMkrS2eWIeczk9ki1RWbcA=; b=c1NxERuLZ46cYYmaEBGRBWQ2GVpmcLrG4deC5lx85c4SboXgwtqsr4h0hEm00x5xLx 8NQ0SnZF3cfYlRetWCh+k5TYfdYtwDQWEVb4zAlrfc0r/bEN7NXYnewYmkBAmRDrPYP6 pF0IFfyZAqgZQgTB+Sclh/eAUq181p/9hkjcfiKz+NpRa6er6UWLXB7BN33tW5dTL4Kl b/6zuZkLdM53WNFe2HoAwAbLN0IOk/wYvV0kUG0wh6bXgCS3jNNoOQMAEc07J6e2jOV9 pKS4WWCb2HM+ZAcUzBIeyGYWpBJFEWAlRbJtJsww7iK+YIHyjiA9O4wmunFVXhYyliHI Rw/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k23si19615737pgb.228.2019.07.25.20.28.11; Thu, 25 Jul 2019 20:28:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbfGZD1R (ORCPT + 99 others); Thu, 25 Jul 2019 23:27:17 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3169 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726441AbfGZD1Q (ORCPT ); Thu, 25 Jul 2019 23:27:16 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1BEE8C55359557F0E3CA; Fri, 26 Jul 2019 11:27:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Fri, 26 Jul 2019 11:26:59 +0800 From: Huazhong Tan To: CC: , , , , , Yonglong Liu , Peng Li , Huazhong Tan Subject: [PATCH V2 net-next 07/11] net: hns3: adds debug messages to identify eth down cause Date: Fri, 26 Jul 2019 11:24:58 +0800 Message-ID: <1564111502-15504-8-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564111502-15504-1-git-send-email-tanhuazhong@huawei.com> References: <1564111502-15504-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonglong Liu Some times just see the eth interface have been down/up via dmesg, but can not know why the eth down. So adds some debug messages to identify the cause for this. Signed-off-by: Yonglong Liu Signed-off-by: Peng Li Signed-off-by: Huazhong Tan --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 24 ++++++++++++++++++++ drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 26 ++++++++++++++++++++++ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 14 ++++++++++++ 3 files changed, 64 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4d58c53..2e30cfa 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -459,6 +459,10 @@ static int hns3_nic_net_open(struct net_device *netdev) h->ae_algo->ops->set_timer_task(priv->ae_handle, true); hns3_config_xps(priv); + + if (netif_msg_drv(h)) + netdev_info(netdev, "net open\n"); + return 0; } @@ -519,6 +523,9 @@ static int hns3_nic_net_stop(struct net_device *netdev) if (test_and_set_bit(HNS3_NIC_STATE_DOWN, &priv->state)) return 0; + if (netif_msg_drv(h)) + netdev_info(netdev, "net stop\n"); + if (h->ae_algo->ops->set_timer_task) h->ae_algo->ops->set_timer_task(priv->ae_handle, false); @@ -1550,6 +1557,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) h = hns3_get_handle(netdev); kinfo = &h->kinfo; + if (netif_msg_drv(h)) + netdev_info(netdev, "setup tc: num_tc=%d\n", tc); + return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; } @@ -1593,6 +1603,11 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, struct hnae3_handle *h = hns3_get_handle(netdev); int ret = -EIO; + if (netif_msg_drv(h)) + netdev_info(netdev, + "set vf vlan: vf=%d, vlan=%d, qos=%d, vlan_proto=%d\n", + vf, vlan, qos, vlan_proto); + if (h->ae_algo->ops->set_vf_vlan_filter) ret = h->ae_algo->ops->set_vf_vlan_filter(h, vf, vlan, qos, vlan_proto); @@ -1611,6 +1626,10 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) if (!h->ae_algo->ops->set_mtu) return -EOPNOTSUPP; + if (netif_msg_drv(h)) + netdev_info(netdev, "change mtu from %d to %d\n", + netdev->mtu, new_mtu); + ret = h->ae_algo->ops->set_mtu(h, new_mtu); if (ret) netdev_err(netdev, "failed to change MTU in hardware %d\n", @@ -4395,6 +4414,11 @@ int hns3_set_channels(struct net_device *netdev, if (kinfo->rss_size == new_tqp_num) return 0; + if (netif_msg_drv(h)) + netdev_info(netdev, + "set channels: tqp_num=%d, rxfh=%d\n", + new_tqp_num, rxfh_configured); + ret = hns3_reset_notify(h, HNAE3_DOWN_CLIENT); if (ret) return ret; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index e71c92b..08334d7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -311,6 +311,9 @@ static void hns3_self_test(struct net_device *ndev, if (eth_test->flags != ETH_TEST_FL_OFFLINE) return; + if (netif_msg_drv(h)) + netdev_info(ndev, "self test start\n"); + st_param[HNAE3_LOOP_APP][0] = HNAE3_LOOP_APP; st_param[HNAE3_LOOP_APP][1] = h->flags & HNAE3_SUPPORT_APP_LOOPBACK; @@ -374,6 +377,9 @@ static void hns3_self_test(struct net_device *ndev, if (if_running) ndev->netdev_ops->ndo_open(ndev); + + if (netif_msg_drv(h)) + netdev_info(ndev, "self test end\n"); } static int hns3_get_sset_count(struct net_device *netdev, int stringset) @@ -604,6 +610,11 @@ static int hns3_set_pauseparam(struct net_device *netdev, { struct hnae3_handle *h = hns3_get_handle(netdev); + if (netif_msg_drv(h)) + netdev_info(netdev, + "set pauseparam: autoneg=%d, rx:%d, tx:%d\n", + param->autoneg, param->rx_pause, param->tx_pause); + if (h->ae_algo->ops->set_pauseparam) return h->ae_algo->ops->set_pauseparam(h, param->autoneg, param->rx_pause, @@ -743,6 +754,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev, if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF) return -EINVAL; + if (netif_msg_drv(handle)) + netdev_info(netdev, + "set link(%s): autoneg=%d, speed=%d, duplex=%d\n", + netdev->phydev ? "phy" : "mac", + cmd->base.autoneg, cmd->base.speed, + cmd->base.duplex); + /* Only support ksettings_set for netdev with phy attached for now */ if (netdev->phydev) return phy_ethtool_ksettings_set(netdev->phydev, cmd); @@ -984,6 +1002,10 @@ static int hns3_nway_reset(struct net_device *netdev) return -EINVAL; } + if (netif_msg_drv(handle)) + netdev_info(netdev, "nway reset (using %s)\n", + phy ? "phy" : "mac"); + if (phy) return genphy_restart_aneg(phy); @@ -1308,6 +1330,10 @@ static int hns3_set_fecparam(struct net_device *netdev, if (!ops->set_fec) return -EOPNOTSUPP; fec_mode = eth_to_loc_fec(fec->fec); + + if (netif_msg_drv(handle)) + netdev_info(netdev, "set fecparam: mode=%d\n", fec_mode); + return ops->set_fec(handle, fec_mode); } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c index bac4ce1..07471ba 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -201,6 +201,7 @@ static int hclge_client_setup_tc(struct hclge_dev *hdev) static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) { struct hclge_vport *vport = hclge_get_vport(h); + struct net_device *netdev = h->kinfo.netdev; struct hclge_dev *hdev = vport->back; bool map_changed = false; u8 num_tc = 0; @@ -215,6 +216,9 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) return ret; if (map_changed) { + if (netif_msg_drv(h)) + netdev_info(netdev, "set ets\n"); + ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); if (ret) return ret; @@ -300,6 +304,7 @@ static int hclge_ieee_getpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) { struct hclge_vport *vport = hclge_get_vport(h); + struct net_device *netdev = h->kinfo.netdev; struct hclge_dev *hdev = vport->back; u8 i, j, pfc_map, *prio_tc; @@ -325,6 +330,11 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) hdev->tm_info.hw_pfc_map = pfc_map; hdev->tm_info.pfc_en = pfc->pfc_en; + if (netif_msg_drv(h)) + netdev_info(netdev, + "set pfc: pfc_en=%d, pfc_map=%d, num_tc=%d\n", + pfc->pfc_en, pfc_map, hdev->tm_info.num_tc); + hclge_tm_pfc_info_update(hdev); return hclge_pause_setup_hw(hdev, false); @@ -345,8 +355,12 @@ static u8 hclge_getdcbx(struct hnae3_handle *h) static u8 hclge_setdcbx(struct hnae3_handle *h, u8 mode) { struct hclge_vport *vport = hclge_get_vport(h); + struct net_device *netdev = h->kinfo.netdev; struct hclge_dev *hdev = vport->back; + if (netif_msg_drv(h)) + netdev_info(netdev, "set dcbx: mode=%d\n", mode); + /* No support for LLD_MANAGED modes or CEE */ if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || (mode & DCB_CAP_DCBX_VER_CEE) || -- 2.7.4